From patchwork Mon Oct 24 11: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: 8861 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433072wru; Mon, 24 Oct 2022 05:48:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5bZQrBYL/0lf1nHzSohvvE1BG7ApLjTD8yh+6fiG39kbxQOsjc3I26PRi3IWf+0PtKWu9u X-Received: by 2002:a17:903:2307:b0:17f:78a5:5484 with SMTP id d7-20020a170903230700b0017f78a55484mr33518395plh.15.1666615711223; Mon, 24 Oct 2022 05:48:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615711; cv=none; d=google.com; s=arc-20160816; b=dchAl0kgqGJaE7r3LLna94ccceFoLs1YFWADwhDLvrL6WQ5LTUzMV/TY/PFGKcEjY8 QGvQi1aScSInNEOwQjNxYXgyLB1x5R4YiQOCTGhlmAm7LAftvslIYnmhgY+euthoHMQJ 6njVTJcmiRMWSe1asTupmhgJikuZPRMk1YLCLadARJlD9ez6bHS8pOPyryfSXKr6tJhf asN8TJAW3qouZCPsdRp08MZBH88jzrW5+TY6+IFg+aihaJcNob32gZz+fF6HtNLjfFee eArcbTRl3pdiPH3jDv9JqlsRthYUNMB7CdCygOyjRpS8qaWOH+063Cqlqbq3trPCqZRN of+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=fMTU+Kggvvg7kvqlunqAQMIKM1MWqcAMka+GLX5vcTc=; b=ZXZ4p899O1Sr2dnKxYuwk9WnsdmopRV0t3Kd/U3j+xWNsiQFnvAqbXjAF0i00vtRME TJWe1LNLwZFdpe4djizjw188lRt4R1bapfjUS3/TqH6us/QqpAhfb6cAj5s4Fasxi1Fp 637dDan16KTAyFjGAWSZ2I3kfWNAtuX0ElE8nya83H/glnZ4UD2jb+uvIu/tCTM5zm0m JjonUgzLlatFLRlIu3IKMpySi1JpYI/hDAluGiFrTA8NHPpYKD7PjJtaCv64epMlrkJQ 8KZuj5TWBq8tGCO1PpnvhjIDpOd/AKcvLlWEOI5ZfH6WV+qcYmhcN0ZtcH4C+6ekBZjP LafA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hXzecuUr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f15-20020a056a00228f00b00556c1c66b61si3090063pfe.143.2022.10.24.05.48.14; Mon, 24 Oct 2022 05:48:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hXzecuUr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231584AbiJXMkt (ORCPT + 99 others); Mon, 24 Oct 2022 08:40:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232017AbiJXMgv (ORCPT ); Mon, 24 Oct 2022 08:36:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0421C89830; Mon, 24 Oct 2022 05:06:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 38D33612D2; Mon, 24 Oct 2022 12:05:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A7DEC433C1; Mon, 24 Oct 2022 12:05:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613129; bh=WPMtADYKcNR6ClKvdDNddtOONdzXkZDJTJ5hrPhY3hM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hXzecuUra+DX0jTjeI6gB5yEftan+4Ho+NnuYjTZmgUpUNtFBbF1P/It9yvb4xCX3 uPcReAGXCyAX+GOKbkXmWF6+M1R6OVVD9Kx5IXj5OdBU1peP+hGAJ1AdFkcVCMn33A q6rT9AIgveEj96FrGBEKeGNh7D/NBYxF8F2lksKU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.4 002/255] ALSA: rawmidi: Drop register_mutex in snd_rawmidi_free() Date: Mon, 24 Oct 2022 13:28:32 +0200 Message-Id: <20221024113002.546814497@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573235798537291?= X-GMAIL-MSGID: =?utf-8?q?1747573235798537291?= 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 @@ -1662,10 +1662,8 @@ static int snd_rawmidi_free(struct snd_r snd_info_free_entry(rmidi->proc_entry); rmidi->proc_entry = NULL; - mutex_lock(®ister_mutex); if (rmidi->ops && rmidi->ops->dev_unregister) rmidi->ops->dev_unregister(rmidi); - mutex_unlock(®ister_mutex); snd_rawmidi_free_substreams(&rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT]); snd_rawmidi_free_substreams(&rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT]); From patchwork Mon Oct 24 11: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: 9107 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456092wru; Mon, 24 Oct 2022 06:33:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6GrqqDxoHMEZB7tboEgj8j93xShWf4lw5xQ4DwWr1qJFf8dxF/6KljExzopJLa/y0VL9Yi X-Received: by 2002:a17:902:64c1:b0:186:827e:a0da with SMTP id y1-20020a17090264c100b00186827ea0damr15964898pli.94.1666618413499; Mon, 24 Oct 2022 06:33:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618413; cv=none; d=google.com; s=arc-20160816; b=Hih8Zwj/6fyDc5LnU+P02/3tUuWsIMWHAgdT5LcpgUnsTJ56Gtxa9JGh/5A1kOfdY1 HX5oui7aKba5UDnpi64pA/oNq4+9qkQ2ku8MnF9iCPG4iWYauoRmTpPEXnJwqz28vEzD OheHFCoqUk5jgywn7nV7EBDEZDAFtXE/GDScvJeXNSn4ok2GKjUFy/kMAhfxrPqi0K7l cWNteNc2Sog85/YhnYV6jOjl6xxydroDnCgdDchxub3He1DuhhAehEk8t64xn6YFmojW V1nlG2biR2B13sz5lrBlqzefbCnfyveIPvpYi2lQBa+jp5Q5ATwizjoY14d3IqQJZc6H 1e1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=G9QD/wg/KrzCV4UvgbmU8/IuGt7DfqZU+XESYSAwNaU=; b=W1k1yypurP4JL3XbWx8kbmu17eciznRTaT679mHFfbBouV4+kU6DBHJNOn4dB/YO+/ dbtBSvYX1G6qCj8rucHPszuW95VIIyyR/iSvVd/NmPqQ/wKFgRZmTU/AQGmoQN+1x0r/ WvzUe3JtkQCI8LzuOCk0cFp2Q3OWlypAxk3cHJtQ2tsDlUoj1tspguy09pl6AZs8wn7K 0SvK4qbMmYjHweiA2B8S/aAiXiZUyN34pMwe1jcVaMUmp2tcPte5xqusgkdu02DNOeBT Rwi3s86YohjHkqqc+7cniIz0+UHSQC6rZKTBKfQj0LkkLVD2hnRmdI5naT4xTUG+piSF N56A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kl7wiOgk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a63be4c000000b0043c075717a1si38291180pgo.361.2022.10.24.06.33.20; Mon, 24 Oct 2022 06: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=kl7wiOgk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235918AbiJXNRK (ORCPT + 99 others); Mon, 24 Oct 2022 09:17:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235858AbiJXNQO (ORCPT ); Mon, 24 Oct 2022 09:16:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD9FEA3BB8; Mon, 24 Oct 2022 05:26: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 5F1D1B8119C; Mon, 24 Oct 2022 12:05:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBE9FC433D6; Mon, 24 Oct 2022 12:05:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613140; bh=pAwobHGd7rI9q02A/QyEcxD2Xk97vhOaQ/88etUXOkw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kl7wiOgk3TWOZAq5uIez1bmi86pshSJYLYBXLC5Zc2H9ixUPPrpNLA5bEaLJvQREw CHgf0to9C5yj3FpVKfZpxpM4txQbIkZIpfv2f7ly5GZcsT8itHegMjBqlruHBzY5K7 WV98Ctq98kzpLXVcIFHeMaitqUhQm+rMqFIGBhOk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.4 003/255] ALSA: usb-audio: Fix potential memory leaks Date: Mon, 24 Oct 2022 13:28:33 +0200 Message-Id: <20221024113002.575449452@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576069316272706?= X-GMAIL-MSGID: =?utf-8?q?1747576069316272706?= 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 @@ -977,6 +977,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; @@ -996,8 +997,6 @@ static int sync_ep_set_params(struct snd u->urb->complete = snd_complete_urb; } - ep->nurbs = SYNC_URBS; - return 0; out_of_memory: From patchwork Mon Oct 24 11: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: 8879 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433319wru; Mon, 24 Oct 2022 05:49:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6lyufHIY7fgI5svQRZb6GD3b3ziWLH/B2R+Kfr/XiJ81HomawdxahyKb/Ie5n3LhwzY7Qx X-Received: by 2002:a65:5583:0:b0:461:25fe:e982 with SMTP id j3-20020a655583000000b0046125fee982mr27832785pgs.4.1666615747775; Mon, 24 Oct 2022 05:49:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615747; cv=none; d=google.com; s=arc-20160816; b=MSs7IQ0LE9lQjSUSi2Wc03ZjHgiawQa2DwjxxF+136COP8twM12sgE5cEqzMszzEEU pNcHbgEczsuaCxIv5Q9bExuNQW1QHKHPiD+xb7ur8vsizwp8fRsk/4dDjxY0/SHlAmma 9yHLL0KD5y0T3eOEyyTGWi8kQ443bynjBveSadd8W//KDxyejta4zOaq8kJpEn4jNhLf mkzl8xPygVf9+MooEQFrE43cqGYsdXD+uoVs77fn9dbnuFmz6XRc8IUX2dFGftejfc80 56yVUWRzmJQSVJkwLKY40bJDd5O71MPdgtbQXgw2tCNlo1e+rU8CG9QbqLh/2/w+qoHY JEGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vLR9Hr4pXaDXczSJ/XRKFG6VHjgezLfmfS/NgjnLuts=; b=aRHBYi51FpoIYqHfy86r0A/LYD5F3C8nsqIYar0wlieO8FuGYoQ3WiubrxHC7tT9Sr 9zfJ9STCpGS0Neykw7bDNdzDt+L161VyV3UaT/cnG15wVCqDmI9/wcyg0scB9hpPVC2T SEY/AAc3VJgCUKG6mfFZomJqS0w0IvQHbCUm7WEZPVjHYksf5QctJd6BBVRMuAB3/xef E3SM7Km5gYdKmSLOCE8+3LcOhOholXpSSCnZ+GDk0vEn6SGKjpcxSW0kpqAEmOE5skCZ zkglstiTEWUpC/I7CfzXHzS6Ii/sodO3qi8QZWaBayx44QI/8HSV4glw3flWuv9or/FG TE5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QO97NfF4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056a0022d400b0052f60f7e0bcsi39167865pfj.346.2022.10.24.05.48.53; Mon, 24 Oct 2022 05:49: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=QO97NfF4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233797AbiJXMn2 (ORCPT + 99 others); Mon, 24 Oct 2022 08:43:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234060AbiJXMly (ORCPT ); Mon, 24 Oct 2022 08:41: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 9F07C8D218; Mon, 24 Oct 2022 05:08: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 60BEE612BE; Mon, 24 Oct 2022 12:05:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72CA6C433D6; Mon, 24 Oct 2022 12:05:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613142; bh=Lo+CknCpFzfV4+jmHuHa+7rRUKqZ5GoheRpToAyZR2Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QO97NfF48frsnZhEIHV5UKd50NhgCd95UmlQn2GM40I2o9PBVLtoWjs0KfLEAYwB2 kvmQS3YnyrPbfM358PhHmtPgunVxDcrlCkxUCoF52Rq94d3Bu7cvjVWjIxgZvorcly 4RgniGtcK1qp1qbtdis8HFyhMxmXz9jVMXBc0GLo= 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.4 004/255] ALSA: usb-audio: Fix NULL dererence at error path Date: Mon, 24 Oct 2022 13:28:34 +0200 Message-Id: <20221024113002.604515314@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573274454331721?= X-GMAIL-MSGID: =?utf-8?q?1747573274454331721?= 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 @@ -73,12 +73,13 @@ static inline unsigned get_usb_high_spee */ static void release_urb_ctx(struct snd_urb_ctx *u) { - if (u->buffer_size) + if (u->urb && u->buffer_size) usb_free_coherent(u->ep->chip->dev, u->buffer_size, u->urb->transfer_buffer, u->urb->transfer_dma); usb_free_urb(u->urb); u->urb = NULL; + u->buffer_size = 0; } static const char *usb_error_string(int err) From patchwork Mon Oct 24 11: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: 9130 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456517wru; Mon, 24 Oct 2022 06:34:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4EMwycV/AX/iOZ8ShwmkwyVRnPNlC3Wv5y1wyUliLuz0moqCbUcnBT/scobFHuBZY9RiTg X-Received: by 2002:a17:90a:a415:b0:20a:f813:83a3 with SMTP id y21-20020a17090aa41500b0020af81383a3mr39086886pjp.238.1666618460774; Mon, 24 Oct 2022 06:34:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618460; cv=none; d=google.com; s=arc-20160816; b=OVkGa737Ewp/LPvNBDmxVjcmY3Geg4wa+iyvVFAh+vTtx1HeCzjAi2YLrqrhU+fS9R rkjsV38vnPXg1tTI6QXs/VTgbP6A14CZE1NtVttySDajtEdV6B3/U/lHYijjVE5PdI0F Vqv4yLkTVUBw+xm+issXV77X3DFIY1+lNlZqpMn4ZXd6B02CB4wjTeYYi62GKtTS/huv Xcxnay6Kzy4tErlC0iPcXi2r4Kbke8t8SC7UxbCes3CuS76WuVaC8t/Z27raaZ/ZxDV/ r546F+YnDduGEBd864WXJ7b4DOUvaWXiFNCG+ewrJ1NNjFuD10U7/VxU4QZ8HobLifSo SWCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=C6IAUMiAxMB2o/oEr9viw+sWxMc1ZYztwU0143LliyA=; b=HlUY8cD5qbfae3Z9rEP9HnC0IVfQlf/n5OOo6T1B7a2xipwpr3X/BM7jo/B8uuNdPv b0v+f6jENorwTFLHPrKNFJ9wGsfXGOcP0iRZ+hhWdCHAyvTnuf/Sn/2j/5BgnkWBYMCK 4A6tw/0RTrpP/DGivB4SKRtaqdYpvOaOk/EAS9lrRzG6HdAZ2lUz/yhZ9L+KJ5Hb0vfw 6dD4XxonCOxgp3YDk/Cus44UOl2C48lp9lAAVGA8Fqb8zd8D1GoaOxL4zBxctsnoXh9X odVdleG7K7ssFnfJHOu8J9nmUvrFYtVASAGdLfUBCkSnGeJvqgSIU8QdQ6Isx2YQ9ZW0 hakw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=n5uz2h2f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x6-20020a170902ec8600b0017535568d5dsi40629336plg.256.2022.10.24.06.34.07; Mon, 24 Oct 2022 06:34: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=n5uz2h2f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231863AbiJXNVN (ORCPT + 99 others); Mon, 24 Oct 2022 09:21:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236257AbiJXNTn (ORCPT ); Mon, 24 Oct 2022 09:19: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 1855AA6C05; Mon, 24 Oct 2022 05:28: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 B55BEB810F5; Mon, 24 Oct 2022 12:05:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17D46C433C1; Mon, 24 Oct 2022 12:05:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613145; bh=dZdoUx1cfGig2aKa5ufWKxeODt8wBSQvHb3m16sWYFM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n5uz2h2fZzRfw4GyLmFXgOy6EC6g1j4r9VwF79NGKFPUWSv3/ExdBL2cCs+aiwZSO iHP8TopRLBa9Q3qvd2IP4Yi9rUhL4BFYZ1bwLm8e8LbTGsLCRhyImVE6DjyLVQIVB6 gbm/O9NidLTmCkvCVQdEKxeoNi1zv79XDWLsDkr4= 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.4 005/255] ALSA: hda/realtek: remove ALC289_FIXUP_DUAL_SPK for Dell 5530 Date: Mon, 24 Oct 2022 13:28:35 +0200 Message-Id: <20221024113002.638783406@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576119511851125?= X-GMAIL-MSGID: =?utf-8?q?1747576119511851125?= 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 @@ -8138,7 +8138,6 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC), SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC), SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB), - SND_PCI_QUIRK(0x1028, 0x087d, "Dell Precision 5530", ALC289_FIXUP_DUAL_SPK), SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB), From patchwork Mon Oct 24 11: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: 9803 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp554798wru; Mon, 24 Oct 2022 09:58:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4SOhjsfv3UCa6Qh9TNppTR98tInVKRY/crMLaEerq2qY77cznm5TDqymvw+HyUefjzxrIY X-Received: by 2002:a63:ed07:0:b0:442:87:3a38 with SMTP id d7-20020a63ed07000000b0044200873a38mr29497230pgi.216.1666630684692; Mon, 24 Oct 2022 09:58:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630684; cv=none; d=google.com; s=arc-20160816; b=Nn4/2qdXXRs+45EjTE+Y4yXS7CfO1Uymkh6QgTVuFhCWuqv3u0hJeJhK7h0RXqax5A 0wYOWFyyQ02Oanv/XfFRlKC1ixZjoym/97kdpVp1JJEH+93vXBzAKURcamCg4QeDJX91 hgNVjNgEcOXqN/Iis1VB/ZMl/Fw1XRUxnaTz4sSFUQCseqeIir2/GwEkfn/y8fyM8Aax 6B5Es2rCbbwKmghNocRmR0Hwco+cL5S+lljZ8uOoNYrpiJ65qwCD4qaIRD2BWhxZU5xl 4aY2ElYmpTgszgVkhXKagG7IWrGAvYlISFKtw+uf8UBkjIRI7c9MuDvJJK8ofVPDmqw0 Nz6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wv+HCoKe0hkDuJ7SyoOMbPMce6eOTJQ41K75k0gTlCU=; b=Gns4phs8RA1O3I2ewFon5JxNvefHrWG80q7hjHz9+UVBRqf6uexhiQbneXKmnQbLVL eluMFBM1lIDypg+3D9YbWfIBKi01thzwmQAneqfrs5y9csi1S4KpkRxAUqwZhTTWjpgr kr8ixFcD9W8WCfyJb1/KKFTsXgYeBSlOAob63mpwMErLUvd1mGXnyFWPJIfYzXCs73he IrjfmR/+zo8B1VmaaS8aS0ZCYZ6HxRO123lLQvPF3JCFMf6vsuj2SfYKznSJ7upsX+b7 2I7TWVpEJcd1mPjObhSNDQGD8gvQpxlGrEOwjvB1vk41g4ODG31jQjXF66Y3ZCTlagt/ 7nQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yP0tTAax; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p22-20020a17090a429600b0020b304225b4si8948613pjg.104.2022.10.24.09.57.48; Mon, 24 Oct 2022 09: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=yP0tTAax; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235220AbiJXQyS (ORCPT + 99 others); Mon, 24 Oct 2022 12:54:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235473AbiJXQtm (ORCPT ); Mon, 24 Oct 2022 12:49: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 C31541F2D4; Mon, 24 Oct 2022 08:32: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 65F27B811F3; Mon, 24 Oct 2022 12:05:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B45D1C433C1; Mon, 24 Oct 2022 12:05:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613148; bh=SBowlJ1c0DUb3hOW8qotgHtHvdNGZkTT+DKRGLY4YmQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yP0tTAaxq4UaIaX3YHNaLC8c2b8e74uYwX6PiebHbcy5aC/98JLARY/ggY8o5QKNz YeTj5jQOz0/KKtzKqKCi9J5H5wpXFN3dRiuvVV4tjtiZ2NLUYMXc2i9UPbRkeEU1om lQFK36owMyixG7gS/xaK+A+XBxHh1rXoXPrd9MMM= 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.4 006/255] ALSA: hda/realtek: Correct pin configs for ASUS G533Z Date: Mon, 24 Oct 2022 13:28:36 +0200 Message-Id: <20221024113002.672004278@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747588937292495518?= X-GMAIL-MSGID: =?utf-8?q?1747588937292495518?= 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 @@ -7775,11 +7775,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 Mon Oct 24 11: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: 8874 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433221wru; Mon, 24 Oct 2022 05:48:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5x2x9xcmQLxsIFJuBQu8kXtax44fx2kkZ/wEJOOPSfgsTHLoiQWtaU96kuaYUTsTEsdxXP X-Received: by 2002:aa7:96c7:0:b0:56b:c569:99c with SMTP id h7-20020aa796c7000000b0056bc569099cmr5898621pfq.4.1666615731510; Mon, 24 Oct 2022 05:48:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615731; cv=none; d=google.com; s=arc-20160816; b=JCMJ/tHWEEbEwvWA4mrILy+ln2gaXiHBnDrCZErgOJ4L/96HazFLJ0tzStFK6PM/fZ EqvUdl+K3jWg0MEdk/tzZb0mjYVvfyONZ3tlBBpGFLCjcTeSNgdtepWUvtwDDD6+IFSv x07s9wJ0RaJ2cMg0Yk8oSqIhmdL7Ag2k8n/MdxvQ0OL2ydaRVoFQNFilv0MQLBdtWU8x v5QotmQJ7BIDihanKmFwpeQGSTM+3fRnmAt3qL5cr1HJvp2nBzrHZ4rWajQE8068yoiv kPgwb5V45WI8OzfQh7mc5s3AqHtFqCS6qyMPJFu7nX72J0NPSIKU89H1hO9+8psWbvgk 6IwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6IEbXRrrcT21O+eX0aK8t3qoU4VG3oIibYj9Tbyb3yU=; b=bAOpeYEjIm5L0bnUWymNGsRmRUTjhtOUuGTot89iNuhETcJfULzFFwzVgvzaGSLGGv QxbsD/LXt5QbzcDGZHpZXh7ozx83FFdSTYwsipqLtnxq8NnKEAOWDAL58h7bANVCbA3o 9l4dIpv4stxmS6K9CnMLZPxt3lZ5JZVSQ7nDpi+ctEWsIgd6TgvmGvqWLzl+b8ErU9aF tege2W+pRBfK8B6oDM18MnuzBgz3/9bJhcar+5BhImB5MVQgq90mSvuv8jbvGpfLfGC0 O/nZ8TLFK8dOwfiD6PgVwOXFF+Vm3ukSPhUbpGAB/QG4C65I2LigBn6qcs4yneQKV0eZ 72Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hLvQ36vr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170903244400b001867ea919bdsi11430772pls.25.2022.10.24.05.48.37; Mon, 24 Oct 2022 05:48: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=hLvQ36vr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233839AbiJXMl0 (ORCPT + 99 others); Mon, 24 Oct 2022 08:41:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233841AbiJXMhW (ORCPT ); Mon, 24 Oct 2022 08:37: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 895FF5DF3F; Mon, 24 Oct 2022 05:06: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 44FB6612D6; Mon, 24 Oct 2022 12:05:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 533D6C433C1; Mon, 24 Oct 2022 12:05:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613150; bh=bZAdixgBkkbayO/PfynI242MpL8KYNSVLdsgYC5AH/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hLvQ36vrrIBDt1lgyQZn89KWJhDq1eRl4RF9n3rzSaXE0FjnkjhSo1dlf092s6uM9 SD+FnqFko1InSivOPZwpPV58ZnOS4YevmF5LfOkZsXP/xAC3+109kyxuBb2i2DC681 /e1Cg0q2YlCl+iSUsmX/srj2z94oYzL1Tmd7Q4u0= 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.4 007/255] ALSA: hda/realtek: Add quirk for ASUS GV601R laptop Date: Mon, 24 Oct 2022 13:28:37 +0200 Message-Id: <20221024113002.700278375@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573257445772554?= X-GMAIL-MSGID: =?utf-8?q?1747573257445772554?= 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 @@ -8280,6 +8280,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 Mon Oct 24 11: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: 9208 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp459129wru; Mon, 24 Oct 2022 06:38:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7LWsGvYn8JwcpZcZISELwM7naszMMOKM2ffDZgBjWkhjfaYf6yzQEwZTyakzTS8ykTT0SL X-Received: by 2002:a05:6a00:234d:b0:561:f0c3:cde1 with SMTP id j13-20020a056a00234d00b00561f0c3cde1mr33713993pfj.34.1666618735548; Mon, 24 Oct 2022 06:38:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618735; cv=none; d=google.com; s=arc-20160816; b=oc70vrdVMX5v4Nn1OK6aaQr8TvaDYck1busD+WDNQ8kdNovbmaioE5ulpdrZartLAF 1bd5w6gYpmsZsE8NE08Zor+W2WzKN15SfKmVTBw7qRRsrlH7m1zIfYvmeSSFvGsG5Q/n izCz0kdonDe3JNg0leWQRXz1ipB2DFSzKG8hVGRI9+uxTbaod5WwcUtHfQE0WlT0ZCrA 0cgO/l6ew8zP+NFqU1Cce9FoGggWD5ggbmvuJKy3d9YhPydcH1UYuYfEgG0UQY7hEP6b EHDRAARZ7NzhduSlNVixwozaM4Iey9H7DtRtPxWe7eegVDya/j6+IhCHuWKpfiHg0Gs0 7Q8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=j5fi0pRfaI7VtwoStNUw9Y9LapaJWaEwd0pch0LjSys=; b=FWwzL742gE1dV80XbdLvlPzDzkpxdWAIwwaMiat5Q99o04w2aF/0Icn2ce8dAaubEi XqnbBZsxozsR6oLCv5MVXTJI0bMz7LLIWuw/z2IdzBEM9qOZ+lolnlMNq8vvm6sLW+rk zMHJCJTJ9umvH5Ghs8cXmPCOyexhhUuxaVROxt4bozF+0ArSMHy7JTiJNqq7KnZ33Y3u pfgQmKA/cOAUCQUXxCjpTB5CUGA28jOVyMnTfvH/k2B2F8fpP/IeuRPpkuE8Xm9Epx8D DLYs3JOrzwitMCZmH6IACuRx6QglftSoXnGcFPCG3X0MLSoNJAmCch6NAwBnRAHHSkuT vsKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yKvJproC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170903240500b0018687896060si8942380plo.178.2022.10.24.06.38.41; Mon, 24 Oct 2022 06: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=yKvJproC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231486AbiJXNce (ORCPT + 99 others); Mon, 24 Oct 2022 09:32:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235985AbiJXN3S (ORCPT ); Mon, 24 Oct 2022 09:29: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 C586023EB3; Mon, 24 Oct 2022 05:32: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 9DCEBB8120C; Mon, 24 Oct 2022 12:05:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02D4AC433D6; Mon, 24 Oct 2022 12:05:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613153; bh=zYHr4P+Jmp1mLYC0rOmvELARsSLzzPB5Ak6CnrGfpqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yKvJproCMF+9M1Ism5N2zvz8B2ElFAm7tIOEwTCS54HeubVpYeJ7SB4e1lu4lZVZa rnJsEIoqUK6pyFWzFgUaPQ1t+Tj0PLgvuca/cjjBETcvIluaYfFx57Sz19bLWhRAYd d5g+CR4D2tbwJdPbnnYKMbXIVdUgs2tFBXLaPSSs= 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.4 008/255] ALSA: hda/realtek: Add Intel Reference SSID to support headset keys Date: Mon, 24 Oct 2022 13:28:38 +0200 Message-Id: <20221024113002.729854973@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576406859625728?= X-GMAIL-MSGID: =?utf-8?q?1747576406859625728?= 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 @@ -8302,6 +8302,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 Mon Oct 24 11: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: 8862 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433128wru; Mon, 24 Oct 2022 05:48:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6EvWZ+WtSgVUHQ/0VFp+6EywbXsy1c8ArPdlQiwNAg0JJv6nu2Tjmufeolcir7ascSfJD5 X-Received: by 2002:a17:902:7104:b0:17f:cdc1:f4c3 with SMTP id a4-20020a170902710400b0017fcdc1f4c3mr33000690pll.149.1666615717522; Mon, 24 Oct 2022 05:48:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615717; cv=none; d=google.com; s=arc-20160816; b=GzFae/mLGj7qawxuFawN26b8lLgZXtH4UOrT+bD19LIYk1/YEr308E+8s2GHfvs+Q3 Nm+dQeaFP/Qmvkpy3PrgxIE9Z2H2XnTki1VhizhagzvdI6711jkNwy4A+yZ9jAJZ6SsT cfGPyzQNncbIFMPIAMfJ5qnCZBLrtxXgELgp8Rgft9/PIgEdKuCOMqGowAjLJg6QoXUs //AwC3kFhLRsWLbn8bM7U+dSLPcwgKtPgs21En2EaDnk/77FUZ/rj/KLgGy/Pk06qd2b ChQk0OwEY8uGBdNHN1TTw1wlCk8i0NDzD9YxdkLrIYlTuJ5x9A/Wal9Fxe/Ua4S2FOzB bflA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9+k1eoOzcsj4j7f1eLP6uGCCZwcWZCnOBOjQDa6MEz4=; b=A4r12MZ/L+FmVqqL3+i2gciEBlUzUq1KFeIWl6QLiR9V7RNGgONByt1DsLJCLaW418 ryD2grvLKip2pdmQZVmI79DfvkJkK/kds38i7Hn4+Ot9vftvKBwWYCjTCiG93gdhNKql trWbs7OfpzSXhUiD7mH1CYrT4EmVZvm3VfLMtEonxGAGkn47aj9MGaa6kvfxnKlkP+CF qHHNNO/JDsOOQk2Doo4WaVk4tWiS6aloTFiReDzQZgaigQgVV/Ahp/J1LJjGK3w7cwqm X7G1IVbKEwdhmAIZM+0r0c/Od32Xcwp061LjRBzPd4JrryvthFj/VlpOkgRzDGGvr3rK hjrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hkc4Au0R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a63cf56000000b0046aff3cb64dsi35275228pgj.410.2022.10.24.05.48.23; Mon, 24 Oct 2022 05: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=hkc4Au0R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233904AbiJXMla (ORCPT + 99 others); Mon, 24 Oct 2022 08:41:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233901AbiJXMiD (ORCPT ); Mon, 24 Oct 2022 08:38:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1E5089CF3; Mon, 24 Oct 2022 05:06: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 879AD612C3; Mon, 24 Oct 2022 12:05:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99E3AC433C1; Mon, 24 Oct 2022 12:05:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613156; bh=QZ6pfJr0Ucw6vmD9lJggPgJH3hSM93RxrgY4K2fGqG0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hkc4Au0Rdyt98qvd+NcpyEsPaSiuf/0LdB1eoCPWwToV8zsjUb0CxUC71MiMKFkjq ZoJZHDto1sXooTWvZX0EeCIaQsznkEhQ8xU+kPtds8UJrzXs0JDhmlI3W/fQcDoHH7 qVkyEL7jx3pC7dGo5F+ZdBS8KGHafoffHFMV90V0= 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.4 009/255] mtd: rawnand: atmel: Unmap streaming DMA mappings Date: Mon, 24 Oct 2022 13:28:39 +0200 Message-Id: <20221024113002.759123643@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573242858227536?= X-GMAIL-MSGID: =?utf-8?q?1747573242858227536?= 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 @@ -402,6 +402,7 @@ static int atmel_nand_dma_transfer(struc dma_async_issue_pending(nc->dmac); wait_for_completion(&finished); + dma_unmap_single(nc->dev, buf_dma, len, dir); return 0; From patchwork Mon Oct 24 11: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: 8840 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431568wru; Mon, 24 Oct 2022 05:44:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7tZqy9r7/ZOBtbzdHu+kGCKbOySU8B39YWqYBq/Yf6grRdfCH6QDosWJsFr+fPCAzuIDQI X-Received: by 2002:a62:cec8:0:b0:56c:235:8399 with SMTP id y191-20020a62cec8000000b0056c02358399mr1245189pfg.64.1666615452311; Mon, 24 Oct 2022 05:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615452; cv=none; d=google.com; s=arc-20160816; b=EIRgksLIme5MKO1Z0rA9B+YnWPZE45+ApI/zfOSRmWpKBvQ9ns0uMlYwyfkX9kwAzY UeFwZme8Nxyq7RS/QNbfsCLqThKLFV7J/vehV27CuKAiuGoaVtjksIssPeFzCZTNXtCe fpxoP3avEhMT0PquXjJim3yaf+T5GQySRDf5mtCTyUAUYN0LQS3Z2KaxPXDdGDYp5aXG CxKAwLiXIK3imPWHWmWrL9rdh3HnJ8zeU+WNg7CwaWdg+ho2DXmppab88HXD0n2Hklks Z9zJYT7q3hIWe8Qayu1ySLgNWNasFqolhDUy2lWKRDsV7tTQLFsbVyVoun5h3LTkNS24 vB9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0IOE9zFUV+etTYE6rCBKsdZGe1Wx0NnXm10By5x9rgg=; b=qjKUx08/AjCRgR1dW4+VSNtWX+p5bzDEItB1tujANJseMQ+8mo+hPGYHCdr10FhwlU Z3lTFHlIxZM1Ca9oS4r6CcfODEBjrrlSlraJ0P3y4SR2YjMArDDhx+0JYhqNhiNl67oa r4fvfZarjSu3EATbjPM/HntZyGJTRcxEV0AKjEO8jfhFmUvZVIj2mrD4+3/1BIzIuBp1 qel8uWdbWda3lchyYlkqXeHkQRTmn7lu8NnmLXVhSIZeOCBDkB2jm2WdbnlaH291XRAO sMu4z02CETVRW1DSnyDTLNESDYOAF971GIhQi+SIHXM8WWrGyey9/1xYJJfjImr0HF7j RheA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ab0K6WPw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a632f03000000b004532834e821si35536951pgv.598.2022.10.24.05.43.57; Mon, 24 Oct 2022 05:44:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ab0K6WPw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230367AbiJXMiR (ORCPT + 99 others); Mon, 24 Oct 2022 08:38:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234431AbiJXMfC (ORCPT ); Mon, 24 Oct 2022 08:35:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EA235DF31; Mon, 24 Oct 2022 05:05: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 20443612D5; Mon, 24 Oct 2022 12:05:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CA41C433D6; Mon, 24 Oct 2022 12:05:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613103; bh=sD+JhGplpPIp1k8OWFkADJvxtCDejQrhYkusRmjNOOo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ab0K6WPwqh9orSjyhPLGF62ot9+RqmqUkHU5quzn6s2VX7YiETv5JxigryfvzZPVr PVxSNEbLaI5+GK/epkAW+F4nZibbclXv3dEuRY7ivHG+/Gf/dViF+0VZ+gjVJ3ANRV tsJwR7xMKfidydaluSare2qhRSLqy+AhLTZESX38= 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.4 010/255] cifs: destage dirty pages before re-reading them for cache=none Date: Mon, 24 Oct 2022 13:28:40 +0200 Message-Id: <20221024113002.788972179@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572964403827756?= X-GMAIL-MSGID: =?utf-8?q?1747572964403827756?= 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 @@ -3877,6 +3877,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 Mon Oct 24 11:28:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8880 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433384wru; Mon, 24 Oct 2022 05:49:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM59/YOYEWPQWNz/JLENX38hJS6P+Ih65JDTl1bbSOB8l2P64GrXjDv0YUnPf8C4jgDUBWh4 X-Received: by 2002:a05:6a00:21ca:b0:569:92dc:2949 with SMTP id t10-20020a056a0021ca00b0056992dc2949mr21313677pfj.63.1666615760309; Mon, 24 Oct 2022 05:49:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615760; cv=none; d=google.com; s=arc-20160816; b=yU5swRF4htNwQLNg4GcMtxNKZqd82Z0qmpYLEOOGMFOVuoMEUmMp2+g8XW6oiYTYD5 3MGAKf1VRFoVzKCa3p9P5GWOA2qIOBVD510o5XiNtyURRpps0jPBS2xQqJBjBCtN30Q4 SKFwoQUlvCgtYYc3MXQivMBJQ6GxJ500B0kx2oq5xDdfxbdFCqyahwa/TtWxEHESH54f HjnqTxO+OAcXjE2o/rccFsmp+0LARVdbMvbybK/QIzNYvI0ZJnahh179Sn4nIfZW33f5 a04fiGQ+IOT4bYeLRcsFKm8tEADNiAbwW4I481X8QFkl65KaYDuYJVmnCwlofxImfZ/c xZjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9LG5F4KWNfofAyltX/YC7qkx4MHQF+lMd/+rxDBT7OI=; b=gzvCjF35RW3HTiXeqgsJ4NGbI6ufyt8iuFc6sHCuIhffWRJaRpaLq4aTO0LpV2umKR vmFxjKT3+/hF+mj8zGbNqw4NiWJACLs12uKBqRYQXr4dYc06wTqfHgmLaiEFf4qRHhc2 nDnI9amQkV4a7WFzQ7zF+bTDLhHdxzni6sLIBIJbAgXW0BAylh/DPY77e6Q7261GAyfM hHBg382JJ8lBgNNGfHkn3mJ/v6fk3I8G2eC7JEnriqtUHfvrtX4zIuVrFx+u5yo9Q8TY fWaQNXOOxbgbLEBWfVDRobjFooi3SoAHo6PzijTbA3Mxd1R2Rh1Rctgz4kgdEcLNanFN 0FQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="w/lxT7Qr"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u24-20020a631418000000b0045c59e9a8a9si35736131pgl.322.2022.10.24.05.49.05; Mon, 24 Oct 2022 05:49: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="w/lxT7Qr"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232023AbiJXMic (ORCPT + 99 others); Mon, 24 Oct 2022 08:38:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234551AbiJXMf0 (ORCPT ); Mon, 24 Oct 2022 08:35: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 A313D5FAF2; Mon, 24 Oct 2022 05: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 A9C3A6129D; Mon, 24 Oct 2022 12:05:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1B7AC433D6; Mon, 24 Oct 2022 12:05:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613106; bh=N6tPm1EFvhXAzR4cNF8AAjV699h2J/V/7WVDj2y+q3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w/lxT7Qr1oFGbZORLAH5tMoK2aQn0xydNgUMyjeGCRY+AHqQhYcAAmnBykqR7y0u1 niwJzyYt6+FV1pqdZCCgWMCnrRSJJvaGpX8/5woIYknGw0OYkeoQIiACIfcU3dhneR GkLwP/4WcdTssHcTfrGckRkQ0XAVlESfoIiETmfE= 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.4 011/255] cifs: Fix the error length of VALIDATE_NEGOTIATE_INFO message Date: Mon, 24 Oct 2022 13:28:41 +0200 Message-Id: <20221024113002.822599107@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573287492921042?= X-GMAIL-MSGID: =?utf-8?q?1747573287492921042?= 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 @@ -1100,9 +1100,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 Mon Oct 24 11:28:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9013 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441109wru; Mon, 24 Oct 2022 06:05:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ZLU7gWdL36L8Ec5zCClc+I1xYW0p+Md7WJTQswqRt7ukzwVSaF60Ny4DdbgyxE3X0n12j X-Received: by 2002:a17:902:848c:b0:17a:b4c0:a02b with SMTP id c12-20020a170902848c00b0017ab4c0a02bmr33106197plo.122.1666616722687; Mon, 24 Oct 2022 06:05:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616722; cv=none; d=google.com; s=arc-20160816; b=TBPHWjyxLHFh2HS3YviN54+Ahccb221KnAXfFV60OJ6OtJFweiKP6cUXc9yER00WWm mP6rR/8KnTlJpMizLi5uJv9XBRmPovkh2sSnrm0OOvl4/mMu2pngwjwQlDRUi+hA4HYK I6q5vN7fzPlCcuEBO7JGYb6keiAKMIvsRxat74PpaEV7aIYcbn9IZVhivsEsl3TfJMQc qBOnVOSGepbEdwAr0/p+P1ttdmbjuVC0PSUmASUg8apKxl29CE44FhQp9JWHTO/bpTur tOrA6tUEPyD8Nf1f3UqG6J1sYsoRa7FJEuCq2/C9XnxYY83ZszHWOy8k87CB3b75DdRZ zbJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=07mgNwZiYIM+hCP8s0MIpcJ8VTKO61AipDsF1BChDlA=; b=J7cR7PTZuRkAOHRDW4CUUBG423B1QLQzDfTXxLeQPPbo+nc/+CN24fVTLsEAUr6gTT Ec+hWSrlMlFS7AHQcRSfYAoaw0RMvIIRyC2ruTYl5R7z0i06dmFCrBqZe6VmvDtTv4Gk bhBOx3knOG42I1z9WUWyZeEkI/lhCLSlueQcltpEJV/KnsEz56gtB3dL+qL8YAcC3fHa VsqckPsIH5L0HiOKIMvCH48xsixXQ7ZdE3t1fA5qntNNbhPh34CjICo9NoUW+ROfX7hd ElHrFclhA1xhXeqltVUckC2VTT+CVCM0S6EfSZQUett7xSRVFt/sPllvtOxvTUoBCRld 1y1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZTl7kcxq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w14-20020a17090a8a0e00b0020a84ae69b1si7549392pjn.71.2022.10.24.06.04.55; Mon, 24 Oct 2022 06:05: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=ZTl7kcxq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235233AbiJXNDr (ORCPT + 99 others); Mon, 24 Oct 2022 09:03:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235318AbiJXM74 (ORCPT ); Mon, 24 Oct 2022 08:59: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 4AA08816A7; Mon, 24 Oct 2022 05:19: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 4FCDC612CC; Mon, 24 Oct 2022 12:05:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F02DC433C1; Mon, 24 Oct 2022 12:05:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613108; bh=d2zFU1lQNCR2OxIHoZ43iXVPZ2TmY3D6P0W58UNPdaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZTl7kcxqrlZ+dssaWGOPq9ewW1UedXIkatdUNC9ITP/Y4/97k6889ERBvH5iV6lY9 /MtyaTs62Yf9vT2FfNh6Z3ZhexLetivZQjlKNVpjug2seaLbPxZTkfMQ21v2V4Yub7 a/xG3i0xI8kGG+oFsF0sSL/HpmA9g39cWi+pOs5Q= 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.4 012/255] iio: dac: ad5593r: Fix i2c read protocol requirements Date: Mon, 24 Oct 2022 13:28:42 +0200 Message-Id: <20221024113002.852005537@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574296764956206?= X-GMAIL-MSGID: =?utf-8?q?1747574296764956206?= 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 @@ -14,6 +14,8 @@ #include #include +#include + #define AD5593R_MODE_CONF (0 << 4) #define AD5593R_MODE_DAC_WRITE (1 << 4) #define AD5593R_MODE_ADC_READBACK (4 << 4) @@ -21,6 +23,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); @@ -39,13 +59,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) @@ -59,25 +73,19 @@ static int ad5593r_reg_write(struct ad55 static int ad5593r_reg_read(struct ad5592r_state *st, u8 reg, u16 *value) { struct i2c_client *i2c = to_i2c_client(st->dev); - s32 val; - - val = i2c_smbus_read_word_swapped(i2c, AD5593R_MODE_REG_READBACK | reg); - if (val < 0) - return (int) val; - *value = (u16) val; - - return 0; + return ad5593r_read_word(i2c, AD5593R_MODE_REG_READBACK | reg, value); } static int ad5593r_gpio_read(struct ad5592r_state *st, u8 *value) { struct i2c_client *i2c = to_i2c_client(st->dev); - s32 val; + u16 val; + int ret; - val = i2c_smbus_read_word_swapped(i2c, AD5593R_MODE_GPIO_READBACK); - if (val < 0) - return (int) val; + ret = ad5593r_read_word(i2c, AD5593R_MODE_GPIO_READBACK, &val); + if (ret) + return ret; *value = (u8) val; From patchwork Mon Oct 24 11: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: 9170 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457779wru; Mon, 24 Oct 2022 06:36:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4JXc6ddk31I5qIU1NKlTzas9i0YDCwNisHSgEizreWAPb4+ERBxSixxVv3grcLhr2+Vre/ X-Received: by 2002:a17:907:2cf0:b0:7aa:21b1:9b4f with SMTP id hz16-20020a1709072cf000b007aa21b19b4fmr2259157ejc.752.1666618590603; Mon, 24 Oct 2022 06:36:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618590; cv=none; d=google.com; s=arc-20160816; b=Tn4BBSGmxZJEDhS5TXwtjrtsLGOpg32hk8YqZiLNoHh1q1jcLMx01yoL/RzUxMES5V YkLaQgSTOO7jpdksC5e5Ha87Ba8R8X1c8jfcS3XvQX26CURp7sEo46EwN4OH/7oyZeXJ XOxkhHOKwzXloANHNAdO1WzwxKdtZRmssjxv5ZOShxx/2G8/02aWpIHoB82b13leKYWy yxRxb+8kP5jI6L9INrwtNRHXZr1TPCDUgu1YvO3GbV1y4rrqVz0SB+yY9d200A2CLxKo 8zMUqSU8WU4Sqo/3epNf2SKsVqmOlAIW9npS/krN9I3uDGE8AzbcXT2YVRQQKk7gMCap 8JbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9HVE2rMkHNLgkJEnSmHjNUKoA0X9MiFpYUc1HhXzd1g=; b=diCzqznZsBrvCRotQjEZPpbqf3Hcpc1eRmN3qKO4srykb/AFZsSoI80ZRQJtFd9gD8 rem+Vng15umy235j/89w6UROOOhzsg1TRZPqy3bOrB0QlfyXCuIFgD+Yde1VHYcx5XkU XiOeIQQxpRwr0St5ILrrpGjzKjJ/BdHjhanu+qD9nusS4QWiGzyfFpn0S+ViHQRX/luM lYmm0GkvQ1tJPiXL5dE4xrbCXvRERnXhBagcQvXAb8MCmFZcxYJv2T22HcCd+AzC+SeK Sp9mM6W6qwFsHJG5Yb5cGmBq0KwGvC5iPZukX/tDdgzf1Fs8YUEYkaqo/CrJIQ/v9/nE YYSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VEhhN1G6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020aa7d04f000000b0046109fd5943si6160977edo.544.2022.10.24.06.35.27; Mon, 24 Oct 2022 06: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=VEhhN1G6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233688AbiJXNWq (ORCPT + 99 others); Mon, 24 Oct 2022 09:22:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235880AbiJXNVE (ORCPT ); Mon, 24 Oct 2022 09:21: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 ACED61C12B; Mon, 24 Oct 2022 05:29: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 AA1A4B81154; Mon, 24 Oct 2022 12:05:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 115F0C433D6; Mon, 24 Oct 2022 12:05:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613111; bh=BOKv1toqEPokUS2/ZA55I1RNQdLtChwRSiwtQ+1O2tw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VEhhN1G6ERue2eWgBcf56B1SvPDIf5OXPtknI5Z8LWzNIAgP9s3kjUgRlsPnO7X60 MKG9ywHhKG5pCQlIO6AX4HmsMLswVztIGGKIROvbS4Ca7IY660iPapUjCIht7EMyaO Xm1c4HDI8ZLdTm5d47M8++BC50SrGGaunms5ubuY= 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.4 013/255] iio: pressure: dps310: Refactor startup procedure Date: Mon, 24 Oct 2022 13:28:43 +0200 Message-Id: <20221024113002.881684704@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576255232183194?= X-GMAIL-MSGID: =?utf-8?q?1747576255232183194?= 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) @@ -748,54 +804,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 Mon Oct 24 11:28:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9742 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp548730wru; Mon, 24 Oct 2022 09:42:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM72EBd0n5fwCMjUjEvINJzcBvjfM7o/4EgQ9mjI4G/t9Znio2P5rbjH5wfn6yp/kNSUpcur X-Received: by 2002:a17:90a:e297:b0:212:dc30:7fed with SMTP id d23-20020a17090ae29700b00212dc307fedmr16925577pjz.90.1666629741338; Mon, 24 Oct 2022 09:42:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629741; cv=none; d=google.com; s=arc-20160816; b=0/DE4ub2Y8pNPFvLkWV/TQ5Sl4ATeWUbXUySy3UKjCS6edQ6unKGlsFuNg9/4dGujC BqP7PKA+cK/b9lpt53usMq8tcYLgNK0YpnwbElvfRGPivB2OEH61xKDExwPmKjr2kZOs cMiM+Cu0CfUl6Pkl3RobEHVWlgldQRfO3ZIJCCsBGDiTLbSY7wqVO8ETdX4r4dFAv9rK u/S8BQpEhTOLWMjpeQAdV6w72HDuA/kTGro8AArWqRiW4Kv+TiXOcaaMB/PYqnd/5H3K HILJKcF6C6aB+pLV56zo2c4DM/NT+aJGMDevYUeeSsY6KfvOv69Avx7vh3qrRggRHSlv zyYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=DqxzjuA/F1+FA2j0Agr7isab4nxUHFB9l7SsSDDBhp5SlPeR3vt7rXeuU3u4B5djuU tf/UGH/oLi/C24Ej2oskoa88PvXFJZNAxCTmYNkWgafCFScAAqewbbNnWZ9bhmJog5NT ldUwVksgkDJCfxnq/HKCO8RXhmHSl7O2HK8HcXwLddDKCIi9LWT1syNaiN5MVjP0EQm8 GjC1XHYS0GMxuga2GA8Ebrl7WhpIvHRkjhfJAyhDwkXzeZ+9SPl/EjXJMbf/h17SQFjJ qrg4sCQ0ycnARTori8Hvb3SFUNGJx97SKWKGgAUSiFo+sRVF88Q5AlCdYYGnJZUHjKsB dCOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nBOuuCF4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pg16-20020a17090b1e1000b0020dbd4207fasi12329220pjb.46.2022.10.24.09.42.07; Mon, 24 Oct 2022 09: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=nBOuuCF4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234303AbiJXQl1 (ORCPT + 99 others); Mon, 24 Oct 2022 12:41:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233948AbiJXQku (ORCPT ); Mon, 24 Oct 2022 12:40: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 149BD1946CE; Mon, 24 Oct 2022 08:28: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 4E927B81150; Mon, 24 Oct 2022 12:05:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A663CC433C1; Mon, 24 Oct 2022 12:05:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613114; bh=z6BUKnQXIYEmBq/uQLvhq8qTqLB0q2qvgDL8SK8Bizo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nBOuuCF47HZel7zjsXK+j4dMxS5nVH/4IT5KEtM9c5tCOYd5HN9FOA1NZRJlXvDIV PzHSRwQjcLu4bOY9AMPjsgGa0tHp/ew7N/73XUqRaeqn+ZXngnGC2yscBHuP4B+i44 hfUeG5CDJwZD92iHdkBAEHurdNLgRo3ZhDVuQPUg= 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.4 014/255] iio: pressure: dps310: Reset chip after timeout Date: Mon, 24 Oct 2022 13:28:44 +0200 Message-Id: <20221024113002.911044933@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587947787144850?= X-GMAIL-MSGID: =?utf-8?q?1747587947787144850?= 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 Mon Oct 24 11:28:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8851 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp432936wru; Mon, 24 Oct 2022 05:48:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5hAKhTgu/Ov63Wh/RJEugQ4KIxw9gjN5JOBFEB+us1L7iMHkgaf2b+ONNxvCfCKQ999G8b X-Received: by 2002:a17:902:c643:b0:186:9efc:67a1 with SMTP id s3-20020a170902c64300b001869efc67a1mr7276733pls.30.1666615687326; Mon, 24 Oct 2022 05:48:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615687; cv=none; d=google.com; s=arc-20160816; b=qxXHpvKOa9GUnsCG7Kx/pKW6h3I1HbMox4frs+LPAs0oVQD5tYAeRTUXb3uwvQBkuI OUmUwmROVOC9iPdHiHPH0lsoXVQJN1+Ay4h368Yl9N0FRz56AZkj2V2Q/5fbVcoQSmoh KddfFbz3IQQ+ITnv0bZnZ6g+E8h3n1bgGPR57RgDZwElPIEMvngIV5aNqFXbfUpSUdDo cwUCfDdmnHLzc3uS+xUAFcCuBlAcfgkHk35K0qq8jdDbsafMzWGPJMJsNVVrkDSiafGJ K1B+dp8lkmop6ba7aitNd6DDNQmJBfYahXZ6IK1vm48mxIQe2a3ky90Ak6J/8d0adJKe A8nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=X2Y7k+O/EHqEPGcV39P9ML5DluktjlZRpO6VdstOmEA=; b=dGcaZg60QNcRXc2H7gfCpsLAm6mkTr/8aW0loAkK2XjH9TJwk3IF5yBLpg1cBcLYa/ TP/CpofXv/1a0Z55g66G1IeS0Q8z+A/bYJ1TVcvoro400GUPLdNSQ+2NpnjelXRwccGF doC+CcCBnV3e+qLTbY3ahTlQZ0TmY2rMh8GrBUaXtU694o1SSozYHe2xNh0VBImX+180 6LRCGT2NqRRG7BH7FHaDWdNXWspstBZbD0pt+i3jTeH6WC0ZR5TXq6dLiK0HIJvAezaf H73CkB8YnHCDbhrlwoc3EoUNhTlELMaj3E+DviCCg3j4/pZedbUSiNIu7AYfoKRct7fJ zZeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="XuEYbK/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 gb17-20020a17090b061100b00210767d910asi8650687pjb.36.2022.10.24.05.47.54; Mon, 24 Oct 2022 05:48: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="XuEYbK/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 S234057AbiJXMiy (ORCPT + 99 others); Mon, 24 Oct 2022 08:38:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234652AbiJXMfj (ORCPT ); Mon, 24 Oct 2022 08:35:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 255F327918; Mon, 24 Oct 2022 05:05: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 3294C612E7; Mon, 24 Oct 2022 12:05:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44522C433D7; Mon, 24 Oct 2022 12:05:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613116; bh=yQyto2Ce9b73hWIW5ToDONrZ7wExoMDHWAq3LWLzMCw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XuEYbK/fwx5sAkvMYVkOqKSuv30lQsH/dT8LbEtHIpFQILhhQIoLSJsB+yxJuBojv heKpgMCkfvWEW330E1pw98KYVCrVlgxlB/khntt/vlOyBl9Kiumg0nnC7sD2L7X572 j8GA0ElONNN6bAugYoCMugrebtWb8alqguaqLJRc= 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.4 015/255] usb: add quirks for Lenovo OneLink+ Dock Date: Mon, 24 Oct 2022 13:28:45 +0200 Message-Id: <20221024113002.944703230@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573211049314299?= X-GMAIL-MSGID: =?utf-8?q?1747573211049314299?= From: Jean-Francois Le Fillatre commit 37d49519b41405b08748392c6a7f193d9f77ecd2 upstream. The Lenovo OneLink+ Dock contains two VL812 USB3.0 controllers: 17ef:1018 upstream 17ef:1019 downstream These hubs suffer from two separate problems: 1) After the host system was suspended and woken up, the hubs appear to be in a random state. Some downstream ports (both internal to the built-in audio and network controllers, and external to USB sockets) may no longer be functional. The exact list of disabled ports (if any) changes from wakeup to wakeup. Ports remain in that state until the dock is power-cycled, or until the laptop is rebooted. Wakeup sources connected to the hubs (keyboard, WoL on the integrated gigabit controller) will wake the system up from suspend, but they may no longer work after wakeup (and in that case will no longer work as wakeup source in a subsequent suspend-wakeup cycle). This issue appears in the logs with messages such as: usb 1-6.1-port4: cannot disable (err = -71) usb 1-6-port2: cannot disable (err = -71) usb 1-6.1: clear tt 1 (80c0) error -71 usb 1-6-port4: cannot disable (err = -71) usb 1-6.4: PM: dpm_run_callback(): usb_dev_resume+0x0/0x10 [usbcore] returns -71 usb 1-6.4: PM: failed to resume async: error -71 usb 1-7: reset full-speed USB device number 5 using xhci_hcd usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: Cannot enable. Maybe the USB cable is bad? usb 1-6.1-port1: cannot disable (err = -71) usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: Cannot enable. Maybe the USB cable is bad? usb 1-6.1-port1: cannot disable (err = -71) 2) Some USB devices cannot be enumerated properly. So far I have only seen the issue with USB 3.0 devices. The same devices work without problem directly connected to the host system, to other systems or to other hubs (even when those hubs are connected to the OneLink+ dock). One very reliable reproducer is this USB 3.0 HDD enclosure: 152d:9561 JMicron Technology Corp. / JMicron USA Technology Corp. Mobius I have seen it happen sporadically with other USB 3.0 enclosures, with controllers from different manufacturers, all self-powered. Typical messages in the logs: xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command usb 2-1.4: device not accepting address 6, error -62 xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command usb 2-1.4: device not accepting address 7, error -62 usb 2-1-port4: attempt power cycle xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command usb 2-1.4: device not accepting address 8, error -62 xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command usb 2-1.4: device not accepting address 9, error -62 usb 2-1-port4: unable to enumerate USB device Through trial and error, I found that the USB_QUIRK_RESET_RESUME solved the second issue. Further testing then uncovered the first issue. Test results are summarized in this table: ======================================================================================= Settings USB2 hotplug USB3 hotplug State after waking up --------------------------------------------------------------------------------------- power/control=auto works fails broken usbcore.autosuspend=-1 works works broken OR power/control=on power/control=auto works (1) works (1) works and USB_QUIRK_RESET_RESUME power/control=on works works works and USB_QUIRK_RESET_RESUME HUB_QUIRK_DISABLE_AUTOSUSPEND works works works and USB_QUIRK_RESET_RESUME ======================================================================================= In those results, the power/control settings are applied to both hubs, both on the USB2 and USB3 side, before each test. >From those results, USB_QUIRK_RESET_RESUME is required to reset the hubs properly after a suspend-wakeup cycle, and the hubs must not autosuspend to work around the USB3 issue. A secondary effect of USB_QUIRK_RESET_RESUME is to prevent the hubs' upstream links from suspending (the downstream ports can still suspend). This secondary effect is used in results (1). It is enough to solve the USB3 problem. Setting USB_QUIRK_RESET_RESUME on those hubs is the smallest patch that solves both issues. Prior to creating this patch, I have used the USB_QUIRK_RESET_RESUME via the kernel command line for over a year without noticing any side effect. Thanks to Oliver Neukum @Suse for explanations of the operations of USB_QUIRK_RESET_RESUME, and requesting more testing. Signed-off-by: Jean-Francois Le Fillatre Cc: stable Link: https://lore.kernel.org/r/20220927073407.5672-1-jflf_kernel@gmx.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/quirks.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c @@ -438,6 +438,10 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x1532, 0x0116), .driver_info = USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL }, + /* Lenovo ThinkPad OneLink+ Dock twin hub controllers (VIA Labs VL812) */ + { USB_DEVICE(0x17ef, 0x1018), .driver_info = USB_QUIRK_RESET_RESUME }, + { USB_DEVICE(0x17ef, 0x1019), .driver_info = USB_QUIRK_RESET_RESUME }, + /* Lenovo USB-C to Ethernet Adapter RTL8153-04 */ { USB_DEVICE(0x17ef, 0x720c), .driver_info = USB_QUIRK_NO_LPM }, From patchwork Mon Oct 24 11: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: 8853 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp432972wru; Mon, 24 Oct 2022 05:48:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6VgozyKymywkAL9ApdgDFaq2yN2NDt2S0fikFbwzX7+dAxM0sw82/cVqT4cYPUdrgWaPcr X-Received: by 2002:a17:902:f78a:b0:184:f2e2:a5fa with SMTP id q10-20020a170902f78a00b00184f2e2a5famr33577515pln.161.1666615693137; Mon, 24 Oct 2022 05:48:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615693; cv=none; d=google.com; s=arc-20160816; b=nz0p/i843uU/Bbuy7oT54WCJh+Gmn9Sr+IkwAa/5V5KEUOBbAaQ3lpDmvQQqFH/7kk xDt8HiK38AWTP6bvmJ4AEzTZCmYwGrKOOVMuLJXPwx2nBHz3E1NcXDQEgzkvyoOHlrM/ E5eJXlQD9RBrlOuyo+wDbrwvzolhgr23Sifb0CzBtVvrTUefWFsN3SL4/LCkKauK/Lff 5ax7TP9Xx82c8Lto4DB6wr/AkjFynyZnALOoQXoz00dab3p+vwmltHgf3kBwpSZDyV2R dkWsqkUJyxd9aNYl61lzLqiHkSEGY8kWsa6pRG1NFwqGf7xhzA0MPn4jgE1Es+41Jysf o2pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uupszNGThibcuoV0lCdr6FdGwKbohbo2rPAHpTTSjgI=; b=Qltv69vruinrOl4jMgcR8YUqzf8Tx/eu8R+mN01JZf7y/+aNpeDNnb+xPeIaLUmz51 A7GBqC4yNtnzU2rmw1zftIFu7dpvKSeoAZszQSehARsj3SvuNHe6lI2fzYPiYB0bTUJ8 zePicXKlWcSK7wHDJj4wMZOI/qXGOaYJ7kwuDU4HqyEiWcrZTzt3MYjtRd575wR1QIpS eHewKl50Dind0Gu2bggergVjvMMk3edS9zjOdG69jyyN+waJuvIHI/p0YeordazeYb6y pv8F4+BcYrA+S77unzAIoirF+Nkv5gQ5jsfWEunL9oB7TSwE83w2KJJ7whksfCczgLWr 5ugA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Dn6lxCak; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z188-20020a6333c5000000b0043882f3e74bsi35583181pgz.441.2022.10.24.05.47.59; Mon, 24 Oct 2022 05:48: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=Dn6lxCak; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234140AbiJXMjI (ORCPT + 99 others); Mon, 24 Oct 2022 08:39:08 -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 S234687AbiJXMfn (ORCPT ); Mon, 24 Oct 2022 08: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 5B7A2356E4; Mon, 24 Oct 2022 05:05: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 C8A8F612D4; Mon, 24 Oct 2022 12:05:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8CE8C433C1; Mon, 24 Oct 2022 12:05:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613119; bh=BFat5BEfy41jcfjN1LQSScF9bLmYMpIuSmHtawi1W2c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dn6lxCakEg6uASYIXyVpP/I6uq7CIElvHrQD6ODfRLKCnEklWrmQygSkIHo+VcKJZ Cfnu0xrSY0IVFZS3p2uo3xzeRIlFF9R7snHY0zKI1kIbIwiyAHbnmYjKFtOKmEvXP0 E6ykY9wTmCaKn7Zsf4Znaazn82So4FmwCzLE8k30= 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.4 016/255] can: kvaser_usb: Fix use of uninitialized completion Date: Mon, 24 Oct 2022 13:28:46 +0200 Message-Id: <20221024113002.973471295@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573217151722241?= X-GMAIL-MSGID: =?utf-8?q?1747573217151722241?= 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 @@ -690,6 +690,7 @@ static int kvaser_usb_init_one(struct kv init_usb_anchor(&priv->tx_submitted); init_completion(&priv->start_comp); init_completion(&priv->stop_comp); + init_completion(&priv->flush_comp); priv->can.ctrlmode_supported = 0; priv->dev = dev; --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c @@ -1886,7 +1886,7 @@ static int kvaser_usb_hydra_flush_queue( { int err; - init_completion(&priv->flush_comp); + reinit_completion(&priv->flush_comp); err = kvaser_usb_hydra_send_simple_cmd(priv->dev, CMD_FLUSH_QUEUE, priv->channel); From patchwork Mon Oct 24 11: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: 8856 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp432993wru; Mon, 24 Oct 2022 05:48:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6B9Kn6C3SH/vpovTpAyWWXaXSvVil+ZxoDeJzW9Zag30QwnSuMc7aafUrqMi1ZCEVpYx6R X-Received: by 2002:a65:4943:0:b0:46e:f5e3:3e94 with SMTP id q3-20020a654943000000b0046ef5e33e94mr6752200pgs.75.1666615697141; Mon, 24 Oct 2022 05:48:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615697; cv=none; d=google.com; s=arc-20160816; b=dZm5R+Pbt6uVqwbLA6ikYRASmUrVktnqOA3x+9mwC92qd+cWfbFyu2bINanB+Zg8IL WyjsYuP4Qeuwcunh64v4bUv3CFPHgANBcbwXnfKBnMZJ2PYKseohz4a23/WzxQlN2NNF OKr143Oj80yZZHOc9vxJHcdVZTG1MUsvOGu4sAci7WJ9QzIGmqT4S88XQ3VGbRCzl1DR JTu9LZaVObrYToLbsU1lwSSS2B4anSIwegacdGScVyxp7yo2bO27QTsYkU4RyXcAagMJ 780xF7FOCQ/5n0P3eLPdSXKLovCw6T3yKIIhSPDNxSUXQfiqi16Qge3bN9TsYJIBH8ZP EmoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=G6+hPiKUYlJTdOD7Xzt85ZC8HUsbwqsfPg1fp/KOQNU=; b=lKLeZI2q1R7H3VPSLUAMnY8JSs4p1Q/wMKal3jSUe7rwvFD8LstzsG5StdkazxyuGZ 7aPWj3/biaWVGt9cM2ijhy4dinxg7vUg2Wxe6jqq4wb8DpWAYcOFbJcTqP4ZLMtQqrGR 5sHRFbKBEddOrQQihktKtXjQwYO9wRLgfXhJn3Yhs3KhIwn6zn8GbUkc2Vq/Sr221ATp pjQ1HzhiT9frGq7Oo3oNrYB2TPwGtP8gdrTUz2PB0U+ezgnqbScMwkR4eusfJliAMyVy sJdqgD4HEay+iP48wouYhDul4SaqRn/jQgNlrEoXUvaqDajwrhut2Cu8xZJA+xzDFHU1 Cy0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k6zjV0Ex; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f18-20020a63f752000000b0042ad28ace95si36126500pgk.832.2022.10.24.05.48.03; Mon, 24 Oct 2022 05:48: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=k6zjV0Ex; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229959AbiJXMkc (ORCPT + 99 others); Mon, 24 Oct 2022 08:40:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234736AbiJXMft (ORCPT ); Mon, 24 Oct 2022 08:35: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 A5E157CB48; Mon, 24 Oct 2022 05:05: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 61F5B612D8; Mon, 24 Oct 2022 12:05:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 737C3C433D6; Mon, 24 Oct 2022 12:05:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613121; bh=FfZJQ7cgeQy24SFeoZdkQ03d0JuMApp87TbnvR3NJuY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k6zjV0Ex0cSEZo/HKxQa5x6e6ZTy7y61DEi1ooW4UkrmyeapF387JqnPNiMRMG8iQ 587zN0+BCZp+iVBlD2H8PnU8xhr2zYYmw8DYY9SScfzsNMX8Wg6Eonm7jDlgNpd/0c oaskDGDG+h68gtw5sIU/z/czZQET2gSp6WndYfjQ= 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.4 017/255] can: kvaser_usb_leaf: Fix overread with an invalid command Date: Mon, 24 Oct 2022 13:28:47 +0200 Message-Id: <20221024113003.001904612@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573221439178367?= X-GMAIL-MSGID: =?utf-8?q?1747573221439178367?= From: Anssi Hannula commit 1499ecaea9d2ba68d5e18d80573b4561a8dc4ee7 upstream. For command events read from the device, kvaser_usb_leaf_read_bulk_callback() verifies that cmd->len does not exceed the size of the received data, but the actual kvaser_cmd handlers will happily read any kvaser_cmd fields without checking for cmd->len. This can cause an overread if the last cmd in the buffer is shorter than expected for the command type (with cmd->len showing the actual short size). Maximum overread seems to be 22 bytes (CMD_LEAF_LOG_MESSAGE), some of which are delivered to userspace as-is. Fix that by verifying the length of command before handling it. This issue can only occur after RX URBs have been set up, i.e. the interface has been opened at least once. Cc: stable@vger.kernel.org Fixes: 080f40a6fa28 ("can: kvaser_usb: Add support for Kvaser CAN/USB devices") Tested-by: Jimmy Assarsson Signed-off-by: Anssi Hannula Signed-off-by: Jimmy Assarsson Link: https://lore.kernel.org/all/20221010150829.199676-2-extja@kvaser.com Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 75 +++++++++++++++++++++++ 1 file changed, 75 insertions(+) --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c @@ -309,6 +309,38 @@ struct kvaser_cmd { } u; } __packed; +#define CMD_SIZE_ANY 0xff +#define kvaser_fsize(field) sizeof_field(struct kvaser_cmd, field) + +static const u8 kvaser_usb_leaf_cmd_sizes_leaf[] = { + [CMD_START_CHIP_REPLY] = kvaser_fsize(u.simple), + [CMD_STOP_CHIP_REPLY] = kvaser_fsize(u.simple), + [CMD_GET_CARD_INFO_REPLY] = kvaser_fsize(u.cardinfo), + [CMD_TX_ACKNOWLEDGE] = kvaser_fsize(u.tx_acknowledge_header), + [CMD_GET_SOFTWARE_INFO_REPLY] = kvaser_fsize(u.leaf.softinfo), + [CMD_RX_STD_MESSAGE] = kvaser_fsize(u.leaf.rx_can), + [CMD_RX_EXT_MESSAGE] = kvaser_fsize(u.leaf.rx_can), + [CMD_LEAF_LOG_MESSAGE] = kvaser_fsize(u.leaf.log_message), + [CMD_CHIP_STATE_EVENT] = kvaser_fsize(u.leaf.chip_state_event), + [CMD_CAN_ERROR_EVENT] = kvaser_fsize(u.leaf.error_event), + /* ignored events: */ + [CMD_FLUSH_QUEUE_REPLY] = CMD_SIZE_ANY, +}; + +static const u8 kvaser_usb_leaf_cmd_sizes_usbcan[] = { + [CMD_START_CHIP_REPLY] = kvaser_fsize(u.simple), + [CMD_STOP_CHIP_REPLY] = kvaser_fsize(u.simple), + [CMD_GET_CARD_INFO_REPLY] = kvaser_fsize(u.cardinfo), + [CMD_TX_ACKNOWLEDGE] = kvaser_fsize(u.tx_acknowledge_header), + [CMD_GET_SOFTWARE_INFO_REPLY] = kvaser_fsize(u.usbcan.softinfo), + [CMD_RX_STD_MESSAGE] = kvaser_fsize(u.usbcan.rx_can), + [CMD_RX_EXT_MESSAGE] = kvaser_fsize(u.usbcan.rx_can), + [CMD_CHIP_STATE_EVENT] = kvaser_fsize(u.usbcan.chip_state_event), + [CMD_CAN_ERROR_EVENT] = kvaser_fsize(u.usbcan.error_event), + /* ignored events: */ + [CMD_USBCAN_CLOCK_OVERFLOW_EVENT] = CMD_SIZE_ANY, +}; + /* Summary of a kvaser error event, for a unified Leaf/Usbcan error * handling. Some discrepancies between the two families exist: * @@ -396,6 +428,43 @@ static const struct kvaser_usb_dev_cfg k .bittiming_const = &kvaser_usb_flexc_bittiming_const, }; +static int kvaser_usb_leaf_verify_size(const struct kvaser_usb *dev, + const struct kvaser_cmd *cmd) +{ + /* buffer size >= cmd->len ensured by caller */ + u8 min_size = 0; + + switch (dev->driver_info->family) { + case KVASER_LEAF: + if (cmd->id < ARRAY_SIZE(kvaser_usb_leaf_cmd_sizes_leaf)) + min_size = kvaser_usb_leaf_cmd_sizes_leaf[cmd->id]; + break; + case KVASER_USBCAN: + if (cmd->id < ARRAY_SIZE(kvaser_usb_leaf_cmd_sizes_usbcan)) + min_size = kvaser_usb_leaf_cmd_sizes_usbcan[cmd->id]; + break; + } + + if (min_size == CMD_SIZE_ANY) + return 0; + + if (min_size) { + min_size += CMD_HEADER_LEN; + if (cmd->len >= min_size) + return 0; + + dev_err_ratelimited(&dev->intf->dev, + "Received command %u too short (size %u, needed %u)", + cmd->id, cmd->len, min_size); + return -EIO; + } + + dev_warn_ratelimited(&dev->intf->dev, + "Unhandled command (%d, size %d)\n", + cmd->id, cmd->len); + return -EINVAL; +} + static void * kvaser_usb_leaf_frame_to_cmd(const struct kvaser_usb_net_priv *priv, const struct sk_buff *skb, int *frame_len, @@ -503,6 +572,9 @@ static int kvaser_usb_leaf_wait_cmd(cons end: kfree(buf); + if (err == 0) + err = kvaser_usb_leaf_verify_size(dev, cmd); + return err; } @@ -1137,6 +1209,9 @@ static void kvaser_usb_leaf_stop_chip_re static void kvaser_usb_leaf_handle_command(const struct kvaser_usb *dev, const struct kvaser_cmd *cmd) { + if (kvaser_usb_leaf_verify_size(dev, cmd) < 0) + return; + switch (cmd->id) { case CMD_START_CHIP_REPLY: kvaser_usb_leaf_start_chip_reply(dev, cmd); From patchwork Mon Oct 24 11: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: 8979 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp438603wru; Mon, 24 Oct 2022 06:01:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7GukSBfQrz6Kxj3bG+lOVYxVNH3ASaFo6u/CL+AMA0uMdGwlZlFSwF0FpzN4B/n8zOflJ4 X-Received: by 2002:a17:903:41c7:b0:182:a32f:4db5 with SMTP id u7-20020a17090341c700b00182a32f4db5mr33377840ple.22.1666616494334; Mon, 24 Oct 2022 06:01:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616494; cv=none; d=google.com; s=arc-20160816; b=ghlCvPhz/HzRrb/p6ARjlq20WV4dMZPcvoPXgU3kriN7bPJ58/Khrruje0kQtzDq5Z 56ZbkaseaCx/BKc4O3L36sYSZQeE1lKpjSx9Xi3Bp3mlOnm/oZp3dPrVmZA1YnHP9jho KEDeoVohknVFgdt1m2xgTmAr89QHx1Q5t0tDIn4rjzCaj6c+Yc3hj7jCWcl+trbe7DbS eKocMN1bB+O8a9XQ0stLWdsx+MdORPImzRv974GHD9RwJG1SDWJIy6jtIunSYOVyKide Cup3QMf9MN5D59jVDAECYWqzJ2WjcZT4TIT4oYsye/1PE79MRGwZWsQQGDoveOWnWRch PzbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FItYcj3d90E13OAXhbQyW+ZGqKFJfAayNRBymu5q/74=; b=DoE7UcvTpmOMeQGR+ZmgxF9pRPh2p8UZftQLIWDfTTOQHqYt1oGpurjxZ+ZCEekdbG J+6pDm59bFJ9GGoAVFe0T+2VGHzz9ZF/XdXTrThETAMlaG/tiDNjN5z2ehf85d3VhtGw nwp/CiREWK3Mby9DcK5Zer3W9/guKAaxceFPZpYV08En/+5KhVH+THUN+S/0UNg7lahE YwxEQpUx7x43yVBfdsv+c4HoehpyftHPaLnLvpGeYVQ9hb/FYtQQBBilbUJ5L8tiLqKh cFHAG34LELkkalQWOxYFaZu9CJGRSEMJ0UpDqCveGgW+Hw2lZ28yDNPIeyX6BVfuyiFe B3aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tcvF8UQB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u200-20020a6279d1000000b0056b8ae6149csi7549544pfc.244.2022.10.24.06.01.01; Mon, 24 Oct 2022 06:01: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=tcvF8UQB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234928AbiJXNAn (ORCPT + 99 others); Mon, 24 Oct 2022 09:00:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234771AbiJXM6i (ORCPT ); Mon, 24 Oct 2022 08:58: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 B898181116; Mon, 24 Oct 2022 05:17: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 06942612CD; Mon, 24 Oct 2022 12:05:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 194BDC433C1; Mon, 24 Oct 2022 12:05:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613124; bh=547xsTNwHNS98HazWD5C1d4zRtBg8qNe5JpQzIaOh8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tcvF8UQBw9xmkOsPUSQ9iJCC0O/Y/lSy5GemcCnd0mpCyh2o3REevqq2ljjZk+ydf G/9Xdylk1dgwim2f0y57tMfuGiW2ZTK9zRtP/OuCzgNhosn0gRyMzgu1jKbTU3w+uc ZJhpcSg+c1gVQFNehx3yhQzrJ4dayC3amWIxn/FU= 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.4 018/255] can: kvaser_usb_leaf: Fix TX queue out of sync after restart Date: Mon, 24 Oct 2022 13:28:48 +0200 Message-Id: <20221024113003.031211772@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574057109046156?= X-GMAIL-MSGID: =?utf-8?q?1747574057109046156?= From: Anssi Hannula commit 455561fb618fde40558776b5b8435f9420f335db upstream. The TX queue seems to be implicitly flushed by the hardware during bus-off or bus-off recovery, but the driver does not reset the TX bookkeeping. Despite not resetting TX bookkeeping the driver still re-enables TX queue unconditionally, leading to "cannot find free context" / NETDEV_TX_BUSY errors if the TX queue was full at bus-off time. Fix that by resetting TX bookkeeping on CAN restart. Tested with 0bfd:0124 Kvaser Mini PCI Express 2xHS FW 4.18.778. Cc: stable@vger.kernel.org Fixes: 080f40a6fa28 ("can: kvaser_usb: Add support for Kvaser CAN/USB devices") Tested-by: Jimmy Assarsson Signed-off-by: Anssi Hannula Signed-off-by: Jimmy Assarsson Link: https://lore.kernel.org/all/20221010150829.199676-4-extja@kvaser.com Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/usb/kvaser_usb/kvaser_usb.h | 2 ++ drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 2 +- drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb.h +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb.h @@ -178,6 +178,8 @@ struct kvaser_usb_dev_cfg { extern const struct kvaser_usb_dev_ops kvaser_usb_hydra_dev_ops; extern const struct kvaser_usb_dev_ops kvaser_usb_leaf_dev_ops; +void kvaser_usb_unlink_tx_urbs(struct kvaser_usb_net_priv *priv); + int kvaser_usb_recv_cmd(const struct kvaser_usb *dev, void *cmd, int len, int *actual_len); --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c @@ -453,7 +453,7 @@ static void kvaser_usb_reset_tx_urb_cont /* This method might sleep. Do not call it in the atomic context * of URB completions. */ -static void kvaser_usb_unlink_tx_urbs(struct kvaser_usb_net_priv *priv) +void kvaser_usb_unlink_tx_urbs(struct kvaser_usb_net_priv *priv) { usb_kill_anchored_urbs(&priv->tx_submitted); kvaser_usb_reset_tx_urb_contexts(priv); --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c @@ -1430,6 +1430,8 @@ static int kvaser_usb_leaf_set_mode(stru switch (mode) { case CAN_MODE_START: + kvaser_usb_unlink_tx_urbs(priv); + err = kvaser_usb_leaf_simple_cmd_async(priv, CMD_START_CHIP); if (err) return err; From patchwork Mon Oct 24 11: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: 9123 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456314wru; Mon, 24 Oct 2022 06:34:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6J2r2PCd3o3WW1ECaXWiquogMVfoJ+YDNlHDmHqcDc2JLMMJ2jhUPpVyVWfZpJScSGwPV2 X-Received: by 2002:a17:90a:ae01:b0:20c:2630:528a with SMTP id t1-20020a17090aae0100b0020c2630528amr38064100pjq.37.1666618440292; Mon, 24 Oct 2022 06:34:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618440; cv=none; d=google.com; s=arc-20160816; b=AYx+4OiN7W/Gfb9hO0WYkohs/EN2foM+ltXJX6OPTOoem9rnhCn36aXve5YTq58hdw 2A9CK03h5VBT3P2ZuEYwMPVA9oixNDAlbrBmCXWcqBcfnvFo9uWchfR8mrS6e/sLf+QX TE1CI6FSo4MqzMGgrsxRT+i+8r/rTlfigQe+pWp9S5YHqtWVjDuTirhs3OXWJ6itocfy QX/eU3BY0rmraKPHamnJ0qF8p5QHnJFAWXOs4tNy2vu8frLZnxCEDu++jBkLIRR6KFfw UEaePlS+6xmJWMNPxVhNP1x7bsbLWQLhRKkC43ncAu2SbCIjjnylrwb5q5cvAlys//I+ EIIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vN+CgVtYtcqDm+eDdaDfnVwlg+RuOg1/We6A3w/O6rc=; b=QKcyFtDUXoNZnNUk2jY1X4C+3IsX5vWaXbMHdFH4+FyCyvtx6cE289jLLOJ2fy+As1 yXf0/Jyy+60gDF9V9IAYlGDLb7A6a6Wv0oP5KcbgrEgnhP011HTGWKacte8FuB6p4vPc eTV5Uq+bBfw/5sUp8av2ryCuX/LI2EXTTRJaeWTPZV/wpsDJiEb3afoyRDXZXeXcIqIW 3Y6CxOTAF/qlZL/cs+D4Aes4FKHCOx/E682pmeTcb8Ii93FFABvJ4mX29oF6QufhtATa WPM4d59NUE+kcNNoTiWutmEI33LmLvzi22mDp12JzxQlVban84cDELtFEuxGAcDmGFwH +6Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WMIaN0oD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902e5c400b001846e0e0511si42941064plf.226.2022.10.24.06.33.41; Mon, 24 Oct 2022 06: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=WMIaN0oD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232330AbiJXNU4 (ORCPT + 99 others); Mon, 24 Oct 2022 09:20:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236022AbiJXNTC (ORCPT ); Mon, 24 Oct 2022 09: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 7D4A1A5722; Mon, 24 Oct 2022 05:27: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 539C4B811BE; Mon, 24 Oct 2022 12:05:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8EA6C433D6; Mon, 24 Oct 2022 12:05:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613127; bh=tuRrGyRDE5pfd9u7YgYcnNL8Vy+H8he/V121FPx+c8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WMIaN0oDx1KSUEeScdOwn3kXgJYgYLyEMgh0lljyU5pvTmyQtztpvO2evEAM4bLKL /AMI34kxHKnRzxd91rXks5lwch8GM8RR6J67pcqhlT3R97ecHOT2Inpq0T70gLUcuG cJxOGJPgrAU7B+KFJMjf7ERCF4NBjUSLE04DC/zU= 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.4 019/255] can: kvaser_usb_leaf: Fix CAN state after restart Date: Mon, 24 Oct 2022 13:28:49 +0200 Message-Id: <20221024113003.075321750@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576097589593584?= X-GMAIL-MSGID: =?utf-8?q?1747576097589593584?= From: Anssi Hannula commit 0be1a655fe68c8e6dcadbcbddb69cf2fb29881f5 upstream. can_restart() expects CMD_START_CHIP to set the error state to ERROR_ACTIVE as it calls netif_carrier_on() immediately afterwards. Otherwise the user may immediately trigger restart again and hit a BUG_ON() in can_restart(). Fix kvaser_usb_leaf set_mode(CMD_START_CHIP) to set the expected state. Cc: stable@vger.kernel.org Fixes: 080f40a6fa28 ("can: kvaser_usb: Add support for Kvaser CAN/USB devices") Tested-by: Jimmy Assarsson Signed-off-by: Anssi Hannula Signed-off-by: Jimmy Assarsson Link: https://lore.kernel.org/all/20221010150829.199676-5-extja@kvaser.com Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c @@ -1435,6 +1435,8 @@ static int kvaser_usb_leaf_set_mode(stru err = kvaser_usb_leaf_simple_cmd_async(priv, CMD_START_CHIP); if (err) return err; + + priv->can.state = CAN_STATE_ERROR_ACTIVE; break; default: return -EOPNOTSUPP; From patchwork Mon Oct 24 11: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: 8868 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433185wru; Mon, 24 Oct 2022 05:48:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7WAj6G+hfe3THE5MvJv33STOnOk0rNkKbKYWogYS7nSWH0Eb4SalfVOCWl03UggENBQSUf X-Received: by 2002:a05:6a00:b54:b0:566:917:e57e with SMTP id p20-20020a056a000b5400b005660917e57emr33206425pfo.26.1666615726053; Mon, 24 Oct 2022 05:48:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615726; cv=none; d=google.com; s=arc-20160816; b=ZK3pk38OcE2Ex4ENhnAoluw9+lYQov8U0GQobO+Y7AS9GsRTBurcXAe4sjFI/SBmaq KsWGBxzvWG2QzxIw17CbS5cxo5r4syLi0k9Ny9TCCTObgJzfJMScCaXAyv+bHNYLKJ3k DKcULhI+gE5bu4QXVte8rw5w21nFH+jf9n5cV7BL13D6MSwwAU85okLx++viGmpzW+pD DiVB0grT/FestT5UoVjQS9RYQMylOsItVwaxD12SRyDFoyPFiOO2n6U3Pv5COjujzTa9 ceOg+MWIgkyvWsC+oespQvp6u9oY//l+H3IKp+lg6GLEFYvEAWF4dReftgXadH3Awylk T5Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DCoMuCP189FMDQ4Ff8Rp4sHylqmaYqYx/f6zqcqiW64=; b=lShPd7iUhiAavrdsnBjmjYmGckDnqwONog9dXUFJcUDm7B1RmopT546lpjgWpK3tQZ H62b6jEEjFkwPomXb20tGAqze/RSYcP0HGkipD2an9iikccoPO2cYkLv+PE78bfYONhy UPrPUL59s15ZNFYYzfaQ90Xz3pqaI/hIZY4c2Zx892ZffNVNZYMtNG7GwBBAoybk85Tz gqXx71+RO3+KEGwEGBvGM3TxWJGqXkpWNRgTr8odYvs0kVE6VJZ8GKWFMj+JpE5C6Kku Ec4uzdnCSM/6UagxOsnyRctPdM/91VJHEiurwuND6siC7VlPAmL6Ux/UTWyGy+Zbwe++ 5Y2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zY9mTwZY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d24-20020a63f258000000b0046ef21af717si7082826pgk.683.2022.10.24.05.48.32; Mon, 24 Oct 2022 05:48:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zY9mTwZY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231904AbiJXMkx (ORCPT + 99 others); Mon, 24 Oct 2022 08:40:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232303AbiJXMhC (ORCPT ); Mon, 24 Oct 2022 08:37: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 A2E1D8994A; Mon, 24 Oct 2022 05:06: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 D382E612F0; Mon, 24 Oct 2022 12:05:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E350CC433C1; Mon, 24 Oct 2022 12:05:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613132; bh=urrhEJtct4bcw8a1xS0BclzyA+n+yNouVsNJBzE1OLE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zY9mTwZYwgq1EomY6r3eQMa+2znDocgz+/K1hq5N3Sd9EtewKYPUtegt0V6w+GvZ7 v0h7mhkCIw5MULJUUSDLmeKUPw4HI4atuDY/kWEy8Muk6fF4bJ0acSDYZo9dIndr/3 dW8G7MIN0BdWWJqm9F76fiv7j9y6Lw4zOufkEDmA= 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.4 020/255] mmc: sdhci-sprd: Fix minimum clock limit Date: Mon, 24 Oct 2022 13:28:50 +0200 Message-Id: <20221024113003.109807512@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573251519107085?= X-GMAIL-MSGID: =?utf-8?q?1747573251519107085?= 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 @@ -295,7 +295,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 Mon Oct 24 11:28:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8872 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433206wru; Mon, 24 Oct 2022 05:48:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4xiQZW/lCe0taGZLCTLu7UitrtwZKO3grbSht6CkkiowBh74pr7P8grUKd3yeY154apiy2 X-Received: by 2002:a17:902:ef4d:b0:181:98d1:69c0 with SMTP id e13-20020a170902ef4d00b0018198d169c0mr34364386plx.45.1666615729686; Mon, 24 Oct 2022 05:48:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615729; cv=none; d=google.com; s=arc-20160816; b=J8mVy/8vi+Tr317WVhEoYlRZNKHswr9tCVPjqOy9SHGfEhkdbLJUxDcR78sC0uvGBB 5McXec2HQ+RXdcizf8lVzPQFMzUs1UnJ7hMmKaA91otgggmxhxrkryi+Ccw1Yblj7eS7 qVWGLVbVOYSU42y+ig/513IpRq+S82bhMz0tKFQte3s+p9YTm8XQlJbEPJHf0EM//TB0 xCy+0lon0754y2zcchrxWzPoFBl5TzShgXOj94Jsfn+cfRTCs5A/xHPQYbeO+eKx8BPU TGwD+QBOOtuYJudQbE0zc2Pm8PnFLWv5iN46V+qvgIbE5o7VT0VC32tjdkyVXz9gqK/D Za2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hmXdpMxOmd4MJuzvpU/cDsAiYsy+E2+329gIPH+Djks=; b=kJHg2FfyGV8l0uxGi8XH5PVNSo88wGxhgmKNjr2e1K5U9269EyevQ01ic8PGin7SL1 43m5LNHU3PjzFgv+5hwdGvh+tRFvbI2RkNDbAKHnASfCgKpQVKq8SEodQR3iDHP1Mluq pmJsRWtawqbJjMleDpeLqKUfAY0Zg0IH2mWc3Pz8Q1/0ZxlPXa1Ys/fWvkNEM46HXyah 61nCtAyvTCxp34375MFPq940codw/wUyioaL0jemwQGgij1lhwmANyEZjE+Rdw4Rjyto xbTe5PsnbORmIeDjpf9zyNLM+iOcgSUb0AFJnipupmtGd9typcADz+ghnbK7dKog8bgz nQFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RJjZLCZQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902f70800b0017f59ed2dfasi32239734plo.63.2022.10.24.05.48.35; Mon, 24 Oct 2022 05:48:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RJjZLCZQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232456AbiJXMlM (ORCPT + 99 others); Mon, 24 Oct 2022 08:41:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232678AbiJXMhC (ORCPT ); Mon, 24 Oct 2022 08:37: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 7985C8997B; Mon, 24 Oct 2022 05:06: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 7207B61295; Mon, 24 Oct 2022 12:05:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84E42C433C1; Mon, 24 Oct 2022 12:05:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613134; bh=Awcd/0SSmDN83dUDpNoaIq8lTcT014AjU8Qvxm5qHes=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RJjZLCZQtoJ5d+73L8y4qm/LOK8ooBMy5HaL/QrNmgfP4sgQRN0itQ2nnVz2noYZM MVjBzLv24tQ8dWkAVnKvWICwnKLVKYB/B/ll29N8xOqq/t84CZZK1c7fsT/6E7+Ogz JM6kq0p2oTTk2IRyPH8ysJUoy6S7wCKRuuIoyO04= 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.4 021/255] fs: dlm: fix race between test_bit() and queue_work() Date: Mon, 24 Oct 2022 13:28:51 +0200 Message-Id: <20221024113003.142544466@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573255845024167?= X-GMAIL-MSGID: =?utf-8?q?1747573255845024167?= 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 @@ -198,13 +198,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); @@ -284,7 +284,9 @@ void dlm_callback_stop(struct dlm_ls *ls void dlm_callback_suspend(struct dlm_ls *ls) { + mutex_lock(&ls->ls_cb_mutex); set_bit(LSFL_CB_DELAY, &ls->ls_flags); + mutex_unlock(&ls->ls_cb_mutex); if (ls->ls_callback_wq) flush_workqueue(ls->ls_callback_wq); From patchwork Mon Oct 24 11: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: 10219 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp642785wru; Mon, 24 Oct 2022 13:39:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6E0wCC2sPhVPjHm+Pe2cdbi/CEmQt9QPtGCi8XO1LcQPLgTLPS8sJukZWDlSpeUDur0yLj X-Received: by 2002:a17:90b:4f4d:b0:20d:a08e:3876 with SMTP id pj13-20020a17090b4f4d00b0020da08e3876mr70425446pjb.0.1666643974681; Mon, 24 Oct 2022 13:39:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643974; cv=none; d=google.com; s=arc-20160816; b=BdXvj1gFLQSA55VRVRT0OiNRu4Br35yyBufv5iweZGB4JVIBH8q+6XVjrqcFFVykpt bMWFmCWF3DRtrbuhAOTpCVFQ3FK0n2NaVqX5a4Auz9mQSDVFCpsODCIsSayvrQnOwJj5 eoymBJjv2nf1gmmCh072C1b977bnX/cmxhSJYzlyVqrz/cZPBSI5yDAizbkgCJ3ihVLf hTc9nDalsui46saS2hWi+asanYK8pv+4OBZsPbB+79UBMAN6aYnlm2dFaN3HjMMH5oXC X17MaAxWyhOeGuynQaqwh9htYZNP5z+lAeO924dO5s6qS5H0VIwVNWESGAkhWXYmYi5U f1ZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zoLsly3rSX2k+tJrefEqaG3ZAdumxmHDrsw1ro01eYY=; b=n+9PyJl7XcOUpKImyHJFCmeltSrmbk2KUOhbtMVNDgBT3No0HtSGCFqnHgrl5rWIgd o6z5bvkI7e4AZ47DCCnuZ0v+Sfqqku9d/i+Fqc3WCaeXj2lkwrb2TDSlhIWW22dxQ0zT nsYpa92bYhpdh4T6eQ2vbqTUJYH6Zz2Ok2cFDn3e4OhphXCDMgODCSyEameb8Yhj+NUD 7C7TBnJOTMSV0fskEcfYaIzpXOqYIeYdn4gBsgkZuvWzGotnkeT9BHtaMQRG4t+O/NEf gixt+Xg/OxG7M4yDoRjlhE3ZE1E3I7S8XR9khrevtE2U8N0Zb2Vezxb8/YcM4UwTpBmB XBzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="KN/C7Au1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f18-20020a63f112000000b00434e297a5ccsi553062pgi.142.2022.10.24.13.39.20; Mon, 24 Oct 2022 13:39: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="KN/C7Au1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234533AbiJXUh5 (ORCPT + 99 others); Mon, 24 Oct 2022 16:37:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234527AbiJXUhW (ORCPT ); Mon, 24 Oct 2022 16:37: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 B34BC1D818B; Mon, 24 Oct 2022 11:48: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 BBFAAB81252; Mon, 24 Oct 2022 12:05:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21AE5C433D7; Mon, 24 Oct 2022 12:05:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613137; bh=HyQXrJH1l3T0A4SR0/zGg1i70pBwz1wEYQUnliiTFqs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KN/C7Au1S/hQU+SmL4GQjC5c26LoJdEqnL+BfdWIokRZS1/TQ92yTMT8O8IWluwIL /ZBBaGnEGW/wYEb7T0TxfEvbb8Nb9fanoT05WMwJS/5z4q5ECh7sFRG4yMK1yrliiH Omt4toLM4YhOETvKBoQbUdThnGrnzMBr7XJgTs9Q= 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.4 022/255] fs: dlm: handle -EBUSY first in lock arg validation Date: Mon, 24 Oct 2022 13:28:52 +0200 Message-Id: <20221024113003.179425329@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602872588716346?= X-GMAIL-MSGID: =?utf-8?q?1747602872588716346?= From: Alexander Aring commit 44637ca41d551d409a481117b07fa209b330fca9 upstream. During lock arg validation, first check for -EBUSY cases, then for -EINVAL cases. The -EINVAL checks look at lkb state variables which are not stable when an lkb is busy and would cause an -EBUSY result, e.g. lkb->lkb_grmode. Cc: stable@vger.kernel.org Signed-off-by: Alexander Aring Signed-off-by: David Teigland Signed-off-by: Greg Kroah-Hartman --- fs/dlm/lock.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c @@ -2888,24 +2888,24 @@ static int set_unlock_args(uint32_t flag static int validate_lock_args(struct dlm_ls *ls, struct dlm_lkb *lkb, struct dlm_args *args) { - int rv = -EINVAL; + int rv = -EBUSY; if (args->flags & DLM_LKF_CONVERT) { - if (lkb->lkb_flags & DLM_IFL_MSTCPY) + if (lkb->lkb_status != DLM_LKSTS_GRANTED) goto out; - if (args->flags & DLM_LKF_QUECVT && - !__quecvt_compat_matrix[lkb->lkb_grmode+1][args->mode+1]) + if (lkb->lkb_wait_type) goto out; - rv = -EBUSY; - if (lkb->lkb_status != DLM_LKSTS_GRANTED) + if (is_overlap(lkb)) goto out; - if (lkb->lkb_wait_type) + rv = -EINVAL; + if (lkb->lkb_flags & DLM_IFL_MSTCPY) goto out; - if (is_overlap(lkb)) + if (args->flags & DLM_LKF_QUECVT && + !__quecvt_compat_matrix[lkb->lkb_grmode+1][args->mode+1]) goto out; } From patchwork Mon Oct 24 11: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: 9762 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp550226wru; Mon, 24 Oct 2022 09:45:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5spd/wkVzeSUrSxCq8NfF340YN2Fp2zQJO/vxCDNWsyRKvc37is7tXtfOztVuC17Fl8DiT X-Received: by 2002:a17:90b:1e4c:b0:213:32a5:a778 with SMTP id pi12-20020a17090b1e4c00b0021332a5a778mr1654426pjb.172.1666629935304; Mon, 24 Oct 2022 09:45:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629935; cv=none; d=google.com; s=arc-20160816; b=MwdsCXstMlG2YXYi7RCITKV8BEthr9YTLksSYpSoFNZczDUEkCaj7cols+Ni0jW+y3 0cCrfiByaFOEPPVAm+FUar/W4Qrr7KXlotd6AGAWWXFwywN5I3FIlt3gqUOXNsRXhdmP wufcifXkFRJ9O5YH/FwoevVmcp1ILoOP25HRpnXWv1JOZUBI7k/lBjun46HNkygseGhp ymA7bQKQHNZc1cl8vE22P/Mv0mE8YwC+DOvKqCsYWJSnQX/VZ5XFU9qcwAs9bt2kCLT8 ijK4EqoyOzvNvFEODmOMCApWWIIj4g7igX4UhOVbcj+aDMwZEGFPVTeYg6t0vsaYp9Um OJrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RCXAHMnwp2QUgqpOtbSvyxFSvrnyD+e5biFEcIG11H8=; b=UYDKG/BnNE1htSYfIVld7Wn8x6QpG9Dl0IpFVz1KaDh+wRmVOPBMxfGKRRPf6W8s2H GJxYz/fivYyNHG4KlDoVtsAmirswgGgXTqXIUf9asOc8D6p4S73fvhuCWf8XHls0inDD rzRGtAi79YPaWG3A9nwRIwDV6re06srKVfUu/416PlBwjzJ0+fIgzQbg2uBLZ3BG0Br8 XUqATw9tvnU0hjZRUhh/dSF1dHWKNB6sVBXkaU1k1vT0JOw0h3R34Ie5Xwnp11YPU1+c hpNRRsZbAKNiunICy/gJtfhQrUOM13SPchaNX78q1cYp3VH0jQMUSdM9J3kqO8g2a0wA nIpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=r6stMrOv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j13-20020a65558d000000b0041cc7bac015si38600871pgs.102.2022.10.24.09.45.21; Mon, 24 Oct 2022 09:45: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=r6stMrOv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234792AbiJXQo4 (ORCPT + 99 others); Mon, 24 Oct 2022 12:44:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234953AbiJXQoF (ORCPT ); Mon, 24 Oct 2022 12:44:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4F49C5893; Mon, 24 Oct 2022 08:30: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 352D6B8125B; Mon, 24 Oct 2022 12:07:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A1AFC433D6; Mon, 24 Oct 2022 12:07:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613242; bh=9shEacYI84F8JDBsGRgFtl6swnxAE9iunptkZdKsg9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r6stMrOv0NDAf1BK7Q1Tabk3sqRwOPYGxRMWAbsuxnFlcE0PLED57eZGR8B5lLVyq JnerTkpmGWUkKZgHiHccrmLdA4ZWfdm0EEnUL92SSdjMgN3p6uAVe56LQVycZqhwMF wIsAMS6Ii+RGeSqCvK7lB8x9nc/RGftCKS0GDbEM= 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.4 023/255] HID: multitouch: Add memory barriers Date: Mon, 24 Oct 2022 13:28:53 +0200 Message-Id: <20221024113003.209473654@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747588150994998559?= X-GMAIL-MSGID: =?utf-8?q?1747588150994998559?= 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 @@ -1162,7 +1162,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; @@ -1243,7 +1243,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, @@ -1680,11 +1680,11 @@ static void mt_expired_timeout(struct ti * An input report came in just before we release the sticky fingers, * it will take care of the sticky fingers. */ - if (test_and_set_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags)) + if (test_and_set_bit_lock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags)) return; if (test_bit(MT_IO_FLAGS_PENDING_SLOTS, &td->mt_io_flags)) mt_release_contacts(hdev); - clear_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); + clear_bit_unlock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); } static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) From patchwork Mon Oct 24 11: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: 9229 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp460884wru; Mon, 24 Oct 2022 06:42:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5gBhAadzuBylPYGfoxbHEaLKvEAdOBbgY9wG8pcvZtBunwVqlBrm/88JCxQ0Ji24OVpx1O X-Received: by 2002:a17:907:720d:b0:7a9:b7e6:8612 with SMTP id dr13-20020a170907720d00b007a9b7e68612mr2749185ejc.435.1666618959330; Mon, 24 Oct 2022 06:42:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618959; cv=none; d=google.com; s=arc-20160816; b=k9vxSrlTg0TdNM0n4mAO+08ZjipeZEZGnf5lC4tdn3U/WasG/FgsT3hG+JTVJbYP4o L08oTIpP1IjQLq+LfFMDHPmX0Tz5DT0jFA5OrfYK37zZ26NXBDy2NnqnfPxjqHDYIZfe fp8GmNkbJJJn2N9fixh8N6jPp/hp0RAAdnDN3gPfqf6ptjczi3LTm7sO4wLVwR+FMaQ2 rBmwU7sxWwsORCAmX/kBLZfhhs0xNlusP+SaYgCiEkSy97hGKOyavnINxN/liE4UlVMO EtCBhunTUCX5IdVrvU0eqn0XD0xbxfOBe6s1ky4msvHEskf8EUTv8HoNLqvgCUrBbD9M 5Xwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cGUYeZEiapMncpFUdDru/QnGu3ogsFhjAcza7V9FCj0=; b=iYUGtvjGHE0Ax2FNgLG5YqeqbN1As45/xtyQnJ5iTjdGpWNmh+5cwdPhBruQt8fErb /ZuFNsN/dNaIEU7ZNwo42NkJ/QQVPYBC5Shx3YRQlZm1qDKt+/kvqX4xNSFJJaNrj+cb yHpdL0wIL8VIb1AttnAEzqvR42/JhG1sAgwDdANp8hap88HRjkHuQNJDjahNyBTL9hCm XLXWN8ypVyIDxPqNAtfXJj0hnVLpbTkrhBp34BsR1ILWOGaOvPFBh6+OA5mhxUIWeO1C 1KV2MPhWdWgOn/dbQzRIZBOYkSBZtXAcRre1kYSCiROp8d8hvQFnkF5xxEpvB4P6IR6H 6xsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HLNedXY8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f11-20020a0564021e8b00b0045ca1098d05si33173909edf.349.2022.10.24.06.42.06; Mon, 24 Oct 2022 06:42: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=HLNedXY8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232941AbiJXNcJ (ORCPT + 99 others); Mon, 24 Oct 2022 09:32:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235953AbiJXN3M (ORCPT ); Mon, 24 Oct 2022 09:29: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 18AC4EE17; Mon, 24 Oct 2022 05:32: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 AFEC0B811BF; Mon, 24 Oct 2022 12:06:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07A82C433D7; Mon, 24 Oct 2022 12:06:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613161; bh=N37XKcVxYB4/HmKAQKuDmdp2IcQE9xotdgysPiZ17zo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HLNedXY8VAudwvoi1418YivSVoQ9JENkiuHfjIBysIAHhT6nvmJ3K9WT3/XHgcs0s nsHxhIdMFACVgovQezwo6xqHlM6CM14uQOCq3xcPsjmCkvymbnrg8SmsYsKRIxhU8w /IlU2+cDiS76iNS1yGh3e7j/HEx8jcUtw1b8xNRw= 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.4 024/255] quota: Check next/prev free block number after reading from quota file Date: Mon, 24 Oct 2022 13:28:54 +0200 Message-Id: <20221024113003.249477884@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576641478170630?= X-GMAIL-MSGID: =?utf-8?q?1747576641478170630?= 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 @@ -80,6 +80,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) { @@ -94,6 +123,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 { @@ -241,6 +273,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) { @@ -433,6 +468,9 @@ static int free_dqentry(struct qtree_mem goto out_buf; } dh = (struct qt_disk_dqdbheader *)buf; + ret = check_dquot_block_header(info, dh); + if (ret) + goto out_buf; le16_add_cpu(&dh->dqdh_entries, -1); if (!le16_to_cpu(dh->dqdh_entries)) { /* Block got free? */ ret = remove_free_dqentry(info, buf, blk); From patchwork Mon Oct 24 11: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: 8864 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433134wru; Mon, 24 Oct 2022 05:48:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Wx7MWe0JR83TVhaoMJ2cWzwS/D9FknISlKppr3nm19jQsnqWkJMLDaXBobYAdQ34z5AeP X-Received: by 2002:a63:2d81:0:b0:446:8d24:c90f with SMTP id t123-20020a632d81000000b004468d24c90fmr27592070pgt.160.1666615718160; Mon, 24 Oct 2022 05:48:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615718; cv=none; d=google.com; s=arc-20160816; b=evbh/mJCZNroJGjmssf4AQ81qA8D22sVM4QmkJhV5jk/PEcC9LtCtyfDV4OoowEeda rl3lUHpu0dNntqZU1NxqHC8BD5cu9YqPJmnwMQp8VecNAHqJxeGjFRq4LWnMdXJAWauO hSyL4x0WkOKfiaui9Tm/SDi3u3ldiRi+NFVUQqYsUa2DUij7WAgQgQsy94PdZsVVLdNs QzOJeZ2s+Sa7tbXQwGi+R+Dgxj+HRvKUe3ZZNUfy3bRnjhQfhTdef7747sFSukXfgw1w SPQdVpy8liD0pXd0mPQJJSdVBvOYRgLv+CDw4/1qMk/n46awt/hIcgGrE6cGU+Kaie+8 fMIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7aYTdLxkJfvgFXKK5jyo2Wg+8bZTYxbEYIU4B/jarto=; b=nuD4nPllp7zgmjMA2t3rKrUPtU2Z6r6GOEW4sYuzuEv7aVgP9CjI23btTWbwLkxAhD 3UNPR+z+Ps12Zl9bu42OazOmxf+edT6flCacdt6MCzyC/FKQyiHOapLFN5KEA8E3Td3b 0DKc9X08FQAsgy0PeTlktSn8XUuUxa0nbA/52pMkXQAvm9kdrahhEZjwIGuZ4Br78wmZ SB2iJVjeQP9HtjdGraFjxrQJCWJDOs5E6ZCIcMM8Jh5FelCD5F2adzw5OZ418wXwU6Jj g4SVWCU7e/tQli2lY0LGXeO2GIWdR+SITowxNVQEavgP2/W/+XXg+9AwUYpyenhuF4/Q uBbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Xefj0o5F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w21-20020a634915000000b0043885b12cb8si37457574pga.272.2022.10.24.05.48.23; Mon, 24 Oct 2022 05: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=Xefj0o5F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233979AbiJXMli (ORCPT + 99 others); Mon, 24 Oct 2022 08:41:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231883AbiJXMiK (ORCPT ); Mon, 24 Oct 2022 08:38: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 A06EE89810; Mon, 24 Oct 2022 05:06: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 0A555612DB; Mon, 24 Oct 2022 12:06:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C8E7C433C1; Mon, 24 Oct 2022 12:06:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613190; bh=qpkhbREp+upQTVqTctmEWCOKn9PVcpaTOkNdIdq7NqU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xefj0o5FHtjf7h7IoJBMJpb8XCAh9qCw/khE5PiVK/J+asjIxeCs6NU7+kHRLF5vC gVQxUsPScVO7QaclCUoFmviJp+iyoNGSC4n9L67ek9rpaCdajHBSn/YOdIDL3VAulR AakE6cqtRaKIVQVHKZsSdHd2DtSMR2zkbsxRt6kI= 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.4 025/255] ASoC: wcd9335: fix order of Slimbus unprepare/disable Date: Mon, 24 Oct 2022 13:28:55 +0200 Message-Id: <20221024113003.283413088@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573243323126949?= X-GMAIL-MSGID: =?utf-8?q?1747573243323126949?= 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 @@ -1971,8 +1971,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 Mon Oct 24 11: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: 9085 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp445714wru; Mon, 24 Oct 2022 06:13:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM63mvNfzwUFxulyk1hAgoqVTqTjb/lG6BpINSMJ3jX2s2LjFH+D6sSY7Y+Y5khRk609Xf6r X-Received: by 2002:a17:903:2303:b0:186:8ef3:5efb with SMTP id d3-20020a170903230300b001868ef35efbmr11352104plh.118.1666617183694; Mon, 24 Oct 2022 06:13:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617183; cv=none; d=google.com; s=arc-20160816; b=v+7XAoCabeaY/EMNa45Jn2q7bYtPOGNnB3PNgQos3uXnFH35p8JaVF0AgNP5gg6H3/ z4FygZpFZt0q8XqsDNgNuqQB2Of/c4SZsoSRYIhjvRZbLJI+aNC279p4Tqjb9cUYioKE 7AUIFSTS/vdvjJnPxLqFSge2ge0YtFGo0ijlv90pO/QmTlx3Em1mfsIkOmRrOoTzQmhd ZRyYzXyC9qEewxxhkBbnitXVTwFYZjPSBLdiUnfB5yCM3bky9eed7/WPWtvGnKEXFYSw sGQW+jX5Eblb1ryaw5FT5+MwaGK2ZstiF1tqUVHCahuzN5FxCUIUErOzwEcnStabYh/g nsyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=P3PRotAnYAVtwq1xs2z+AGOoOin525PxEviNwxK/7nc=; b=XLLuTGn3CmB0zbsfAEiqXws/7qfr9alOU95B5FzxJasSFsikGRN9RwmFstVe/F7p6w u3/8zI1i8euBDHrdbPyVkJ0bTzNczW4LW+UpYlxKRN4EYU3o9jhJGjTJ/nw9+5TznDM9 dCyQnbDJbHQ/X0G+0D1nJVcX72JkEdNIg4xSMestxmQiErTKm3VItx4M5eWr1uiyRBC6 3JxEzPWq89r6f4qOnzrIyWnjAr2HHGuNRENPt62AgGkXQkwtL2rtkd26JeEPAD1ye3uS 7mIZEWTpxlfJngKskXvdtFuvdO3XFLFf/2tTmjIgeykKTZRy7PrSzs1D4bazFieJYBv5 Gmfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Um69Xy8q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056a00148500b0056b82fbafebsi9550498pfu.379.2022.10.24.06.12.47; Mon, 24 Oct 2022 06:13: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=Um69Xy8q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235712AbiJXNM0 (ORCPT + 99 others); Mon, 24 Oct 2022 09:12:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235954AbiJXNKP (ORCPT ); Mon, 24 Oct 2022 09:10:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB5D3A221F; Mon, 24 Oct 2022 05:23: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 D57AA612E6; Mon, 24 Oct 2022 12:06:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E89CBC433D7; Mon, 24 Oct 2022 12:06:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613219; bh=PHfa30wXeQj8H2Hq4WSPYKIb6dph1mJ/5TjURLeioIA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Um69Xy8qu0E9M3aIGYqwBxCD53Y12EpvoTYZBHk67gR9t/LvqH5Lmh9/YiLNtsJGu 1OaFs4IP2s01ujmVSQH8ol4yug+QdWcdmpMskCxSBXl/B82XBaSNiB61qyZTMs55jp ikIu5GL2FuB0tt810JzQ9uUi0g90JhKmsExH8lpY= 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.4 026/255] regulator: qcom_rpm: Fix circular deferral regression Date: Mon, 24 Oct 2022 13:28:56 +0200 Message-Id: <20221024113003.322709743@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574779752022394?= X-GMAIL-MSGID: =?utf-8?q?1747574779752022394?= 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 @@ -812,6 +812,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" }, @@ -839,12 +845,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" }, @@ -853,6 +853,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" }, @@ -861,12 +867,6 @@ static const struct rpm_regulator_data r { "l5", QCOM_RPM_PM8901_LDO5, &pm8901_pldo, "vdd_l5" }, { "l6", QCOM_RPM_PM8901_LDO6, &pm8901_pldo, "vdd_l6" }, - { "s0", QCOM_RPM_PM8901_SMPS0, &pm8901_ftsmps, "vdd_s0" }, - { "s1", QCOM_RPM_PM8901_SMPS1, &pm8901_ftsmps, "vdd_s1" }, - { "s2", QCOM_RPM_PM8901_SMPS2, &pm8901_ftsmps, "vdd_s2" }, - { "s3", QCOM_RPM_PM8901_SMPS3, &pm8901_ftsmps, "vdd_s3" }, - { "s4", QCOM_RPM_PM8901_SMPS4, &pm8901_ftsmps, "vdd_s4" }, - { "lvs0", QCOM_RPM_PM8901_LVS0, &pm8901_switch, "lvs0_in" }, { "lvs1", QCOM_RPM_PM8901_LVS1, &pm8901_switch, "lvs1_in" }, { "lvs2", QCOM_RPM_PM8901_LVS2, &pm8901_switch, "lvs2_in" }, From patchwork Mon Oct 24 11: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: 10025 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp622221wru; Mon, 24 Oct 2022 12:45:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7T6IrRZp0qrHjRq3uaNrp05/91SjEg+hxbmZaqgjJhVu7QimKZ3GzXOycDMeKyYhHfw/sR X-Received: by 2002:a17:907:3f04:b0:741:4bf4:fe42 with SMTP id hq4-20020a1709073f0400b007414bf4fe42mr29635697ejc.664.1666640693989; Mon, 24 Oct 2022 12:44:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640693; cv=none; d=google.com; s=arc-20160816; b=Qw4DAW1Zzc94SWImy3LGYjaJDW1eRBN+FLhCM/82akAE6yJt5ga4z6G+dlV7tXmPo2 f2SorGnjT5dk8nEpFLFYGulJgiC8I1q0cPNUz13DVdUQmb1v37uKp4/08tAytKbEFK2U dErPl27fuax+w9ErHp7zt06V1zbaANa07iiwLqqjBCBkbV+2kTowiMHJDEf5IYdYT9lB 5ZTgfVnC4qAFojrKs0jCST5FOYnDxF3YzjHcfgpVzAT49o1dygMUk+vEgrJsPgIlLEB7 /UTYdlrk+iKKbMO98SNSFywGiUGqQmbxWlqyOezIK7LbrsCwdhZ8xOJLk2+G0OPqGx9c gTlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wjYHHSWnLmew19xnoI9+hkhD0H10ryjM3BFI62FrWE4=; b=dTMqYxW7jiwkokWpHMQHVZ4WPwESMmReq6IYbfnDlpjILoF8IokrZxM1zOS/FjFI1P SMV8G2ShvREZAFnpDrBOJSoi5In7vdWuxZOBsgMUlW72mTjqtmiOaRFSwGxL7ShEsw/J tjaIUFn/FKhYye3FiJzHOcn/tqiNOS9BoTMOFWuLLvyV9IZlSd9a/1IoWyIA9MLcZBri IRQ5Hh/BPDmIHj+9h5ZzB+xCEh0ZbIB6uvGv2y7+KxTOwSjH37AZhjqRALFHXKSoDfm8 XdNd9iPzwAnV12x7Hag10/Y+lDDJq8v1RGB4Fc5OsBIfkQYsQNe5aA1wur34K56/xRNl sklA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Irajqu3u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go13-20020a1709070d8d00b0073d9ea386d4si505826ejc.983.2022.10.24.12.44.24; Mon, 24 Oct 2022 12:44:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Irajqu3u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233155AbiJXThj (ORCPT + 99 others); Mon, 24 Oct 2022 15:37:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233360AbiJXThS (ORCPT ); Mon, 24 Oct 2022 15:37:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE94D165CA7; Mon, 24 Oct 2022 11:07: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 85B21B81259; Mon, 24 Oct 2022 12:07:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB003C433C1; Mon, 24 Oct 2022 12:07:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613227; bh=f8G+ZqxzK7owbbLn3ZRePAVxBAeNxR/+4kqK8EJlIRU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Irajqu3uS83PMU9X7hj7h+dDtJkfMTN7HB4jOiJ5srsFi36CR5WrtRDJUELtwNKZN X6gLiO9aHmnnrqgyGLbiQix6TrG6mp79ReNY1uj2/GctBLwVmK5c+7j8/0y45UmF7c LGfH3v9DPymHFcTxV/u1FJJVKvZLnxF4/9h7GGSY= 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.4 027/255] RISC-V: Make port I/O string accessors actually work Date: Mon, 24 Oct 2022 13:28:57 +0200 Message-Id: <20221024113003.351633006@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599432429730001?= X-GMAIL-MSGID: =?utf-8?q?1747599432429730001?= 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 @@ -252,9 +252,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()) @@ -266,22 +266,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 Mon Oct 24 11:28:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9763 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp550370wru; Mon, 24 Oct 2022 09:45:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6a/2MFFVxNeBqK3qtqxAJH9b1+p/0K+Bv0tsUpQguq8whGYa7z7qTrE+wniRDCeOPbzXl+ X-Received: by 2002:aa7:818f:0:b0:562:dc99:8a84 with SMTP id g15-20020aa7818f000000b00562dc998a84mr34200916pfi.30.1666629954762; Mon, 24 Oct 2022 09:45:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629954; cv=none; d=google.com; s=arc-20160816; b=enGGKC9PYJ09CM9I0YdT+pipEicWKtF2fGec30ge+xP+3NBUnYjfrkErwL0XKTsHDO GdIgqp2/wpVAD/ut9k+CNBO4rQGXFYpQLvk8cMlJao4ONW2uY8Gp7oyPhsPDHfZWNoRa 24Ng06R08mtl70jVey1VFBESnKveTZd9G5e/uw8dBUEdKkQrLwsGhwtIuYC/ESZA1CuU O/g58cfdepaaiXQ8B+uN2xaNSN7mGfCtVBJCNiRV/APA2+h+G+OzHrKC+jXfFnBOm724 PmvtHFv7JsuEcLRjaoAGakBMXMaPmbsWX3iOwXBR1c0srdDPZ1JSzITvLMrMcGqqibyW 58uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0iXjiI1uzDUFY4xmp74E6j77SdFazKA7znoCBQisjxM=; b=mduENeGFEoaHBhzOOnbVkK9V/KcF8gCdJevAR4Roa/kEGvRg8GgomTkaJiymgLIz0G uTPuacmzRLSX8e00qVzFt6YhXjgYAPmdTiCcOJC/TC+oGWGAffh4Fz08eme6eXxhbOnl qusWwx7AMBxfCpBj2razF9CcHo2uMDkBC7Feo+GhpgkpP3FhAuo2U3XUxZnrbpbpaiv5 g18bIsD6ByGl2JNsOHY0PFU8Dfr0VmYALIuZB7QwkbIrjfdaTJL8d37fkKNPu8s16y8h iysiklUfYr4IdSTEvLfDUhfIFyUzPE5GAQglnqPiUp0Wo9tAjEJgt38YI/wO0pS+5vd8 VDBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=w2Ry+33J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902ea0400b00182631bdf78si28396263plg.222.2022.10.24.09.45.36; Mon, 24 Oct 2022 09: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=w2Ry+33J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234809AbiJXQpL (ORCPT + 99 others); Mon, 24 Oct 2022 12:45:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234990AbiJXQoK (ORCPT ); Mon, 24 Oct 2022 12:44: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 AB8199E2C2; Mon, 24 Oct 2022 08:30: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 2F947B811A5; Mon, 24 Oct 2022 12:07:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 838A2C433C1; Mon, 24 Oct 2022 12:07:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613229; bh=Ys3ka49cccFJzfsTCTuZ+erQPYHY5yRX3BygybRzjkA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w2Ry+33JZoizGkywHI81h3wacURBrdYsrHmHBSB8m/mp5kQFGn7Q00A9gsIrlzfg0 qz6AVX1BzDtKJ7WrCzn0xJw+bSAAZX+u/N9PCAiCpwWgTzKmz1xQXuqhSagpfsK5Vp Y3sgESGOfOaawnp/xv4enJ82ladi/Y/ISfsSiIAY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller Subject: [PATCH 5.4 028/255] parisc: fbdev/stifb: Align graphics memory size to 4MB Date: Mon, 24 Oct 2022 13:28:58 +0200 Message-Id: <20221024113003.381799170@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747588171692062236?= X-GMAIL-MSGID: =?utf-8?q?1747588171692062236?= From: Helge Deller commit aca7c13d3bee81a968337a5515411409ae9d095d upstream. Independend of the current graphics resolution, adjust the reported graphics card memory size to the next 4MB boundary. This fixes the fbtest program which expects a naturally aligned size. Signed-off-by: Helge Deller Cc: Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/stifb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/video/fbdev/stifb.c +++ b/drivers/video/fbdev/stifb.c @@ -1257,7 +1257,7 @@ static int __init stifb_init_fb(struct s /* limit fbsize to max visible screen size */ if (fix->smem_len > yres*fix->line_length) - fix->smem_len = yres*fix->line_length; + fix->smem_len = ALIGN(yres*fix->line_length, 4*1024*1024); fix->accel = FB_ACCEL_NONE; From patchwork Mon Oct 24 11: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: 9018 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441339wru; Mon, 24 Oct 2022 06:05:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4DJbfZzE2rhY2HNc73YLax13RW6cw5mXf2Z4NvT68xjYL9xAGKMAHieh23WHIypw/7rw9P X-Received: by 2002:a17:903:120e:b0:179:fe49:a952 with SMTP id l14-20020a170903120e00b00179fe49a952mr33238434plh.21.1666616746965; Mon, 24 Oct 2022 06:05:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616746; cv=none; d=google.com; s=arc-20160816; b=cBtOmLNjZdk+FVO1WACutJ2ShicG90DCQ6TU9AjfZ/YBGroUq2l97UpwCnN4v8xMHs oIVKTYrN4Rz1U6NhfR6mmtmZ4jZTKF9+soSM8RXQrUwAA3FxhAFoEgGZZ/r0o6k11eGW AWjlhuwTh+6yUSEYrMsafOKBwXtb68dbxKKykZ5I6bZMkVkGHd+a3yGrSWbq6OaxCDqq 5yOc9oMvmJKmNtwnXC8vzhrCMCmSHdpzs0r3Yq8pkSD3XYu5dRzm0ulGEqc2M+9qFbJi uOXEY6xcwtzVt2L4W2FFt6e+tlbmI0r+KQTsYLTWMFRpQsr3/lSybHTmWMpkE/tHzxBM z4bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=Ra7tQvXg+mPh6POSh4X3v198kIaP5bX5qn0iAOcqX4UkcywhaMOqM+rk5CBmsHCZcz +Pp5hwsrPXXQRClcAQtOw37ExPHGZPd0/XT9/LTYFpaUEFCIk4ZoNA4HBN12nFnhcRe8 SDx4D+H+xnzylYRIhrnN5cOT+GcPdXzzTEBa+qD6NrhkiDYvm6/v26g9F/VmBCVkixCv pgKGMiF6TD8X03Bk/OSG7jOzmpzPmODQToQCOq7ULUSV+NL3ZS/0utCTa8AXwV4MPIvU Q2mK3YMqbtUFrmRBzLBeRaFic/8KCuUEOl+Ae6RSEZfpRP06vBJFezzTzRflrqZGMZG+ q9Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="OXZ5/6Nw"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t24-20020a056a00139800b0056bdae22580si3291719pfg.338.2022.10.24.06.05.08; Mon, 24 Oct 2022 06:05: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="OXZ5/6Nw"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235297AbiJXNEO (ORCPT + 99 others); Mon, 24 Oct 2022 09:04:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235398AbiJXNAP (ORCPT ); Mon, 24 Oct 2022 09:00: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 26EFF13DE7; Mon, 24 Oct 2022 05:19: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 15C29612F0; Mon, 24 Oct 2022 12:07:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D0E1C433D6; Mon, 24 Oct 2022 12:07:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613232; bh=u8jCsQTg+AUQ8MfWiYmhRVCIrhrvAtAfKvtbHgYSGJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OXZ5/6NwDMPjcaEKA1bYzXWZb9W8vYpe4u1+k88/ahSKIe10v1VU84iy7dBaB3giE Ix5Y4h13BsXiLLsqKDcoTdcMMBzAqJhhuOd4jPrbAs83XB17xQlvmA+mVLYukUDf9m US8zG0Atez6zc4rRRI9EISdzO+zH/Sz+H7cIc3QU= 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.4 029/255] riscv: Allow PROT_WRITE-only mmap() Date: Mon, 24 Oct 2022 13:28:59 +0200 Message-Id: <20221024113003.412136922@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574321624028792?= X-GMAIL-MSGID: =?utf-8?q?1747574321624028792?= 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 Mon Oct 24 11:29:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10216 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp642620wru; Mon, 24 Oct 2022 13:39:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6bgNZC4b5GS6r8hJ7AQpseKXVQ1SvEeuDCV+HoziE5oRImk6tGC+gctq7xJ7ImRsfH6+EL X-Received: by 2002:a17:902:dac3:b0:186:a437:f4b8 with SMTP id q3-20020a170902dac300b00186a437f4b8mr7728533plx.70.1666643941581; Mon, 24 Oct 2022 13:39:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643941; cv=none; d=google.com; s=arc-20160816; b=Xq1SJFQxZhzrYSg7DxL/84InJJd6JedYpfzDCypcmRQrO4LKqBZAEJX2pkGE5XhCD0 KowavOM7ZxZDDUBkcRcmRMvXDteD8R3zW8wBCYGHeeyJy8G+cJdpFih47Q/B2X3+zsng R53eOhuexJtHuGQcLMVzzo3arkE0NC7PKKQ6njUSonME28qKn1aeBM47f2/noTQehXEX 6HUJyAjZhkakoax9OzTcyOOLGKGCEuz3cWTZQzJ/NfLZvIU2QIgqmPop63RIR2iqjhsU Y7c/NavErrv8zOTUp+9BzOPhPMcznmPXFp4yqXfvEhk4/RN9MpPiIYTP46QWBTs1F7lT xhRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rOnf+DLt5wlVwiBLSeJfnmo+zGFnBRojGhJ6iPvP7jE=; b=jIDv+Xf1T2KtJpHOXYPChdhnaLVCxvKG+K9hh1OtWE4lrwtl0tfCs4KHZP4Wm7V/rN b40855RaS2s5Q0/iVXNH2okmc0VdEB5Uq8x6FIe2U8Gtp/QTPuJvbhhSSeFVHGKzNP+e eDeCeeLGOaOkAM5mPCBFR60jpA1yHHr7BUlF+6qf/VMI1czmxpO7+1c3dl8snUn4akGV a61ieFkVba366eYMFIsGZQOnueDLiTF7MNHIaebg/WS/fqS3xjKnoNLmKqfcf7NuRY+H OddGx+57T6PmvD/bouxu+X1BN62UQmM0sIxyZPiUONxN6PEtRlLiYjdoyzHvTh47kL2n WBiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qqtLZBOr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w186-20020a6382c3000000b0041cd5c0295esi470926pgd.852.2022.10.24.13.38.48; Mon, 24 Oct 2022 13: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=qqtLZBOr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234505AbiJXUhn (ORCPT + 99 others); Mon, 24 Oct 2022 16:37:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234391AbiJXUgg (ORCPT ); Mon, 24 Oct 2022 16:36:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13F3D1D346A; Mon, 24 Oct 2022 11:48: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 70C77B81219; Mon, 24 Oct 2022 12:07:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF06EC433C1; Mon, 24 Oct 2022 12:07:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613235; bh=YzygpU2lqHazfot/AtqlQuUcuIafh1+pkMPgAoMjJ4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qqtLZBOrSu3dPOxOhHisPPgHgXh28kLdl62TP49XdqMud2qfA1ThcYFr/W+jOqJvk FObH/x6UodmZyej2eRrdQ/D0614sQ+MthJmcnEIf544rDjU1bfftOlEgwyytUBuNn4 D9bS+NF72MJsVKJi7Vh8GV7EYCRxqdkzo0DM/R30= 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.4 030/255] riscv: Pass -mno-relax only on lld < 15.0.0 Date: Mon, 24 Oct 2022 13:29:00 +0200 Message-Id: <20221024113003.450495044@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602837750924322?= X-GMAIL-MSGID: =?utf-8?q?1747602837750924322?= 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 @@ -35,6 +35,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 ifneq ($(LLVM_IAS),1) @@ -42,6 +43,7 @@ ifneq ($(LLVM_IAS),1) KBUILD_AFLAGS += -Wa,-mno-relax endif endif +endif # ISA string setting riscv-march-$(CONFIG_ARCH_RV32I) := rv32ima From patchwork Mon Oct 24 11:29:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9980 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp615273wru; Mon, 24 Oct 2022 12:25:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6t9IpH8IVSN4BFcfdmwQfZUACeSKhPqOR+aWoIsBYn5ecBgNrNQS6o0QEsHbtsXKr0BlCW X-Received: by 2002:a05:6402:1906:b0:45d:db20:7709 with SMTP id e6-20020a056402190600b0045ddb207709mr31403552edz.406.1666639559454; Mon, 24 Oct 2022 12:25:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666639559; cv=none; d=google.com; s=arc-20160816; b=s+b9+0LnMUgZxUhTkbhVoQn+ova0Ekp73ShQTW4W7Nq6P2L/6qKqmLPyzOuf9bKTUz kL2ZkGiwrICxdEFkcBXPzHcegQ2ui94908DMiYJxUrX4K/F2vyvp33Fjv5SkOl8PcGgj eDPzhfrTpWnIDHvwUsmHRrqladbgAbhdM70CHw82M7URjBIOE4WwQhMqt/sBqTJQU2d8 yGBiCKPwMSNw6KfkMi6DInAO46PRoZvWCiseiQdC7WeQCUSA1iPRTz3naWX/tHzfCWNt 9nwJpPRR54Cz/kLZRX9kZlXMUNY+MgtiL3TqSDaK0myYkFms3WliDSdU30LdWprN8V9L CgKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VwaAX4ijTAW1/JY2XMmcMeTeUWRgXI9gDfuV9600zAQ=; b=AtEyFiY2U87CBSBRxpbSdjIZI5t+djtyK8df2sqUuRFUOIxvTWRcJtBYkCCNViE+G4 Dy/l1zPOqe9+W5svHXZM2GXUiv3/1eCG5DBf1QAjWHMglx3sXssDMsKirdHqL/xidsYM SIyKNQXZpGtRwadYFW4P6+I7ZiZVljmznBCDNwajMYqtbMpI5vrsSQQDfYnfZy7Upyif Y2f1DxlqE0ss0014bP1x46MzuOoaa0qIH5PF+StbWRgzDQnEU2aGB6SsjtAoIjHwWz7H u9ZU8P1df3Q1Z+Jgs7VrTUmH0WOhV9B5i7nav0DcdLS9KUOc7ZVio+gnYc03E8NBb2ms lrZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dqRpSmfv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y20-20020a1709060a9400b0079ca59305a6si491032ejf.354.2022.10.24.12.25.33; Mon, 24 Oct 2022 12:25: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=dqRpSmfv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231788AbiJXTPc (ORCPT + 99 others); Mon, 24 Oct 2022 15:15:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232287AbiJXTOa (ORCPT ); Mon, 24 Oct 2022 15:14: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 743FF8A1F6; Mon, 24 Oct 2022 10:52: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 ED12FB8125A; Mon, 24 Oct 2022 12:07:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54FC7C433D7; Mon, 24 Oct 2022 12:07:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613237; bh=uBbLc8QAgT9cQGnph4PMHqBIqShqWIcTjog/nTwhBok=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dqRpSmfv3See8KKJYrMrHErdHez1wstb112X9SgzUoPSkKZToKgj7EYRUEt/HKT5O xDWP5O8uBrtVWG7GlQmQbPyQV7J7Ubooy9jeqzrhKHLG6L//JlAFqaQm/KnxXhu+3R RiDncoNPG+gS4g3bkRbBAlny010SR0ueqwFWfdzQ= 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.4 031/255] UM: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK Date: Mon, 24 Oct 2022 13:29:01 +0200 Message-Id: <20221024113003.480501799@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747598242744180288?= X-GMAIL-MSGID: =?utf-8?q?1747598242744180288?= From: Huacai Chen commit 16c546e148fa6d14a019431436a6f7b4087dbccd upstream. When CONFIG_CPUMASK_OFFSTACK and CONFIG_DEBUG_PER_CPU_MAPS is selected, cpu_max_bits_warn() generates a runtime warning similar as below while we show /proc/cpuinfo. Fix this by using nr_cpu_ids (the runtime limit) instead of NR_CPUS to iterate CPUs. [ 3.052463] ------------[ cut here ]------------ [ 3.059679] WARNING: CPU: 3 PID: 1 at include/linux/cpumask.h:108 show_cpuinfo+0x5e8/0x5f0 [ 3.070072] Modules linked in: efivarfs autofs4 [ 3.076257] CPU: 0 PID: 1 Comm: systemd Not tainted 5.19-rc5+ #1052 [ 3.099465] Stack : 9000000100157b08 9000000000f18530 9000000000cf846c 9000000100154000 [ 3.109127] 9000000100157a50 0000000000000000 9000000100157a58 9000000000ef7430 [ 3.118774] 90000001001578e8 0000000000000040 0000000000000020 ffffffffffffffff [ 3.128412] 0000000000aaaaaa 1ab25f00eec96a37 900000010021de80 900000000101c890 [ 3.138056] 0000000000000000 0000000000000000 0000000000000000 0000000000aaaaaa [ 3.147711] ffff8000339dc220 0000000000000001 0000000006ab4000 0000000000000000 [ 3.157364] 900000000101c998 0000000000000004 9000000000ef7430 0000000000000000 [ 3.167012] 0000000000000009 000000000000006c 0000000000000000 0000000000000000 [ 3.176641] 9000000000d3de08 9000000001639390 90000000002086d8 00007ffff0080286 [ 3.186260] 00000000000000b0 0000000000000004 0000000000000000 0000000000071c1c [ 3.195868] ... [ 3.199917] Call Trace: [ 3.203941] [<90000000002086d8>] show_stack+0x38/0x14c [ 3.210666] [<9000000000cf846c>] dump_stack_lvl+0x60/0x88 [ 3.217625] [<900000000023d268>] __warn+0xd0/0x100 [ 3.223958] [<9000000000cf3c90>] warn_slowpath_fmt+0x7c/0xcc [ 3.231150] [<9000000000210220>] show_cpuinfo+0x5e8/0x5f0 [ 3.238080] [<90000000004f578c>] seq_read_iter+0x354/0x4b4 [ 3.245098] [<90000000004c2e90>] new_sync_read+0x17c/0x1c4 [ 3.252114] [<90000000004c5174>] vfs_read+0x138/0x1d0 [ 3.258694] [<90000000004c55f8>] ksys_read+0x70/0x100 [ 3.265265] [<9000000000cfde9c>] do_syscall+0x7c/0x94 [ 3.271820] [<9000000000202fe4>] handle_syscall+0xc4/0x160 [ 3.281824] ---[ end trace 8b484262b4b8c24c ]--- Cc: stable@vger.kernel.org Signed-off-by: Huacai Chen Signed-off-by: Richard Weinberger Signed-off-by: Greg Kroah-Hartman --- arch/um/kernel/um_arch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c @@ -77,7 +77,7 @@ static int show_cpuinfo(struct seq_file static void *c_start(struct seq_file *m, loff_t *pos) { - return *pos < NR_CPUS ? cpu_data + *pos : NULL; + return *pos < nr_cpu_ids ? cpu_data + *pos : NULL; } static void *c_next(struct seq_file *m, void *v, loff_t *pos) From patchwork Mon Oct 24 11:29: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: 10268 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp644786wru; Mon, 24 Oct 2022 13:46:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6wNJfArEHf2bjkZQ1Z7OQ8rDx5vW+ijl/o0siNYyl+7UfzjOgwciGIvwdwQDsqFHMSZgE3 X-Received: by 2002:a63:89c3:0:b0:46e:d2d9:a960 with SMTP id v186-20020a6389c3000000b0046ed2d9a960mr12871625pgd.329.1666644368994; Mon, 24 Oct 2022 13:46:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666644368; cv=none; d=google.com; s=arc-20160816; b=vg4EnGKWMIWpLt0xflM1p5qk55bQlPkRVslCpBok2hhdCefrevb4P6Un/YHMvqMfTb q/64H5SSdSN1WcLIcp5FKr9etkDtqaV+kZ6GBOdYbHyEtweYjvwHsOf728clzZIlXZ2D lw3z3BKQ6M8udYbYw8Twci/+7NxdUDOQQyZ5gEHy1EOXpFvQimTdLfJ1/hH0R2z6KJz+ mtzLkVwDgSQ3bWXHtgv9Xx915e/UYvPPm+In+Cb+sbsl+T0fOB8FVzR7lc8BIHO+4yzz aevkI1wkhSIRkObcfBtj7ElzS2y/DWlPPi5UuYRVbcBIIMAcuEAsYPly8902T/TvHmMz I9Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gY+XvzL7AtoHdksVNSa0lDj4SD23lcILqtuYgW/a1qk=; b=effRnvwwzqCotQwEva3eDKFj374jPiZxpMIpdZzVStCdlZ0JM3Nh4itJVcrQwdJsMq kTUQNQxrxeNQiyHnDW5G0BopRBaR+GJssOKUIF4mPJM1sA068az79mvkgc68LTu7ILSt 06RJ5pA/YvbpWnW0V+zTFbUUdNwRWXjuo3OAJLHAUMGoAxVGHOqP1HcTmp/Gzk1hStOx FNBUqbkfOG18Ajn081M/gwbX32PwvB/LJC2bli4ez/uHgJMm/DivkN2bxllg9G1UaXcd jAze72vZDbWF422GAYOWaqGlejSMa1q3vcNji6FEy9NKYtV5HjOJ7fRCFWORUoM+AVma JFxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=j7kjlmre; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902714f00b0017bcea4e6b6si455430plm.234.2022.10.24.13.45.55; Mon, 24 Oct 2022 13:46: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=j7kjlmre; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235026AbiJXUph (ORCPT + 99 others); Mon, 24 Oct 2022 16:45:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235162AbiJXUoL (ORCPT ); Mon, 24 Oct 2022 16: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 3DDC78052B; Mon, 24 Oct 2022 11:52: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 8FB2DB81250; Mon, 24 Oct 2022 12:07:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E68B8C433D6; Mon, 24 Oct 2022 12:07:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613240; bh=aOvtxZzoxLZvYMnqDsCHT9AR35HDLsRHaZZOOkdNEaQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j7kjlmre42Csglxqt55+GmQDK69D5Ix3RLHCb8DZtA69anMCZvXws84YrD4+YBzs/ 7Yt8IDyAYom+lCoDCrKcwBZgWQndeO24a3pqI+A078UHBRIHhS3nOexQLKMkEJ7n4O c4QyzqT1Jjc7s/5E3qzfzYZpR8xjiSwXm9N2nVbM= 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.4 032/255] PCI: Sanitise firmware BAR assignments behind a PCI-PCI bridge Date: Mon, 24 Oct 2022 13:29:02 +0200 Message-Id: <20221024113003.509965008@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747603286099573476?= X-GMAIL-MSGID: =?utf-8?q?1747603286099573476?= From: Maciej W. Rozycki commit 0e32818397426a688f598f35d3bc762eca6d7592 upstream. When pci_assign_resource() is unable to assign resources to a BAR, it uses pci_revert_fw_address() to fall back to a firmware assignment (if any). Previously pci_revert_fw_address() assumed all addresses could reach the device, but this is not true if the device is below a bridge that only forwards addresses within its windows. This problem was observed on a Tyan Tomcat IV S1564D system where the BIOS did not assign valid addresses to several bridges and USB devices: pci 0000:00:11.0: PCI-to-PCIe bridge to [bus 01-ff] pci 0000:00:11.0: bridge window [io 0xe000-0xefff] pci 0000:01:00.0: PCIe Upstream Port to [bus 02-ff] pci 0000:01:00.0: bridge window [io 0x0000-0x0fff] # unreachable pci 0000:02:02.0: PCIe Downstream Port to [bus 05-ff] pci 0000:02:02.0: bridge window [io 0x0000-0x0fff] # unreachable pci 0000:05:00.0: PCIe-to-PCI bridge to [bus 06-ff] pci 0000:05:00.0: bridge window [io 0x0000-0x0fff] # unreachable pci 0000:06:08.0: USB UHCI 1.1 pci 0000:06:08.0: BAR 4: [io 0xfce0-0xfcff] # unreachable pci 0000:06:08.1: USB UHCI 1.1 pci 0000:06:08.1: BAR 4: [io 0xfce0-0xfcff] # unreachable pci 0000:06:08.0: can't claim BAR 4 [io 0xfce0-0xfcff]: no compatible bridge window pci 0000:06:08.1: can't claim BAR 4 [io 0xfce0-0xfcff]: no compatible bridge window During the first pass of assigning unassigned resources, there was not enough I/O space available, so we couldn't assign the 06:08.0 BAR and reverted to the firmware assignment (still unreachable). Reverting the 06:08.1 assignment failed because it conflicted with 06:08.0: pci 0000:00:11.0: bridge window [io 0xe000-0xefff] pci 0000:01:00.0: no space for bridge window [io size 0x2000] pci 0000:02:02.0: no space for bridge window [io size 0x1000] pci 0000:05:00.0: no space for bridge window [io size 0x1000] pci 0000:06:08.0: BAR 4: no space for [io size 0x0020] pci 0000:06:08.0: BAR 4: trying firmware assignment [io 0xfce0-0xfcff] pci 0000:06:08.1: BAR 4: no space for [io size 0x0020] pci 0000:06:08.1: BAR 4: trying firmware assignment [io 0xfce0-0xfcff] pci 0000:06:08.1: BAR 4: [io 0xfce0-0xfcff] conflicts with 0000:06:08.0 [io 0xfce0-0xfcff] A subsequent pass assigned valid bridge windows and a valid 06:08.1 BAR, but left the 06:08.0 BAR alone, so the UHCI device was still unusable: pci 0000:00:11.0: bridge window [io 0xe000-0xefff] released pci 0000:00:11.0: bridge window [io 0x1000-0x2fff] # reassigned pci 0000:01:00.0: bridge window [io 0x1000-0x2fff] # reassigned pci 0000:02:02.0: bridge window [io 0x2000-0x2fff] # reassigned pci 0000:05:00.0: bridge window [io 0x2000-0x2fff] # reassigned pci 0000:06:08.0: BAR 4: assigned [io 0xfce0-0xfcff] # left alone pci 0000:06:08.1: BAR 4: assigned [io 0x2000-0x201f] ... uhci_hcd 0000:06:08.0: host system error, PCI problems? uhci_hcd 0000:06:08.0: host controller process error, something bad happened! uhci_hcd 0000:06:08.0: host controller halted, very bad! uhci_hcd 0000:06:08.0: HCRESET not completed yet! uhci_hcd 0000:06:08.0: HC died; cleaning up If the address assigned by firmware is not reachable because it's not within upstream bridge windows, fail instead of assigning the unusable address from firmware. [bhelgaas: commit log, use pci_upstream_bridge()] Link: https://bugzilla.kernel.org/show_bug.cgi?id=16263 Link: https://lore.kernel.org/r/alpine.DEB.2.21.2203012338460.46819@angie.orcam.me.uk Link: https://lore.kernel.org/r/alpine.DEB.2.21.2209211921250.29493@angie.orcam.me.uk Fixes: 58c84eda0756 ("PCI: fall back to original BIOS BAR addresses") Signed-off-by: Maciej W. Rozycki Signed-off-by: Bjorn Helgaas Cc: stable@vger.kernel.org # v2.6.35+ Signed-off-by: Greg Kroah-Hartman --- drivers/pci/setup-res.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c @@ -209,6 +209,17 @@ static int pci_revert_fw_address(struct root = pci_find_parent_resource(dev, res); if (!root) { + /* + * If dev is behind a bridge, accesses will only reach it + * if res is inside the relevant bridge window. + */ + if (pci_upstream_bridge(dev)) + return -ENXIO; + + /* + * On the root bus, assume the host bridge will forward + * everything. + */ if (res->flags & IORESOURCE_IO) root = &ioport_resource; else From patchwork Mon Oct 24 11:29:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9187 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458453wru; Mon, 24 Oct 2022 06:37:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ljj3XQsMOV4Kflkn52zyD2gqJwTjJTrbtkCOzOyUlP9wi7d/TRiiYFxVPe7R2cSGGwfdD X-Received: by 2002:a05:6402:11ce:b0:45c:a364:2c3d with SMTP id j14-20020a05640211ce00b0045ca3642c3dmr31308586edw.204.1666618657028; Mon, 24 Oct 2022 06:37:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618657; cv=none; d=google.com; s=arc-20160816; b=yTrWuWsyUm7VBBs0hoMX4UrPypCGJ8vKhs2nmRDnHgey+3g/LLDFzl1TIjAI6WMHRS IKkVdyFf+Nt4JzWeAn0L1ZpRRDzaE2ZDJIvwhHkMzYYNalWlZ6Hk5sgHQ+Pesyt9+Q8y T0DU8kIwJ5YDqVeM0XYIdi2HP2pxJT/s8Vv6zmigj71ox0YWpuyy/UkwHW38M0p1oyvV yd6YP2cWuNeFiFzG6IefgMFmJSAcYcc5xh/+CroVtcuGJRYj0vF43uwXjusxfSZqxJY3 fYJCS9veEjnssVhrzVAcxtJvukOrAdOcaMJxhBaK4DKPAkczgH00o28j05K2oC+xs9oL bgvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cpZPBBKh7ogf0ehMjOS82luusCHlf9RCv/16mSeJx5U=; b=zWXlqrHenZT/PLrWU+oLzFaDDLF+3TixjUwjpz9utVxfVUeTr7/NhXpXMbh7DDK3Q8 jGeFD7zwr/YW3yTvaixtr31Cn6dB7iGNqE6ORxxCDqbkD85fplcnfrscBrxeRnfZ/5tb D2e95Fkqer3D2mYHQ0CppLd7EB7+wyBwYnmt3+TvfLDxgBebzf5sQuQoBJcm4+z47V6p De8bkVlE9L9M5yhDFkdbUqb53x8vIjVA2M0IJhdPevf96Pz78FOfaakXT0OSrk9gwOjQ vojh0StE6FeqvQfx1RH+HBwDrV9moiFi/MV4Z5Ci4HWxdpEhIrtYbkIwuHzUUfe3fR41 9UfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kRvgPMz0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga13-20020a1709070c0d00b0078d2197d670si27233930ejc.661.2022.10.24.06.37.04; Mon, 24 Oct 2022 06:37: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=kRvgPMz0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232579AbiJXNQK (ORCPT + 99 others); Mon, 24 Oct 2022 09:16:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236017AbiJXNOa (ORCPT ); Mon, 24 Oct 2022 09:14:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEB62474C3; Mon, 24 Oct 2022 05:25: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 51BD3B811C4; Mon, 24 Oct 2022 12:06:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E3C4C433C1; Mon, 24 Oct 2022 12:06:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613164; bh=9YSJ36wjFxsTEnFDQT7Naqs+miqmLf7RXIRtV46M3DY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kRvgPMz0keH7QNk1KwCSXxFhQGYo4+fg1ZsDbXR8YPK6bZURBPwICCX52+zQgeZgv WmJeccYpNFI8wy2PaXf4XLU3OM2oKRsbnDDdkKkIqwNoDVienzFhHi9osXmKgPhyc7 OXZCjoHqVpC5SXe5GGFKPcAZY/3CU1cM5GK9cfdw= 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.4 033/255] powerpc/boot: Explicitly disable usage of SPE instructions Date: Mon, 24 Oct 2022 13:29:03 +0200 Message-Id: <20221024113003.549793289@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576325137658697?= X-GMAIL-MSGID: =?utf-8?q?1747576325137658697?= 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 @@ -30,6 +30,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 Mon Oct 24 11:29:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8907 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434138wru; Mon, 24 Oct 2022 05:51:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Ppoau8VhB7N0LU806If4P9+59wZqJI3gHZgCNRkAUNtuvbQb92mAUuE2sR7WsR9J50Ncg X-Received: by 2002:a17:907:9625:b0:78d:bb06:9072 with SMTP id gb37-20020a170907962500b0078dbb069072mr27565232ejc.472.1666615889903; Mon, 24 Oct 2022 05:51:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615889; cv=none; d=google.com; s=arc-20160816; b=caNql8p8WXZFO4Ao45U6tGjxynnFvAqxux0USkOadufgxJPmHaAQ47P2Lgl+NH2xCf zaZpsnT/db2FFFHKJsa87PLK+qyHLJfDu+vpPoRqK/NwvDiUQlsoyUhUFrg3HlR15/ag oRbkNqMkmLcbWIA4F8ACsMg+ivawBtz+wYkSDamtg3zyxL4pCuGde4q21IktCYrO/nLf Ab1Msgw2C1BJdmwSDYWRi1jVoB+WosWIUTmix95ZZ6+PvcMAb4W9zsPzXmIcK+r4Zk+W 9PcBIt9JVXH3i2M1Pf+JIzMn2JMPPDj/qyZdedMmx0rNDctLwSUIB55pvsnrNgqJnpn6 4Idg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FxRExeGjFJ7ykxvD39fBYbL+MhY87gQij+xDqWhDfqI=; b=twgKorCLkrQeb+3+ubSaH8T6lFBnhlOyWTjP5duki1vmpG2qywkUdby8UkT8Yk4NQv LHW88TxROhIL2ghw3JnvS6+dKrnDPfdXtZpz9HEFdO5I64gksPjwhSsQJfATtUoPQcjM Oq6r2ewzKzyplZuelIIST3ofioJkz+DFGj2ylzMODQ6IqOCjHIn5inK3bf6GUGL6Fs91 52tR4NyIWZn0g4wWGvVuOhyhKPHU3e4OszgiErY78WG0DZ88oGf6RfsMmzRA25zQLfFD CeRy21qRC4u2wFrhO79bSEZc2PTgVAsttCXWam5MqSYpBH9pGUDMFsjEn4rls1mfmCSa ZR9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RPJ24wAo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mc10-20020a170906eb4a00b00767e24156dbsi24237812ejb.256.2022.10.24.05.50.59; Mon, 24 Oct 2022 05:51: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=RPJ24wAo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229926AbiJXMmb (ORCPT + 99 others); Mon, 24 Oct 2022 08:42:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234603AbiJXMkS (ORCPT ); Mon, 24 Oct 2022 08:40: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 CC8027E821; Mon, 24 Oct 2022 05:08: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 2D804612D7; Mon, 24 Oct 2022 12:06:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FA09C433C1; Mon, 24 Oct 2022 12:06:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613166; bh=NC/Z+V26eeA1Z3iEnYZiVxYZPA1qrFYiKABdDWYzFEs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RPJ24wAoPhO50LMRrwk4lW5a2v2FyAzOL1lL1Df0dnzEzWVi80yi+cIyjqH4nLF13 E0oNId2qYmCiVzzmQ2D7ZKbtETtBen2hjCqrR3mey92Z/hcbfbL1Px7bpkZZ9ecXPg /3EARK5/mCqPvGHWaerB5UTRJARzlSXp1sOmSkVk= 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.4 034/255] fbdev: smscufx: Fix use-after-free in ufx_ops_open() Date: Mon, 24 Oct 2022 13:29:04 +0200 Message-Id: <20221024113003.578841361@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573423234469020?= X-GMAIL-MSGID: =?utf-8?q?1747573423234469020?= 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) { @@ -1070,9 +1072,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++; @@ -1096,6 +1102,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 Mon Oct 24 11:29:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8863 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433133wru; Mon, 24 Oct 2022 05:48:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5VE4URV+FjgDMoWL/CrTHZHYmdKhMEH+DZGiQOtlvBNXrHznE5qAnmdXEwtY2htwTjbh1F X-Received: by 2002:a05:6a00:1149:b0:53e:62c8:10bc with SMTP id b9-20020a056a00114900b0053e62c810bcmr32847593pfm.49.1666615717969; Mon, 24 Oct 2022 05:48:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615717; cv=none; d=google.com; s=arc-20160816; b=eSVHBCrE4ykqD0zLV1Kgxwj5tahhocaNCj22TgJ14dExMmJmTYXxediW8+TD4Qol0g hbojAPz+yP2nC6QYe1znXQ2YGdRWYwq10D1XDZ5eRF32yyUWhEdDm6JajqdPx17tJtj+ JHGQivk8w/EiiVn4FNJC9yYq6Mdw3wDu0j1XN0yfAGfF+r8JAgfzLzAAApuERwg1l/Ro aDynESfgj5PuJIu0SOI0pwHmDCL+HMQMtS9BVEqLBqYkX/lqw0BhNPIQoM56MqnBa/Y6 IBnr92I84/iD8vhflRDZkiITZFJHjxWcsfvxRQEXwueXi7csuIg3LbaX1EDwZfaZF8fk oryA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JYXdMn7z9eDCvKU74pp5LNFcItgeS/PwFEjDU1rWNnA=; b=jftrgCTW3h+o+yUqnZdvmrmdQxKWKU2LAW7mENa2YXTrDdrYRUuUFlvnxD0zCAzUEy fIEmi4Rm2FlCGjeRqHbLeBb0RrKxsE9EqFB2+nfmxrKxrlc0sqtur+x+zKppPv/hYprp zo380ecn5Tc01EuQRGzzw8qQuQz7Kk7KpnV//0w9re6UA0Rqc1PmYU1IZjzqFM+mW6+L 9uXh9bz01Ys7fuA+8EM0GqaanlDPImfSX9fw5ANHBfi5Hl/hTVltj0Ecv1GIQMfXWBur OUIaxIpL61ocDfSKV7xSXVqTkbSffdB2gWmT+B/57yFQyGXqLS6hnq0eIqXOF0D+BIZw D4GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1mrZGVK3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oo17-20020a17090b1c9100b00206012b593csi10049399pjb.33.2022.10.24.05.48.23; Mon, 24 Oct 2022 05: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=1mrZGVK3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233940AbiJXMlf (ORCPT + 99 others); Mon, 24 Oct 2022 08:41:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231256AbiJXMiF (ORCPT ); Mon, 24 Oct 2022 08:38:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5F028A1C1; Mon, 24 Oct 2022 05:06: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 C03FF612E6; Mon, 24 Oct 2022 12:06:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D80FEC433D6; Mon, 24 Oct 2022 12:06:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613169; bh=alETWVNsuyM1X64cVYCBiCkJ9fiVjtFgAaSa0450EIs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1mrZGVK3m6jVoRntgJoSFIKMo1eOj31ZyM3giS4/EAz8VtC5r/tl3cXwiP4WSe6Pe 2muMjNznUTHVbSOxe7DallKpt4oMTdy8nGQn7Sn50tKBtKBQVn/gmX0iFHc6yuAUJQ 0yFWrAy8GQeRikc0ZqCjhD9q+ZHSgg3uJdHuI8eQ= 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.4 035/255] btrfs: fix race between quota enable and quota rescan ioctl Date: Mon, 24 Oct 2022 13:29:05 +0200 Message-Id: <20221024113003.608998685@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573243421291327?= X-GMAIL-MSGID: =?utf-8?q?1747573243421291327?= 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 @@ -1075,6 +1075,21 @@ out_add_root: fs_info->qgroup_rescan_running = true; btrfs_queue_work(fs_info->qgroup_rescan_workers, &fs_info->qgroup_rescan_work); + } else { + /* + * We have set both BTRFS_FS_QUOTA_ENABLED and + * BTRFS_QGROUP_STATUS_FLAG_ON, so we can only fail with + * -EINPROGRESS. That can happen because someone started the + * rescan worker by calling quota rescan ioctl before we + * attempted to initialize the rescan worker. Failure due to + * quotas disabled in the meanwhile is not possible, because + * we are holding a write lock on fs_info->subvol_sem, which + * is also acquired when disabling quotas. + * Ignore such error, and any other error would need to undo + * everything we did in the transaction we just committed. + */ + ASSERT(ret == -EINPROGRESS); + ret = 0; } out_free_path: From patchwork Mon Oct 24 11:29: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: 9291 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp463448wru; Mon, 24 Oct 2022 06:48:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4+Hb3wp9peEHBxWGpAo3tL18zJZPVBglyFNClDBvU6t5hnwPLPVuTrCCpabNdUn7B3xlnc X-Received: by 2002:a17:906:478e:b0:78e:4b5:a547 with SMTP id cw14-20020a170906478e00b0078e04b5a547mr27898603ejc.81.1666619279877; Mon, 24 Oct 2022 06:47:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619279; cv=none; d=google.com; s=arc-20160816; b=HELWanocP0xmJAxfQFFzf+BWX9JtUC6Q3riEcAKzKM7EG1AQ1P1hXrYzIAoAfVJIqQ mYkarIVo/WGPRbIJWuyVA5LA/38VJoqsVz6/e7ur6nHM01r/lkxfGHkoB9/5mxHBTRoR /HVoEoR9z9modYmh0xnqSJtBpL9+9xzka/RPOGF2vnwzlOr7HubiPCy6s1bQQWdRWaCD wxneLaMPvBEFgcmT3PozvJuBMa+RhiJie6BzcwQ/QZhvy6k9X/78dNpCx6jQpbypYBMW Ia90ZE51XRRG7GyjEh6JMk7vRTlEi7UANzNgYmw3PIiD5HZBVxqVu1tYMKQ580dfOnzf TjsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QLJwnGS4T6bWkE+g00VHGf3iRxatkX5lxDXAdpGRsRM=; b=rwDz6Ou9UXiBIbGtWHfRLmpBGUBBzPieYgWWIyH13JqcMbn+9ODxYwIHD1v948rojS MitX2tj8dDilIBoqAXVx0x9XK2pCjPZWK9o49mN/+u9jr2ArDWgYhYMl+O0hET8S1vQ/ dtCSr6UU7x6XMnVCjcA2Ujd3ezxopZVxipmP7revdhLf4jibRwiFFX1Jbi2PUHBrhMF+ SWWh8NvDms82dTPgTO52z9f1qAlbFJy7z7Dxu+8oNC+S0aZAzyyQy4kCAfrd/DomN+Co s0NVBLFYg3eTmlMf8mcs2RyLf3dYK3cinf/RnQR+zYpgRSUqQE4knZaQjAmvVL810dF1 0dWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wNb6YY4g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056402274100b0045c786162f5si6277928edd.567.2022.10.24.06.47.35; Mon, 24 Oct 2022 06:47: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=wNb6YY4g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236273AbiJXNnL (ORCPT + 99 others); Mon, 24 Oct 2022 09:43:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236561AbiJXNkk (ORCPT ); Mon, 24 Oct 2022 09:40: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 0B4EAB276C; Mon, 24 Oct 2022 05:37: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 3DD48B811F9; Mon, 24 Oct 2022 12:06:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DEF8C433C1; Mon, 24 Oct 2022 12:06:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613171; bh=ZDdK79/PqGnACpozGpN+trTIzki0JQbZTUwIzXIGj5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wNb6YY4gLTdPMC29iShPm5p28766CDJ/R2MkR4U5Pb3cxqlf5jf9NziD3/55d1rG6 lj+RKGhewfefSKYQWdUGPuBjmf0XizY2woEXrunA+hrjkvOTXpRYCKGt3RY13xiERR Mvvb9ShpW741ZIU/ZC2DRN7MIhmNh0F5kJtYd17o= 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.4 036/255] f2fs: increase the limit for reserve_root Date: Mon, 24 Oct 2022 13:29:06 +0200 Message-Id: <20221024113003.640625457@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576977697470966?= X-GMAIL-MSGID: =?utf-8?q?1747576977697470966?= 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 @@ -255,10 +255,10 @@ static int f2fs_sb_read_encoding(const s 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 Mon Oct 24 11: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: 10211 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp642487wru; Mon, 24 Oct 2022 13:38:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6COeLgWQV9/8aMoQ0DRayLVNnKmlsGuP4jO9JBSDby58hRTIa1C6euV0UAtsjFH2xbXji1 X-Received: by 2002:a17:902:d503:b0:185:457a:9325 with SMTP id b3-20020a170902d50300b00185457a9325mr35524151plg.140.1666643918566; Mon, 24 Oct 2022 13:38:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643918; cv=none; d=google.com; s=arc-20160816; b=lOGLPTj/5U9Sr7HvNj7neQ0+wag/27eBz0X3122WlkK6Hu8UH4ck0FTDECmErEJNjo OoNvDWedjikADESxXES/XG7fkMdtMpVFEmxYStbxXgSAAXpV1S+JWwE2bBfBQgt29KGI riUg2IdXPEoG5LHULNGEWAu0x0oVnRrdkvN9uR7oPPj1luljmFbJZSfKWdp/4UWOCZWb IiBV4dvEWJ2tfMCBKm3cB39sDjj0tNulR9pAeGAWn57CkydyuQzbOLfBCY+Rz08JPN0s ff9DqsEc+QPdku1cQT/R0akQ6SRj3xhoDLdyMw/H5gWixXt/Xu0QIsf6HRyHAGjqPqW5 HZtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WWwCs/4xDOIUxT+zm+KThnHU7kObtxSoMqLObU/BCZM=; b=JH3OW/j/87LBachxpuKVnOrdnmP6gsT/ARaZKjbYaJFevmWKXpopGAUlcJGcSrkW4E dQ9k7DDimQGc4w5rOJ6GSK02mJ6gM4DXLSjAbCj6fhU2Hw+WzNIv8cO0dCvLKeclfTZH sH2uj7YdyTwv0Km9TZOxQAY6VlhCkiuzxDfQKjvDTgJX/OdAIQX5o2MiHRHuC/9NSSB5 7v1+PvVTrmDngOEcC5O1t48hkf7YoEV+605O4zwFWOmeeQibL1DQRdKl3Qq8OgM+ZF8q usza6f5tP1COkD4KkEwA5MvtXB618vhVQeHKKFqGr4uQ0nZByZ/vAPvHxv92S4laL4pT dECA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uX2oLhy5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a639e0a000000b0043c0b452d3csi655683pgd.69.2022.10.24.13.38.20; Mon, 24 Oct 2022 13:38: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=uX2oLhy5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234504AbiJXUg7 (ORCPT + 99 others); Mon, 24 Oct 2022 16:36:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234415AbiJXUg0 (ORCPT ); Mon, 24 Oct 2022 16:36: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 BADAC1358AA; Mon, 24 Oct 2022 11: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 ams.source.kernel.org (Postfix) with ESMTPS id DB4B8B81200; Mon, 24 Oct 2022 12:06:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42A84C4314D; Mon, 24 Oct 2022 12:06:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613174; bh=btpbaJQOeK/Q5qLPhStOkkSHkPIW1bhoa9FE22TUv0U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uX2oLhy52ExjHMmChEtcUsAZGtEAYlnCHOUqmVR6JJH7GQZQnvTrs66XNk7wmfgxo 7ShrfzvUJg90BKXJLMO52wi3XB76/Fbzky/Ai3Q9eP0yIa6BEs/j9nqBgry1pCiOjv vIZ/CLABhhDIynAoC1eJ4imcShDk4bRA1BRcLw/8= 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.4 037/255] f2fs: fix to do sanity check on destination blkaddr during recovery Date: Mon, 24 Oct 2022 13:29:07 +0200 Message-Id: <20221024113003.670696382@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602813661308236?= X-GMAIL-MSGID: =?utf-8?q?1747602813661308236?= 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 @@ -137,7 +137,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); @@ -145,6 +145,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); @@ -182,6 +189,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 @@ -225,6 +225,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 @@ -630,6 +630,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 Mon Oct 24 11: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: 9092 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp446063wru; Mon, 24 Oct 2022 06:13:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4tvoZhp+LYz0wf2LFvbbIo1mrA5PTlbSykMbBk4xWns7V8xefZUByLfAMeu2jes3z1VGns X-Received: by 2002:a62:1d52:0:b0:56c:2c:8124 with SMTP id d79-20020a621d52000000b0056c002c8124mr1438244pfd.24.1666617218880; Mon, 24 Oct 2022 06:13:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617218; cv=none; d=google.com; s=arc-20160816; b=zgHiMIFZXlj/StFhQXr6y0TwqjboMwPaCQqDStqBb6ABW1O4lxkdsZ2NLCZTv+mQCS +gFW7npKu0e0n3/Bs1jeononqVQPdzfNvIDOYVk0ygOceDOkn+VmpmUpqhsx/lPCIuPZ UoOADyMXol2gegVBYIntPewYMmqSnTQ0pGPQPYfdSXexQMlK8RHquUaNNYJ7dfe/8qVk q6KsXSWCFFLBxy6xRBaA6K0/Rg+o7JpYWUEaKGQi5KeQQ6+Jnr/SMqhD/rUe2JvgDwLM mRY585YZ00i82Joakkety/eZebJKKD3NqzUfqGEaQjFkgadvVGXU/paqvZQZXO8llR1S gSsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9m4nwRBGP06J2Wm3nxCxDrjrXFQepFUCsQ/vlch/KLw=; b=z53dKUWAzaQFhXu/2Y9GNg3GWcYAd4uyTEKgL6wNSBH+lYViErJLAl7Zwf8FT+Skxg O3Dlfs7w0YpcdxPwGPUQhkJLxA00VgEcJ/GvMgackCWRPuuqEi2nDKPftCnQ519HriTK LWqTbWUPPJZtGXxQYhGmoBQFrYW1HegyIJxhPvq9/Y6gbfE8NiqYVr1N31Gp19XAReSy NLFw5cP8+Vt3OsJpyzSF12Ojuxr0beOJI0uCzL2Ub1FeDUVqpBGK2iGYEB3Pc6i5hkO2 O9zTK65aQ/LxhzA4bIv0Lb3R8KqpsQKOzNlI2uDLQbaO99c1vavs/a5XQhfdrW4sYeAZ mKzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=s9IyUwV5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902dac900b001867d1a71a6si11699775plx.473.2022.10.24.06.13.24; Mon, 24 Oct 2022 06:13: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=s9IyUwV5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235784AbiJXNNG (ORCPT + 99 others); Mon, 24 Oct 2022 09:13:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236011AbiJXNK0 (ORCPT ); Mon, 24 Oct 2022 09:10:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C94A22BE2D; Mon, 24 Oct 2022 05:24: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 8F10BB81205; Mon, 24 Oct 2022 12:06:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB809C433D6; Mon, 24 Oct 2022 12:06:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613177; bh=n+CMlShebmcQLDR5asrTsndohyMMu9dY5i7dyKNhIsI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s9IyUwV5adMnI32yQafYfOpSoilATCOFAwKN/E5VMOMpmDr+Ubf4F6yuuAlIOpmxA AIe5dloC/LyV76zOQyMAusM03bcJ0QWhUe1pVltY+kwx8eDNEi0pVwMaJfHX/cDOTC 9RlkXTzVNTKLY+nOjFBwS5fgLHEcR6e12Xf3Lr4o= 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.4 038/255] f2fs: fix to do sanity check on summary info Date: Mon, 24 Oct 2022 13:29:08 +0200 Message-Id: <20221024113003.699400716@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574816740177776?= X-GMAIL-MSGID: =?utf-8?q?1747574816740177776?= 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 @@ -612,7 +612,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); @@ -638,6 +638,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 = datablock_addr(NULL, node_page, ofs_in_node); f2fs_put_page(node_page, 1); --- a/fs/f2fs/recovery.c +++ b/fs/f2fs/recovery.c @@ -406,7 +406,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; @@ -432,15 +432,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 Mon Oct 24 11:29:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8954 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp436066wru; Mon, 24 Oct 2022 05:56:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ZFeVsbfqZEGwicg7znHp9Uaiu503mkTUcharQzPnBmwRdjz3zlV2+UT4z3R0bScXigoTw X-Received: by 2002:a17:902:b218:b0:184:710c:8c52 with SMTP id t24-20020a170902b21800b00184710c8c52mr33423413plr.95.1666616169055; Mon, 24 Oct 2022 05:56:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616169; cv=none; d=google.com; s=arc-20160816; b=nlBLJCb54sY5tc7AUTpV7GdgJMuwDcgYsUi4TWq9SS68i8e8AO8dsGZzC2g+Rch7vI miqvUAUI26I/NMEGeMwpGv4m2EVUDaSTBxrutkK7mNtJbL/9YyV7NlO9m/Zn94id8S5Y yIk7ikFFtvDjDdzk0bdzT0OQAdH1ewnH0Mmu0zdmSQRzbyxs0IV5AwjIPQ6EmpZ6JrcW b7aLJLwpb5OaKgsHZ0jjJtO1k/Ccx50Hxx7mvvuaVnp57HqLaTcxTOKu92ndJhmutbvb N8ojP28653WC2z+VkM4tdkoaDovGywFb40yCmWD6z5SPH9NRx3+tFJzjtiGsBHeUpptU qIsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kpYHaUuqvI2YUJGcHswZBPY+osAcTf9K2CkjYsg6TQM=; b=dR1fNw2voGQXGsscR3r5sPbFrf3dSLWhg+iSvWIhxbIDu+XjKNIRNIKrg0OuKndR/w Zvbsn5V+IPxFIfS+hRlZWPPjSe2Lq9LSbcnZNqg0zAbLo/xYL4Vajm/xEnbkrMb1WtZ8 BgfjTDkrPkimGWgiT6uhwxOQoXbGcK5chxyvONWngOP4rAYFRzkgaOM1w31Dy70mZ0ke Dfj6DpqNlgXvo7dm7tNMLbyTmLlrS+09zg1Iu71e+R6wNu3UP8KRU+8uUHBoyvvyA4dE AtTEjWbaiCR3R56+qaUN5KNiMWO5cVde2+yvk4Skh2dWkXChg6gHCQUtmllGE5vglL72 g82w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gdibjvGo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f124-20020a636a82000000b00458a4779f56si35081309pgc.558.2022.10.24.05.55.54; Mon, 24 Oct 2022 05: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=gdibjvGo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234526AbiJXMyd (ORCPT + 99 others); Mon, 24 Oct 2022 08:54:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234817AbiJXMyG (ORCPT ); Mon, 24 Oct 2022 08:54: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 9153895B3; Mon, 24 Oct 2022 05:14: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 657C8612D5; Mon, 24 Oct 2022 12:06:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7AC2BC433D6; Mon, 24 Oct 2022 12:06:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613179; bh=nThvYlMCokv6gXc3/lKR2WMS3hubHiyAx5INGUND/qw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gdibjvGothA0ZsTD0B3zBYEm0xxwMa1p5ocdescMIy+kBXjS8XdmgtrHhZZoBGBlB K3SIRDfaQNsKB2i6ySbfkjZcTnYyNo8b086pfuTY1s55hH5mxD6GP398cFFGhOkYT9 ax0Sihhpl7LCYGr0n/TdK3C/MXism4KUc7QvW3Hw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryusuke Konishi , syzbot+b8c672b0e22615c80fe0@syzkaller.appspotmail.com, Khalid Masum , Andrew Morton Subject: [PATCH 5.4 039/255] nilfs2: fix use-after-free bug of struct nilfs_root Date: Mon, 24 Oct 2022 13:29:09 +0200 Message-Id: <20221024113003.729627889@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573716425913491?= X-GMAIL-MSGID: =?utf-8?q?1747573716425913491?= From: Ryusuke Konishi commit d325dc6eb763c10f591c239550b8c7e5466a5d09 upstream. If the beginning of the inode bitmap area is corrupted on disk, an inode with the same inode number as the root inode can be allocated and fail soon after. In this case, the subsequent call to nilfs_clear_inode() on that bogus root inode will wrongly decrement the reference counter of struct nilfs_root, and this will erroneously free struct nilfs_root, causing kernel oopses. This fixes the problem by changing nilfs_new_inode() to skip reserved inode numbers while repairing the inode bitmap. Link: https://lkml.kernel.org/r/20221003150519.39789-1-konishi.ryusuke@gmail.com Signed-off-by: Ryusuke Konishi Reported-by: syzbot+b8c672b0e22615c80fe0@syzkaller.appspotmail.com Reported-by: Khalid Masum Tested-by: Ryusuke Konishi Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- fs/nilfs2/inode.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c @@ -340,6 +340,7 @@ struct inode *nilfs_new_inode(struct ino struct inode *inode; struct nilfs_inode_info *ii; struct nilfs_root *root; + struct buffer_head *bh; int err = -ENOMEM; ino_t ino; @@ -355,11 +356,26 @@ struct inode *nilfs_new_inode(struct ino ii->i_state = BIT(NILFS_I_NEW); ii->i_root = root; - err = nilfs_ifile_create_inode(root->ifile, &ino, &ii->i_bh); + err = nilfs_ifile_create_inode(root->ifile, &ino, &bh); if (unlikely(err)) goto failed_ifile_create_inode; /* reference count of i_bh inherits from nilfs_mdt_read_block() */ + if (unlikely(ino < NILFS_USER_INO)) { + nilfs_msg(sb, KERN_WARNING, + "inode bitmap is inconsistent for reserved inodes"); + do { + brelse(bh); + err = nilfs_ifile_create_inode(root->ifile, &ino, &bh); + if (unlikely(err)) + goto failed_ifile_create_inode; + } while (ino < NILFS_USER_INO); + + nilfs_msg(sb, KERN_INFO, + "repaired inode bitmap for reserved inodes"); + } + ii->i_bh = bh; + atomic64_inc(&root->inodes_count); inode_init_owner(inode, dir, mode); inode->i_ino = ino; From patchwork Mon Oct 24 11:29: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: 8959 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp436461wru; Mon, 24 Oct 2022 05:57:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7YXkfWobGbEOu7Zb/51zEeqCmNekLMQ8QpuHzhWh+3riWm7lfs/sXcveaKRDyS9h/Qd0W1 X-Received: by 2002:a63:8a42:0:b0:460:58ec:cc66 with SMTP id y63-20020a638a42000000b0046058eccc66mr28091394pgd.195.1666616236483; Mon, 24 Oct 2022 05:57:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616236; cv=none; d=google.com; s=arc-20160816; b=JaLoW7PBroaaQYETQt54yHvRcOMbSn0y7i4BG7k4818rIYzEmW5DD5Ao/H3HBMoVBj 13Ty/5OrogyixpDEekGsIe3km0QSxedV9TJgvPyCAmXk5eiVc2VtmDCNbmjAa0UsJZLk xmMqiPZVBa6G0pf0YlZLgk4cGMZbC52+x8hxzqgeQFl8MIuH1ub+BnqKgb+BoBFJV9ZF 5uxkGezq6Lv/j1J925C1d+9DVQtC+VT2lH2qBVDo34G34QLC18oYvMpxPOf5+Pem7Alv Pv1M6BXiIuouDvV8w5wu+O4Pht4wYTGHlIeHwPrmmYIPCpCJlyuJHDsWjyZpyz61bzLs 4rhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vcaguoFYEMV/WjTeGRsoR1F7zzZdtojzgH32tZZptMI=; b=QAGNUcZBrNEhI/Ahi3ovz4raHIQwNS0krYAXcJ/oyTFywBs6JvSnWse7Q3PfwyFn9b 3YjkBSZN3cI0Q/mAoWwODcKsO+bPXexbHB0sKgQKu6jrqLUEwDnZCLlZurw8rugQsQrC vxSPgUx7H+2YoXho58f25C9kP5OLkSoeE9Fuik9qLJX9DLUaOY97jS2zdRSKKy99gdib QcTSc5mOf7Bs/zg2ougsSWd6LjrjAFXz28xAGFKSx845u/mAVGNoIyAuk5fgXpzjSPI6 GQIGnPdmDcN+YAwlR4Yis7AH+gGcskeWmqc8s7iNEZ5R+cecquUUgRiPI3CgrFFigenH WLSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RBqbMcH1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902ac8700b001868a25da0dsi8046140plr.40.2022.10.24.05.57.01; Mon, 24 Oct 2022 05:57: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=RBqbMcH1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234617AbiJXMz7 (ORCPT + 99 others); Mon, 24 Oct 2022 08:55:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234554AbiJXMzX (ORCPT ); Mon, 24 Oct 2022 08:55:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EB764E634; Mon, 24 Oct 2022 05:15: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 0C056612CA; Mon, 24 Oct 2022 12:06:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A856C433D7; Mon, 24 Oct 2022 12:06:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613182; bh=047Q3mGb+D9Rqs3g/v7llmzjHPdZKzlZ4a+uHakLGiI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RBqbMcH1TtzHTcKCwv78dFGYi3g7eT8spQf/Xia0d6l81dhWVmnytbbgXag6pWoti n896QBm9PiuTuc3m61kyTa+hpPHT8RUQxK485XdME9ta6fXmJVzHS+4wWAITa6pFpB UgL4Hx08XhnkhD6wuHRgzRMNMwqGLwbrYzmhTa/U= 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.4 040/255] jbd2: wake up journal waiters in FIFO order, not LIFO Date: Mon, 24 Oct 2022 13:29:10 +0200 Message-Id: <20221024113003.764929384@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573786801855801?= X-GMAIL-MSGID: =?utf-8?q?1747573786801855801?= 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 @@ -531,7 +531,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 @@ -149,7 +149,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); @@ -175,7 +175,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); /* @@ -810,7 +810,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 Mon Oct 24 11:29:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10269 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp644818wru; Mon, 24 Oct 2022 13:46:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Hf4S95ENOtNNdLGxmmJMlj+vp5G6I2Gptpxae9e6L107PHFSsrHBFVQJxtm6fZGeZFubP X-Received: by 2002:a17:90a:f001:b0:213:bf4:ee29 with SMTP id bt1-20020a17090af00100b002130bf4ee29mr8285776pjb.98.1666644374254; Mon, 24 Oct 2022 13:46:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666644374; cv=none; d=google.com; s=arc-20160816; b=OFisuQMo83oSszEuA2aSL8QNmaZdK7ZN3kVx2fIBaJtoZ3ggd7nL3K4g6VuZYIUM3z 3+7n23GstFrUW3UuTZOeItwhrVvvap0dIeeYj6OdPlr8IxwWrwzkXx9A5Eck4JEfEniY WfozUoi4Sy3AHXP4ualV6B2nIb9puOvu2S89VeBRTT3e3HJ3wGK+OVryNSB23PHHUnLD slpXN31Brlmc1G4BXBKNxHiVZn+ShWCDCe8h4RJlbvrIfnwPxTANzjfJ5y83q3egYdAq lPnpwJ8mCKGO9DFCZZKKtkP643a6vz0dOIdVuGRVyrLQg0uJsCZVPW7vsRcxv4aAI7de N+sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gRjFT5msr9HK47fVA2pbFydpTuf04++rBXHCVaPgRHo=; b=JADMmSsbRsCuJmSDyn7E8P8rOl/06KbtGYKkq/1LDaLfiFKoDnsGjPWy3icRxn3lsI TjUxjoXQ7prjTsl1NuAfypnoCtQEN0HWbVh8pZ1mt6FQLjDFxuhZdA/RPSqwPff3GHz+ CuoSO3vOevIMptQAhXhJvXpqBujjjpY4sYjYuMdMhJtLIOzNi1GvYVrQVAancycHn8zT VTcsUvkR12s3XgRYJuvlKgPO4ZRtj6SzVIb5WcynEbo1FNNtwgf/RK3cmuANYgwCQ/u8 ZSX2c6iEg3dPXf4CXgEME+ygLgyavKGgAoHmqqBt+H5AHg1UcvDBorsbKtoQj6I6Ar6Y 4mxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mzjp5qz8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i17-20020a17090332d100b0018686834315si649385plr.431.2022.10.24.13.46.01; Mon, 24 Oct 2022 13:46: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=mzjp5qz8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235040AbiJXUpl (ORCPT + 99 others); Mon, 24 Oct 2022 16:45:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235168AbiJXUoL (ORCPT ); Mon, 24 Oct 2022 16: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 8A148175AF; Mon, 24 Oct 2022 11: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 8357AB811B6; Mon, 24 Oct 2022 12:06:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E113CC433D6; Mon, 24 Oct 2022 12:06:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613185; bh=XTVhTzc/xTN+HjoQQ+gMakvgeYZ5zzi8LY0H4wMCYgM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mzjp5qz8f2z2bMbej0OFbyUNuJBdL4KQR0iD7O+Xi05pmvKK5VKHbWypNgBCh/sDW lRHOXXxkRYlJV39J/KPZOJm4pLFYfGTQFFKDqujSdu+zDO7KO1qFMdTfgjMNeiUn/k 1omPnu42yO46/vaDDdNo3UGx157NYmzFPfocpvtY= 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.4 041/255] ext4: avoid crash when inline data creation follows DIO write Date: Mon, 24 Oct 2022 13:29:11 +0200 Message-Id: <20221024113003.793730758@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747603291604045863?= X-GMAIL-MSGID: =?utf-8?q?1747603291604045863?= 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 @@ -505,6 +505,12 @@ loff_t ext4_llseek(struct file *file, lo inode_unlock_shared(inode); break; } + /* + * Make sure inline data cannot be created anymore since we are going + * to allocate blocks for DIO. We know the inode does not have any + * inline data now because ext4_dio_supported() checked for that. + */ + ext4_clear_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA); if (offset < 0) return offset; From patchwork Mon Oct 24 11:29: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: 9805 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp554815wru; Mon, 24 Oct 2022 09:58:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7XD/MEpIAd4jL0F6TfJxa0hKzDrsNWgF4RjMblGQWfmer8kHs/TijyAbt4ki6YzYFsfW9U X-Received: by 2002:a17:90a:7849:b0:20d:2d54:65d with SMTP id y9-20020a17090a784900b0020d2d54065dmr75462026pjl.219.1666630687340; Mon, 24 Oct 2022 09:58:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630687; cv=none; d=google.com; s=arc-20160816; b=F3VHZFGzuuyxqWbEVZU7zVzzP0dzlzgvPftei6EojG5i00n/yTD+5kMqYV5Rfr60IB fH6wAXYuNCYwtX+0rIiJKI/nU6R2WEj0nSSvZF1j1Pg+JTUC+64S53QIW0R7Kit1Jpah wevSjEw5eG4r04wxXXoQcr3BK/vBF7LvPlaE4Vx0faCvCOjBxff8z+XDoj/QktntRuwD Wim1jBKIRHXVc/y7DhsKYSJJwVNFhlOXq3sSiHFsjA+DTQxg+NIURCiQ+YhWFqH2tZmx rCvEVhPFAfWDrufqsj5zWgtgqAPaWaMus/ojJiXlKQJuxxJ74zIGOVPK8Xy/pihEFPJv E2cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NpXO1rMSILS51OGOU0gRtDFjZLO5oex+s9EREWoJc6E=; b=AWU0rx4oG2D/it/WR7d4u1k6SjA75M/u10ttTfvQ+3WnDYf+83S5wDHU2qYZx+q/XQ vLpM7+FdAopALVZwx7WPnh1lLRbmdqaaK3VCPUU9i/qjhtKY+kbFFZkyPbEhmLtQraqg mFdvHF+omKS5J0MnDdHQNWjL5TlAKzgxHyS9m+/jsfJv5cJSQ3vxUTGkhglcG8L/VsZT XgCVecpaSgmDeNwsi5V9/lnYlzaXOUpajd249D+xd7TAzXH28hO8zkePNymmqRDv/tlM ZZWu14NI/B6KE2euS4O/2jdfvqh0km25W9X1rcs4JwnGNcHeZZcDgyk+1Z0hZk2f7kml wHvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qKRGxeWj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a62790c000000b0056c01ece001si167508pfc.252.2022.10.24.09.57.50; Mon, 24 Oct 2022 09:58: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=qKRGxeWj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235286AbiJXQyY (ORCPT + 99 others); Mon, 24 Oct 2022 12:54:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235485AbiJXQtp (ORCPT ); Mon, 24 Oct 2022 12:49: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 63C742035D; Mon, 24 Oct 2022 08:33: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 2DA4DB8124B; Mon, 24 Oct 2022 12:06:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7ECB0C433C1; Mon, 24 Oct 2022 12:06:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613187; bh=VInNq3pcofEXsFY2ZYXBIzpHnG2nDAIZc7FLbTxJPsQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qKRGxeWjPxS6dvCMNBI83+t9l3C2dMSB3Io1nkzVSZZ2jAUthr8IkFwWf1kGfiQkR pcnX+Va+YayA6PHOqCVNwGdmYRn+5HqG5SeML488JaMW6+2BjOGt7y6gBoBE1er3Ja yp0GoBIIQydGEzMJCQOt13KLfDaYzk9B6jGFdw5w= 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.4 042/255] ext4: fix null-ptr-deref in ext4_write_info Date: Mon, 24 Oct 2022 13:29:12 +0200 Message-Id: <20221024113003.831687683@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747588939839704226?= X-GMAIL-MSGID: =?utf-8?q?1747588939839704226?= 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 @@ -5836,7 +5836,7 @@ static int ext4_write_info(struct super_ handle_t *handle; /* Data block + inode block */ - handle = ext4_journal_start(d_inode(sb->s_root), EXT4_HT_QUOTA, 2); + handle = ext4_journal_start_sb(sb, EXT4_HT_QUOTA, 2); if (IS_ERR(handle)) return PTR_ERR(handle); ret = dquot_commit_info(sb, type); From patchwork Mon Oct 24 11:29: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: 8892 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433654wru; Mon, 24 Oct 2022 05:50:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4XHOBSFT/eHff+IsJqOklEXhKiVxjcy+GxLxjM6LiQSzHWm7oy9gBooeJasPn4C1aOb/2r X-Received: by 2002:a17:907:628f:b0:72f:57da:c33d with SMTP id nd15-20020a170907628f00b0072f57dac33dmr27176048ejc.374.1666615806752; Mon, 24 Oct 2022 05:50:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615806; cv=none; d=google.com; s=arc-20160816; b=IK4VGGGS8NBjVCMbMjsw+w84dUNb4ex6UsBAQkD3mnSWumwhxpfjt7S+E0A0SkgKwe 05PeE1xFj3DBRPG64bqSxywCfBwTKGMAfb7fjVQtV1fVIBS3wgFwrG2wb0r1te8ldstE PuAZT+atGZorMeqkn+xYmYVLcAFHnchs/g266nE3U/BfwXZe+pgssczk3GAXPSIFqa9H WrbxRNXJg5etPLjzAXL+S1/3vP5Vf1KSRTp7ECyfQ8fiw+EBko7hbrZZIYc7LnztUcp5 y5Mxv/qmChLUWjk2maDit37RuL+/RE84lAwmkHGNBEmT5Ctrq+58eZID1o7ZksZoGC7k p5kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xYI14rWA1yANQLUVHEUXbqAAPR8TAypk4vrznp5QGzc=; b=DaOdHcC6OQBtccR5+KOzWaHGrjMQcLXdwqk6bbAzK73B97M9U7c3RB192dMsAKGrhz XeZafw7pjgro7fHmdprCFNnbmDAbBzKEdDKHoqYTTbZQNtpKKn8oCkp75lrXkwPlgp+V Or/ApPPpsta2lxUdnhYQdScbttfTKklApmjyNBcyHtoNUF67oXah6DQr0ACih0vGM21I OmykSE7FK+qssRX1cj/GEmgUWDrXmC+se3jq34Zd8ob+6yZw1E+5i+7LDjrU+rwUHcCi eGu+YGr64Dc7za1QaJvuAhQ3CugxEqvQYl11ZMYZ8hsIT5NqQ8qYacXT8u/ltD8aEb/K Nhiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WTNzZ5uF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fk23-20020a056402399700b004608b4f28b7si11831670edb.106.2022.10.24.05.49.41; Mon, 24 Oct 2022 05:50:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WTNzZ5uF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232144AbiJXMrx (ORCPT + 99 others); Mon, 24 Oct 2022 08:47:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234255AbiJXMmo (ORCPT ); Mon, 24 Oct 2022 08:42: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 DAFDD8A7EE; Mon, 24 Oct 2022 05:08:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9F7FD612D4; Mon, 24 Oct 2022 12:06:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B13C5C433C1; Mon, 24 Oct 2022 12:06:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613193; bh=9lSZ8aRNqxUmK/4jyig8irUcUZqPBRulXTjpjA2nuaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WTNzZ5uFc+dTmt9k2csTbehDzNldzFNj/hHot+GdrOTAq+SCm8UXG0EYA/CEHlB5h BFNYnkAafylPL5kMCE9uITe267zWPDOyampLZZPojKyWyEyKuf+MtJNilH3mKPyhaj vUWHO0EKOoaxmqFKxN4E5u87fv1eIOJgg55l2c/0= 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.4 043/255] ext4: make ext4_lazyinit_thread freezable Date: Mon, 24 Oct 2022 13:29:13 +0200 Message-Id: <20221024113003.863221366@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573335907418393?= X-GMAIL-MSGID: =?utf-8?q?1747573335907418393?= 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 @@ -3157,6 +3157,7 @@ static int ext4_lazyinit_thread(void *ar unsigned long next_wakeup, cur; BUG_ON(NULL == eli); + set_freezable(); cont_thread: while (true) { From patchwork Mon Oct 24 11:29: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: 9836 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp555998wru; Mon, 24 Oct 2022 10:00:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM46qdTrteHBG3rgc13CiltRJdl4g9rNRUqnI46NKnmihjoI7MhMckwm1vZukA7X4HqDvA5B X-Received: by 2002:a63:9144:0:b0:45f:c9f5:1bb with SMTP id l65-20020a639144000000b0045fc9f501bbmr28088006pge.165.1666630859490; Mon, 24 Oct 2022 10:00:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630859; cv=none; d=google.com; s=arc-20160816; b=zI9KBQK5toC6zIu9VgQTshxCta+UqqSG+br4/SrEvJFsaGSoOhownQxkGzLWBmCrmx 0k8homu6zBoj/iXDEP7oAGjkSnWrxeoo00L7gPfScxBttMc/FpQsutuSEP8V6EhUMH3l NRrkH7x1+o+5AZJhBQQkB3c7fWyHF1IPC+GYlYIU6FfKVpT0mTwBsyOBuejNmvN0pcRL FKGqsW47yH0b7QmOMCS/tCa+nzzhyxnYUa5idByRkrsShJtkVT5t22XI54Xco35yLgCz Lz29mQYc6uLbgVbV0YmgLIz2ESrirT0mpl8rTfj+N7I1HcZVm56wn3rK0mhmWlt/sdUR S5LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OoXUJMqtcbWukmRb+zUw2hyrbyKOEynAYk+JXmyg2k0=; b=CXY1r4M1CD/ZZOzHqxnhvf++0Wr/PtUGIwvgJtrovoQ6MQUgiE8jC4+o5xHTXFmUhC EkIy0VjyCjveyfs+3XY6Gs40+xjeO92BhtIuqlR5MUJav+srKEqzc9gj+g1WHEwGa68G YlomjmzwEH70JDZnVCNhBUd749JrWHUosxd00T5o9McmcueZQg8YwUmaJFh184J+7JGr QYFFthcz7lmnUsBwUZU9sQk+koXcvHCwCQiM/QRDBbqCS/AoA2uUOSOZhCzlC64SWpza In/b3lo21uLE931NIY1+7bqt0a074NzwFl/N6lmpkwlj+/opTSzwAKQV37WvGKlkaHkq 3Whg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lqb+dGyy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x6-20020a170902ec8600b0016efde92292si9700plg.255.2022.10.24.10.00.36; Mon, 24 Oct 2022 10:00: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=lqb+dGyy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235938AbiJXQzV (ORCPT + 99 others); Mon, 24 Oct 2022 12:55:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235671AbiJXQuF (ORCPT ); Mon, 24 Oct 2022 12:50: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 48BF64449A; Mon, 24 Oct 2022 08:33:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 01797B811BC; Mon, 24 Oct 2022 12:06:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59F0CC433D6; Mon, 24 Oct 2022 12:06:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613195; bh=V4IA2J+RiUYh6Wz5OBXXBXbyZirdIwQ3guXguybdpdA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lqb+dGyy1wuQ1OY3qZrJ+nN0gfNGffFgeh979bpNWJ3q3jZxVJlTpvDzYVNIEO4c1 y0O7xBkoaSNErdqQlrRzS+UTS0mmc/eQrLSGUrb6AAt5vJJhu8iKpOFYW/rY4vhSSD LS4+xNOxMRL962QHaqYHyCL7AB/HU9GxP695uYUo= 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.4 044/255] ext4: place buffer head allocation before handle start Date: Mon, 24 Oct 2022 13:29:14 +0200 Message-Id: <20221024113003.892320358@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747589120063406393?= X-GMAIL-MSGID: =?utf-8?q?1747589120063406393?= 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 @@ -1317,6 +1317,13 @@ retry_grab: page = grab_cache_page_write_begin(mapping, index, flags); if (!page) return -ENOMEM; + /* + * The same as page allocation, we prealloc buffer heads before + * starting the handle. + */ + if (!page_has_buffers(page)) + create_empty_buffers(page, inode->i_sb->s_blocksize, 0); + unlock_page(page); retry_journal: From patchwork Mon Oct 24 11:29: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: 8866 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433143wru; Mon, 24 Oct 2022 05:48:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4oETh+Czf0WFPQQeYsPRhf6Mxa1cahuyWJ0RLWnqkwuDZxsXGF8Cs1EGrGvkcI2Hmj9r3+ X-Received: by 2002:a17:902:8542:b0:186:75ee:baac with SMTP id d2-20020a170902854200b0018675eebaacmr18291619plo.35.1666615719970; Mon, 24 Oct 2022 05:48:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615719; cv=none; d=google.com; s=arc-20160816; b=pz9BMbsBknj8CH2ftWgJaf4hDbtuMTCAsQhmTT4JNFMGRPp8MZj2L8DqoO7dMxa7F1 MS4+kKpo9ZpjvmTHTa1N6sjpPXy124Mwv5gQVcuWnmWDUX35z78l55ZiI8KYFJ10ppi4 10oAn9B5ksiK6GxATRPln3G/zaS/KKt7gZW4uX7LDBd9H5VMbbhhHts5WcpNm/BmTFis UZBbMEagQbYQmiQBqDBdgWpoabF/058GpZmGYK7Iy7vPlaVOTpkpLFpKBlGq6ecSK/j7 AtcLglpdRcadLn9VLvhgo46Vz9qffyuRZWBHzX+COe/YYV0+7GzgoFMgVJ3hAv6yw7pc Y7kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3P07V5+0QvgExhqU5bSPyEIgOG8Hgc7gEw584zyCgXs=; b=VlFVUMs4Y4AxdExzJWj0P18OylpNAKI8hkpG32NJ95Ri9a0i9Aqgw6u9YzQwE7fIYb RE+oi9OMOF7S8QQQAK7n87JO96yl9nncqyO99ZTXvCKyjbJMd7zwkxNFrWQm24+XktMo +R3Ui5Gz4HfsGQ0zJ/VVKpu8g/Pl74hmwIJUy8x/FNo9aXX8lunewiXiFcXFoVgf1UtN J0hor+7M44KjWenagPLBjRg5BdLXN6SAr5uCWK90mZjdE1KiNHGIIV/cypqYDyguG5xD 0EOlAqIdYAt3KXNGhO6j4hO8VvKeODjTFQdyHzAA46UUWv/hBMUVSCWqw4wwCLh/mTVG hM8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0h5+sHIe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902b18400b00186aee053fbsi1977461plr.287.2022.10.24.05.48.26; Mon, 24 Oct 2022 05:48: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=0h5+sHIe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233993AbiJXMlo (ORCPT + 99 others); Mon, 24 Oct 2022 08:41:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230254AbiJXMiq (ORCPT ); Mon, 24 Oct 2022 08:38: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 6FC7189ACD; Mon, 24 Oct 2022 05:06: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 D8DEA612DA; Mon, 24 Oct 2022 12:06:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC8B8C433D6; Mon, 24 Oct 2022 12:06:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613198; bh=QU6jcTM5tFiqBhEpEDUebcCTZlgBib+XeTwuUsseiyE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0h5+sHIepDjG5IvtcEvd2LEO/IcDhyuNio63oH0RmR7IvyqnSvtDtub1ctw9ULdOo DpZrT3RTut92W/GY/ToJy2346pBesxdWx3W5wT5Bvg++j6TKTFKc+jDMXbMGTt9iZh Eq84gqVTv8cwhYWI9nbA9kSQX4IHYb1aHZ2XR/+s= 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.4 045/255] livepatch: fix race between fork and KLP transition Date: Mon, 24 Oct 2022 13:29:15 +0200 Message-Id: <20221024113003.931359535@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573245461585137?= X-GMAIL-MSGID: =?utf-8?q?1747573245461585137?= 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 @@ -611,9 +611,23 @@ void klp_reverse_transition(void) /* Called from copy_process() during fork */ void klp_copy_process(struct task_struct *child) { - child->patch_state = current->patch_state; - /* TIF_PATCH_PENDING gets copied in setup_thread_stack() */ + /* + * The parent process may have gone through a KLP transition since + * the thread flag was copied in setup_thread_stack earlier. Bring + * the task flag up to date with the parent here. + * + * The operation is serialized against all klp_*_transition() + * operations by the tasklist_lock. The only exception is + * klp_update_patch_state(current), but we cannot race with + * that because we are current. + */ + if (test_tsk_thread_flag(current, TIF_PATCH_PENDING)) + set_tsk_thread_flag(child, TIF_PATCH_PENDING); + else + clear_tsk_thread_flag(child, TIF_PATCH_PENDING); + + child->patch_state = current->patch_state; } /* From patchwork Mon Oct 24 11:29: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: 9243 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp461215wru; Mon, 24 Oct 2022 06:43:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5oiFkGdkAgTnE5YbLOnoSGPi9PIKD9+f8NoJBXJiXRjZJGljvQclTEJdi+MLAmVFMoPdRt X-Received: by 2002:a17:907:2da7:b0:78e:4ea:dbf7 with SMTP id gt39-20020a1709072da700b0078e04eadbf7mr27043097ejc.616.1666619004120; Mon, 24 Oct 2022 06:43:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619004; cv=none; d=google.com; s=arc-20160816; b=WYo1xOv7X8K3ucPhTreCuNnq5dXmNjXQMAz0ey4tbN/MvwkOXuXkZSuH+K3V1paMDr H7t9kPn4hwXSkFiT+nh3MeuJtrXLHH4zLWyRFgORihDaNYwpnFIfyWKW2TK5thneCYXy klx1+IdYreyVyC7T4t6a8/0yJ0Duk9c7MOqP7EsofLO//vxosWqWzGaWoRRUQ9l6OFRL Wsin4kt8o3X1Vtt7/iT5fkGmniu45H02dPg00o2MBe3olv3csTEqgruHMJpMt1hzvz24 DO+V9yQ/3KEmwf/Rj2eQy9olY9+L3bavyhrdueDW/btB6+nkPx8K69X4by/5RpyXIwKz e1pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0YzBseyDoF1h/BU5A8XERDqGrGhL8s4TjPx+gr7AZWM=; b=T3udxjS0u2mBgjosA9NAIhuY6n7fm4XBgDp60h3cN/GFB+CfoS9Ec8rLLS/KgMhkpB xkSDTtXkqoaB6QeWl6T5FAac5nALEM4zzCdmvcApsbbFs+L12CG4Ymhk8QgjY15ETwJ8 QDU8Hym0utoOTA+yt1AWP9oJm9MW2MgaUEndLuYsTwKZhLqwD+HgK4VSrC0o2Q6piVBA jjv7hBEvSJUifOU8qFS7pEhabhqr4Hg+u/SAutvd8/+37dq/ogS50Fn3j9NgOFvMHy8W T0m9kxNLr3i8qFFnCukDzCaTU5VmdI9B5276u3E97uKl5BNcJEq1fNwqlIW3OiBbAvBE wThA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B6Ckco5P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090632d900b007891fd91786si23356478ejk.151.2022.10.24.06.42.59; Mon, 24 Oct 2022 06:43: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=B6Ckco5P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236025AbiJXNh0 (ORCPT + 99 others); Mon, 24 Oct 2022 09:37:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233520AbiJXNcp (ORCPT ); Mon, 24 Oct 2022 09:32: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 B01B51DA70; Mon, 24 Oct 2022 05: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 ams.source.kernel.org (Postfix) with ESMTPS id 3D7B1B81190; Mon, 24 Oct 2022 12:06:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91C16C433C1; Mon, 24 Oct 2022 12:06:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613200; bh=kapTbQ2ku69T4B7Gewk0shhG4KoU6HkPfCsKrGr7XUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B6Ckco5PkqMDXkPCCymZE5ylLPnpdreYzBdkXKP5WK7vQQJB2ePC69cXPN6iZQXh7 7RoYO2/2Sa0dwVhfaNDzxYqBlpepvy+my7RHfOkBT1q20M8rvPUK3WZ7FOCsodQ8qI sJUDtHCyNT0pb6CYpfslMMjq4juJ9s1farO0aR7E= 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.4 046/255] ftrace: Properly unset FTRACE_HASH_FL_MOD Date: Mon, 24 Oct 2022 13:29:16 +0200 Message-Id: <20221024113003.960842024@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576688818852522?= X-GMAIL-MSGID: =?utf-8?q?1747576688818852522?= 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 @@ -5084,8 +5084,12 @@ int ftrace_regex_release(struct inode *i if (filter_hash) { orig_hash = &iter->ops->func_hash->filter_hash; - if (iter->tr && !list_empty(&iter->tr->mod_trace)) - iter->hash->flags |= FTRACE_HASH_FL_MOD; + if (iter->tr) { + if (list_empty(&iter->tr->mod_trace)) + iter->hash->flags &= ~FTRACE_HASH_FL_MOD; + else + iter->hash->flags |= FTRACE_HASH_FL_MOD; + } } else orig_hash = &iter->ops->func_hash->notrace_hash; From patchwork Mon Oct 24 11:29: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: 9809 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp554919wru; Mon, 24 Oct 2022 09:58:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4VcSDbUdym+ByZsOznjc9Dl/HXLj3HhqAyZRIDeuofE1Q4ZkI3zsTihgGK09k8wDoBJRj7 X-Received: by 2002:a17:90b:1c06:b0:20a:f070:9f3c with SMTP id oc6-20020a17090b1c0600b0020af0709f3cmr40415217pjb.151.1666630706993; Mon, 24 Oct 2022 09:58:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630706; cv=none; d=google.com; s=arc-20160816; b=G3FRSHtKtapBLd33unK/adLLo+SCzsZiocuZ8OOyJyCUIa2LRjSBHKcovlyMxXv3LI 6yYSKvdlMkpslZFJ6/rm64aCiN99CeQ6/l5Jc1dN8zAJrSzSNcBFs0K+WYLWQVY+Gj+j 9yGkaKa8GYoC4ic2rsEb0a9kDaiZ6a5M58+X1zMsWNDgkw+vgHD7hYmd5aK25qWll68R XVCKMlppZ+dpAStAisHoQznWC2wKHv111584uuD3B0YuXsBJN/hZ/aTbqkrMBJfNABPN thAuluu2t+Z96y33DIdGppkQYvxU2JtGuxEIoPD5zWAdwzhvrHx6J2LysyP47XnF634V sJFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Utz/02xJvIOtZkxUUcNH09X6XpNcQQL7Y74KPTN50pw=; b=ynMhFLRv9vHfG6dxNnYIZdYn91cf4nRG0T4DC09NEopeO2+sAPlSJHwWe2D/Dyfets 2iq+P108q0VNuMu3Fb3HDCRqKkxWn435HTRHhWDxf03fT/8RrohyD2SDxx6o+RTzyD+s RusMiZATsQRQHnkuT/e9SKo4+OkPOpTKap+V9qxlEsIq5yeuNvCFYkFopOnMLHKOIbiy kB8r3goUOvfWW/2kzzdU8hCr1IspRG8kDQ7KgHt+etBKxaWGMW5o+/dS38IUqTQ9wNKD oTIea1lg05iXbaPBqvCSaigzIX9wtrK/6BmOOz+UgFHHew4oo2R0DbSnP+qtlWy0aufg MRbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="AaXnha/8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id on13-20020a17090b1d0d00b00212ee026b3csi559811pjb.24.2022.10.24.09.58.03; Mon, 24 Oct 2022 09:58: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="AaXnha/8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232384AbiJXQw4 (ORCPT + 99 others); Mon, 24 Oct 2022 12:52:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235286AbiJXQtW (ORCPT ); Mon, 24 Oct 2022 12:49: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 0DF0283F03; Mon, 24 Oct 2022 08:32:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CDF64B811C0; Mon, 24 Oct 2022 12:06:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2EF57C433D6; Mon, 24 Oct 2022 12:06:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613203; bh=l6/JJYg71Tp2CdzP8UNQum0EZe0uGk6D7/A7ysK3Bd8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AaXnha/8/a7grlQt8T4RAetTN0RTHSGTKuicaNkWjn2amnQrv608Qc2wZ7n1aNa63 eMSz+0U8pF/WKvFC0i82oXj1gVChDPMb5UXgwkRcMPHfpuCN3gA0iG8n+B32HZ5d3n //aoiExxbH9kOwgs1GDyXjY9wAGFAVGjztCb4aDU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Steven Rostedt (Google)" Subject: [PATCH 5.4 047/255] ring-buffer: Allow splice to read previous partially read pages Date: Mon, 24 Oct 2022 13:29:17 +0200 Message-Id: <20221024113004.000546176@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747588960152616558?= X-GMAIL-MSGID: =?utf-8?q?1747588960152616558?= 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 @@ -4825,7 +4825,15 @@ int ring_buffer_read_page(struct ring_bu unsigned int pos = 0; unsigned int size; - if (full) + /* + * If a full page is expected, this can still be returned + * if there's been a previous partial read and the + * rest of the page can be read and the commit page is off + * the reader page. + */ + if (full && + (!read || (len < (commit - read)) || + cpu_buffer->reader_page == cpu_buffer->commit_page)) goto out_unlock; if (len > (commit - read)) From patchwork Mon Oct 24 11:29: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: 9832 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp555985wru; Mon, 24 Oct 2022 10:00:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7e4Ph3/oKtcgujvOgoeD2hixTRvMII8LpDUjkpDRvLTiiR4TLJbV+cy0YgytjWi/tUehKU X-Received: by 2002:a05:6a00:238d:b0:563:b212:9257 with SMTP id f13-20020a056a00238d00b00563b2129257mr34260021pfc.21.1666630858596; Mon, 24 Oct 2022 10:00:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630858; cv=none; d=google.com; s=arc-20160816; b=PSoCh70AJqmpAK4q+cRKdr8DdZ6+BCTeQTqziOupVyOIEiw7xeqNylCP+MVqjBJVve d1R7VoivAvCmxqhoFV4BaWOuvRnF1fO+1lCysaaQvfNQYmPZ3vne1BTchRkFr5dA+qzk VpcyFfNl4awSAkJKc7fzUbOsjtwUHs13/4vtwBZ+F6RLpmMkca8U3D8O0SknOMjGx25l N17WjzbeebDWLb1o0RrEmGTvbo85yBB/NFG7vbys/QxHgEE4PACp4N/Y1DdUMzbQBDxZ vkpH17RqUIGy606H/n4plwOQP7jHVs3WuFDVmlvSi7Lp3+PjNj0Ezck+mg2K2Ygi0WDF BaaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=c8ji6hNG/8lpqM0s6e2jhUqEfpjVrmEW5dH6PyEj+FU=; b=tptvWNIrHKboHAmW1wDsWRyusGDlxcMovHp54gRvR0nYBbMQm5pBdIgPMn13HQT/Rv q5UdehwBEEI2zTZhvcQj6XrgwWHwbD4zLMQ0eLaTmaVQL9JqJJkcYzb102OgnnoxC03S gWLu00kL4jDlwr5M7bf/4gw3Q1cxnKN0u1vQvXzpCHQGa/Eq5edO8wY4K1O/yZVCIEQ6 zQhhst0IoXkBByPKJKylPP/ub40ZilPQ1iConX9q+ESjl4gBiTDLb5X0LtD9EzxzRDF+ pB4gfVLWAKKc32KN60Bw5hVijNF8Fn0dy42M9PVgu8b6535M/Td+WfV6ZdcGk7Gl2qHo j5Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CwZs90bY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a63485a000000b00439e6a52bb4si34398489pgk.620.2022.10.24.10.00.32; Mon, 24 Oct 2022 10:00:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CwZs90bY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230486AbiJXQxb (ORCPT + 99 others); Mon, 24 Oct 2022 12:53:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235368AbiJXQt2 (ORCPT ); Mon, 24 Oct 2022 12:49:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC460AE47; Mon, 24 Oct 2022 08:32: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 6C68EB811DC; Mon, 24 Oct 2022 12:06:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC54AC433D6; Mon, 24 Oct 2022 12:06:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613206; bh=icTs9rKGCt1Miqe8tmTxHT+ggf/LGr/61YnBplZxuxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CwZs90bYflhbvsKnFVHXovTftHjqt62SEUbxJGbmjGwj+bm1m/bMDFZZNavxCj7bY tDrtlcxk8lRScY1o5UX3aGMlvCAV6p3J3HWuKxwkFHHjVLtQJFGFrjw9v+YmZaiL+h 7fi5SMqjmUudtOB86VhSPJYJF25KLOChLvlwgzZY= 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.4 048/255] ring-buffer: Have the shortest_full queue be the shortest not longest Date: Mon, 24 Oct 2022 13:29:18 +0200 Message-Id: <20221024113004.034684859@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747589119170638712?= X-GMAIL-MSGID: =?utf-8?q?1747589119170638712?= 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 @@ -662,7 +662,7 @@ int ring_buffer_wait(struct ring_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 Mon Oct 24 11:29:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9824 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp555154wru; Mon, 24 Oct 2022 09:59:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6UTcuqT19ct1xWMIXUqYhNmPlDQEYx5Vwze4ONOHvKXEmTbMGqCpAwE2chcnGfiY+oYD/w X-Received: by 2002:a05:6a00:1596:b0:563:9a1a:b5b0 with SMTP id u22-20020a056a00159600b005639a1ab5b0mr33551070pfk.38.1666630749569; Mon, 24 Oct 2022 09:59:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630749; cv=none; d=google.com; s=arc-20160816; b=ilDIfIKhzYBJCyJMGqatvqTFnAu0wx5742aty7HOMh3ZRO6vPjuIpKBbaBWHIM6iTy TQRqAJLGuYB+acfj/eufVYFIlTpcXRe5LJAj9su4SUucUEKgKhGVhc3nA059Z2g2/9bR QPsCrQYf2mYjAkCfyANCEx5RH2ORDKmG227pclmUN+bGP1WG7r1hASqZqqYSqk4/1BNc nBz8Dk/ND2HMIXBcsArg0wstLPuU02T7iu14qfCipxbPCNcqltsKxTSTbKaxa/GsRDbr tkYUQq7qf55/TdLjoI77ypRK7w4Xkpni/CFVxQmifiNpbcVzLO3uHUFWySjZuH4jrs1i oqnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dAyvHZn5UFfHfZK5Rl35YLAQbqD1BjUFH9FboZC6bHU=; b=uI1C2TIgljOkpqn1Xl2HFAa8bjHO4itIvwWVoDJueJZDcV/n4jXpL09QMGNKeAj/go vTBD/5WrH4MhnOXoEZljA8mgMhitMaEowp3xltwiucI2+ZKOrJLGf69xHDPhIDTH/bW/ Q7cvxC6XFF9O7GjvUqriLHn/vfpxVVTgTJu5qjQTfcX3xxjbJx470aRr1KQYfSxVlusZ qstSk5c1k/OTok7XalPH9D7mMI9iR5sigOgUqEABTdoMkxXwgjju505ksTSHmpnte4do MHeJRqIFhXs+/3goNO55OpBMMv7KUg6YNVqQp/1vo68bolzNkzDfCxVni8Kooj/nIonC Vg9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MUaLmpxi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r23-20020a17090a941700b0020a7e0138d2si393372pjo.50.2022.10.24.09.58.52; Mon, 24 Oct 2022 09:59: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=MUaLmpxi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235721AbiJXQyz (ORCPT + 99 others); Mon, 24 Oct 2022 12:54:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235524AbiJXQts (ORCPT ); Mon, 24 Oct 2022 12:49: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 F15653AE69; Mon, 24 Oct 2022 08:33: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 0FC32B811F5; Mon, 24 Oct 2022 12:06:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64103C433C1; Mon, 24 Oct 2022 12:06:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613208; bh=ZIGrfetGEIU8wKnKF3wqlhW5iLqaHlFdnmonhwY5LqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MUaLmpxiD2AOX+rVPBcNtbNlqxF9M1HSfIapABY0ER0nc43nrzN6Egl4WnnHo0ra7 EYQipx7yCXeaLOxjVfUXp/rLU+L3Bxu2WKrZK+etnwUfXc73Ogwohc4ttSJLOHfnh0 ibG6zWT8dm4SVMaEzZ5Q60RBKzszv20m6ayKLTCg= 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.4 049/255] ring-buffer: Check pending waiters when doing wake ups as well Date: Mon, 24 Oct 2022 13:29:19 +0200 Message-Id: <20221024113004.064636694@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747589004827316259?= X-GMAIL-MSGID: =?utf-8?q?1747589004827316259?= 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 @@ -568,8 +568,9 @@ static void rb_wake_up_waiters(struct ir struct rb_irq_work *rbwork = container_of(work, struct rb_irq_work, work); wake_up_all(&rbwork->waiters); - if (rbwork->wakeup_full) { + if (rbwork->full_waiters_pending || rbwork->wakeup_full) { rbwork->wakeup_full = false; + rbwork->full_waiters_pending = false; wake_up_all(&rbwork->full_waiters); } } From patchwork Mon Oct 24 11:29: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: 8870 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433192wru; Mon, 24 Oct 2022 05:48:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Xxr+pPMAj01dhKMmLFg6cvTMfcLlTE0g4PCPxdwh3gmlQ3Aff6bf9uG2//x00SnIiDvhC X-Received: by 2002:a17:90b:4c11:b0:212:ec8:88ff with SMTP id na17-20020a17090b4c1100b002120ec888ffmr26516206pjb.199.1666615727095; Mon, 24 Oct 2022 05:48:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615727; cv=none; d=google.com; s=arc-20160816; b=nln7JZS8GeZOUg80f2KFtPUQwKuWlcNyrVN+j2t/o6Lo8Q4p7BTPnEf/5l3DbykSaX 9BvJuCReLldFzz4nyGJeWSOuGbWWreDWWPsvqqsIeZ+7kuCVnQgjV3iqWmg0t2VynQY4 HmCq9sAkNhKHMFSn/dJadZlgcYnWK7tX+G7hcLtQ3bADy7MqyjrTuN7oR5oRxID2FkU8 dioqwN8hecLmWyTg8xR+vPBq0rJeWf9EjR/TGtaKfUw6FGkQWAQPmX4dq89P571OL5Uw akaC3IHVEoydgre4RQVCLCC3SsjrvAFAx6k5TZSjXpwjhb5gEyU0Q9IMKMHyxdc710aR LaOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SR6pP5IM+Q07mRRMsBu/gbQ4fTiM/NMWMPhxvWMJUPw=; b=llMGsh8SOqNfCeifbbL0v9qedvVJnQfVOSJxfTxCxRMi//GmdVHzxw9Ymju35r8rk6 u7YC9vyDhcaeIRGTrwIRLBtjZkKZCXgs7aIxPrV6+IMtMaL8nK85x7sbKu/H6D9VgAz+ D8o+0uwYA+OVDaKTd8DoWRj3FnIG0wcAzZxBOZyHG1cq7RXRYE960O2ru3a+VbAZLgjg sdrnbZrLlf/VctkrHp5QacY1v22TtNIFwJxCsA5VeuCQLq3ESXNxUpugmpgvLaW8D05k NGwc83NebESFanbxo65ezm/7PlrCw3PaQv1qxM6V7Gu6F4/rjp66PtumNdyHjg013K4h u7mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UEqYTW2h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p22-20020a17090a429600b0020b304225b4si8335023pjg.104.2022.10.24.05.48.33; Mon, 24 Oct 2022 05:48: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=UEqYTW2h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234141AbiJXMmG (ORCPT + 99 others); Mon, 24 Oct 2022 08:42:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234205AbiJXMjP (ORCPT ); Mon, 24 Oct 2022 08:39:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9AE38A1F2; Mon, 24 Oct 2022 05:06: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 0420361252; Mon, 24 Oct 2022 12:06:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17A98C433C1; Mon, 24 Oct 2022 12:06:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613211; bh=mnZrPTVXa7PbvUf39H6Md7ZmnvlQMMndqMjFvHUqwe8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UEqYTW2hXHfSdPBtAq8lUcYRKfBRa/1RDyqrVVy+w+aF/Z8x+k2TW3MFTv6kfz3SV jpDydDkwNtDnAMRWGZxn8kzWkNxylwVL1t33I2v7ESSU55lrdVsiw5ZQQgpnJJHxzW Ocvjwc/SBg4YcZiQna60SCKUN/QGpOvgE+EAeZ3g= 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.4 050/255] ring-buffer: Fix race between reset page and reading page Date: Mon, 24 Oct 2022 13:29:20 +0200 Message-Id: <20221024113004.095004506@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573252518586849?= X-GMAIL-MSGID: =?utf-8?q?1747573252518586849?= 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 @@ -2191,6 +2191,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; @@ -2202,6 +2205,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); @@ -3864,6 +3870,33 @@ rb_get_reader_page(struct ring_buffer_pe arch_spin_unlock(&cpu_buffer->lock); local_irq_restore(flags); + /* + * The writer has preempt disable, wait for it. But not forever + * Although, 1 second is pretty much "forever" + */ +#define USECS_WAIT 1000000 + for (nr_loops = 0; nr_loops < USECS_WAIT; nr_loops++) { + /* If the write is past the end of page, a writer is still updating it */ + if (likely(!reader || rb_page_write(reader) <= BUF_PAGE_SIZE)) + break; + + udelay(1); + + /* Get the latest version of the reader write value */ + smp_rmb(); + } + + /* The writer is not moving forward? Something is wrong */ + if (RB_WARN_ON(cpu_buffer, nr_loops == USECS_WAIT)) + reader = NULL; + + /* + * Make sure we see any padding after the write update + * (see rb_reset_tail()) + */ + smp_rmb(); + + return reader; } From patchwork Mon Oct 24 11:29: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: 8867 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433165wru; Mon, 24 Oct 2022 05:48:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6xYd52NSxdl7jgy8CtX10PeSZuHxMGx76G+VX8AZiCa//8qNRu14rwT+sVkssN4CbWtoCq X-Received: by 2002:a17:903:447:b0:186:b945:c0b2 with SMTP id iw7-20020a170903044700b00186b945c0b2mr743511plb.25.1666615722352; Mon, 24 Oct 2022 05:48:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615722; cv=none; d=google.com; s=arc-20160816; b=tuSQ+IOU6TDssUhLyI/I5j/aC7u3Cpie/Vo03CiIAYMVZx1KqDWDj+zz1JXsQEeuKz aCLFgyNUzvqRyvmGH/tpir3byqx9NBMrQGnQsCbiIxcinYrVoHajrL5DvOcHgEP5tlps XVLutsoOpZ/wgxzYi73qm6c4s3OTZCrQFRPnRqj8STM4JuFWDSzuXhZY+HpfzDgPIoEh U2zwLUd23EDlmW7UHScDv8XA18dggeV0wO5kddXhyDVEm0hOi+bsLHif/g1SZKfXl4uW 2Ql1X20vfB6ZVahd7m7X/gHkBM/OoxRaj72KjPME8JYLexk/oS2RhTKxCpNXU8wUMe6v DwiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iCJ1YO0mDXrp2UpGwzDGOzTne2FlJmHeHqJ5p6Bw6xY=; b=UhlrWG95k2HvmTF9aN4XZjEl1WWlMvx44v4rlaKzJcAoj0MA+fMr/J/QIiaN+sTfMB avZkDb/Rt+2stvwrxN+tJ9f6k3qyHBD8Rh/zhVZ21wL5ZhbxYbgUJC56P4ASBP1OuzvS BJ+TJaw+dmnUw+YuUI0IM20bKBu3Z7gJGVMi4onOXvEoMuuba5KJCEmj6aiPAvsSLKw1 5nZc1rM79eJP40RWebUHY94e7BMGbNxhb1I53nCrBKhz4rUpFN7PXYWpnZgfOnDKbmD3 KT5ZE8jPkfgoaoUtqtWL0kUr4HRyYJnu0O9qjox3y9DEQJx/+sriK7yAyY4sziuWh2I3 dxMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=V92o0Cvu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oc16-20020a17090b1c1000b001f0311d12d0si10682081pjb.185.2022.10.24.05.48.28; Mon, 24 Oct 2022 05:48: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=V92o0Cvu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231211AbiJXMl5 (ORCPT + 99 others); Mon, 24 Oct 2022 08:41:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234127AbiJXMjF (ORCPT ); Mon, 24 Oct 2022 08:39:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD98889922; Mon, 24 Oct 2022 05:06: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 8E163612D2; Mon, 24 Oct 2022 12:06:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A316CC433C1; Mon, 24 Oct 2022 12:06:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613214; bh=G5rFMnbphdFlimTTrBxf0GATpB6Qn3yV8DwLPrEA5UM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V92o0Cvu9UeaO8MRSVUoeVYxRGi3mlgRWRcvPnuAH2Sg+S86gG+A9Qz/F2NnGUvaA CZITvtIi+oUqdWEPLlvWTI1r7fux1tZLNxluAluI4E8x8/iJjMbW3VGkLVHkQKNU+7 9SmeFLmQ5xRC6ii7I1tlYYmbA3uUf4Y13UGiP0LU= 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.4 051/255] media: cedrus: Set the platform driver data earlier Date: Mon, 24 Oct 2022 13:29:21 +0200 Message-Id: <20221024113004.124428205@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573247571798789?= X-GMAIL-MSGID: =?utf-8?q?1747573247571798789?= 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 @@ -323,6 +323,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; @@ -392,8 +394,6 @@ static int cedrus_probe(struct platform_ goto err_m2m_mc; } - platform_set_drvdata(pdev, dev); - return 0; err_m2m_mc: From patchwork Mon Oct 24 11:29:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9802 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp554786wru; Mon, 24 Oct 2022 09:58:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Fj98JLkCBq5daLZgfSKwxnKErnARGSTQaq8MOuK9G1seI6QkaKpF7ZibLZLMaQuLKqXME X-Received: by 2002:a17:90b:4d0e:b0:1f7:ae99:4d7f with SMTP id mw14-20020a17090b4d0e00b001f7ae994d7fmr73928107pjb.200.1666630683511; Mon, 24 Oct 2022 09:58:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630683; cv=none; d=google.com; s=arc-20160816; b=xFEPvxRMILFCl2IGWMZt7F3JJWhihNqUF2UzcBP9XteFXzxbe3vEDbwJFUY5+JFVJX 5oZ2vTdtIarkADGB6a+1F6UE/fSQO14eF73raeTAIiVosOMm4VZZSyHeszTP1NDbj1TC yNwZA2nn7gaDU1OEwkeXa6iNe4LlCFvOLRqvrKRYpSwewihtb1Iae3PLSQNMPtBw53fI Q+A3uJcZiGYA18z0NVKXgGyg1EmNgccfBkuD2ctX5c4bxYDlF+7LihmbQ/BBOp9znPEW 3wfGg6lduxtuQO9lGQVPbMoeNCdXelA/lzsd5sPUFKFXi+bRp/fo4Ap5u/m4uJcRTAcj K0Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3paHA/VENjwUE9u8un4N+G/GGDUMDO+3ZdjCK//tX4w=; b=yzFMeo/xWGZg/A8lbYQiO3/gST4qiMY92/BO1C7fuPgVGjw/BJ2t8Xdzn0N/+auBWv IufC+AzMzY/KdBkCmRzueCJT0Ejqh19P47gvoqiRrRhkabHj8JZEtSAnpKAHIWRncjIv qoyH/18mMLdXJG0KpyCGYIXxt1Zr0HWDuMlFoMMrhBtnNgxksddzFbkHPv/YzZu6Dpob f3UC6uWv2ML4XZrrWOkoaKt3V0osn4+rUq7w2SaxQI9JazoQ5BGEc77i5gp4qPOYuElk w7FVkuUmgbxvTHWrPgKLlhN2MuuO9xpzhoJCbQVOFCelooNIlaEf2IspEB2xHlM4q1fV 8pYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EpbIDIpJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090ad3ce00b001f31f339134si8234656pjw.152.2022.10.24.09.57.47; Mon, 24 Oct 2022 09:58: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=EpbIDIpJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232333AbiJXQxk (ORCPT + 99 others); Mon, 24 Oct 2022 12:53:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235374AbiJXQt3 (ORCPT ); Mon, 24 Oct 2022 12:49: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 D7DDADFCA; Mon, 24 Oct 2022 08:32: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 E3FC9B81189; Mon, 24 Oct 2022 12:06:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C1ABC433B5; Mon, 24 Oct 2022 12:06:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613216; bh=sXnZwpG+EnVCgf+pJ+E6fXXKiV+zbor2+tgZXkotU/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EpbIDIpJIUN3mIo4uwzwZpBiquC/qTYwrjgpfEnpriN6h9hVX/w1aKLdbRQi6+Sgt OtijxfePiovuXHdSUzBv0v3rwyAJaPdmMHoPdTZHCzL8YppJBFsV0Tv4bT19Nw+WNv LdZ0Pec9Km/fCnqgtxeOy1Dtc48eX6/wJ1r6VUhw= 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.4 052/255] KVM: x86/emulator: Fix handing of POP SS to correctly set interruptibility Date: Mon, 24 Oct 2022 13:29:22 +0200 Message-Id: <20221024113004.154878047@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747588935318587854?= X-GMAIL-MSGID: =?utf-8?q?1747588935318587854?= 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 @@ -2020,7 +2020,7 @@ static int em_pop_sreg(struct x86_emulat if (rc != X86EMUL_CONTINUE) return rc; - if (ctxt->modrm_reg == VCPU_SREG_SS) + if (seg == VCPU_SREG_SS) ctxt->interruptibility = KVM_X86_SHADOW_INT_MOV_SS; if (ctxt->op_bytes > 2) rsp_increment(ctxt, ctxt->op_bytes - 2); From patchwork Mon Oct 24 11:29: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: 8875 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433224wru; Mon, 24 Oct 2022 05:48:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7rVuLvP61mXbDNK7WFYXzQJcJzKYyzTUcMOkxVqbTuOeO7Z7oQB4PP/MkolKrbODN2rhZ+ X-Received: by 2002:a17:902:d503:b0:185:457a:9325 with SMTP id b3-20020a170902d50300b00185457a9325mr33632408plg.140.1666615732234; Mon, 24 Oct 2022 05:48:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615732; cv=none; d=google.com; s=arc-20160816; b=x67BZUMWdqUrIxR7iKrJleWr3AELoE1C2IKbywGG5MRFwv+9usugnA/+fcu+Fc82CG jdl6nH82haAAqC0sRFemQJcph7Xprl52PoBYtQamFjuJ9+ciiwEffepeZrWSE660bux6 ubVz6SHDkU9261bDOOgnMV+h/eAXKnE6ffg8N4cXXPqTPsaeO/SSbsTc+0qJbPwElzAX x0wga+6kxyy/+RCEdMhJRHk9D9tuJ6JYsN6YluURJJ5uiZetV6vEropzRafCF42Bg+jY 36kBRBZX+/qkFTt3690tJUSnzq6Avmx39YKZ/mb7Ip7JRvSRIzrs9MTxJhLvbQpK1Mpq 20yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Cjv+lgp5MI7aFg0f603nyp/tII/rp6/XXqdoo5/eUBE=; b=aCNQXS4epDaHwW2rdzcAPwg3XxmpzyP/EEdcD/T0npNrTwYyewMdPSiUlIxuWgOM4v jzyCM53DZdZ97JY87eOBlchOKo+XJaDPqfVrGbefl+Rqw8Xq/oxnCrJAGOYZzYTzZqPd oJZVVCIo8WOK0BJJ/D/iIRmCWJH5SiVnuhoKEhbsN+UhS8+pM9fcPZs9Q0hmhPzjHj/D 3E8pUeQ2p8U7AGoGea+jj1nq7U18xTte/TcH4N6cWkPFcO6qVA6r2s301yBuJEI4r3m0 YnqTkbREQlNwLLmyJW64d/1l4pkcQuMaiA3rl08mH+2cgFLIcNX5SjN9Q2Tt1T7FnuUC h0wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YLZQNHOu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hk2-20020a17090b224200b00200435da17asi2303912pjb.128.2022.10.24.05.48.38; Mon, 24 Oct 2022 05: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=YLZQNHOu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234187AbiJXMmJ (ORCPT + 99 others); Mon, 24 Oct 2022 08:42:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234249AbiJXMjV (ORCPT ); Mon, 24 Oct 2022 08:39:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F02778A7CB; Mon, 24 Oct 2022 05:07: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 826DD61218; Mon, 24 Oct 2022 12:07:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97FFCC433D6; Mon, 24 Oct 2022 12:07:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613222; bh=eS/afclanA9Sgmy7PVNXgX/5pYFFrMUi897ywUNNzFg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YLZQNHOuUVTpOg2nXBZalZ8W34oa8VndzFsdlVmmtv0sXK5GBcUJH81NbHoQKrVTo rdzSRVgNzfl13N8w/UaiSRORzpGhiBekg34lZlyWiN9adK68lOuSg7UJWmiiZFqbWq zQXsyReEDgJk/239fG4Hyl6OWW6buHwz/JsEjGvY= 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.4 053/255] KVM: nVMX: Unconditionally purge queued/injected events on nested "exit" Date: Mon, 24 Oct 2022 13:29:23 +0200 Message-Id: <20221024113004.183945639@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573258156608733?= X-GMAIL-MSGID: =?utf-8?q?1747573258156608733?= 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 @@ -3762,14 +3762,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); } /* @@ -4104,6 +4096,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 Mon Oct 24 11:29:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9172 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457989wru; Mon, 24 Oct 2022 06:36:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM53S7MoePAcbTxieBVOb72UqlC2GlbsSXHKXERUJC8chhrWGEQ3pxWkIU/If4WX9GeYCwze X-Received: by 2002:a17:90b:4d8d:b0:20a:ad78:7826 with SMTP id oj13-20020a17090b4d8d00b0020aad787826mr38414943pjb.237.1666618601020; Mon, 24 Oct 2022 06:36:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618601; cv=none; d=google.com; s=arc-20160816; b=dnSAscrcX8Y01Q1ArGKQzAqMfkq8w6QFpJyhge/R5znog8/vffP/am+I+SW0VsQosl j7LHvAx805NISMSbGt7WjhuJjkIB9CrXcmzClQgO10eHf0hl1a+lH5bYDoPj8slMMngt T3Hm00/KcJe0CM5bAxqimmgRw2za+yWVvC8cBQNEo0UC5eNyVqRUL5F42/dDk9I6FpTr pJsrC5OBt+0JbIjKn9B8bEnxw3WrDTQcAdTqchi3PD++xsl0hVaMjtsj9tGmxdeaim95 zu+LAaPRho9ERgoz7q6d5zD0eEaxZ82V9Giru0ztftmSwQXnSTCRmNpixcwulk6hnvEc gOlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Sf/kcHgr7ThBXeL1J3BOw6DMrJB5Dw3cQ+7Zuop0PME=; b=X+i7xMptIiy5QKRTrxuXWrnxWNYbrDMFt6lyzNHggFAvHs+c+5Xw33jJRYAs/MjMaH GpjIBGKRDQT82pxyvfC5QfsnBizM8y8/+vO7z0+pSpNvGx4lbv4PxL895zUR4jFpki++ D9RrADE/9xTW8qRzvpjMjd3xX/cHPU/dGoE/zAiSYH5tjBphvdv/oiTjGJt2GbVeZqvc fxKouqU6QRJR2pEc58qxQ6U3ub2fA/HhNmoyKTOwWq9j9x9c/ceS1FHOKx6p6BaTlGbE Qoj+siquNvMfHY6BmEy2ZfOMPXNDHIqGW1+cJnusNIABMWEfJDK66RNpixTWa5wUL9/z Y6wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F2I2mY67; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f18-20020a63f752000000b0042ad28ace95si36245554pgk.832.2022.10.24.06.36.25; Mon, 24 Oct 2022 06:36: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=F2I2mY67; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235936AbiJXNRu (ORCPT + 99 others); Mon, 24 Oct 2022 09:17:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233613AbiJXNRP (ORCPT ); Mon, 24 Oct 2022 09:17:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDE89A3F6E; Mon, 24 Oct 2022 05:26: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 D7D77B81258; Mon, 24 Oct 2022 12:07:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39BEBC433C1; Mon, 24 Oct 2022 12:07:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613224; bh=D/1C7EpUO8dR4S94f/ncKRR/DAc34QnIqngnR6tn9hs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F2I2mY67Zc4Zw4nzHgOzUa1fClxNfjYzL9WgEOfkcKnQ5T9nsRh6KjYuFPyNG9rWr eZFTFVofwlTqw8HTX2n5OA87xojzyM6Do5hy9nZ+LnVkr8IoZ4/xBHzrwB5uyCKMa6 ab3C97Kg70u9BHseAn8jpkIJrrAVVZ34+RW9hZiQ= 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.4 054/255] KVM: VMX: Drop bits 31:16 when shoving exception error code into VMCS Date: Mon, 24 Oct 2022 13:29:24 +0200 Message-Id: <20221024113004.213318188@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576266642982479?= X-GMAIL-MSGID: =?utf-8?q?1747576266642982479?= 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 @@ -3427,7 +3427,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 @@ -1676,7 +1676,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 Mon Oct 24 11:29:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8904 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433989wru; Mon, 24 Oct 2022 05:51:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7HW7EiAZaxJp4+PD78SUoJkGSwhwyYMTaUyLSH2pI7BCQybMA2HIs3ZK29tc73/MTAA0E0 X-Received: by 2002:a17:907:3da2:b0:78d:45df:b4f with SMTP id he34-20020a1709073da200b0078d45df0b4fmr26809535ejc.651.1666615864575; Mon, 24 Oct 2022 05:51:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615864; cv=none; d=google.com; s=arc-20160816; b=tv7WPBa1QXgPnytxMeyg9CtbI5OtctKyTeH3goQsmUsLVk2wbQczQWq2ASMDmr+6+2 YrBnm79y2AC4nj8G9COrFvmmF/CnzDGzKMaMtvG3LLo3wVfflMGY8TRxjmOsjdufGxpQ /5zDoa1bJKQ5YHrbzoFYrZBZdH09wTEXyID4Sg0EehoomGgR7fPtWh9GrtP/klYTXGPA /cQUJqShidUpmN6uiX1M/ZRdLK+QPUSNiNrasm5S+hy/TMmI/lZMCUWY/j1bjwIWU6gB uLUTQYaDnwR0pnUaMeG7sFJVzO7RdmZlZ83a1ZejGzIZoClrGB3VJqvfP1tcpMSujuW8 Pt+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=/83USHCMB2hdYmRPH12/clGeKyqK4sNW52edn+MhCbo=; b=pFbvJ17t4cnFzFaMItM/oI0Pcu3pvuGoGrxnvTG1UWOhgtK4eaQpQhu/+baj6vWCAT z+pMZ3mhrsAmQ5u7w00ESe29ojVlayT3B2N5Oa3PIJQC66kCP/Zp8fa5IrKjzf5RKEDY G1B/oDyJHqatyTH/YRqYyKhPCaokpj2doCZo+TlzCjsuUwhQJLI0OJ7aN9Iyy0QpegyG A8Vj6UhwmJRWM2G7uMlsgEmEV7sIRoWmRn6lO1rjCQ2+n66aBkab8+VRW/ZFdveVk/mx ibF3eOiS78YjRXYjThL83jhkpYKB4s1P0uBVLVGuFRNIqPXJVTQxpsxpFkM0FzC/43Nb PANg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fNPn1cCL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du18-20020a17090772d200b007835897050esi8869309ejc.404.2022.10.24.05.50.37; Mon, 24 Oct 2022 05:51: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=fNPn1cCL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234835AbiJXMtc (ORCPT + 99 others); Mon, 24 Oct 2022 08:49:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234476AbiJXMo4 (ORCPT ); Mon, 24 Oct 2022 08:44: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 E731F201BD; Mon, 24 Oct 2022 05:09: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 92A51612BE; Mon, 24 Oct 2022 12:08:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2FCFC433D6; Mon, 24 Oct 2022 12:08:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613327; bh=QHolA/OG9b0aq0+4xFDwS22hchZVMgKudTulwkkkeH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fNPn1cCLK7QzJz0Jp2xpnjUj/S1v4vvYFl6nU8YEI1t7Q8Y4yc1cNRH5m2vCXDRCo iZD5Dl2t35TNbeqUeTKMkUD0fEtt4yyGn9rgosRAipk0qQIRQHpwmFSs6l8tOLF3IM +a5SWCZRmxLAysntQEz8gL6ud5Y38piwnBssJ6EY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Liska , Peter Oberparleiter , Andrew Morton Subject: [PATCH 5.4 055/255] gcov: support GCC 12.1 and newer compilers Date: Mon, 24 Oct 2022 13:29:25 +0200 Message-Id: <20221024113004.332068147@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573397054692783?= X-GMAIL-MSGID: =?utf-8?q?1747573397054692783?= From: Martin Liska commit 977ef30a7d888eeb52fb6908f99080f33e5309a8 upstream. Starting with GCC 12.1, the created .gcda format can't be read by gcov tool. There are 2 significant changes to the .gcda file format that need to be supported: a) [gcov: Use system IO buffering] (23eb66d1d46a34cb28c4acbdf8a1deb80a7c5a05) changed that all sizes in the format are in bytes and not in words (4B) b) [gcov: make profile merging smarter] (72e0c742bd01f8e7e6dcca64042b9ad7e75979de) add a new checksum to the file header. Tested with GCC 7.5, 10.4, 12.2 and the current master. Link: https://lkml.kernel.org/r/624bda92-f307-30e9-9aaa-8cc678b2dfb2@suse.cz Signed-off-by: Martin Liska Tested-by: Peter Oberparleiter Reviewed-by: Peter Oberparleiter Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- kernel/gcov/gcc_4_7.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) --- a/kernel/gcov/gcc_4_7.c +++ b/kernel/gcov/gcc_4_7.c @@ -33,6 +33,13 @@ #define GCOV_TAG_FUNCTION_LENGTH 3 +/* Since GCC 12.1 sizes are in BYTES and not in WORDS (4B). */ +#if (__GNUC__ >= 12) +#define GCOV_UNIT_SIZE 4 +#else +#define GCOV_UNIT_SIZE 1 +#endif + static struct gcov_info *gcov_info_head; /** @@ -451,12 +458,18 @@ static size_t convert_to_gcda(char *buff pos += store_gcov_u32(buffer, pos, info->version); pos += store_gcov_u32(buffer, pos, info->stamp); +#if (__GNUC__ >= 12) + /* Use zero as checksum of the compilation unit. */ + pos += store_gcov_u32(buffer, pos, 0); +#endif + for (fi_idx = 0; fi_idx < info->n_functions; fi_idx++) { fi_ptr = info->functions[fi_idx]; /* Function record. */ pos += store_gcov_u32(buffer, pos, GCOV_TAG_FUNCTION); - pos += store_gcov_u32(buffer, pos, GCOV_TAG_FUNCTION_LENGTH); + pos += store_gcov_u32(buffer, pos, + GCOV_TAG_FUNCTION_LENGTH * GCOV_UNIT_SIZE); pos += store_gcov_u32(buffer, pos, fi_ptr->ident); pos += store_gcov_u32(buffer, pos, fi_ptr->lineno_checksum); pos += store_gcov_u32(buffer, pos, fi_ptr->cfg_checksum); @@ -470,7 +483,8 @@ static size_t convert_to_gcda(char *buff /* Counter record. */ pos += store_gcov_u32(buffer, pos, GCOV_TAG_FOR_COUNTER(ct_idx)); - pos += store_gcov_u32(buffer, pos, ci_ptr->num * 2); + pos += store_gcov_u32(buffer, pos, + ci_ptr->num * 2 * GCOV_UNIT_SIZE); for (cv_idx = 0; cv_idx < ci_ptr->num; cv_idx++) { pos += store_gcov_u64(buffer, pos, From patchwork Mon Oct 24 11:29:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8890 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433650wru; Mon, 24 Oct 2022 05:50:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4qvHMO7TFM8lpVkEqjlrLx7fqC3IhOG+r2XU5kT2oBJYMU3ih8AUW4w50CwMK6UvFcrG16 X-Received: by 2002:a17:907:7294:b0:7a9:8a22:74d4 with SMTP id dt20-20020a170907729400b007a98a2274d4mr2614582ejc.139.1666615806536; Mon, 24 Oct 2022 05:50:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615806; cv=none; d=google.com; s=arc-20160816; b=j4bw7fQjVpD6OABclgg+RcgyTVQBI2tMj8XLdwlVssMIRB/+3+TvN6BYj7W3Qo3g+M SNEDXIpLhYGc3j8acJs/Zhj0K7TSpaNJ9DIACt5iMh7Xk6ww/z2Tfrvv1j4QL1PUqyxp AJ/pkpqm0di0pHbAGShN8SJGkeEEg76qceS8yZiaOS1dvva7R+6YasFDWaG4FPUiL2lU scsLepKYqVXqB1YlXBs4F/c80hRkPr4EryRWOeIYkSHPQjyUY4WybN0tjClD773K1Mkc qz37c1u622/dgjRJblToYMqz+Vfa4441s71105HLFqK8FkCV3JZd3rzeYsbLbZ+nP9Qf j3oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=o32l6BKZYdLZ6S5J+7PckgRhd7KCOB8Wm+23asHvIRg=; b=ggNCMe01tBf20K4YJuwz2ilRl229LO551klOO3dGRSecDZzgGE0Hqjq8HBPuXpCuU8 YUh1Ia4a+QDdbE+B23DD4g8JukMmMXUnLUzPEOkpv9Av/+NwaqdaQsI6gC0flSGm8QtX vCcik8X+5hyOSDB4kGvuboi6QjluEIdY2ktao63qE8P19zl3utCcJ6rCNjjXW2eKuLiz rMin+smlyDbDhzrCNa9HWHT7kfFrxCY/wDowahObsBlbUwxRj64JkESg3s1dGqWmrXCw aTce7fNkFif11+j8J2vGNkdqALdK0iGsr0x4uekGMuMgXsDZAXtdDN4NtHvdvzckSE24 Bdaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=r3RrXqRP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hb6-20020a170907160600b0078dcee0cf13si31207456ejc.561.2022.10.24.05.49.40; Mon, 24 Oct 2022 05:50:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=r3RrXqRP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234220AbiJXMsD (ORCPT + 99 others); Mon, 24 Oct 2022 08:48:03 -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 S231810AbiJXMnL (ORCPT ); Mon, 24 Oct 2022 08:43:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 656907F0AC; Mon, 24 Oct 2022 05:09: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 179CC6128E; Mon, 24 Oct 2022 12:07:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A6C1C433D7; Mon, 24 Oct 2022 12:07:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613245; bh=yT4I2SIf6prmOQ5TA2r4Sm95rU2zqmrlMEcsNxaDwgM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r3RrXqRPzlxM9pdJHzgbzcDs3K1eK22R6nWAREfmOF/nrQxoBbYsuqGwdNfGNI7LO UFKqKTH3te7j57yDYZcwALeke/hPFsi1XfUa4tjea0yo1CMiklguYb1JMCiFRaX/ZX cF8tWkebIImraliiPEEyKitYB0p5cKogUggNac7s= 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.4 056/255] drm/nouveau: fix a use-after-free in nouveau_gem_prime_import_sg_table() Date: Mon, 24 Oct 2022 13:29:26 +0200 Message-Id: <20221024113004.362252810@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573336408433707?= X-GMAIL-MSGID: =?utf-8?q?1747573336408433707?= 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 @@ -90,7 +90,6 @@ struct drm_gem_object *nouveau_gem_prime ret = nouveau_bo_init(nvbo, size, align, flags, sg, robj); if (ret) { - nouveau_bo_ref(NULL, &nvbo); obj = ERR_PTR(ret); goto unlock; } From patchwork Mon Oct 24 11:29:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8899 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433883wru; Mon, 24 Oct 2022 05:50:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM464kVZrWj4x9enga6JdQ2f0WGp+n2Vs0x9a/GfJldCSVqhgSQghL+ElT0H93zp/kSEwpsh X-Received: by 2002:a17:902:f54f:b0:186:a987:c733 with SMTP id h15-20020a170902f54f00b00186a987c733mr5050172plf.170.1666615847934; Mon, 24 Oct 2022 05:50:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615847; cv=none; d=google.com; s=arc-20160816; b=mCzZ2ImucfdvQpWN/ch7T60hNLfD+wItapxhuIeMAXpPk1AMif90+YGrCe8UnPwtV1 NdGd4e12gSmI//wG3rMvTf9vvPcn2HcNNUngcrOyIXkJ6ujDTIbFc0+VSD6Zb6FK0UfH 99A/MkAZ59kRlYjtdzWB5RXfMeOHPXOZNOudljzwnPX0pi04ce2mNuSxixgZ0WjDmD8x sUYjw+668phxqwIWruiXFUrAf+RLHN2fx9mrYLVpJncNh+G39yjDCAu8uCJSUjA8z13r uozsCmAJ8U0QIsmCFC1IbKbX+yzYChfRjVXHqkK8obf/FTY0hZWlOYGK7TvtTnkMu17c 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=YCRKJCfcbu79sBq4qIZn4FIjwAspe2hJvwsrrGU6Z2c=; b=jnWMuPCU8uyySHP+6DHeVtIoNznpwKg+AuAtiDd88jIAF9t1Q1usyXcNh+q75zAJDO T29Oa9zRl+3diKQjPWTd+tTaeOJx8vMNvEoGF2yDvOH8SS7PMgzdUgJnwVSS0AbN4x1R 0h4QQ+excmBV4ZuT36h9ZAN+19FGCt4XMuN17U82M/k7rKUqklU8sUYoM/KvykJ33fyn Jw0O4/5UGcgQqx0v1/FU9ZBdH/wesKA3L/66uTyQYc82oR8kwR5c2iGnypDY0ClfvZOw R81+KJrAMVN9hk6sKVThawZNskQZj+bnlt+4CgC1e53sXQRo+Mx2+QK61J33BPb8gt13 xecQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D+fkqKfq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ot1-20020a17090b3b4100b00200acd39846si21043656pjb.63.2022.10.24.05.50.32; Mon, 24 Oct 2022 05: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=D+fkqKfq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234753AbiJXMtZ (ORCPT + 99 others); Mon, 24 Oct 2022 08:49:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234453AbiJXMox (ORCPT ); Mon, 24 Oct 2022 08:44:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 588F426E9; Mon, 24 Oct 2022 05: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 CED84612BC; Mon, 24 Oct 2022 12:07:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDCB3C433C1; Mon, 24 Oct 2022 12:07:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613274; bh=QOgwnGXtJ5WnEebGLcaB/JmKLZooNWI4me6Yyig3MGY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D+fkqKfqeBTuIiYaO419A0VL/7ptoBjCeEN3b/zaZAMaPZmkk1yca6C7ixzqLsUXX L0Dtd8BqKCkjBqkjMoF0MQMniyv+8infDquMkezVaCSMInY+vXgg1y86lFqSOsIYSm bq3llWmkc13DukUpBwAEPDk3HHtxZZPDXGmWlIRc= 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.4 057/255] selinux: use "grep -E" instead of "egrep" Date: Mon, 24 Oct 2022 13:29:27 +0200 Message-Id: <20221024113004.394129391@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573378865164241?= X-GMAIL-MSGID: =?utf-8?q?1747573378865164241?= 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 Mon Oct 24 11:29:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9096 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp448622wru; Mon, 24 Oct 2022 06:18:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5/yY2Amq0hdwmMVZGXdjtYRRqybLhUcpPxxx7B8VaiMi1YQM0SMIhLwZozm0i6TLg7cE6x X-Received: by 2002:a05:6402:7c6:b0:461:aca1:97cd with SMTP id u6-20020a05640207c600b00461aca197cdmr6767897edy.95.1666617494224; Mon, 24 Oct 2022 06:18:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617494; cv=none; d=google.com; s=arc-20160816; b=uL9FEWpIMjd8VnPvR5ZpDm3QQhUbSzlCNZ6MpgOzeBKXJmY1iWqYYg0C/DdhM+DLwV UWmhqKBGIJkycega0045sgZfyvgrh8Rwx2HDnVSJ82oAKJ2m9Z5hVP6EK8Wst9iNHO65 KGNIO0WUHG49zTcsCc1YkatacW1J+qYx8/f3PrHSztaUqHiEAN/i8UBpJRWuwpjgldou orKo8s7iqsimmYhOFWwpb86xgOEsG9pswiH2Pv5kr38zj9on/alGwzTDo69p32Yla0NJ toor/G5RjpK738XMT3Kt9BRlLcLw4N35DPpa2OkzbBEaSWFlt8WDn+9kYnH07oS/GbjT c/rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YCe8jNC0eteNGzLiVIdA3OfbOvSQLQ6QfnbwWVuOKWU=; b=soD79xQw/mbdU054eHwn0BMJ8gcEERq9bGkizWZcIJiOtsiGsE8VoS/EDWbKkFM31N erebd72u6NCSfllTl3CkiD7kCG2kLvU8t+N9mJQsnhyhSPBJZU7tYloCvGZJU8r71404 nRsUCLuIBT0AFtPRI7+qJvtQHcfWdliOVbssNHvO5957d/2UrZdn17kvHRic7Jo0IinC BokQDg8ZvL+XEmr+sOLh2jBQY7Xf/cjfjuvSmnLpZao0kV9yWzmcmychspU5ImsCcLIU J70ndhC7J6YA57ybJKrLVLrndpTMcgfP+Bm1kyYUP5Jss4SQvoHEVPHgnakCNRNvIERE YDHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o5U1Q4RG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056402139500b00448d387c327si24108740edv.181.2022.10.24.06.17.48; Mon, 24 Oct 2022 06:18: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=o5U1Q4RG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235616AbiJXNNX (ORCPT + 99 others); Mon, 24 Oct 2022 09:13:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235392AbiJXNKi (ORCPT ); Mon, 24 Oct 2022 09:10:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0BFA55AF; Mon, 24 Oct 2022 05:24: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 84901B8128A; Mon, 24 Oct 2022 12:08:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D805DC433D6; Mon, 24 Oct 2022 12:08:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613303; bh=UyuZpJtDdBlAMBxwjO1LoIr8P8/jB/CSrlcYvn14KoE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o5U1Q4RG7gldGGmgXQC+Siln4PCbkNau40FYisjghvZsu4KqvwwRZyowdDbjiwkV5 ih61cxqNCwmwhvFFKtq99Xql5oRRzodbc/JsYPL/WNCcyhDFNB/PU3MsOGSAnCFaWh UQ/R4BE8Sa8FdxC91AJIzrPhBwRRSvRAKVAeOu6U= 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.4 058/255] tracing: Disable interrupt or preemption before acquiring arch_spinlock_t Date: Mon, 24 Oct 2022 13:29:28 +0200 Message-Id: <20221024113004.424681161@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747575105705876180?= X-GMAIL-MSGID: =?utf-8?q?1747575105705876180?= 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 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -1015,12 +1015,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; } @@ -1156,9 +1158,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); @@ -1185,6 +1189,7 @@ int tracing_snapshot_cond_disable(struct { int ret = 0; + local_irq_disable(); arch_spin_lock(&tr->max_lock); if (!tr->cond_snapshot) @@ -1195,6 +1200,7 @@ int tracing_snapshot_cond_disable(struct } arch_spin_unlock(&tr->max_lock); + local_irq_enable(); return ret; } @@ -1951,6 +1957,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]; @@ -2163,6 +2174,9 @@ 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. */ if (!arch_spin_trylock(&trace_cmdline_lock)) return 0; @@ -5199,9 +5213,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); } @@ -5226,10 +5242,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; @@ -5684,10 +5702,12 @@ static int tracing_set_tracer(struct tra #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; } @@ -6767,10 +6787,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 Mon Oct 24 11:29:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10289 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp653799wru; Mon, 24 Oct 2022 14:10:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Gf1cw0qe9xYEWmOGjA4xe2QkYfJqTB3IbqtddKWGsomgWuEDmpXOMnfCJe8FQbvD8i16I X-Received: by 2002:aa7:c054:0:b0:453:98c6:f6c4 with SMTP id k20-20020aa7c054000000b0045398c6f6c4mr32270259edo.2.1666645852356; Mon, 24 Oct 2022 14:10:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666645852; cv=none; d=google.com; s=arc-20160816; b=mXcY/e9wm7uZq8GPuxyRs0zgV8DbFiWT6T2O2GzDhaZZvQHcGvg61tcF724sSNwm2y l7H8nYGuAEMplL87t5gidlAlXK5zwTh2YBoebbor+RI7eJ2uzigkvJj7kD7pM5CdnS8d iEzyIuZd+BoJP56/B5JdjpUBFL95WD79TqeDZ63/n6PC85YAT6FOXI5CqKaPTV1EDc4Q UvSCDVxGVbU8EgTJORwIwzGNsP7MxeGCKAXz7qVXLHaOYWI49AGqw5LYAcy2SfyWgKiR E1ZJIqc3cxoBwzBSMH42BHZE99WGinljXpEcoNQdWGuRb1H3U0Wen+kjR7rHHSJJECc9 rFBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rJmBh40SEDwJpH1DSpVMvM9IWkv3BnOzNOKX+4LnlJ8=; b=zW95AZ0EbVt/yqVNmYjyCvt+r49BkI2syqCv0Oa+5AJKsEY65azyAdrDqVymga46uC lV2QhCBDw/oMpJdMOqt7rJGrCQt0203pJAVI2hmr5B+2vllkfekxfuruenXNNArzUFJZ qXz091SOXRQinKXs+5FSFmQpdKwlDGzsbenRYWawq6PYKUyawE64gQX4OWYUa5D42gyV G0+/NuwWQ8Ouw/G8PauVFMTsdF4q/lg132cA7rAyyfTDMwSkEpfTXoqzGlnBjtMlaWAQ is5BhBHUOcF3DlE7AWkJV4gzuuWJOtP4ib9z7WBkL9GFX/mA6BJk1Gk1BvFRY6OQsvkJ J+Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rFs6R6hF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bn3-20020a170906c0c300b0078306c5c48asi705788ejb.250.2022.10.24.14.10.26; Mon, 24 Oct 2022 14:10: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=rFs6R6hF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234135AbiJXU4V (ORCPT + 99 others); Mon, 24 Oct 2022 16:56:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232571AbiJXU4C (ORCPT ); Mon, 24 Oct 2022 16:56:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E600F2413CA; Mon, 24 Oct 2022 12: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 759A5B81330; Mon, 24 Oct 2022 12:08:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4BB6C433D7; Mon, 24 Oct 2022 12:08:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613311; bh=QOy3cjI1C0pLjk5Kou9W52sE41We3XgJT9GQSvfzZZ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rFs6R6hFdr54lQ59ZL1Q+Pex0r8aByLmHA1QoHbklt4VdzvTjEhL/cJlkEHV51qgA EJAIlCtmCGpJ+D3MsWr+vt5TJhKdVETKIiZlMdnOqX1Rm8K5tiVXSlLCMGCjWUyh6n +RP1YsfK6al72p4i56IDZQ3JJZaiIXWYx0fPISkU= 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.4 059/255] userfaultfd: open userfaultfds with O_RDONLY Date: Mon, 24 Oct 2022 13:29:29 +0200 Message-Id: <20221024113004.455015344@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747604841423790476?= X-GMAIL-MSGID: =?utf-8?q?1747604841423790476?= 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 ec57bbb6bb05..740853465356 100644 --- a/fs/userfaultfd.c +++ b/fs/userfaultfd.c @@ -1018,7 +1018,7 @@ static int resolve_userfault_fork(struct userfaultfd_ctx *ctx, int fd; fd = anon_inode_getfd("[userfaultfd]", &userfaultfd_fops, new, - O_RDWR | (new->flags & UFFD_SHARED_FCNTL_FLAGS)); + O_RDONLY | (new->flags & UFFD_SHARED_FCNTL_FLAGS)); if (fd < 0) return fd; @@ -1969,7 +1969,7 @@ SYSCALL_DEFINE1(userfaultfd, int, flags) mmgrab(ctx->mm); fd = anon_inode_getfd("[userfaultfd]", &userfaultfd_fops, ctx, - O_RDWR | (flags & UFFD_SHARED_FCNTL_FLAGS)); + O_RDONLY | (flags & UFFD_SHARED_FCNTL_FLAGS)); if (fd < 0) { mmdrop(ctx->mm); kmem_cache_free(userfaultfd_ctx_cachep, ctx); From patchwork Mon Oct 24 11:29:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8906 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434112wru; Mon, 24 Oct 2022 05:51:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7JJnJKhrgwkYhLCpt2iULGyChUpXCN28jPO7IKmTMZrIj5OqUJkgca829kfg/SFZ41KQSB X-Received: by 2002:a63:6942:0:b0:41c:9261:54fd with SMTP id e63-20020a636942000000b0041c926154fdmr28842970pgc.34.1666615886131; Mon, 24 Oct 2022 05:51:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615886; cv=none; d=google.com; s=arc-20160816; b=mYjs+JmrMhG1Y2XRUbWqjQUR1RcBrlUnNLUEvgf1YohSzIDeKnCViBhU7cVpwGFP70 TqFQbCRbYHEuPygd+OkNeASykMi2RJ50tWCS//YSeaMdAnYCwczgRnC0PW32hGGbzGa/ +P3HhlXJ8xJCHoMxAdQ504tMH2WlVCvIfYZgedGPfaP6w6ytDZn8i/2SI77lS6T1+khk tr/mGLX7ErDZnCYHIn+SH582mjf6m68VZ7mnRSS5biERh1K3p3GRpY03RvunkMndqfK6 TrYWj6MsQdqajY7EfASZ9vFlWkemgQc2W2UxfMJ6cH/FRhv+KXjtnprLlxAJC7FmMvwy qDKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/yn1BOOtCq44xb3t12KEGR0KPKfwNHsiBRV78UrAKjc=; b=nJwBIqiTjQDE0/ASUhzoeDjHIIaB8fIlyozCxyu8POVZNmazlP9rWz0NWbA3h3wot7 unSOsJA7bk0Zlkuau23d1KmrwTysvNr1TWokrqUJOPz+n73XKNwXCEy5o+tpjmqcdrwS oZKHOnWh5XhTo9r/mQb+txaygwggtFZ+fw49g7XhKsX5jFiHS4T5Yi7uGfqdojCQ9ihI fzueuE3JoqA/czuYEhM9ZkazRfrCfoidq0Z7eHQQLMnkB8uzk/iO94EqAylGaMy5R3Sl 2P5DnSfH39z/VCl222P3iNHBnbjAXNhFWuadwodfBwbsrB5Z6ybJcj5kSdDcLQhkKnac Yt7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=K6jGO3bi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i7-20020aa796e7000000b00557c8a20395si32551574pfq.120.2022.10.24.05.51.07; Mon, 24 Oct 2022 05:51: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=K6jGO3bi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232139AbiJXMtq (ORCPT + 99 others); Mon, 24 Oct 2022 08:49:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234537AbiJXMpC (ORCPT ); Mon, 24 Oct 2022 08:45: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 7E82A65F5; Mon, 24 Oct 2022 05:09: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 59DB5612FE; Mon, 24 Oct 2022 12:08:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67F45C433C1; Mon, 24 Oct 2022 12:08:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613313; bh=7kquWWJa6dl+O7F/u2jmTd2EKZ7sY3//BZHI9nmrGcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K6jGO3bilaSt5Ho6eKE8YD3PczIU5EYz3I87NZhzHKtDaSqX6k24o5Ju6ZJrtCcAV mGEwllAiOySYHdoFEJlOgUprD/7nC5YRw2Yxc+qqAFaWKFDbeTMH2I4iAL230Cy8GM 64C9Ej5zybqMVupYSNNm3hMfTXCeSbtCGLpaJpAg= 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.4 060/255] sh: machvec: Use char[] for section boundaries Date: Mon, 24 Oct 2022 13:29:30 +0200 Message-Id: <20221024113004.494467418@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573419112527836?= X-GMAIL-MSGID: =?utf-8?q?1747573419112527836?= 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 beadbbdb4486..3e0a4306f1d5 100644 --- a/arch/sh/kernel/machvec.c +++ b/arch/sh/kernel/machvec.c @@ -19,8 +19,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) @@ -86,8 +86,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 @@ -101,7 +101,7 @@ void __init sh_mv_setup(void) * vector (usually the only one) from .machvec.init. */ if (machvec_size >= sizeof(struct sh_machine_vector)) - sh_mv = *(struct sh_machine_vector *)&__machvec_start; + sh_mv = *(struct sh_machine_vector *)__machvec_start; } printk(KERN_NOTICE "Booting machvec: %s\n", get_system_type()); From patchwork Mon Oct 24 11:29: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: 9196 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458904wru; Mon, 24 Oct 2022 06:38:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ShrCeb59nZ4/1e8V3skZIqLMsAUZ4a5cxon9ICMUcMv/S7OK9YU+yQR/fnCOupEpNrfVS X-Received: by 2002:a05:6402:35d1:b0:45d:3661:567e with SMTP id z17-20020a05640235d100b0045d3661567emr31444133edc.343.1666618710071; Mon, 24 Oct 2022 06:38:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618710; cv=none; d=google.com; s=arc-20160816; b=SeuktflB3OYWeOddtx7Q/RSur5aEHStqrtqMVNg/MedlkUWkSosgmG7K7h7IXUA/7p tu2F4REnqoKTLeoZ4i6CkYoBjBpYo+9DEC9CkMQQCCTzfSYDAuYO/JFvJqCi3YPPJvla mENtLMpjMJ/IR9L0FWZGV9s+V4UwqLODxWJ/Kfqn9dF3GzXwBsbrLKpP4AfOS0TzI9FR lFi5Vr9L/RNx8UVmZbtn/Qzo3BIsitSuJwsd4ps+I9jPlen2PXxdFUV8GPyuZxNtm3Te QFIqfl8SwmEhch3nanymJj+2ABwpj16grCLpkGIjrsMwOVLmp5oJpPKfRLW++mB0eoYG ZNew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BXsn2ZLA9PcwxRQNv2v6gjqsLT0z8PXWQLClY5wE75I=; b=yNK+do5/O0mxdrcHNOb8S6nBxfnuT7X48LNax4ex4Lrek8oYYpjlBHUYyPCKXyVgv0 FThXXt8FuNE7VL+LFes6YBvCYeIeLI8/CMfhGqgl18dIf1N6wEo7cvk1G29dNHlDNuPn gXOb1jH/AhbgKJqF0maK+wkpJ94a4DtAaahb83urRfBZIrX+TcNYXJTKDffvYX1hlk+p voVsD+nwqs5OK21D+v3geQGkhklSklTGq1PFRIGLkljdYlTPgnIPENfR2HM6NtEdpNJ1 eW/pbxeEzdbzvzovrGPEND1WtmXUtYHIFbgf6x16Q6GQCqH0+nHrC/7HIkhvUb3BGQUt viFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="r+gL/QiF"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v12-20020a056402348c00b004619cbd9055si5947900edc.366.2022.10.24.06.37.48; Mon, 24 Oct 2022 06:38: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="r+gL/QiF"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232893AbiJXNXP (ORCPT + 99 others); Mon, 24 Oct 2022 09:23:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233097AbiJXNWK (ORCPT ); Mon, 24 Oct 2022 09: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 32D3A2D1F3; Mon, 24 Oct 2022 05:29: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 AB765B81331; Mon, 24 Oct 2022 12:08:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BB2BC433D6; Mon, 24 Oct 2022 12:08:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613316; bh=y839G3eWhqbFg+CH70M0j3cZIXcSKYZtss7cD99g68g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r+gL/QiFhnEa0b16YIqf+yT5+u8scvHb4hrp17GJrm+Gjunb+P/upyJQH2FvQ8Jtf 603K9FGwVgtKMusU8Cf6luTQlaDoRFYPOe7rTfxQ9x0MQQkQQM9qjeaTtideIpnlbN SeSEPNy9c4jm08u2j33VFRZJ3AvVJVpOF33NBmXk= 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.4 061/255] ARM: 9247/1: mm: set readonly for MT_MEMORY_RO with ARM_LPAE Date: Mon, 24 Oct 2022 13:29:31 +0200 Message-Id: <20221024113004.533977981@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576380792714307?= X-GMAIL-MSGID: =?utf-8?q?1747576380792714307?= 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 463cbb0631be..5becec790379 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -320,7 +320,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 Mon Oct 24 11:29:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8930 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434800wru; Mon, 24 Oct 2022 05:53:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5/VfRNQ4kasbyAJ1Uc3osSE7o6l7tyaIsVdVvpUVsS+QiRgpdBcNAq8C1FVdtRhv0UvjlS X-Received: by 2002:a17:906:5d04:b0:722:f46c:b891 with SMTP id g4-20020a1709065d0400b00722f46cb891mr27199765ejt.4.1666615969935; Mon, 24 Oct 2022 05:52:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615969; cv=none; d=google.com; s=arc-20160816; b=0cDrHrbDtjuUiU9Izo2ZhQYapGkBLg6vVRv4vMjLzPPiV4BvNBfTigEz9NH1eXuTfy dEGcgDBP7IBkdDlNpB+Jd9WGhb3UGh4W1SHqNjdqvSF8WVKe8q8QIANAhoXrMhUy6YlY aIkAw0Bv1F9RWNFyrAd9DbpUV7IlaeMH8Th6EAq+Rrvy4VIvrlqlID4H20bz/j9h1/fe NRZDe4GKrdBCwfCmvdaP1N+TA90f8TIlvj6LE58d63O6ZHceOim18VTd51HO+qGe4O42 4OalSlvbFcJyoymczkY/7HEgA8KLWR+ii0O9+KGFkmqoT3ls+HfghgrDb3vy/FR6t9Bi HS5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=V7mOAfbKi8Oqp9UbcnpPxdve997h5q3HBoWYuX4ZO3M=; b=hv0pmd1/Np0s1WcJlwgPTh+MldhTnrXhgXa/CsvJX5u1ktVNigZA4gCVYPEHrL3DTl V7lyqXSTA3lBwqGH39xXyJD9HMR/3ONdP+UpCr/fCJzZwH7qPRxsEzv8MfHqFH71p/kP 0n1nQRHsWk+ONR9X79HVPJCp5ievVdYIzWenrP2kxLZVUcbWq7mf0HiYpHzPxyh1pwGp jzAzDUFKctJNzy1BcqbjBvgRMno6mlrGqAcOOEgUT52QL0JZdM5WNWWwM7nG0fc+jZld CRv8rjbtYlddwW0z3qV/K+005m4EEo3JdxzPxNNRXqybOdbVluf2C7mQzJuSnt67taJK yr+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="lQvg/zAq"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t8-20020a056402524800b00461f0d84ee1si674544edd.228.2022.10.24.05.52.25; Mon, 24 Oct 2022 05:52: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="lQvg/zAq"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234192AbiJXMt6 (ORCPT + 99 others); Mon, 24 Oct 2022 08:49:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234574AbiJXMpI (ORCPT ); Mon, 24 Oct 2022 08:45: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 2504A18B3F; Mon, 24 Oct 2022 05:09: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 8E32061280; Mon, 24 Oct 2022 12:08:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A026BC433D6; Mon, 24 Oct 2022 12:08:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613319; bh=f5/ry2w4/EIE/Rvgacwxb1aOJVW3QyhE+7Q0rNa4NA4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lQvg/zAqOna8+ABd2AeW/3rjf6CsKXJpHtPVUypMK87vd4WD7wlxwEH071NNOFCco JvuLP5sdDdF/C84R1nXuLlfiBTHj0L5tyxd7LyaLcNDoYzm3IbiBEZNkg67505CKoh cuYcfyAERM6QeuMgFLfTJmMIFpNk1+V2JGTRPmOo= 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.4 062/255] nfsd: Fix a memory leak in an error handling path Date: Mon, 24 Oct 2022 13:29:32 +0200 Message-Id: <20221024113004.576442802@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573507422467794?= X-GMAIL-MSGID: =?utf-8?q?1747573507422467794?= 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 7d408957ed62..14463e107918 100644 --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c @@ -825,8 +825,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 Mon Oct 24 11:29:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8921 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434510wru; Mon, 24 Oct 2022 05:52:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4rbdzPGk12qEqhUlDN/wNMI6JolcWg5flNAkNlaP32jNp3OZik48ZPGVd9mp6zKNYA26VZ X-Received: by 2002:a05:6402:51c6:b0:45d:50ef:1142 with SMTP id r6-20020a05640251c600b0045d50ef1142mr31107805edd.259.1666615943056; Mon, 24 Oct 2022 05:52:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615943; cv=none; d=google.com; s=arc-20160816; b=ZZ18UnlfX7mnDIQX4vYUbjPediOKX9GlxgQIhxJSPGHtk0W17hZ7+ScNYlUCv+usmc yVrnFUIaKiuNSUkE3RIzk+Lpgyt7SIw2lCLeCA07rY/+XLna26jqheu0LqoxWULeD5Mw vIaZLoJtvTgHVa0NFFFj3lchaEG/Jt99ucJlkLRGCDXfk7BLof49P5eSmVsw2etKmnMh 7THUEbXBFsdmHuZtsIOEBa2LeaeDSqLy7puWDdPukroLqP8M7iauIcw5y4BQTxuYlJNv dzw1LDAIJ+MKr/G3LdX+2r8Ii+IRY6rJH90cjtouFuJeYpPz+AVLwHcpW/ERZdoG3YWM 1vYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uuPk36XraSyrbRqLv6kJRVqQqFgeZDhYzXc7JyxzanQ=; b=itM7XtNejVZXaypKdpl8yzcSYvq+OQqHCFMD+38D23RPjwuill0m2j9O0VZMxiMZzl d76MdHVxaR2cBxF5HBRBmRAU4nn3ELkeaZ5I2xmaqopIbJ3NKT51jN8BoHIIg4A1oCCN Qi2sXp8cgJU9EdOkvKpmvdjrq9KyXhAPt9Zx8DSEiUsyJZ1m4EK+zImfyxTCTDqn14Mt yhZp9YxQUnVucBl0qutHdE6//4zrCBgF8xQJ1KqpTn7ZV/fTI+vWq6rE1hHqMtYbKUiI iZFmOcKsH7xrmRsRxz5KD/wATxC01elnurqeUbitTMwFTWO02QoceXCozu4G0hh2SkZD ZEIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0BicGWG1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d11-20020a170906370b00b007818378f560si21314184ejc.383.2022.10.24.05.51.57; Mon, 24 Oct 2022 05: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=0BicGWG1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234400AbiJXMu5 (ORCPT + 99 others); Mon, 24 Oct 2022 08:50:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234651AbiJXMpZ (ORCPT ); Mon, 24 Oct 2022 08:45:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C47DE1F9D8; Mon, 24 Oct 2022 05:09: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 3EB9D612A5; Mon, 24 Oct 2022 12:08:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56BFEC433D6; Mon, 24 Oct 2022 12:08:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613321; bh=VbgFAkKPQ74r2BRvLQBffF1wNqmTcOBZKaAjbrVPDk4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0BicGWG1rSUdeirVi2kKf48hmegJkBAGNtj0U+WXYq+eHKm3fiiBa0IefRO4FiKgT JqaDIuFQsolEC7L2X8GGt9Qk4xo7GtTrJHmIgwyt8vZoyUvNkmJkwgPXI9fRPbmXQ/ zrzQjweR3Da8RfsgZs87zkZcA3wBxztCdBudoKqI= 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.4 063/255] wifi: ath10k: add peer map clean up for peer delete in ath10k_sta_state() Date: Mon, 24 Oct 2022 13:29:33 +0200 Message-Id: <20221024113004.620989958@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573478830144580?= X-GMAIL-MSGID: =?utf-8?q?1747573478830144580?= 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 3026eb54a7f2..afa3cc92fc2a 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -856,11 +856,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); @@ -872,25 +897,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); } @@ -6641,10 +6648,7 @@ static int ath10k_sta_state(struct ieee80211_hw *hw, /* Clean up the peer object as well since we * must have failed to do this above. */ - list_del(&peer->list); - ar->peer_map[i] = NULL; - kfree(peer); - ar->num_peers--; + ath10k_peer_map_cleanup(ar, peer); } } spin_unlock_bh(&ar->data_lock); From patchwork Mon Oct 24 11:29: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: 9769 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp551179wru; Mon, 24 Oct 2022 09:48:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6iU5YOPQsFWyxl6EtogXj7r+CFL0s8u6NrKGZITt7Hzi7wx91qD1lRphh7h+7spCYHK6U+ X-Received: by 2002:a17:907:701:b0:780:2c44:e4dd with SMTP id xb1-20020a170907070100b007802c44e4ddmr29239017ejb.589.1666630081214; Mon, 24 Oct 2022 09:48:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630081; cv=none; d=google.com; s=arc-20160816; b=I/ci0O/8agCl1ZLH+PE1xN5ib+5K4+XJ6ZjARP6CPieVv058tyhwSRVWQ1uz04c1QC NlYIc/RDky3V95h903ys2/GXrL4lmC3ISAj1MGBZIwkb05gwenxzIx00Umg51EigBTcM B5ekIMAl4/hoWeHsTHpLQv8WgJkUScDkNwSsrdoIlCQZYh3P6aPuYkBE+/+HxzXvx9k7 6y2saAf3mVm2cp0crp4tka7M3j7M5tHkeK5MRB1dLWi9Dd7qDBeUKdgfIIfqZx05RbML WO/Nq4Fb72fVkdEc8W1ZlTGRXVm7wF0dnvoxNNcxZPE0auJUodwGplYbzTE6P+sgoNSd dNbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oRK/mxgbRT/P333akUHFL/j+sMpKLiB/JenJxEuDy6A=; b=PwHZ2s9z48zrY0JTmGGPpFg6BzqQOwVEjPiY3+Tmiq8UtQKA4E7GzY7xGPkkTMpIm/ Ht1Ail8g37hEWtVFjUDDNa/UfZ2TQWKufGu8+OYL0Hw1lh6gZvIj6lW8iJtQC/CtV11y 7IXWD2uqfFgQU/RMFic/j5VjMkO1BoI5sDDht9Rm6Isu1IrFoYf9lHHm8MManOalSiUu BgUpjRJCUCmNIJcl8owBcpMECt6ccuOCDMRZyZEUiujjlQ1rn4+UZJOe0i4RdIX+luf7 fLRAKOtdRHzdPJxgdjsnoL1GKR8sVtMTncO8UZOtS3U+BFYodeitALzhlV/uRTDjlCdI E0Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EXgGN5c9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170906660c00b007919dbd3770si184373ejp.485.2022.10.24.09.47.36; Mon, 24 Oct 2022 09: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=EXgGN5c9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234771AbiJXQqI (ORCPT + 99 others); Mon, 24 Oct 2022 12:46:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234766AbiJXQos (ORCPT ); Mon, 24 Oct 2022 12:44: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 DC31C1413A5; Mon, 24 Oct 2022 08:30: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 9D2FFB8125D; Mon, 24 Oct 2022 12:08:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0330AC433D6; Mon, 24 Oct 2022 12:08:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613324; bh=4VCSDqSlPZ+rCOtkOPxYpWeaHXHCLuVtW976ejNpcr8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EXgGN5c9Iqyf74GPNxIKVmAuBOjsl9AUuZuoGqrGCtmBDKkfe/Sj1tZr+FBSeJIiP Bg7YxK3NlVNBXFEBkjbUvbVPc1oNI7K4O7yFth2j6ypIid3NBpZHic2E9ebeunVr+M I8/kIFIsmDtL9ADXqHwRb5NFX6wKh96B5xXI9bF0= 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.4 064/255] wifi: mac80211: allow bw change during channel switch in mesh Date: Mon, 24 Oct 2022 13:29:34 +0200 Message-Id: <20221024113004.669115686@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747588304157797046?= X-GMAIL-MSGID: =?utf-8?q?1747588304157797046?= 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 16f37fd0ac0e..9e3bff5aaf8b 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -3280,9 +3280,6 @@ static int ieee80211_set_csa_beacon(struct ieee80211_sub_if_data *sdata, case NL80211_IFTYPE_MESH_POINT: { struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - if (params->chandef.width != sdata->vif.bss_conf.chandef.width) - return -EINVAL; - /* changes into another band are not supported */ if (sdata->vif.bss_conf.chandef.chan->band != params->chandef.chan->band) From patchwork Mon Oct 24 11:29: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: 8897 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433866wru; Mon, 24 Oct 2022 05:50:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6H1FSOZg//ayrpN0PYHcNA1S6raEKnNth4gZTCwU1WC5swY314Ie68IuHFVvEGW++a34AR X-Received: by 2002:a05:6402:190f:b0:461:bd53:27c4 with SMTP id e15-20020a056402190f00b00461bd5327c4mr5405195edz.75.1666615843470; Mon, 24 Oct 2022 05:50:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615843; cv=none; d=google.com; s=arc-20160816; b=lw+2y/rhYyp+zcHACNe1t0SemaB3z/eY9vqeVRx2iwsZ/wyZ71BIiaQ81xbbVAlkhz Ksn+u+ksBHnHrWLcBYRCgO6y+c+ecqedIuFrl4qBuoXw1D1Vlm6BEO5TffGeKCjeL5Y3 fkkzG0aLqL72B5T00Gw7tJ43xRSEDL2QnNOxm/QK2zz11R63xowsMwOLNfh05+z4Gy/j j/1bl4V/hK2pM3O5qNgS9dK3u1QmjcdhBEb4hRAcoLsvUT7wrpk4l+Rdy71FhdR0HvY+ +iWyFsA4lZtmHVpEuU9yTGgJEUVpbPYkDAhGVViwKWcGM9qgwznSw8xYReaJWUnfWCi5 HUfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eCMu2uidSaa5fyIIHrq/0Av7b/6mZEMPhUwKvWpgsbw=; b=sL5w5gxC8xE4fi+rm60/ztx8gn7DsCQ59eaWz4X1N8CXxkKLM9P4MZKXPlwfKegX2i 1svu+n7p2ICQ+3WjZWGra0ncOzm1yDrZ2ewGS9IwevxFh5wO9NomesZ7vTcZDDjqdj4J Z5orLCgaghZxpLwvaS0D3U+XnCxD7urpqF/f7zIFpMjbQb1EatyfGi7I+kRBlwLqiK9d 1R362HCZ8CsqUhQWQN8C33Mu+hJchNZVFbZiBK76B01eZfI01FFwPFFMolv840SIBbYl 8qr/Zq4vKiQUiwsdrMGEfu4iprBS0z4i0hHQXAEM2/gVu83t86QT663BKFxhfQeYZiuP egug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=whPg1C6H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a05640211cb00b0045f802c0b98si17599037edw.443.2022.10.24.05.50.17; Mon, 24 Oct 2022 05:50:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=whPg1C6H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234155AbiJXMsj (ORCPT + 99 others); Mon, 24 Oct 2022 08:48:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234338AbiJXMoX (ORCPT ); Mon, 24 Oct 2022 08:44:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4412721B1; Mon, 24 Oct 2022 05: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 AF1D0612D2; Mon, 24 Oct 2022 12:07:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3B2CC433C1; Mon, 24 Oct 2022 12:07:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613248; bh=9vtvKDeSqBdPU8YAR9Q9YNhvZJPLYD1863BGmsYTrgA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=whPg1C6HsWyn3yATueTs6JdLFIW7k1B+V65ptzgagM69v0TqKwKiEBZqd9pENSPVY rLHepw/fF3tYcnpV8+KXWTflzXpo9xZgDy2dS1ZNFbozzx3tZ+WvpnfOE+EmYDgqL6 qP/Lj5PefWAZPj284VorMComT4gPAocUr5SA/J1E= 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.4 065/255] bpftool: Fix a wrong type cast in btf_dumper_int Date: Mon, 24 Oct 2022 13:29:35 +0200 Message-Id: <20221024113004.698380237@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573374776671739?= X-GMAIL-MSGID: =?utf-8?q?1747573374776671739?= 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 397e5716ab6d..ebb73e447310 100644 --- a/tools/bpf/bpftool/btf_dumper.c +++ b/tools/bpf/bpftool/btf_dumper.c @@ -251,7 +251,7 @@ static int btf_dumper_int(const struct btf_type *t, __u8 bit_offset, *(char *)data); break; case BTF_INT_BOOL: - jsonw_bool(jw, *(int *)data); + jsonw_bool(jw, *(bool *)data); break; default: /* shouldn't happen */ From patchwork Mon Oct 24 11:29: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: 8893 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433663wru; Mon, 24 Oct 2022 05:50:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7z6/843deFaDHJvAlp/2xsUpAney7A0+E0tzxsS0DWM8T3eH8oE7GQGZxiJnIeu2AiW+pj X-Received: by 2002:a17:906:ee8e:b0:730:3646:d178 with SMTP id wt14-20020a170906ee8e00b007303646d178mr27816245ejb.426.1666615808250; Mon, 24 Oct 2022 05:50:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615808; cv=none; d=google.com; s=arc-20160816; b=vS/s1tV2lSVwAFEWJa1HyUesT07nOWTRTOpKcXmWbiYMxMR0KJd/PGHMH81MKUbwaW 5Rv2FBW+7GLYiAfnNkOll+V3V9Si11NFyKaAJ+/h7Yn6oA9ukkURM1i4nYbjYDY4gQ7E ESb+HKDhRpbJm+caLtJKODcD008WuTRqyXs6Jlo7evUF2FAYJqH3jnuwzek/8u47H6l7 KnUjrybQSWnANYbGWhc4ntjYQuEZbUhIo2gqf/K0rh297E9jH4QSezcGEGmTqfZ5c2JU U4IVhTgm5+8NJVAG/Grz7yTPRZoGZxgA9+5edYd88O9x1zfHvr24vvXFHJxH6xdWnWN1 B7RQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6qXShBkQR/sdeyTetqRlPN34tTQwoqnJc6/BXAh8htg=; b=BU9bjVApU2PwM+qA2VbqeDPctVbUc5x9EHRg4kxm41XfYWkElNX6J1ZQEwuC/PGATb J1RJJga2CdmBAL3jpSAkYyqHJFB1+ZwGjGCCiVQhFAt5lMELHsJMZNMJ0XRw9DtQnljk 3InP54wikfGo0YkD3SKS7WXrNe5O/xByCuXX+Tb2E2BKuCmPf/CJHO4UHQSTSZQku+VY CNzOWpvECYMVWxqqRxWZ5eE2QfdYn/WqCEI24/qjHfnD4wFVvf18Akz+rrlYZeoh4Gu/ bMo3vm41Fdbe3BlnAg41/cDh1VCCTJDy3Evue0j+B2yHyWmJQw/ZxAC75g07ZlbXJlX7 kp0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ljJQZ6j2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020aa7dcc4000000b00460faf7d2a3si10351331edu.277.2022.10.24.05.49.43; Mon, 24 Oct 2022 05:50: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=ljJQZ6j2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234334AbiJXMsU (ORCPT + 99 others); Mon, 24 Oct 2022 08:48:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234278AbiJXMoH (ORCPT ); Mon, 24 Oct 2022 08:44: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 DFBF07F09D; Mon, 24 Oct 2022 05:09: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 5BD0561254; Mon, 24 Oct 2022 12:07:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B51BC433D6; Mon, 24 Oct 2022 12:07:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613250; bh=21dVou3Gq/a7ZoG5zTXIAiKD76PN9yjqnKjHTj+BF0w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ljJQZ6j2p09MeHnI3gk/2tAdZ3Cw9hoQA2QR8QMjKoy2fRZ2fsEHfMDfg30+z+BQe IpFTNxm4B7x6Blmigq4JFXkRAGO4E0pvER5PGXLeGOq1LlgzJaul6+7BKuQtcMBe1Z LS/23Byrp7MoY5awucCTHJrZUIVTLhqFtLFt0J4Q= 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.4 066/255] x86/resctrl: Fix to restore to original value when re-enabling hardware prefetch register Date: Mon, 24 Oct 2022 13:29:36 +0200 Message-Id: <20221024113004.726777183@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573337613209091?= X-GMAIL-MSGID: =?utf-8?q?1747573337613209091?= 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 d7623e1b927d..f186470c2e66 100644 --- a/arch/x86/kernel/cpu/resctrl/pseudo_lock.c +++ b/arch/x86/kernel/cpu/resctrl/pseudo_lock.c @@ -416,6 +416,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 @@ -459,6 +460,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); @@ -510,7 +512,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; @@ -867,6 +869,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; @@ -875,6 +878,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); /* @@ -891,7 +895,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); @@ -936,6 +940,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; @@ -969,6 +974,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 */ @@ -1027,7 +1033,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 Mon Oct 24 11:29:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8894 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433712wru; Mon, 24 Oct 2022 05:50:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4EHpEig7NiAaY4yClCW0d0e8mnRKVyd/zC4Qh+d6puZi+nruJGxklxE0R/iAp6VXqQWfuF X-Received: by 2002:a05:6402:501b:b0:459:df91:983 with SMTP id p27-20020a056402501b00b00459df910983mr29242275eda.85.1666615818330; Mon, 24 Oct 2022 05:50:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615818; cv=none; d=google.com; s=arc-20160816; b=lLDavvUUntj59p4JTzSqpzHnQc7v7qQZ84FrV7u1Bh66dA7RTTkyxkbRLx8yeh5c/g 1PvVr5Innk/AksM/K8OuTt3ngZWSXgzcmzU5mlGs4eZu/bBjR0U+fzqLxKLu0IBJ6O9S Md1WNsrAICh7C5wZ+tMo9gEWzg+iaeThbuPKi0o7CGipH1ZqkUScjHv4ba1RCaDOP+6E RE3Y+2lyboXhOJerLKly+fFBy74ggqeKGZiOkFCyOAL5QQrHIHNkLt7V0HJFUE1iWHIm 1g6nrIU7NOLqzu0aY95IzvDV+qzSGzzpsryjdIoe/B/nndwlo1oaJfSSF/wWy6PmESxt gpDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Zbbun71Pyk0d+oTzUB3NJlC9O072ak/GoGNeVfVObkk=; b=alJICmMkwkHwpTI2kCqkj8dWfwwjjVdAUs7KudRm0sYp+aJhUJB7NlIiYMsmJDPi2O Td4BlIGiraEr7gPBnS40nk9h3FJVslNP8zNYbrCpLGg5sIPpbxzd6uRHJifq1q9mmb3S JIodV1ZdlKq9i/A85Os/azp7Bn/1G2JHpnwSkwwkS74sy55vM8QWx/hqmyxu7X/UsIpY A1x7xRrPRYpKXEaGmFfVHT90Y1pSbc0olGBX3Dg4BOa9c/9BwFjxNa4wmuts0t277P0D 7DTNm4/yG3acqJwnTq7M/3zcCeZ9sijzCg0HXFzQ7HnVVzNB6+It7GDwv0gP6DNSVkZl azLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=V7Qd57Yj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170906135700b007470b52f94esi22985998ejb.199.2022.10.24.05.49.53; Mon, 24 Oct 2022 05: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=V7Qd57Yj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234401AbiJXMsb (ORCPT + 99 others); Mon, 24 Oct 2022 08:48:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234292AbiJXMoJ (ORCPT ); Mon, 24 Oct 2022 08:44: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 DC1627F08A; Mon, 24 Oct 2022 05:09:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EF4A161218; Mon, 24 Oct 2022 12:07:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BBF4C433D7; Mon, 24 Oct 2022 12:07:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613253; bh=uIdIsyZkWCtELS/sAPgIrAEP1Cyh+NKa0k0yNsrSR3Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V7Qd57YjhQ3v1K0CK+SaX8TYibZ2vZ1LMzJvEpa/Wl47mkap8s3Fnj87j+tUUs24+ plBSGaguouIT87B3bSsHnfPlwuxAmR42sliHmNleUF09McbF/4OQRbOe55i7cTR5WN M4KD4BDnIA5W5bYqlDuCwPWcFN64mimTgIlWt4Vg= 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.4 067/255] wifi: rtl8xxxu: tighten bounds checking in rtl8xxxu_read_efuse() Date: Mon, 24 Oct 2022 13:29:37 +0200 Message-Id: <20221024113004.757211325@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573348661799891?= X-GMAIL-MSGID: =?utf-8?q?1747573348661799891?= 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 048984ca81fd..3062103e216a 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -1875,13 +1875,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)) { @@ -1892,6 +1885,13 @@ static int rtl8xxxu_read_efuse(struct rtl8xxxu_priv *priv) ret = rtl8xxxu_read_efuse8(priv, efuse_addr++, &val8); if (ret) goto exit; + if (map_addr >= EFUSE_MAP_LEN - 1) { + dev_warn(dev, "%s: Illegal map_addr (%04x), " + "efuse corrupt!\n", + __func__, map_addr); + ret = -EINVAL; + goto exit; + } priv->efuse_wifi.raw[map_addr++] = val8; ret = rtl8xxxu_read_efuse8(priv, efuse_addr++, &val8); From patchwork Mon Oct 24 11:29: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: 10381 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp696078wru; Mon, 24 Oct 2022 16:10:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7RDzCrvDmMzdIUh/niYidccA8/0sq271NPkuqnosc9045aWcC348PttyW+750FyNl5Blkj X-Received: by 2002:a05:6402:2804:b0:439:83c2:8be2 with SMTP id h4-20020a056402280400b0043983c28be2mr33424353ede.292.1666653036793; Mon, 24 Oct 2022 16:10:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666653036; cv=none; d=google.com; s=arc-20160816; b=EQAEB5X5ZhhdoWAGnJ83zc0uZESqwMtakFepkOI2sTL2mH0mI+rOV5IYWIKClYbJe7 R5PzSm4l1YFJA3XtRBUJQzQLtyqP/E1weVs7B1OtVzhAiU6Zql1H3Z2t1NTKoEC5gG9l ymMW4+z8PmwvEx/xVKFndAPrAFZodITO8MWPs3CseGLVML6ovRfyefpVydkTFCZsuACI C6Et6JS9nAhqh/I/qYG06KbCwgbLOmln8Mt6ORfziFOhpAI5j2MtTNmqgP8jf13Srqc0 WQXJJn0tPcHg6HGQBH/+0PCzWBigTniB0owaZW6TexaJtCEHwJzQrmmXQYp+mCMqM9G5 6ySg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=H7DiPTsLpKEEMi/2n3jAo5j9AghPQ8J1jWI64+LLQQc=; b=feHEM2hGK5lSOafs5Txjr1vEBmWekA0P6TxHEqqqmiKubClTxBhP06CHoD8qezBBI6 05AOgReSTuKEOFh06sNy0EVHORuSyxToHTGiQV1Q7ydrQCNgQigxMYGYJ3AsP4j0loyA ain2qZgQId7u3DydMiLceKDOwKVMAr6BUC+R6/mgn8Mv1Z14m+L9NsGDScsBhuhZRC2B nEOkxGmzydtrK60MqYDfsKz7CnsGtQgfi/skY4ukiiczDFIKoOE3ZB1/l0LDsB+XJMCZ z6PtXDGRRp2lDbKWUOVMBbZ/HH90JhpUDSYUH81E2/GBZI3zLEMyghszP8a9w6fknJGy IzhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LrBVr8sF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i4-20020a50fc04000000b00456b734ceebsi892929edr.436.2022.10.24.16.10.12; Mon, 24 Oct 2022 16:10: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=LrBVr8sF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232173AbiJXWzu (ORCPT + 99 others); Mon, 24 Oct 2022 18:55:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231440AbiJXWzQ (ORCPT ); Mon, 24 Oct 2022 18:55: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 691104150B; Mon, 24 Oct 2022 14:16:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 51A3CB81210; Mon, 24 Oct 2022 12:07:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8B2CC433C1; Mon, 24 Oct 2022 12:07:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613256; bh=448XI5nFKO3xYfv7nmwZvLPYd7LKGy/pR4tYG6xDquA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LrBVr8sF8TDVopNpiua2wSOaPaG7jOVaNMCfCkmOLb5qB+3IIruYeRSYFRg1TofiL Vz4Vq6xt+sLQ4LvVicCc1wpjR9D+1efO3YTeEPDr6AE/sy23G9fUxdxcXmGwQho8CI COoaDcDp/FJ3w/odWA7r/pD/NTxrDWw5qpL7tPjM= 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.4 068/255] spi: qup: add missing clk_disable_unprepare on error in spi_qup_resume() Date: Mon, 24 Oct 2022 13:29:38 +0200 Message-Id: <20221024113004.787516127@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747612374850617428?= X-GMAIL-MSGID: =?utf-8?q?1747612374850617428?= 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 d1dfb52008b4..6da49705a10a 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c @@ -1246,14 +1246,25 @@ static int spi_qup_resume(struct device *device) return ret; ret = clk_prepare_enable(controller->cclk); - if (ret) + if (ret) { + clk_disable_unprepare(controller->iclk); return ret; + } ret = spi_qup_set_state(controller, QUP_STATE_RESET); if (ret) - return ret; + goto disable_clk; + + ret = spi_master_resume(master); + if (ret) + goto disable_clk; - return spi_master_resume(master); + return 0; + +disable_clk: + clk_disable_unprepare(controller->cclk); + clk_disable_unprepare(controller->iclk); + return ret; } #endif /* CONFIG_PM_SLEEP */ From patchwork Mon Oct 24 11:29: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: 9008 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp440602wru; Mon, 24 Oct 2022 06:04:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM50DIVam6sGgxiFaZAjqhJpoLQbJZMpEZhQKfeyR9OjDPVLdVJZlrCHKKlQ4JwZhFtnWSTD X-Received: by 2002:a17:90b:1d0e:b0:20d:a61f:84b1 with SMTP id on14-20020a17090b1d0e00b0020da61f84b1mr65344051pjb.172.1666616671759; Mon, 24 Oct 2022 06:04:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616671; cv=none; d=google.com; s=arc-20160816; b=PMMm75gO1Zb7Pt3kTNGn9iv4smy5L31eyLbzRVbhCwnbi83nSL5cqDDhGZqvaiFmBc Nh2ugQx/GjT4YuvIwZtA+4Ttxxce0zCpxT8h2d49kQYyDmb7xOXsFGpdVtZYtVbna4DH zhS4i3pdFQgUOu54LfTg3ZlfoamQqfcUrGWM6BccYBsNLAU4/k3thuTzmKd2LHHFKJGK nI/RLT3tkAce0kOW/dIXFRRMTILzHF46PWguyncFl6UC6iaj0cypzv03pr9MetsUBkbp CPH1hLORDsO4X2bkeA85T91ql6Nlmwg0sWkhC5nrtrSwGD9LnXkwEL4mYI82vd8Gwgfu a4qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=I2a6497Yat8D57tcmSRLnI5CdPkfXXWQX3Fa35zmacs=; b=XR/f0OAHEP1G6KSyQL/cM66DZZwsn04OjjdmMxBaEeHJwn8KjOCgzUusmk/2xpWoyG JR67JJcSkG3ATCorRoPSksB052ABYLGp2SM8/AdLeAhyj92eq66ICHJsIBVIDvRjF9lh ExuUis5DssY39MqIzdQYXe0PS8zj0827iyvgcLAjyzv9b4Upjf/w69q1SMEYSQcUHaE/ 2yVrcocKFEwKEQyqMFL5cL6MKhKuDrIuyz2XVDSKYCHW+WPK58Lk7nbg4sgNioAURH+a gQk2Q+h6IOeWGvriwuCa6OZDr+xPbZKu3Cf7sfKfON4VfUCOwU5wwy/i7566ZCDvHKZq ZUxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QvMXN0Zi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a63064c000000b0041b86985526si28298950pgg.189.2022.10.24.06.03.51; Mon, 24 Oct 2022 06:04: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=QvMXN0Zi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232261AbiJXNDZ (ORCPT + 99 others); Mon, 24 Oct 2022 09:03:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235258AbiJXM7q (ORCPT ); Mon, 24 Oct 2022 08:59: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 F05A48274E; Mon, 24 Oct 2022 05: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 dfw.source.kernel.org (Postfix) with ESMTPS id 42D46612E7; Mon, 24 Oct 2022 12:07:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5347AC433C1; Mon, 24 Oct 2022 12:07:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613258; bh=xk1T27BF9PaH7xxK/iE4NlW4zOBlJKTpUnWvV3WYC5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QvMXN0ZiLp5lySt3PAC/4qoalIqqd2iStlx2ac/bGve5xdLgYH6VdCEMiC1GEh4n5 xBnfhvOTqj3axIa59yEbb76LXFyalkHjZWRvp9mDVto0BpY17czZ7mxaW7zopG2T9m 7og3V6j6iCK5s2a5vjN8K8owjuCwzJqbDKMeN9ck= 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.4 069/255] spi: qup: add missing clk_disable_unprepare on error in spi_qup_pm_resume_runtime() Date: Mon, 24 Oct 2022 13:29:39 +0200 Message-Id: <20221024113004.816616499@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574243618234974?= X-GMAIL-MSGID: =?utf-8?q?1747574243618234974?= 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 6da49705a10a..ead6c211047d 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c @@ -1199,8 +1199,10 @@ static int spi_qup_pm_resume_runtime(struct device *device) return ret; ret = clk_prepare_enable(controller->cclk); - if (ret) + if (ret) { + clk_disable_unprepare(controller->iclk); return ret; + } /* Disable clocks auto gaiting */ config = readl_relaxed(controller->base + QUP_CONFIG); From patchwork Mon Oct 24 11:29: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: 10225 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp642882wru; Mon, 24 Oct 2022 13:39:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7S0H9mLY3JQ8MfBWGvIld4esOGoO/TD8Mlo59LMKnjZGsP5cBXn0zp4r7pe56tSkdvAQZi X-Received: by 2002:a17:90a:29e4:b0:20a:f9d5:c10e with SMTP id h91-20020a17090a29e400b0020af9d5c10emr77479687pjd.132.1666643992597; Mon, 24 Oct 2022 13:39:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643992; cv=none; d=google.com; s=arc-20160816; b=xwa+ReKMkouAp6PUa5uj+Z5C6jttg4vS2/QZRT1b92NMyu+jCKxRN9pNvLlmULOAu7 +zVnfNbcMUJo49ByLGt6+9fR4YOuBwFO/eX1AzxJn6icS/XQp9+JIJtVKNbdV30t0fyF efXSBIzsfo3AR6mwh5kfA3AVIy+RuzTpUORXvyuc1MGcBwTQT9zjXDAJv6pPE5U2vFHg z7Pyxkw82MGguJ9ZBZh2kjOgIrEExVhc1b9VH0CFXLKHpozisWaduyZwoaWzf/wVkJ08 m920KxLZkTOSr+XyfJyoboJvex9j0FBwctDQnnVbsVfL0oqyU/unFj/jMNVGs3TQf0Lb FekA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FkD88N9klqxKXsAY9SBtglKOqSdzVSbWa7tDOlZmx2E=; b=RNc4p/lkH18omwyGY21Y/Z3G5uCFqKzlIJn6X8pzTHaahAxBZCCLavymhC8PXj9HyV uVecj7u1ST2Ms3c9WMrKa9AmcphmwYrItaJ17yxuBOXoU+obYd9Aw3gOv4ZOTWbEzYT3 iXYScj1NcYA/MBNlgzAPSeGjsNU8xGljVLFnelk8Au2+5rvg7rSbCP8QsCtC23PsGv7J Zft8B9T5vviS9ZiHcR4ZCWLJXQrmqVbgGBhSAskZn4J4Y3gaC56dmUCwUG3yHc3FI8CG bKhamUUIxdsOnynme1FjSzUKmkf06cr2/Varud08Wo+XSCuMaDmAXtIs2WL8iHTagT3O wPkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yLtn1MMj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p3-20020a170902e74300b00176a87603dbsi559104plf.156.2022.10.24.13.39.38; Mon, 24 Oct 2022 13:39: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=yLtn1MMj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234379AbiJXUi2 (ORCPT + 99 others); Mon, 24 Oct 2022 16:38:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234328AbiJXUhy (ORCPT ); Mon, 24 Oct 2022 16:37:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92FB79258D; Mon, 24 Oct 2022 11: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 909E0B81257; Mon, 24 Oct 2022 12:07:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8C6FC433C1; Mon, 24 Oct 2022 12:07:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613261; bh=4kuhib7yZhV84x31Vuyv9TsHCqSc7etGBr9ReZnR+PA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yLtn1MMjOOP/0L2Y6V+FWfdodmCpr2gy+m2IdHxo63ZdK5ZwHneLt/wOb3J6vcJNn 8qvkiJkQaFZJDthMC570JfTV29cIpd/TC+5nIrQAqON7AWf/UKmfkhUWojp+8Jjy7b WNb1jgdOebM6muBCxflzRoI9aGOTt0PIr4+WiW6E= 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.4 070/255] wifi: rtl8xxxu: Fix skb misuse in TX queue selection Date: Mon, 24 Oct 2022 13:29:40 +0200 Message-Id: <20221024113004.845254874@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602891362387896?= X-GMAIL-MSGID: =?utf-8?q?1747602891362387896?= 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 3062103e216a..977ebb647c0e 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -4950,6 +4950,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); @@ -4962,7 +4964,6 @@ static void rtl8xxxu_tx(struct ieee80211_hw *hw, is_broadcast_ether_addr(ieee80211_get_DA(hdr))) tx_desc->txdw0 |= TXDESC_BROADMULTICAST; - queue = rtl8xxxu_queue_select(hw, skb); tx_desc->txdw1 = cpu_to_le32(queue << TXDESC_QUEUE_SHIFT); if (tx_info->control.hw_key) { From patchwork Mon Oct 24 11:29: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: 8910 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434235wru; Mon, 24 Oct 2022 05:51:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4STKXNuXfwb2InZnfP99fwj3m9BY2qoqDaM9jUuW3C9+VdbTrbY7AU+RWbNmbdi3VyPjMl X-Received: by 2002:a17:907:8a1c:b0:78d:ef44:7759 with SMTP id sc28-20020a1709078a1c00b0078def447759mr28149257ejc.441.1666615904542; Mon, 24 Oct 2022 05:51:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615904; cv=none; d=google.com; s=arc-20160816; b=I34orKPgLVTYIAIpMz9r4wvlf7jhIcalhKiEXn3ek5IkzsvouQ456uU9iOxOuomk8E QpOvRBBe1wT+xFqn6fDYHIayPfVNYLlK2vvdN+Zd+xDUjhkdylPbDW+lk81IEOOXBg88 20IbilEZxRdwUZko3+5hxWNKi2Qjj5lVM/Y5lVVr5IPc+H3j4OeJovcXV52v1fBINGPx 4HIWViOrQAtRsExeLStFfRjtrBwMjt+zxFT/yyePfNdu8oBCGNIvqOgocxFaOpmYHy6N w2WLbwZFJjymwbFQs42KPjBnRoqzO5y+xHgUazb9uMTKaPp/ylqV87XVx7OKPM3r6Rdb Wp9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=I95kczr1i3O50JqL7+kQwkJ7u+HXg7tyjRo8o1JwSVc=; b=jaj1FN/JwDtUavLVIKeNmE0e1BZZFWhv+9AImlgzk92jHQa78NggZn8KI8xjLloiQf IIFbJ9s4ajYFTZNxee249FUkoTAzSX2fE4C+4VQM1Ltgl+OgqDWgpMJBK1kwFX964o/N 9DoE1ySFtCFBnJw1Vk3K49athsgv0ZfSQfLtip6WVG6Nw5gGiUwbMlYL6yDtN5pod5TB FGYyyFNeS2xpegEC1v4kpEMze4t0KPxYWbsyaU5Yg4j7bTJrVN+DBQj5Sq/W5Up+pqad r3esPKMcfeIOhQ83dYtu+9X84xdoGXWZwRSrdIlIs/NxerS4g1edL8AOx3u59iEB5U0d WIOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="DZto/Zzt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xd5-20020a170907078500b007a9fc5516f6si1371840ejb.307.2022.10.24.05.51.12; Mon, 24 Oct 2022 05:51: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="DZto/Zzt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234277AbiJXMuE (ORCPT + 99 others); Mon, 24 Oct 2022 08:50:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234587AbiJXMpL (ORCPT ); Mon, 24 Oct 2022 08:45: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 BF82127919; Mon, 24 Oct 2022 05:09: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 6EDA1612F3; Mon, 24 Oct 2022 12:07:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 815FBC433D6; Mon, 24 Oct 2022 12:07:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613263; bh=hURhAdwU43oF0/Pvc6MdAAwY52fvgvgudcuyGiMZYj0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DZto/ZztecsvSDsOyb0dDn2aiqz6/YybrN2IhF8XB39nRpyQcKwiCWgitB8kMICe6 FYpsPxh9MrGsp4XiHz/c8WGA5lpcwc2G7PTlXUYLr53Q030h1pUeECh7qbT6TcImYJ +gdOsCrPqLDjqH1KnojjCnY5fZVRji/vuS67AwsM= 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.4 071/255] bpf: btf: fix truncated last_member_type_id in btf_struct_resolve Date: Mon, 24 Oct 2022 13:29:41 +0200 Message-Id: <20221024113004.874478085@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573438726394925?= X-GMAIL-MSGID: =?utf-8?q?1747573438726394925?= 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 b03087f110eb..a28bbec8c59f 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -2148,7 +2148,7 @@ static int btf_struct_resolve(struct btf_verifier_env *env, if (v->next_member) { const struct btf_type *last_member_type; const struct btf_member *last_member; - u16 last_member_type_id; + u32 last_member_type_id; last_member = btf_type_member(v->t) + v->next_member - 1; last_member_type_id = last_member->type; From patchwork Mon Oct 24 11:29: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: 8902 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433949wru; Mon, 24 Oct 2022 05:50:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7titgYSZoPAIOTz+vdd/CA0mI/xsQNUTCho3wPM1i9ZIRkpUr2QaB89KylXhTTvicak67J X-Received: by 2002:a05:6402:e87:b0:456:c93c:5361 with SMTP id h7-20020a0564020e8700b00456c93c5361mr29829233eda.88.1666615857581; Mon, 24 Oct 2022 05:50:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615857; cv=none; d=google.com; s=arc-20160816; b=ygFbUg72FUms/devfyNORAlau6YqQOBk7+/xzTCoEhSMrEl2eAIrlQpUJ2Ff24YlGs RUjJEZdfBf5P3wKv/84VS4hhEpaEh3N5BQ42LY44vVYid6UJnK6qwOx1ts0C3c4kjh1h EYfrb6je+SY75exwDzFuPCcbuq8eKVTYYtuDf5fuUpsC40gwAAf+6Gqz8QBw6SVdirFC 2ZXSg1J12SrRRUKJE1xPbHD6dRPp/Nzt8yVj+SQv2RxF3y+OUL36yKb4Rvpeur4Mot68 HSKCmvSb63P0HsEHyKtoxyyrCoqU0qaJJgGiTSukarJPDjRpLiDaYla5hcRhxu1H++hu NJmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cAAvUSqZ+Bmx/V9PQbFkICxUMdOHINiHXyVaEInYbAY=; b=AoKkAZzS9mhJCOEljZYp2EQAEuNCa/SmOA7Y+4kC6mSaKleS7b4vW9l2O7WwzN1CVI Y/ZumBCc35rlU+DSBkl7wmRkY0gAXlJSDZW+zUSGNLN3isk4JCsm2zE7V0oCRPYoVeo1 bL0fChVypMVWJVZXFHDMn/mS8p+UgtOkfSVYvc59BA+jPhO2u+/rRmQ4GwmFQNIMNZ2H ucH4YDMf2JLblr+QRAaT77JnIDv4r4dh3vw4iCj/3il44LvwR55OitdKG6R/NJpoGH4F NGgy9pTHBJKt7FizTo1Q8NKZ6aAX6nBXFNDCQ97OQ6DGpkmnnDRgtp20Zt5smRQ6eWjc v0vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iui385KT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170906eecd00b0078db6f5f499si31464444ejb.796.2022.10.24.05.50.31; Mon, 24 Oct 2022 05:50: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=iui385KT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234491AbiJXMs6 (ORCPT + 99 others); Mon, 24 Oct 2022 08:48:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234392AbiJXMon (ORCPT ); Mon, 24 Oct 2022 08:44:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25EDDB5E; Mon, 24 Oct 2022 05:09: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 098DB612D6; Mon, 24 Oct 2022 12:07:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17C6CC43470; Mon, 24 Oct 2022 12:07:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613266; bh=PBbgQzVY69vYoEKwRWh1226dyBvyaJBWcFSUeNNxKVE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iui385KTGhPmi7NsE4QtaIvVOZoh2l71d8G8tyRFhu0b7IsEiYwd1xEAboEOnjyoh 79U4FQiHb1wuLRJMxg/P99N+WI5sw2p7qtvuOldHBrhHxRcZhUtmUL08h/UlPiwpVs 4afDzYEL1RYS/dllQ8LFzFzsENbF0ky0lYOhyxL0= 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.4 072/255] wifi: rtl8xxxu: gen2: Fix mistake in path B IQ calibration Date: Mon, 24 Oct 2022 13:29:42 +0200 Message-Id: <20221024113004.904664709@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573389375625170?= X-GMAIL-MSGID: =?utf-8?q?1747573389375625170?= 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 977ebb647c0e..b472dc4c551e 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -2926,12 +2926,12 @@ bool rtl8xxxu_gen2_simularity_compare(struct rtl8xxxu_priv *priv, } if (!(simubitmap & 0x30) && priv->tx_paths > 1) { - /* path B RX OK */ + /* path B TX OK */ for (i = 4; i < 6; i++) result[3][i] = result[c1][i]; } - if (!(simubitmap & 0x30) && priv->tx_paths > 1) { + if (!(simubitmap & 0xc0) && priv->tx_paths > 1) { /* path B RX OK */ for (i = 6; i < 8; i++) result[3][i] = result[c1][i]; From patchwork Mon Oct 24 11: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: 8900 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433918wru; Mon, 24 Oct 2022 05:50:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7iYTVEGYp6GdBqFUE+aXhLi9GqyKuasLJxLqxmK7zJsLLsR0l36suytMAAu/+KJSChRN8Y X-Received: by 2002:a05:6402:3547:b0:45d:1578:9424 with SMTP id f7-20020a056402354700b0045d15789424mr29874494edd.281.1666615853748; Mon, 24 Oct 2022 05:50:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615853; cv=none; d=google.com; s=arc-20160816; b=0YQRoNgRBPDhPTjCwmC+ZLQ+3e/UDAKoMwD51CiR56h7W3N4bN8VfJ3xeeSLUrESuw awZDz7dCORKbsrO5mMMIrJ6MnQfYZCkAxyPcq+JS/WgmNaEPw3NX6XyGpyrH6i9PZCv+ tHhmrx8HCsISCyZH/1dMzG+pTkl0a/9iqWthr+3WFTlGCvTl1uaPHAAiIoqbtoVUFqEq jHtBcdaTN8gxnjA3y41qNBVNky2wtkt1tav6/mpHOF68s7cJYmJJZdjMz7rVqmvo3cKx QcpXmEZHG5Bogl9V8VsclvAcGxzqTLyw8p8Q5WTAkQywnnw6wgqbfEqafTucQDqaCI7P XK4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=SyG4E9bzpDOX/FrMyKKr9ZMxKAjXpQ6VieFH1lyxidheZmcNhmsH7lqlx7pMQFtCEy nGI4MVUrPZRBowj1TvmpDmK+uapVF97VdRAy+cg2+eqeqq0xF4lv8C4O2g4GfvAaC7nF wMvQJPnKcVk4SW/XsaXWLGzYqpFDiZ/V2RwhvDofxRw6IhlqXh0gmmrgFVstk4KjZRqt 9QnuV8dFp69AUgOKdk6mrm4H9EH7lxafojUQOeK5MqiyHPzFkztmnO/xEt/rm6gKT1HF n6yvNLcf5LHBKPh1zPvxuL9wrAIs+f7c0rBf6NIz0/Lf166xHnyoOIFWvSOnUzTx/YaU J/OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=taZFGTrX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170906730d00b0078d1e08f1e5si27754864ejc.919.2022.10.24.05.50.27; Mon, 24 Oct 2022 05:50: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=taZFGTrX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234731AbiJXMtW (ORCPT + 99 others); Mon, 24 Oct 2022 08:49:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234449AbiJXMow (ORCPT ); Mon, 24 Oct 2022 08:44: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 56CB72665; Mon, 24 Oct 2022 05: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 99110612A4; Mon, 24 Oct 2022 12:07:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC17CC433D6; Mon, 24 Oct 2022 12:07:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613269; bh=deb/+f+bTm4Ytyvf8OL7N3yZQGGpLOBi7QxH7ZECr8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=taZFGTrXUfQgmbxN62EfzcStndxifyxZyaz+A+34iDfy8LYwgb8AyOrVGhwomPSUu 7B1kf686Q18xJnsmE+t5YEb+W55ZLPFeyt+YEui5VDylRv4ZYrUKLp8w/JJN9uE+2k g7xnaWJeYkvxk7sUXfyqFUp2xshbGPfKkFWiS37k= 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.4 073/255] net: fs_enet: Fix wrong check in do_pd_setup Date: Mon, 24 Oct 2022 13:29:43 +0200 Message-Id: <20221024113004.933567582@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573385806235005?= X-GMAIL-MSGID: =?utf-8?q?1747573385806235005?= From: Zheng Yongjun [ Upstream commit ec3f06b542a960806a81345042e4eee3f8c5dec4 ] Should check of_iomap return value 'fep->fec.fecp' instead of 'fep->fcc.fccp' Fixes: 976de6a8c304 ("fs_enet: Be an of_platform device when CONFIG_PPC_CPM_NEW_BINDING is set.") Signed-off-by: Zheng Yongjun Reviewed-by: Christophe Leroy Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/freescale/fs_enet/mac-fec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/fs_enet/mac-fec.c b/drivers/net/ethernet/freescale/fs_enet/mac-fec.c index 99fe2c210d0f..61f4b6e50d29 100644 --- a/drivers/net/ethernet/freescale/fs_enet/mac-fec.c +++ b/drivers/net/ethernet/freescale/fs_enet/mac-fec.c @@ -98,7 +98,7 @@ static int do_pd_setup(struct fs_enet_private *fep) return -EINVAL; fep->fec.fecp = of_iomap(ofdev->dev.of_node, 0); - if (!fep->fcc.fccp) + if (!fep->fec.fecp) return -EINVAL; return 0; From patchwork Mon Oct 24 11: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: 9189 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458611wru; Mon, 24 Oct 2022 06:37:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4PBqxxYH8Iwop1ahx6p7Cr94pRWdG2oqRXYAJHH5ihdsWk5TtWqzYtxn8vwrMcrsukvTxj X-Received: by 2002:aa7:c61a:0:b0:461:c48d:effe with SMTP id h26-20020aa7c61a000000b00461c48deffemr4909080edq.7.1666618673808; Mon, 24 Oct 2022 06:37:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618673; cv=none; d=google.com; s=arc-20160816; b=eSOFMwkydJJXjXRUiPo+cNCzI9F4hXhprwEj0bvvLcrO52P0YCbtMlY2/f8VZrtJij KZAg49RO7owSqZI3if/R9y4mpLTzIeX16gp7PVKrSv4+GTeuItAJSJlbtfYO6N1gsc4W hLPuJZ07FSFRwETwTmtDhMSjJQUB4FuH68orut4qdupJHQu9JfRQX4H2r4+xsc0gcIVc mdWF82Za7Fpi6ntc3UJkuR6Q7B1rAtswpnU45H5tEI+wuvEJYxYhNqABftmv6Gg8P56f FFUNjnKkIF5q7qoqSByYfvwz2BEXX9nM20hZ+0OkEOGcBeHMakOPqIldc33Uhrp2rukk 08Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zFdcedCp7xw6WbFIwvZdgu59CP54udLeIEvJzVCmhEE=; b=ySKK35amA2/ncokTOc8THiELBK96Diz3GUqAuj93LPvbi0TOS0x45LXw1vg6fgMw1+ OXBcWWXXbVRB9KCSiIeLsBNkrcLZXg0I6/hZib0JpOP5sS2iLGtmHWUhchxVQDoROwIZ w8OtjVz4DyK0VzHkgnG6cdi/4/SrVSDqdsILLxGDAgELRKRb9xetx2SQA4jMd4EV/xxt S6xTJ9ySil+O8h+/70nTlrVpsei55xATP4uPjk8PUOMq9T/PMX1cxAaA+13dC8VpdeOi dk32oDg6KWVw6BunZ25RXIcwJG8vNl9OoD514XcteBH8UNhxWSGDVXH6IqvZJ83bqwo2 KgjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="WqGN/J9a"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp21-20020a170906c15500b0078df1c345dcsi34222474ejc.535.2022.10.24.06.37.10; Mon, 24 Oct 2022 06:37: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="WqGN/J9a"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230188AbiJXNcS (ORCPT + 99 others); Mon, 24 Oct 2022 09:32:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235975AbiJXN3R (ORCPT ); Mon, 24 Oct 2022 09: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 AE49E12A9A; Mon, 24 Oct 2022 05:32: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 F34C5B81212; Mon, 24 Oct 2022 12:07:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E0D6C4314E; Mon, 24 Oct 2022 12:07:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613271; bh=eu3dHn2Lu/ALN7PdPni6DW2q/Erc6p8YdVQGodhk4OA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WqGN/J9aNfxZggqej0WeCfHpFcT0YIFJ6Tg4/Ck09XW0zlt57UVyJWu1wmTHubJt9 GDRECsKBVPKeLr0/JDgCUu1yP3lL1h/WHoDPTdSyS7yjYXMCEm2ynaGZsvGUvY3GIf bJTvK+t4IfyVP1fc+pMOvd+tOxW9xafjVWMo54NU= 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.4 074/255] bpf: Ensure correct locking around vulnerable function find_vpid() Date: Mon, 24 Oct 2022 13:29:44 +0200 Message-Id: <20221024113004.972494500@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576342584046292?= X-GMAIL-MSGID: =?utf-8?q?1747576342584046292?= 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 9ebdcdaa5f16..de788761b708 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -2787,7 +2787,9 @@ static int bpf_task_fd_query(const union bpf_attr *attr, if (attr->task_fd_query.flags != 0) return -EINVAL; + rcu_read_lock(); task = get_pid_task(find_vpid(pid), PIDTYPE_PID); + rcu_read_unlock(); if (!task) return -ENOENT; From patchwork Mon Oct 24 11: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: 8922 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434562wru; Mon, 24 Oct 2022 05:52:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4OmbehUN+F1tKIGv9jfrwqXXICsfK3BFFZm3BpMmzEgk9b0xgAk1EVDiWpAF+ZEEkroC8W X-Received: by 2002:a05:6402:555:b0:461:a144:e949 with SMTP id i21-20020a056402055500b00461a144e949mr7357977edx.45.1666615948235; Mon, 24 Oct 2022 05:52:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615948; cv=none; d=google.com; s=arc-20160816; b=HH9VVJUhicXo0MsVp2/c1pQKblC0jWtYJj9Mu5RgY+mM5xGRgM6aP+Sj9MCYQLdcp6 wOWp/NJNuqB/n96rwkIs9qpNsCPndFQHcEVa4GSbituUAtUNggvrjMgJvgHWjfr+AhQI 1dGY19z3XHf1BId53uapdtiPb8BA8gh+tvDnQv9vscPk+5Bu/oJXhQky27ItnRuyBQm6 ka/Q9B/JkDEdBYvziwJqJilJQRRF4ERZAIHM3XEoPrFTrBen07+4SwckE15WIeiqmkXG fA2of02/DxhO/KlmgnsNL9mxDdcqP5LfW43OIVOePczVWnKB1uQU8mANucHss/cP6ebk 2Tsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xsJnZjdB8h4o7Pchn6j94I7tOwoEguonmkzuuQ60Sd0=; b=TWiTlN1WGbkVQndThoihUGUH+YLZrGcjIYF3XTfYbWNb/dk7yCvvfVFm64PwDWA4IS y6MhDJ3lraNNbxrFrDbYapgggP95yPmeSMdMLYVhF1a+IToxfAB4qyi1mGnsPKVD5jbc 5UYraCFR3rixG1OUQUobeVrAPHN1nw7tN498IAaXuGWZwNs6r9gc3ThZTgtAey/NQbYM 8m7lMd77uw90i31THrZxhKBTjIlDJyvv0w2AaptQCH78clOMErV1HKV5a2Mx5hIt/zJq fi322ue4nX8KNvV3taDadgugvdwEsvluobIHe2ytRYnhfUjHMC2CCGYEvwiMfXnIo5Pc 8SuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AQr1ZJd9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sc41-20020a1709078a2900b0078d027ceb41si31380645ejc.857.2022.10.24.05.52.01; Mon, 24 Oct 2022 05: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=AQr1ZJd9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234869AbiJXMte (ORCPT + 99 others); Mon, 24 Oct 2022 08:49:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234473AbiJXMo4 (ORCPT ); Mon, 24 Oct 2022 08:44: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 C8594F5BB; Mon, 24 Oct 2022 05:09: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 746F8612DA; Mon, 24 Oct 2022 12:07:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8671FC433C1; Mon, 24 Oct 2022 12:07:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613276; bh=UdSoqEBkBwPElrlxMo5agw7TJXBjNCUSgmXNmvuEWhk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AQr1ZJd9gmy8Qlc82hkkenXE+Uzp4wIpNHL5GEZ0V6vG/8Hpu19M5OFac9pxcr7i9 tDJAFWN/ggkocJc9kEytCrunxWYc1wTs8cTaT41bjTA76SZ4LRMQxZqBZj4iox76WP eXLNSE6eHeyFet8Jqpqp2t2d7ih6HsVA1h2nCpwE= 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.4 075/255] x86/microcode/AMD: Track patch allocation size explicitly Date: Mon, 24 Oct 2022 13:29:45 +0200 Message-Id: <20221024113005.010028078@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573484547251356?= X-GMAIL-MSGID: =?utf-8?q?1747573484547251356?= 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 91a06cef50c1..f73327397b89 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 a0e52bd00ecc..3b82d022dcd4 100644 --- a/arch/x86/kernel/cpu/microcode/amd.c +++ b/arch/x86/kernel/cpu/microcode/amd.c @@ -783,6 +783,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; @@ -864,7 +865,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 Mon Oct 24 11:29:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9744 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp548761wru; Mon, 24 Oct 2022 09:42:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Hh9Tce4+2ZJg26rdOVL6Anxzv3elfESK0M7OxkHFek4zQZzSseg/YwbOPJGz/6hnBeTQc X-Received: by 2002:a17:902:b70c:b0:179:eb79:cf9a with SMTP id d12-20020a170902b70c00b00179eb79cf9amr33933050pls.130.1666629745639; Mon, 24 Oct 2022 09:42:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629745; cv=none; d=google.com; s=arc-20160816; b=eJt0LRkIFbLj6UlVGd2t1r3a+sjvjGpExYUHCZ+zyBc5k90/sTpao5eI5b6jF7Oebm wsgNAk95ApdoaPXmvn17MaIE869PeLNqk7HSW1vdWm+nUnWbVUZgB7th1HGHuK5Oiggb DHvVdbs4MaGRXHbDhOGbWyKuBe4UBHDD7yi0f8WqzSvA8Yw+XdNnyNWYnZI5YKrBNGve Xp02x1W2zjL/doY/utcrbBWckzK2wyoT1VJmk9uVjt5D1SvIzXQ4XiyYxvFXLM5D72Pz 45hDNmycYjpZRDiYwqYW5RIEghXUudDhKef/VfEGZR9/oIh1M9Fi5OaPZ6B13u1AAGov ZxgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/fDYK22enPx4QXTMtGhRJyXr8DupQAP+IJdWjyXz9rE=; b=qjdJnHqxlLvHg/n0F/pVZZVzhSJKUqt4E8OB9KWfhsq9Y3OuCsyYmYLPC8osKQzhCE omeDjOME17de2GE+xjqy1knLv3lkuiHbp2rFTqjDcm6Kkytwactw3gaTB98vN4f6Nzi4 bmnDcXFup57Yx71m0mnRPS/Dvs/ieiUYiH0QBFDdAYW7Ct6Fq0CnbgklwxV6x63goZAK 65EtHY+RSm8SnPUV5ohUj4Vv5JfmzFml6RQ27PE4QMSRo/CfpJCH0SP8VFQ3+Jsyrsna ffkawpzkUnEkMYEa34jKHxrHna/8Eyntpfbp2qFGtEkNSrK0RmeLFtnFtTi9Wu6a/uVu tuWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dw1cR1hM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a63f205000000b0045706a2a5f3si35523719pgh.439.2022.10.24.09.42.12; Mon, 24 Oct 2022 09: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=dw1cR1hM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232026AbiJXQlu (ORCPT + 99 others); Mon, 24 Oct 2022 12:41:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234375AbiJXQlE (ORCPT ); Mon, 24 Oct 2022 12:41:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9ABE4CA884; Mon, 24 Oct 2022 08:28: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 C6577B81255; Mon, 24 Oct 2022 12:08:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27CDFC433C1; Mon, 24 Oct 2022 12:07:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613279; bh=n6hSCr/yUwW8mNV3+JAkqCanWy4S3tIwyEl58OYzcR0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dw1cR1hMQ9CrXFHkZCkGB5Gj8PqZTEKLkwzwexzVY/sJA13QcVr5CDfzirmFzeMYM +LkTWCIC2KwzhggmtNS9HsuD03fh/7Yy12kJT53CZMcKzaKEdYXZpIAQ2PHuL0XEwo vz9vcMIeERaYVcpm/0YEAld9KnAJ/FoLcO2zOldM= 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.4 076/255] spi/omap100k:Fix PM disable depth imbalance in omap1_spi100k_probe Date: Mon, 24 Oct 2022 13:29:46 +0200 Message-Id: <20221024113005.039415667@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587952124892242?= X-GMAIL-MSGID: =?utf-8?q?1747587952124892242?= 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 f64d030c760a..89d89ad1064d 100644 --- a/drivers/spi/spi-omap-100k.c +++ b/drivers/spi/spi-omap-100k.c @@ -416,6 +416,7 @@ static int omap1_spi100k_probe(struct platform_device *pdev) return status; err_fck: + pm_runtime_disable(&pdev->dev); clk_disable_unprepare(spi100k->fck); err_ick: clk_disable_unprepare(spi100k->ick); From patchwork Mon Oct 24 11:29:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9752 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp549393wru; Mon, 24 Oct 2022 09:43:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4EEgAac/WmDm8qFdvsy5xvqBHfgb11CJ8kSA84Z1m2eZpRfyDUHHEX4Hx9dm4SRsiHlIWt X-Received: by 2002:a63:e22:0:b0:458:cfe7:958 with SMTP id d34-20020a630e22000000b00458cfe70958mr28591088pgl.449.1666629832558; Mon, 24 Oct 2022 09:43:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629832; cv=none; d=google.com; s=arc-20160816; b=FZmF80hqR7UnnDDGlzz/pl1me2/HRHm9I9Wd5BmKhav9IbIqSXgIuuu9cnvdXRAr7b 1gEs5Vm6FIPmcFszR9e3lr7bVy7RN4f4Gz2qPVFTir+5lh1eS/zQQswj2oUUvidn7f9I 34DY2+IP4wiw7YNjbVRpOW6WVqHBjW8IdW+rl48MgY+4XIDcwl4wniluXoP4MtaBKan+ 6LmQBahoKX9sjY2YB9hdRHw8fs1dKy20VlqtB0T/7E53LhLkZDaCS0iCe+KWXCyDVWjz ddUYpyJMH9SGFJIwWhMslFHf+7FIwlMQrCNb3nZJcH9jkKWqHQvnbkBQtfh/C0mJ8UGE +8Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/5kKdIgWL5fiNVZMR7dh48z7BxzZDC3JQLRhwicDEXE=; b=eZkXzMkZUgTeHohm2p5zMWLnG2QhFF4EmKm7nk2Le+1qY8G46zbqiwsuRjkdy1BHAV n5JoLHH66G0FBfnN3Cz6kaeC0BbMtiqX/8P4hnJMiwsuqV3gbbz005XwgoqPB2RH4te/ NdVXEbTgHxkW5ZT7KD6252PPvLBRdtpKyL/XDJYARGEJVZTArtSXwzuEgbyZcZH9zKlW EDyu+l+w5UuIgENdTui3FpSJTCp+DGBNT1+9O3C3tuuXAbZ9e5VKOMTAUUfK37dLIxuN n/uu3sUam6GBAdcxPl2JUqu+nOzdrmqPl3Sh6Hnyju1hkLPxdJ3/pI9jrKcAx+cu65it UExA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QBgRQyzU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020aa78d8c000000b00536bbfa4994si77001pfr.345.2022.10.24.09.43.40; Mon, 24 Oct 2022 09:43: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=QBgRQyzU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231211AbiJXQnK (ORCPT + 99 others); Mon, 24 Oct 2022 12:43:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234635AbiJXQmP (ORCPT ); Mon, 24 Oct 2022 12:42:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4E11814D2; Mon, 24 Oct 2022 08: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 ams.source.kernel.org (Postfix) with ESMTPS id 6DCB7B811B2; Mon, 24 Oct 2022 12:08:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDE3FC433D6; Mon, 24 Oct 2022 12:08:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613282; bh=L3nu73DTIBY+iOWWvmkHwnjOgqxSoPaiZ7zV+CQG90w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QBgRQyzUjefCjRL85fqAXrbKxLI9lzjwQ7PJ61d2l+zgVFKsvKTx8Kt7T3ze4W6Rt OmuLMQ2q+GwYP1/OrsCjJes8e/ZNJxP4FyoP1blslKlYHcR5it/yShhiKeN5dPblWP wn2VEl6dTc3rcij6sYrwMYa1uXushT4dYfN0Manw= 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.4 077/255] netfilter: nft_fib: Fix for rpath check with VRF devices Date: Mon, 24 Oct 2022 13:29:47 +0200 Message-Id: <20221024113005.068677117@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747588043430508556?= X-GMAIL-MSGID: =?utf-8?q?1747588043430508556?= 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 ce294113dbcd..85eac5aa5204 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 7ece86afd079..03dbd16f9ad5 100644 --- a/net/ipv6/netfilter/nft_fib_ipv6.c +++ b/net/ipv6/netfilter/nft_fib_ipv6.c @@ -37,6 +37,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) @@ -179,7 +182,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 Mon Oct 24 11:29:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8917 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434411wru; Mon, 24 Oct 2022 05:52:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM69J3/HXHsJW+v2IcA9eSVGA2GLF0dxnAM3VWvz3fFqOnTn8sDzybEx4rg5VaLTq2ApH5U2 X-Received: by 2002:a17:907:d22:b0:78e:2788:51ae with SMTP id gn34-20020a1709070d2200b0078e278851aemr26900248ejc.689.1666615930886; Mon, 24 Oct 2022 05:52:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615930; cv=none; d=google.com; s=arc-20160816; b=gkp6sXQNH//mSDdEFMbKehz78Vuabn1FCcRl8NazhcOiskHF54gz3n7mxpU2IJX++3 OiEWUftw+9PlR1Bu7hCqQ9CfnyFAmKTlXmc99Ktz7PMXSSLJZ1dG5voN5JBGFbqi52EA QGMQUzqKSW2EjF7lohs4X3wlxS1vsJWm1+kQxSD8IzOZ8H6ANO3jAbcfpg2F2DYarjr1 ycjFRBW46GcOkA/eo4xTdvZeJilsy/yKouJDsJxxYzbmkqntx/nsDSBv0vOZrmy43QbL J0tm8HjsGz9oWA4zX4NTFSdvQkPALmGhwcOlV4vmGboVn1fbJuikLhMrl9oh1nU8ljFR nNYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NCajvmPzlLtTQEuxTL2OzG5eHDyTQ+NLd7FwXLOsMOI=; b=Td7UPU0f+gX+GoHT5vmKvdg4a3uRzkTbzG4fCsA2hK1+oWjN7PN0cXtvjWZNZb/b5K xxob+DcllT9V7QxMMqxcM52UcY28LtZWQcK8RgDc4tZmSU+J8ABf7T6HIsH7+iZV7N3x 7KUOdvXkS6Q5QLz3RQK0WsCUoFFbBa1NedRB4hw2RK+m+4RZITYqXGUS0hNEMdxs05ZE P11XFukkxl53rHFNSN0uWmtHgnCblxU5Mb03Z3qt4mrg15sJkLFj0fqwImxBg5UXLXLL rTWPgHMP1EaLeFFRv0odTFVMdUQDAHow6Jotq4B60F/Sw5eAqmvTzofKYvZO5Nib/qDo m3Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GujPXOXY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090669cb00b0073d710fec77si24403201ejs.251.2022.10.24.05.51.45; Mon, 24 Oct 2022 05: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=GujPXOXY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234663AbiJXMtO (ORCPT + 99 others); Mon, 24 Oct 2022 08:49:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234419AbiJXMos (ORCPT ); Mon, 24 Oct 2022 08:44: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 671A712611; Mon, 24 Oct 2022 05:09: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 46FB261252; Mon, 24 Oct 2022 12:08:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A2B6C433D6; Mon, 24 Oct 2022 12:08:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613284; bh=OdCrpPWWG4nWQffHV/hJadngSemBaAi8ZG/iIGDQHl4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GujPXOXYgF/Dc8eWSCCG95k2N4Ps3NKmaR+xwa/zPv2rJt221OzPYWlYSOkOdcjn0 zY7YgvO4Dz3oZPI27ZOlGHbBHXg6ntMqwVbL4DIJveCLIk7/zS8Z6HAcHue8PGPu9O 0WfVf6ootn3/+U0iG0+PZs/oOLa+/RMgc1UiQ91g= 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.4 078/255] spi: s3c64xx: Fix large transfers with DMA Date: Mon, 24 Oct 2022 13:29:48 +0200 Message-Id: <20221024113005.102682231@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573466241681669?= X-GMAIL-MSGID: =?utf-8?q?1747573466241681669?= From: Vincent Whitchurch [ Upstream commit 1224e29572f655facfcd850cf0f0a4784f36a903 ] The COUNT_VALUE in the PACKET_CNT register is 16-bit so the maximum value is 65535. Asking the driver to transfer a larger size currently leads to the DMA transfer timing out. Implement ->max_transfer_size() and have the core split the transfer as needed. Fixes: 230d42d422e7 ("spi: Add s3c64xx SPI Controller driver") Signed-off-by: Vincent Whitchurch Link: https://lore.kernel.org/r/20220927112117.77599-5-vincent.whitchurch@axis.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-s3c64xx.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 1d948fee1a03..d9420561236c 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -84,6 +84,7 @@ #define S3C64XX_SPI_ST_TX_FIFORDY (1<<0) #define S3C64XX_SPI_PACKET_CNT_EN (1<<16) +#define S3C64XX_SPI_PACKET_CNT_MASK GENMASK(15, 0) #define S3C64XX_SPI_PND_TX_UNDERRUN_CLR (1<<4) #define S3C64XX_SPI_PND_TX_OVERRUN_CLR (1<<3) @@ -654,6 +655,13 @@ static int s3c64xx_spi_prepare_message(struct spi_master *master, return 0; } +static size_t s3c64xx_spi_max_transfer_size(struct spi_device *spi) +{ + struct spi_controller *ctlr = spi->controller; + + return ctlr->can_dma ? S3C64XX_SPI_PACKET_CNT_MASK : SIZE_MAX; +} + static int s3c64xx_spi_transfer_one(struct spi_master *master, struct spi_device *spi, struct spi_transfer *xfer) @@ -1118,6 +1126,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) master->prepare_transfer_hardware = s3c64xx_spi_prepare_transfer; master->prepare_message = s3c64xx_spi_prepare_message; master->transfer_one = s3c64xx_spi_transfer_one; + master->max_transfer_size = s3c64xx_spi_max_transfer_size; master->num_chipselect = sci->num_cs; master->dma_alignment = 8; master->bits_per_word_mask = SPI_BPW_MASK(32) | SPI_BPW_MASK(16) | From patchwork Mon Oct 24 11: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: 9736 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp548561wru; Mon, 24 Oct 2022 09:41:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7nmk5CDN5RK3F86vCvfLNCvJ8CUX91LiLDdA7xqS1J7VDlAoEmFFYR4SmA9x0tzQzEaTLa X-Received: by 2002:a17:903:1245:b0:178:9234:3768 with SMTP id u5-20020a170903124500b0017892343768mr34556742plh.146.1666629711028; Mon, 24 Oct 2022 09:41:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629711; cv=none; d=google.com; s=arc-20160816; b=OmBVe8jEkz72dbuCfbnNAAbhoBQGAicpLY99K4v7STyc+JBN53rAzTlhjsYw9MOfBT Hfw/skRZXxn4eVhOQcfWOCaR+hSAdG2eqzYw94/9kipTMLWkIgJJXTLdZJrJsTtVAL+s Im0+UdrQbiGqQ+W8H99Om+1qIyqz+jSsm3TV3iW/q/DKpvNzRbPHsxlvsx6GrgKIhse/ B5iQY3RsVhyBX2lZZbp6mm0b6cJvxxlF7PYejFjORzC0tNCvu2DnVm9qhO5H9NZXzu5P 08AQgF+gSyhivwMKbzkm3YO8zmN7uGdZHkB9upgATmfwSy7Lcw2UWAJUz13fDvSt264X hsog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7hbBV08m2h6rWycDuVSrzpGdLCf6LdSL71KsEoDbRmo=; b=e7/KNKZDF3th7RWF6tZeEkQoWmuYHMkMuHJ+6MaQNPCWaE6v2KDwP+Sx12bP5KfZlx XzZrwwXykSZizDfi5AthCu+pIAuTjmSFHqDk49QeGis9ensRkZckUL+3SbmdpxcP9piT 80IQ6LTDglhMqtEjEf1P9oO6nUAXf+9IL0GV4yXZ9GzgZfca1GVc1ZHeG5tqaT9FiuTx drry03N9uwAA8YW8K8rLnS063utwO3gBTiODhgsb0Xbs75//igcWStUIACNRIQwNh/Ri lLYZzqqJNODLXxvOWXTmpKNHSDRHr5Kl9j2FVA1HdhofYFfyty0G9BHRMeOvYfWjXnmK 6NtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=K8mKVWlC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h22-20020a056a001a5600b0056bb424088csi127445pfv.212.2022.10.24.09.41.37; Mon, 24 Oct 2022 09:41: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=K8mKVWlC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234384AbiJXQkd (ORCPT + 99 others); Mon, 24 Oct 2022 12:40:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234406AbiJXQkJ (ORCPT ); Mon, 24 Oct 2022 12:40: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 DDDC47FE45; Mon, 24 Oct 2022 08:27: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 A9C47B81283; Mon, 24 Oct 2022 12:08:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 067E1C433D6; Mon, 24 Oct 2022 12:08:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613287; bh=TfChbMCsTu4vpxNOhnTfgPYTaYOSftYhqzKHw1VLQlE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K8mKVWlC24HmN4AAuEnTUf6aivEinycRgYJDcanmRxW4+eUH+5o5ApqNX43nF/dmH eiDH4XLLC7axx67QHXyq37tEWB9CSnXH+aCKPHAb2aKxBUxI3SSzHeXdYbU8r+6Y0I kZAgPqpsssUwfCbL/G9aQ9KTXX1oT5dmdIm56nbY= 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.4 079/255] vhost/vsock: Use kvmalloc/kvfree for larger packets. Date: Mon, 24 Oct 2022 13:29:49 +0200 Message-Id: <20221024113005.139831763@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587915913000944?= X-GMAIL-MSGID: =?utf-8?q?1747587915913000944?= 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 308df62655dd..64806e562bf6 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -353,7 +353,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 dde16a033a09..93c11ffae92b 100644 --- a/net/vmw_vsock/virtio_transport_common.c +++ b/net/vmw_vsock/virtio_transport_common.c @@ -1146,7 +1146,7 @@ EXPORT_SYMBOL_GPL(virtio_transport_recv_pkt); void virtio_transport_free_pkt(struct virtio_vsock_pkt *pkt) { - kfree(pkt->buf); + kvfree(pkt->buf); kfree(pkt); } EXPORT_SYMBOL_GPL(virtio_transport_free_pkt); From patchwork Mon Oct 24 11: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: 10228 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp642940wru; Mon, 24 Oct 2022 13:40:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6YXZMn8kEoO4O7/5EhwSxZzTuihF2T+FtMjXwqeVdB84N493FZP92txdJ0CdqrQhhiHRVD X-Received: by 2002:a17:902:cac3:b0:186:6ce4:f94a with SMTP id y3-20020a170902cac300b001866ce4f94amr22396319pld.145.1666644001332; Mon, 24 Oct 2022 13:40:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666644001; cv=none; d=google.com; s=arc-20160816; b=IVxOldz/TEqEF1hHFqFf7gpPlLdVq9J1S9IrFr2Uczi+7e8KtJS1NhyXd49qoxJDqt G4SNDO1i7BJQCxsBRMYHW0qtAOfZRli4WgIONCbVKaq29ZA9pq4UaJbUO3EtufMoQjML ql8UHmFR6viBMGLTxeO8E3sCGn84xx5UrCq7zkzSKPexQvgE6Fjc9LBISGpVwCPYPDG6 +ayKiMLSxEHTS7qXnIQitPdtHZkcG3L7VqDhvHVEteQ6O3fB8xWXNnnZ1d0ODv+s9/2I ZZFa8ts37RQ3sQm8ssLwW7JPJYjiprnjPTm9fE5PJtrLJN9043TS12xT/nqzn4eUQ3Kk qZhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YyBJTR+ihSnlgsZKObYqzucWb98ATOZT2eXgF5w7dUY=; b=MvsrKb2dLv3kOc1teTG6C7lfIOeLx1er0QYr57kNF8uZ5cZ+uOZE0RW3761tZgp/3J iR7M+OMQCLvBlqtCYyY5DvYBAQNk/wSSq7KCm/feW60lb+c6BUl/P0FwQhiydsTeLuny OfMK3UrmQLjicv94Wld4eAz4D100ev0IaJVRRgjEmQGgYw6EYzrbFDsm9nnlbLHyyIOY i/hCnvGOYhDIzYDb4nzPkohius03pDqHsnoovBMu5q4mQerdiEj1q0h5gHYVRs4fo11P I02bzxIz+EQxcZC81PlXmy4v72U4PCjWfhodsfpWs0uEd6Yo9wxZ940z9CWF4VDdfs89 T6LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lq9UPjIi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a22-20020a17090a6d9600b002130d0f6df8si920690pjk.30.2022.10.24.13.39.48; Mon, 24 Oct 2022 13:40: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=lq9UPjIi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234648AbiJXUiu (ORCPT + 99 others); Mon, 24 Oct 2022 16:38:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234609AbiJXUiL (ORCPT ); Mon, 24 Oct 2022 16:38: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 627DF3FA20; Mon, 24 Oct 2022 11:49: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 459C7B81256; Mon, 24 Oct 2022 12:08:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D5B4C433C1; Mon, 24 Oct 2022 12:08:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613290; bh=J07xhHpiz53nfpmBnVPX+Nux9GuiPCo4H7qkooMzdPM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lq9UPjIiFzE/GppoS4G8T04RWcw7z2uGTbNjRl6OYm7HvqSF3xP70mE+6/AkZMmpV T7zsEvsUdAyvmSj355NPoWvN1u6Z8+8gdWOMYO1p47Cj0l+G3NOkXaH7J9V2iBid2O 8fHCno3B9NL3ozRjWoGyaquvV+4jOT6eV71Qa/ZA= 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.4 080/255] mISDN: fix use-after-free bugs in l1oip timer handlers Date: Mon, 24 Oct 2022 13:29:50 +0200 Message-Id: <20221024113005.169495890@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602900587379142?= X-GMAIL-MSGID: =?utf-8?q?1747602900587379142?= 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 b57dcb834594..aec4f2a69c3b 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 Mon Oct 24 11:29:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8905 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434022wru; Mon, 24 Oct 2022 05:51:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5wGHjXAjrwisb/7SXUhgKYed5MkyYoki3+nawKrx2LMMySkan8GnoTSqwpAag5N47CpEwr X-Received: by 2002:a17:907:2c71:b0:79e:8603:72c6 with SMTP id ib17-20020a1709072c7100b0079e860372c6mr12943428ejc.172.1666615873173; Mon, 24 Oct 2022 05:51:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615873; cv=none; d=google.com; s=arc-20160816; b=mQrvCr9ZoHeywEfi4Q4JIzwTjfcnEboIJeQQSTz/Jk1pBCez9UQzIOWE/wdlhGwujV OYs7xgPgLZFoGzoLxQBdYFCN9lnKD5rdrnyji8qqSEGutZsU5iqsQJlP95jov8ubRPzy tRMi6Ny84OC6xflh71rVUSeRPNtuIn5FLaNM3Zijql1bM/jEV7fQswMrHgj7tPFLV3XM kkj3Y2GfY3afb5ZV8dmg1paZamW/SZ0of5dBIgAZ6AuDeIWVs0SldI5ore+9Xf3QWxuO eXW/EVjCiyIVuWZ7MwjxhfGfbODThyp1MaKlUM6AFmOfqMUTtWHDx0V7jAtAS2T8HwKM WTDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JtEiJO89vNT2ZrdGD/0PXPOP5avgHgUre4DiweazUbg=; b=xcvz7OBCy3Z8h5Cj3JG4ZGF6GkGSlxjdUoNIoZzO02T51cX6lBBBiFTdBQa5B5j0o8 rW9uIuMAj+EyL4Q9TccZu3CX/+eycn8fkuiCl6PwJyph0m7knsYYVumTv9a6iFQfk+yU DbPTgSzxjaoHAJNAgCAnBWNXDiJP8qH9PM6k4EwDJK9a77uZNBaGbtQGxnt9QfztkXWp QGmgnqUI99SDeqc/2O6kQ0EJHRrK7+Kt6dtblhg1pbgIuSl/VYiO7z/sWQewDDr9o4eQ rJLtQkyaS0BWjcHQ6fXyMEfa5X0Ouhs2sIkoTIyP/8kmEpmDcN17Ld4SIA2Xjz9mF4hC CR5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ek5GJSBK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c6-20020a05640227c600b00461e3e1a628si1613938ede.110.2022.10.24.05.50.48; Mon, 24 Oct 2022 05:51: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=ek5GJSBK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234910AbiJXMtj (ORCPT + 99 others); Mon, 24 Oct 2022 08:49:39 -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 S234502AbiJXMo6 (ORCPT ); Mon, 24 Oct 2022 08:44:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C68C5140E7; Mon, 24 Oct 2022 05:09: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 2F48A61278; Mon, 24 Oct 2022 12:08:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3CF9CC433C1; Mon, 24 Oct 2022 12:08:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613292; bh=kwbVD9Us+cXE954oSglAIQMXgHk6yPoSGcch9kkRkps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ek5GJSBKXp7x9GCKUFLPDn3N4u4MrXRqK2H3Bbfe+0r3FF97JCzlrZT6Bw0GeWGLH l8kSBJp8R34Cf81ExDhgqMb1Fgi3rY1/vXQXn8el75Jurs0WwQQoTsNVhgl9mlWRJO 34ymamJH+FsZ6vgBI7EzTecLjDmZ6I3oiqwQcZqs= 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.4 081/255] sctp: handle the error returned from sctp_auth_asoc_init_active_key Date: Mon, 24 Oct 2022 13:29:51 +0200 Message-Id: <20221024113005.198074246@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573405824018486?= X-GMAIL-MSGID: =?utf-8?q?1747573405824018486?= 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 3b2d0bd616dd..6b97b734a16f 100644 --- a/net/sctp/auth.c +++ b/net/sctp/auth.c @@ -869,12 +869,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; } @@ -908,8 +913,13 @@ int sctp_auth_set_active_key(struct sctp_endpoint *ep, return -EINVAL; if (asoc) { + __u16 active_key_id = asoc->active_key_id; + asoc->active_key_id = key_id; - sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL); + if (sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL)) { + asoc->active_key_id = active_key_id; + return -ENOMEM; + } } else ep->active_key_id = key_id; From patchwork Mon Oct 24 11:29:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9079 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp445470wru; Mon, 24 Oct 2022 06:12:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Z3Acr6ZneUiMrvsSkYwi+ObLEdqTVa/ADYGVePBlxtHji8YSCmmft78O9ppIm5K/PC/4B X-Received: by 2002:a17:902:ce11:b0:172:6f2c:a910 with SMTP id k17-20020a170902ce1100b001726f2ca910mr34172509plg.156.1666617159313; Mon, 24 Oct 2022 06:12:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617159; cv=none; d=google.com; s=arc-20160816; b=zArl9/+xQGUVMy99j7hOrM7534c8iYuLvdr2ZXCO6zrS3k0Ss/uCOuSBlxdZDfNLqi cHuu8ffAhELWwkU6S0GNE4clNeAZOY07wz94UIIHQ2ZKX0lgzWKDJvd/Wd/Wn8LR0fXu c0DV730VSkgZKxi/T2aAtreWnETtqUh8AQ/BrCMY87zLxXnit3k70xBrudFqLGTM1EtP uyOpJnlqpj5BDIw/1vCXcYMKmuDtpnf3xWBqI4yrpMfShA21m5+3NxlnxIhCWjYLlXsa so8UEiG8GnCQod9KDLp9bJEQU3Pu3HjIDbeQxvmn00Tm8BMb5+p8BCIaRqjeCstOnayH vb6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JY1QRyq6Qwh9ifOfbeiLE9xAuXWN9CIeyZ+H007gzhI=; b=n4gpiEyaRm0mPombphNmOG2XQ+jerwDQC05y0UHICoQRjPsETGeOYT5fyV5DuP9j1u cNJpdRXtzVnHjbSL73A8ErtWWhnsZV37yHxMpi6aXzTkezUm3Kvc/lmEttngakakDc3J rrxGhmVFN0BHsr6JzVRT98hVjYpZr1o0QWpKc3uJpo/blXPXNXSqAsQth35L0A1mKA+q uHXZu875H2DXQ/GSyhuWbLumtYgnuDIrXrtTSQBYfjZuMcuaSmTWm83l/rzaWLssZiMd YFjUqrD34mTX4oMqMBsFdJv+Tn1j7szyEpszEsny5MG86Gocc1mRx/XPiw00xJhzsO3N qO5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=U+hcrLje; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090b118800b00211780dcde8si13999245pjb.124.2022.10.24.06.12.24; Mon, 24 Oct 2022 06:12: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=U+hcrLje; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235627AbiJXNLu (ORCPT + 99 others); Mon, 24 Oct 2022 09:11:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235625AbiJXNJL (ORCPT ); Mon, 24 Oct 2022 09:09: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 7615F9F358; Mon, 24 Oct 2022 05:22: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 87973B8125F; Mon, 24 Oct 2022 12:08:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4E15C433D6; Mon, 24 Oct 2022 12:08:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613295; bh=KV8SO6PkOxIGVs+0wL3V4s/0hRb6vXTMph23wDiCXkw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U+hcrLjeAjKWNig+Z++s36rlQ05+dlBUG0ZfnEMaj5qeuB+UivnQmdTX/QwxFRWht cJi/pNIavPEZcQeinf6QoM+bySr1pEnF0MuRnd9/GgUT6lAUfhFY2aSNaDfBw2bIqm +1PKFamEfR34GOg8gSzlU1m5qCdGqhivS5Zc4FHg= 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.4 082/255] tcp: fix tcp_cwnd_validate() to not forget is_cwnd_limited Date: Mon, 24 Oct 2022 13:29:52 +0200 Message-Id: <20221024113005.229311481@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574754664083631?= X-GMAIL-MSGID: =?utf-8?q?1747574754664083631?= 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 358deb4ff830..89751c89f11f 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h @@ -258,7 +258,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 8459145497b7..5b2473a08241 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1258,11 +1258,14 @@ static inline bool tcp_is_cwnd_limited(const struct sock *sk) { const struct tcp_sock *tp = tcp_sk(sk); + if (tp->is_cwnd_limited) + return true; + /* If in slow start, ensure cwnd grows to twice what was ACKed. */ if (tcp_in_slow_start(tp)) return tp->snd_cwnd < 2 * tp->max_packets_out; - return tp->is_cwnd_limited; + return false; } /* BBR congestion control needs pacing. diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 0a570d5d0b38..2da4f852fc58 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -2635,6 +2635,8 @@ int tcp_disconnect(struct sock *sk, int flags) tp->snd_ssthresh = TCP_INFINITE_SSTHRESH; tp->snd_cwnd = 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 c37028af0db0..b4a9f6948cb5 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -1653,15 +1653,20 @@ static void tcp_cwnd_validate(struct sock *sk, bool is_cwnd_limited) const struct tcp_congestion_ops *ca_ops = inet_csk(sk)->icsk_ca_ops; struct tcp_sock *tp = tcp_sk(sk); - /* Track the maximum number of outstanding packets in each - * window, and remember whether we were cwnd-limited then. + /* Track the strongest available signal of the degree to which the cwnd + * is fully utilized. If cwnd-limited then remember that fact for the + * current window. If not cwnd-limited then track the maximum number of + * outstanding packets in the current window. (If cwnd-limited then we + * chose to not update tp->max_packets_out to avoid an extra else + * clause with no functional impact.) */ - if (!before(tp->snd_una, tp->max_packets_seq) || - tp->packets_out > tp->max_packets_out || - is_cwnd_limited) { - tp->max_packets_out = tp->packets_out; - tp->max_packets_seq = tp->snd_nxt; + if (!before(tp->snd_una, tp->cwnd_usage_seq) || + is_cwnd_limited || + (!tp->is_cwnd_limited && + tp->packets_out > tp->max_packets_out)) { tp->is_cwnd_limited = is_cwnd_limited; + tp->max_packets_out = tp->packets_out; + tp->cwnd_usage_seq = tp->snd_nxt; } if (tcp_is_cwnd_limited(sk)) { From patchwork Mon Oct 24 11:29:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8908 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434143wru; Mon, 24 Oct 2022 05:51:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4QGRXE1/lcb3CaCZh1/ma5S2wxOeTiihfYBAA+nV64X4b4PXGs0APtnedon78JyaD0tgVB X-Received: by 2002:a05:6402:84d:b0:454:f41d:6ccf with SMTP id b13-20020a056402084d00b00454f41d6ccfmr30454731edz.129.1666615890568; Mon, 24 Oct 2022 05:51:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615890; cv=none; d=google.com; s=arc-20160816; b=YTYf+sT7zu5uX/9K/D8lA9ia1IYMCDVE0+B6vfAlKmGbFju0fyjjObxGbyGIEqxvum 1t0npiLnN7vo98iw6/TM4BkZ+hBQ2ESVpWnz+F9vgCMORQb8hDx5J9m6n4MG2oKumpTQ os9y41YRU9w0HPK7a7IY7vUFbUUrjxwYkK9WVvXM0ihqmuLL098h32VEkb3mNLQokVRg kUIof1RxhEFRSXpec7pua7cLpcu98PagJ/D5MwJ3jJ7EVGOwUX1APB6ovyW7ZWoEDq2D vWveakpG9fSMlzf5wccLd1qBE24/K719c2ko2WSp1ZH9DmMF9dxnJtAljDDa9KXelYVm DTnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+ynPjui00aO/pf2P/NxkrTUfNFOdf1IEh1/gZVcJh0I=; b=YNMgjLCc1x9oPBSF5OIABVoitvBHtZxvN1XpRH/hf1fz6mGs+2l5nMa7l54+4I66PC BxUg7mxpbMKdFA3MHlSUrMPdkzF2OKzl1IstAlQbJcidcI+KSJwsF+SV+IGkkNUWqgW9 Lx+uVDAwLDal6/DGddcH/dxWwCVjbwjUOVkjaODoOdbFhEURndLqtaRdidHrwBA7nhOd gCAYhyEOAqmSSRCjQCHZqYXja4slqSFohf+HuQazh/+iIL2zIIJq64r3Fg3YM2+9mICD hIJ2j1+BDEwGNMH/6W2ARfeTVs8Jt8YoFAcRyCHkO96olbu+t6+x9hMCQMNi6UTf6UWB lsbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NPT7XOp5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ji19-20020a170907981300b007823d2b20fdsi28156780ejc.219.2022.10.24.05.50.59; Mon, 24 Oct 2022 05: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=NPT7XOp5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234166AbiJXMtv (ORCPT + 99 others); Mon, 24 Oct 2022 08:49:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234524AbiJXMpB (ORCPT ); Mon, 24 Oct 2022 08:45: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 2F3E11CFD3; Mon, 24 Oct 2022 05: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 dfw.source.kernel.org (Postfix) with ESMTPS id 987EB612BB; Mon, 24 Oct 2022 12:08:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A75BEC433C1; Mon, 24 Oct 2022 12:08:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613298; bh=Nlr3whkKSXmBdqljoxTbdkcPVBXygdd7SJC2WUfTS7M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NPT7XOp5Kx0FCjiLeTtF4grtwhlZrNeULLDXK+3KexK7VL4XB46ASekto2jvRQ4Hu /ptMeCOp1LyIch7Ok4nRrddaabgt9QoxJ3+9BRsq3uV1t0GE7QqkPwEUwGqTFlz4Xe VZitWP/vs8ed5qRJUNvXy8vwkwG3ktBmFtrac3IA= 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.4 083/255] net: rds: dont hold sock lock when cancelling work from rds_tcp_reset_callbacks() Date: Mon, 24 Oct 2022 13:29:53 +0200 Message-Id: <20221024113005.267727463@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573424222492612?= X-GMAIL-MSGID: =?utf-8?q?1747573424222492612?= 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 d55d81b01d37..bfb8d4d6a994 100644 --- a/net/rds/tcp.c +++ b/net/rds/tcp.c @@ -176,10 +176,10 @@ void rds_tcp_reset_callbacks(struct socket *sock, */ atomic_set(&cp->cp_state, RDS_CONN_RESETTING); wait_event(cp->cp_waitq, !test_bit(RDS_IN_XMIT, &cp->cp_flags)); - lock_sock(osock->sk); /* reset receive side state for rds_tcp_data_recv() for osock */ cancel_delayed_work_sync(&cp->cp_send_w); cancel_delayed_work_sync(&cp->cp_recv_w); + lock_sock(osock->sk); if (tc->t_tinc) { rds_inc_put(&tc->t_tinc->ti_inc); tc->t_tinc = NULL; From patchwork Mon Oct 24 11:29:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8940 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp435134wru; Mon, 24 Oct 2022 05:53:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM64WxXiNQnw+LMZrvcbAQA5/WllEboxt1Kn+MZwBpxBDgv4UoX8g0kWhKLI4JJPank+BfES X-Received: by 2002:a17:907:d89:b0:7a8:d67d:87d3 with SMTP id go9-20020a1709070d8900b007a8d67d87d3mr3278034ejc.364.1666616021156; Mon, 24 Oct 2022 05:53:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616021; cv=none; d=google.com; s=arc-20160816; b=iaBDDVGVNxHe3rUiXTRTv5yv0WUji6+W0pUknjfF0ihz6hcB+HIVlQg3jP+IjVSQwD 4mq29C+uU0LIeeH2cuHJEJDyHj9BspCL0Zd8vQbc+cTW4y7Kw5zmGAkW6DLtTNXurYvK TR7NcaQnIeKeHH95JQVk/iqvXEYTl2xBANoLrFE9/FQUkgeOC9hOET00AAj6dFXnBupJ yXOlaA/hg+wLSz+34dI9egqdmoyFYdK0tXje7QRJe/guBBqfEwD7mOId0uOCoiLO4B/V MtycXBTd60gicLQaK9x3o30P9Swine5p5UyaebPoHOvu21Cfij7UALwuPpLZVcn39AQQ BBuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Oh0IziQZhKeYNlfpfRn33dTTMuill2SHd9n/uuReXOk=; b=Y1kFYH2aIu4GW1aFmIc+CtaDYLdcj5z7iNSIsXCtypbPfAPkbh+uKcY7eYZaAxuYi3 Y1Q5ArPtOI99ez5twaf2PVBwondYcBR5FNBckGETEJVm6WeMpR3vz007SaQHPSk0pRT7 dfUn1QSU03TPMRoBaDfY5d1m8otC8idTn1h+q8D36OUZqW6NkAMSVpWH+dtfeFXO54Lh ta+MX9L5Pk49PzKGtQnYiZi9JejRYjDkia0egPR8PBawyPxLCkziuQrGTaMtGs+zf7pB +beDviFiXKhRvwjY+4972tCpxBFII7xxh/xZJbln4uW3hlR3bCrQYRfuVtl9yqa9xcQb DbBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="QbUwv6/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 qf22-20020a1709077f1600b0073fc8e72882si27068573ejc.28.2022.10.24.05.53.17; Mon, 24 Oct 2022 05:53: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="QbUwv6/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 S230043AbiJXMw1 (ORCPT + 99 others); Mon, 24 Oct 2022 08:52:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235521AbiJXMri (ORCPT ); Mon, 24 Oct 2022 08:47: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 DDA9480510; Mon, 24 Oct 2022 05:12: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 3C152612E3; Mon, 24 Oct 2022 12:08:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4AF05C433D6; Mon, 24 Oct 2022 12:08:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613300; bh=dki//+ul7bXiMbekV2qwewjmJI5EqUjlJZpavHCL+Kg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QbUwv6/GXKs9mRjur+ltVDKPf+MQtdXZv9xyv6LvX/hkH/rDURfe/cgAgoMS0kbKB sOVMMlHd11kj6VEK5wEwG+qnd7lN/MmvoHHHD4fgOTMDYEF2WF3bm+GSDPeGB80rCK 7YTy+2JqZeCL/3LEfEvdzijU9jOpaNG+7UrKVCFc= 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.4 084/255] bnx2x: fix potential memory leak in bnx2x_tpa_stop() Date: Mon, 24 Oct 2022 13:29:54 +0200 Message-Id: <20221024113005.303398845@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573561107519738?= X-GMAIL-MSGID: =?utf-8?q?1747573561107519738?= 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 9af8afd7ae89..d8e13ee0601f 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c @@ -787,6 +787,7 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp, BNX2X_ERR("skb_put is about to fail... pad %d len %d rx_buf_size %d\n", pad, len, fp->rx_buf_size); bnx2x_panic(); + bnx2x_frag_free(fp, new_data); return; } #endif From patchwork Mon Oct 24 11:29: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: 9760 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp550149wru; Mon, 24 Oct 2022 09:45:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ru6NCwroBZDSG00rf9bVyZha8moGKFXNVjpugWeT6Tx2KKUdG51EtGBb09peKyidsausv X-Received: by 2002:a17:902:ce8a:b0:186:9d96:b93c with SMTP id f10-20020a170902ce8a00b001869d96b93cmr9115854plg.123.1666629925856; Mon, 24 Oct 2022 09:45:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629925; cv=none; d=google.com; s=arc-20160816; b=zwB7XSC/aYWdQuk369veN6tDMMtbNaJoNKmcS4Uh2ZjUUl0G7Hn1g+fTzS0Q+Q2uOh goY4RWgDRnMa7S1t0PGlRL4CGPJkmbhbunGp7UHJ8G13jMRTnUMIrk5JYQCOlFB7M53K 3SRbRH5D5+mueH21EpoFnqQiuKCcuCHMfAwrTyJsXRaP0jbgYBbPYSdA1usY9xdqDWv9 K5Ule05Y3mQNj4ZUS3gjT1d0ZNJ5vUqoSoL05wqMocrqOKxbnNNjxEyJvW+PtdraLyAO qFUfwCK9fTQZ0D4Qci2mTrOCkVg4tJwwI3LKP+MwUXKbuS8MN66BUlMa0AnWERIaAQM5 g9MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kgMqsa4gIHo+CIEZFHkTYNu7cUqVkPpfui9P6NY/Mkc=; b=lUXDN/UwByZgp/oUyHg23vTa/28IVGLvoKYk9+Vyuuf3s7cw+sLECq29AtWOh4rnwI FXEQQDAkGSjfuF5iqO171qLhNozO8VBXgNwz0rviM8qL4X9UsjA0PcC5Whp0uQk+eIwx h3raX99D8jUJCtS1Ik/Cl0GK+Ub0JP9NQ0iqHQpQsBhymlO00WinqRNBd+z0mVQCz/Pj Fvm1fQigKEZV/zM/GHHxSjHFqNG3AfN4ddWc6DbbE2sYnfh1Xt/3CfHeou9NnTajEOdC K1zPonsG/EnDWPfTATz/e3dVUb0RO8YKrZ40QKR+3BhWAkAaNPEz5Q+y9ZJPGNxmxIk8 LU/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A4TO2c5Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a6555cc000000b0041cefab5b61si36971632pgs.719.2022.10.24.09.45.12; Mon, 24 Oct 2022 09:45: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=A4TO2c5Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234782AbiJXQov (ORCPT + 99 others); Mon, 24 Oct 2022 12:44:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234910AbiJXQoC (ORCPT ); Mon, 24 Oct 2022 12:44:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7635B88A0A; Mon, 24 Oct 2022 08:30: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 26AE0B81263; Mon, 24 Oct 2022 12:08:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CA6EC433D7; Mon, 24 Oct 2022 12:08:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613305; bh=j5N1rRaBQUoxQJhkXMaxZ4cTTEwSn03DWlIFc7ndmlI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A4TO2c5YJ27pFscnfWER9NfQEZ6Rg0zLWCekDuFn7QXEKzMyKnr2vmoFRCb0fKNmN ftXYm/gqB5vVd6H0IPdPso3rp5rbFG1a+socxb1I1vPj852gUP7Aa1nURuUtorDLEt C+j2MIoovl4uLpf+FAfQJloRTXbk3tLAlrCn4mGA= 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.4 085/255] net/ieee802154: reject zero-sized raw_sendmsg() Date: Mon, 24 Oct 2022 13:29:55 +0200 Message-Id: <20221024113005.332271068@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747588140792653545?= X-GMAIL-MSGID: =?utf-8?q?1747588140792653545?= 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 a92b11999e5f..72637d5994d8 100644 --- a/net/ieee802154/socket.c +++ b/net/ieee802154/socket.c @@ -252,6 +252,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 Mon Oct 24 11:29: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: 9766 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp550464wru; Mon, 24 Oct 2022 09:46:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5USZGKyYdrhmXDMKfwxoCQ7eEUiNG3iBrlLPM6HR/zgByClabXmq95HeLFX3EAoqrLA6y2 X-Received: by 2002:a63:1450:0:b0:439:3806:9b91 with SMTP id 16-20020a631450000000b0043938069b91mr28795657pgu.407.1666629966650; Mon, 24 Oct 2022 09:46:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629966; cv=none; d=google.com; s=arc-20160816; b=kuUWmTa3pyyKpPTSnuLOZtmQDwbTUf9sYYhrIhsq2MeHmM0zeC11gVtu8kD+ZkAn9Q n7s4liOQ+XICkQ84H/y2z1BTI/dWBw8pMtNFmrsOUFd8O7dAX3ZuYgPQZO7SANXPZyoO iV5IxumKgZGcftPe06VIhDZhE2ciNSwCK1e1MmpbuX4rssyE/WNlm3fihjR89qJKY+2o h0JqNOT1DaIVaV9KfEmONWyaj/4nL2ZM0rvc6txE4YA5LrZsNpE7+wP3aYCkHzcDQzNT SC5RRUEn009NiE6FJ2oLpLNLT0ZQQOFUj9/hnQbfatRO+M5JQ5xNaqjFDl6ypmTQaWD2 gDdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/qMtU9FfErMcfuHV6KSdWUQbpLshq3wQMI1OhNMaVuk=; b=x3fYfOI+n006YQi8OplXA5ZaNzl9VAfqzApPcMESBsjewf3GYGaD5ONvougWhmI3Ij 1szerYgvQ+KvLceBOmbfVO+CY0u9aqwX1mwi3Y+mA5O8fYrHRiCo2udvZiIFhq8VeHfR iaEK5UpgsQxxCvgVJVH7gKHAe8ydNh2Xz3a1o5LOSwx96cQNw0BPcFUS8JxfMDBYe0p6 tleWaMmxLTN8UudllFqvdGi+vrwHsj5VCa5yD0ku93guETii3fBM7s7hpDfGtsp/duBP ILhWskr2BvQxQF6Oc8Ltxhv6hcJ3ujLxO6oIz3co5uLj8LmYOFeNRqEsJBR2/xkac9uz QbCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b71I67uZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a628709000000b00555463cd9e6si130763pfe.238.2022.10.24.09.45.50; Mon, 24 Oct 2022 09:46: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=b71I67uZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231192AbiJXQpg (ORCPT + 99 others); Mon, 24 Oct 2022 12:45:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235080AbiJXQoV (ORCPT ); Mon, 24 Oct 2022 12:44: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 D2CA7CAE60; Mon, 24 Oct 2022 08:30: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 CD9BEB8126A; Mon, 24 Oct 2022 12:08:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D943C433C1; Mon, 24 Oct 2022 12:08:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613308; bh=yp3QlkNxcWOAnCNZsNW2yBlmfqv9Vxh39A7ZNeoK6Ts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b71I67uZjfjdz7Jg+l+G3Y7rijgVFYwsfZj+7o0TBryRE+zwDZyGwZHbGB2fL1O0Y Ln8xJN2nZN7VdS3O+qdmgq/g8PxdkDaMANTS8DO0CxQypsLeQ2plCffBJK1yns5Hwd +cSdh6GtIzaIsMi10RZn1HR5X4gutEAokpVaGung= 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.4 086/255] once: add DO_ONCE_SLOW() for sleepable contexts Date: Mon, 24 Oct 2022 13:29:56 +0200 Message-Id: <20221024113005.376059449@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747588183814529492?= X-GMAIL-MSGID: =?utf-8?q?1747588183814529492?= From: Eric Dumazet [ Upstream commit 62c07983bef9d3e78e71189441e1a470f0d1e653 ] Christophe Leroy reported a ~80ms latency spike happening at first TCP connect() time. This is because __inet_hash_connect() uses get_random_once() to populate a perturbation table which became quite big after commit 4c2c8f03a5ab ("tcp: increase source port perturb table to 2^16") get_random_once() uses DO_ONCE(), which block hard irqs for the duration of the operation. This patch adds DO_ONCE_SLOW() which uses a mutex instead of a spinlock for operations where we prefer to stay in process context. Then __inet_hash_connect() can use get_random_slow_once() to populate its perturbation table. Fixes: 4c2c8f03a5ab ("tcp: increase source port perturb table to 2^16") Fixes: 190cc82489f4 ("tcp: change source port randomizarion at connect() time") Reported-by: Christophe Leroy Link: https://lore.kernel.org/netdev/CANn89iLAEYBaoYajy0Y9UmGFff5GPxDUoG-ErVB2jDdRNQ5Tug@mail.gmail.com/T/#t Signed-off-by: Eric Dumazet Cc: Willy Tarreau Tested-by: Christophe Leroy Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- include/linux/once.h | 28 ++++++++++++++++++++++++++++ lib/once.c | 30 ++++++++++++++++++++++++++++++ net/ipv4/inet_hashtables.c | 4 ++-- 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/include/linux/once.h b/include/linux/once.h index ae6f4eb41cbe..bb58e1c3aa03 100644 --- a/include/linux/once.h +++ b/include/linux/once.h @@ -5,10 +5,18 @@ #include #include +/* Helpers used from arbitrary contexts. + * Hard irqs are blocked, be cautious. + */ bool __do_once_start(bool *done, unsigned long *flags); void __do_once_done(bool *done, struct static_key_true *once_key, unsigned long *flags, struct module *mod); +/* Variant for process contexts only. */ +bool __do_once_slow_start(bool *done); +void __do_once_slow_done(bool *done, struct static_key_true *once_key, + struct module *mod); + /* Call a function exactly once. The idea of DO_ONCE() is to perform * a function call such as initialization of random seeds, etc, only * once, where DO_ONCE() can live in the fast-path. After @func has @@ -52,9 +60,29 @@ void __do_once_done(bool *done, struct static_key_true *once_key, ___ret; \ }) +/* Variant of DO_ONCE() for process/sleepable contexts. */ +#define DO_ONCE_SLOW(func, ...) \ + ({ \ + bool ___ret = false; \ + static bool __section(".data.once") ___done = false; \ + static DEFINE_STATIC_KEY_TRUE(___once_key); \ + if (static_branch_unlikely(&___once_key)) { \ + ___ret = __do_once_slow_start(&___done); \ + if (unlikely(___ret)) { \ + func(__VA_ARGS__); \ + __do_once_slow_done(&___done, &___once_key, \ + THIS_MODULE); \ + } \ + } \ + ___ret; \ + }) + #define get_random_once(buf, nbytes) \ DO_ONCE(get_random_bytes, (buf), (nbytes)) #define get_random_once_wait(buf, nbytes) \ DO_ONCE(get_random_bytes_wait, (buf), (nbytes)) \ +#define get_random_slow_once(buf, nbytes) \ + DO_ONCE_SLOW(get_random_bytes, (buf), (nbytes)) + #endif /* _LINUX_ONCE_H */ diff --git a/lib/once.c b/lib/once.c index 59149bf3bfb4..351f66aad310 100644 --- a/lib/once.c +++ b/lib/once.c @@ -66,3 +66,33 @@ void __do_once_done(bool *done, struct static_key_true *once_key, once_disable_jump(once_key, mod); } EXPORT_SYMBOL(__do_once_done); + +static DEFINE_MUTEX(once_mutex); + +bool __do_once_slow_start(bool *done) + __acquires(once_mutex) +{ + mutex_lock(&once_mutex); + if (*done) { + mutex_unlock(&once_mutex); + /* Keep sparse happy by restoring an even lock count on + * this mutex. In case we return here, we don't call into + * __do_once_done but return early in the DO_ONCE_SLOW() macro. + */ + __acquire(once_mutex); + return false; + } + + return true; +} +EXPORT_SYMBOL(__do_once_slow_start); + +void __do_once_slow_done(bool *done, struct static_key_true *once_key, + struct module *mod) + __releases(once_mutex) +{ + *done = true; + mutex_unlock(&once_mutex); + once_disable_jump(once_key, mod); +} +EXPORT_SYMBOL(__do_once_slow_done); diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index d9bee15e36a5..bd3d9ad78e56 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c @@ -725,8 +725,8 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row, if (likely(remaining > 1)) remaining &= ~1U; - net_get_random_once(table_perturb, - INET_TABLE_PERTURB_SIZE * sizeof(*table_perturb)); + get_random_slow_once(table_perturb, + INET_TABLE_PERTURB_SIZE * sizeof(*table_perturb)); index = port_offset & (INET_TABLE_PERTURB_SIZE - 1); offset = READ_ONCE(table_perturb[index]) + (port_offset >> 32); From patchwork Mon Oct 24 11:29:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8934 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434937wru; Mon, 24 Oct 2022 05:53:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4grNL8g2wWDlVz21Ze9e2+Y1lUd8/nFAMTF0fMifz9a/yKE8CfTtOmIUJjwn/KtL2wp4SQ X-Received: by 2002:a17:907:60c7:b0:78e:1cc:57de with SMTP id hv7-20020a17090760c700b0078e01cc57demr27591367ejc.33.1666615999224; Mon, 24 Oct 2022 05:53:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615999; cv=none; d=google.com; s=arc-20160816; b=RmVeLu62+zf+c75xBQmEes8sH/3fyyNJ8eEai4byWnybJAtfu2CaNNzBQQOKZ3hR11 zwnvniX9zOGgCDzEetnNKHHFjlTLTQG7gEPViE4eCGmKhSY3XAl+daZ5RJ/mJH0aGVkJ BUPOumWHfSu8tO4fAx4n66NIxSNvqgnN5bmMNpUbZhDpEGRzULvo0uvk9vRai7jvCQ/j Ga1oEILpDB9tMrDUW0KfoyDU92tQF8aibgLxnqN8PsTHm2gMN9Jj2qkii5OdOqQkcUdX k+NKFAifx6hSflGdTwUr7zoat9C5qpeAImh54zvgTiKTfVQ2WSDpBbLwc5EEzmIdtdAP ug0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FwNwffmfXG4rAXHzEVsVtR2QZzOG8c6TNXCZg0MFf5U=; b=RezmIpbkrqAKdzHVkyJ2ED4aEIr/oXOmI1ilUzigP3RO/OcELVu338ywVym1GxtzI9 It3+RSDkFjYhUxcfXJ9e/MfcJ9tFup0TphfgQ3nA+8ichUe9wkPTAkY1qI89r72n/6vG FfUAUdDB5JhETookO4GlWSAgRk3Sm71v6NiiDAzRWMVBD3xUFJHoOnKBfN9pBOzObvK4 nghJK9lTBirKLM8ZGr3oxYSAUkF1veZGDBzQFJjYs/tXMJwBqk5J3xTCU4EwiZkWiMiQ l9XgDcZtuXX/fkud/BjcxX3UnZ5WzUqRzbGGzKPr5rMPXrUFpFcVCHZY0nGbqtJQWxbu 1ORQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dZleLuhD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb13-20020a1709071c8d00b0078b88453306si31543214ejc.285.2022.10.24.05.52.55; Mon, 24 Oct 2022 05:53: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=dZleLuhD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234202AbiJXMwA (ORCPT + 99 others); Mon, 24 Oct 2022 08:52:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234823AbiJXMpt (ORCPT ); Mon, 24 Oct 2022 08:45: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 E8C2F6557D; Mon, 24 Oct 2022 05:10: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 7987761252; Mon, 24 Oct 2022 12:10:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82EEFC433C1; Mon, 24 Oct 2022 12:10:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613413; bh=IpTc00b1WooAfUaExUTL18xyD+b8NPRY2MQZns4Lg+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dZleLuhDwZqjp8RHojkJyupNK/H+KkQDGb1C3B2miGlTlbZQQ1fh/sEopssc/8ZTf b5M7sV2FhMcCvKdXtRtQQIC6CDKWRfM5M24xlvltTgqBbpT+MUzEJSJOSTntC7iry3 gb0jk6Kr1wd8eIVv/78NP55GiPYSQFtHcql6NZ1A= 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.4 087/255] net: mvpp2: fix mvpp2 debugfs leak Date: Mon, 24 Oct 2022 13:29:57 +0200 Message-Id: <20221024113005.405586497@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573538178644909?= X-GMAIL-MSGID: =?utf-8?q?1747573538178644909?= 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 543a310ec102..cf45b9210c15 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h @@ -1202,5 +1202,6 @@ 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); #endif 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 d700f1b5a4bf..31dde6fbdbdc 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -6004,7 +6004,18 @@ static struct platform_driver mvpp2_driver = { }, }; -module_platform_driver(mvpp2_driver); +static int __init mvpp2_driver_init(void) +{ + return platform_driver_register(&mvpp2_driver); +} +module_init(mvpp2_driver_init); + +static void __exit mvpp2_driver_exit(void) +{ + platform_driver_unregister(&mvpp2_driver); + mvpp2_dbgfs_exit(); +} +module_exit(mvpp2_driver_exit); MODULE_DESCRIPTION("Marvell PPv2 Ethernet Driver - www.marvell.com"); MODULE_AUTHOR("Marcin Wojtas "); From patchwork Mon Oct 24 11:29: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: 9757 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp549997wru; Mon, 24 Oct 2022 09:45:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5OsCVdELsCAq3ZmmEdpawEPeanX1wrIAYXWhfr6MRJcCBmls2vPMoSjRuVZb0nQ4bY5cL7 X-Received: by 2002:a05:6a00:198e:b0:566:9207:d340 with SMTP id d14-20020a056a00198e00b005669207d340mr34503388pfl.83.1666629907084; Mon, 24 Oct 2022 09:45:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629907; cv=none; d=google.com; s=arc-20160816; b=nkZtuCXN7h4kYNAJqYy34VZAM7HnDgR9lID8gt2dUWME92dVKeht+XdzR0I4wAc4fW rUNbPDQ449hn9Y+TNGYtdsOQZxxfJPRB2M+iT94uCnmL+scpIn9o+AU/TPySqcmnwTTd 982ruC6BxTi8EoDo5JkQoRujArKmiBcn/0oaFzVMO6RZkv0AGc2R33hQsXVIR99Bv30z 9qDLx/rrvH2bGqpsFZZY6HWq1Y/subBa8jcQgLovmB+nY18sVFKkJyPSDtgTCFx3TLY5 f+rTkhNIYh0+rSkWECicMTrgGNAaTee8twxwqB46LByfeBw9N7M0RDV0B8MvZiU7oLNT VGXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aoUpr8o+yCdGxI9TZvGazo4BOMwWp77+8Pa8KPPcqDE=; b=RrTDa8eHaGfcFGOUG3s/qXSuU6htNwBAL754Qun1UEBVmPIVTVWNV65biG3CCBxIOV YYZP1YCsPKt1MgZ0099mBJUElbz/fN0WoCukAaVukqGHIE6pgRK3d5xmVp/Vs0Olx349 gz3KorixbcpipTYBjhYbnCh5Me+CAWtQxiwqcHniH82SPrEjInDMcnx9FX6hgCsMJapE q0fagujsb9XSXMZCD4Z7vv932rxWyYlqCt+UxMB/QfKhdCXHdoHNRV0G3cRM1GBN4EjY Ngk6px4OOwhiX57wpITbB2C41zduFpto7f5YCE0NBk95kcBixrYnNPfhK57MsepzLhS9 /zRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qiSpsSRi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a6287c1000000b0056391cc1e6asi78734pfe.354.2022.10.24.09.44.53; Mon, 24 Oct 2022 09:45: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=qiSpsSRi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234704AbiJXQoh (ORCPT + 99 others); Mon, 24 Oct 2022 12:44:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234819AbiJXQn4 (ORCPT ); Mon, 24 Oct 2022 12:43:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39ADF72857; Mon, 24 Oct 2022 08:30: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 04555B81135; Mon, 24 Oct 2022 12:08:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5016CC433C1; Mon, 24 Oct 2022 12:08:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613329; bh=34rtLmGZAXqTGiRi43XeZcJKLD8da60agJA5dgZICh0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qiSpsSRi30TFG0i29SmA1l8bPYMGWP9G791VZBqQOanoLmjPpwx7Nx1XT5bVMY2Vk eLpFISmBDQouXeTbjrqloNrvn4SmCNJ2upokAlRRMWuyCh71J4tig/SNWbWgoKzTzF WAtP4QnoFlycitzKaf0cMW+ihTyd7QPGvTCxTZFo= 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.4 088/255] drm: bridge: adv7511: fix CEC power down control register offset Date: Mon, 24 Oct 2022 13:29:58 +0200 Message-Id: <20221024113005.440362867@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747588121457280201?= X-GMAIL-MSGID: =?utf-8?q?1747588121457280201?= 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 52b2adfdc877..90a721226231 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511.h +++ b/drivers/gpu/drm/bridge/adv7511/adv7511.h @@ -384,10 +384,7 @@ void adv7511_cec_irq_process(struct adv7511 *adv7511, unsigned int irq1); #else static inline int adv7511_cec_init(struct device *dev, struct adv7511 *adv7511) { - unsigned int offset = adv7511->type == ADV7533 ? - ADV7533_REG_CEC_OFFSET : 0; - - regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL + offset, + regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL, ADV7511_CEC_CTRL_POWER_DOWN); return 0; } diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_cec.c b/drivers/gpu/drm/bridge/adv7511/adv7511_cec.c index a20a45c0b353..ddd1305b82b2 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_cec.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_cec.c @@ -316,7 +316,7 @@ int adv7511_cec_init(struct device *dev, struct adv7511 *adv7511) goto err_cec_alloc; } - regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL + offset, 0); + regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL, 0); /* cec soft reset */ regmap_write(adv7511->regmap_cec, ADV7511_REG_CEC_SOFT_RESET + offset, 0x01); @@ -343,7 +343,7 @@ int adv7511_cec_init(struct device *dev, struct adv7511 *adv7511) dev_info(dev, "Initializing CEC failed with error %d, disabling CEC\n", ret); err_cec_parse_dt: - regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL + offset, + regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL, ADV7511_CEC_CTRL_POWER_DOWN); return ret == -EPROBE_DEFER ? ret : 0; } From patchwork Mon Oct 24 11:29:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8919 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434439wru; Mon, 24 Oct 2022 05:52:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6TNt7ESR4haet8zjyAXz8oJ8SJl9ZdHL7MYg8W1InVuxe5FyRXoXm5o2ovM1iCJr5AwTvn X-Received: by 2002:a17:907:6e28:b0:7a0:b6b5:5103 with SMTP id sd40-20020a1709076e2800b007a0b6b55103mr10538413ejc.300.1666615934844; Mon, 24 Oct 2022 05:52:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615934; cv=none; d=google.com; s=arc-20160816; b=Gt9+RXgKc+tzjsiu8gceX7nzuCcDQuS7NRdSNR3w6sdHXqNIdqrEgWkHvHU3JxHz/P aL8EvI/a9me3PRO9PG3Ol+wtYSrz7+UIOtMkN/1FNeQz/5jw+S9/KlZ2MUMS8TfWDptz K5PQT3qVsVDcnKuqWCeQow0gGI9pmK1s9/AAIB2gDbs0uwLOFPUxuEgLNAIbEg83xpWx juU0XVC6fqm9nbM38jwtJEKC+FLzxTJL/iSSKuUnNTL6Owe+BLObBOKXdv1u5QiijKQV t42K54X7oe25SnMJMArmVBJNpsFm1QF3XjNUhuSePDUlgwUI9815opyfOcUSxCf3CQri WuzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kAQb9ekc3d8UMEQYMykHkGtIWui57GxV1zTxt9g336k=; b=r/o+CxeBOBvUhB8X+Ripr9sCbaD+blHMdfnXpsuqQEc5L1wHhSruRoofI25FHKA0zM 2TTmerTwUsUCnFozZp3vLoNJH3NtNLkOxihCtFK3jRRrBlBWaOkr1dLn38CYksdcd5C9 iMWPLbzikFk3Zhg6BmpNnvS7QqTRsRTgEY6eQd4EPo8yC82N1nVxRRw3fHnf/Kwoe3P1 H2WepGzt6TJCqv9ZD/QD4iRDPR8JkErzOTlQswyPK6djGx0CjVXHb/VnD44m8fZ8SQas /CLp5OdAfMdDKYIsOB02teDN1Bn7WHC9pLqjingVga87Dz/rsJGKRHwQuN+ILxsErvtK a3Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Qs3fhHrd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw22-20020a1709066a1600b0078dcf11ccf7si27152071ejc.802.2022.10.24.05.51.48; Mon, 24 Oct 2022 05:52: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=Qs3fhHrd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234377AbiJXMum (ORCPT + 99 others); Mon, 24 Oct 2022 08:50:42 -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 S234627AbiJXMpW (ORCPT ); Mon, 24 Oct 2022 08:45: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 7768E31DEA; Mon, 24 Oct 2022 05:09: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 37E4361218; Mon, 24 Oct 2022 12:09:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A721C433D6; Mon, 24 Oct 2022 12:09:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613358; bh=ne2UJ6vabJsh3Q1TxGPkJc9EVVF+3J1pryip5BHrUoI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qs3fhHrdrGU0Dxe57ORM65fSntl19kX264q3ijLzYiTyufiq8YWlTEQeRzciK2Omi ZA6zhgjyW+wfXFT/DOr+tmL/PwePINz+UzYNH6/DL3scB4oq24a06v61gsI0h+ANCE xNuxCOkcoDmLLeCwCPm8Gn4xlRKRtZYul4aftNk8= 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.4 089/255] drm/mipi-dsi: Detach devices when removing the host Date: Mon, 24 Oct 2022 13:29:59 +0200 Message-Id: <20221024113005.468986382@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573470326974270?= X-GMAIL-MSGID: =?utf-8?q?1747573470326974270?= 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 b99f96dcc6f1..bb7f72ade628 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c @@ -300,6 +300,7 @@ static int mipi_dsi_remove_device_fn(struct device *dev, void *priv) { struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev); + mipi_dsi_detach(dsi); mipi_dsi_device_unregister(dsi); return 0; From patchwork Mon Oct 24 11:30: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: 8931 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434804wru; Mon, 24 Oct 2022 05:53:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6PGs1H3uFI84Hm6rHuZyKVE+uZMGdl0Xpj6cGp4DE5M1bEU+8a5p8HVW1qsXlt4NDH16zl X-Received: by 2002:a17:907:968b:b0:78d:f5c2:70d8 with SMTP id hd11-20020a170907968b00b0078df5c270d8mr26790890ejc.564.1666615981232; Mon, 24 Oct 2022 05:53:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615981; cv=none; d=google.com; s=arc-20160816; b=abR7GDUFYF14vBXl8luV2KX8zJIWdhdZEXXHqHI+yjEaTkgNXHz/11pLkM3S3tJwgD izKvRpe/B8ORAAx4HJX6Oyx7kI/kRn8/Ox+pVSdvrMdfqnfLSe2zXz7YG1cnBLzuMg8X 0H2Dd4E9k8fQWykvG0IBe+CDT2Vp4B6Mu3GgtDaOf8tbciriWdEZXtlgqBn9h5YkSzfo bPBELkSiGb3Y2qsQaOtA01QWxRoHbXAeCxitljRKbPXMpmatfeJ5hMvDGyOA8Pf0fl9W Ir5geEqRzRVRik3/NQ33EYVKnSQGsBsgLtxgc/7J5ViL/YNtwuocs3ZLmb/skI3IN9dh /2Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ONJ2gE8328C0XgDQX1kBLZMQp3rhNem3u35wWARvZ/A=; b=t1VSgJ7GNPecGLO4+xsXZsH3L3lomH99eIKxz/FNq7pUWT9zp6NpHA4dvYsNKFMXwj AB7W3Zvj2phnFvgizmyw/qqNzfE9iaUrw2amlJpAQfLzpurG228BmiL/78ZrGvKGpGnO HKRopJEtFT+8NH0KRIOkHy8TsxiKAnTMi7ztEAQpQU+6S/PAWUubYYEDW2cnpvkVjrh0 qFYWEWQ0o6hFc0GtkDA+N1S3IzetDslGnll5aWK/q7eLSShT6lhY6u+X2F8vhbEB7B+V M2Rb5BOcA7MA6ugdtoYJItfR7AGYL0AmsWP1BmSSOqv/YYOWvFOrJROzxDGrq7DR6okq Bqsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k6Wreb9I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090699c300b0078e254ae43fsi30704228ejn.787.2022.10.24.05.52.36; Mon, 24 Oct 2022 05:53: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=k6Wreb9I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234564AbiJXMvn (ORCPT + 99 others); Mon, 24 Oct 2022 08:51:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234741AbiJXMpg (ORCPT ); Mon, 24 Oct 2022 08:45:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E89318B31; Mon, 24 Oct 2022 05:10: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 455496129E; Mon, 24 Oct 2022 12:09:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 515B7C433C1; Mon, 24 Oct 2022 12:09:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613387; bh=/46bcVhFzcjZWnoY6JgoprBlN42KkvWIVoF7PtLK2+U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k6Wreb9Ix+w620h6b9/mN7qw6XsblKYvE4bYRy4JYpo1uHJ/SmjAXilvy+zehpPfb crQFY43NYIIl1m6elasbMjsiYb76hoVFYu5B6SZeLqZiEtkMmF4D8m375+GpEN5jAB KqC4KxqOrgbKAPNSEuo8FiUdHuIuV3Kv4QzgBMn8= 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.4 090/255] platform/chrome: fix double-free in chromeos_laptop_prepare() Date: Mon, 24 Oct 2022 13:30:00 +0200 Message-Id: <20221024113005.498169773@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573519011941415?= X-GMAIL-MSGID: =?utf-8?q?1747573519011941415?= 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 8723bcf10c93..954953133d56 100644 --- a/drivers/platform/chrome/chromeos_laptop.c +++ b/drivers/platform/chrome/chromeos_laptop.c @@ -716,6 +716,7 @@ static int __init chromeos_laptop_prepare_i2c_peripherals(struct chromeos_laptop *cros_laptop, const struct chromeos_laptop *src) { + struct i2c_peripheral *i2c_peripherals; struct i2c_peripheral *i2c_dev; struct i2c_board_info *info; int i; @@ -724,17 +725,15 @@ chromeos_laptop_prepare_i2c_peripherals(struct chromeos_laptop *cros_laptop, if (!src->num_i2c_peripherals) return 0; - cros_laptop->i2c_peripherals = kmemdup(src->i2c_peripherals, - src->num_i2c_peripherals * - sizeof(*src->i2c_peripherals), - GFP_KERNEL); - if (!cros_laptop->i2c_peripherals) + i2c_peripherals = kmemdup(src->i2c_peripherals, + src->num_i2c_peripherals * + sizeof(*src->i2c_peripherals), + GFP_KERNEL); + if (!i2c_peripherals) return -ENOMEM; - cros_laptop->num_i2c_peripherals = src->num_i2c_peripherals; - - for (i = 0; i < cros_laptop->num_i2c_peripherals; i++) { - i2c_dev = &cros_laptop->i2c_peripherals[i]; + for (i = 0; i < src->num_i2c_peripherals; i++) { + i2c_dev = &i2c_peripherals[i]; info = &i2c_dev->board_info; error = chromeos_laptop_setup_irq(i2c_dev); @@ -752,16 +751,19 @@ chromeos_laptop_prepare_i2c_peripherals(struct chromeos_laptop *cros_laptop, } } + cros_laptop->i2c_peripherals = i2c_peripherals; + cros_laptop->num_i2c_peripherals = src->num_i2c_peripherals; + return 0; err_out: while (--i >= 0) { - i2c_dev = &cros_laptop->i2c_peripherals[i]; + i2c_dev = &i2c_peripherals[i]; info = &i2c_dev->board_info; if (info->properties) property_entries_free(info->properties); } - kfree(cros_laptop->i2c_peripherals); + kfree(i2c_peripherals); return error; } From patchwork Mon Oct 24 11:30: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: 8936 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp435002wru; Mon, 24 Oct 2022 05:53:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM71hvmnvqCXH0hv/19ojfWEEapSBovwCF/yiXvB184wBsqrNbyrDGIRbMSfrN5n8jxV23D0 X-Received: by 2002:a17:907:3d91:b0:78e:11cc:3bc7 with SMTP id he17-20020a1709073d9100b0078e11cc3bc7mr27606039ejc.655.1666616008373; Mon, 24 Oct 2022 05:53:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616008; cv=none; d=google.com; s=arc-20160816; b=xpmnhkpO68pdN7d7jAG4LbxFPVpghzDizGKkq0lfYNA1LEP/0PVkX7rEcZ2GbyBJNs MPEb7U+XaJ4NknZoHU0VgSxSGZmaj+3y2vHBHchFyGpLziUkdxj7a9rk5QjSZbuwVXdO UMBd3mUstXlL6qtLF9DMP76H5Mc9RrGeKRz+oj8nktouflgwdyR7lFb4GG9WyQwAn6JF GxKbTNPAQVHzWDC5axBgqeR600qDxn3kQWZPU+9IjkFkJJKxPRjtYSeJK+KkPd2qY3WU 4aPdQ9VRteNnPkCsGEFqSbigFE7hrq9DFvBOaPOE4F5wEtnCU1HWJxGsMRLT9UzWnc14 B4zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/csJDqmCeT0TSNlaMlarojsPi8f4jlNdRTYmo9/D3jQ=; b=iaYEBRzXQ7EyrxBOMy+VwGIsbc1k7Uoe97WgoDCOkrDvPesM+l1mglb2K3uhoX+sp6 +3jddWqIkYE1kD7lwiwv6MHnxpx5S8EXbpfPG75uJCaSF1lAaOIWIz67xo4VHZdpl/mV LBfu/4No5HfEsgANNnxBCJZFzxh7YzVTeUTzCf5pxZjvRc+eYd+sZw3vysRbgjt0W+lw TbQvn0Y+8Wp5OvB3zyZIRWV3OcbxrnOSQrEvkfgJXNA50ME0Bvg7jjVAImbmWrtD+U9u Iz6qI7DGykMk8rJIH4BVrgQBELffcubEy981liLWgio5nl8Fj5vl3zetVpXaVy6UMepR wcbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lZaQS7xd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb21-20020a1709071c9500b0078049ab4bbasi28802641ejc.526.2022.10.24.05.53.03; Mon, 24 Oct 2022 05:53: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=lZaQS7xd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234625AbiJXMwM (ORCPT + 99 others); Mon, 24 Oct 2022 08:52:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234842AbiJXMpw (ORCPT ); Mon, 24 Oct 2022 08:45:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A67A24BA55; Mon, 24 Oct 2022 05:10: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 BC40661280; Mon, 24 Oct 2022 12:09:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4108C433C1; Mon, 24 Oct 2022 12:09:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613398; bh=Bi/jTu3vv3ASwo99EidjsRPHNNx3PdUduh5fUYjNiGY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lZaQS7xdINCFy3cGfWMrectNkc/JeuHMSr5vrRaIiOCJFaCSAJydjWG1RgIjfRj5Y PwEYebEtHrQr5IUM+7B3nIvPT+0S0MiFa7qDuN+hdiKu+XJ0d/mvAxNHXJbT1uKLD7 ZSUFAQkFj4JPm8IZqkW7qBbtY1/Ms70eSbX6gZ/U= 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.4 091/255] platform/chrome: fix memory corruption in ioctl Date: Mon, 24 Oct 2022 13:30:01 +0200 Message-Id: <20221024113005.527640362@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573547594493085?= X-GMAIL-MSGID: =?utf-8?q?1747573547594493085?= 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 74ded441bb50..1f5f4a46ab74 100644 --- a/drivers/platform/chrome/cros_ec_chardev.c +++ b/drivers/platform/chrome/cros_ec_chardev.c @@ -328,6 +328,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 Mon Oct 24 11:30:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9009 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp440690wru; Mon, 24 Oct 2022 06:04:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM52uprqn8bsQ0bJP1cH8jHSvL/w4ZkBWvf27wXGKal6Qmt1Gq4dQHf2mVzJu9oE9LSd9NqN X-Received: by 2002:a17:90b:2803:b0:210:3b5e:62eb with SMTP id qb3-20020a17090b280300b002103b5e62ebmr30136400pjb.95.1666616670310; Mon, 24 Oct 2022 06:04:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616670; cv=none; d=google.com; s=arc-20160816; b=Aae6h9cJd6h3QmD5Xmb2Alq29II0fc1E1tVxJ6zgJ3X1CRkYUhXN7ew1uH2oNl3BKv YCQ648dK4GDNPHrEm/vh28tLGoojr1OjHl4jxrysGspjjt3O8F4dsItUG+s+MxOd9YPt SsQSx8wRAWf872yDnCq2cUtxOeF13tLp8sXSRJoGknYcf2vNWy8+EYMvmmn2DwTDj+MH G9WevhDjMfSrDyfJ4ulxpFU/4CXNU4Cy5cQggRD4AX8x8RtjB5wE4TxsW87brrEUXPQp XXPEkkMNswmrzdr3OEPMUt8+g6nPcnmip+Ce8Vpdu0gkY39Rn2otmNsVWZUh9OnhT8Ln +x8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=NUVZHQrIrCpGMGwAu6lgP4c0WirJ8wTIQpdn0wruazc+F0bHg+ol8grZNvyVVNJ63k x2nN7glLbf4wZNs7yqzQ9DxHMNHCI+ZCoZdKUbzwODOwwo0F4Ghy1a6qz+rDYF1/qER5 GzIAxGuRlCs2kpD/zs1y4bJOP3/vRJGVNPX1xxJ4gWiMXCkXK4hx3lOOHOWTrgJDwo3w uXKZU4jy4UsHLDQn+32Gm+xgF/vecftjSw0ze2gurGIWV2hnwO8LjT2kUHMyTpA+7m3t Q187M0xSs9l/YHYOwsl869D+yfhkvkGZFewi+DTtI7ocl5KAg0H74gW4dmUANXaHdosw u3qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="N/sVcOid"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090b33d200b00209a3e49f63si9576871pjb.94.2022.10.24.06.03.36; Mon, 24 Oct 2022 06:04: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="N/sVcOid"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235172AbiJXNC7 (ORCPT + 99 others); Mon, 24 Oct 2022 09:02:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235212AbiJXM7j (ORCPT ); Mon, 24 Oct 2022 08:59: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 4E1289AFAC; Mon, 24 Oct 2022 05:19: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 6726261281; Mon, 24 Oct 2022 12:10:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7842CC433D6; Mon, 24 Oct 2022 12:10:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613400; bh=zT6MDUv1/e0ceaKhgr+62ulahZ4sloOaOytnAgt472Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N/sVcOidM1moFKEGs80QigbJ0Y4hbXDkmdIS+kCvSSpdPp3YM0QIytf/VaB00cGjg Tx8Ka6LsPlts9aGIM4gQc7n3wK7wbPd5enpks/F+0+O6HuCR5NXbpapeYDNAuYzsnH MeF8Kx8Z7LCtzmvOx0RuX4v3XxP5CJZo1qNGbvQM= 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.4 092/255] platform/x86: msi-laptop: Fix old-ec check for backlight registering Date: Mon, 24 Oct 2022 13:30:02 +0200 Message-Id: <20221024113005.556081298@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574242093060825?= X-GMAIL-MSGID: =?utf-8?q?1747574242093060825?= 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 Mon Oct 24 11:30:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9145 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457543wru; Mon, 24 Oct 2022 06:36:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5/uf9+71v1PgSkAYSdUY2wqjovZz+78paE6Bg035v5QEAxjTy7zmp4e441AZhGX0L8O5GI X-Received: by 2002:a17:907:8a1c:b0:78d:ef44:7759 with SMTP id sc28-20020a1709078a1c00b0078def447759mr28351507ejc.441.1666618569650; Mon, 24 Oct 2022 06:36:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618569; cv=none; d=google.com; s=arc-20160816; b=nr/WdVStAB2zZ7Ri0B5dDHfHjNHUD5nADVC4a39wHOm0Wh9IKWCtHV+yhkKTAZPnKg j/BTqYSrPPmmObv1GlGC4KoT51UPNgaNXiXgGU+m7h44/tp4zyflJqUFxCcg3IZ5V3yo xZw73DtejMRShSruVvgJVV9uuF2vndOa8rB1Eqc+W9m1mYRTpUl0BuNljWA6wC67GfeK VjP9xphNu+EMVbLio7fHNhA5AOhnaAB4MBlqrpMlJ9AFeSLoaY7r4dWK11NLTAhBsSWs oqAGwmdJzzkhdopdbyqHzT1aDCM7rh9u2q2il1QRqp22dFCVhIQlhXy8wJVVG51AoU3n yXBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=vMawnvniwQxu6wfr80VnaBdDxw/RBnpFJm47SwavRTZBjbRK7Zsf71ifak6r2YkzYU Gedlr/ceVbQG8F8pAf+PBvuhQRDdw/yQRBgyR/koF9uVhKCaQuciPqO5U6Cm1M+6qkTs yyduBqtMuDp4UFVcB4d3/iiK4UVp0yv1ynnKKmoDhh6sXRg3Nka1WML5lFOMYRDrIIwA TNhg5vIzCPpypabtCNlcUBcgf+j/dJmiMSo5phpmPQ5qQr8NqYkZFi82Uuk50NAQ/8cZ QVLVyxNPaLvuXBLIdSPnMW0q4qpZ3gRNjs6Z9o+TZZ7jiQz3TeFXYByaNDh7voFkwb36 zIWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2WdqA9pp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs17-20020a1709072d1100b0078d27c1b499si34905902ejc.500.2022.10.24.06.35.26; Mon, 24 Oct 2022 06:36:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2WdqA9pp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232659AbiJXNVb (ORCPT + 99 others); Mon, 24 Oct 2022 09:21:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236377AbiJXNUR (ORCPT ); Mon, 24 Oct 2022 09:20: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 CB72384E65; Mon, 24 Oct 2022 05:28: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 B0B40B815AC; Mon, 24 Oct 2022 12:10:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11D41C433C1; Mon, 24 Oct 2022 12:10:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613403; bh=LMiQSmINL+WpJ+Efxa9vMNxwvWoH4bT4QVIx9zBBdls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2WdqA9ppt+2yCOZfja4F/sCCZ/fu3lcDyj6qC4WrcoYbk0+4KXRfQaXlS3AHHdTC5 HSOS6vYkWES/A8WtLMH0t9K9sgitwxYj4v6x/qADmhnY9F37xYuPxempTKYS5fmWfw sNNRWjYJd4lpyICEC5UHesZJijUkBXH6LZY0IOko= 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.4 093/255] platform/x86: msi-laptop: Fix resource cleanup Date: Mon, 24 Oct 2022 13:30:03 +0200 Message-Id: <20221024113005.585622506@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576233228700633?= X-GMAIL-MSGID: =?utf-8?q?1747576233228700633?= 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 Mon Oct 24 11:30:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8929 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434787wru; Mon, 24 Oct 2022 05:52:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6KmnA9X2h3pa9cZzm+uZJ8I3QVDcwPRpndr8AWmkTe9gZ1LqJbmo7WKAf5EWwO8lZdJnR3 X-Received: by 2002:a17:907:7f25:b0:7aa:acf9:c07e with SMTP id qf37-20020a1709077f2500b007aaacf9c07emr1169460ejc.280.1666615978455; Mon, 24 Oct 2022 05:52:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615978; cv=none; d=google.com; s=arc-20160816; b=BHmuZtqvxdciW+XFjnzZnpPWXDNao6mrqw9lVj8wgg5Iv7TZbxUGTIz7qfhVo9NVx0 9jKtpeExfOQaHm4I1cxzEO2KTxRkgknpJfy6Ft8/H5iofSbjzuOVGfJblOLHlIUg0RCx WtEAtoc3rfFi+CJvbNuYtS5CtZqxSFf7+XPS0K/fFRXXXewMf1MZjq6Ir2EzZEunRFzN Q4+iONcHwDwU/ymiH6e78dob/oyK5ArdGmZeXnJwXB/zeMF4Q+RVu7ACP8qjOnWviTLz suvXx9UPbVueSdnVI/smAJpAL3YOdqLu3YDD7SqYQ+QGOCR+km0/vHIzw0b+nd/DUq2d b7WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LPvFlrzBtK5yB5NinsDUc9jjOGQj5OP0sSrV1iH8pJM=; b=QYnuiMl4BtkrBCbn5oQmmGY+1W6oDQXq0Ug2z7dOdOtLDDb91pd0/2C5F46sQFXkLp Q1sX+tPgyjxNwzuROQZnc4qSzLsZP1xU4rMT7KlAlP6g2TlWwhCuP64oyAtZvyd5pd/m g2GeBWmECG75da9s5HvaHHd2T801DeOQmqrGUtxbGkUfu0X0xvGZwm0l6APH/Kf2l0qi ih1PNHwbzq+zVwwc7xsF2qt7IbbHT/D6tUxfYjUcxFERXww1Mwgv6MIJEuZm2a4uM85g fR0F3FPCdk2J4vLN4KmG6tHiagPvdDy/fkbhiL6w5CQfCJ8FkpoKCsGN9a9e2cqOAGls N7NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=djZmvVh+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090658ce00b007a6ae47c314si4503961ejs.539.2022.10.24.05.52.32; Mon, 24 Oct 2022 05:52: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=djZmvVh+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234511AbiJXMvc (ORCPT + 99 others); Mon, 24 Oct 2022 08:51:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234737AbiJXMpf (ORCPT ); Mon, 24 Oct 2022 08:45: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 42F7758B46; Mon, 24 Oct 2022 05:10: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 9D9966128E; Mon, 24 Oct 2022 12:10:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87ED6C433D7; Mon, 24 Oct 2022 12:10:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613406; bh=FW2NvzB1JvQFsKGrSBo35+KBXe7fSEbV76DQZwXfYnQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=djZmvVh+OUwK9MZgvhOEqgePV3IJUPxUI7JlKVdWLQ5XmmEgFXdGiH8ulbtpLFmRV XOGrfxYPpg6+yzqiuIfveHmJ2Bobe75jrJgWdMHO6FGoJ5B9gfWYXJ3wIoUw/Qe1Ar YKN/an5ekYgQis4E+PfsN20i+3yMwktWDr0+4CVc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , kernel test robot , Dillon Min , Linus Walleij , Sam Ravnborg , =?utf-8?q?Noralf_Tr=C3=B8nnes?= , Thomas Zimmermann , Thierry Reding , dri-devel@lists.freedesktop.org, David Airlie , Daniel Vetter , Sasha Levin Subject: [PATCH 5.4 094/255] drm: fix drm_mipi_dbi build errors Date: Mon, 24 Oct 2022 13:30:04 +0200 Message-Id: <20221024113005.616180416@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573515890721349?= X-GMAIL-MSGID: =?utf-8?q?1747573515890721349?= From: Randy Dunlap [ Upstream commit eb7de496451bd969e203f02f66585131228ba4ae ] drm_mipi_dbi needs lots of DRM_KMS_HELPER support, so select that Kconfig symbol like it is done is most other uses, and the way that it was before MIPS_DBI was moved from tinydrm to its core location. Fixes these build errors: ld: drivers/gpu/drm/drm_mipi_dbi.o: in function `mipi_dbi_buf_copy': drivers/gpu/drm/drm_mipi_dbi.c:205: undefined reference to `drm_gem_fb_get_obj' ld: drivers/gpu/drm/drm_mipi_dbi.c:211: undefined reference to `drm_gem_fb_begin_cpu_access' ld: drivers/gpu/drm/drm_mipi_dbi.c:215: undefined reference to `drm_gem_fb_vmap' ld: drivers/gpu/drm/drm_mipi_dbi.c:222: undefined reference to `drm_fb_swab' ld: drivers/gpu/drm/drm_mipi_dbi.c:224: undefined reference to `drm_fb_memcpy' ld: drivers/gpu/drm/drm_mipi_dbi.c:227: undefined reference to `drm_fb_xrgb8888_to_rgb565' ld: drivers/gpu/drm/drm_mipi_dbi.c:235: undefined reference to `drm_gem_fb_vunmap' ld: drivers/gpu/drm/drm_mipi_dbi.c:237: undefined reference to `drm_gem_fb_end_cpu_access' ld: drivers/gpu/drm/drm_mipi_dbi.o: in function `mipi_dbi_dev_init_with_formats': ld: drivers/gpu/drm/drm_mipi_dbi.o:/X64/../drivers/gpu/drm/drm_mipi_dbi.c:469: undefined reference to `drm_gem_fb_create_with_dirty' Fixes: 174102f4de23 ("drm/tinydrm: Move mipi-dbi") Signed-off-by: Randy Dunlap Reported-by: kernel test robot Cc: Dillon Min Cc: Linus Walleij Cc: Sam Ravnborg Cc: Noralf Trønnes Cc: Thomas Zimmermann Cc: Thierry Reding Cc: dri-devel@lists.freedesktop.org Cc: David Airlie Cc: Daniel Vetter Signed-off-by: Linus Walleij Link: https://patchwork.freedesktop.org/patch/msgid/20220823004243.11596-1-rdunlap@infradead.org Signed-off-by: Sasha Levin --- drivers/gpu/drm/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 649f17dfcf45..fc6c4f81985e 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -27,6 +27,7 @@ menuconfig DRM config DRM_MIPI_DBI tristate depends on DRM + select DRM_KMS_HELPER config DRM_MIPI_DSI bool From patchwork Mon Oct 24 11:30:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10299 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp654515wru; Mon, 24 Oct 2022 14:12:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM717C9ah5KZE6Tce5GTlsObb2mCSiPFC+onO5KWBcz+8tv6klXOJxyjXt2gJuQIBDBywcDU X-Received: by 2002:a05:6a00:168e:b0:53b:3f2c:3213 with SMTP id k14-20020a056a00168e00b0053b3f2c3213mr35355521pfc.56.1666645947668; Mon, 24 Oct 2022 14:12:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666645947; cv=none; d=google.com; s=arc-20160816; b=TDjGugDHp9gOczDCcuAifKEyTPpRC8t1psDoGDmQR24FXQB1qpZHzSxwq3JzNEioWO +veT+3x1Ox/E7UgJE4OhGzLZvZtyN5ECALZ5GzMEOIZQI/PspNEQxe+I8MLsFtAzOpnt KjqSFsvlySxDMtg5sJ9VW0ZiKjEdb9aVFtyUMeb03pFLaDfK7s3zDX3VHUZn4KwLA1bR N29iPW9+o6AINM/zVAZGEiR9QKmEC4HPQt7BRLnAbcYZNAPa7vZ8cB6VdID6dmzm5tVj eRdJ84hT+McNfmWI5GYXf/yqXocLPgz2vzzK7sG9vndF+cW0uEfaNOx0VerRe5lpic3W Ll4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZKqePUtERwiNpa9RU8NgZVmDvaIbmBIzrho3RAWbE04=; b=s6+7xwK7YxStlcuI6TV024YKXH93Q+st4ZYcoYL7rkO4NaFhuCjoJ7f2ltTi6UQfKC BtMifCmpY0OJZSesnSHRZ3JIpV1cN4KBojUErLp7JpH1k6jI1+n6QjVhZN/YMk1NYqWu vgomAoT2jK0fczlUHxG5NkRd5ItaG7OucYz1nZ0lwBncYpEErjUyo42xi+SPGr1bCt0o yvMVWx97OTf7nLP69q5DAj+iDYUq2/wVskab8JH/4sDfrBh3oHgJgx+TtoLHOs0w4WA6 ThPI2x26CZmffz97D2TCPPfqz3zw5XEH5QucUNxY56PPQDV6VkFk7qIJqmBMkVKoaRoD MOSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CuPfMEny; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k194-20020a636fcb000000b0042ad0333df1si628815pgc.479.2022.10.24.14.12.12; Mon, 24 Oct 2022 14:12: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=CuPfMEny; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230138AbiJXU4Z (ORCPT + 99 others); Mon, 24 Oct 2022 16:56:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233989AbiJXU4D (ORCPT ); Mon, 24 Oct 2022 16:56:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 495562C4C9E; Mon, 24 Oct 2022 12:02: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 E8CB1B815B4; Mon, 24 Oct 2022 12:10:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4930DC43142; Mon, 24 Oct 2022 12:10:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613408; bh=G1iDAf3f6Jpdzk94UbQC3Rkti0Ys811hQbx2+MSiH9k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CuPfMEny0Ift32isBMGhUf5Sb8cc6xfGJa3gcHy3iLipCswGQZ2pl8DhXaq8Aroxd DcV6cKisSGwUm6ZlY2C+3WwXBBkfBWYmwW7e1YZqVWib86lAm7322XgW8Z0ETNfzsW ZypnnrzQH1BF4mDYNLY64oW0T7iCggLKT47TUEAQ= 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.4 095/255] drm/bridge: megachips: Fix a null pointer dereference bug Date: Mon, 24 Oct 2022 13:30:05 +0200 Message-Id: <20221024113005.647585310@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747604941045155133?= X-GMAIL-MSGID: =?utf-8?q?1747604941045155133?= 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 5302dd90a7a5..b72f6f541d4e 100644 --- a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c +++ b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c @@ -279,7 +279,9 @@ static void ge_b850v3_lvds_remove(void) * This check is to avoid both the drivers * removing the bridge in their remove() function */ - if (!ge_b850v3_lvds_ptr) + if (!ge_b850v3_lvds_ptr || + !ge_b850v3_lvds_ptr->stdp2690_i2c || + !ge_b850v3_lvds_ptr->stdp4028_i2c) goto out; drm_bridge_remove(&ge_b850v3_lvds_ptr->bridge); From patchwork Mon Oct 24 11:30: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: 10325 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp668641wru; Mon, 24 Oct 2022 14:55:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7klspIG6M/ZpVLSABoKc41qtE4yNbsdV3PJR5NSj0e2t7fneo+urSHib2DJN3tOBMaGGMN X-Received: by 2002:a05:6402:294f:b0:461:f5ce:31e8 with SMTP id ed15-20020a056402294f00b00461f5ce31e8mr2805796edb.363.1666648521920; Mon, 24 Oct 2022 14:55:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666648521; cv=none; d=google.com; s=arc-20160816; b=J+OICcl2a6Q63y7tVySkz+5W4ComrR3NF4G1p90TFsQsH/AJKLinBZ0DVBBUc9plmL nY+CpjSgHyMrG7DKuCB0dQXIwig+SVxgRPvXLRq02zCJJVovLqSEwrbdD9Ee7Luek6Af 8qQgOa/y8kcb/DWkneXeCl4t8sScppYS7sjOie0mWuSg9MWiZYHnIIkHanWCjEBZhGRB Lv9sZ8qMrZkF0pLN8kDVz1MUeBEt5E370loHZ6Y51CUFzsmg/GBQrr/x0qAds+MJ3ZSX Vnck0n2YyVWNiHHkG87lDpelqtPbCP0F0xAOwEWRs7JLCHqE/KeuoRXDpaokBHQPt60h l1ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DM7C59FOdBtPuJ4fPntX+29ciIUcQEwSgWBJxoVKWx0=; b=Okp7WJ3fXMebHJ/J2N1fhzTSy22hMVkyUUba2J6Vo+qTkHOBONQOKKtQHJhtMcsTGb OX26CeRxvOMHgm0YNJ98rNL/L1ysVz7KDxIeCGvl6tr+cFDokpB0h8KRmmWk0O+js1// TlyN6lT/OlXa7XYhlJ+klNYOu8zkYzVbzd+DD+hGIpKa7PqyU+asxb73Fn5vMEp3lPAb IX8xySZpDZrf8HIV61bsxbHVShsx7KAu+tCb5Om+PV2P/IUbNnmaiJ+QLxwSLLQmowBu 9zNuMeBYOmOX2md4PHQN9pgAecBLx2UKWQ7eOcWAwLl8IgM9tkZaXuLW09qIThpZB5GY MQ6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XMX4uR8K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hr26-20020a1709073f9a00b00791a84056d9si969534ejc.751.2022.10.24.14.54.57; Mon, 24 Oct 2022 14:55: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=XMX4uR8K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230311AbiJXVng (ORCPT + 99 others); Mon, 24 Oct 2022 17:43:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231172AbiJXVnL (ORCPT ); Mon, 24 Oct 2022 17: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 CC9E02E8BA3; Mon, 24 Oct 2022 12:53: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 87CE3B81260; Mon, 24 Oct 2022 12:10:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E410EC433D7; Mon, 24 Oct 2022 12:10:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613411; bh=MiaE12X1LvN9oohMud7WJDraPD8xqNI2YGqZjWZZdc0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XMX4uR8KK9waiuB2YN9DgEJLNKK5pIbjVCFjXTGISUkO2OfQpwOM/7zD3uynjMTP7 YgcVLbwjDRpPv7OpQJSnUr634lirPM0kT4AK76nGsRUOKcFL4pYkGHtbnmyYfggO3R b8z4Ip5f9/9fhj36c0ISOr3X+AyZ6aTltq/sy9QU= 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.4 096/255] ASoC: rsnd: Add check for rsnd_mod_power_on Date: Mon, 24 Oct 2022 13:30:06 +0200 Message-Id: <20221024113005.677599125@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747607640599340386?= X-GMAIL-MSGID: =?utf-8?q?1747607640599340386?= 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 7647b3d4c0ba..25a8cfc27433 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 8d91c0eb0880..53b2ad01222b 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 a3e0370f5704..c6fe2595c373 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 585ffba0244b..fd52e26a3808 100644 --- a/sound/soc/sh/rcar/src.c +++ b/sound/soc/sh/rcar/src.c @@ -454,11 +454,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 09af402ca31f..f8960bad2bd1 100644 --- a/sound/soc/sh/rcar/ssi.c +++ b/sound/soc/sh/rcar/ssi.c @@ -518,7 +518,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 Mon Oct 24 11:30:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8911 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434280wru; Mon, 24 Oct 2022 05:51:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4kU8QNq5Sda3LCA63WAHoExpjix6/b0teCK55MYkE054BkAXaogHjqBPICdn/Hd1xROCK4 X-Received: by 2002:a17:906:3019:b0:7a7:6425:7d1e with SMTP id 25-20020a170906301900b007a764257d1emr4550157ejz.663.1666615911021; Mon, 24 Oct 2022 05:51:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615911; cv=none; d=google.com; s=arc-20160816; b=bYz0A4hiVxwQpAEspt43z97UjE5xsP34rNvChduU3VTlEhP2BpX1ZXfIaDA2wAftu6 PeKExqVLGrf40e4FHFnm9ZgSDDGDt3IXmyJ36TAalmgPbWfno1t/FjIBqD0NjZqpfLno ilCdkhzqVg6fxznht/HfvBnrCAVeeu49Icj5JqWRiOFM1NgsgUC8C9mZAWcqIazUnuvd vb6yQVsweWmSG09SCm0Iw7ZpVDxjsDSU3i39//dwV3u83ZWl3LAe2wKGGzbCkKJQg0GM wunuAYC2JSoukiUsPR2iwPwOFKhXzDt0OMooEEsU86ingkCu6vCwB9X7cCy3N1twK5UX PeUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wNLsOR9sMAGTz8IJxdzfeWZ5+9K+er4XE69megKINC0=; b=BVzgKqm0Do17M4gUW9TRvmOjY2oIMvTFlA73a1dv/HsXXvJiXszeV7YtYVDiuHd/0/ sRT8kCN9Os95LLxgzJNo/Zv29iGIcJsIsLmo8WaXmpRm8xwZyFnJpzP3NNYBD3MixhfI yldtDl5Zll/3mNcj4esQ4JIpCGgPaTsPEGAYCHm9UqE6Rd7yhKEkNijPijhNVNf4ug+Z aAPex1Ak+FD30UqniUal/9jclqzgglWFHIllbLXo1XpThlxfIh9ictIAVqqAo+pTiVkD GhA3x1XhHx0ium65zrWGbJOOR65Ol1ignKhyXuL97rCMiq/bf3RuPmpGvEEu7RUtf4bJ NE2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=c1tWbXIa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id he18-20020a1709073d9200b0078ca7bbf616si31926883ejc.746.2022.10.24.05.51.22; Mon, 24 Oct 2022 05:51: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=c1tWbXIa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234312AbiJXMuL (ORCPT + 99 others); Mon, 24 Oct 2022 08:50:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234585AbiJXMpL (ORCPT ); Mon, 24 Oct 2022 08:45: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 4F54622531; Mon, 24 Oct 2022 05:09: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 DA702612B1; Mon, 24 Oct 2022 12:08:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEB14C433D6; Mon, 24 Oct 2022 12:08:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613332; bh=GvrN2gzQkrI3b84T+M2mKLypIgpyFxYr4imErMtP4aM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c1tWbXIasAhvtDVvBlfEIXPkNVm9xPpAbLDUsUYF6MbeyVgwNE8uPCwY0gB1AMtWM NHhjZvKHCxrmSzoj4drd/9VRlDUp5Jkzz5nTTQbAw5exQw8sBYwg/MvADZnRkmaor3 jP+1lUEwvb7Itq+XgXx/EAju7kJIFL20CQhLuPhk= 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.4 097/255] ALSA: hda: beep: Simplify keep-power-at-enable behavior Date: Mon, 24 Oct 2022 13:30:07 +0200 Message-Id: <20221024113005.715321102@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573445876622276?= X-GMAIL-MSGID: =?utf-8?q?1747573445876622276?= 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 c6e1e03a5e4d..5a50b6c1d604 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 04a89171327d..e42a6c5c1ba3 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -4302,6 +4302,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)) { @@ -4442,28 +4444,6 @@ static int stac_suspend(struct hda_codec *codec) stac_shutup(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 */ @@ -4476,7 +4456,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 .reboot_notify = stac_shutup, }; From patchwork Mon Oct 24 11:30:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8915 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434359wru; Mon, 24 Oct 2022 05:52:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6CIZ74GhiDfHsSrLc9NEDmCS2P4iJodJgeN9gQ6wOZVEbYQiQclIOG0LU6HoP5NLK7JV1M X-Received: by 2002:aa7:d30a:0:b0:460:362e:af11 with SMTP id p10-20020aa7d30a000000b00460362eaf11mr21970364edq.256.1666615922375; Mon, 24 Oct 2022 05:52:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615922; cv=none; d=google.com; s=arc-20160816; b=ZBDHHS/P7/biALiJ3SUML/DaAgUix39DzbwXduTfGWPEmX1Xnsudml2o5adYV9oCGE x59WVrOFETwSSRjTiQKEBFPCz97kv0zquDzBYhrnx26lMtRRstMegdBkv9PaUHI++xTz hJJ59wQXqKzwLg3a22zj1hvI4JAVh+ZM/WhdTFF/xXf7CmYZrKemzeNjyMzw5XSp8pJi 78Oy8FobP7gx1CS1s8NMRv8c9JEI2wQzboH3t1MIyV5giGunYIm06oELehTBaK5J8upL PiJbOvDrnL6yo/k16kTvPsEFzpPg9Hyv8gJuNLUnth779uKapGX/XiVbf20v73rBkVH1 6FvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vGGmNLF6TLphsliy+3B1d/dm9U9+k0TPkQAauwGZYm0=; b=Su075znOdR6XwSImjLWonEwlH1kkb2U/9S0E4SYqpvlMW7xFgs/hggeILaRmEUxx/v 7IZRNMXN0Qqmj8aoy50dL7kT+uzKZcj8qLPfvU7crHiKDX0eijzuE4U+/CQA/nR2/0Lz lNlHtSdv8MQEEWX+ZkM6IsuABrGyWKjBN368iG7XRu5/Y1B5gjHDTRlNENr9UmzQgCvF LoxoDlwLG+fBnAyS2gPJGBzqjIOqivi0lRmOKa5tFykA3fabBnJqWW9aJ+oFKgTcSbHS 1IH+NInNQ/dvNTvXisWAks39Gg7VxRRFeVWgmh6IuZ85Lg0D03CdVWdLEgR0dGFeqfQA /dXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AlyP9nE0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qb36-20020a1709077ea400b0078d93245e23si18578117ejc.791.2022.10.24.05.51.36; Mon, 24 Oct 2022 05:52:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AlyP9nE0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234279AbiJXMub (ORCPT + 99 others); Mon, 24 Oct 2022 08:50:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234592AbiJXMpL (ORCPT ); Mon, 24 Oct 2022 08:45: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 326F62250F; Mon, 24 Oct 2022 05:09: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 835A4612C3; Mon, 24 Oct 2022 12:08:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95B8CC433D6; Mon, 24 Oct 2022 12:08:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613334; bh=o4w8XgtE59JzAVRdbtF4cnGcQAvWAo4f2hVevgR+zp0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AlyP9nE0u2smyncLW5EOlZvWM7LzGoiIHIySRnezLdcE1ok2qCGs7N9N0tIXyK4gC 8tWJpHa2+ujGz5v1sLgQ8GM4YJhzC1sEQobhVb2MSn1Lrqv612gYyIuXqJXjhVkWvm KSYycvb8dy55mZJbNLspUpmaqQyFcDWI7LPZkXb4= 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.4 098/255] drm/omap: dss: Fix refcount leak bugs Date: Mon, 24 Oct 2022 13:30:08 +0200 Message-Id: <20221024113005.744434614@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573457702588386?= X-GMAIL-MSGID: =?utf-8?q?1747573457702588386?= 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 ac93dae2a9c8..7f1d0a9afafb 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss.c +++ b/drivers/gpu/drm/omapdrm/dss/dss.c @@ -1173,6 +1173,7 @@ static void __dss_uninit_ports(struct dss_device *dss, unsigned int num_ports) default: break; } + of_node_put(port); } } @@ -1205,11 +1206,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 Mon Oct 24 11:30:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8918 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434419wru; Mon, 24 Oct 2022 05:52:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4IGgGvnZmyI+naerPU0o7mfesczu/hIruBKlBCOvJPkeUFaGRLX1EA5MLiNTD7dRrGWyyZ X-Received: by 2002:a17:907:3e03:b0:722:e694:438 with SMTP id hp3-20020a1709073e0300b00722e6940438mr28198977ejc.755.1666615932735; Mon, 24 Oct 2022 05:52:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615932; cv=none; d=google.com; s=arc-20160816; b=upqwJAspgkQM2iNuZT5S+e8SaQB+ZPhy3OPlczD6rCJ2DOsQMoSSYMCUqQzCierVCx Un7aSiCbWs6dX0vHt/3SdA5cH62cn4GMSL78t2vtJTNDt/l2IBQ8mJuIh3WR7ubS7WDi WtjgWgimjrRIqXt3oQJKzlQepkIe93ea/vArZj0PNZX4ARf3pHs0yt0D2XLEJC7TqD9X aqixwUlxmRb6ZWsNJ97t6EgfBJErPWjebPDi0ZHRecaF5egXxQ89nqTQuUgaa/uWUlVD MYxyjfgZXj1WdC5e36ngGJNl2lZCxPVjDoN551M7MRSbDohCOAAgkyXxQJ9LSpwATov6 URmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2q10K0vzCSjBvKXBjsTsPUvpEJMmXSvyOJnVNgnNsGo=; b=eNWGvp2b15zAWKhfNu8sne8eeiKjuFJ1EIk/2Qqvvg9rD+Bh9E74BQJ540iUD9BGHY dif2jyVKG8H7MFFxK/YgnY6IT2pa5O3tBrvKfSO2xEKcO4LziulrLq9nlS3dW6VUcjlw wIIsDhQ9RL6JML9bRXzfOVLwWqdBlUTwXBCQnkyJ2QMDLkozkNwtudjL3i5+zSsKktDc fWNXg9wRPZTMt+eh0OGOgRlmrPdXhbTFlL/d6rkt5k8GP9CP+T8b9bEgESSaLJXW5vzF lsvjTONZzBeUeqIP2V2he//crDkQ6basQ0LIhn6fKTupsU84z6dvRvFtrnqW4cRKS7pa W6+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Br16Cn6S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a1709077fa000b0077bf109acb5si25662797ejc.116.2022.10.24.05.51.46; Mon, 24 Oct 2022 05:52: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=Br16Cn6S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234373AbiJXMui (ORCPT + 99 others); Mon, 24 Oct 2022 08:50:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234621AbiJXMpV (ORCPT ); Mon, 24 Oct 2022 08:45:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C8C72872B; Mon, 24 Oct 2022 05:09: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 20C71612DB; Mon, 24 Oct 2022 12:08:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32F7AC433D6; Mon, 24 Oct 2022 12:08:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613337; bh=reVmjF1orNsb6WREl5L1JcF/8r41j2eq9TSpDSt3XMo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Br16Cn6SNEiSz5OU16XrhzKDVxfSTD8k6YKP4p2ulsvSfQ1H+fBAdynVEa6cK1crB niNmQG4FxjGpRErQ0MqIND7rnEgQigCcEOE1wST/8hAjij+KoR3LfTwv+IZ3N3RSCt a3Z9kTbIXLaZix7gfJz8Rk+swBuaLpmsIJ1nAgdI= 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.4 099/255] mmc: au1xmmc: Fix an error handling path in au1xmmc_probe() Date: Mon, 24 Oct 2022 13:30:09 +0200 Message-Id: <20221024113005.774025102@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573468465348170?= X-GMAIL-MSGID: =?utf-8?q?1747573468465348170?= 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 bc8aeb47a7b4..9c4a67f4195e 100644 --- a/drivers/mmc/host/au1xmmc.c +++ b/drivers/mmc/host/au1xmmc.c @@ -1116,8 +1116,9 @@ static int au1xmmc_probe(struct platform_device *pdev) if (host->platdata && host->platdata->cd_setup && !(mmc->caps & MMC_CAP_NEEDS_POLL)) host->platdata->cd_setup(mmc, 0); -out_clk: + clk_disable_unprepare(host->clk); +out_clk: clk_put(host->clk); out_irq: free_irq(host->irq, host); From patchwork Mon Oct 24 11:30: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: 8920 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434453wru; Mon, 24 Oct 2022 05:52:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7IDco7AKKtclyFf4pvB0RpPsXlVMrIO0aSYMWdbbYb91qMM8DB+qIBwQWCQiM0nZiy5cdZ X-Received: by 2002:a05:6402:5187:b0:461:ac01:7512 with SMTP id q7-20020a056402518700b00461ac017512mr6695180edd.327.1666615936902; Mon, 24 Oct 2022 05:52:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615936; cv=none; d=google.com; s=arc-20160816; b=rJM7enlyO4QPswxghBfN70ZvqWsGGhTj8V55AxzpKvBGbVEqU1+bwn8Ato2+gfnSW0 jD2t7GoTb3goyVk/GmVp8kAqaQbkvmKAWRKzYdWNerhIGic2u1gHCkarTLS6ReNCDS0D ODkb+AiLVwf6dlh7O91kqy1Exg6nZ+yZwENGogOpr0Ox060XJ9VtBoLTkW5Rb8mB09EN BTl/NAaiUadUqeOduOoXkMax9zIT2IGFjXWq4bmmbyK55ZlpcRWkfi27jVs8b9rGnCrI V0g3HHlMmpgI4BLj4tLPjXYZ7TBQ/EqpTB1MnGMNDO2/AOtPidRNrVnquukHBhesWvRe n4QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UHNO9FElLGaCOa/fxNImtYoSSdJYDKUWKTVOQ4nnWA0=; b=e9X28UDuvRUOxde0Xq3WcObQOaRWfSIJKDHWDR8hzgeCWsExr/M14Lu5i89DusS7oM UO2w5lV6haRKdy5ppp+J7uDpKxEYRjV+W5r2IRd+7mfTYhc1zOVzqAjvSuOUZyTq+xJj i09Uo6IhvaOsk8Bhe/qubFFxviBrQCySh5Zm7pHOvP7bWRIkxrU6nNJ265DoQU2NYbvv T/QQmxIraTQbQiCDs8VRueTz4+k16xbdT5CoaZylHGNv7KV1ngNVCQfsmodwLD5bO8g6 Mzvuq3qSQmxh3qT37UWmGj8mo/W6X2SwuVqJ2GaKwSw6cDoscmLEgvlf4qxJkUFbZBwS 7Hig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QhHwUlGi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 10-20020a508e0a000000b0045d0660a039si25246195edw.316.2022.10.24.05.51.51; Mon, 24 Oct 2022 05:52: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=QhHwUlGi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234390AbiJXMus (ORCPT + 99 others); Mon, 24 Oct 2022 08:50:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234644AbiJXMpY (ORCPT ); Mon, 24 Oct 2022 08:45: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 5FFDA28E06; Mon, 24 Oct 2022 05:09: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 C1E49612DF; Mon, 24 Oct 2022 12:09:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1A42C433D7; Mon, 24 Oct 2022 12:08:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613340; bh=RhZY3f/cNX48ieii4f+tk/Br9qS6MllaouL23ztsNwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QhHwUlGi+8zAk30SeKcfPSIeISYF01r+Ewl8sKtPayrlmvvjmEmt0HYkzzA0aapNz 0A7BteM0wqM2QaVrLW755W9kOrzY65jyZgRr/DCm4NSeefysQWpILmg+qS/wAYqCaG MWIl5SDdMZIZNiVoPpFEulrrgPZwZ7rRi/Yq21B4= 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.4 100/255] ASoC: eureka-tlv320: Hold reference returned from of_find_xxx API Date: Mon, 24 Oct 2022 13:30:10 +0200 Message-Id: <20221024113005.806514427@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573472506967157?= X-GMAIL-MSGID: =?utf-8?q?1747573472506967157?= 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 6f3b768489f6..bf3d3f0aa858 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 Mon Oct 24 11:30:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8912 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434297wru; Mon, 24 Oct 2022 05:51:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5whGbr+LmNZtCxk8Jtc5n7KHhRoqDdNLXf0ygPCz42hYwQ2TrSw17HC8eA/HBY7hp9LvTR X-Received: by 2002:a17:907:6296:b0:787:d066:9fcf with SMTP id nd22-20020a170907629600b00787d0669fcfmr26087063ejc.692.1666615913023; Mon, 24 Oct 2022 05:51:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615913; cv=none; d=google.com; s=arc-20160816; b=uYW10H0okhzwCD/Wkf4NSczgH/EcxL2WHZeU+fpOe1Dh6NlKO9+DhazRVuaieJlGy6 6LhiwVVBTmLAxoqXU8Lud/4MnAVEm+D+Sker0JCp7KZZc5a0W5qYObPPLUvBopk12n56 Y7J5ZWDTJD0zrPQifJlZkCaa4S23gRqKavUM9y4vLwXfI67fkw+Q+FUIPnXSujOYQLPi pMs5q8LAS5AAp1c4F5pg39aJ2kG1v4726ndEF2Z92mmd9clChksOS8jxgOGx3ehDyxfG sGjhvX5ks5w76aiNXMm7EaFH2OCdX5h3LUVWBmkV+A7kfsiRk3jUEcvz3/ZhWtJ8dJzC o5AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QpFokPj2q3wj7Tp2OLbuSBLbAdr+yHuE6z+1rwSY5OQ=; b=vr22XXFSJhBSG9RuqNYCmN4LOUy2g7I2tqFC7F6bGXqs7PW1gkYiDOlZmceJbMgkZa BJhDhgdYsN70mm/EzNLKi2VoYqrief0O/Io88SNcYqW9U7Be9SmG/K7CsnsmpA4TDB3q iXHZwaNByhjkOU4WyVRjn+DX/k3KpIgSVda1CJtJleVdV2U2MDKaF2PEXF7Hw6QTmsqo /Ic5V8niIPGSJOnvPX4SllTYsSUAS3ojCCUGTHkUs4Sh7FErgG1tA+a6fkI5/4SnooOH 24LDnmPoMgf1oC7y8I9f0TFOYRVUbUCWYMFKbLh8/jd4QuJMnf3DdKV4g96wPQgLURLP dTiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kkmgqS6v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i10-20020a1709064fca00b0078db1258ae9si32703411ejw.555.2022.10.24.05.51.25; Mon, 24 Oct 2022 05:51: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=kkmgqS6v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229817AbiJXMuW (ORCPT + 99 others); Mon, 24 Oct 2022 08:50:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234612AbiJXMpU (ORCPT ); Mon, 24 Oct 2022 08:45: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 455D02E691; Mon, 24 Oct 2022 05:09: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 5AF6961281; Mon, 24 Oct 2022 12:09:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70E89C433C1; Mon, 24 Oct 2022 12:09:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613342; bh=/DnBlGEHmDsKGRdYo7vtlx+6+pve0D4reGzgxgMkpRs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kkmgqS6vrXuNc4EyLhVgDcj9NN5/KwxnvnNRVXUuvD+lcPPzeIy3YdSuYhhdWle67 KblEpOCNJz1jYGcbaNfaiEVhFNyVWWcyPqSEQeVmwe3Qv5T/DQWvUni6YKu6nMwPwE iW9Mqr1V+w+TY7tYd6SStVxt57C1WVXZSIzZzyA0= 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.4 101/255] drm/msm/dpu: index dpu_kms->hw_vbif using vbif_idx Date: Mon, 24 Oct 2022 13:30:11 +0200 Message-Id: <20221024113005.834791195@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573447927886881?= X-GMAIL-MSGID: =?utf-8?q?1747573447927886881?= 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 c08c67338d73..a74f8ae1a894 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -596,12 +596,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; } } } @@ -899,7 +897,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 8d24b79fd400..5e6bb2f306be 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,11 +156,11 @@ static u32 _dpu_vbif_get_ot_limit(struct dpu_hw_vbif *vbif, void dpu_vbif_set_ot_limit(struct dpu_kms *dpu_kms, struct dpu_vbif_set_ot_params *params) { - struct dpu_hw_vbif *vbif = NULL; + struct dpu_hw_vbif *vbif; struct dpu_hw_mdp *mdp; bool forced_on = false; u32 ot_lim; - int ret, i; + int ret; if (!dpu_kms) { DPU_ERROR("invalid arguments\n"); @@ -160,12 +168,7 @@ void dpu_vbif_set_ot_limit(struct dpu_kms *dpu_kms, } mdp = dpu_kms->hw_mdp; - for (i = 0; i < ARRAY_SIZE(dpu_kms->hw_vbif); i++) { - if (dpu_kms->hw_vbif[i] && - dpu_kms->hw_vbif[i]->idx == params->vbif_idx) - vbif = dpu_kms->hw_vbif[i]; - } - + vbif = dpu_get_vbif(dpu_kms, params->vbif_idx); if (!vbif || !mdp) { DPU_DEBUG("invalid arguments vbif %d mdp %d\n", vbif != 0, mdp != 0); @@ -208,7 +211,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; @@ -220,13 +223,7 @@ void dpu_vbif_set_qos_remap(struct dpu_kms *dpu_kms, } mdp = dpu_kms->hw_mdp; - for (i = 0; i < ARRAY_SIZE(dpu_kms->hw_vbif); i++) { - if (dpu_kms->hw_vbif[i] && - dpu_kms->hw_vbif[i]->idx == params->vbif_idx) { - vbif = dpu_kms->hw_vbif[i]; - break; - } - } + vbif = dpu_get_vbif(dpu_kms, params->vbif_idx); if (!vbif || !vbif->cap) { DPU_ERROR("invalid vbif %d\n", params->vbif_idx); From patchwork Mon Oct 24 11:30: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: 10162 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp640198wru; Mon, 24 Oct 2022 13:31:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5XHFAjq0IkUvN6HsbiOJ9pz7Q5LpE+2ebajzxVrEItbR9eXs5ZJSP6tADXHIBEJrg250ob X-Received: by 2002:a63:5a08:0:b0:43c:9fcc:cc54 with SMTP id o8-20020a635a08000000b0043c9fcccc54mr29422015pgb.229.1666643519009; Mon, 24 Oct 2022 13:31:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643519; cv=none; d=google.com; s=arc-20160816; b=ZIWYbTwQ9tEtg+hUyR2+qIzqNwvVnGvCpgdMQ6GAhJ12Bb68cv5Pvsf/FPcADDagpz ihdBiGOgQk0FQl4fVB11usXOw0YUQLz5mc1uetBB5DvebkXmKUnD3T8cWrVQ69HLwAra 08QZcx0hMxNopQbK/HoU4eGFzdwztopzwwtEjQtg0OA62X7Do7EG+l874y7DIMfkuGfr iWsxIyBbF8aTtHh7tsyV8vuIzEZlCfsGF3rJAjArUBPcjJDVuLJVAfprT66quw1GOziU VrT+h94w2ZGskl7SOW56QZgKJqOV9GFppYMerDlZBa5/q9KrtFQjB48SHpao8iuLr9WP 05GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IPyrfujMdNPsHMq0pdgkV781o95MtUKL7tRYO3GeQ8o=; b=X6i9ypVFbOmht7rsvj8Zw+Q7QXqH8n4E9Wbs0uGct/Wvb5JB3Jrc5tHtpHuC4HeDpe JVOTtcKuZt9q+jzjt/I/RJrZqPUSckTGg6qWM+InOQQGIB5LnjmuCEd++Jq3XO9Pjl0V edvzhseUxvU3ehEXUNyjYjvmY7v4xq0tk7EsNwf+fKydBvhM3s/hYawO96jytd+WH/P8 A9MqoGDgbNL5xkRKEL81pfTikjeqm4E2Phl6KWEXW9kCDekbfmhpwT0MYeODrpVGeqaQ WP4eYccQu/gMCQusRKTJkHFiZ+hj1D7gz2Q5CjJDg3dMflgO1QB1Lu1l5gMKPgjPqCvU nWRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cDPJkvEo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c34-20020a631c22000000b0045e96393e37si567361pgc.20.2022.10.24.13.31.46; Mon, 24 Oct 2022 13: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=cDPJkvEo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231791AbiJXUV6 (ORCPT + 99 others); Mon, 24 Oct 2022 16:21:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229798AbiJXUVM (ORCPT ); Mon, 24 Oct 2022 16:21: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 E14CA186D78; Mon, 24 Oct 2022 11:37: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 B3599B81269; Mon, 24 Oct 2022 12:09:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16A3CC433D6; Mon, 24 Oct 2022 12:09:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613345; bh=PKw48NvRM6Pv0obQueP1baQfXMf9H18bxdys05abGAI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cDPJkvEoVf5VVGFSVChPWwcUa6F5K2RTuWFWgCXITjrxsQm52HkplZQSOrUDT1z75 8EIKvFmXZ2F0Z40J4iwzyfQj889pn8PeNKiD6FJlGa+DsB67Rwki+I9V1uuSQYYz2H 1r2DkYphgddakRQ729o5EZ8RDJlYZWDR6rkFlraA= 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.4 102/255] ALSA: dmaengine: increment buffer pointer atomically Date: Mon, 24 Oct 2022 13:30:12 +0200 Message-Id: <20221024113005.863585249@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602395012026038?= X-GMAIL-MSGID: =?utf-8?q?1747602395012026038?= 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 89a05926ac73..5d9a24ca6f3e 100644 --- a/sound/core/pcm_dmaengine.c +++ b/sound/core/pcm_dmaengine.c @@ -130,12 +130,14 @@ EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_set_config_from_dai_data); static void dmaengine_pcm_dma_complete(void *arg) { + unsigned int new_pos; struct snd_pcm_substream *substream = arg; struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream); - prtd->pos += snd_pcm_lib_period_bytes(substream); - if (prtd->pos >= snd_pcm_lib_buffer_bytes(substream)) - prtd->pos = 0; + new_pos = prtd->pos + snd_pcm_lib_period_bytes(substream); + if (new_pos >= snd_pcm_lib_buffer_bytes(substream)) + new_pos = 0; + prtd->pos = new_pos; snd_pcm_period_elapsed(substream); } From patchwork Mon Oct 24 11:30: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: 8916 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434407wru; Mon, 24 Oct 2022 05:52:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4a+97GwvUwHVoTfy3CFF8ETuLBpCTWP/guroxNhUTZQjkNAPj+hsJGbk2On+TXpRyqDMbw X-Received: by 2002:a17:906:8a79:b0:78d:9c52:2196 with SMTP id hy25-20020a1709068a7900b0078d9c522196mr27688229ejc.328.1666615929954; Mon, 24 Oct 2022 05:52:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615929; cv=none; d=google.com; s=arc-20160816; b=frUdbEbex1jM4dPRez1Caqtixpr962v/vBcJOSZEaAjIyvH/hf7B7SWuvKBRhmNRy8 RYhH1u5715UBiNO/0XRUqAq3x6HaoRviT5fpUvNzDBSInErv9zTo+ySs9pNEa06cq1aj 4M2ovAC+4thn4eEKu9wUQGJ1N57e0cF3qVQxfx6sGhdIVB/hmqhOSImzg59ok63p7eCr asOMIYUbRs05YK2Egu1Da9eZFYiLstOv9JYNsq/dHKNd0UTjUfNYZ3WNZKf4l1Z3cNnL 9ZQffMWZDczHP3YA5VZ0VqNgm6MmDhE/oyAVJSIWJm2Wq4OlpoOBH/BVDEFNVXfR2bN6 QuFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ui39gpCw0BD6+auaLEiZ0UWrgFwJVtSDPWaD/1llSok=; b=Dqt9tczMoT92yJyvwviHH9b/S33+JOhYaVpNaQkE41EzHGi64r3t1Oy5+R/ywagSRK z9XD1GYmRMLGzIRG738OfkxJGROUHV2pZ6twTkPJbJyrddrCWYpPZndoqMcpVZ5nlNB3 MHLg3LmSamnDwRZKqJzI3ly5ilTQFV0YFqqWMAT40cJ0KcXL2dV9/f3f3qg8EYWbuCGM zSeUBUz2nksn4nDHtFfs37S/tsP0LnCtlz0YFFOikYMHBs0td54vC3kbe3lzSt/EYgzG 3KrPUqPwKfmGWnXnqTHed/zYCjizT4dEWwWdoORwA7KkeCxGbReFLoRGSI4RH0iQZumv Yrhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bkfhLekG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090797cd00b00782f3e3bb71si15110590ejc.912.2022.10.24.05.51.44; Mon, 24 Oct 2022 05:52: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=bkfhLekG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234271AbiJXMue (ORCPT + 99 others); Mon, 24 Oct 2022 08:50:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234589AbiJXMpL (ORCPT ); Mon, 24 Oct 2022 08:45: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 CD6922F01D; Mon, 24 Oct 2022 05:09: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 9EA9A6129D; Mon, 24 Oct 2022 12:09:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5EF2C433D6; Mon, 24 Oct 2022 12:09:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613348; bh=ZrsYK6Nl2EM2TgK2s+s0ekaPojcy+Op5hVt+uaDoDp0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bkfhLekGj1NiNV+3WBWy8cQNLmrob0z49U4VDyVXPgiGuZ9JHAMRSsww9wiKl0IaI Gm+EH15uX9gy+V6YzcohLotbDdjzML7rXE9bgT2Aot4lkJb7lxTbmr8+UZkMs3ms9J 8cwyXPRT4UB8wtP6KcX5ns9tHnVGzPs/BZhDtJhw= 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.4 103/255] mmc: wmt-sdmmc: Fix an error handling path in wmt_mci_probe() Date: Mon, 24 Oct 2022 13:30:13 +0200 Message-Id: <20221024113005.892591461@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573465321452084?= X-GMAIL-MSGID: =?utf-8?q?1747573465321452084?= 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 2c4ba1fa4bbf..d774068dba30 100644 --- a/drivers/mmc/host/wmt-sdmmc.c +++ b/drivers/mmc/host/wmt-sdmmc.c @@ -849,7 +849,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); @@ -866,6 +866,9 @@ static int wmt_mci_probe(struct platform_device *pdev) return 0; fail6: clk_put(priv->clk_sdmmc); +fail5_and_a_half: + dma_free_coherent(&pdev->dev, mmc->max_blk_count * 16, + priv->dma_desc_buffer, priv->dma_desc_device_addr); fail5: free_irq(dma_irq, priv); fail4: From patchwork Mon Oct 24 11:30: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: 8928 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434764wru; Mon, 24 Oct 2022 05:52:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6F0Ukz3fYknehcf7kWnUHwhHZIptkaJsSeBTOVWg0mz08oqkeSH/Q4sH7k3G4O/dQsYN9F X-Received: by 2002:a17:907:3ea9:b0:78d:fdf0:88fe with SMTP id hs41-20020a1709073ea900b0078dfdf088femr28485988ejc.667.1666615974169; Mon, 24 Oct 2022 05:52:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615974; cv=none; d=google.com; s=arc-20160816; b=v8wqFlvxta7T7O1HfuTvchsxDyU7dcKJ8xkADLxElla6pqQhKgyipINv0h3DlcYjH9 lBMRAgXXyLJ7ljYEv6FUpdg4hnDF+ZUxKyJfakXGfudSfY+W/KkklKmDR3V4PwDorFeV BiDgYxNqwR5F5pHrf2Jeb7qTHbqKJ6OMq6ubd4jhy43NPcpS7iZfkVr/ztT2KDLEET5c yaDfEN0xzkV1EVFiYSubZBzcuheTxmky7O2EP0pX9na1Vl8lXFWiV7fHmg1cF+p8IIBe gBTGTIVLbspjYCTZkTW+lXZjl3aL6pIDuvMHA0wsqFaKkO3wRxBti9DI83RE4N9Dx/Xh g1vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UWe/0d8MWcfmz7HNB6Ulj6buLFxeGeEANw016p6IHy0=; b=mspDnR3jgk1/aH805ebjsIiPQoXPtOY0pCOpetuvZn+Vr1JC3UkfDSCQPA+ACKlro3 4BwpXsYXmeO6obycVHovAuD+utx+CAEexk3nlbx7j7IWEvnzXV4PasHv11J9A7meB1zC UoGfL3JOBqn4VS+0vKKf5Y0FKRNXPBUMo5Ypif4ILxKAZTjDauCDFw4U96upHg5KCrlm DWGag04jYNSK67l9b0OlfHL+5PwtPkpkrtHC5Mydkn/HhYcCbOk69IV28gat0dwG/xoy v2teNrxBn58y+39JN6ChuFtyF6GdgnXcpekEnvM86cZaD3OzH+rqpyn2uKT4/cXMBiuz 4hgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Y7UyAuIV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bx26-20020a170906a1da00b0078d45e9d485si22898048ejb.709.2022.10.24.05.52.27; Mon, 24 Oct 2022 05:52: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=Y7UyAuIV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234493AbiJXMvZ (ORCPT + 99 others); Mon, 24 Oct 2022 08:51:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234715AbiJXMpd (ORCPT ); Mon, 24 Oct 2022 08:45: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 772F7317FA; Mon, 24 Oct 2022 05:09: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 4B400612F5; Mon, 24 Oct 2022 12:09:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B4F8C433C1; Mon, 24 Oct 2022 12:09:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613350; bh=wF6UUJRkHf9QYtND6AvtkHRvV5GkEmtaCAcf59ra3aQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y7UyAuIVF1/nFgIIjYbYO4nh379hMu3puDVaWlqsoLxB0yXMqn4YonpfHGU5oyoEQ rBkozKaZ932gUiDY1DMCIqbtnqhPmxifAFcxzizKBZMhol85hZTiixRIlyq5wz+ZIM Brnq66k3WQS4XqlF9+PXvvd7rGFuHa/T9AobhvW0= 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.4 104/255] ASoC: wm8997: Fix PM disable depth imbalance in wm8997_probe Date: Mon, 24 Oct 2022 13:30:14 +0200 Message-Id: <20221024113005.922301368@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573511862294822?= X-GMAIL-MSGID: =?utf-8?q?1747573511862294822?= 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 229f2986cd96..07378714b013 100644 --- a/sound/soc/codecs/wm8997.c +++ b/sound/soc/codecs/wm8997.c @@ -1156,9 +1156,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); @@ -1177,6 +1174,9 @@ static int wm8997_probe(struct platform_device *pdev) goto err_spk_irqs; } + pm_runtime_enable(&pdev->dev); + pm_runtime_idle(&pdev->dev); + return ret; err_spk_irqs: From patchwork Mon Oct 24 11:30: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: 10193 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp641803wru; Mon, 24 Oct 2022 13:36:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7UTRSYS4JWBcYgxf/dBpzyZs0XGq/HVlt2wI7rpI2te9PfraxVcfXZzQU702yVU7n7d+ew X-Received: by 2002:a17:907:7d90:b0:78d:bc5a:913c with SMTP id oz16-20020a1709077d9000b0078dbc5a913cmr28812295ejc.390.1666643795898; Mon, 24 Oct 2022 13:36:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643795; cv=none; d=google.com; s=arc-20160816; b=ePCL9lLBQp7jC4XOJr59MNioILaRPx/MQO3PLbgPArJmGjux1GfneZWzEos6Age/fw GUnFF4efQusY8YYCkxG0mbPbV9VbahDoNTCUqEgQGG/AykPhU4B8xHbNWd6unxo0y2/q e8ouqF7jExmKPQy2SwElm4NE3aNHR6D0oZ5R2gcTYu0ceFp1W5nsMfV7K0eXe9EAkVGy eVvCIs0kFeLJMde7FXKFDnXG4lIGHSAvdmmyxcj79chZ9yMUH12gflGJvAXZ07GeXAgN TJdMFhY12UmA/7DE767yveWHz1m3xSenRxfdxbGlm+gPaeYAaz729UhLxdWIAkvSsA7Y Saaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YP7UZEqKr1ufPntwYO7ntcD3yugAAp6Px/OEPJEV88s=; b=MpST+BBpmC7oscgm4CCvlDwSJZryCftZgPfCtfww4h3Q2udVhwV6sPHNqUbT/qkkw5 h1Q8YLAdvNU0UB66vI3d5Ueq/ThwQdEqEy4FumYTSAr41hDQD1PWvcWHL8eJx52a9rTd mTDgE4s4f+ThdYLSlncmBWcoM+zOl1k4MLRSQL3FGtYm+loImJgrFktzMxbVcw41/2tb 038KPaKT4ZE9svda0awSvcYjo0d6+Nd7OTXY/Xydz1wbwny+3LU9FrQpFSZTEdv8I9FE QMv1ghF+sBK6Oj/RG1u9U9bJn7YNOYkS/Ujcmhu+WQQAW27X9XII/CLHbh9UoKa6lDyK 6aLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="CyD/vG/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 h5-20020aa7de05000000b00453b9f11b56si598987edv.261.2022.10.24.13.35.56; Mon, 24 Oct 2022 13: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="CyD/vG/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 S234278AbiJXU0L (ORCPT + 99 others); Mon, 24 Oct 2022 16:26:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234444AbiJXUYk (ORCPT ); Mon, 24 Oct 2022 16:24: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 55DCF25E9; Mon, 24 Oct 2022 11:39: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 94B9CB812AC; Mon, 24 Oct 2022 12:09:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F271EC433D6; Mon, 24 Oct 2022 12:09:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613353; bh=zVw8f6eVRwzJ9ev+ioz6DzxGJvAN9wL6YL/KwtGDU+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CyD/vG/IntdEKMr1foHhAEOMl1q499e1HtPeoYBAfNONErXpwZhoVO9KQJHZoTNG1 WysHooo2BmJhV4jae3DgY+ouNCAkwN4pzTvbO7TmGHAsPJmKEXuLeaBQ8HfoohYLMv QC5KrMZwoAXAcHcrZYO9M5Z8fvICqS7QVenySmGA= 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.4 105/255] ASoC: wm5110: Fix PM disable depth imbalance in wm5110_probe Date: Mon, 24 Oct 2022 13:30:15 +0200 Message-Id: <20221024113005.951281610@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602684472747887?= X-GMAIL-MSGID: =?utf-8?q?1747602684472747887?= 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 06ec3f48c808..bbe9fdfb423c 100644 --- a/sound/soc/codecs/wm5110.c +++ b/sound/soc/codecs/wm5110.c @@ -2452,9 +2452,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); @@ -2487,6 +2484,9 @@ static int wm5110_probe(struct platform_device *pdev) goto err_spk_irqs; } + pm_runtime_enable(&pdev->dev); + pm_runtime_idle(&pdev->dev); + return ret; err_spk_irqs: From patchwork Mon Oct 24 11:30: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: 9224 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp460785wru; Mon, 24 Oct 2022 06:42:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6CsJUgqxKHvWJsDdy06ZQIPOgUF8VZCul/1hnsgjs45IEnNJH/86VA4ceBDfP/Kq1pnKPv X-Received: by 2002:a17:90a:1b44:b0:213:1035:f913 with SMTP id q62-20020a17090a1b4400b002131035f913mr5927867pjq.133.1666618947158; Mon, 24 Oct 2022 06:42:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618947; cv=none; d=google.com; s=arc-20160816; b=PFWEwErwWSK2oEwo5s1Pv1x6rWGq7cHnRdNqBYDmMi1X44we0H05TGy/vJDMYHBUKy AVeoDF5T4JeDgHsjI8HuNYh7MCsLof/Ep5A5dvxi5ZFF9uk/HXnccQLd04wFlLkOWF6e kVbTnkR+7of+yJT7gaHruREd4NTurOq7Alu6irmQ2U9vzbVV37ahKd3MLryYGDd04lYT +T4QIO7Ey6w+tEoby8K5QGHmOdQ6iFfk8N1l71WUjJQg/518JB4feV70mSNbZOWcrj5D bfkKAYkatvsQvB5MsHFxQUZ+Tzu8igtCvb46IeHeECc+WxlBRUmEIXRIUow9YgbiB0u2 zXag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ibRUFsOB90Rr7ZXqgEoANmAxqzJc/03YSGl8xaidVfI=; b=vYVVC5U6pBvWzWIa/pC2eyKynC47N5+zs7QP3kLksu56vsOHWPocIhvwqeEOP9kCRs mjFMrlkW/DoMszapyjfoLLa2CInd5bEyjR0PBwv8bYshaLwrOHR+Gg5UAZFwBAXu+R81 tV07IgttV2YeS/G1m0HEN4jhphy632QnfryGnaJFYed3Zf4VTIaRfSV5vkfsNhtTNsCV lnzjeTXbbB6pxmcP8o2gvt1MacH8CHOtpZ+2qwWrzKuIG6Xr5OXOjw8CmDhZPW4l0uOK dS7hHpb6N40h58fTZEEsfETTrscuuuvoLb6tRVC78MKqBiSA7wthTsNw0Rs5W1rULyIE PW5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qP5zeIh3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r134-20020a632b8c000000b0042b30f95f99si36033741pgr.807.2022.10.24.06.42.03; Mon, 24 Oct 2022 06:42: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=qP5zeIh3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236055AbiJXNeb (ORCPT + 99 others); Mon, 24 Oct 2022 09:34:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236208AbiJXN36 (ORCPT ); Mon, 24 Oct 2022 09: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 6EABA39BB7; Mon, 24 Oct 2022 05:33: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 484F8B81334; Mon, 24 Oct 2022 12:09:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A079EC433C1; Mon, 24 Oct 2022 12:09:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613356; bh=ftqTTz4oueZLOW8B6OOpn9+6JAH7uQ2dzq2hyjs5PNs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qP5zeIh3arv2uXg5wLR/mtoKcyyOtJwt6k6XaqexITHj4bCPy1uUxJ3oDy/7QuVea Fw1FPcRbrUOwHnxZFSZsIr/D2y8+m54G7ZF3pKs1TlOMKmPOi3/CTgUx0muAph82Ub a8qW9inXAHIRaf2hKg8iCxi/291JevSn846WBKjk= 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.4 106/255] ASoC: wm5102: Fix PM disable depth imbalance in wm5102_probe Date: Mon, 24 Oct 2022 13:30:16 +0200 Message-Id: <20221024113005.981453324@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576629293639725?= X-GMAIL-MSGID: =?utf-8?q?1747576629293639725?= 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 d6d4b4121369..c5667b149c70 100644 --- a/sound/soc/codecs/wm5102.c +++ b/sound/soc/codecs/wm5102.c @@ -2084,9 +2084,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); @@ -2119,6 +2116,9 @@ static int wm5102_probe(struct platform_device *pdev) goto err_spk_irqs; } + pm_runtime_enable(&pdev->dev); + pm_runtime_idle(&pdev->dev); + return ret; err_spk_irqs: From patchwork Mon Oct 24 11:30: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: 8927 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434700wru; Mon, 24 Oct 2022 05:52:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM64f3bQ/s4YTRt8gA1IC+cn2m8uVQ4X443uXK1GbFtpAQb9IeCYgH2tjWLFXb+1ma78yShP X-Received: by 2002:a17:907:6e11:b0:78e:3057:f631 with SMTP id sd17-20020a1709076e1100b0078e3057f631mr26768279ejc.333.1666615965676; Mon, 24 Oct 2022 05:52:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615965; cv=none; d=google.com; s=arc-20160816; b=QXLRSKRxxksij/gNWSoaT18z5GEWXWkWQRT12/qKZmpYD0uPglZS5btV/+qTADiDYz Kd6wNGbOd7YmUzyVg11FTfRHgSPv72AMXjpU+2NDVkD4IQg47q8c87XNV5k6fmJ3Q68U vR8n5WjK/rsCDA+E+W509iaGW+3H7+X4pqSaucUIKYuTg5BPVSmPCVvEHQSoVO2H7QK+ 1RIVnRh8ifS80XcGsOPt8pn9q1H6RCGJUfVVlLADS/Vy6ZXrbQrOKvX7mntu8+1gSolq TIK8sRdmKEfgEWx/13w7X6RJ7D+pwH+aXlB9pStVYK7Z/Grt1fWqBXWwXV7Xw/N2H0Eq 3mNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tPpTEAkDY5531AJf31+gAZ7Al2FLDyfU0DjNy9fhmm8=; b=KuTgDh2hM02VSeplg7Kv20Jk4pP68izIFab6t7xS2lxxgxUkl/zNAkQm/Q0dSAnh7b I8Te27wKo2QgvGE+ZyyiSD7OH90bKc4msDwKCHg/7bhKnGO0UNXnxwSNPXWuF5dW/5dA 5Pfqf74xzMryx4PFrs0mRG+Hcw3+N7COZjBHB7Y+FJo9prji51bxEH2DviVtHxVl5aNV Yrn/ZuWLTTM8iAw0mRbbR2M41LGDX7trVRH3xoiYTvv9B7KDZBVXVJGpVpbMr/zQd4i2 IDJQxBqCIgEPYbrGnVDHNkT9IgdPzQ3EfSuiRawOzvLeERdON2fIIlHT/B6ao9fOPTfU CaoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jOjUGyq0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nc23-20020a1709071c1700b00779f8e7ec5bsi28751424ejc.42.2022.10.24.05.52.20; Mon, 24 Oct 2022 05:52: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=jOjUGyq0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234478AbiJXMvT (ORCPT + 99 others); Mon, 24 Oct 2022 08:51:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234713AbiJXMpd (ORCPT ); Mon, 24 Oct 2022 08:45: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 16E3520BE1; Mon, 24 Oct 2022 05:09: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 062C261254; Mon, 24 Oct 2022 12:09:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17F1BC433D6; Mon, 24 Oct 2022 12:09:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613361; bh=2Vjaw+jnNPYG7C987hDFRmh/ww6z2y9ybP/IXCozQTs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jOjUGyq0IzlmWu9kmm6mkur/pupHbEG0AB5gO9F3p8RqSfS+v4KT/QoWIRW3zRb+N BCsE0mlQo/w/5KpAdEoFgQHEDOMALt7tcyYaFuLlNJWS+SnnkBQxQHTgk2SHj7nAmE CEF+2ncMsbdDvHQpzu68uODC8ExOa8XzgER+SIzc= 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.4 107/255] ALSA: hda/hdmi: Dont skip notification handling during PM operation Date: Mon, 24 Oct 2022 13:30:17 +0200 Message-Id: <20221024113006.021031087@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573502622803043?= X-GMAIL-MSGID: =?utf-8?q?1747573502622803043?= 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 169e74299987..091a7fe85451 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -2570,9 +2570,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); } @@ -2775,9 +2772,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 Mon Oct 24 11:30:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9115 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456164wru; Mon, 24 Oct 2022 06:33:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4D1e37sJcIEbHxiplKjvwIne1iwVEvHHbes3dPXat4UTKbZay3THXks9vNJRpnLzmC9fUh X-Received: by 2002:a05:6402:10c2:b0:45c:3c87:721f with SMTP id p2-20020a05640210c200b0045c3c87721fmr31968757edu.251.1666618421470; Mon, 24 Oct 2022 06:33:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618421; cv=none; d=google.com; s=arc-20160816; b=Z7ELIz7zDtUihPoYhKHJXMKGKddUASPdz7wua3Uvei7Vqe4jerYc9mQ3qIhBfk3rru B4FtXcpOu9GgpJKWFKMX/aIno+5oiRbiEhgdm4T1S6mULLOoYd2fmwfQJD2Q5zE0tO5P eq+sGR/o9FVdU85VlIJYzrsbo9kwpPgsmXGy/n98DP9pt1rsDItVhONcDlN71qOdapix eHF5pfv5LPyw1S35M4/FebzU9eIbJfXvswBgFBOnJP+jfU7o3dUOCkX0FmRHrv5HaJkH s61ibs2iEWAkMl487IcGVJKnoNxV8fwHUzmT8LgENRmh528KNh8vqcmqUFtSDz1a3ltZ gEhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FQoIe7ktJmDTjQSNBl3d1Q1buF7U+4SVqEiDxhw/g4g=; b=XDqw3Py+zF1hGewj0Yxa/1Wrt/MpnHiN5TfBF3nNWSudP/Eh0hCKsDlqNvIWcB6xyj GWFKHXsvjru6kpry+FbxVFmR9kQVQxqKgiUWIE5nPH5t9pOS7cHPEFf0u1Dy9D+uhxJ9 uQzVJztoglnSEwaTwlH638w7wPZl9ihdPrfk2ShreEHm/IasrWdEqwFKVCDy+L5syKQv AKVFMrAxWIAYUPHIx05Z8h3FxbXe2OII5yGeospQLtGXPLFjwr87CKsHXKY2CJePZ2TP spmETrpeZtuwhGf3VBh08bl9Y7hBM+BXLmyN8xXVbhxU3q07Yp9NHbGbFvia+jtYi1+1 h39g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AK4q3fUK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m13-20020a50ef0d000000b00461a2654335si4270002eds.425.2022.10.24.06.33.16; Mon, 24 Oct 2022 06:33: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=AK4q3fUK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235884AbiJXNQa (ORCPT + 99 others); Mon, 24 Oct 2022 09:16:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236101AbiJXNOr (ORCPT ); Mon, 24 Oct 2022 09:14:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FA1DA23EC; Mon, 24 Oct 2022 05:25: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 59BF1B81289; Mon, 24 Oct 2022 12:09:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE78EC433C1; Mon, 24 Oct 2022 12:09:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613364; bh=YCXQS2xzc48G6OVfeIwrWrM+RKOJvvmspSjHPzG5Owo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AK4q3fUKJTgLgXLYKcxOJsRuo5PU/pK3SBjqvHojMbKj3EFfmvzPzJ5ga5bzbaex1 J7weXY98U6/mHmc80/Rxe+Bxv63J1R/Mfan8dGPXnL5b+yZ/mmrjNwCmXun4Ebp1kn BNlm7/yqmxm45cwMjOv8GkETNceQU+6hPj0dSuT4= 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.4 108/255] memory: pl353-smc: Fix refcount leak bug in pl353_smc_probe() Date: Mon, 24 Oct 2022 13:30:18 +0200 Message-Id: <20221024113006.059859095@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576078143011171?= X-GMAIL-MSGID: =?utf-8?q?1747576078143011171?= 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 cc01979780d8..322d7ead0031 100644 --- a/drivers/memory/pl353-smc.c +++ b/drivers/memory/pl353-smc.c @@ -416,6 +416,7 @@ static int pl353_smc_probe(struct amba_device *adev, const struct amba_id *id) if (init) init(adev, child); of_platform_device_create(child, NULL, &adev->dev); + of_node_put(child); return 0; From patchwork Mon Oct 24 11:30:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9747 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp548947wru; Mon, 24 Oct 2022 09:42:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM78fmBhBVKD7RzP8sBsKK9Q/p/x8ykeI8oW4+sfOUleNTfb1PgKzOW/JxND1eB1aUzV/EgY X-Received: by 2002:a65:6ccd:0:b0:439:2033:6ee with SMTP id g13-20020a656ccd000000b00439203306eemr29554198pgw.271.1666629774965; Mon, 24 Oct 2022 09:42:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629774; cv=none; d=google.com; s=arc-20160816; b=KDHaPuSfnVkN+wuSSFRv4pXVO5UjxxxnL1R9BehCm0T+BlU+OnV1x8JuHSOZHzYnbN uMArtCsYB+C9jxEu1hxxQWCfr7PbPDphPmFqs0JVC7wocr6TiXFbuYKpSGefRmHNNHKN 0asIfv6xbE3fZLQDorLYNN9VxzLG24kNavQ6GDFtUh5dZQ9aclzcx129JhWSa4YY69Xt jEHTrs3LilNZD2LcshLH76apxBjOiSHgEbMop0UqGGLHh3WE0Dpsu9JT5++oD4uN93e+ wDUpxO4s9bmT4vqs2QU6YwF2Lp6w8pwJnrOfSvs+tRvoOG1NQ6X6XbS+tl4G1cyqVaVx tNwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2vl5V9pT1vFdnllBfDn9kAQ6fSg/ASdf0DY5/XYic3c=; b=wBgH8wdnGniXH9Dq4XILRIGo6PCvvQfiyh42ko5n2YQjTCtkEx/HON//mtjCRLgpEa lEMAuZWU1rSqVCndE0BrbGlq8jDFJVb4R22YLyZRL1LK30tW/lLyf9w8Czz7n+kKqvTs 8nhFgCGuW/Iu9F9mKv0mZxCALLFh3kNW0+YqwnP8OlNh8IUDfdmP3XCd7oJPju4/mpej Tarni/1D1MYprrdpIqV1P9X4VtyYpUHp6YBi/lIKXiJzSTyBzwrBpelNDb5FFClTh9ER GRXQFavrIAa6NmTeb7oNOJOP+UXYI0rrYIhIqrV1yb7M5Du5ZWIGcuGgkRUSuHPhDCVP peNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=e3bBgxAU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y193-20020a638aca000000b0046edf6af557si8103497pgd.839.2022.10.24.09.42.41; Mon, 24 Oct 2022 09:42: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=e3bBgxAU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234639AbiJXQmQ (ORCPT + 99 others); Mon, 24 Oct 2022 12:42:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234491AbiJXQlW (ORCPT ); Mon, 24 Oct 2022 12:41:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E753FA18F; Mon, 24 Oct 2022 08:28: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 E9A62B8133B; Mon, 24 Oct 2022 12:09:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C8EFC433C1; Mon, 24 Oct 2022 12:09:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613366; bh=yid7h1IcFvUUz+yr0Ju4t5/VBxBQceYRkM+JldNnPCY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e3bBgxAUP+M+Jd8blBglFIF8JBg6NMnMWQjDrNwdFZpKb9qfJ2tkP/oe/TXyxChU8 VQIvlp4sUk0lH2L1ws/XoqhXUMYlXrjXCk0TWxew6jxdtsDH58V2RKmYCwc+VAEYCO z1pnzF+sdirgGCpmszyuSLMSFdILTkRj20PbvnbM= 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.4 109/255] memory: of: Fix refcount leak bug in of_get_ddr_timings() Date: Mon, 24 Oct 2022 13:30:19 +0200 Message-Id: <20221024113006.100020154@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587983151844780?= X-GMAIL-MSGID: =?utf-8?q?1747587983151844780?= 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 46539b27a3fb..835754304a7f 100644 --- a/drivers/memory/of_memory.c +++ b/drivers/memory/of_memory.c @@ -132,6 +132,7 @@ const struct lpddr2_timings *of_get_ddr_timings(struct device_node *np_ddr, for_each_child_of_node(np_ddr, np_tim) { if (of_device_is_compatible(np_tim, tim_compat)) { if (of_do_get_timings(np_tim, &timings[i])) { + of_node_put(np_tim); devm_kfree(dev, timings); goto default_timings; } From patchwork Mon Oct 24 11:30: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: 8926 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434670wru; Mon, 24 Oct 2022 05:52:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6m3HfOhqTb+/xM859qGDjfn+bd9naq4SXfpprh1x9sm8XHSd5yC9pC7V3aBpjvTHj+uL5r X-Received: by 2002:a17:907:dac:b0:78e:17a0:d1cb with SMTP id go44-20020a1709070dac00b0078e17a0d1cbmr27755782ejc.618.1666615961242; Mon, 24 Oct 2022 05:52:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615961; cv=none; d=google.com; s=arc-20160816; b=j6FB/mHAtjSosTY8sNF6sRPQaOx1QScXoJ8FNVBitCCnlCGUVUtZnE363MwSaZ/+jJ z9ub4X/fJv9RlkqbYbra/HGp+G3zjKZos9O3DjVLMBkd6CSYz7a+50GrGUSgeGJ0laYw L6uTP4UlUjBAsC6xTs4AjywGkDjZRWCaRYCoopbmzgLV9QrsB4s6KIe7U6MbEbMyFnQY QZcKnN+aBq0BPigKmzUnt8sB8OGJy2cOF1MhVHmAuxyAXlsNTvIfD/VmQqdYpXVRyapR TUWVcnRtDh5VPiQ3cgnGYwRfurwyt8VW2thAjE8Pn6B5W4nGXoExkHAcZcKuZYV/DGdD 8jYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XXkRnNRnS71n76ApnkrnNyCg0eJtwia58A4rfORHHxk=; b=AJgyuDIHvz+sNMYIIiOSsI8GaYPSye0SLZhL0jiU2rExZpTSRHgnyd43gLXFQRpcgL KWK6RhQ1p7jNy0ZlYLokOXKJQqe/W655vgoChlg7Si18dAx01ysGCSYYPh7SZOr4XZJD mcPf5Bim4hqee4LzQ59z6db85MEEcEVSIhh4G6z9GVSvgy4nFPRPmiJNM7NM19UzGez5 CCf4G9ZaU8cxe8u23xNSlfkuQVAhlcrXMLYYyqR0gxIoIEKF5/EGNK5+54vOoXEAUJcu deP1a+3iMDi1wlKbWInkMJZPFhzG0GVqLJlDV9ZukLOctCWLbMsHL9W7T9eZ0zvk6TwH 5dhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wxuh472X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r18-20020a05640251d200b004593895fb89si1213903edd.390.2022.10.24.05.52.16; Mon, 24 Oct 2022 05:52: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=wxuh472X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234464AbiJXMvN (ORCPT + 99 others); Mon, 24 Oct 2022 08:51:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234712AbiJXMpd (ORCPT ); Mon, 24 Oct 2022 08:45: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 3A01A31EFA; Mon, 24 Oct 2022 05:09: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 DB9256127C; Mon, 24 Oct 2022 12:09:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0A11C433C1; Mon, 24 Oct 2022 12:09:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613369; bh=Uhl66iM0KuPXimYo3oJQbWlMZPTK9qOjxrbDCHLHOMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wxuh472XpSxQa10UbbXejG5ln65nRlpLA3p4XKsfQQM2h9vRuYn2Rnc4AnVE/am0K 8QWCd8SQbhnygq7eI0ygvVtjdHCLIMlhcXhEp0mCXbKaakQEpOgJ06QCipOGwY2Z40 v7HNtbVRi5VdVeNoZFuK3AuFMkWv+xO6Don6fpME= 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.4 110/255] soc: qcom: smsm: Fix refcount leak bugs in qcom_smsm_probe() Date: Mon, 24 Oct 2022 13:30:20 +0200 Message-Id: <20221024113006.146074628@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573498127910262?= X-GMAIL-MSGID: =?utf-8?q?1747573498127910262?= 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 6564f15c5319..acba67dfbc85 100644 --- a/drivers/soc/qcom/smsm.c +++ b/drivers/soc/qcom/smsm.c @@ -511,7 +511,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 */ @@ -519,13 +519,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 */ @@ -533,13 +534,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 */ @@ -550,7 +552,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. */ @@ -580,16 +583,19 @@ static int qcom_smsm_probe(struct platform_device *pdev) } platform_set_drvdata(pdev, smsm); + of_node_put(local_node); return 0; unwind_interfaces: + of_node_put(node); for (id = 0; id < smsm->num_entries; id++) if (smsm->entries[id].domain) irq_domain_remove(smsm->entries[id].domain); qcom_smem_state_unregister(smsm->state); - +out_put: + of_node_put(local_node); return ret; } From patchwork Mon Oct 24 11:30: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: 8925 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434665wru; Mon, 24 Oct 2022 05:52:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6KeZMHzmuEzDIAd2j1+u3Jxp6CJfHRu/Td8Lrma//LqEN6cypA9zmP6Zu+QHKIyknFjemz X-Received: by 2002:a17:907:94d6:b0:78d:f947:7cf5 with SMTP id dn22-20020a17090794d600b0078df9477cf5mr27141933ejc.446.1666615950218; Mon, 24 Oct 2022 05:52:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615950; cv=none; d=google.com; s=arc-20160816; b=LU5gpN51iOkHrEjosVD6kkL71qtQQrQ9miGDSgDybXwvuqJ07c+fDLPIQee6HnkWL/ pl0JEoDoD0tY1LZcx3qc6QvbMU9D3lizNQ3eT6bWmVawE62U+8OSG4JJOSdBfgYWKO9K 9+bGGnGn3nrNsOtyKUBsfnp7LDDGB3pMA0+yb/g0VJvfrDO/y1MYbm6Esft8x0n63S8z DQvaZzRcpKJNcIOQdVOT0wfV6ujNRl5LJOdhwSFRQi7qd12XZhMkaJEyEYyRR2DhsQQ/ KVH3YgnOVf65sH7nKcVQ55//OSFiLlXbr1QGAZv7u+E7JlLiXmIMvwq2hYw28pdpqKCO K/PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4OtXHtQup1rGtIK/IDVIEl+JFc9Pp/hplrE967immRY=; b=WDpIpC2va2mTP2J70i2CfpjPZ5n4/MDxcVQmvVQaWuPYvCpbKL3RU4IM1cpgEwk/xW rsfSRGdU01BTPEDrjANwV55H4DLqoweR9+ibZAaoGBGnChENIiC8ubeNWsZRiSCBgSv1 AAjsLsaxdSpWOeMNIC5BxbuIafXYuLG10bXxqmTa3SxNWmGpc4z7yn1aPSPSB3IT5uq2 7ZGzQ9VALC0//QU0DMfborzgn0eiJQBrgUyfyRAKoY/XCoHmCEXQDYvQzXjxJw1fA3+z eqXBnyb8F1YakMmiOyc4DbLDb43WA8RTQ1xFAcs2v9Jw5CcYAxM9uAWN5guLhsNmDsSp C2HA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=reDOfpne; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf8-20020a1709077f0800b0078d62ae01c1si29782498ejc.536.2022.10.24.05.52.05; Mon, 24 Oct 2022 05:52: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=reDOfpne; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234415AbiJXMvA (ORCPT + 99 others); Mon, 24 Oct 2022 08:51:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234660AbiJXMp1 (ORCPT ); Mon, 24 Oct 2022 08:45: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 0113A193DF; Mon, 24 Oct 2022 05:09: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 855E76125D; Mon, 24 Oct 2022 12:09:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B653C433C1; Mon, 24 Oct 2022 12:09:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613372; bh=kQWJbAtvZifP1shAjObse3DkaoIE1hj0tuT6mBsGAMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=reDOfpneOrbcXU9Jlex5H13XUl9Sp/sjF3877AoXTUh5gNo7Rcq/gNhxdIzBeHgdh eVg/Y3iTjsDp/vlgSBqCaK7gV5ugHcY35aIeMH6kI+cHzhmFRZF+8hMhxAkW7eOM1M 1QSuvAoE/2PP/watZM6sUo38vVqybmrMFZBdjE4Y= 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.4 111/255] soc: qcom: smem_state: Add refcounting for the state->of_node Date: Mon, 24 Oct 2022 13:30:21 +0200 Message-Id: <20221024113006.185176924@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573486427873580?= X-GMAIL-MSGID: =?utf-8?q?1747573486427873580?= 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 d2b558438deb..41e929407196 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); } @@ -169,7 +170,7 @@ struct qcom_smem_state *qcom_smem_state_register(struct device_node *of_node, kref_init(&state->refcount); - state->of_node = of_node; + state->of_node = of_node_get(of_node); state->ops = *ops; state->priv = priv; From patchwork Mon Oct 24 11:30: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: 8923 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434609wru; Mon, 24 Oct 2022 05:52:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM53MIsSfykTcvkaVDI5Nswcyj/Hwau9j9rcj5IFsBf1uavlCklIgzyt31p+b9iAX9Axfuit X-Received: by 2002:a17:906:da86:b0:740:7120:c6e6 with SMTP id xh6-20020a170906da8600b007407120c6e6mr27200391ejb.44.1666615952735; Mon, 24 Oct 2022 05:52:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615952; cv=none; d=google.com; s=arc-20160816; b=yycNx4Z/kUO7AmS9jFLED59FGYyIE1KOfMHaavv50zm/zWSkPFYyaL85co401tPE2h WpJzQI/uCZGCWdbIgH++duMT93jJSDG6x/3e7HQtczaKP1sZxpIRFgRm2FhP6HWxbMRl FNlbd5IzERTk9Nl0D9jQXncHlrsWyT9hBc2xJfh5sYlu3ZLYBT7Bd9K6+Od4VPwonQGp lxpjqzQK0exiqJlJdw4U4yvDk/bGd4SoH7KtEEXgEgmzMJveVWQ00qa55Kn/SlugsaRE YgbTh8fNL8bLQuCXYsCJjvmeveiPZTcigFoVO4wvXZnIdREEJH6hv1npmCuYxvheKYKg GTRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GyJzWI/3K+eYCuoLWmEQ/RUEr2IgU15DA+HH+EwjSks=; b=PoR145ezcpvPKQUCCpCGoCB938uBFcj397TFTepX4pFfRuUXxiMfkByLs/3+iTRzUv Eec8a/BUEneZ6sGwb92eAjYS5amrH9d2IiAjebY0J+DEeqT/2QI0MEWU41o5IFXybQVq LTefMKvZynhHgKGinLqyNTa4QDBz51gfnVMGX5LsCIM+cQG4P1HaxyRQNNiF97d5WUXU wn9FaYs7W0+zOZtq3jPBEQc1hxrbNqggWIQ+aEdD5I3Vc+CPX/vI+2KEX5OJ7JdtRzqH eIARtNzm1CjRiKtEnACHGs4s+bRZbVl0AYxlCmdvweggIyCSHr8j+zNCGPTiosBeP1Uy CDaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BC2w4zXg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v15-20020a170906180f00b0078d20d71475si24080032eje.413.2022.10.24.05.52.07; Mon, 24 Oct 2022 05: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=BC2w4zXg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234419AbiJXMvF (ORCPT + 99 others); Mon, 24 Oct 2022 08:51:05 -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 S234683AbiJXMp3 (ORCPT ); Mon, 24 Oct 2022 08:45: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 6265A6156; Mon, 24 Oct 2022 05:10: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 1D1F86128E; Mon, 24 Oct 2022 12:09:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FF02C433D6; Mon, 24 Oct 2022 12:09:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613374; bh=cHT/tctzQJbGiXiQn4s+uUUWvv1Z72ev5clpduBCXxw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BC2w4zXgazcjXBj03+wWOvmxN0Zkt8ShfQvMaUQnZxuLFovN8+DR/gsirqroUrma8 skFkL05ftvG/yNDHGQtFyDqgK7qNe8RQ947WW/AHl5AWKCeHEKlwTPuNDZUhd4IJyN UAmQP4zTtuTYEOE7ZVBrKS09I8bgNcZDag2EVp5g= 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.4 112/255] ARM: dts: turris-omnia: Fix mpp26 pin name and comment Date: Mon, 24 Oct 2022 13:30:22 +0200 Message-Id: <20221024113006.214478404@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573489401249617?= X-GMAIL-MSGID: =?utf-8?q?1747573489401249617?= From: Marek Behún [ Upstream commit 49e93898f0dc177e645c22d0664813567fd9ec00 ] There is a bug in Turris Omnia's schematics, whereupon the MPP[26] pin, which is routed to CN11 pin header, is documented as SPI CS1, but MPP[26] pin does not support this function. Instead it controls chip select 2 if in "spi0" mode. Fix the name of the pin node in pinctrl node and fix the comment in SPI node. Fixes: 26ca8b52d6e1 ("ARM: dts: add support for Turris Omnia") Signed-off-by: Marek Behún Signed-off-by: Gregory CLEMENT Signed-off-by: Sasha Levin --- arch/arm/boot/dts/armada-385-turris-omnia.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/armada-385-turris-omnia.dts b/arch/arm/boot/dts/armada-385-turris-omnia.dts index fde4c302f08e..92e08486ec81 100644 --- a/arch/arm/boot/dts/armada-385-turris-omnia.dts +++ b/arch/arm/boot/dts/armada-385-turris-omnia.dts @@ -307,7 +307,7 @@ marvell,function = "spi0"; }; - spi0cs1_pins: spi0cs1-pins { + spi0cs2_pins: spi0cs2-pins { marvell,pins = "mpp26"; marvell,function = "spi0"; }; @@ -342,7 +342,7 @@ }; }; - /* MISO, MOSI, SCLK and CS1 are routed to pin header CN11 */ + /* MISO, MOSI, SCLK and CS2 are routed to pin header CN11 */ }; &uart0 { From patchwork Mon Oct 24 11:30: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: 9751 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp549291wru; Mon, 24 Oct 2022 09:43:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4TbuwOydHeyv2k57jbIrS/aCcYrq77cooUrXGiTQ2/9qLJq8ZdrWxZpRoTA4k0iqp90Eyx X-Received: by 2002:aa7:92c8:0:b0:56b:d0b8:10f0 with SMTP id k8-20020aa792c8000000b0056bd0b810f0mr6079985pfa.46.1666629821338; Mon, 24 Oct 2022 09:43:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629821; cv=none; d=google.com; s=arc-20160816; b=ovtWAa+frOo40f7+Vb/mp/e1Q6/aeXGh1QfKCkyaUxTjLra9k+rW8F1zyuFuZ5r6CE pz+EKh/fk7AexRGRoj5odQ5urnqgLi/zouOypRvwEnSdXFl6zOjrgwjqs6MRcORdmfQr K08JfAX/cH8E4Qw2kYkK+kFs5XBHY3xSJnnTe5K4sYnJfNTbQ5e5IRk8B1fuS6Z9+TLl SGL0tC5k+keACyxRAWcnEpke+1q8bwXWO4E3wK/OwL42x24VYjKCVP4Ly6jL0T6RyPCz AtzjzsPtGJZObJEteUNzTFwFo/LgZTL+L+PMAjZDiydrfRuAkDRMV7d7J0hc1zsj/rIQ 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=RHN2Ske92yvWhsHoCz4tAmIpOnu73nVOxi2Cc3hoDoI=; b=a8L8uZVxUbp5VmUqJjNyXcu5XUljDWKqV9SAp5a5QUT9IhTtjmmD6PFPIgGkS57bkV 3LBOTpY9rYkDhx9pBwXHocIJ1Mxf52yWY+AHU3y+sd5e2M3Qv+vMd/5aAeqBtsfEk6Ca kPr2wwiqYD/bG4mzwhEsYTVScG7osKzyN8eSskFyXBGa4Lyo+uJhl/35SxbLni23CLhR eqcByAxSB5nyW5b2qXrdbXtXPAgsP08NcBP4HNYvgoyKJCxLoxAx7Ctv9x8mf5aOqlKf 3dFKD75CmAH0x5yggUfGcnXUCPBigB2dfiBVKby4mtlFjqMTWvwjx5o+wc/FgVicx2dz wcEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aAwRrwiu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 194-20020a6300cb000000b00457dced8b7dsi31544728pga.588.2022.10.24.09.43.28; Mon, 24 Oct 2022 09:43: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=aAwRrwiu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234601AbiJXQnH (ORCPT + 99 others); Mon, 24 Oct 2022 12:43:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234533AbiJXQmH (ORCPT ); Mon, 24 Oct 2022 12: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 26E142D1ED; Mon, 24 Oct 2022 08:29: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 6CDB7B8133A; Mon, 24 Oct 2022 12:09:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2FC5C433C1; Mon, 24 Oct 2022 12:09:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613377; bh=BBEZSL/kEaLKT0nn3CDJDaoaCe8MaFX+1kU7JZ+z9Ck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aAwRrwiukzch5kKrN8kbXcQjEEE8d+/hej6mX5TllsIoibDhpVlhW3CNYpq2i0W47 DxTfPJXVyDorvdo/NtucvxfjpjWdk4wqQxcwFJn/iDnifS56HlUwVky2GUJaETq6oS 5+8TyMzY6xlceeLsnBROq16s2fX8Oc74NSBT4ARs= 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.4 113/255] ARM: dts: kirkwood: lsxl: fix serial line Date: Mon, 24 Oct 2022 13:30:23 +0200 Message-Id: <20221024113006.244007192@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747588031391002291?= X-GMAIL-MSGID: =?utf-8?q?1747588031391002291?= From: Michael Walle [ Upstream commit 04eabc6ac10fda9424606d9a7ab6ab9a5d95350a ] Commit 327e15428977 ("ARM: dts: kirkwood: consolidate common pinctrl settings") unknowingly broke the serial output on this board. Before this commit, the pinmux was still configured by the bootloader and the kernel didn't reconfigured it again. This was an oversight by the initial board support where the pinmux for the serial line was never configured by the kernel. But with this commit, the serial line will be reconfigured to the wrong pins. This is especially confusing, because the output still works, but the input doesn't. Presumingly, the input is reconfigured to MPP10, but the output is connected to both MPP11 and MPP5. Override the pinmux in the board device tree. Fixes: 327e15428977 ("ARM: dts: kirkwood: consolidate common pinctrl settings") Signed-off-by: Michael Walle Reviewed-by: Andrew Lunn Signed-off-by: Gregory CLEMENT Signed-off-by: Sasha Levin --- arch/arm/boot/dts/kirkwood-lsxl.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/boot/dts/kirkwood-lsxl.dtsi b/arch/arm/boot/dts/kirkwood-lsxl.dtsi index 7b151acb9984..321a40a98ed2 100644 --- a/arch/arm/boot/dts/kirkwood-lsxl.dtsi +++ b/arch/arm/boot/dts/kirkwood-lsxl.dtsi @@ -10,6 +10,11 @@ ocp@f1000000 { pinctrl: pin-controller@10000 { + /* Non-default UART pins */ + pmx_uart0: pmx-uart0 { + marvell,pins = "mpp4", "mpp5"; + }; + pmx_power_hdd: pmx-power-hdd { marvell,pins = "mpp10"; marvell,function = "gpo"; From patchwork Mon Oct 24 11:30: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: 8924 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434646wru; Mon, 24 Oct 2022 05:52:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Kt5YYVzrTXToBbWNf9/b42rnKLfqGwVENH57c8/Hf4/DlF2MjqMhwDZ6hxeKycqRAk/3s X-Received: by 2002:a17:907:a071:b0:7a7:dc5e:eb32 with SMTP id ia17-20020a170907a07100b007a7dc5eeb32mr4352526ejc.519.1666615958502; Mon, 24 Oct 2022 05:52:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615958; cv=none; d=google.com; s=arc-20160816; b=gP1uZLDDWn08nQdaimhsh9KCNiEjBc1SnbbP21H2Dv6uhd7iVc22MSAbBn+bq0ICrl xOwrVguAWcXXySObX7CMSx6j55Ui3ba58V3FgkHgEgYXNG1PNQlDer2FYcYKMUVGbRDL gknhJ8PJmw9DyRJEqWP70p9YYYOaWUE1yDCj9SWwOR3qQjzWiInPdLvldwssCwnddPWH OtG/0df+UsU0/ocLA6ghg/PPlOYnW4eJzbAndIF/3MrHZV84xCixjUfBCEf7+y9mMz9d UlGy/fikHCpYoyuqJutMEwLpordOprtrvIjwRpecnTivLMllaCOsCtLXGQNxyWF4uB3e qKJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=fpRfER57yC5wS9+jzfmxtOrW8usHFoS7Y7Hl0/X91VMsbsmdOsuIkcnStcR/sI8dVZ zYZg4Uj1FU9TxMbZUitiZdEiWeUXOB7DdDWRtUe8Vax4AGOavtBsg4H26GrZizRO/Lc7 W5oBy46wooy7Izs7ar2E5ZlgDJkl1VxXQnewLq+R/Qf/UeTGBJWuwyHaZcd3hDl8MV/H 9GoWB+C6IO31c0qyIWA1wbEeEddbEuD72AzT80D9eIMKgz3BoQblf5jMw+OFQLH7q7e6 KCSEhHGi1M4a8XxNvQMeH6CC3T1mYO10An+fLx+vnCiFn4SsT1XHeCZDqwcxds8a5ak6 prsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cBdXLzup; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz35-20020a1709077da300b007aacd494fe9si617137ejc.311.2022.10.24.05.52.13; Mon, 24 Oct 2022 05:52: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=cBdXLzup; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234437AbiJXMvJ (ORCPT + 99 others); Mon, 24 Oct 2022 08:51:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234675AbiJXMp2 (ORCPT ); Mon, 24 Oct 2022 08:45:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62AB31B799; Mon, 24 Oct 2022 05:10: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 51C1E61252; Mon, 24 Oct 2022 12:09:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67104C433C1; Mon, 24 Oct 2022 12:09:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613379; bh=RLkQdPDMRCOU/IECOAC2hHaLhoeqjEyfi9vzRWGTaUE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cBdXLzuprUjmSy2/h4z7DVI6w3/K1BFFhIV8/jcg49NL1xSI2mI/pkFrFnBc1lz23 Ce8pBwkFqQVd7u8PMw4bv2LPttXEmKjBvh63yin1rKhkHlgruNfUq6VTawaANHBABv 6f+2mWZMSBHzINJX2s6iA+C8huE2DcHqembXJ7ho= 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.4 114/255] ARM: dts: kirkwood: lsxl: remove first ethernet port Date: Mon, 24 Oct 2022 13:30:24 +0200 Message-Id: <20221024113006.284226360@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573495195214236?= X-GMAIL-MSGID: =?utf-8?q?1747573495195214236?= From: Michael Walle [ Upstream commit 2d528eda7c96ce5c70f895854ecd5684bd5d80b9 ] Both the Linkstation LS-CHLv2 and the LS-XHL have only one ethernet port. This has always been wrong, i.e. the board code used to set up both ports, but the driver will play nice and return -ENODEV if the assiciated PHY is not found. Nevertheless, it is wrong. Remove it. Fixes: 876e23333511 ("ARM: kirkwood: add gigabit ethernet and mvmdio device tree nodes") Signed-off-by: Michael Walle Reviewed-by: Andrew Lunn Signed-off-by: Gregory CLEMENT Signed-off-by: Sasha Levin --- arch/arm/boot/dts/kirkwood-lsxl.dtsi | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/arch/arm/boot/dts/kirkwood-lsxl.dtsi b/arch/arm/boot/dts/kirkwood-lsxl.dtsi index 321a40a98ed2..88b70ba1c8fe 100644 --- a/arch/arm/boot/dts/kirkwood-lsxl.dtsi +++ b/arch/arm/boot/dts/kirkwood-lsxl.dtsi @@ -218,22 +218,11 @@ &mdio { status = "okay"; - ethphy0: ethernet-phy@0 { - reg = <0>; - }; - ethphy1: ethernet-phy@8 { reg = <8>; }; }; -ð0 { - status = "okay"; - ethernet0-port@0 { - phy-handle = <ðphy0>; - }; -}; - ð1 { status = "okay"; ethernet1-port@0 { From patchwork Mon Oct 24 11:30: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: 8950 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp435803wru; Mon, 24 Oct 2022 05:55:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4vt6I6o8uTcfeSstRmrkUyymqvVMgRXAl0v4qEsyn9pgEulLULb9/8n3CndI2PrKrwp1Eu X-Received: by 2002:a17:907:7ea6:b0:791:81f4:b0e3 with SMTP id qb38-20020a1709077ea600b0079181f4b0e3mr27858068ejc.164.1666616132313; Mon, 24 Oct 2022 05:55:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616132; cv=none; d=google.com; s=arc-20160816; b=JBjXgWve9MNqCnwvc6wgXefIooHulRSVBgeb0uNP1HubJ21aESAmsY7dhnMHyXX2wI 8aRGeWZToYvi9Ey1H7yWbalJeWE52AQkzC9Emx+ZgX1sbShCM1rbs+/IFMPlCsw8dhgV qZP8fFc/dIGQhUKnzHrKNOjWRDxZNSPdNPXHy7c+YCJcZrK0Shgx6DCOcMglNrRMfav3 cp7HRUgCWb6hcG0ZdW7qSHHDVSnPC6w/vbUQyA1R4ATOorMJMqgzqYygL/A59I4NuKjg 1WgwqysNFoaxJ5gLIBQ/Q60/Admnl7xaycQoY0tCUZHC3x+OoLxkL3+oAcptGmKtLPA1 xaxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KwZDhLSTldA0w9F5dhhn9cAbN6xDWcFbM8KzJGaXNC8=; b=ZAQ0DQENbo1EcOSDAGYAPniEozYfIXxX8+Gm7FTsTYaCiEOo6fHnSzrDstQ/tlLtPo qCN87kUd+8l+4aHGNlKa82Z85W/BjlDKmfV6qFRliVC0N3hzrvGStD2L0kCsX+lOzE6o a4SIEg8W3EU36mcdNMytKzTaZF6kGKvHyZgejh6jYt1How8ulSnGYlPRqBGKx7/gJa5/ NnQsntO9ViMQbsRKoM6ARF2LAhdrRV8XhFo+Z/STtQLLCKOuew55wSCibydKta/zMyOr U4JKrdeaO0H8xtCK8g3yzqlGW+KEM9419WaXtovR13gXyiKlisgjvBQh6F1XiFIGBNtT +1ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aC5E4hiB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mc10-20020a170906eb4a00b00767e24156dbsi24237812ejb.256.2022.10.24.05.55.06; Mon, 24 Oct 2022 05:55: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=aC5E4hiB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234592AbiJXMvz (ORCPT + 99 others); Mon, 24 Oct 2022 08:51:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234811AbiJXMpq (ORCPT ); Mon, 24 Oct 2022 08:45: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 1EF6C3E746; Mon, 24 Oct 2022 05:10: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 EA13E61290; Mon, 24 Oct 2022 12:09:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05EC3C433D6; Mon, 24 Oct 2022 12:09:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613382; bh=dSBgMwkcBEDBTRh7WfBvcmxAmIWLgTFQbRJGsdSnd+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aC5E4hiBWZmDY6TbnsH1hM92DTbuothF0OCTZJ/0QCA6n1cHKDaBUuknAypE3dagt MkGKi9RGGUIFsrgR3C4AS5kq+9fqf20T1u9zlCEk2VvAv1end9dv8egkgGm02trcwa rpayLj2wefr54qdbFcpls3UKv2ekZwwEX/7mrBQM= 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.4 115/255] ARM: dts: exynos: correct s5k6a3 reset polarity on Midas family Date: Mon, 24 Oct 2022 13:30:25 +0200 Message-Id: <20221024113006.332687457@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573677390334661?= X-GMAIL-MSGID: =?utf-8?q?1747573677390334661?= 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 fedb21377c66..3538739c7901 100644 --- a/arch/arm/boot/dts/exynos4412-midas.dtsi +++ b/arch/arm/boot/dts/exynos4412-midas.dtsi @@ -534,7 +534,7 @@ clocks = <&camera 1>; clock-names = "extclk"; samsung,camclk-out = <1>; - gpios = <&gpm1 6 GPIO_ACTIVE_HIGH>; + gpios = <&gpm1 6 GPIO_ACTIVE_LOW>; port { is_s5k6a3_ep: endpoint { From patchwork Mon Oct 24 11:30: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: 9780 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp554144wru; Mon, 24 Oct 2022 09:56:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5xgqMrhCquM+xEhoQcB4qQPWGF2cPDKwv5oq3HyJ/nxmTlcF8RJCNfELAa37oUHfySga1+ X-Received: by 2002:a63:8bc9:0:b0:45f:afa8:e686 with SMTP id j192-20020a638bc9000000b0045fafa8e686mr29086869pge.219.1666630582380; Mon, 24 Oct 2022 09:56:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630582; cv=none; d=google.com; s=arc-20160816; b=L3c+1mKqe4cjXP0I2WJH7uQF0Adhet3qIm0gTmU3KZcXu8rjLy/2MBWqp6c1D8Wq/L F1WwiIs9EJzy4UqZ0U1PZxSbkU/VvCfzDIsyXvb9MMWtc++jILM3I3TfQYNoELlyzb2D BqsEqpJXOeG1JTHr3JBwih7nyRiJ7yZV8q7+Pac0ltT6IoulbfKTRXbYdZleJPos6ARD OfFa8CPZV8f3IDWIdup3CtIkgnoBYKcEgBAtO3inQah/vvQhQxnsPjfI0+VaVbFZqTik 3MKmrMsooBNjFHcoTHAy5YzOK7PSgidLb+YqKaAhlrcmJF6A8I7Ui1QOG217c7NZUwTn Wixg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8YvOtmN5B3GepiLv/8QD4yD49haGsIyfpSCcrjpNFp0=; b=0sHEmPSVqQhLjDrCAryI6+xz05Bdb4rbk4BoCYvhgpVNpP+LB9WqwYvtu1T7quPmla g95cK2JLtkHtzLGe9JaAEpktnQX8l9O4yGAXSw73JifNWvWe8A1E36ktUwin7moVMj5U SQK0pIYoc4uG0EJEpa97tm02cXjMDJvSVGtd2szc8dEa3vakPaIWi3oW7Bx0MPkHUx+6 wFGPrzZu1KzxlRrQacmruWdsRleo76bVs+RQmAHLQHS41eNadfpJ7mpVjk5jjXPIjnBX LI/ws/8b6/jpGiAzRbkOjb+5FBeEnE/UQDoNGXcwTs1+CTrEg/jl2rNnCmdDt6346uyf xKgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NPV8zVtN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i2-20020a170902eb4200b0018685257c0csi21653pli.121.2022.10.24.09.56.07; Mon, 24 Oct 2022 09: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=NPV8zVtN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234814AbiJXQsy (ORCPT + 99 others); Mon, 24 Oct 2022 12:48:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234936AbiJXQrM (ORCPT ); Mon, 24 Oct 2022 12:47: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 3A9E2202727; Mon, 24 Oct 2022 08:31: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 600EEB815A1; Mon, 24 Oct 2022 12:09:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A927EC433C1; Mon, 24 Oct 2022 12:09:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613385; bh=Ja7lCy50tCJE6mYG1SdXngoINi65jyCg6+IPCRVXcOo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NPV8zVtNYSN7Ed+nN3rW3pJoRvC6QVPHAYJy4mCj7SOuM1jYfGBe/3hxia9FPjA+p mgZiVU+8MBuxQx8f/+u3kBs6fayP3/20goORHKT6aSfnvD/4QA4/D/J9dCaZQ5ccfg jJbFOrxDZWDeh8BcudzY2SXnZICdovzAald5T2ug= 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.4 116/255] ARM: Drop CMDLINE_* dependency on ATAGS Date: Mon, 24 Oct 2022 13:30:26 +0200 Message-Id: <20221024113006.370145986@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747588829626849684?= X-GMAIL-MSGID: =?utf-8?q?1747588829626849684?= 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 a4364cce85f8..a70696a95b79 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1837,7 +1837,6 @@ config CMDLINE choice prompt "Kernel command line type" if CMDLINE != "" default CMDLINE_FROM_BOOTLOADER - depends on ATAGS config CMDLINE_FROM_BOOTLOADER bool "Use bootloader kernel arguments if available" From patchwork Mon Oct 24 11:30: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: 8932 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434864wru; Mon, 24 Oct 2022 05:53:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6cOZ3XuWYkeGkB6aBqwwOpl90LbUSMizTzSAuLl21+N7RRgmIDFr00eKZJ2LSCYzE5aLcs X-Received: by 2002:a05:6402:c4d:b0:457:99ec:1837 with SMTP id cs13-20020a0564020c4d00b0045799ec1837mr30163529edb.86.1666615989533; Mon, 24 Oct 2022 05:53:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615989; cv=none; d=google.com; s=arc-20160816; b=QOZzvwhInu2vwNS1507/SID8b8rY+MB0A/AIluAc2fSMpo+Abh2/G0M4LUjYgOHCmx UFoCi/7Az5cX1lSWNorV5OQ1++5zwcK04jNzU8ohMDFbZbPapQMZMvI2r3ViYDVlDzCM VZFnXsRq+bj9n9rTkiQGzycz7RMC3BcBdeTcgDtReP4wOnziwAGWTmfxZc/QJH7MGvAd 2w6C3dcY6+urtaC7YIP4B236OIdO2oB6t80dpu/Epr6Fbq5Hiv9QmMAYdfNhseL5llxx pLc0bRJ3aWLiU2TpFxZhDmM1nb4eR7mseo3f+CYFkSEk21VeEb/A5D5QeqxKlPKrm0Ra uYLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ijc6JG0CMCU858CrqjwAJdRczEuz7jfGb1QDroBkM4A=; b=L40goFNgxwWqiEu99awRAaFI2GU3TpmDk4I+ilnagxVNAy9ARw/eRP5Y4EngQlXaSS VQqcS7bNacMiayg4zkDFexyahOeubfMaxrT3TEd6iTuVgxNG85ENIvF4aIYX7pYBIJKQ pLLdsTIxMngELUz21AGF627diKhZqOhsE0tIbq7fMzv+h+QlWatrqdcIguIYT/lCZ3zL CnvJsybWP7QsMy3ZMxyz8iqt8OgKMCEK1rJ9zZjCBo+3t7qtWPC4v6oEnFiGo1gLNEHN hDFBKeSk2PdFXhGekWBiNUk0vckG0XACyCSbwCpQDBwtWFGazzBKovwyg/blFXi4+5A/ +ujA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BYrHfZTt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ey10-20020a0564022a0a00b004615c5728e8si7643531edb.494.2022.10.24.05.52.44; Mon, 24 Oct 2022 05: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=BYrHfZTt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234575AbiJXMvq (ORCPT + 99 others); Mon, 24 Oct 2022 08:51:46 -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 S234757AbiJXMpi (ORCPT ); Mon, 24 Oct 2022 08:45: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 EFC9843AC0; Mon, 24 Oct 2022 05: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 EC74E61278; Mon, 24 Oct 2022 12:09:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0985BC433D6; Mon, 24 Oct 2022 12:09:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613390; bh=/WVprh8LeBA0UjKyNAbI/MRXBmvmQYtP0wwgE/nsLvA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BYrHfZTtBq0UXCHysDVhTBdoa4HpVi6BWStnFwzEx3PWqoDQLa5tHPzxkHArmuMPQ cHxIzRLXsIOX9H8+a2F1QNzoRoJZDRaGVsh9gYtIzY34lkpZX5aPsil6wsX6QZRITA T3UQ/8rYiglFRVTB+w2ZwY6ildOrATAUrAEeaTdU= 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.4 117/255] ARM: dts: exynos: fix polarity of VBUS GPIO of Origen Date: Mon, 24 Oct 2022 13:30:27 +0200 Message-Id: <20221024113006.416588347@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573527956196351?= X-GMAIL-MSGID: =?utf-8?q?1747573527956196351?= 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 ecd14b283a6b..c6678c120cbd 100644 --- a/arch/arm/boot/dts/exynos4412-origen.dts +++ b/arch/arm/boot/dts/exynos4412-origen.dts @@ -86,7 +86,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 Mon Oct 24 11:30:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9231 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp460896wru; Mon, 24 Oct 2022 06:42:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM74Y71wzdaBo3C6Wea2IH92AbanM+a0esKdGWTBoh+CJTNMflFEI2OZr+qhT3Lsn4l7UAmI X-Received: by 2002:a05:6402:28b5:b0:461:c6e9:8cc with SMTP id eg53-20020a05640228b500b00461c6e908ccmr4812416edb.170.1666618961042; Mon, 24 Oct 2022 06:42:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618961; cv=none; d=google.com; s=arc-20160816; b=PrTN3iCsO00TgNE+ppSVaPuw1zLr+Os7XZ3RXV3cP62cuUkWXHbpPzB4J3opPdil1W OoNEjCeNMN2UJnzZ99gbR/O1+cCpD1HcWR+qC4HMf/uSnx6PL7HEXDOICBqqUxLsEnUP hWEvCX+35nYfvFonUk4KLbvubXcaFJnynEjowH9dYC3k/lkpPeF0RC7zM83GadrbThej HCe02bRz/Aim+gtwUIPKIjr4SetvUnGhRvmu8xxq8qkGX0GFgYzKtWI3t3THmPsspPJI U6u3EuSlFeJpf3Df+sQpL4zeRGYgBYalUmm0nwdjKhTMnGAqrduF3QK+Oc5HjkAFnBbU tZeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=X4vZf5eBxHvGeOQvYtBn8OjrvER62UlOgOdNS+itMO0=; b=MpslffVb6OUCWLWA6xhHnR1erM5hH6LXqvhz57XNXVQgdJCqtaHG3el5EXpMgombis pU3uc+3Cpc8UKQTdX4ptbkBhoHWHdava+nmp5RRV1Fm6NO6ndnzy0otsLUeAu+jcHpwG UCCLbqXIc8lhL3g7HsVXoh6b1B1hSktTLRtCpJ0ENlfmAbM9XMOwAbilxZ8xUuu7G4bz yac1PrWkUfYr5Zj1ouk8Vxy5X9PXnbyhJWyS4csMUU6NRvoCrLkDKCeCHXT/T+J0SUxJ yjqVX9BInErvQSJCL8/WSvxy0UBftzwgc8wpCPgwHY3DktKnYZwIoiDttEiuoE+xHIId cY+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kdTKq6ma; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp21-20020a170906c15500b0078df1c345dcsi34222474ejc.535.2022.10.24.06.42.09; Mon, 24 Oct 2022 06:42: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=kdTKq6ma; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233916AbiJXNhJ (ORCPT + 99 others); Mon, 24 Oct 2022 09:37:09 -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 S233753AbiJXNbg (ORCPT ); Mon, 24 Oct 2022 09:31:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C02D014006; Mon, 24 Oct 2022 05:34: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 4B172B8159F; Mon, 24 Oct 2022 12:09:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D061C433D7; Mon, 24 Oct 2022 12:09:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613393; bh=j7U+p6jbLuBWIM6XPMkClhUXNjuV4Gfk8DCzNUWWSHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kdTKq6mazV8n0femrqSa6hqSe9FQbgJbpDMr8ueVjtmRIJv2fSkahKa4lDTZoeCak o9eqo9a9H3HNy2xm+ZQHPS2gjGjOoJ1tx+VC58X2nOihn8b9UP5g9oFYVpZvAiYlLA YoxVBXLEExOjonQEgsSFcC+yn95kN13kfRnw8xDI= 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.4 118/255] iio: adc: at91-sama5d2_adc: fix AT91_SAMA5D2_MR_TRACKTIM_MAX Date: Mon, 24 Oct 2022 13:30:28 +0200 Message-Id: <20221024113006.446760310@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576643633966996?= X-GMAIL-MSGID: =?utf-8?q?1747576643633966996?= 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 8854da453669..090cc1e8b4ea 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -73,7 +73,7 @@ #define AT91_SAMA5D2_MR_ANACH BIT(23) /* Tracking Time */ #define AT91_SAMA5D2_MR_TRACKTIM(v) ((v) << 24) -#define AT91_SAMA5D2_MR_TRACKTIM_MAX 0xff +#define AT91_SAMA5D2_MR_TRACKTIM_MAX 0xf /* Transfer Time */ #define AT91_SAMA5D2_MR_TRANSFER(v) ((v) << 28) #define AT91_SAMA5D2_MR_TRANSFER_MAX 0x3 From patchwork Mon Oct 24 11:30: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: 8933 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434890wru; Mon, 24 Oct 2022 05:53:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6rcCwLMTEGUe5Vtxl2j+6kR4cA1gNdikacEnFsfDI5XRvLs37QnnfLiQQpg09sYlOPe5wf X-Received: by 2002:a17:906:fe45:b0:788:15a5:7495 with SMTP id wz5-20020a170906fe4500b0078815a57495mr27811191ejb.633.1666615993303; Mon, 24 Oct 2022 05:53:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615993; cv=none; d=google.com; s=arc-20160816; b=E2V31NoWz0ndiQPYYgTAfRCJgdK95Avum+AKQX97xvVTJqexFAu+bVj3iM1kgNrbr+ gSdx65IdQ4Ty6RkOploO1+RCiy6tfrx68ZwWc2xGhtNAjGHtQlRX8R4Z8U5x5TMtCoem svIIXYKkBHGeGsj1nJx/PfR/Ej6bLh7f3cbitAqGUPKghzSOa2ih8YvfrY9364TnB/k4 UB5IZRfK42lpC4XRn2i8tLYDxUo/jgeD8MiV1QVDiXh9dRUh+Dw8m/uBVhtYRfmcMxZ7 AhpplgZAQFJohce7hTzXZnFgaHP4XAYGIHQmNTfr/oFb6+XzuqiLahr+l7R2raKHOL3O Houg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qEiJ/svzP79ah2dA+srjN+97a6ewVNlURk/Uk6YADuo=; b=d+mQ6qNXv3ZpNEy4z7kx4KRm8YlMEj2qoNZ8BtRY5tcaBOFsPurkeTe0EdgI9cRHMw 4fypHkP8TkEsZmvyNEimNLqR/uRG3pdO/XSqNFefNjCANXJCdGKmV0QPScBCAf8AAc7t 5MBdtruIB6sHpSwgClYFRwjYYHeVOhv1qA3koMBujsj0NPWoxQ1xLeXVyzEUY/eaQek0 cTxPqV4E5d6rXDrS5U42QnVT95RkoeJyttNfPYHuU5RmEAB02i39vQrOPk/SMCX3pbnk qwNm3Ucxo7jdAvWAsCI5eIUu64BIYRLAi22NXiX4fIQbNIGZsCE4IetgdK7XYrAQBwbt 2InQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HyvjqScG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090658ce00b007a6ae47c314si4504845ejs.539.2022.10.24.05.52.47; Mon, 24 Oct 2022 05:53: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=HyvjqScG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234584AbiJXMvv (ORCPT + 99 others); Mon, 24 Oct 2022 08:51:51 -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 S234775AbiJXMpk (ORCPT ); Mon, 24 Oct 2022 08:45: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 16F7A4A82E; Mon, 24 Oct 2022 05:10: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 315C0612A4; Mon, 24 Oct 2022 12:09:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40EF0C433C1; Mon, 24 Oct 2022 12:09:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613395; bh=5KeHGDA8jHkPEmGTI8j1RHcmYxHd7OcD4B7p3LSoRwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HyvjqScGsy0cOjdU8OQI3LG0MObSwH5aYm9ivKkGodntoJHyFI9e6el6fkXuNBuak NBsGBJm0zqdM0bHtrrvDdOsLM9XnBnMF0lcJTepVI9vQXe4P+sxFtC+RP2/3hSr2IX ByOCvc930utQkjg98cYko8NMB48zWQ9u+7yeVMyU= 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.4 119/255] iio: adc: at91-sama5d2_adc: check return status for pressure and touch Date: Mon, 24 Oct 2022 13:30:29 +0200 Message-Id: <20221024113006.476298258@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573531365982536?= X-GMAIL-MSGID: =?utf-8?q?1747573531365982536?= 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 090cc1e8b4ea..20ef858d65c7 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -1323,8 +1323,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); @@ -1337,8 +1339,10 @@ static int at91_adc_read_info_raw(struct iio_dev *indio_dev, *val = tmp_val; mutex_unlock(&st->lock); iio_device_release_direct_mode(indio_dev); + if (ret > 0) + ret = at91_adc_adjust_val_osr(st, val); - return at91_adc_adjust_val_osr(st, val); + return ret; } /* in this case we have a voltage channel */ From patchwork Mon Oct 24 11:30: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: 8946 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp435588wru; Mon, 24 Oct 2022 05:54:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7MVCORLrkZ+lfgdNhkOXnu92ugW9EZ8fecX6aa+W6wRSP6GKxmwY8GxBKgScBQ+69Lej2z X-Received: by 2002:aa7:de9a:0:b0:44d:8191:44c5 with SMTP id j26-20020aa7de9a000000b0044d819144c5mr30119485edv.232.1666616092781; Mon, 24 Oct 2022 05:54:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616092; cv=none; d=google.com; s=arc-20160816; b=TsnO+hiZOggVeEDnDdoZ9da8lORb4yahVmLWewDSEy4RxuUU6fjXMIgRadu0YlMZP+ sA45+dMUZy9nFskpnmbQw7bv0i1dAZEM0tXMDSHGcbVtQCPzyRWqRXEOIWVV4kcRoUQ/ mDAjjs+Kh4f3NHhSGrqeOpLE/GXT1ZnqKLKOoeLVhmhNoScuUmvoOyYRlfPt6R47Opqk 6JXzOBr3S26Aq9i7GZxwX9NH2AS+SgyS1Ygp+yiet2SGoSG+m0M4yocjL5Pjon+VtIKj RB9+tT+XCOq95sYjZC4elmIQMb/4u6LjH4MxrUrGXv5t7oGIjoK8O0WyRgmR4bbQ5IeW zdGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZtSXPfn6ERZiheLRr3Aarp97CiT74t7N4Uwfr3za+yU=; b=wLLar1PsSoT5ZXLD5XrSm72m+myDxGT1jdQm0zMjRftGeVOxfeok3uwNYLWm3OWqrj pcC3DvP/FXUKtIYH6Td+mlybUw9NPy8CrYrPfFh7ovos/U//fflI8jJCNdIsRHry2/1Q 0SDag+zfnVLyUvdVXXeCmlhoMmabfVZHzfZIvUt3iA/sSoeZ9RzIZapVg9XHuqV5kjOl AmIPLy61DEckIm4iiyVPabauBMax0dq2kNMvCi49e48vc8RkbAC9XXNsBWgcgczA+ofo llV/WWcwSOoJij0x/2lVR3mDyGY7LPhqhvZPIEKiMUtyP/HTgQziFJcT8EOdTASKsfaU wJcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WU8piDmT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a101-20020a509eee000000b00457f5aa9dc6si26658735edf.528.2022.10.24.05.54.27; Mon, 24 Oct 2022 05:54: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=WU8piDmT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234683AbiJXMwq (ORCPT + 99 others); Mon, 24 Oct 2022 08:52:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234773AbiJXMt0 (ORCPT ); Mon, 24 Oct 2022 08:49: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 4173D6334D; Mon, 24 Oct 2022 05:13: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 ED085612DA; Mon, 24 Oct 2022 12:11:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F5BAC433C1; Mon, 24 Oct 2022 12:11:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613500; bh=+8Fenf4HrWzODfw9fMvEQLB9TNK5G1Ue1PYCowkizws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WU8piDmTGdTnhiSpJPjMdESdyfkSWwEKd90dLlSuiYxYXN4j8b+AZUkSjXIkFhs7E eB03uHLTQ/AY3kO00gtGRWey2jaUmXY0HCE1iHQxrBisJbqbO7AaSOiF9cSiYvLea2 zinoLXQLBz5aQ2Uai2it5q+BG1zxtfHvr/xfaByI= 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.4 120/255] iio: adc: at91-sama5d2_adc: lock around oversampling and sample freq Date: Mon, 24 Oct 2022 13:30:30 +0200 Message-Id: <20221024113006.524130719@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573636044594880?= X-GMAIL-MSGID: =?utf-8?q?1747573636044594880?= 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 20ef858d65c7..734762084968 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -1321,10 +1321,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; } @@ -1337,10 +1337,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; } @@ -1433,16 +1433,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 Mon Oct 24 11:30: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: 8938 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp435076wru; Mon, 24 Oct 2022 05:53:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4tD6CM8p2nyIRI+kcRwdsyBGWrjY7aAoTghVQicadpPUZV4j6obPScT99YDML+kTygBxfE X-Received: by 2002:a17:907:2d2c:b0:78d:d289:7efd with SMTP id gs44-20020a1709072d2c00b0078dd2897efdmr27367628ejc.166.1666616006031; Mon, 24 Oct 2022 05:53:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616006; cv=none; d=google.com; s=arc-20160816; b=tTMSwQEtsuOpO7HvB8n6/0f1kPN8M70qVt4a/dwfmYnKx+F9iCulibqhQV5alr1617 HZxjn6s2ACqdrWsPHon/HbcvEC2igrs2/QTwrZHtN8xtjrxww9HUQkoX9g+hgQC4t4vv 9Kg62Xrx+AejKYBLUdMLrPqtiNx/0GHZbmH8AwLAHnYB6AadYKcTJqVcoz6NY2JjzbQD CiDAG8G3hc+wKdRYxN8fAVyy8ONgPLZCp0SGWseAYFNwqX0JperWiEJ3BNGDDp1zxOBJ DnPiT03dBUNLrMUa3RcoU4Qp5lXbL2IlKwHOtBtccQ6JFKLOfe4YbfVLqazP3GoXU/O7 Qn4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/1pGYtS/gl7QoouyJOduH+kH6PG5VVjn57xl2e4TFk0=; b=pfShO2dMfC6MfFdpEd5TO3Dx0kowNY8cLkFTDLQ0r7R8AcpNpIPNFhYdchiZgONw7u qCrQJE4zZNx6D33i1i1rDz4VnyjGVuEQVmvHTpuyla33GyTgx+gVwbJ2gOBIWnHUhW51 RsXmCPCZVHSSWc6TkN9Czm/fFS2e4yJ5C8mEg9qRppPGjMS8SVa+xQ6ah572/JNE3aFA r+mlUsE+R4Eq8xTVGFnNK368pIGIddkfyfFZFCsIv70ikVZzYBKv23rBkMCVSRl4hH6s VVtJ176zepuvh0ue7s2fLwWGdFjJaFBuW/CA+IMsJ9IN9URKUXXOWL2XOiB/EloYafEs +Mxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DthsHNDk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz41-20020a1709077da900b00782a33f2850si27904776ejc.736.2022.10.24.05.53.01; Mon, 24 Oct 2022 05:53: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=DthsHNDk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234335AbiJXMwJ (ORCPT + 99 others); Mon, 24 Oct 2022 08:52:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234837AbiJXMpv (ORCPT ); Mon, 24 Oct 2022 08:45: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 5B5726AA24; Mon, 24 Oct 2022 05:10: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 04B5461254; Mon, 24 Oct 2022 12:10:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BBAEC43470; Mon, 24 Oct 2022 12:10:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613416; bh=jGjZlBQPhcH9jQ0Rm5yLEnHk8aUsn/4zCK9ghfgiHIs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DthsHNDkaDd9hAt9vkG/uy37tavNj9wzEkQ+y87nSWidEfz4sgX19oXJ7PbF/iEEN zWFLnjKMqsBwWDp9/yArBoLf6qCdH9WAFJaqNrds52g+F7Ox/M2DOO3jW2huurzjl8 6kZyJQphWwpm9J77PqJHwJI1YjULWAV3y7n+6TaI= 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.4 121/255] iio: inkern: only release the device node when done with it Date: Mon, 24 Oct 2022 13:30:31 +0200 Message-Id: <20221024113006.568093359@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573545105465840?= X-GMAIL-MSGID: =?utf-8?q?1747573545105465840?= 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 ca0fe902a7db..d00f3045557c 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c @@ -136,9 +136,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; @@ -146,6 +147,7 @@ static int __of_iio_channel_get(struct iio_channel *channel, index = indio_dev->info->of_xlate(indio_dev, &iiospec); else index = __of_iio_simple_xlate(indio_dev, &iiospec); + of_node_put(iiospec.np); if (index < 0) goto err_put; channel->channel = &indio_dev->channels[index]; From patchwork Mon Oct 24 11:30: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: 9761 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp550154wru; Mon, 24 Oct 2022 09:45:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4yN3Cj2L1feXiMrlA1vsjdpX7yF2I2koMvTI68FM/nIkNDTlHKraI8qYDeDODFr9zKuTQF X-Received: by 2002:a17:902:8a88:b0:17f:8642:7c9a with SMTP id p8-20020a1709028a8800b0017f86427c9amr35351730plo.13.1666629926260; Mon, 24 Oct 2022 09:45:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629926; cv=none; d=google.com; s=arc-20160816; b=gbHyQdSEhm6Thz5GExx3y5lj07TEvqUV0hMAEFvdCGsImhd4lPr8SEz8oD5StRxlTr DD8qaecgYiZjXf6HpHJ5TplgMXTaGJnyBl4YL85hn2VFpcxg9G1a3G+BWNQev2mGcKfw 8lUkwcJEkr+kkvzZkrWJPFzDTFntMigc/J385/Sv+2AR7hs2aR+EZVdcFttXcRCv+zOq pCbtPwgT2KJILHKZz9Aye3W29/W5Y+eIvZ6ZQTVeIvtRIlsXBBTTrSmj2M0CEcYXHfqL 2QVa7A6ld2NszAJk5aHqL2ctbX0mmjx2yg+EPjfPWzNhE1zhVCPh8rurF3DPvaGfoSTh Rr7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Yw5PZO4D2PAt6QZw2a9KZTUznmSVzkZfbH2dbdyTWP4=; b=fvNLFAAzlPo9EP+1gabmdzy6bsch5MnhodWVDV5pOcKL/B2xZd+/UyHTV5/wSWjdi8 dzAJrz3m9xgsF8u+br9rcj71zKGT84LHyFnDuA2ZXggPm9QfxGW+WHzWsvR0GjANmk7O il6OdgmFEY/JpODHSo5rgN4hUwEFBaIyCjW2p4YidyWRjxfBDO6Hw3QeoSTKfRqMJSll dm6ymwpG0UhzeMJm6tbZDgdkE5CigWe2JjqqTRzT+xL3gghmiy6Haz03n/gJIClBmFZC zNdqVKrBb7zyPIhrdtCPRv9IDvBEwKjA218k92LEmYBbhZ88JLvgykY8/s28sPGUSPmW cYhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QWO6bgvU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902da9200b001853b9b277bsi38159853plx.527.2022.10.24.09.45.12; Mon, 24 Oct 2022 09:45: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=QWO6bgvU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234751AbiJXQom (ORCPT + 99 others); Mon, 24 Oct 2022 12:44:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234846AbiJXQn6 (ORCPT ); Mon, 24 Oct 2022 12:43: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 57B1D7CA89; Mon, 24 Oct 2022 08:30: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 C8588B815C6; Mon, 24 Oct 2022 12:10:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2958EC433D6; Mon, 24 Oct 2022 12:10:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613445; bh=Tk2fsYBZfN8OwxsAmt0/Cuy5y7W6WHDkl/a0c6JLf78=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QWO6bgvUHu2jkoT07pG5b6h7VXbNcChEzUcFklV2jD+F0x/l01bzkUKDRAvNLC1w+ R7daCv4rehkK0PxpaLL/YyjX6lGBWkkmwIgNfu6uPo5AOtEzZEvlso3mf1N+iJ3zeA ZxWrMFUX8ZLh6nlmcsR2HLjwEFNh8R40N9xZk8EA= 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.4 122/255] iio: ABI: Fix wrong format of differential capacitance channel ABI. Date: Mon, 24 Oct 2022 13:30:32 +0200 Message-Id: <20221024113006.603673582@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747588141382721518?= X-GMAIL-MSGID: =?utf-8?q?1747588141382721518?= 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 c3767d4d01a6..4d873e813949 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio +++ b/Documentation/ABI/testing/sysfs-bus-iio @@ -138,7 +138,7 @@ Description: Raw capacitance measurement from channel Y. Units after application of scale and offset are nanofarads. -What: /sys/.../iio:deviceX/in_capacitanceY-in_capacitanceZ_raw +What: /sys/.../iio:deviceX/in_capacitanceY-capacitanceZ_raw KernelVersion: 3.2 Contact: linux-iio@vger.kernel.org Description: From patchwork Mon Oct 24 11:30: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: 9080 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp445496wru; Mon, 24 Oct 2022 06:12:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7pzei7OJgIBQN+dNJNgMOaiAnoAeCbmZazySDfEvbfWxZemRJDsQGCDAZxeSLZ4aU9M7mG X-Received: by 2002:a63:4f09:0:b0:440:4706:2299 with SMTP id d9-20020a634f09000000b0044047062299mr28605173pgb.115.1666617162019; Mon, 24 Oct 2022 06:12:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617162; cv=none; d=google.com; s=arc-20160816; b=bTibQVdYDl3ksSg9B5qcIcQNsJN99ID7PInT945dgq0lxerUw7BWGgogOXEnVKVlHH VVpTDm3JwjGjyLzOv8txVEDMGLr/nTCK24HdJPgpaMuASct59t6UC7tkaSlX+n7Y5iI6 /MZLWWEQCXxLrEPAxIE3dOYWQWcvG4d2UeOkhTKbWnGeEyjPJ0bFn/85xBqS+bgcW/zO do/XsBlQqkJ98TVfwLVkXMRFKEFnWEfe6pMgKZg/2AFjetQIfOMUPg3sZdPCpa/a6dhC D9FNW1vuri3ZuY2KTRYzR8uvlNCSBqmn7n6KLZkEFmfBBQesfTEmmZgY1RygNFhlIDzT 8kgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ILSjbA+b0tU0insuaq8u/tms5eGyaC+XlBcEjOrcvD0=; b=DK9Qll51vfIFnkD2G5yDO+EpgNyDY/otAbu5nEfkwerUHP7KHn5WFbP20pPp5e634s e5GPQTAmbTDJcbje3ctTLKDplZqDBg88iAszhkMbsFMewwTFVbALFAUToWkAQEVRnIYs V0TbODqNkcdB/D4zP6JT8gULNudcZ+29RowZO7uhk3tZhZRrzzwBTptl6JPeJkBXdbiF mJrOhEQLMjtYAw+Bhmb53LCRILAMFtnjo5NQbvIOhSJHEkP+j/9cRsgCCfMfZzZJF3gV 2npwejKOGQal/hsvn/EQVx6F/4EuHhqP4BDfdmapE0G9tzyadfipc2r31k+qC+lZSTyq l/Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Xc2v6H3V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h187-20020a636cc4000000b004396227b476si30257871pgc.774.2022.10.24.06.12.27; Mon, 24 Oct 2022 06:12: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=Xc2v6H3V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235655AbiJXNMD (ORCPT + 99 others); Mon, 24 Oct 2022 09:12:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235822AbiJXNJo (ORCPT ); Mon, 24 Oct 2022 09: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 6F3D69F754; Mon, 24 Oct 2022 05:23: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 D576E61268; Mon, 24 Oct 2022 12:11:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E781AC433C1; Mon, 24 Oct 2022 12:11:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613474; bh=ZV8yv8pgRgm0gpnXZ2O17bX3RzXcFDMTAtvPX2IT8zU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xc2v6H3VrRmkLmWOUw6ZLuhBgdDIgugJBUbIu8ncNIX7J4aY3easectCkPZisfVG3 ruVkPmHBU9msoemwBWb3A/jBnmzBTL09vmRaA7hlyBT3CBxL55S+XUKxh7UGVA4qeQ H5tvi9ZXhiUVIjmABNID5h6aqkYNPLfazTNk8mqE= 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.4 123/255] clk: meson: Hold reference returned by of_get_parent() Date: Mon, 24 Oct 2022 13:30:33 +0200 Message-Id: <20221024113006.638350032@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574757488066493?= X-GMAIL-MSGID: =?utf-8?q?1747574757488066493?= 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 bf8bea675d24..6c7110a96194 100644 --- a/drivers/clk/meson/meson-aoclk.c +++ b/drivers/clk/meson/meson-aoclk.c @@ -36,6 +36,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; @@ -47,7 +48,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 a7cb1e7aedc4..18ae38787268 100644 --- a/drivers/clk/meson/meson-eeclk.c +++ b/drivers/clk/meson/meson-eeclk.c @@ -17,6 +17,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; @@ -25,7 +26,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 082178a0f41a..efddf0d152a4 100644 --- a/drivers/clk/meson/meson8b.c +++ b/drivers/clk/meson/meson8b.c @@ -3684,13 +3684,16 @@ 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; void __iomem *clk_base; 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_info("failed to get HHI regmap - Trying obsolete regs\n"); From patchwork Mon Oct 24 11:30:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10259 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp643854wru; Mon, 24 Oct 2022 13:43:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7UWx/iWKxwtR6uKPsnXKjtcIiZ5Dv0PldXctiIoqbNHmuaJuL5MDziLOL3lJCTyRnad0RE X-Received: by 2002:a63:b545:0:b0:43c:2ad9:b00 with SMTP id u5-20020a63b545000000b0043c2ad90b00mr29606008pgo.535.1666644187626; Mon, 24 Oct 2022 13:43:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666644187; cv=none; d=google.com; s=arc-20160816; b=Bsxf+1BcWK9jM6IIZ1AIe+HN9I9FVHFow7EmbvrXRqGbuGh4v+KtkUDPk/7teOfP02 x7wZMWSmUMZLpmypS3mrTe4uEhfbZqw1hgr+FcVPAUVRPb7Ju2u29JFbIOzPcMW1BDbF OYm5jPWufmBBlcK9xG+RswurIRY1EOtCD37F25tIB1iBzr0E4RSUDsfALHuCFWDK5gL5 Ad1zo2xZYo4VfbMQ6nl5gWdtYoWPMMPwE6hplgZ6vgPbzQCAtbFB1QBbbLHDnmTLqi/0 WO7mCk3jOpS+yWEXPHocW50IhK5YS3sH+msHAZJLOcivd/eyvBm84NoD6pOkNIqv6TVA 74bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=P7he3boLJjoDyg4JyksFE1FjKdheQ/OWPJaEtn3/zDQ=; b=l2WfO37tqAoGeyyvEMlly7y8AdZGfn5SASgPdgUJQxY78cLAxlQ+UoeQ92Dmdy713P tVZfN889umO4dFjfP5EEzrXzB7b7/qQKHXioA+VbnoY5X63YKjsns413Q4ogXr3a/KhG h2D+1CQqmNQE5fETjE5NXcxiSooplsbTaf1ZgyTz+2XmM6gjBJLaiqHYFFFQ0lV24HfB HnRhI/zu8lNKJQHK0V9FTjgdoSvpG3Y6+x9mOC0CIiAzZGATqhtxjtSLU/MVo67Zgkkg bOrSQAk9f4TmROjxe+uQ1N61GbpIFpq66wOncjnOJkb5FOT+Mu0R4Vh55wEYCjFluyTF o1vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OhzG9GdB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x184-20020a6386c1000000b00438d7ca729bsi619190pgd.207.2022.10.24.13.42.52; Mon, 24 Oct 2022 13:43: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=OhzG9GdB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234999AbiJXUmV (ORCPT + 99 others); Mon, 24 Oct 2022 16:42:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234881AbiJXUlT (ORCPT ); Mon, 24 Oct 2022 16:41: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 64246114DCA; Mon, 24 Oct 2022 11:50: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 0E566B815D8; Mon, 24 Oct 2022 12:11:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64583C433D6; Mon, 24 Oct 2022 12:11:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613484; bh=X38VWH2et6l8j7ErF92H2f0hZx1DchmzPhdw98JHFCs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OhzG9GdBMMr0oDwsstn/J/B5k5VHjVEYcXTS7Kb6eZ5cVLTpibyaIei09EPy31+X6 ocjz3jWe97dZyX+09yc0eUNQog5K0r622YUrO+8Kx4wkXJoE7v8EepMfW3vYN58sVx P8TlAGb0e6JFmOOkWKh54J9sHD42psML2NPVlmQw= 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.4 124/255] clk: oxnas: Hold reference returned by of_get_parent() Date: Mon, 24 Oct 2022 13:30:34 +0200 Message-Id: <20221024113006.681951284@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747603095611087068?= X-GMAIL-MSGID: =?utf-8?q?1747603095611087068?= 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 78d5ea669fea..2fe36f579ac5 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; const struct of_device_id *id; struct regmap *regmap; @@ -219,7 +219,9 @@ static int oxnas_stdclk_probe(struct platform_device *pdev) return -ENODEV; data = id->data; - regmap = syscon_node_to_regmap(of_get_parent(np)); + parent_np = of_get_parent(np); + regmap = syscon_node_to_regmap(parent_np); + of_node_put(parent_np); if (IS_ERR(regmap)) { dev_err(&pdev->dev, "failed to have parent regmap\n"); return PTR_ERR(regmap); From patchwork Mon Oct 24 11:30: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: 8945 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp435573wru; Mon, 24 Oct 2022 05:54:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7XKRNnvVCWoIIRKQwqNRw5FaYnYpMa6GdFkqRn0bio4C0tORFL62abpXIYX8C/zZlJnqMJ X-Received: by 2002:a17:906:fc6:b0:72f:d080:416 with SMTP id c6-20020a1709060fc600b0072fd0800416mr27900006ejk.1.1666616090771; Mon, 24 Oct 2022 05:54:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616090; cv=none; d=google.com; s=arc-20160816; b=0YHBH2VdGS6VdfB7GBlUcvVsPwbeR2Q42d0kOKNqkLJOek+RJVmjgUq3ICpKKyry7E ztgV8dOHVQO5Y6Hb1nHXGsroq3oogtpRmnj64TL5EQKYM/Q3xtRdMBBjG7K2bOkOtFLQ vAZA0dyc/cPmZfTECAH8cm4pS/3VsbmKO8xnZiP6uJ3jowihibnza9qol2My0KS9gPk6 oV7kbJcwEpMWpLNw2bfgwMNrbszKaYKV22lya6K/AsL2WO2JcGQJ/YEjkUuySeT2qhKZ FZ0MiemCrrZBx1XZ4eq3BleK4mrXiXi+3/SsvDaJFFHzpLb2ClbebPp4cmQKFgcRHLvZ /BaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=d3HatgjZAlSQJhFlS4hGhPM+ymOtB1KKML0uujeDhaQkY5DSOcAldALgVF00DleNC6 pjmGum86MAhYuTSMZVuT1rtK+t2lS0f5tp4gJ3llf/ipVLGyojwSoirYbFXGdzbG/SCW xetwbG07XRo8Wvk2sAF7DVJLtgXrEPmHVH2DVCQtJKFB0JPdVpEPao/0ta6SSJDg6P4m 7C4HwqYWe0sRmDwlT1ebs1a/33O9a3PD6nO3XxWB7vO2eCeotskXHrtuyIxpeGzPminw YfmUIAziaG8LR5TbTzCtQQsTMVvqNHQQqkZfY+sQjZX1tXV7XBwS8LVuZ7lL9X947WBP 9OVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vN4ATdDv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p34-20020a056402502200b0045d45f0e69asi24470611eda.561.2022.10.24.05.54.26; Mon, 24 Oct 2022 05:54: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=vN4ATdDv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234393AbiJXMwn (ORCPT + 99 others); Mon, 24 Oct 2022 08:52:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234632AbiJXMtL (ORCPT ); Mon, 24 Oct 2022 08: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 54C6B923E4; Mon, 24 Oct 2022 05:13: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 0426B61218; Mon, 24 Oct 2022 12:11:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12798C433C1; Mon, 24 Oct 2022 12:11:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613487; bh=aMhgMqMGgRl1+zscEHQn3kdfGb1OaQRYRmBXmXDblFE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vN4ATdDvTkGOIHAHSnLjQRBZnL4rByEKNnsjf+qQncrHwv33Q5g/07YMygGB8ylNv E/9GrB+OyWmECrmv+N/giEbZe4kgZOXxK3p1TcIna5Z0umYBsb79qcDi6sa8Bvkk9G m/doXHboSqCBx2T9qWBATdFkXfg8iubFXQive9CU= 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.4 125/255] clk: berlin: Add of_node_put() for of_get_parent() Date: Mon, 24 Oct 2022 13:30:35 +0200 Message-Id: <20221024113006.715657901@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573634346091892?= X-GMAIL-MSGID: =?utf-8?q?1747573634346091892?= 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 Mon Oct 24 11:30:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10258 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp643816wru; Mon, 24 Oct 2022 13:43:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5bHkYGCRD6FWZ6qvxt51VzEPopPvEVpuhuQo3finrl07FlxEqbs2wSjVmO9gldKxj+x8oR X-Received: by 2002:a17:902:b945:b0:181:c6b6:abc with SMTP id h5-20020a170902b94500b00181c6b60abcmr35340941pls.75.1666644179724; Mon, 24 Oct 2022 13:42:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666644179; cv=none; d=google.com; s=arc-20160816; b=zDj0ipN4xbx/ktOM0HceYuCldSvQWOU+mhYhwNreUKyGTg+aDDfO500V9q4CWtgfiH e0k+0z4WtwS4tEf4qT9b0kBz8mzWB0yTL3t4guNbZqQo3pGxtUXdrlR2cSIPULvjZlc9 3dnTXUITFnXav14v3CPgAMG2oF9H8ArFPajpKEibkdCiqKfIlN9PR6rYYBsb5YPC6bi3 8L2erNdCmS7QdpR0Tx9ocIqP7H60CtZFnx+89RI42s0blcSqshV7Fl82ZIH7k0zx3OkH pXCc+WjnjpKVUIgJ1jSJZ9wV8QzHSZ4DRqj7PY3Vm6dD1BNEENHiK+s3lT5GRopqFenh vb+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=/p5Ujs2KqcyALA+Z97agTpQoh8vlr97IKoU55BAue1Y=; b=TJhBHqcGIqUOPW0GpBxkW8WUAXOC66LYM2Y7cGuEk9lQR3VHBIimO7rbNpekmiVPm5 ukLbEckzR/vP+5MkRADBXSyi2oCIDKWMRpva4cnk960orU3raXkq8qKFmgXx4zZEsN3C H5Yd4l9N9NDTT2EcYvHUn2C0CsQcXeLEGH1uLbGqrnWTUFU+NR+zDpj5duqPzyMoLVYJ 7PYnP5INUfi2tYjSXHk8m445J8BhcBJV8D47Cob3PAH49fZZj1MRr21WRBGejeYEPMDo tcJAoy8/dFBXgNV+pSvSBbUWh30GqyPZi9NszykFAqcZkXcSwRDV+sXA7m18I4gLavlj cJqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QtYNq3b9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mw10-20020a17090b4d0a00b0021336b17122si896982pjb.5.2022.10.24.13.42.46; Mon, 24 Oct 2022 13:42:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QtYNq3b9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234994AbiJXUmT (ORCPT + 99 others); Mon, 24 Oct 2022 16:42:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234880AbiJXUlT (ORCPT ); Mon, 24 Oct 2022 16:41: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 7AB2AFFF96; Mon, 24 Oct 2022 11:50: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 47996B815A3; Mon, 24 Oct 2022 12:11:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A399BC433D6; Mon, 24 Oct 2022 12:11:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613490; bh=67SwH3yl/AFIQ+5gVJObOOoTwx5eMWWZ5Rp5oyWalPo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QtYNq3b9lNBsVKOdUkng1Ib9nzBAEw6sEh5Y5ildhnEzKl6JEGcrZRfySzEJLv573 57bQX6aAfdmPVZVaTaVrukLqQDuhKFhtoONujA03nwtcrFVAbV0BysBz5wx9Ny4p0Z xzJdPpppDR+uQniwhhK3I1vgAmxsqYOhmRqjPygM= 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.4 126/255] clk: tegra: Fix refcount leak in tegra210_clock_init Date: Mon, 24 Oct 2022 13:30:36 +0200 Message-Id: <20221024113006.754561168@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747603087247956143?= X-GMAIL-MSGID: =?utf-8?q?1747603087247956143?= 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 df172d5772d7..34155b5b994d 100644 --- a/drivers/clk/tegra/clk-tegra210.c +++ b/drivers/clk/tegra/clk-tegra210.c @@ -3523,6 +3523,7 @@ static void __init tegra210_clock_init(struct device_node *np) } pmc_base = of_iomap(node, 0); + of_node_put(node); if (!pmc_base) { pr_err("Can't map pmc registers\n"); WARN_ON(1); From patchwork Mon Oct 24 11:30: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: 10214 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp642583wru; Mon, 24 Oct 2022 13:38:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4GcHhshpxtOJM2Efl8RuG6UrBnDbSTnxY0mSkWaI8rGLIn5D0Z7iBYaIXJfPNmsyg11cOj X-Received: by 2002:a05:6402:27d4:b0:45d:a69e:336d with SMTP id c20-20020a05640227d400b0045da69e336dmr32106297ede.298.1666643933874; Mon, 24 Oct 2022 13:38:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643933; cv=none; d=google.com; s=arc-20160816; b=Z4GssS4OGViUJJr6OkGu5bvvnxK9SdEbzgGgGMk/SYh9fLe9IxXbCgkF7wScKjzaJR 7qCiij58R3wpswgZ7Q3h+f7JcfNl33uLv/clcBKUKd+TNldcq+NCu+IwlAsqPV9+P5m8 Vrr2OPqTRHGccTHb5HyBlXnnCj2VH6/vp/4NRatePCj/cIq5Cq4GrhjbdpH/7H1+p/33 ukVKJy2rgLLnw2eFODa4gnHeVcM8YWisgZlvkun3r8VJCl4Oo5wh9AzjPXvNjTj3ygWs lig8bjOfEp+YBG7priepeyWj+KIcRXk2SiPpEaIfxgbqwWiFYqR07DttT5hQQlrn3TBr T36Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aXfnmRkZjqW80b4yH5aOF2PbBiqc8XllzV0xfP+Lupg=; b=bBqF0t0HbUoh51aPTgVDSi0ABycsLob4eBX6GeM2ZqM5+IU8ESIjQZvSaWQAY4HzdP hW275Fewdf+aj5gBQvshJ55Y9GGyxL4W5LqAs9kmh5Q/ENAvYe52l+T3EPR7wH9n80AG MmeoxglwZ1xYZTluPFgWuaw0h4zY24sMM+GfWcmR87K5hQ/3jjmBSCX6DyayKiM8MDe/ 5lZrNEy809EQBViiFaw3r9vY4x5eTrDQgtdVw2bd/Y7qJ1+LhQ7JfeechbhZLR43cvjY tnfihzkLlsGsPxGN0cne8hjG3AnEiCDjxHClAUR4PeDGAleM+mHlWfI5+RYrPmHA8Mto 5qEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=d1NSdUUt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i22-20020a508716000000b0045c3f5b458fsi725770edb.397.2022.10.24.13.38.28; Mon, 24 Oct 2022 13:38: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=d1NSdUUt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234511AbiJXUhF (ORCPT + 99 others); Mon, 24 Oct 2022 16:37:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234300AbiJXUg2 (ORCPT ); Mon, 24 Oct 2022 16:36: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 53BCD18542A; Mon, 24 Oct 2022 11:48: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 DAA73B815DD; Mon, 24 Oct 2022 12:11:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C846C433C1; Mon, 24 Oct 2022 12:11:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613492; bh=hhGcXY6v0OKrhqU0sVU5iboQdDo/0yK2fTx5k6H6Sf8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d1NSdUUtlsA1RIxLIqhURCiYvQFxDsxLMnMNtTv/5X3M+btp4hT5/cZjAWl87AmHo KSymKBHnTYXbPvIsNAEOFBztBQmv5rowpbiLaOx4JVu632lNMLX2NV8dU6h0bwA+rY atwvDMEPZEyPb1y2iW4w+BhXl9egEymouRZt++Vk= 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.4 127/255] clk: tegra: Fix refcount leak in tegra114_clock_init Date: Mon, 24 Oct 2022 13:30:37 +0200 Message-Id: <20221024113006.797144870@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602829777398882?= X-GMAIL-MSGID: =?utf-8?q?1747602829777398882?= 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 4efcaaf51b3a..586b091651dd 100644 --- a/drivers/clk/tegra/clk-tegra114.c +++ b/drivers/clk/tegra/clk-tegra114.c @@ -1337,6 +1337,7 @@ static void __init tegra114_clock_init(struct device_node *np) } pmc_base = of_iomap(node, 0); + of_node_put(node); if (!pmc_base) { pr_err("Can't map pmc registers\n"); WARN_ON(1); From patchwork Mon Oct 24 11:30: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: 10328 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp668790wru; Mon, 24 Oct 2022 14:55:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6TJBgVwFpNKJ4l1AHSAqplcy7WTUJ2FNEblT10SqhSCdEecPgSWB0n2cby4BRGMj3De4dB X-Received: by 2002:a17:902:6bc6:b0:183:e8a2:9760 with SMTP id m6-20020a1709026bc600b00183e8a29760mr35395621plt.157.1666648546566; Mon, 24 Oct 2022 14:55:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666648546; cv=none; d=google.com; s=arc-20160816; b=eGkA7UsFCFKliBW4hn7GErCGJnb9w9tBPun78QXZ3fvdAtr3dyVvjHKwOT+RcUj2qO rh0Y5csTSF3lkEr/wLjtczlQ/tnJ4e6QXELL2b3FmuuhCgPL99KOLJ9EpwPnEGnN7szm JspDoq+iGYOikF3FaIQesZ33Wy757UawZ22S5rMaUye5x0HzVJaioDr8BWUZMAf1WWab gj5FglhAxRE2KbvO/ah/pnFYxLdhUdkQxkGla7nG2SKDQ6Z4sJ+eTEf88MWIp+YsPKqt f/nz4KVKx6LIiJB9tjUf2+GlSDHEs/PHyw5a7mmQ4o1RLwOoft8NJeNFP5BQKeVzjytY Pq1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YGeIBcUd3yBl9/FNZqKup1uj5yTA3qIeFtsyUz+trpc=; b=ylawTLJiuACB6tWAdH0CkLaA3jlF8uRF+EE/oYJ3yEd3Flx7wFHfShYzVKWbWzW34g gum+a1+0ZrIPGVEslYo71X9vtNJKvZPztCJtMB/ImCLctC+AfbnhNwINQDZyR10hcr/x SH+q6JbZeMfKzUpTHcMTLrmmQK2WGYSVRcpU+eEop5DUYWoNMBSNO06O1ZrY0b6OfuBs qVO3TUzBycmZLqfuR2J1brIatBrww1iEBBBSTxVyzb6Wbyab6o4Q93GkaA8FTpYgHohD R1EwkcrmsdEET8GR+s6exUdA7r+xr6pqGLMYeq+vvikjwLf0OhyJRMjbY155lhNF+/zv zHoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sQ3aipQv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f15-20020a170902ce8f00b001853a1fddecsi762993plg.403.2022.10.24.14.55.33; Mon, 24 Oct 2022 14: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=sQ3aipQv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230254AbiJXVrP (ORCPT + 99 others); Mon, 24 Oct 2022 17:47:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231310AbiJXVqo (ORCPT ); Mon, 24 Oct 2022 17:46: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 9C0871645E0; Mon, 24 Oct 2022 12:58: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 73E0EB815DB; Mon, 24 Oct 2022 12:11:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5483C433D6; Mon, 24 Oct 2022 12:11:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613495; bh=zmM+aWSIdZtCALQFVN2TXHaxzhsuDCKBlpj+0+xeCj4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sQ3aipQvubB+baSLWbNwIxNqNQjRGXC9rEiJfTx640qVguP/BGoUYMVBVluhl9Kzk GOHExgQ7W3wEDH22cGnRNN8tJ+m5vo5H1WwZOlu4El7WosynmP91LKs4nRPurump0V FNx+im5JK6/ZO+iu3p2tMTb6ZKUNTvV2y4yiMzI4= 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.4 128/255] clk: tegra20: Fix refcount leak in tegra20_clock_init Date: Mon, 24 Oct 2022 13:30:38 +0200 Message-Id: <20221024113006.830046182@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747607666622937526?= X-GMAIL-MSGID: =?utf-8?q?1747607666622937526?= 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 bcd871134f45..3e0f04f0e16e 100644 --- a/drivers/clk/tegra/clk-tegra20.c +++ b/drivers/clk/tegra/clk-tegra20.c @@ -1151,6 +1151,7 @@ static void __init tegra20_clock_init(struct device_node *np) } pmc_base = of_iomap(node, 0); + of_node_put(node); if (!pmc_base) { pr_err("Can't map pmc registers\n"); BUG(); From patchwork Mon Oct 24 11:30: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: 10281 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp652902wru; Mon, 24 Oct 2022 14:08:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7b9nr6dGnFR4mvdCESy2RDIkpm+xJFwR3BtCf/OpG6nXBDbF7PUL8VRVOX047ikjY3bHUk X-Received: by 2002:a17:907:3ea9:b0:78d:fdf0:88fe with SMTP id hs41-20020a1709073ea900b0078dfdf088femr30471348ejc.667.1666645718269; Mon, 24 Oct 2022 14:08:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666645718; cv=none; d=google.com; s=arc-20160816; b=fcRTTBa1V01O2V2elE0Owgdw3ZhTnRBaCTP+uRMWtBVmsBbMXA7onzEdn93xWYddsi YstBXRELf3ewc+vpfAP61YtqwmkCMe6o02OOAwET13sETzt+8RkSYWzPmc79hpt7CxmC XBUr2yE7uHAhNzIED6V+XPtupzuWpf4q47/6WonyqulPJ0ScOYBzCBSPPLBMWfi4SJkO yIZmPSlm1a/i+zgMgT/ZASbhSrwVLMugdxOj3iSp2sGEaGltj2uWbfeVBCnKXfgLqmSl 1U4mGdArNWungyVy91zBA5wi6PddaVtWhEZlykHj965YYc2J7UFDX27XaR7iuhHCGZ8r Zw9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SzCoMzXFyE5GZ0NQm10hPs0HXA7uc3zrgWOO6r/lAuA=; b=A5kPfcnmp71Z912JRXAEsPalU8tJycz1kOwryGMb4lgim3rQg1ZkWvGvbG6nGTQ4rv Iit/uh59lMWSt468vehLSLltnqQbVfHhKQq1rJkmMYbm/R7Hliir531xk1RT6Hfh4k2S m0N9erVJ+NkHRXb4tUZQ9kHQGXKqyL90hcb1+xFCevKeJtEDoCLxcNAMDgqQ8gaIWt3K eahNbm5bjCBDSYFceC0qbIbt6MeRiDnsDQGI3yTdYHmaFxS6Lc2DDeD55ZUTGQhpWRnv 69iBPcQpICa94ueM1rJz/bAwiH0A1hii6I0WbiNFUW96AIvqfonFXNlgb4P/80+IUF8U uu6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H90afxO+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a50aacb000000b00458ab55ccc9si739807edc.168.2022.10.24.14.08.09; Mon, 24 Oct 2022 14:08: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=H90afxO+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233756AbiJXUrP (ORCPT + 99 others); Mon, 24 Oct 2022 16:47:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235154AbiJXUqe (ORCPT ); Mon, 24 Oct 2022 16:46: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 9B45A1D0C7; Mon, 24 Oct 2022 11:54: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 61C3761295; Mon, 24 Oct 2022 12:11:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 746BFC433D7; Mon, 24 Oct 2022 12:11:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613497; bh=oYcz0CeD1bLDLIcWSYmweAHkK+Sk99SWfYn/Sl9KipI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H90afxO+F/yU06bm8N2Y6M4tnJIVKxmsAAf4SXYx9n+dMp4nfKBWk6UX3S4xBFNLg 1LTQ3Y7pCJO9AektYgs/rJXSr4y9CEu1IKqfI0CPqN+B4/ZDONkf5MKw/CFK7u5Chj AWrKabGKB7uGCAS3yBqAz/bLpq1ITUtCXZRuJWWg= 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.4 129/255] HSI: omap_ssi: Fix refcount leak in ssi_probe Date: Mon, 24 Oct 2022 13:30:39 +0200 Message-Id: <20221024113006.859257762@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747604700725785779?= X-GMAIL-MSGID: =?utf-8?q?1747604700725785779?= 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 f36036be7f03..5aa6955b609f 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 Mon Oct 24 11:30:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8935 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434968wru; Mon, 24 Oct 2022 05:53:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6aRcmPXDFyhJSyEYtF3Wlh1J8KiheU/qq7Zg0S6iXSfz108ZzQkIl+APgvdMfjwxtRzqJb X-Received: by 2002:a17:907:3181:b0:787:d81c:a6ad with SMTP id xe1-20020a170907318100b00787d81ca6admr27599684ejb.769.1666616002673; Mon, 24 Oct 2022 05:53:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616002; cv=none; d=google.com; s=arc-20160816; b=Hp2SXx4sGSLO+LD4gGPhp33rUpj2TV4OY+Y22nliOna1B/PFThmJzy0bqqTfDIXUvn ONqT7txlgefATzFueMXwAgwDrfPQKeGXKg0+Pm7l0TjgedhVoxpNaI3KJIaRTA2FQbNY 7JjghaKslBpHBJxTHKRBsOnVuJYn6Ub0/BvZXO+xUBx1JSXHualkTq0I5sHgdHMX3zc/ CwbHPFewYayMl39dIxaONhJZrE3mIB8x7iOuOV+lODwrY71upZRXe511PFdQfXdFnK8U 93mVmPIQ42s6NICMcpZ8WtoRru4qmF5D9W2bwdImebbOjLeV9N4CqsrTcTiyU6G6LVbB M03w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=e/kBGpXdwDJNyguMG6E84sWFg3Vk/5lqTx67HNtfpJNbTkCBoKHzNbUzd9IcxOXSpw Rqq2HZBFb/iWoI1YY5qXm3WOQza/eUPk+V+Kg6wqjOKXqAOOAqd1sKn3qAW2+Si8S+Dt EKH/LCgcE2P7GTmOi20AFocwAGkvswTtfqKGzfPtyWBXd2mAwXs8S5dYhcllqXSU6XLw 5BDBEO0W8GYkUpo2/Wqx8R/za2mOmNF0B8c3yur3SQkpdUVxwx34ezoYz/z7b70Hamtr MaFtl+DxMhUicpxpyiP/dLJd+X4ZyM3nQvf/847k5N5p1Vm8hlZ6J2ROAPmqyUJovJn3 ufWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yZzPnFNb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a50eac2000000b004513a465ec6si25060719edp.94.2022.10.24.05.52.59; Mon, 24 Oct 2022 05:53: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=yZzPnFNb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234307AbiJXMwF (ORCPT + 99 others); Mon, 24 Oct 2022 08:52:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234821AbiJXMpt (ORCPT ); Mon, 24 Oct 2022 08:45: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 0478E72B69; Mon, 24 Oct 2022 05:10: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 9A791612B9; Mon, 24 Oct 2022 12:10:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B29FEC433D6; Mon, 24 Oct 2022 12:10:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613419; bh=K4roTK2fnCmQiAynGRZx39W2zSKfyzroDBihQQeCMlI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yZzPnFNb92nf3wnacW9NdCuaCcSK3gl0K0lZJ/Wyz2ttwT2YGBGhB+ReAPpzdCXs5 2GGhVQZNs/X9btCnIfAg3ZYNXPvLQUH+humpZ3O0gOrrh5of88RX4xqRLgg939lc6a S2Rze9fAbmuD1s8sTnKveSxnVY1nBwHR+3Yh7nVc= 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.4 130/255] HSI: omap_ssi_port: Fix dma_map_sg error check Date: Mon, 24 Oct 2022 13:30:40 +0200 Message-Id: <20221024113006.898391348@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573541631507704?= X-GMAIL-MSGID: =?utf-8?q?1747573541631507704?= 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 Mon Oct 24 11:30:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10288 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp653785wru; Mon, 24 Oct 2022 14:10:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4VxnnFsV+gyfFgHFWldTwUcpADYEtcsujDxFPEQjXHt9gDfPGgJi5Hod40cncL7eIQdoFd X-Received: by 2002:a17:906:1b49:b0:78d:b7b5:71cc with SMTP id p9-20020a1709061b4900b0078db7b571ccmr28918582ejg.536.1666645851506; Mon, 24 Oct 2022 14:10:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666645851; cv=none; d=google.com; s=arc-20160816; b=1DgFA6saoiOY4bY82RG3ryTngHyoBnmOJSTEwjojre/bP+b0uJt3/NENf7SrhD5VDV 5I5z6IG2Va8T0ovL2px/rb20Ncjy3mSQhhML4RQ6cgorSk02pKmdxi1i4DuCfm6qd6w7 1kghYMqf0O/o98yVaR1JLkmphUajReU8/jh8m64soe21pySsDsR1AmZIS5JnPWIF4nTM /38ik9bZET4iHG7rYGTPHCSn0ZSvJ1KX6+sUnDZL+Q/zi32FaMhUUTQD2IIhfGfY5MuM v4/mSyaiIcs1hccg0VGMfegYAtMN4tey3e1cnoZ5kNKR0CHeKROicqojHfCod+nqqjeA f1zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ngXAf4wPdKw1EuRnocJjsnG6rhfsOWoj8n+PMX7xmSk=; b=UFhtIKQrQSZTJqBO9MUp+70CanC/I3G/gEnsrMpEQAScmfuBt7Wfnna9tujhsxYFnN b4r4t5ddDGITbaIUFA4hclqH7ztP/zCDscsqAzg+ZUfUPvYDPRK3arrhvrQ6+8KBxjsl E7I/bAxMq8uf8bJtdxx4T8OvkAA+rf2Qn5mejJMzf0sWq//qL72oxqzJ0sUvskulJ5QK ObtkB0K4/LYalnj30dnz78YcRsIeSLatb3CIgaXNWZapDh1naOhbtRam+2a7MEaAcnRg /gk16Vf9IXa8eWyqJ76DOWeO1ueRm7LbHg97tLQezpatjgv1GIaWUrqyvMFBz72wWqES fGag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m1C96i4i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b8-20020a056402278800b00461e3e1bc3asi874267ede.317.2022.10.24.14.10.26; Mon, 24 Oct 2022 14:10: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=m1C96i4i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235068AbiJXUys (ORCPT + 99 others); Mon, 24 Oct 2022 16:54:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235242AbiJXUxd (ORCPT ); Mon, 24 Oct 2022 16:53: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 A4A4BA7AB3; Mon, 24 Oct 2022 12: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 3BDCE61259; Mon, 24 Oct 2022 12:10:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51696C433D7; Mon, 24 Oct 2022 12:10:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613421; bh=mgOxfyx21Abf6dzZ0R2ImjjUuO/7RuhL89xIScdUt0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m1C96i4iZZXtthMlmJl5Lwez+aY9iKNLZIwPCTpeGhX8A2zowxPS9a/f3jqBYM7bM xftQJowQnxiXbPDDY8kVJrIaw+lq8tuXuWKHwmd6mnBLrATQs3zO0aPQSpKDFV67Oo Wy+3SEIsSoXtZEYnwokZdOPQeLwaBbsCyctZAQmQ= 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.4 131/255] media: exynos4-is: fimc-is: Add of_node_put() when breaking out of loop Date: Mon, 24 Oct 2022 13:30:41 +0200 Message-Id: <20221024113006.929167878@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747604840247541568?= X-GMAIL-MSGID: =?utf-8?q?1747604840247541568?= From: Liang He [ Upstream commit 211f8304fa21aaedc2c247f0c9d6c7f1aaa61ad7 ] In fimc_is_register_subdevs(), we need to call of_node_put() for the reference 'i2c_bus' when breaking out of the for_each_compatible_node() which has increased the refcount. Fixes: 9a761e436843 ("[media] exynos4-is: Add Exynos4x12 FIMC-IS driver") Signed-off-by: Liang He Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/exynos4-is/fimc-is.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/platform/exynos4-is/fimc-is.c b/drivers/media/platform/exynos4-is/fimc-is.c index 9bb14bb2e498..c78c2a7f03fa 100644 --- a/drivers/media/platform/exynos4-is/fimc-is.c +++ b/drivers/media/platform/exynos4-is/fimc-is.c @@ -214,6 +214,7 @@ static int fimc_is_register_subdevs(struct fimc_is *is) if (ret < 0 || index >= FIMC_IS_SENSORS_NUM) { of_node_put(child); + of_node_put(i2c_bus); return ret; } index++; From patchwork Mon Oct 24 11:30: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: 9205 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp459061wru; Mon, 24 Oct 2022 06:38:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4v1cwpAMteDfeXK1wnrgADD3apQbKh6cDkwMRNfkQtBu4/6qTOswBB/fyq4jpBPV/Ewaj6 X-Received: by 2002:a17:902:eb89:b0:185:33d:cb34 with SMTP id q9-20020a170902eb8900b00185033dcb34mr33329971plg.55.1666618728838; Mon, 24 Oct 2022 06:38:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618728; cv=none; d=google.com; s=arc-20160816; b=GmN+VRs88WVwGs9RtbwRVWZMen9j9FNwt+IXvXZTtRr9lhAe8Gbt62yosjjDK+Wh4D B/PErTTeR86Re1zpVqMxiQuT39EDfXr+CXEJp7ehXA7yL62o04/rQri9JQGRT1dKSIqt vJhKEYNy5fhj/qruCwb2WjK6o6Y5IU17ii8YXNoOKjq8z3zONq9ihQYq2Y0vdUbJ1uwH RXLHck9mstEExbeQ5Fz5o0qpqPuSkJHJRP5DA6OIru6E2EeyLqO4+Q/yv9Uw+bgP62eI FpWQY0NVflOt/JYcGj3hwqvIE0fcaa5EprYQqw3lmMbGIXDmrUwpTeX2t/1xzqCr21hm 9fWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EHDC2wlGjzIfoYT8VbY7RHK+0XZDpGn9meghCznzQhU=; b=Y07yz4iGh54qqbDSqGWl2AwYOHgwRpAJ13/sVGyOq5ntVAAAh2B2N7PBC3ITwmcSeB Y+TSgYriaSD9FiaWfDCgIqgNPKmwP9AOSF8K/zzHixauxYsiy+h0nR3w9qOIyOoifD/X cowN2UZjxu8ogYJf7msHNamAk22zoXwd5mmEakW0fzZgA+Gppa5fONQHLg+mry53E06Q owydqY/FvUxMh7W8C/5tlAiisA+q6XHuphuq2dBZCr6JYlMXYncs21WU6T1OFtNbqbkJ fYSEwFh+zCv2bU7UvLlcM5tBdRO9RneZMWkyor7AlT+KIEb6IbayMt410Owb6vsbx+oK wr9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Sf+Clm1C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j19-20020a633c13000000b0046efa6dfeaasi4922587pga.859.2022.10.24.06.38.32; Mon, 24 Oct 2022 06:38: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=Sf+Clm1C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233608AbiJXNdj (ORCPT + 99 others); Mon, 24 Oct 2022 09:33:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236104AbiJXN3i (ORCPT ); Mon, 24 Oct 2022 09:29:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8206BABD5D; Mon, 24 Oct 2022 05:32: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 9304CB815A6; Mon, 24 Oct 2022 12:10:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDAAEC433D7; Mon, 24 Oct 2022 12:10:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613424; bh=C2m0brS/mQxeTv6w1PZLi108PJEB7MRBUQFStMEbs28=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sf+Clm1ChZERGL26LhHN9kmu+XMkEiiJ/7j7LTi/XKw4kjGh4+C9pbVE/ksp5h0Ot sYUQs5KCAZZdiiHYWOIuMscmTSeeQ7+x0DOuP5Zy3YpFdRWv112catmWk1wfYnfJ89 v4gL+tb3zMW4BxXPGy23BkR90dbUCTyGOy8CET0k= 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.4 132/255] tty: xilinx_uartps: Fix the ignore_status Date: Mon, 24 Oct 2022 13:30:42 +0200 Message-Id: <20221024113006.960063576@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576400138358348?= X-GMAIL-MSGID: =?utf-8?q?1747576400138358348?= 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 a1409251fbcc..6842999072c5 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -369,6 +369,8 @@ static irqreturn_t cdns_uart_isr(int irq, void *dev_id) isrstatus &= ~CDNS_UART_IXR_TXEMPTY; } + isrstatus &= port->read_status_mask; + isrstatus &= ~port->ignore_status_mask; /* * Skip RX processing if RX is disabled as RXEMPTY will never be set * as read bytes will not be removed from the FIFO. From patchwork Mon Oct 24 11:30: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: 9219 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp459318wru; Mon, 24 Oct 2022 06:39:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6/+KeOGstXYoVJ/yIacRYZesxArQsP0g4Hy44D2iTpaFFn2p5qNJoQlijUvFIrEhc3eT3p X-Received: by 2002:a05:6402:1906:b0:45d:db20:7709 with SMTP id e6-20020a056402190600b0045ddb207709mr30091187edz.406.1666618759809; Mon, 24 Oct 2022 06:39:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618759; cv=none; d=google.com; s=arc-20160816; b=utaDAw9EY9rh8KE649YRTw/cMQHyO7JtwtfXZEhwfCVT2qx35N5f0MOZDSDW1m9PxB hBUWgZ/ypk0jOi13G90EnfAQSQoQNaSkOoudWmP4wLvTLdYbXvBr1z4i7D4gI6PwTDIh rYFznrw1wT1FXKl+f9bd0eqSZdiAW1DEPUPlkqXMkJheV82L885UkkQamzTTysJO58Kx W52/R1WZDpBYbhISM4dTf2DYjN0/tFrL14DBtg1QmRvysHL3fEdIqeGYDzUZMo2PYh3e 1RzdHQNNQNXX1NuJCRTInsK7WENZjgxjBty8FX6uZi57QlrbuJzkG4ZcTcZKaeiAIK8B A35w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rmOBNfZQuM6fDzJ5MCye9A5aZzt4QByqpmDDpkiSopo=; b=EVI2fLRPEpGILV1LsQw1Z/Xhhy/WU4VIp7zOjLlnHmJKd8zeRS6lndRaXhZ4OTbU1e WXlhWJNV5VhaUSpYZ62riFq6ew7OvLL1tN1hiO1984wadA+aQUfXpnrVe2IS/slC/z/v 2B4FPVewxvlRn86ySlPjJQgREZnyk0mIAleK3yob/clMze5nArCFJcG34cpUYBwYJUyX h3Sgbo7IH5XnEsKSiP0tVW/SOC06TYOQITcVhWBplrj2RWj2t+dcSS43zX56Yl7kzD6f 1Cfhc+1rK1lLj+mmj4GIpAUpWO2bvFlyllNY3gEv0/YA3qvwvLW51srxZhODAhnctN0K FPWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lN+9P4cZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170906268500b0078d38cda44bsi6718510ejc.694.2022.10.24.06.38.54; Mon, 24 Oct 2022 06:39: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=lN+9P4cZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235986AbiJXNeL (ORCPT + 99 others); Mon, 24 Oct 2022 09:34:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236199AbiJXN35 (ORCPT ); Mon, 24 Oct 2022 09:29:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 760A6AC4B2; Mon, 24 Oct 2022 05:33: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 4EC71B815BD; Mon, 24 Oct 2022 12:10:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A608AC433C1; Mon, 24 Oct 2022 12:10:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613427; bh=oYRhmtQE/klOFsQCHCsRhaWDY77M6fjbrOG794N8IJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lN+9P4cZCntknjUGfcRbTfsww9N6PoQYfl/7HL0Tsa6yfwKt1WYaatQRkliJx8eSX UgYDjZZiszSdJRQJj06R0NGP60CC1WWCOzzge6Xq3IZpS7lsMCvE6qeOmynlMuyKmm VbqjS+vfRICSK+50gRwd4yrLLMBF6Cq5nMiE+qm8= 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.4 133/255] media: xilinx: vipp: Fix refcount leak in xvip_graph_dma_init Date: Mon, 24 Oct 2022 13:30:43 +0200 Message-Id: <20221024113007.001252156@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576432836954523?= X-GMAIL-MSGID: =?utf-8?q?1747576432836954523?= 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 cc2856efea59..f2b0c490187c 100644 --- a/drivers/media/platform/xilinx/xilinx-vipp.c +++ b/drivers/media/platform/xilinx/xilinx-vipp.c @@ -472,7 +472,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) { @@ -482,13 +482,14 @@ static int xvip_graph_dma_init(struct xvip_composite_device *xdev) for_each_child_of_node(ports, port) { ret = xvip_graph_dma_init_one(xdev, port); - if (ret < 0) { + if (ret) { of_node_put(port); - return ret; + break; } } - return 0; + of_node_put(ports); + return ret; } static void xvip_graph_cleanup(struct xvip_composite_device *xdev) From patchwork Mon Oct 24 11:30: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: 8937 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp435059wru; Mon, 24 Oct 2022 05:53:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7nnXkCFFa1x8y70EXhifQHIQYT6XilNyNoQ/V/9IsIqt+hNKT84zrdj/TJROjr28R9PMKH X-Received: by 2002:a17:907:744:b0:741:36b9:d2cc with SMTP id xc4-20020a170907074400b0074136b9d2ccmr26461113ejb.613.1666616015012; Mon, 24 Oct 2022 05:53:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616015; cv=none; d=google.com; s=arc-20160816; b=UGMHUopnpa4WTQ5792DPgmNjj2M44wuOvxr7gXjGcq3shxdR6yszdfZrCkVZrnnRzZ rBy1MlQrf99ydLN63v87P7SgEbrjYqj34JJd8BDwFoNHoao1y+r+E535wSc4HZ9RErCu 0PlGxYx9tECQCA+ZCS8BlnzCrzUAZ8kSKLxVP+b1/YgEawSFc1XrId5wFOaDVQIckFNA tRQrz4Gx0w9FUA7kJkiNzjivxrBurNchPQ3N/LgNf10AF6QDY574AFgK6WyhEo12h8I+ 7BJRpSEzazrKzxhwV8tzeQSYzliyHIGj7mnF2QBwKLZ3qkQ9/3m8PZHdFkK1PdrSH/UF m0lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yelop9q74YkPOZ4gsG10ihT5SLmc7sj/3WDxiorRvkM=; b=Ubb3BEbAih6O5Uy6d6DY1d13Ec4g87G27uzcv7Q8IsuapgBpDoicD6ybnvKEWZj86z 2haeJGYF9NR1pkv/7VqVOhZsMnUo5TDHTdF8V5qGQ9uGVL9PdtaIwNLi5H6iibXH5BHj cQ3NlXE0x5OvTtFq1XuDA8xoI7WqcSb92o+oN8h0uCW1g+lTjtp4S5aTHM1Wg/r+77Wk NGhV6GoqR/5hTUCsdqRd7uCxW7rxsTsdMXr4IMyipTsk0aZUPefm980Tty1cWaFkl8PM MeuRN/A9nH7cAeIJH8q6JsGRZhilLq01zuTHlOnBNfDn8M8hgBGX88fOqZzbhLLb6r1g xHPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PCabu5h9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j7-20020a05640211c700b004593a09f7cdsi26857095edw.394.2022.10.24.05.53.10; Mon, 24 Oct 2022 05:53: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=PCabu5h9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234634AbiJXMwQ (ORCPT + 99 others); Mon, 24 Oct 2022 08:52:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234882AbiJXMqB (ORCPT ); Mon, 24 Oct 2022 08:46:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F4E57FF8F; Mon, 24 Oct 2022 05:10: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 2CF72612BB; Mon, 24 Oct 2022 12:10:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F3F3C433D6; Mon, 24 Oct 2022 12:10:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613429; bh=Z4KwhnZocj034/nVJJU8n25lrzvP5QKqGXheAD/kt6w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PCabu5h9goUcc7oMfupjCR1uYKWNneEmEo1wAgsnSWWjz7HgLNvNfYNO/aQ7OyXFD FRNzIcF8OTW7rI2iWTOAcAI4isMzOst3iN9IGC5l/8qDwcK/3sMa9DDj6ykMc5mKhi d/fW1Jg+gNo0toAMO0yzZKnnLLxPab1IVTjjUFB4= 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.4 134/255] RDMA/rxe: Fix "kernel NULL pointer dereference" error Date: Mon, 24 Oct 2022 13:30:44 +0200 Message-Id: <20221024113007.032306033@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573554415452055?= X-GMAIL-MSGID: =?utf-8?q?1747573554415452055?= 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 57f111fe5443..be3eff792864 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -805,7 +805,9 @@ void rxe_qp_destroy(struct rxe_qp *qp) rxe_cleanup_task(&qp->comp.task); /* flush out any receive wr's or pending requests */ - __rxe_do_task(&qp->req.task); + if (qp->req.task.func) + __rxe_do_task(&qp->req.task); + if (qp->sq.queue) { __rxe_do_task(&qp->comp.task); __rxe_do_task(&qp->req.task); From patchwork Mon Oct 24 11:30: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: 9019 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441340wru; Mon, 24 Oct 2022 06:05:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4QExdaa/LRZgFrDqmjp49Omx+Jy028cF+y7pp2XhPav4caNTye1hwHTU4P3glCGgnYcahA X-Received: by 2002:a17:90a:d588:b0:202:aa2d:1022 with SMTP id v8-20020a17090ad58800b00202aa2d1022mr74714048pju.31.1666616747092; Mon, 24 Oct 2022 06:05:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616747; cv=none; d=google.com; s=arc-20160816; b=GZSva5y9JP9Kr2MLJxZuVVlZXZXLcuY6q55hc0Wp28QSn7W6NiR8zJzA6GTdmiMvKG Cgcse7+EFeSMiRAWpdvAjpSZ4EgfdM2JeigVjk43vMe5l4gg6T0hR1KyoMzzRuCNKIyP 0ycpS23rYNbWKXHNOyAf6MznbWQIrrkJrr8Y9QsH9nTSJ40H/RX9od4/rF2Rt/EkZ+jj IhbZlW+tkugq5PqTVm13bWk4Ey0uvbLmSZnyNvkFe6rpJ8vrJ4IR2T3vZVF8I3K5eeQQ FpximaRThnWuGi/S1yei/ugI0SB9HCnURra0v5oA/YkGAbxMhdDMbdDv0CtRp1ua5o6S c1MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NnoGBOX7oRpgOlnKc+7dMO76eHKbubbKeIee0TxYfCE=; b=v9htA4MhngJfRoX07VXkHN/qr/Q9gWSdZ7ydjCX+OHPR+J05euaIi4XyZfPOYvnJO3 3eLnUVsaKog/ak9+paXg5599WVXIn/xMV8/xG1DA4tgnp/Fw/dDYW0g55+a91LlDB9vo 821ySxcQwqhRJWvnlxfF7210cmOY8rtTUxwKTrXuXSL7c7bFbdiOC28orR6nM/NhDAed L7PuZltfvcFXtO1rkTny6Q64gFFZasuN9saqqGEFqjES+kLJw1PwEQmTK890agxThVPl dUmTDicJDR09j9CNydW3Ahj7/UX3asZE3H5DqeQE+8LH4NLMX+irvqyjJBT/MNeT4FTt p3gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kQPqNYtS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j69-20020a638048000000b0046ebb32e9d4si12057740pgd.737.2022.10.24.06.05.02; Mon, 24 Oct 2022 06:05: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=kQPqNYtS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235264AbiJXND7 (ORCPT + 99 others); Mon, 24 Oct 2022 09:03:59 -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 S235378AbiJXNAF (ORCPT ); Mon, 24 Oct 2022 09:00:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E75811834; Mon, 24 Oct 2022 05:19: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 06E9A61290; Mon, 24 Oct 2022 12:10:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 155EEC433C1; Mon, 24 Oct 2022 12:10:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613432; bh=erp1Dq2cXRI9kYCT9NdeySqx+z3DNa6n189hM0YEwPM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kQPqNYtSN4hxLetGoU/ZDrEaJP0lCglc7dFh6l5rY2nYskAwRYDgiGLL4FmYKRgB2 CaaZbWZfhrSHVwVZRVqDxXbHFO4L1sbXVNVoukltnmZur6ostGbRTT+eN0/7JUr1pC NJn0s51qa8dNdqUTggVfZ3wMPxyBzL7XDULhPhVU= 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.4 135/255] RDMA/rxe: Fix the error caused by qp->sk Date: Mon, 24 Oct 2022 13:30:45 +0200 Message-Id: <20221024113007.067610368@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574322245157361?= X-GMAIL-MSGID: =?utf-8?q?1747574322245157361?= 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 be3eff792864..89f6d54a4312 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -847,8 +847,10 @@ static void rxe_qp_do_cleanup(struct work_struct *work) free_rd_atomic_resources(qp); - kernel_sock_shutdown(qp->sk, SHUT_RDWR); - sock_release(qp->sk); + if (qp->sk) { + kernel_sock_shutdown(qp->sk, SHUT_RDWR); + sock_release(qp->sk); + } } /* called when the last reference to the qp is dropped */ From patchwork Mon Oct 24 11:30: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: 9888 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp571603wru; Mon, 24 Oct 2022 10:33:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4jDUmgxbk/s4tc7sXXqtlyayNs8KIhTS1XdheYPV/F6H/bBw1wALUaCY4LgzvvFRc5BNGT X-Received: by 2002:a17:902:bb98:b0:186:988d:a0f0 with SMTP id m24-20020a170902bb9800b00186988da0f0mr10403698pls.10.1666632809470; Mon, 24 Oct 2022 10:33:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666632809; cv=none; d=google.com; s=arc-20160816; b=m9b0pZb3bYzT4hHKyQ11QlLFPpKKAb4/HgSs1IOiFU1v3BlP7IYwwcbNORsiyC2BoS 5eGuS2q3h70jdd7GVxwIhStySRAf0myUE5BqC83XgrrkHA8NwLEkV94CxY6INwINR9r5 uulv6agOgEUosYfARPfhmVqh+jRCvr9SSOntNVtUCvVp9ZKBvMwuZOHp+B0GBjRiYjEw I0USQcliCh4sxCQAvnG1Hx0l/VXpG80iMz9tsQo93FiOmBtOlvNc0+My/C4APdszbz9K 9CuR/5J+0okaLg9KSASeOoTYmONqA+7uoIgkbZKux3+jBhUbYUTfdgSow9BusVNMA8yR aeLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tiZMvgom47ZskvD9/GGQoI+2kuQxUSJ+bjsHRgYACvo=; b=EmjphtGfnetV2s/HXnj2B8uiPSRvcoNT2Ia7t9wf+NZU0wOQB/GRQHn3bTW6V+mZvD r7lw36+M52HgcU+nCzpSuXj6qDxPkDjI18JsabGz9/fwr/xxYwlE+p5hbhgORMQeZ96I Bco3zung/PkiuUqhiv8nT3Vc5xojZSqa7c1amXn84SY5+AtOMvZMgElUtJLbXCVgNGgy mWPVD+RK834bnvEMCNW8orVggotW2R4qiUpdYuUeA0QhvQukCkaAsXy+bovyQY0ljwfP F5Y/DClXsvM8AM5l8075LXC74hU1/VjCsI+YewTzz310+71PBGzKe0G3nKjQ2INz9rFZ eZ0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xrhaMr+Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z37-20020a630a65000000b0046eb1d42b66si100179pgk.284.2022.10.24.10.33.16; Mon, 24 Oct 2022 10:33: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=xrhaMr+Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231726AbiJXRbr (ORCPT + 99 others); Mon, 24 Oct 2022 13:31:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231984AbiJXRbY (ORCPT ); Mon, 24 Oct 2022 13:31: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 356CE4D142; Mon, 24 Oct 2022 09:07: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 5A97EB815B1; Mon, 24 Oct 2022 12:10:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AAFAFC433C1; Mon, 24 Oct 2022 12:10:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613435; bh=F9QdaByYRJJaL62QU8goMier2SlNAtihGwndftq3eS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xrhaMr+ZPHT84G79Mj0rrBs6lU2EK4JJGpSd7JMUItJ+LtV2csQrJaiSsxDWvJLp9 Lg+1V9IkSHyatcoW9Kd46QHz3bCoSaqf/+gYCyLblMM7RgpwEpXIa44mhnvpIKGRg2 c0B8OesKjeANqorVHMlJeNNhzhGKmRFOyY40cT3A= 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.4 136/255] misc: ocxl: fix possible refcount leak in afu_ioctl() Date: Mon, 24 Oct 2022 13:30:46 +0200 Message-Id: <20221024113007.102279918@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747591164588039997?= X-GMAIL-MSGID: =?utf-8?q?1747591164588039997?= 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 c742ab02ae18..e094809b54ff 100644 --- a/drivers/misc/ocxl/file.c +++ b/drivers/misc/ocxl/file.c @@ -259,6 +259,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 Mon Oct 24 11:30:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9012 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441113wru; Mon, 24 Oct 2022 06:05:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5wg4TX0ox5hofKRHncdhCI5sHuFpmyJ8ihBZNPm19AnN3dM+P016pilHn2JutNhODmai/x X-Received: by 2002:a17:902:db09:b0:185:53c7:6e8e with SMTP id m9-20020a170902db0900b0018553c76e8emr33475986plx.155.1666616722817; Mon, 24 Oct 2022 06:05:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616722; cv=none; d=google.com; s=arc-20160816; b=eyy3d2KdQtfKCKze+fOoFzC2wgZUhZLnc2EB8MTpFl5GVnAdiw+N0mL4xtQMUE/Voj heFkc+9Fdsl1m3ODoDZTDdz/GI4HABUyPC9uIZ7meLmt+WFQ9Cr1ucO+/tkbDOIZ14iX FyjfGk5gUROo5XHE5MJOlDvYrS1sV929yjyFQPnDIYUiaEO2gZgPoX4y47Gq7ryfJKOR 0Tl668wJfJWEebdfl477XjmXmeaAUPNNiUs7McJOomuRS+ndwTjMPpLl0VEtb8Q2EwfM FD7AFz8VMZl91wmOTmy1O0FNrxMkPuy6rkxNEhvTJnGB6YZe3U3kAigjUleTVGN7ibur Vuow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=G5n5fw6Ej3l5dvSD0k8+uaWWO1aSGho/BzJQ3CJVykg=; b=pw64tL9qBgxD/mDv9lIFlRqNF6tHGvKGEvD5hXkbKQPG2GlJ10rj5uF932vCVZ1ZIU dJYwDnxW6OCkIQCg5xgSWz71JNBgstnF+21RWZ07CGZ94kkvkxYbNTZhCVRwsVc/aQVX lbRRG5x4oV0ULPGUAR0tdvIjPipPdfcoxFKIDvfuQXL9zaa1EtFV3s/JqukDvWjkQCM3 d0bKnxKLhwys9gMFIGqTWro+/Qy7BmGPQpmeQ+0CF8aj0mxYK96SgqrCsOlrx98GffCl A87HMLo9xNEbHTzXXvtoDQ1TdxnCIc5p9x+ykD4SGJvdePDvkIw5FMsMSb4/h2qVAfb4 E3/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sNcue61Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a6381c2000000b00434bfa4c2d7si1401953pgd.317.2022.10.24.06.04.54; Mon, 24 Oct 2022 06:05: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=sNcue61Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235206AbiJXNDd (ORCPT + 99 others); Mon, 24 Oct 2022 09:03:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235300AbiJXM7x (ORCPT ); Mon, 24 Oct 2022 08:59: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 B7CEC82740; Mon, 24 Oct 2022 05:19: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 4069161254; Mon, 24 Oct 2022 12:10:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57FC3C433D6; Mon, 24 Oct 2022 12:10:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613437; bh=aMwCiuho+5sGPWzHfvZm4UqIdHJc/Ci1aTkPE5AYjf0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sNcue61QhnFAmLGaXVuBPV7YlF9qrhFdFkGKKBrPjs8qZLr08ypBkrw3S/WDjg/rk kh8UQGaOLXKcChPvjRWWVViV17MfFafDRC6+7H2Fbbtyk5wEdkT1JT0NZmU17Jfgg0 cbW9DflVZo9lmpje+o2kzpHXIBPCXYkk69+7loxM= 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.4 137/255] dyndbg: fix module.dyndbg handling Date: Mon, 24 Oct 2022 13:30:47 +0200 Message-Id: <20221024113007.133286024@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574296455265095?= X-GMAIL-MSGID: =?utf-8?q?1747574296455265095?= 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 4cf02ecd67de..65575143c89f 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -191,7 +191,7 @@ static inline int ddebug_remove_module(const char *mod) static inline int ddebug_dyndbg_module_param_cb(char *param, char *val, const char *modname) { - if (strstr(param, "dyndbg")) { + if (!strcmp(param, "dyndbg")) { /* avoid pr_warn(), which wants pr_fmt() fully defined */ printk(KERN_WARNING "dyndbg param is supported only in " "CONFIG_DYNAMIC_DEBUG builds\n"); From patchwork Mon Oct 24 11:30: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: 9020 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441345wru; Mon, 24 Oct 2022 06:05:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5bLO8GsqnaZi06Izd/Opz9mdfnS4Tx+A/SyIc5jC1EbMp1kTjZ39Kc+9/dy6bXNioWMgmM X-Received: by 2002:a05:6a00:1412:b0:557:d887:2025 with SMTP id l18-20020a056a00141200b00557d8872025mr33316702pfu.39.1666616747309; Mon, 24 Oct 2022 06:05:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616747; cv=none; d=google.com; s=arc-20160816; b=oofCOmEiRvd4UcPdYrkHnSyT/rZh9FitpmMvtE33zK5t/YdrUtZh3r5Saj6aXqx/Rk S4wUkMsfcB5EiQs5gFZDR7eg2V7cO9ygHn+62eHNHoBHV/2sKeYn9EX01ss5Y6gG/i8f QrvjhQOEH6ktWDEs+u0SvW1MjK0Zf22qfXgWHAW3FVE4uyBOlhXgVk0RJrYjhR6pugac Vc16hVjjQTooIXPn8FnxdY87T3mr+LIVI4brFslBYj+y2sV9gzEsIgeOQfLv1uOWNCwW v8adO5G73th8hFvq4shAYicbq6cS8vE0L1I0vLgP0F0qYmqZP91c5LeZ4UsF3HhW8LRy gFSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NYq0Y4GBRPnQky3iM5aEqieQZ9EdIagmmjj6MPw7pME=; b=A5R6tZ3/6/hN5qjztDrdwBxPcOEK4b1sH2bqfkzi8H5FJrBDmmkj5ubKQtrqmcbmey T9+7Y/dIyhXWbWkv6MrYHcH5kBN9cpS5zhip73CvRqFtaRvpNzkMtNDOEzfghk2rDpmV anG2ABsJ9WIt7+Ol+GKlJShtkGJ3RlLpx33VVGejCWzJnYz+z8U0t/iw9hFXQ6NeJAve Vy9e/VoY+a2dsdf2E5SfWWx92t8CO76ln7Fy2wmwL9dM1CYMHe+0qCo9xhZRgaH/v3nu 2Hc8L7Z7ymM/XF1/PcEkiZ8rV9SgjksAWg4Glc7exFtyllYnQLrFK7zDm2URwKM3/TLz YVgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0ELsrGy7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t32-20020a634620000000b0045d8554a062si34054391pga.56.2022.10.24.06.04.58; Mon, 24 Oct 2022 06:05: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=0ELsrGy7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235245AbiJXNDx (ORCPT + 99 others); Mon, 24 Oct 2022 09:03:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235349AbiJXNAA (ORCPT ); Mon, 24 Oct 2022 09:00: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 6E0EE11819; Mon, 24 Oct 2022 05:19: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 CF4386129D; Mon, 24 Oct 2022 12:10:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7ABDC433C1; Mon, 24 Oct 2022 12:10:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613440; bh=zAXf8WbaaT0rVM2JF9TeKwea6lfPVHe5p/pfXUS6HQI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0ELsrGy7SJu2tq0z/68Dp6IoA3yUKLKB0+48QUQinqpRGjHYcHGYz7AypjaCq0tAR v6nbBM9bq8o6CZOlDz3CNWssvC6Irs8WDbGs3rWZQxvFr7whKj+KIXmOYxfbhpHNE7 j6MZgGRc84AKL5BwD3t2sYbzYwxK068cE7rBTz0s= 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.4 138/255] dyndbg: let query-modname override actual module name Date: Mon, 24 Oct 2022 13:30:48 +0200 Message-Id: <20221024113007.162215977@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574322343356832?= X-GMAIL-MSGID: =?utf-8?q?1747574322343356832?= 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 ccf05719b1ad..c9e1960fefc8 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -329,10 +329,6 @@ static int ddebug_parse_query(char *words[], int nwords, } memset(query, 0, sizeof(*query)); - if (modname) - /* support $modname.dyndbg= */ - query->module = modname; - for (i = 0; i < nwords; i += 2) { if (!strcmp(words[i], "func")) { rc = check_set(&query->function, words[i+1], "func"); @@ -381,6 +377,13 @@ static int ddebug_parse_query(char *words[], int nwords, if (rc) return rc; } + if (!query->module && modname) + /* + * support $modname.dyndbg=, when + * not given in the query itself + */ + query->module = modname; + vpr_info_dq(query, "parsed"); return 0; } From patchwork Mon Oct 24 11:30: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: 9000 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp440032wru; Mon, 24 Oct 2022 06:03:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7cT5DlCpUw40E0VibkZ9agf9fkGCr/Y1kjBL6qgNnoZZclwL7ohdKAAKRqcCLGuY8OOlmh X-Received: by 2002:a17:903:50e:b0:182:631b:df6f with SMTP id jn14-20020a170903050e00b00182631bdf6fmr33562630plb.66.1666616620024; Mon, 24 Oct 2022 06:03:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616620; cv=none; d=google.com; s=arc-20160816; b=gpUxBAMtrE3rwfin4BZuNvYkbhcjhCg+MHz6VWtAv2ry9KT9zb+99C9G+ri+DWEGnr ONubb96++59ApJ59eXX1NdHhnRxACc5DzPdUSK3TDr1JuUpYlDcf66yCS+mfUSeeHWPy l9T+zkHf1iyWvl7SjWyvY6XX8MEZJH/k6gVF2epiMsZD3pp5Gbn1QxFSu+27qyR++EAi C+evfxCf/JwqMDK1LeKXse0oDhsE6trVxRFF5tJX5J5JQXPeMNUwo7Jm4ctASmIre31f ZZdO2zFZn6nz2/0YfQJyYVWVtgDSKGCSN8j3jloUtyZZq+lxSLALgvwkEZvgnXv4OrQ0 IxTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UwvvAbW53sou3hvf0KN9OQkQ/haXiDNVacFIRHS5hQg=; b=SGlpJXU+nAZ+1cdoJH0z5u5XXY3e7+cZescLMDYxV0CsjlNT6oSbx/tIGzPhk4B7qn INw/hoSEucxI8kEjI8TYS3rpxlgdBW+C578UgAuHEssJyoMy1RNhjpgqGoFdNZzg4lF7 7FtLrs0SPQ6FTSqQtK78eaXbM99mHNnRVulUWSphYL83h7Ifuci4JQriKW1ImHyCTkmE Jm7hadWfsqmMEEAO6crYQhU6TXSmCP367sB/YzZZ9xC0P57b0rISvEHqXP3XLu8xGo1s 1Eit/R4jnrgqJZ5FjlCi/j3HJkNs6Vu1m8CbOTo4+bQeH6TC07nGnzycxFdardJL4eRh aGbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TeH3tk2U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090b224100b001fd81d07d0esi18617569pjb.123.2022.10.24.06.03.12; Mon, 24 Oct 2022 06: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=TeH3tk2U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234987AbiJXNCh (ORCPT + 99 others); Mon, 24 Oct 2022 09:02:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235176AbiJXM7d (ORCPT ); Mon, 24 Oct 2022 08:59: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 4501D79920; Mon, 24 Oct 2022 05:19: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 67D3F6129E; Mon, 24 Oct 2022 12:10:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79665C433C1; Mon, 24 Oct 2022 12:10:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613442; bh=JIglXPERcfYhEFaXJE8sshooRMTJ9fVV8Yw7NNMupAw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TeH3tk2UbqQVssInwYnYbqov1800GjtedHXLo9iTczJZZ44cfERjlkP6ATD1dZAsJ oWFNU0kI3dC/pTX1TxFRTJXK6/89zeiXBaX7pWBiJQ4ptZQ9m6U95ujIjk26cIjWt7 aO2Z5dH1FX2tlKcpsKdd6PlQQ76v3eUUbOPHCTrI= 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.4 139/255] mtd: devices: docg3: check the return value of devm_ioremap() in the probe Date: Mon, 24 Oct 2022 13:30:49 +0200 Message-Id: <20221024113007.210068079@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574188826921023?= X-GMAIL-MSGID: =?utf-8?q?1747574188826921023?= 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 eb0f4600efd1..40f9b6dffe3d 100644 --- a/drivers/mtd/devices/docg3.c +++ b/drivers/mtd/devices/docg3.c @@ -1975,9 +1975,14 @@ static int __init docg3_probe(struct platform_device *pdev) dev_err(dev, "No I/O memory resource defined\n"); return ret; } - base = devm_ioremap(dev, ress->start, DOC_IOSPACE_SIZE); ret = -ENOMEM; + base = devm_ioremap(dev, ress->start, DOC_IOSPACE_SIZE); + if (!base) { + dev_err(dev, "devm_ioremap dev failed\n"); + return ret; + } + cascade = devm_kcalloc(dev, DOC_MAX_NBFLOORS, sizeof(*cascade), GFP_KERNEL); if (!cascade) From patchwork Mon Oct 24 11:30: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: 9753 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp549496wru; Mon, 24 Oct 2022 09:44:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4mFoHvzjxw/2xs5RV7aATcwZuUZCSRaM8XZiOMRZ6Wvz/jSSlAcxoiPn32bTXne83flKAy X-Received: by 2002:a17:902:eb8e:b0:17f:637b:9548 with SMTP id q14-20020a170902eb8e00b0017f637b9548mr34968534plg.158.1666629840744; Mon, 24 Oct 2022 09:44:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629840; cv=none; d=google.com; s=arc-20160816; b=F3MVFyq0MSYlMXIY/D6nrx5UcmykpQL5K8Jdi+Y9/TKKWMCdTO1d8aBRZAPu8oUVWH IBZtgMXdO7M0+Bl5kUPA6AXBCBG2QAHKA2sWFLZynPpyfQueeUuQsyfkatuzJ1Qx0WsW jagXZMHmipgFLVJku2PyjnyfZ8aHdLNYpFWevM2OoSjmpo1f1hzhncKRNZtp/fN28b4u hOGXYq9QqpOIedi1seKU+zA3jTk6dpbWDgMUPp1y/1ZVIuxiViBqLYdWiAuc+ORmmtpI CJJk9AVBRX8TFMjI+P2mlwCTND+PM1ZCltnOAqMvI11PbF5IzrraUJW+Ozl4IU/T35U7 lyFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=z6jNpnPRrfL3p5Pocn5zJarLiKBPrjuG/YJQ229yvPo=; b=Ur3X1frdNzHCzwRZ7GZUoeKJ84m4b8DVMsAk9OkmJfXHHBju6w2rpH6lJYwb5jV/W6 wmt4dmZVF4XuhyPcbB9p3L+XI/SGx6vrrPmEYqRzsO+pvYhM0frxinegUbBzBz5xkeHj P4BQ2TVLj8m9q0zq07iX+qV9gdbez2QDwJKh+GuC5m1/bjjXZ2DrB/G2BFrILDhr0ZbI Irj2/yCQEfzsg7h6a65WrhSLUEF8KJgMu0vL/yuHdXXyuT6CUBrvxKC8Qqb0FGRN1M57 cZ1WYDDoKk2C/V4NIX91v8HIc+LmFzwkrcQw5GK5C66vgdrkcobCTrQPETrM7VfVbJaU 5JnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UcDpDQm7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902c40400b00185402cfee2si41916508plk.390.2022.10.24.09.43.48; Mon, 24 Oct 2022 09: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=UcDpDQm7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234746AbiJXQnZ (ORCPT + 99 others); Mon, 24 Oct 2022 12:43:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234704AbiJXQmu (ORCPT ); Mon, 24 Oct 2022 12:42:50 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D609FCC5; Mon, 24 Oct 2022 08:29: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 6C80AB815AE; Mon, 24 Oct 2022 12:10:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFD7DC433D6; Mon, 24 Oct 2022 12:10:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613448; bh=/HiONoJLixYYJMotsCLlT211vd+a59UGQzRL4UvcskU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UcDpDQm7ZbIOHf2wFreeRMy72rqlo90yuY2P+op1fhYiKUw2MvAhCNUJIcqiNlrxL dkh5rB8EC5YZVwn5bZs7vezwVxNnOT6lUFkXcHuUpe2GSILE9nObmsjE//6c5faUqf GzXzAAvtjntZPM87+rj6meEEqyH4GpdprYow5B/g= 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.4 140/255] RDMA/siw: Always consume all skbuf data in sk_data_ready() upcall. Date: Mon, 24 Oct 2022 13:30:50 +0200 Message-Id: <20221024113007.238775802@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747588051818577996?= X-GMAIL-MSGID: =?utf-8?q?1747588051818577996?= 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 5f94c716301f..e8a1aa07f058 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 Mon Oct 24 11:30:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9014 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441110wru; Mon, 24 Oct 2022 06:05:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7RQEXHlfOrihsJWRYZ8HW5jCS9R8Bg3jOAiMPgG1tThiEdWzHHXpP9sPhxZMLPwtVVrGY1 X-Received: by 2002:a63:90c1:0:b0:45f:c9a7:15c3 with SMTP id a184-20020a6390c1000000b0045fc9a715c3mr28158952pge.304.1666616722677; Mon, 24 Oct 2022 06:05:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616722; cv=none; d=google.com; s=arc-20160816; b=b2/nVzdzEfXxhyoDcI5W2SUU4NyHlu5MsnRSEuBw+RWOGYjsbwT19/JTGJzIT4+dlB rfdb+06nVvwuz4UWoiEtdCD9A5uQ28OclNZBKxTellHIIiNopdF/7qdVGXki37j43UMf fb/oIx1jyUAxfe5LzENOH++JGagO6DmeIyZzOE/wKIviwDXuxvdSKhtSs+p5B1QPKe6v +67EsQyMTh6ZSuJrtgcidiitmJ3MWlWfoiOUS4X1r8GilDXTxKBvGmrM81D2jYdnM5eC kmuWDv5bHWTBSPCPtkodXZX9UymbUWXL4Q/HqrQVLwNM1+tDseYfdj3A/mfTc7qwVAi+ On0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QOKLZ4ZMSPje3XYsO1BAlLqeRs8O9EAwnpnwqLYpxsA=; b=Q/IkjoqBjwgCOHqX9Z4LfPjqUxWFhNNr0gukDU2AxDUfEoA2a2AXGAzjK2zBKmtqWn iXen+QRYkxnPJfN9LOA/jJcyYFMLOS4l5U+aCSvyESy7HoAqwobj1SlwCki7HfOJfiCT RTq86S8kDCrR4uNXtGhmsj3RWLUSJztAlNIE3xyxF7mfDhg0Y9+2VjHJeAiEEuZw9Wv8 EP+Z4iVJWNZdYtqqO/+ElVLGb3MEjjfH3hbABMeD4+0E5bmjjOYEQ8fggQ/xwOwPg4oy KDk0Z/jNiLw+FP+tzuDxTfH9FYFFEinpCKODBrb9voE7LoD4dy6Ex3/Ce2yb4nB/AZTH NwKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="KAzKQ/Sj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056a00178a00b00565a581ecc0si39226988pfg.11.2022.10.24.06.04.54; Mon, 24 Oct 2022 06:05: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="KAzKQ/Sj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234712AbiJXNDi (ORCPT + 99 others); Mon, 24 Oct 2022 09:03:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235306AbiJXM7x (ORCPT ); Mon, 24 Oct 2022 08:59: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 0F0E182743; Mon, 24 Oct 2022 05:19: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 4B7C9612A4; Mon, 24 Oct 2022 12:10:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BFD1C433D6; Mon, 24 Oct 2022 12:10:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613450; bh=xGYjKcOLlvZoNqj94TrqhJyt9N8mS9hRdIcXcQIs8x4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KAzKQ/Sj+vlY1yhy58dljbM0Vjs1L0rg0Ucuu+i9JSJHd5wx5+nxsffkv5AKC5zjv TrfT7tkCO/4723MG6nIFh78Nax3cAIt+9hxtN7+lqYLb0oaitOe3uKngnCwB+89ORR RYUH3wWsX097Yj75CN9JHtPeo3Tb1EN1RSxAB7d8= 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.4 141/255] ata: fix ata_id_sense_reporting_enabled() and ata_id_has_sense_reporting() Date: Mon, 24 Oct 2022 13:30:51 +0200 Message-Id: <20221024113007.283128570@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574296676977024?= X-GMAIL-MSGID: =?utf-8?q?1747574296676977024?= 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 6e67aded28f8..734cc646ce35 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -770,16 +770,21 @@ static inline bool ata_id_has_read_log_dma_ext(const u16 *id) static inline bool ata_id_has_sense_reporting(const u16 *id) { - if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15))) + if (!(id[ATA_ID_CFS_ENABLE_2] & BIT(15))) + return false; + if ((id[ATA_ID_COMMAND_SET_3] & (BIT(15) | BIT(14))) != BIT(14)) return false; - return id[ATA_ID_COMMAND_SET_3] & (1 << 6); + return id[ATA_ID_COMMAND_SET_3] & BIT(6); } static inline bool ata_id_sense_reporting_enabled(const u16 *id) { - if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15))) + if (!ata_id_has_sense_reporting(id)) + return false; + /* ata_id_has_sense_reporting() == true, word 86 must have bit 15 set */ + if ((id[ATA_ID_COMMAND_SET_4] & (BIT(15) | BIT(14))) != BIT(14)) return false; - return id[ATA_ID_COMMAND_SET_4] & (1 << 6); + return id[ATA_ID_COMMAND_SET_4] & BIT(6); } /** From patchwork Mon Oct 24 11:30: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: 9024 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441417wru; Mon, 24 Oct 2022 06:05:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM77WJxgB2xSbp1VWW17qLa+c7X5ObbP/rOGgpceHGBqOvnXPbg4Iuk8e7B5lFgyUdm3tnkp X-Received: by 2002:a63:d845:0:b0:44b:d074:97d with SMTP id k5-20020a63d845000000b0044bd074097dmr28655579pgj.32.1666616753344; Mon, 24 Oct 2022 06:05:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616753; cv=none; d=google.com; s=arc-20160816; b=Ss1ICUNfGq3O81jcfrCYYuziuLLtLzi1xcpSDMDSis94jgeVXhVE+YaRXcl1+DnlT7 LTHUieS+Sqk9JuQNRS1hWEhOVgZrIMZU8ByY6ediIxRlqjMXfgI3w3jUo0D7hebNc/Km BYfbkd/J2m1eF9vq8s0GgrqE1dPBR9GX/xB0U3kLBGfsGzkuR16UeGaUWmFX1aj0+i2A 2TLb02Vlc5SZswxljcuz3kfwb70HhDi0OSV+X6JE9mmoqXbLgQzqF+SSPOmWogk7WKKL Xdt97x+LE4YnB4qz5YK95fxkCIQhIrtGpF/eeNbDyRkn9oVlqAwUzaA7swAuGqVm7Dvx AnEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cYrSvltH2yTZNaRkugwmHf6xUxP2z6XKXvfql4CvoKo=; b=PZNRpya6KCimBafacFyl21aJq33DZJMyhXBj4KpC4KtAPWVtjmNw+WnpdYrP49bDxP EvTeBYs9yU2duUDyiCL1ZhQNIer6atmPx9dmg7cG93uV2TzBSB6yjt4DFBaHPWUiRlhy hqYMSWA9ma2DGly7GWt3V+0HQShQ3dsihTJTacI/zpi8IcRnHADo8fJVNNfT/2t4asbi MeCeeShwVxwelKE5u3KMTMdKF6FIXO3AvzuPIyqU1ETbyxnMj7K0SximCMLl/SRV9JdY HA8kbS5e3dPm4vcCI0TcOYDqn1MEdLqMd+YOF7PdmEhwgTrNv0RGf15xjMPRgZYwUXmP UTyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uQWxKS8n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056a00230d00b0053652e1c0b6si39651211pfh.12.2022.10.24.06.05.04; Mon, 24 Oct 2022 06:05: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=uQWxKS8n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235282AbiJXNEJ (ORCPT + 99 others); Mon, 24 Oct 2022 09:04:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235384AbiJXNAF (ORCPT ); Mon, 24 Oct 2022 09:00:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 544681144; Mon, 24 Oct 2022 05:19: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 DAB0061278; Mon, 24 Oct 2022 12:10:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFD60C433C1; Mon, 24 Oct 2022 12:10:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613453; bh=MAndz8nMfGWumzgeumXtIyvQC0YhR+/u+DyUw+CVihY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uQWxKS8n1+Wdr2zTYwZkCDkXSVCCpKErzGADoctbWtkmSVWB+HbJqE+D95F4WKmYC 76MAXkqXHfpJ/RhK3OqgJP46SrwpKuCGTM9YmeJiYbXHw4axyULF2xzIDg6yVHyaVe FycBnh3+dOTvoKReGKCPCyI87HEd/50S9DPqO42Q= 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.4 142/255] ata: fix ata_id_has_devslp() Date: Mon, 24 Oct 2022 13:30:52 +0200 Message-Id: <20221024113007.321825699@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574328972445864?= X-GMAIL-MSGID: =?utf-8?q?1747574328972445864?= 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 734cc646ce35..8b884cd3a232 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -565,6 +565,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) \ @@ -577,7 +581,6 @@ struct ata_bmdma_prd { #define ata_id_cdb_intr(id) (((id)[ATA_ID_CONFIG] & 0x60) == 0x20) #define ata_id_has_da(id) ((id)[ATA_ID_SATA_CAPABILITY_2] & (1 << 4)) -#define ata_id_has_devslp(id) ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8)) #define ata_id_has_ncq_autosense(id) \ ((id)[ATA_ID_FEATURE_SUPP] & (1 << 7)) From patchwork Mon Oct 24 11:30: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: 8951 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp435832wru; Mon, 24 Oct 2022 05:55:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7hpQIUoJ9+rmct3y7w/byJKwy2z5oUZz77QjwkudKbcUZ48GsOKbh2WngpK6gO6JiremCh X-Received: by 2002:a05:6a00:2384:b0:566:813c:ae24 with SMTP id f4-20020a056a00238400b00566813cae24mr33533670pfc.17.1666616139124; Mon, 24 Oct 2022 05:55:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616139; cv=none; d=google.com; s=arc-20160816; b=Leq+j2v8kUO1UZ4loAtrq01kSz6BoyVGrqKMG7/6IVLFzYLe8bD+Khg8++/kfhJ93O w50yS+h27hDdJchzurYMK6ELWb/G0nkHs5GApPAj/I+GXmYRFylK7CGkDmBAAt8nssHb DvDNJfXl3e4yzgXEwk7RKi0FFreJiLUpOL4GV7y7cLxlhsOW+8uiRUe3z0HAYCbABJEk K8iZIyn8YMVJtRtG2T2JeefX+kHOJgZqITseDcL0uJZ+x9xd0AUiBS1HMCbb2lIaYYC4 2Xu8GIZaX5c+U79rO6RtZquDJFte4FCoSZPc3bH7ZDuj56/G1q3e094S2z/Kr+36MT7G +YyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8SmK+dC9X1WKK6XBB5logJ8chux93+70D0FuD7TFs2E=; b=TdJIKUsESsyHhvfcR59rWQqP9REZ0qouLcSeBo8BP3QE78bV+BHkDhbVXRZj26kbBR MUmJKR3cfCfAVOfHzyU92QRvktpx3nJGfjyMEyE2cy4xWYWxclPa+tvWUeq38K/eamMe dYyXW+3zRUIiCnL0FHsEOtjmpXKm9+5j3fZmqjBvwtFdiLMV+A2XgktjCrcFQycBvRbJ 2w8zOoG4oaxfWnjqiq03BGXak5SUFSFhhe+EkrvLMzTFkbnK+ME/rWN9GcJcHKqNBj2K sSThp7fKMsXb/YDPegWhKtKbpEj52TM3IthtVHRlCtxgNfeKTmCDyrMzCCEi/fDwNFOm NmGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cKiRExH+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a63495c000000b0045a73a1790asi35385799pgk.613.2022.10.24.05.55.26; Mon, 24 Oct 2022 05:55: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=cKiRExH+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234740AbiJXMxa (ORCPT + 99 others); Mon, 24 Oct 2022 08:53:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234574AbiJXMvq (ORCPT ); Mon, 24 Oct 2022 08:51:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B22DF92CF0; Mon, 24 Oct 2022 05:14: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 80A58612B7; Mon, 24 Oct 2022 12:10:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95DDFC433D7; Mon, 24 Oct 2022 12:10:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613456; bh=xPThxkg/kWjmznk8UoQBVXx8Q5wQiDakS3AeMMjacOk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cKiRExH+c8P+GI5RbgRHuDtSnctmsIbHZzNaTjwUX6PvjZns5zzI+wm1D9ILgOxVP q4XwgljO8iB3JREZV9DVnKivfnsjxNyTpdH2CJMUSjrDT6OvrowovxBKvjP7B0AUYS W3Q9zYeGIhnZbfhm2caG+fhpsL1l68iZOOLldhio= 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.4 143/255] ata: fix ata_id_has_ncq_autosense() Date: Mon, 24 Oct 2022 13:30:53 +0200 Message-Id: <20221024113007.361630001@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573684321985494?= X-GMAIL-MSGID: =?utf-8?q?1747573684321985494?= 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 8b884cd3a232..94f7872da983 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -569,6 +569,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) \ @@ -581,8 +585,6 @@ struct ata_bmdma_prd { #define ata_id_cdb_intr(id) (((id)[ATA_ID_CONFIG] & 0x60) == 0x20) #define ata_id_has_da(id) ((id)[ATA_ID_SATA_CAPABILITY_2] & (1 << 4)) -#define ata_id_has_ncq_autosense(id) \ - ((id)[ATA_ID_FEATURE_SUPP] & (1 << 7)) static inline bool ata_id_has_hipm(const u16 *id) { From patchwork Mon Oct 24 11:30: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: 9748 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp549055wru; Mon, 24 Oct 2022 09:43:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5l3DMWnJKlJ/xI07UiEkOWddcSnTfAh/nH8ZY346HSvvqXptjhJ9ZHynROVplXc3T/i3iN X-Received: by 2002:a17:902:9888:b0:186:9c32:79ca with SMTP id s8-20020a170902988800b001869c3279camr9063851plp.17.1666629787466; Mon, 24 Oct 2022 09:43:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629787; cv=none; d=google.com; s=arc-20160816; b=fJ+Cq+0iCbu92xq8++JM/nVhc0m36NQhXywJUFVseIkHSVfTf1X2BTAnF61wQmN0Xb f8+4+XctAJT7W0Sd0f11ITH9u6KZpD5zCYUTofyCfQawflW4jyBEnIhKWilYdPy6XKJX HUGka2I3lgTNG7gIweamo5bkst2XGPpssZe+qQllICjD1ypFPxVeqESplVRLcIiowJSJ EsmrNScyBDl3pM7aOg5I6qwhl59AUS92E3R6pYlQs+3e/sxiEZkR1geHt65B+MOSIGDi ah52xhpSyniNASScRIFC8jgse3vP01FMv6e/SkrmE6R24urJJkrtQ+SuBGRRac1tGpG4 E75w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=endudesdeCslzZM35c/XaU7ehPAwoU3maBwUzSyBauE=; b=iz3EymutYL1FLK0gtCJ3PS2Ydz2tYaSD3AyvQgYY3ZMf7KSyvOiA2JkIr0MwxnB0Gr LxJbll1wT130g8MuljyW3ZTu4MpzeJR/sE9R3qovk13jnbYezYqVFcGqhAbB09u6CbG+ C78DUBtvq3qqS8jqon9JtOL48WrgaoK6lY5tk/cb5mnr2PLKgyP/vJ0wF9ReMDq0pfCz zMXNI6iRlgcTYIYir4wxMuTYEaGclpIIaoarUyZNJRFSW160w4pfDa6Dza8il/GMtvEW aF7a7OwmFjrkUDLzlSoIw+h7IQeGnTodQWRio1AbF7qVc8Oyn1hsbyshQCjS2a43G4Ga V20Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LjyNu7Og; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t2-20020a632d02000000b004615836deeasi38310527pgt.860.2022.10.24.09.42.54; Mon, 24 Oct 2022 09:43: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=LjyNu7Og; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234451AbiJXQm2 (ORCPT + 99 others); Mon, 24 Oct 2022 12:42:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234434AbiJXQli (ORCPT ); Mon, 24 Oct 2022 12:41:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23D30786E2; Mon, 24 Oct 2022 08:28: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 E3B84B815BE; Mon, 24 Oct 2022 12:10:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FE50C433D6; Mon, 24 Oct 2022 12:10:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613458; bh=2vgZYrGdBLmeat8hb0agASqFn5UrbCmTTg2/geDVt9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LjyNu7OgkMs1wFPQFFN4OSTPKONi+bVwWP7QUqSwMqzmPELVtDmXtCxmKhGxPGKV8 TeizQRkPdrBjob7o6LMy6bUKKj1SI8HARVy20KTFHTe9HShbC9U/sZ5vxZDKChxy5K XumnNN/RSD2AU4YW0FGCpAMODpZbE8f0CzAzDrGM= 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.4 144/255] ata: fix ata_id_has_dipm() Date: Mon, 24 Oct 2022 13:30:54 +0200 Message-Id: <20221024113007.408141071@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587995717012884?= X-GMAIL-MSGID: =?utf-8?q?1747587995717012884?= 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 94f7872da983..6d2d31b03b4d 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -573,6 +573,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) \ @@ -596,17 +600,6 @@ static inline bool ata_id_has_hipm(const u16 *id) return val & (1 << 9); } -static inline bool ata_id_has_dipm(const u16 *id) -{ - u16 val = id[ATA_ID_FEATURE_SUPP]; - - if (val == 0 || val == 0xffff) - return false; - - return val & (1 << 3); -} - - static inline bool ata_id_has_fua(const u16 *id) { if ((id[ATA_ID_CFSSE] & 0xC000) != 0x4000) From patchwork Mon Oct 24 11:30: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: 9073 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp445152wru; Mon, 24 Oct 2022 06:12:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5S8eKCWOgWN7eah5NTdv3kP2HxaDcTIwZOcWOQn892CGFYJuMPS2p5M8gcZb+Lfd9ZF00h X-Received: by 2002:a63:5a26:0:b0:463:7ca2:653b with SMTP id o38-20020a635a26000000b004637ca2653bmr28644159pgb.352.1666617130833; Mon, 24 Oct 2022 06:12:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617130; cv=none; d=google.com; s=arc-20160816; b=XXEO68pcXXK8Xoxs3iGsld+lTT2Ddt97MfD1IycLOHx9owRlCwhYMnstjVWdRNkkYU MxiV1O54quNNuDkUoMwCfuyW5+T1TuqLsdn6nnttspDOm3S/oOUZLNvwdh7jgtXZv9Tl XBtcQyUa8a+Vuk6Zj5Fto1hPzxXgbM5S9+XfOdZniIGeFOdRNvM0cqgA2QoCaZnKxp1Y OQRkJCnkzPlZPZnfPX8zAFY/FJ4GAWhHVPiEi94jNVmMlA7MEm3BD+QOSgVMf/f/5uSF pL8NOG3VMu3nfCTz4jDe0ZvckR2rLoadpdxvN1eksivft/t+SN57F8YcY88pmw33TlGM CXag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PbFYwv7wkS925NNqdtkFPQRaDcfPese6Q58u8KJgPBI=; b=e1wAGRIUeLyIvoVvLtBHu0neWTalCgvJ5IK3xcEOA/crU4Sq+pTQEzJtQl49YV/vVT 6oMlFkpmO3aXHQSv3GN95bITU5CwtT51yUOr0P/84I4ObOR8DW8VnysI5L3xEDSnY/oz koGf4Rl4j1WymWU6FveTCShB+MKlm0/3+qYU5kmMs/s2/Yj4ZvAT20wXn5ZFswLWQ3T+ Gz5nFb5O+K+UEUpRSKL1OPQ/bkex4XhJ4o0NZiAxcvO8+8uHmJEHqXoNoZCDM4YrMftY 33mYK7xdHdT15aTLh/ct1uwaM0LvQ9R0/xK/diYRFNisMQN+K2jpyQsYLpgHtX6fhP0y o0HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nIEXaxKv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q7-20020a17090311c700b0018128753b2bsi43599051plh.437.2022.10.24.06.11.54; Mon, 24 Oct 2022 06:12: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=nIEXaxKv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235604AbiJXNLe (ORCPT + 99 others); Mon, 24 Oct 2022 09:11:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235572AbiJXNJD (ORCPT ); Mon, 24 Oct 2022 09:09: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 DCB299F367; Mon, 24 Oct 2022 05:22: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 83509B815B3; Mon, 24 Oct 2022 12:11:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D884EC433C1; Mon, 24 Oct 2022 12:11:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613461; bh=5gRo8IX02SsCQBABh41eIAqNTl+yzSyxn8vl9XNFPkU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nIEXaxKv4lGWbcNS1eOuc9iqurLvwsK+nhlhDXTCIWEnT+Henla8f/UgPxlXOc7Vr OVOatDsoYUQpSPJf5uLgB6RTJ+RqrSD6hFkt5bDw8ERXjv+Y/KpJlgMVbDNTX8V2lz 95S1d3xspAgxDyKcLgi//VW09GVpieFinn9m9G9g= 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.4 145/255] mtd: rawnand: meson: fix bit map use in meson_nfc_ecc_correct() Date: Mon, 24 Oct 2022 13:30:55 +0200 Message-Id: <20221024113007.441345681@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574724310891350?= X-GMAIL-MSGID: =?utf-8?q?1747574724310891350?= 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 28dc26e1a20a..a65aadb54af6 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 Mon Oct 24 11:30:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9810 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp554920wru; Mon, 24 Oct 2022 09:58:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7XUmSWuFdsNeJREMt2tNIPDnpRZ7ywJCv5e4b2TOLr9oy9QdUjwaZWu5TEogqNx6btzOFo X-Received: by 2002:a17:902:860a:b0:186:7eab:afa2 with SMTP id f10-20020a170902860a00b001867eabafa2mr17062256plo.46.1666630707177; Mon, 24 Oct 2022 09:58:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630707; cv=none; d=google.com; s=arc-20160816; b=qBzEFb13utRrE7qvumsQ07f7pHM03ksMy4AGAciucCOiZ4het0F9W5tJpRJuWd0fbL CqEw1ArS4ucuNI6TdFSnceopg6pgb/zpJipBy8eJCfP8h5ALfGbzqlkAfrONLO0f/vba crj0KMNQJYwWL24twkY9cobTBUcGdO0QPEztLiZOuARvxspA0DDs/2ihww6QkS9KCync F/7UxvuEKatWEM5qulaRHqZg6kR14Cxc8Y8UVTiRdMfZxzRjDzfrSKWw4uP4QEMe4j/R j+UtePcMDXuR9TLK8eDm7u0/40Tq+GV2/Zh5f19k9hACfEl/X2nSnFZMvs5k76BqsuHe Wtgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vcK4M4YiyIFOf+wZFwmwMFQf3g4okF8w/+i4hOBpfSw=; b=0FerzHOdGeN3MPki4V76/bZb9An/bylMIbBftDwaeW47wtNES6XmG5KZkio31sO10m Y6Yewyp/07YjcUXe7nIGp89XSoXJOVM+U0elTkZbk1tpYTHXK52fpNidogaS/YH/7zDu dMU7N6heITgkUBNDh7mQCxZ4goo8NbA5dIa50DtfQu5iOHQBh0K2/tBzDrVXmyExPuYe T1ngElf3O7qN5OxkCnP2CCksezdhLb9buWDNhxGOYDkehs8JsDDrN+R4JoNXdgx4nwSy sBXHb35kT9HlgBr6Sb3oMbDybCBXDxTORazUVRSOzoOuSYZY+zLfdBmYVoQ3KEPJEpuU 0Mkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=P0ur2b5A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a63ac56000000b0046f13b048b6si13930pgn.168.2022.10.24.09.58.03; Mon, 24 Oct 2022 09: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=P0ur2b5A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234147AbiJXQwu (ORCPT + 99 others); Mon, 24 Oct 2022 12:52:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235275AbiJXQtV (ORCPT ); Mon, 24 Oct 2022 12:49: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 52A7A170DD2; Mon, 24 Oct 2022 08:32: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 2994DB815C3; Mon, 24 Oct 2022 12:11:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77638C433C1; Mon, 24 Oct 2022 12:11:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613463; bh=aWsSx6tS4BASewcQgz+ogKnVR4asshbALXf6ZioxJWs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P0ur2b5AA2sQZ6F0Y5pJxHuQUnB35pyyO4uxFFKaeFelSTqfr5JzUmL6R+TZFNCLj 2OhaUvHf5ganfNsrEMBDhCW7Pe/q/hMjueU2L4DJuAldBiz22jLu8LrJlyJMm2vgOl Wu8PgIkePKO+CSGzXsNZNptYeG1tY2tAdVfZ5zUA= 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.4 146/255] md/raid5: Ensure stripe_fill happens on non-read IO with journal Date: Mon, 24 Oct 2022 13:30:56 +0200 Message-Id: <20221024113007.480134270@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747588960103505998?= X-GMAIL-MSGID: =?utf-8?q?1747588960103505998?= 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 fe99e8cdc026..a7753e859ea9 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -3728,7 +3728,7 @@ static void handle_stripe_fill(struct stripe_head *sh, * back cache (prexor with orig_page, and then xor with * page) in the read path */ - if (s->injournal && s->failed) { + if (s->to_read && s->injournal && s->failed) { if (test_bit(STRIPE_R5C_CACHING, &sh->state)) r5c_make_stripe_write_out(sh); goto out; From patchwork Mon Oct 24 11:30:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9088 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp445919wru; Mon, 24 Oct 2022 06:13:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7qWGS6qv6d5Y1JArijoImhrGMkE0e5D3ryxeZBQYr0zFqkoQ+SysOECfa6+L4XV+YTUyPx X-Received: by 2002:a17:90a:ad08:b0:212:d5f1:e0c6 with SMTP id r8-20020a17090aad0800b00212d5f1e0c6mr17609407pjq.228.1666617202446; Mon, 24 Oct 2022 06:13:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617202; cv=none; d=google.com; s=arc-20160816; b=LfA9FtKm5Z1GIO/knXTS1PA7KzfwGaQpus9fcezJZpvvWu9GeAA0wY8+KgoKyBIuxT u5ka/z7wjG3E+rh2OfanRpoTVA8DiPWcCivAMU8UxL2BzjAbimha5PPimTNO0p/34f2z 04n6zo1BAB9cu5COo013ZSeXj0ThTL4Ev997+GNa8QccjuE6pQIgKhonLO5ictTYrHwq 5XTMLw5fY8SgyyY70NxtnTYyMHq92csFDoOnDvEpUwiSdvA5inL7lTh2aCLLw0hmgsMh 69Sls/NXRALsxa89s2xllTGFrLxygvjnoHYEN+q2AXLSJE1cMIQ9F7nExmTrvddZUgtV i/pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/j5My3S8WCkPEDEaAu3Eo4fr07LyLJWFJAMAGer6+0s=; b=Dhw4TXFbweSskf0Ly2tcDXp6t/1h6wRmXn5+7Du5rWUR/XzTBHQK4AQXkFlfFUtk7D kGK+CozmhOp0iZLdI2DfoNziEAei2+srKSOdgNgLbWB+l7lM+gur4zpPoAjK1At7A6Q6 P5fQD69O0pNS9+CBGPS1Dlcj2UiFFoCxfvMJeDH06hIF/q/l9wUmf/jqVyiO4eMUo7KV T99dabj1QwCQVZa2njWnENtzBVBjoy4AwatbmstBWu1rSbSfBG/EXQ36jrPSUCfsxXjv o2nZi6q6kXcd19qWCamS9cC0X0OX3Oq8KhkheXPSRmz5blQpcsndMZyr/ojDpvDCBHZv M6oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rfWeT9cq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090a940700b00205f9df1f32si15033609pjo.25.2022.10.24.06.13.07; Mon, 24 Oct 2022 06:13: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=rfWeT9cq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235759AbiJXNMr (ORCPT + 99 others); Mon, 24 Oct 2022 09:12:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235978AbiJXNKT (ORCPT ); Mon, 24 Oct 2022 09:10:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50D43233AB; Mon, 24 Oct 2022 05:24: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 05E76612BC; Mon, 24 Oct 2022 12:11:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14E23C433D6; Mon, 24 Oct 2022 12:11:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613466; bh=1/qEl5ij5KZbVIEpccmHs7XOPhQhjB56i1GxS68K0+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rfWeT9cqpRfPy7i07wTcw0Rf16zYr5QIp921rgfGdGcKl1D0ZO+fLF4GgwPAj8f9p 8xtj8Oe3hMCUur/K4sJXi2Z1raQ8Ii43/rZUYBWaYBdBXTCmbW/CM/zw/VJbsA+TSb dqLuLQfYOFrcCrXKowy20ZXwe/G5AUmhsBFjIlRc= 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.4 147/255] xhci: Dont show warning for reinit on known broken suspend Date: Mon, 24 Oct 2022 13:30:57 +0200 Message-Id: <20221024113007.509934646@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574799909104863?= X-GMAIL-MSGID: =?utf-8?q?1747574799909104863?= 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 5ce16a259e61..3537113f006f 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -1163,7 +1163,8 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) /* re-initialize the HC on Restore Error, or Host Controller Error */ if (temp & (STS_SRE | STS_HCE)) { reinit_xhc = true; - xhci_warn(xhci, "xHC error in resume, USBSTS 0x%x, Reinit\n", temp); + if (!xhci->broken_suspend) + xhci_warn(xhci, "xHC error in resume, USBSTS 0x%x, Reinit\n", temp); } if (reinit_xhc) { From patchwork Mon Oct 24 11:30:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9248 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp461287wru; Mon, 24 Oct 2022 06:43:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7LJLeMG7lpKJRktrlv/8asSNdbwX23h0gw5EaE9ZB874kNVd9dNVXu04bgUZYTbXCq5UFJ X-Received: by 2002:a17:907:6e09:b0:78d:a326:49c6 with SMTP id sd9-20020a1709076e0900b0078da32649c6mr27203707ejc.507.1666619014130; Mon, 24 Oct 2022 06:43:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619014; cv=none; d=google.com; s=arc-20160816; b=lqbjFzI6q3BgTI93FY7RbA5ytFIy0hCQHf+X1zBGPPlVogDWkGzQzZrv8HtfiNU+xx 7EkoL5xWfpM4BNrxpSmS6w6iqxa0MxphjMl16fF7XUg2F0U6JA6wpj22deJhi7Jmmeip 6S6kHe560mi7yN/WqN9Y+QBaNurddmh9w6T824ngK2PRZa3Q/52V+TXrdkEkMjkE+2qT ULUQ0lXPPja1oQjs2l3ElU4b7kabCjPqbSO5yLC8xnp5qlRd93EoBx3YMMXHqbQz8+Kq JeGr7qQ2h6zF+gxj4O6E+jLD7oiiAnZzUmEBXCJa6nfSMnDia1VjjplhVN5HiGMgm1m2 GvDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6mvQY2Q8JHJnrTgCD4CXvbtWrnxMW+ygr2dJrEEVEBA=; b=pgWZWCNl5aR8MqS0sXgGIrBMuxAitfhWYNXPvEZa+LY9sWe4RCXKC4Lk9PkmLpngwq PvdTUSr7h4VkIZ3HDg2/22rthzAWTHridLZp4VyhedgXD8tnso8uVvMA1cO2sE2aBNAW dc6j88It550QfoSGrE1SKdti0piwcHWUAlGUTgSXteLPa8TE/l+E4x2RV35GB9kCvD8v M3qRx6l4vQCjxzmHiqEX8nbaccMaVJIRqTsDKWpOCu1gAjv/wtp70oOhmOLqDJX/qfxV UhYEbwcKkrL8sEGyeHfmQ3PqT4GrU/Rhmu9IVuxzCu6rrZdX+zcC8gW96Mp85vkXLIAs p7mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sP64IM20; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a50c382000000b0045729070194si27937322edf.517.2022.10.24.06.43.10; Mon, 24 Oct 2022 06: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=sP64IM20; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236072AbiJXNej (ORCPT + 99 others); Mon, 24 Oct 2022 09:34:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236227AbiJXNaH (ORCPT ); Mon, 24 Oct 2022 09:30:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED9F51742A; Mon, 24 Oct 2022 05:33:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9812C612F4; Mon, 24 Oct 2022 12:11:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A91CDC433C1; Mon, 24 Oct 2022 12:11:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613469; bh=ZFD043lCmEwcZ86aV03p+0CQjj0aQci3UHQTAIeDJbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sP64IM20DXQUyhSwZtH4CkCOd0WzgaZ1hvGiLIL4izfOtHPYm8mnIIE1nEOA6UF0w NnMl3DNmri7VeBRRXt+TA//3hwDYkL60oRP/zGiejwZoa+cwbio0dC30+hlwwv4j5P lWmC8dz0d3150y4azGT+PoOaXilgLqLpkPkqi3JI= 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.4 148/255] usb: gadget: function: fix dangling pnp_string in f_printer.c Date: Mon, 24 Oct 2022 13:30:58 +0200 Message-Id: <20221024113007.539350666@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576699121122240?= X-GMAIL-MSGID: =?utf-8?q?1747576699121122240?= From: Albert Briscoe [ Upstream commit 24b7ba2f88e04800b54d462f376512e8c41b8a3c ] When opts->pnp_string is changed with configfs, new memory is allocated for the string. It does not, however, update dev->pnp_string, even though the memory is freed. When rquesting the string, the host then gets old or corrupted data rather than the new string. The ieee 1284 id string should be allowed to change while the device is connected. The bug was introduced in commit fdc01cc286be ("usb: gadget: printer: Remove pnp_string static buffer"), which changed opts->pnp_string from a char[] to a char*. This patch changes dev->pnp_string from a char* to a char** pointing to opts->pnp_string. Fixes: fdc01cc286be ("usb: gadget: printer: Remove pnp_string static buffer") Signed-off-by: Albert Briscoe Link: https://lore.kernel.org/r/20220911223753.20417-1-albertsbriscoe@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/gadget/function/f_printer.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/usb/gadget/function/f_printer.c b/drivers/usb/gadget/function/f_printer.c index 2a1868b2d24c..dd5eb6202fe1 100644 --- a/drivers/usb/gadget/function/f_printer.c +++ b/drivers/usb/gadget/function/f_printer.c @@ -87,7 +87,7 @@ struct printer_dev { u8 printer_cdev_open; wait_queue_head_t wait; unsigned q_len; - char *pnp_string; /* We don't own memory! */ + char **pnp_string; /* We don't own memory! */ struct usb_function function; }; @@ -963,16 +963,16 @@ static int printer_func_setup(struct usb_function *f, if ((wIndex>>8) != dev->interface) break; - if (!dev->pnp_string) { + if (!*dev->pnp_string) { value = 0; break; } - value = strlen(dev->pnp_string); + value = strlen(*dev->pnp_string); buf[0] = (value >> 8) & 0xFF; buf[1] = value & 0xFF; - memcpy(buf + 2, dev->pnp_string, value); + memcpy(buf + 2, *dev->pnp_string, value); DBG(dev, "1284 PNP String: %x %s\n", value, - dev->pnp_string); + *dev->pnp_string); break; case GET_PORT_STATUS: /* Get Port Status */ @@ -1435,7 +1435,7 @@ static struct usb_function *gprinter_alloc(struct usb_function_instance *fi) kref_init(&dev->kref); ++opts->refcnt; dev->minor = opts->minor; - dev->pnp_string = opts->pnp_string; + dev->pnp_string = &opts->pnp_string; dev->q_len = opts->q_len; mutex_unlock(&opts->lock); From patchwork Mon Oct 24 11:30:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8941 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp435178wru; Mon, 24 Oct 2022 05:53:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7g4nQBBP7xLU6fA1jgfmDItRhDkh4QHNx63VqaWV2Ba1ebj5Y3X8OcWkOBWBgpFgzHfHwZ X-Received: by 2002:a17:907:7f1c:b0:78d:ddc7:dfb1 with SMTP id qf28-20020a1709077f1c00b0078dddc7dfb1mr28277069ejc.189.1666616025475; Mon, 24 Oct 2022 05:53:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616025; cv=none; d=google.com; s=arc-20160816; b=BZYlNVIoy8vBvKw+ABcnhJg/Ew2Gibzgyt31SLLo0WG8/YfJQbLskGAs06aqa9NCab 6H4Fbv5DKPkkjxCvECySNRe0DzNnLTmwSynmsV+6FrWWsuDNh3vu8aVYa7faZyJ9qOsh 05Ep/zsIkGqqbqf8HwB8AiwEDioqIL/yowS2Z0SBf6Yt7AeFvKBv9yUiRSY+w8Jbs1iG 1SdNOIOPUi144QnDtNgUTaIZhQeqWRifHqtuxAGnKxZA2PL1ivgxrK/h3j2l1lFvDEAS 6aLWw/gZcjFyqFELWKIHYCd/emQrpwiXUlu5pv5ijcMSBGNMWnkhEZWHvMStfJZV5sSS mleA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=x7gSp2HSRdjoYghO2cgua/liE+dvyKeoWzhmuAomQwk=; b=EVra0KTdWx+r1Y42i2YopUzFnPrq76RphGJ0dBpXRXUej3PQZfbdMMor2n9MGpeLMh w7WayEwz6FAU96WvtLegtGrx4jLqOL+vxcAnONFafZP21Ovjkg631sFULPYXklG1P4OR /Rv7X1jCOmV72z94jMGZp9LU2rZDLNiBml6h3VYv4UMLn+j+Yy0GmcMTpj5p9Iu145wn tzqKvKp9vYT6DNeh3T/PK4whvAeXNHY12Jcn6iH+3qDM8lEpBfO7suXOdhl7Tgu4/HSS RLj4aoD7iHn3pmQdaVln55iq/k/NGbyG2DXbWgKbO7Fj36WhbFGXXjjRWzXRauCaE+62 4OiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LBBuclyt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i19-20020a05640242d300b0045bd55b122fsi34170864edc.57.2022.10.24.05.53.20; Mon, 24 Oct 2022 05:53: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=LBBuclyt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234658AbiJXMwb (ORCPT + 99 others); Mon, 24 Oct 2022 08:52:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232287AbiJXMrs (ORCPT ); Mon, 24 Oct 2022 08:47: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 908469184B; Mon, 24 Oct 2022 05: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 dfw.source.kernel.org (Postfix) with ESMTPS id 3904D61252; Mon, 24 Oct 2022 12:11:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D07AC433C1; Mon, 24 Oct 2022 12:11:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613471; bh=NwiRgoGNNgwSk51Vc6rEQuhFQM5Y9IwYt/EDlaVrrCg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LBBuclyt0fxruzcZQH7fW6R0THoP7BGCDRiPn4KccOlbTW12Y0jflcyXUDdRxdOgh xwV04EsaJVCvQVpAmar7TjIJ0blws+TKedyKTnKHSwSrQeL7HYZuBoSrErNpXMEFJw iQ0Jw8kGU8ZIriyiYiiYMHtkS/5wYMdxRo5G9dUQ= 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.4 149/255] drivers: serial: jsm: fix some leaks in probe Date: Mon, 24 Oct 2022 13:30:59 +0200 Message-Id: <20221024113007.570051825@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573565423794328?= X-GMAIL-MSGID: =?utf-8?q?1747573565423794328?= From: Dan Carpenter [ Upstream commit 1d5859ef229e381f4db38dce8ed58e4bf862006b ] This error path needs to unwind instead of just returning directly. Fixes: 03a8482c17dd ("drivers: serial: jsm: Enable support for Digi Classic adapters") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/YyxFh1+lOeZ9WfKO@kili Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/jsm/jsm_driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/jsm/jsm_driver.c b/drivers/tty/serial/jsm/jsm_driver.c index 592e51d8944e..07e9be9865c7 100644 --- a/drivers/tty/serial/jsm/jsm_driver.c +++ b/drivers/tty/serial/jsm/jsm_driver.c @@ -212,7 +212,8 @@ static int jsm_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent) break; default: - return -ENXIO; + rc = -ENXIO; + goto out_kfree_brd; } rc = request_irq(brd->irq, brd->bd_ops->intr, IRQF_SHARED, "JSM", brd); From patchwork Mon Oct 24 11:31:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9277 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp462676wru; Mon, 24 Oct 2022 06:46:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6/rhLSoD9lxGm+U6eepkrdOJ/VnZM5TC7RIcO7yioLmDGyIVV0K6ecdmkI04rCaRPdUGHa X-Received: by 2002:a05:6402:35d6:b0:45d:a52f:2d30 with SMTP id z22-20020a05640235d600b0045da52f2d30mr29969865edc.4.1666619182279; Mon, 24 Oct 2022 06:46:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619182; cv=none; d=google.com; s=arc-20160816; b=sjIfAE8TU+7r16pjlg+igbEK3lkxSyrQ6CDxlBCGCH+IwJK9owaGdXltnz5pwt9X9g IhrlZOrKkECbiw4Xn0cXRBeKDb1T+YHsueMHCadRki/0DtiHBrjDyxo919qxpNpmDT1p cZbHby34XKTdJLBR1M6SnwQZSd/49bLgLceDQoW4Bu5gr6p/1goe3xLH6VDu7k4NFXy5 pxciemyGTLs2yHWYsa8IarMt09ImoqNFW4gy1L59lQEHZhNBFCPZc6tXOzpRTVN71UNk vS/ZdMPvTQX/Gk2MUqgtVHCCjMpeTzZ1IhqNZCsH0Q/x+9jR1lUi+b3iB9ORjZqOKcAu 5org== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=grz/i0/Bz5NqWzOLSgLsupKABKsN3n3UQZytXSO5ZLA=; b=Y8IDq87PrdDuAK5NA/HvkzjBaSSJ5mjP3gu5x9HlNU8Yl8Fj3ZWm7VuftUPZYIlDww q+1124c3rmiQxznIDI3P1UK8kqYrYr7Sg5I0457mrifb+UAu6g6ioVbzQMDfc+1RMHpH i+v6fKQLBdsu07B0GE95tgpRBJ2wZ3xUxS5LhyW54FJAD9Eb48iBytNo5WLtYh/iNedl vmqMW9kq6ZLzvCnh9AJy5HHDHMjhyVjnGCzoC6EI8MEX2bD4qtDCuLKgNsBLbRZtraFB 5Ltw9Jv2RwBtggX1iDvEonYdXj/aZuojOLT20MYfxNzG+1BQzdl9PEm2q0Ly/6Uj2Mp/ +oJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TXlV2lKv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id et15-20020a056402378f00b004607378ae65si13061982edb.160.2022.10.24.06.45.58; Mon, 24 Oct 2022 06:46: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=TXlV2lKv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236514AbiJXNoV (ORCPT + 99 others); Mon, 24 Oct 2022 09:44:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236745AbiJXNlL (ORCPT ); Mon, 24 Oct 2022 09:41:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAE287CE38; Mon, 24 Oct 2022 05:38: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 6E232612B1; Mon, 24 Oct 2022 12:11:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 801DAC433D6; Mon, 24 Oct 2022 12:11:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613476; bh=n48JiY1HehSvPZQZr4+8YYzAFPNrvieuLfh/2ghY9Q4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TXlV2lKvRk/93DATtlYwEDZ5UxNyqZ90rhcwIG2WvVtlCI5oOIBhk7tt8omJhvSTf 5aIdG/ozMHpzci8dUlcuaig7jvv42hn8Why+sHX5/nDWguswvwdknbv6JOV9XT3MP9 twoYzxuSzu/DOnLcoIXEg/OOy3ytDsb9t6fKI4pE= 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.4 150/255] tty: serial: fsl_lpuart: disable dma rx/tx use flags in lpuart_dma_shutdown Date: Mon, 24 Oct 2022 13:31:00 +0200 Message-Id: <20221024113007.609028983@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576875476325280?= X-GMAIL-MSGID: =?utf-8?q?1747576875476325280?= 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 f3f582c3dc87..e84cef42f4b7 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -1593,6 +1593,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) { @@ -1601,6 +1602,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; } } From patchwork Mon Oct 24 11:31:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10241 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp643337wru; Mon, 24 Oct 2022 13:41:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7tGAsWfS6a30aievtO3KVcLbXZgQ+44S+vTAmxiSfQLp5Mbyf5T4i5gkAH6RLHdZzRYkoN X-Received: by 2002:a63:1c47:0:b0:44c:2476:12ff with SMTP id c7-20020a631c47000000b0044c247612ffmr30697272pgm.50.1666644077263; Mon, 24 Oct 2022 13:41:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666644077; cv=none; d=google.com; s=arc-20160816; b=AijjOh2MeaOsx4GrnXxrJXYgfy9ovNT6sMPyMPVyZPfWF8mC1advx9d05ePCHuC9S0 bQ3m4OvW2TLxHJpcOxHnfJwP1m00UOOtwqHSRRlOUg6kLO4cuEqDUNiY3DsBJxM9zVEv v8/jILX4ZscDS0IOu7BXvjtZpaW0NV+RZYJsCneTBMIWkuzwjQ+bbtKVNqs4DtMgR7OI 7vTZfXWXTWPkhH6XrxESCJryKsiILv5Z88UxqQ7RRop+l51LVuFynklsrnF9fGqA4Fyh yi+uVBE/jOt/CazLCs1rQ7tku0Ov2Jm5QEpRGZgmd30zBhB+tWcdXCiWLJ+fUSd4h9zo 8qaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=b2LrdPslTpSR+a4NoDv8cr21N1Dh60AfYOqXbgR7nX8=; b=OVCDGGDI0NdCPSBtkTaKbUY65SPjSk3eNVk/tuGkE7o9jO1IPEOBSmE1+Z7xcBnGXo /5TT60OFdaFd4Fh11/nlUR6jGdKIMO+doZjUrndNaXHVF7Sp6U8fqTL3O2UtCvnTEs4+ 2c6EDMlVwqSEPEuiFwWUAontnZevMUTh6iSvYXmp6MWrvwTG7yCsm8Thst/NksW89QH8 UyWXUxtlRdUT8s8oKHGIJidAvEAQyO1sAP45o7ciA68Y4A9mTDO2sq8pGksJAqnnx8xq A67ze+dYJtWonJg+kVYdWLRxFBfGNI8H6wRZBIT6tPSYiY5dPlDzZ7X0qLBDTr80qhgF bIlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VeOXsCoP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902b60d00b0018695bddc45si542917pls.193.2022.10.24.13.41.04; Mon, 24 Oct 2022 13:41: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=VeOXsCoP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234756AbiJXUkh (ORCPT + 99 others); Mon, 24 Oct 2022 16:40:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234791AbiJXUjL (ORCPT ); Mon, 24 Oct 2022 16: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 20F9A2CC98; Mon, 24 Oct 2022 11:50: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 C6864B811BB; Mon, 24 Oct 2022 12:11:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C701C433C1; Mon, 24 Oct 2022 12:11:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613479; bh=npCRfkXpyD3oFS/RTYI4IZ26DGEUxTCME7Uv6lz4OjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VeOXsCoPVaiJmfVNVAeAlwmXsIGm6IZk48PCNHF9m95RBbpDfcqqtKXgYblTxHepf MktaIVj0Sv5LHas34Hy3tgXHr5g97CNUl+4Zl7mbUGHVWZA+M65KqonzwHu91vhbkh c7cTy+uxHfvASIo3gFYHaiTYCpP/4sm4DCupe9lY= 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.4 151/255] phy: qualcomm: call clk_disable_unprepare in the error handling Date: Mon, 24 Oct 2022 13:31:01 +0200 Message-Id: <20221024113007.653516098@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602979826059025?= X-GMAIL-MSGID: =?utf-8?q?1747602979826059025?= 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 04d18d52f700..d4741c2dbbb5 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 Mon Oct 24 11:31:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8942 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp435241wru; Mon, 24 Oct 2022 05:53:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6/x+bqEZMitcXewZyS+fSNG6Gt8CKvJnCyQiePG48Sm1MK3FkeMlyidRU5ZyBxhltUpW2z X-Received: by 2002:a17:907:75e6:b0:7a1:848:20cb with SMTP id jz6-20020a17090775e600b007a1084820cbmr10037127ejc.745.1666616035886; Mon, 24 Oct 2022 05:53:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616035; cv=none; d=google.com; s=arc-20160816; b=MvJNFOmGBVKbjbX1Rc2Q05Gvc2GgF/nkH/srxdUDILcJHC/UYMtEG5tjPq3nX1Vm9b nwSMYd6w/2YRxMRxWdR6ERfAgLTtYOdkaZz/sKKjO3LR4S+eVVtbRw2tvXgm8gkf0NLu i2OfkmOeZr2nhlfOjSFQoBl2nCBj+TheP32xyhGMurBzkfaJoZPw64OBJJapY0bQ5f5l 4HBTDc3G996QBvsDnunu+/zSBJHuPqeGUXC75WhabrRGn64+qJIHu8rVuLmQVTALwC8X Q4U/iGL/DzdPUpr7QLEmm7ePJHKdZFs6Wl7ktanm7y3L/IlwNXfp7wuv6sgnJf5zl9yC kBBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cyiouJ/lmUanYnMzeChA1KCdOYqsv5lnqmZqEDHaeaQ=; b=xFRGxOTD+x7ZytfuV3qkqpewtea9loPW4oip8cTebjI04qxwnHy/fTrU7INAEGVTwe 9Q+Kv5Lez/c4abJfOdsoGqJlnNRhom5Kr/IXqYXDQWxVFv018MwsS+4COgx38sLuhrQi mDQud/j17uYi+k3nYy08xNNcU8ewmKvOg/kqEh5ZOJzvtkqVk3i2pu6tj5UbprO+PuMR +FI21FmOCZxg7Cvq2YCPyOh2P2FF5se4BXUsdT2xMgTyUe60hqvD+Qrv5XL9sGl0TKG8 BCzYvgNfxWXQd2UryHLYyRY5KShUQyVCVM9jDQrok6jXzFTcpVUqrHdQCYS9rxIz6RqD NHxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=d5M9xYr7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t15-20020aa7d4cf000000b0045743696acbsi24160626edr.139.2022.10.24.05.53.31; Mon, 24 Oct 2022 05:53: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=d5M9xYr7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234666AbiJXMwg (ORCPT + 99 others); Mon, 24 Oct 2022 08:52:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234428AbiJXMsp (ORCPT ); Mon, 24 Oct 2022 08:48: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 6F042923C5; Mon, 24 Oct 2022 05:12: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 B73DD612BB; Mon, 24 Oct 2022 12:11:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1692C433D6; Mon, 24 Oct 2022 12:11:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613482; bh=7BBawXnclGc7VD+m7l6mAXuY6gIVYHTlLGs2AC/M8g0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d5M9xYr7hh/TZjwpuV/vsBo8+y0FfizhFHhPCfqu+s5IEXiEmALgRTvAIegtyEoh0 Iugr92MyI0QHofnfw9tP9mIUKpEI099XFe+/iGHj9jd8OIOhV9smxSYBxMxxJscvN3 TeLr7jtgfd+HGNJdJQMYGr7cpUzT6jRHdk4Kz2qI= 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.4 152/255] staging: vt6655: fix some erroneous memory clean-up loops Date: Mon, 24 Oct 2022 13:31:02 +0200 Message-Id: <20221024113007.691974379@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573576464552183?= X-GMAIL-MSGID: =?utf-8?q?1747573576464552183?= 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 082302944c37..c1f9b263129e 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -560,7 +560,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); @@ -606,7 +606,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); @@ -710,7 +710,7 @@ static int device_init_td1_ring(struct vnt_private *priv) return 0; err_free_desc: - while (--i) { + while (i--) { desc = &priv->apTD1Rings[i]; kfree(desc->td_info); } From patchwork Mon Oct 24 11:31: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: 8963 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp436766wru; Mon, 24 Oct 2022 05:58:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7/xCwHowmlHC9HCxsOrAXWfPdgTrbiUUA9ty0C9k64JFBtV59oM9PjQHQsV/no41CkaLUw X-Received: by 2002:a05:6a00:170a:b0:563:a40a:b5e1 with SMTP id h10-20020a056a00170a00b00563a40ab5e1mr33188791pfc.40.1666616286184; Mon, 24 Oct 2022 05:58:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616286; cv=none; d=google.com; s=arc-20160816; b=ZMvJOwuheENkOVs3vOis9Nlw4YCrxrWGdWAjvjQN1hGYm2UCgPUsqQ8pUakylAGXCG w4MtkDXcZEe5izqM6jtikpYEr5y6xVnBn2F9+DXG7MvL9E0WQNM8O22bzl+SV64N9iWp h/x6JtY+QFq6mn+A0FwvZYUOM3vfTYsQinDEHaoTMMR3qUQM/7/4wfEsnWwUllYyd9Ii hePLmRENgdkuQlIWZJKFu+eGlPmLrTcv7utpyaFE9nGHu96Ct/ASDadsW20l5ARaeYoB YHIcE91ddbWyDhbF1GtdO7JoIFMZeH0vi2paqLZt76pHPEeGS6LfAQs9nKe/jA3yW99y aDpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=upDPo48Tel9vCrQfd8FK34kJjZAZVEiBHXLNCDRGezM=; b=JhoHo1B67nObxxfJWIUlWE6OMy+tqYyvuBV0XXnOzutYe8I+aKEVtYfk9I4CcqOuuM 2EVK0AIrHwDYTMmEQyd8kMX0OG9w4NcYcQf1NZAcQROlY93pz9IQTTAlYuY0opoZmF1q AV3iBk2Q9H8MI6B9tyRi/BOC54Djj2S0M0Jg4QUQok91vDk5xh8Fc6qpoi0CyrTlCPLv k6n7wp/UOxkyVOyPL316Joh9x3XHYQK2jlhidfsSKr/L/yJOjTVtPQnfrwPsfO7WBToK LN/BXQM2a8j1V85004DsvR/uBbk4v6EqxqYbqa0+NTtFinnGKYDV77rCMcqu4Popg3jk 1b5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Dj11ZVh/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i2-20020a170902c94200b001867bac69cdsi12349376pla.342.2022.10.24.05.57.52; Mon, 24 Oct 2022 05:58: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="Dj11ZVh/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234846AbiJXM5Y (ORCPT + 99 others); Mon, 24 Oct 2022 08:57:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234827AbiJXM5C (ORCPT ); Mon, 24 Oct 2022 08:57:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E5FA3AB14; Mon, 24 Oct 2022 05:16: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 6D34961252; Mon, 24 Oct 2022 12:13:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 806F4C433C1; Mon, 24 Oct 2022 12:13:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613586; bh=QVxdyH9Kh0TLvy8RfnKx31BeDg9LLwu7Ai4bBHeLUhU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dj11ZVh/c2tVw3FZFfvE1QiIzoZBLuF3rsQgeFyopp44FL3vq+QECEA0NxKEgZ8lG ZVAC4mjKO3tbVePETcoXrpzDuQalN1ijMy/9F6uWFBnt9nDD7NlhPkqaibhLUkqm6a +rQKKTTpZsfa2RCfvBckf4dOGDcqF4GyHUSmWr8U= 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.4 153/255] firmware: google: Test spinlock on panic path to avoid lockups Date: Mon, 24 Oct 2022 13:31:03 +0200 Message-Id: <20221024113007.732606344@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573838617634513?= X-GMAIL-MSGID: =?utf-8?q?1747573838617634513?= 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 edaa4e5d84ad..517fb57d07d2 100644 --- a/drivers/firmware/google/gsmi.c +++ b/drivers/firmware/google/gsmi.c @@ -679,6 +679,15 @@ static struct notifier_block gsmi_die_notifier = { static int gsmi_panic_callback(struct notifier_block *nb, unsigned long reason, void *arg) { + + /* + * Panic callbacks are executed with all other CPUs stopped, + * so we must not attempt to spin waiting for gsmi_dev.lock + * to be released. + */ + if (spin_is_locked(&gsmi_dev.lock)) + return NOTIFY_DONE; + gsmi_shutdown_reason(GSMI_SHUTDOWN_PANIC); return NOTIFY_DONE; } From patchwork Mon Oct 24 11:31:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9091 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp445995wru; Mon, 24 Oct 2022 06:13:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4hrlVgPcZ7LJ0splXBOBI6ugkkwVCV+H3BWhWEv7wE5zewpauxEjnzHSSADuqrUMa8yd6H X-Received: by 2002:a63:f047:0:b0:46e:b1d4:2a68 with SMTP id s7-20020a63f047000000b0046eb1d42a68mr16879108pgj.496.1666617211146; Mon, 24 Oct 2022 06:13:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617211; cv=none; d=google.com; s=arc-20160816; b=IXtpP5VSl0svhtW8bzHn4u/nPrv+IowPJLQlSWpgdIl/K36wLcibYkYH3zS/GzMhsA oQv0mACgnr9Fx8Z6oVtrZ+qp5+raGhrDIQTAhQGVxswB9+I3n4pvnBr/sp1kBhavV5J1 ODRazmO1tXKYtqODO4rsA2123bGSqxotytFaR0nCaCImhVICIX4v9ms3utRBiAYTjYmW q3NNh0lvGKndbwXe0rxDBVnlmIy+jpsTH0o3Qfo0CMpJ95CvQJrHb6Gl5TxpCetkK3cx 1Sa4fCI9oAoJoxnhynIrRNMZIX3UVXrexbK6luyP7+lJVWkIAf5SilULEQ9XYctzkFY9 +E/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=pQ+DTvTfU54KhGo1D7FJyIK4j4vCXcRkb9Nlu/S7bvE=; b=jg1vSJLrDBb1+j4CWuftDoT/yqKBXx/S3BYvBcprorBBGaa1Kvjl4/mJwsjm/8wgx/ FOv5RZ5uM0aZNe++vj9dQ7ljTW3i1ms/8F+BExhI8m2OdfUCsjBYZHVvOCFDqzRpNLu+ K9tM9IlhieQ31DTNfZQTeavw0CA1ijgv06NCKjkJLRdWuolx8keCx1ndidKhisOg2qgh cQ1AOBJQ7/Xx8IqDCf287pTakibKt0Y5FKx1hGziGxgQpOUzjglsbJpJQpVTQXmE0aXb GtlAKJ6AxoHml5o2qVDsPqAb/QFOuL49dwN7N/yJhnSC0g/nXcQLRu35GJEAWRCd0jKy y1GA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=butk5ILD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902904400b0017f97fe774fsi7636459plz.445.2022.10.24.06.13.17; Mon, 24 Oct 2022 06:13: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=butk5ILD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235773AbiJXNM4 (ORCPT + 99 others); Mon, 24 Oct 2022 09:12:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235989AbiJXNKV (ORCPT ); Mon, 24 Oct 2022 09:10:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3999A2337; Mon, 24 Oct 2022 05:23:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 92B41612E4; Mon, 24 Oct 2022 12:11:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6AA3C433D6; Mon, 24 Oct 2022 12:11:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613503; bh=QI9wxZDgrBqPGWPZkZgZkNGHm56xUlzdIwnv5LHH7ho=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=butk5ILDT73S+ubSGXEY/U4v2Km0wyb2LRzZWswbFF4rlOKknXdtLgeA3H1c6ynba zULLkNdxD1VoVO5nXpVWcqHNpe2rNCX7GjU7iu96A10p2/AwN3a+rrC6Z2M2Ql8h4+ hmOBCarFdkNSHBy3pjZoHqxet2H4By2iBVmyHidI= 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.4 154/255] serial: 8250: Fix restoring termios speed after suspend Date: Mon, 24 Oct 2022 13:31:04 +0200 Message-Id: <20221024113007.770480129@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574808693528561?= X-GMAIL-MSGID: =?utf-8?q?1747574808693528561?= 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 f8819f72304a..c1551319684f 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -3180,8 +3180,13 @@ static void serial8250_console_restore(struct uart_8250_port *up) unsigned int baud, quot, frac = 0; termios.c_cflag = port->cons->cflag; - if (port->state->port.tty && termios.c_cflag == 0) + termios.c_ispeed = port->cons->ispeed; + termios.c_ospeed = port->cons->ospeed; + if (port->state->port.tty && termios.c_cflag == 0) { termios.c_cflag = port->state->port.tty->termios.c_cflag; + termios.c_ispeed = port->state->port.tty->termios.c_ispeed; + termios.c_ospeed = port->state->port.tty->termios.c_ospeed; + } baud = serial8250_get_baud_rate(port, &termios, NULL); quot = serial8250_get_divisor(port, baud, &frac); From patchwork Mon Oct 24 11:31: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: 10189 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp641572wru; Mon, 24 Oct 2022 13:35:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6wuLpo11PhB+37vGnw+HbXmueWG6hl71WyxePM+WvzDubExKxK3RXr77S3Ke9fXe+Y49I1 X-Received: by 2002:aa7:dc06:0:b0:461:b683:5fba with SMTP id b6-20020aa7dc06000000b00461b6835fbamr7649671edu.72.1666643738862; Mon, 24 Oct 2022 13:35:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643738; cv=none; d=google.com; s=arc-20160816; b=lAAFP8x1/7g0FUN54TWe8mTgxbfjqBVFeGh/1sRkOQugzxGeNJGf5uGkTi8Tfvlr+/ DRV/r4L2yHULdFNGL8JQBgLBx0spThARYAb9isdYLjqfQ7iriqIRa3guZM7iql/wsVny dlOHRj34QtikDTLUZh4EOr1RrDk1faVhv2PoDaAem25aFF/zbn7iXGzorWDNKx4pkJuH xfoz6hgrulkU2jHXzekijXlivF+xb1WF2vyq9u+qvF/0P/FYCdXzWGbYwmO5watoq7Of gnPYI3K/Kfzb5fROgtk/+L8/GhYjrgt5E7t7YNu0w7JEv+DDLH4J2b0+4YAwqy11bMiq gHWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OH9AgJ5YCu5niQF4ZqKJ8t8k3xgEO5t6goiDptO/IOU=; b=p+I7VKV7ninLSYSoTCj/wrH/ZPKfBefdFvhvjCeyFj5R3Yjdvw1tZUi9K3V+IJ5qqV 58on9/bg2+gl6kQXvHUTy1c9J+Jq5ucbzLsyXZwKr0Fy27mfL6kXJbUaX5iZV3G+QkfV KUp4cosHdjunBY2Y1+rYD7k9nWu6ML1LIPY3Ohvv3J54L3iSoiULKdUJKxjtpCh6a843 99zq32fwv3vYXqPcmQmYDyfkliysRyRMKV0tOoFPizsbN5nEH1yJFOwX3F5KiDannkRr ipWjvyar0zdm4u0/mihgBfSdHokrRLEvI7L6K8XGqW7l/q27F5X3SeyX/a66MBkzTws0 e6iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ciSoZHLS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hb38-20020a170907162600b0078dcdb1c9dfsi734074ejc.553.2022.10.24.13.35.13; Mon, 24 Oct 2022 13:35: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=ciSoZHLS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233054AbiJXUZP (ORCPT + 99 others); Mon, 24 Oct 2022 16:25:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233437AbiJXUXR (ORCPT ); Mon, 24 Oct 2022 16:23: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 C7F61349A3; Mon, 24 Oct 2022 11:38: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 0D291B815DA; Mon, 24 Oct 2022 12:12:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6317DC433D6; Mon, 24 Oct 2022 12:12:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613531; bh=Eq053hQgh5hot3gFniUkU0XCEGYQXU6z0x6OdiZi4KQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ciSoZHLSmjYelPs7J4blb48JzNkjfZS5yekCOzQqBtYr1yGWIMNB16s3znGxuPldz 3LdP/qmZZwRM8EEeL+06ssTdpfnl2nUjiRE43DHcBXL968RawoOggiDAc15U7ENwco ESCyKaLtZvvT5UE3tbLK5x+h9EGVvcCE3rFgXJS8= 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.4 155/255] scsi: libsas: Fix use-after-free bug in smp_execute_task_sg() Date: Mon, 24 Oct 2022 13:31:05 +0200 Message-Id: <20221024113007.799761629@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602625268419679?= X-GMAIL-MSGID: =?utf-8?q?1747602625268419679?= 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 9fdb9c9fbda4..173f91ae38f0 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c @@ -85,7 +85,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 Mon Oct 24 11:31: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: 10190 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp641655wru; Mon, 24 Oct 2022 13:36:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7HAyLmmMjcBwB6tW2oTy+t7LarFAM2d1PdQ3uIr5jL83zzkQviPR4+1ks4Y8oswqhgnFss X-Received: by 2002:a63:5a1b:0:b0:461:9934:6f62 with SMTP id o27-20020a635a1b000000b0046199346f62mr29727951pgb.266.1666643762570; Mon, 24 Oct 2022 13:36:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643762; cv=none; d=google.com; s=arc-20160816; b=YQW26tThe9eyNztCw8l1NFI1AHQoOFvYBQpMf8iHiwxQQOhCyqp7pQ+1Bx4AxDndj0 XFDnQLfBZUVCQGD50YYQ22Dk/m4YI6oF4/Rj6zaQkYe2e/T+d7Y930zzlj2w6jP5dyiM CCDRy51eqfS+yTpj0tns6KGqVIzDQiHsZ6OKpJnTttZBeQj1H4D4sPVPtIpAYUB6ut+c q8nirPiAzgQZ/6wX1cGOpDv1JPwuDH4awcryfOHZxO43teWabZv04leGm3OcAgotbe00 EZSfjdsimYSgDnsNgW5ZXXlcAJYxjr4WkyR1w4UiWEh+ZueEOOOmwTCvZ70ek/wNrxwZ NoVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mhrnEAmN77+RJHaVT4tPm8zG5lYwoWjh+dwR9ZXYH3U=; b=pWy4Y8p69s4WwEHeGpBVfQWN23bmSBr6v2xHJCkmjlaTAyQr7FxqtqiBfvCn3RqvRX PazBgQKb9O8NMxc/j57oVggbYDPEPS+G7fehXheAkypDOLOAWD0lmbFg6sB3tXvOG//3 NtGCtxKRuXSYzeoaACgj0OoQYRZZWjqPBapcWx7x+/j/fRFS3R61RIYTYHWgJRz3LuJM kn5he9ZAlMS6lP2acsPM15GeDRRzTXOVinNxYe5dAAQyB7ZOQcdhNYRxy6Z08VZNLbmm oiLXCG/Pli5cklWa2nul51y72xrtyOc/OCPUsNNchns/w7AH7MztUBwEenCDuAIoLENH YKsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F739Hle2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a637449000000b0043c700feb0dsi601121pgn.160.2022.10.24.13.35.31; Mon, 24 Oct 2022 13:36: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=F739Hle2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231928AbiJXUZm (ORCPT + 99 others); Mon, 24 Oct 2022 16:25:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233548AbiJXUXi (ORCPT ); Mon, 24 Oct 2022 16:23:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F04BDFA9; Mon, 24 Oct 2022 11:39: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 D4BE3B815F2; Mon, 24 Oct 2022 12:12:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C98DC433D6; Mon, 24 Oct 2022 12:12:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613560; bh=KqJLZ6cRDvhGDBZ0Cn5kRIj2K7+4uDN50DC5R9l8bLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F739Hle2KcghIukFwsHB048C9d7xiQDi9sBMal7CgdYgERu8uzHS9HXGjJ7n79gYE tjXa2XjekJXG60RJVWEmlZjLfNfJRxoI40SilGEiHbwQrgTc0uG8m9nic8yBdASmBL 9uEiGWUfcIAV8LJTS8Lcl67LhY4MzWp809nVe/1I= 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.4 156/255] fsi: core: Check error number after calling ida_simple_get Date: Mon, 24 Oct 2022 13:31:06 +0200 Message-Id: <20221024113007.831407481@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602649821932313?= X-GMAIL-MSGID: =?utf-8?q?1747602649821932313?= 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 cb980a60af0e..09e571578232 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -1271,6 +1271,9 @@ int fsi_master_register(struct fsi_master *master) mutex_init(&master->scan_lock); master->idx = ida_simple_get(&master_ida, 0, INT_MAX, GFP_KERNEL); + if (master->idx < 0) + return master->idx; + dev_set_name(&master->dev, "fsi%d", master->idx); rc = device_register(&master->dev); From patchwork Mon Oct 24 11:31: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: 8961 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp436595wru; Mon, 24 Oct 2022 05:57:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4s3GJ9/EP2d8AYZjz44iqpCMHP0Nyn6TBhzxZ4NR1bX4btk1eCbYasM4DB7PoGTK345bCP X-Received: by 2002:a17:902:b101:b0:186:7067:3ea3 with SMTP id q1-20020a170902b10100b0018670673ea3mr20291686plr.59.1666616259189; Mon, 24 Oct 2022 05:57:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616259; cv=none; d=google.com; s=arc-20160816; b=c71TyZI0F2m4QSkbKpC5Z5Voi4+eiDEBU3iIgvyMM7uJUOwhn7rI7cg6INLKj6QJp3 V9IqM/X/Bq9vDYI0Eef4nhch+ShwDnkbHFQ8KHD9xS06KTIUdUc3ykezO9y0186VVPtw PKrk4dic4x0FSUQu05qqVOdvrvShthwbxixgE8XZcbg5/H2rFFE2e/J5rhH5jVAHP1uS 4HN2CztqPJ9hB0jmfny0Ty/HIjfXMXd/Umti51Ek8M2ZV4U8GLZfe6x6cPD7zOk+t5PN Aiqfb4DSF/oXRF2apEuTFKzcGxqhhaSo6rDYv33HvRFXJ/uTUM8KtC2Pkc/wkaiJDFG6 6fkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IOHSfyFD4niVyHHhM+glbmmMt/480At2Df81CEcv5Vo=; b=qksxm9JMfOTt/La4g/VHkb6uhrmWw0V2MFCvhd2edMsNXry9njBAOfsnJTEkiipVFZ OSllSm1tDAMKSWBfnCHmAqOH5Cz9laDvAGmzNQV0Hv1yfUTr/Yqrh0yUgsLg87NHY/5K 9aCYSOq37Gpd7dL6X15uGJ3DNAVyAA4FZd3ZgndJkSTmBnIMBnUqZOFMQNm5TqqWB0/T qElPh/70m021Sc4AuYwDE8jK4oNphbVPYZozmVCQOrbwn658vsraCmO/k+z0/cQ1rzT7 5pCf0td3zBa06J0Bw4lEXN+HpFdXhZY8Mn6QmjX+4v2d1+1HufQzr/raaDvQuPFOS3yT uccA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fNNkFhTi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eb19-20020a056a004c9300b00563a0453c55si30735407pfb.268.2022.10.24.05.57.25; Mon, 24 Oct 2022 05:57: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=fNNkFhTi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234363AbiJXM4f (ORCPT + 99 others); Mon, 24 Oct 2022 08:56:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234749AbiJXM4K (ORCPT ); Mon, 24 Oct 2022 08:56:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6E8D77E84; Mon, 24 Oct 2022 05:15: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 91D096127C; Mon, 24 Oct 2022 12:12:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A03C6C433D6; Mon, 24 Oct 2022 12:12:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613571; bh=0EsrBRhNjT/7EWbcf7qA2B5MZSx/S7gsSGue+kr9cJk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fNNkFhTiWmIrJ/3BBY5IEb2d08nOoxH4VPPBHQqhHxoPNgUF29naTISpQD1uCGceX R0lL/5uUMbcTLd1Mhp1PFphuOYIrDRAebeSczbl4YWu/lMaOtXEtIxDNFol0MRvVjo 4iYx7tOrvq2VG81PmkroCaPzruFrWqfbsvVirRGg= 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.4 157/255] mfd: intel_soc_pmic: Fix an error handling path in intel_soc_pmic_i2c_probe() Date: Mon, 24 Oct 2022 13:31:07 +0200 Message-Id: <20221024113007.870720716@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573810728184462?= X-GMAIL-MSGID: =?utf-8?q?1747573810728184462?= 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 c9f35378d391..4d9b2ad9b086 100644 --- a/drivers/mfd/intel_soc_pmic_core.c +++ b/drivers/mfd/intel_soc_pmic_core.c @@ -111,6 +111,7 @@ static int intel_soc_pmic_i2c_probe(struct i2c_client *i2c, return 0; err_del_irq_chip: + pwm_remove_table(crc_pwm_lookup, ARRAY_SIZE(crc_pwm_lookup)); regmap_del_irq_chip(pmic->irq, pmic->irq_chip_data); return ret; } From patchwork Mon Oct 24 11:31: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: 8972 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp437882wru; Mon, 24 Oct 2022 06:00:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6gJ0dd4v9bCc74PBTR8owNvy5Z6AwIdwEgpZKZ8T4I/XFRcRYh4J0+snocsmQYcCEffsd+ X-Received: by 2002:a17:90b:4d84:b0:212:c78f:8d6e with SMTP id oj4-20020a17090b4d8400b00212c78f8d6emr21781222pjb.201.1666616436075; Mon, 24 Oct 2022 06:00:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616436; cv=none; d=google.com; s=arc-20160816; b=KUSL9WjG0op7oYabzd32CvgFounN2VuyDkz7tOXPbOkvkGZKxf0TYXen9FzWN8lVDT vICaVIykeiGZKAynXXhQ02BuRU4BE2LU0rERf7C7szMny/wvGd4dmue3fJm6y0Qkfcmv 2yBbCKuYQQUXXjHL7uhX2nX5BU4UzfROwXtdEDdY9i2TZBNW+eVbsHNmmB7zMidBGKVw 9lFAC43i8YP1ppuT9DRlDNmLn+wmLuR5mjKZF3dnaqbANpYGE2BodKG0w0OvfUIRxf3H 2YsqFnV9XqfWkl7ZbC0BMnjUuwwI29mFE0s7ckm68f9tra69OPZGk7cNwC5inCHFuG0F iCaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fcI3k15DIZHI6L/UoW0KlIMKvdVwbLy0Lc8HivKBdx8=; b=jZ9XBxIDSlljc8H7FWoqrOJxXipdEs3e97gkJdOhJEL6PSH2Qcdkk0Wx8uJSQAv1As /UHonaNwEiGLkpaz+Ig2RrERFdTrz9AjLqpJiXXCiZfJKWD7y+wYvyHxNtXCjeWh8q99 ov9roxSSzLluxpaQEKclP6G7Mxud0DCRijS8PS7vdvPVX7iKgaip07B+H/YcUClo/6O5 XP2Hr20nme8LMrBWkQOZ5ehvaExVWjlzFsQqHU8ceSLeRpkq0BqianCljU65C1OYGqUW hsXxyjOYc9hWCg3CcYVh9oB9AaET3YFhD0YHqso2hOX6bVQSZe6i19XuJI9AAf27W/dI bZew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Pc6JA6IA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902f70900b00186b46df624si1211858plo.424.2022.10.24.06.00.16; Mon, 24 Oct 2022 06:00: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=Pc6JA6IA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234723AbiJXM5A (ORCPT + 99 others); Mon, 24 Oct 2022 08:57:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234712AbiJXM4c (ORCPT ); Mon, 24 Oct 2022 08:56:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B3068D0D6; Mon, 24 Oct 2022 05:15: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 312BE61291; Mon, 24 Oct 2022 12:12:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 468F3C433C1; Mon, 24 Oct 2022 12:12:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613573; bh=72IdrIRDfHiRyzadDUK1d/TKQj32QPvspPY4OjhOf2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pc6JA6IAVaTEQClLtRlLwjFsEgJtb2J8tWxE8iJcjkF7QVHqrxdG8huKrsYdNJYFG olgBl/pUd7APmUk8EbA1yEH21A2YBcP3vEo5ozlAxakt+lU0ez1XikHhYWmVHm7atB MX4z4+tTNN4Bb+2cq1Bew+ylqpQ5MYFIRllO3w3o= 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.4 158/255] mfd: fsl-imx25: Fix an error handling path in mx25_tsadc_setup_irq() Date: Mon, 24 Oct 2022 13:31:08 +0200 Message-Id: <20221024113007.902329329@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573995974696173?= X-GMAIL-MSGID: =?utf-8?q?1747573995974696173?= 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 a016b39fe9b0..95103b2cc471 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 Mon Oct 24 11:31:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10164 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp640433wru; Mon, 24 Oct 2022 13:32:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM41s0QxMRM2idp4tqLGFbrlmUwKEn1ljgPx0uUxHkBX8zjMnlKtWTxuCpXQlxLggigWbhhE X-Received: by 2002:a17:907:6d25:b0:7aa:f5a4:5f66 with SMTP id sa37-20020a1709076d2500b007aaf5a45f66mr2553386ejc.216.1666643559002; Mon, 24 Oct 2022 13:32:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643558; cv=none; d=google.com; s=arc-20160816; b=yKCaHEW4tq15I/h4/7gSJEzHE1VPfeoYCiIXhRbPzX9HScl4CFQHGP4+aS45TX3WUC lgOM7PILPcBklP/n2HnGHa9cmbR9iRms6cPTcUkfwCpgxaq+7Rz6RwlZzhLlHO/ZpXSZ Aqb6njdOti90MV4+OWLA+Y0kp18tAoTXSYsIplnqTvLrcGMEbTUvMANC71zkiKgHjDLe ySmxtLodiOPtnasJOC2VxJQ1R7LZK+uh7M+ZbtDnGA7Ktk6+MzYm4HPgHOs7qMs6DxGG 9TKVKf6xHsbQCb/Sq7qFMEGmcHge0XqgAYIUxPdRvtwhYu2trjwJ2XOwjSDWpfthVV+i pmiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qWFqiEeGZmqcWOMXUVigVT0msLAk+Sw1/4oXwxBjZ+M=; b=0QnAMir1V2+3d8ZhJbQZLAnc8aQ538eoNKmhthGkOqFatW3nVh58r2PxSyEcHhbsW2 OV/+OOoItO3oXj5+d+d+pMHAhicZeYotoMSdrbRGUiQ5xAbUhqJQCD0WG7/ISPkyAx2D PGq/CTLJ6M9DYN0H2ICMl9D/0RRDq3YH+MCxiHfaAydYp5YLW5NOsKysDvOIgeMka7sf E9RKfJJ4X8AA7k1SlHWbn0i+btAeJo9AjfS4iNFBVSnk33E0fnZLe7wBzQP3X1gy9Dcv qfzjH49VdQmOHHZsCKRBJYtjiYWATa+cbXgTKtaY7eJN/rt07v+lYx9/xIGhN8QfCpY7 vbHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FrS1kHVL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hb38-20020a170907162600b0078dcdb1c9dfsi734074ejc.553.2022.10.24.13.32.13; Mon, 24 Oct 2022 13:32: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=FrS1kHVL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233264AbiJXUWZ (ORCPT + 99 others); Mon, 24 Oct 2022 16:22:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234217AbiJXUV0 (ORCPT ); Mon, 24 Oct 2022 16:21: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 529DB31DDE; Mon, 24 Oct 2022 11:37: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 ACCF8B815E2; Mon, 24 Oct 2022 12:12:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11C73C433C1; Mon, 24 Oct 2022 12:12:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613576; bh=43hCi9kwgxotGOGQYEO+J/HJrzuryoYkehb67txsiVk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FrS1kHVLsjnw8CY94nYZE0uR+I3WizPvaCBFu+UIMd/chFTfNK/xVSz2bLmogqAwb FJdG+t0PxM8CMUYIJaw1rl7y0xcC56mWPg9JaDVlQbQlzdrI2QlKNA/cvKfCJyv2qt 2F3ALJtWCvk5SOn0oZXYRoSo2O74f3HdqBagvUbs= 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.4 159/255] mfd: lp8788: Fix an error handling path in lp8788_probe() Date: Mon, 24 Oct 2022 13:31:09 +0200 Message-Id: <20221024113007.950152920@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602436687802639?= X-GMAIL-MSGID: =?utf-8?q?1747602436687802639?= 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 768d556b3fe9..5c3d642c8e3a 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 Mon Oct 24 11:31:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9221 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp459347wru; Mon, 24 Oct 2022 06:39:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM68zCW7Nt4uPWefZrvH9i7svTJQuOUEgDe2F4I5Ptz46pEGVeXOZJu3OJUuB8cgSmBwzNER X-Received: by 2002:a17:906:58d2:b0:78d:9d2f:3005 with SMTP id e18-20020a17090658d200b0078d9d2f3005mr26836924ejs.697.1666618764957; Mon, 24 Oct 2022 06:39:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618764; cv=none; d=google.com; s=arc-20160816; b=CBqEVo+U7dp9ayiiqB5U4u8sKHZ9botyKNJ25GdmB9y1W3n02J9hUC16fUWqyEflYs 5giZXhqR5mN18sxgd4tBaVxxdbDyseJMhUzewdSRqke7eWlC9oEBgD+ShcYZPyct6Knu zECLa1iZhp5JUw1ikrE5lVAstCUacKzQpe7sLpSLhxfBjP8Utz1PjOd37pfMBEZLiTmR J9JznTYiig25rHtm31h/HQl8/V+jF+TgUlh8C8H8p9tqdVGxI70I289aT8XgzUdM3yUT axINz/rcDgPXuicRaV6h1XnJfd2dYIqvwtUfGnntyCqt8qxyeaXODzv+AJ349YzMs8t0 kA5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=F7YhCsMC4AcbOSjUcUSOWknElbIK0aDvLiJOdfjEmXgU9wyabrvGW8hWtubuO7H+gD AqMbI+IEJYTbv1/Uv3nQopAff9ZAq+YseGgl9BVfJuEk5WuuV9JomabaOp94Kq8rtJ3P yKH34Gk/L4NI/+AIEM+MukhVXTxxd9zEU5rve8kBk59m5McdPt+i0eiw+l2bXa326v4k s95U/F1xSku9CPlQox4uEILpS5xBXw5NFoh54X/hnafHPsdWc+RZrTEbXOZ9SYjQVgFe Al7tl7NrwzRr2FDFwoGeVBwT4eNShY1AJz3jSfLdgsvh+FBJ40z+OLRuz+7vGBOGt83/ lAMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=T1jNKM9x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170906500500b0078255525a6fsi25509229ejj.671.2022.10.24.06.38.59; Mon, 24 Oct 2022 06:39: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=T1jNKM9x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236105AbiJXNer (ORCPT + 99 others); Mon, 24 Oct 2022 09:34:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236221AbiJXNaA (ORCPT ); Mon, 24 Oct 2022 09:30: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 D114C1B9D2; Mon, 24 Oct 2022 05:33: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 986A661316; Mon, 24 Oct 2022 12:12:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5763C433D6; Mon, 24 Oct 2022 12:12:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613579; bh=Ku35vuD17YGpq0QHl+DAKe80YrZ/0TpL18rzyvhTdJ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T1jNKM9xxD57yNy+/qBhZOkspWV7x5VGskmW5hTVknz2/0A8UZazGiXHw9RlcKGmD Se9D77dX2jhWz6Gfo4SH+1RfuFHBuOcw8n0H0kXEl20Lxt+GMJRi+CVlfGA/6df7pC uYNvZluCUQsoUJOnU8tNzmA8e3b0uKlG9mMcnKG0= 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.4 160/255] mfd: lp8788: Fix an error handling path in lp8788_irq_init() and lp8788_irq_init() Date: Mon, 24 Oct 2022 13:31:10 +0200 Message-Id: <20221024113007.999419911@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576438306464043?= X-GMAIL-MSGID: =?utf-8?q?1747576438306464043?= 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 Mon Oct 24 11:31:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10176 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp640942wru; Mon, 24 Oct 2022 13:33:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM609Z4NLY22BKKcNjltZLx5p4B+tLkjr556fWu8qdIskl0I3iM8kQ/doJM9MEaabJVdgNAL X-Received: by 2002:a05:6402:5483:b0:45c:1336:6d9b with SMTP id fg3-20020a056402548300b0045c13366d9bmr32432265edb.100.1666643629220; Mon, 24 Oct 2022 13:33:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643629; cv=none; d=google.com; s=arc-20160816; b=jTS8xEdFGhQOkJ0sGRnLkzz4tSVv6mPtkqx4y0Inxk1wqIP8jsHdlN91kOb7wvPia6 KdVefj801cb01QVha1alc+JyiP7GhhijFXh3+BitzYus6zxtqOU8tNjK7khAGMDg/0Y5 6ELlHiQJzRIyydsiacjixaizwrbOCGS2Z9CThp6R63wqU/1DEeLi6bC2Ji9f4PQGH1Dl bfutNLEUotMLIxuqXveSUOCahUalRpTmg+Zr2cJkxNIphMqQfsXi3dsQVSBwPwJgaAJw VSueF88U796Ys9x2PgFJL1Fr/3AqR4pRFLg1jLBPCPXPz7tHW2B0e1hAV0Yjjtffu57r Ibdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=M2V7W3OFf01DcmguN0q3zt7bMLKA2JPTuoJe8v98bxg=; b=u0l/1Iqt2RC2aHuSYKrRzNPYFuq0cwsOhCUfVGV2V4vTgwrkfhtF9xrhuPZjvIunYT F/j4IkIdh2CTuq/D7CGezOKFSr8g3blJLCXbQtwqLbwN+nWXyU5uWCJX71FMpBDTzHe7 I6utnXTBY0nMk4txJAvR4iT15YJk01a1nhsRHtFWGw56At6gCNuQTwb8TYkQbReDHOD3 0jle/u8aRdbiCRCREr407YB8mDgZlVbgN7G3YhDT4j6caQNXeHxPzCNXfqoDt2TzobTc sDoCBREyBiIGbsL4pAKfu+zscgQaYOZEPmHR82qZYC7OhrsTnWaImQ2miwoEKz5mnvKu 3TQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="l/pJl072"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056402281300b0045945eed10asi938123ede.5.2022.10.24.13.33.24; Mon, 24 Oct 2022 13:33: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="l/pJl072"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234262AbiJXUXV (ORCPT + 99 others); Mon, 24 Oct 2022 16:23:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234272AbiJXUW3 (ORCPT ); Mon, 24 Oct 2022 16:22: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 BDD603C169; Mon, 24 Oct 2022 11:38: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 E8B0AB81601; Mon, 24 Oct 2022 12:13:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44693C433C1; Mon, 24 Oct 2022 12:13:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613581; bh=hc8c3MQUf/iJKjMeBQ8BrGrAjXnopkSr+laGHJAs9m0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l/pJl072FBIJfng1DYeWtYSiXJHq5vbyItMe0bkOwcNGzpgNWAU0lVedMz4I5IX5e KswZYSS3o1taMEm8eAr/FOPbDm6Kd1/GJw4HHM7qvFwX5wIA8jo212s3vSq5GpTlUT vxikNmEWjTiLTXPZdMzFlfnrK2xv/B8lJbiCWQDc= 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.4 161/255] mfd: fsl-imx25: Fix check for platform_get_irq() errors Date: Mon, 24 Oct 2022 13:31:11 +0200 Message-Id: <20221024113008.040133654@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602510319914001?= X-GMAIL-MSGID: =?utf-8?q?1747602510319914001?= 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 95103b2cc471..5f1f6f3a0696 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 Mon Oct 24 11:31:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10173 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp640828wru; Mon, 24 Oct 2022 13:33:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7RqtNc/r66jRYyRTS7N9xbseq3SCI9V5gQncB2XEGoHqX0MEpjWcD4cL2olcXQCUR8WXpU X-Received: by 2002:a05:6a00:4c8e:b0:562:a157:6599 with SMTP id eb14-20020a056a004c8e00b00562a1576599mr35165582pfb.59.1666643619396; Mon, 24 Oct 2022 13:33:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643619; cv=none; d=google.com; s=arc-20160816; b=S03VSQrfSFjJSW1agGwQ1elfZMAZT5ILJOCnmPlhI8/osWMN4R9cIIcAQOJVC/DHm/ MlvoralgA7GZ3PsjVHYKkqqoBFRJIeHVkvZ1YgWpsTqKTkcfEB83+NPXLgc26Sa71VM1 D2iCEutfn0M1rg/Sh8lnSl1/lE5UuvQOnE28LBWH2xkF/H3NSLFDqqRaaWp31w6pJKQW PiOoFm4oq+q0MuEYUR6T+LDVzEKkn7LGpZdFqDPKXvs0YdmF4/ycRXGIszA4JMZXHncF 29MMveYaCUM0KUhI6fon36XVncTg5WMiI8L4aIXzS/4orHckKkb8bnuthWRsm5H3gc/H ETRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HES3aUMc7j86bPcRiouBQUa+Jx+PgWmCfI5TEXfEYSo=; b=YVdYPn7kxeiHOIE9l5Mr7HRVk0amMccKJyfYV5qA+U4aOtoIgIlBbzyi5EHjlvzMzE j8HvNTMwlGxzfHP/lemFpT/S8lZlsgJjzq0I6BTm6winEsj/9Dxzslc1oRxaWaUSzW72 a8DfvcPjAH5ir/CZWNKh/b0TdC0jBtwDko+kmtfHm9oXfOs5jJXZGDTdmGK+lKtN4o/9 HPbi1D9o1Mchlfc6kafZ9Nr24do+BbhEl+Eu/E5buVfRY8lMrAoStKsDRrCtw1sjuqO6 8OzxJ1hqio70SHbBUh3U2dT6+ThsZAszKojkEX6uTYRPV9Sw7RqxwGJ0I4kuEAmkPWwn P9RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oRXVU11G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i66-20020a626d45000000b0056bce3dfaacsi695086pfc.25.2022.10.24.13.33.26; Mon, 24 Oct 2022 13: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=oRXVU11G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231764AbiJXUVV (ORCPT + 99 others); Mon, 24 Oct 2022 16:21:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234175AbiJXUUw (ORCPT ); Mon, 24 Oct 2022 16:20: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 4091E1217C6; Mon, 24 Oct 2022 11:37:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8F81BB81600; Mon, 24 Oct 2022 12:13:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7523C433C1; Mon, 24 Oct 2022 12:13:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613584; bh=gz9ev0LdS7M3V9dBmwprZdmuld09/+jN/6jhqDDKq8Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oRXVU11GhZeHR0SnDiQqgBA38RhXibqWcQ2YdsOpq5f7PD8SAnXCdpJm/8tiDDMDS 8w8mluCX6En7DuULcuDwVHOZ+0wH8AVKFHRyKmNxXlHeVoKJtj1tw3gmf1VDZ6qjoL 4faCGF2uVW0t1vR2pXf70uyP7HUzzYHvJQGI7FXs= 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.4 162/255] mfd: sm501: Add check for platform_driver_register() Date: Mon, 24 Oct 2022 13:31:12 +0200 Message-Id: <20221024113008.082171119@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602500299069598?= X-GMAIL-MSGID: =?utf-8?q?1747602500299069598?= 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 bbcde58e2a11..aab8d8910319 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c @@ -1733,7 +1733,12 @@ static struct platform_driver sm501_plat_driver = { static int __init sm501_base_init(void) { - platform_driver_register(&sm501_plat_driver); + int ret; + + ret = platform_driver_register(&sm501_plat_driver); + if (ret < 0) + return ret; + return pci_register_driver(&sm501_pci_driver); } From patchwork Mon Oct 24 11:31:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8944 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp435543wru; Mon, 24 Oct 2022 05:54:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4+x9KxHUjYGg97IZW/ORdWvN/LOiqnJ4vOZqyspHcBlFVCs08XN2lulY4VJ/uLHp+BKang X-Received: by 2002:a63:d241:0:b0:43c:474c:c6c6 with SMTP id t1-20020a63d241000000b0043c474cc6c6mr28254976pgi.523.1666616086455; Mon, 24 Oct 2022 05:54:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616086; cv=none; d=google.com; s=arc-20160816; b=XSTGqz+ASBbs5euOuB7LgwER7pTFnO42q2Sp2LnYOzvVCo+YUm7bJIlwlMnqlhxkTI oVkoN9Hw/nsdygD4AKQgra26IzaviLDbg/qoMKbZmkz/O4/d2sBJTMUubuwXEQgV7yLx Wp6XmGBm94xdSxSu4NaV2hAlN8b/jqQgUMI3m9STiMxuW+63DwOxpbfYv85tLnoakvS8 PXdggXTTuAbXHx57ZAelMdautKcZT/qx70yPdcJDvNzuCRH7kekX3I3SgRS7JGTWRuoJ N3bVbMeYVhILrcOb6Gpvu/Vr20mbpK5PfXsjErSiT38BunHnbDPiJhOuGua7TJ+LKYwJ Qa8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/BZNhYn13W+36/Yuz8521Xfy/tIB7dwXiwnHBP1N8eQ=; b=T+BgNjA3m5pEt0I1Yzg4+d/WW3Rlk5eacjTTmFKyDy36wN1H3V8jZmA+iTCZFE7B6J QKqJXSg6MCGgbXWp0yC2JTrrSeDZc4ShWf2+l03BhK1TF+TN7+C8S1jmIEj186VQ5YDa z19sRJ7E62D1maHcSPBBz2lv+Jos/hXehP0hpFqDIBbsNHq8nmIT+utXpDBQi4XOFwEL TDI/5WLCxLF5x7M2iNDq+OFroNguEZJC0UumhXG9OUgaIPvwQ6VJdD0XcX+DvyYaOEAu uOElLmC4O3JFwQ3wAXAUAJ2ANuHonDJswA1hi6WRjAahmyQMpi3vTrKHhkJHpF2hAumf ZNDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JmRzCPD6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b17-20020a630c11000000b00464748b58c7si32643110pgl.838.2022.10.24.05.54.33; Mon, 24 Oct 2022 05:54: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=JmRzCPD6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234690AbiJXMw5 (ORCPT + 99 others); Mon, 24 Oct 2022 08:52:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234808AbiJXMta (ORCPT ); Mon, 24 Oct 2022 08:49: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 8BC00923ED; Mon, 24 Oct 2022 05:13: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 36E2A612F3; Mon, 24 Oct 2022 12:11:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 413E3C433B5; Mon, 24 Oct 2022 12:11:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613505; bh=V2dOPSF3+RqJgCZ0dAjorrygamRapc5bi17muQbPhos=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JmRzCPD61aGrNBEKnHpnWHViaadflMAm3Uu1Udd0H6vuHO0BSSdKZ0QsopfK+fSUj txviznu+DFlIHsDsOKXnZJQm8pEi5+TiCGncSydexO+RJm+Rz740pqyJuu9yoosV02 sAfoM1zipBJFYOU+9nJzubtSCHIFmNpTXiJld920= 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.4 163/255] clk: mediatek: mt8183: mfgcfg: Propagate rate changes to parent Date: Mon, 24 Oct 2022 13:31:13 +0200 Message-Id: <20221024113008.118489236@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573629285321206?= X-GMAIL-MSGID: =?utf-8?q?1747573629285321206?= 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 37b4162c5882..3a33014eee7f 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 Mon Oct 24 11:31:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10253 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp643709wru; Mon, 24 Oct 2022 13:42:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5c0VVEwPEaZDdRXUOWwasOk/TppKRasvKDL+as7XviYNueBThB97EDiprJrcTxaxX2UbhK X-Received: by 2002:a05:6a00:198d:b0:56b:fa7b:56ed with SMTP id d13-20020a056a00198d00b0056bfa7b56edmr3683032pfl.81.1666644153845; Mon, 24 Oct 2022 13:42:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666644153; cv=none; d=google.com; s=arc-20160816; b=PZY6ud/2Oomfxox0Mh8CXK/AjA5rYYOQ/9zI08uRx/pp7BtWBY6Qmvbb8A6faiN5Xz ISiY+MfDB2xjWMmx/tuhh0bxEjmJiW/39c4yE1QxxNl1Gbwr0ORz3m23oYgqy2SakgFr eYffHyJDHz/acMg26WzN/6R6C3YLu57owpD5GCpAggTX5SW2JjpJFdZMbme4fZtWs7N9 hf0GcffDNTrLFzupNzBsH98REGJiMd+J/aj6X67g3TA1oYprUnzZPbdtPEY40dzqwpUv sK1RyvnqpXk2shCP/Hkzwx8s2fx7HnymFpBg4rI6KAm8g2UQOBQ+Uy/ey1Zeq1LBfyGe I+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=2DaQzy31sq8wf+8sLMVqT9YoyNRbiEg10ZdmOVmJXsE=; b=TUOiB0JzpCFjWtNgRn/k+hQeXvnhBzuHjZBxqvI+FETUasgw9HKxp3gcvpBBh+d1sP UflmP5jymL+XBXKdIVACJ1R1tdyxRRgoE69pesaZdEw1yrHt8HMAM0aqRaL7NKWjtX+u kdCf/KO2ZCeAtaNKXPFt4Tp6zyl+uDMP73vbQoKwJuwRB1OA/tR/R1Q1tmvztbe7A0FC J3OoeRp2DoZW73kN1mi+NE90RGQAlxCGbn1X/zBc6bjZZrcin9Gwsd7M6FKX9gnovIk5 UFRkfZfJPfOJEllhlkPNpXHySrxco6tak+WFNluSOZXK0bU7hl930x69grol66s2qwJD WzjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=be54DHcj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pj13-20020a17090b4f4d00b0020d9f17b911si11250647pjb.99.2022.10.24.13.42.21; Mon, 24 Oct 2022 13: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=be54DHcj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234957AbiJXUmD (ORCPT + 99 others); Mon, 24 Oct 2022 16:42:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234674AbiJXUlO (ORCPT ); Mon, 24 Oct 2022 16:41: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 63F83A9249; Mon, 24 Oct 2022 11:50: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 6EF29B815CB; Mon, 24 Oct 2022 12:11:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C64ADC433C1; Mon, 24 Oct 2022 12:11:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613508; bh=HD77Wa609X+9+wDYum1pHdfln9/gmMB9kVg4mwj/yPE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=be54DHcjfedM4OLVXPWHKC7p5c2tEF82W+KXZcLOsKE5B7jmpIYGQSSoRC7eFODOJ FpjuGlZIYEvDPrCJCRLZJEIfXrG3R6d1tw93h9tlUOeSWtL+M0ffdV85+t/sROHXpO 5x+XnR8ZdUqlpWZnuOg533X2ye/WPw4eyBFQW21s= 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.4 164/255] dmaengine: ioat: stop mod_timer from resurrecting deleted timer in __cleanup() Date: Mon, 24 Oct 2022 13:31:14 +0200 Message-Id: <20221024113008.150196237@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747603060024948721?= X-GMAIL-MSGID: =?utf-8?q?1747603060024948721?= 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 8e2a4d1f0be5..997839c2130e 100644 --- a/drivers/dma/ioat/dma.c +++ b/drivers/dma/ioat/dma.c @@ -653,7 +653,7 @@ static void __cleanup(struct ioatdma_chan *ioat_chan, dma_addr_t phys_complete) if (active - i == 0) { dev_dbg(to_dev(ioat_chan), "%s: cancel completion timeout\n", __func__); - mod_timer(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); + mod_timer_pending(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); } /* microsecond delay by sysfs variable per pending descriptor */ @@ -679,7 +679,7 @@ static void ioat_cleanup(struct ioatdma_chan *ioat_chan) if (chanerr & (IOAT_CHANERR_HANDLE_MASK | IOAT_CHANERR_RECOVER_MASK)) { - mod_timer(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); + mod_timer_pending(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); ioat_eh(ioat_chan); } } @@ -876,7 +876,7 @@ static void check_active(struct ioatdma_chan *ioat_chan) } if (test_and_clear_bit(IOAT_CHAN_ACTIVE, &ioat_chan->state)) - mod_timer(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); + mod_timer_pending(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); } void ioat_timer_event(struct timer_list *t) From patchwork Mon Oct 24 11:31: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: 10255 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp643739wru; Mon, 24 Oct 2022 13:42:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6O7hfJCGRlpNF5ERyPmYhR4DWN8bYU9lWwHjjGXqLLsgPyAUSwuwPlLxcKka9o3MYLyyL7 X-Received: by 2002:a17:902:b092:b0:17b:833e:74f7 with SMTP id p18-20020a170902b09200b0017b833e74f7mr34757133plr.149.1666644162052; Mon, 24 Oct 2022 13:42:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666644162; cv=none; d=google.com; s=arc-20160816; b=FFewLtsq3XRhtjrlJQT5jc6IVd5+l2U2ildOlP62H2Bgs49IkHFSw/XVVX0AgJ3Qv2 nrwRskuK4rMxcVBfexmdG/zK3r/03ReLlbX2KDOv/mxlbvk/iwrb+WywWcjnMdFaKKbA nj32vOtHV3TVxiKqMp7mEp2AKRwjOsJVmVE/tHav67Yh7uq6qWydL5KydXUEEjFEEIgD vmdyMqWDPecOMxcbek9UUVc9X/tyvAhZ544rSvqON7paua0trPyS71PUVZXkzye5YCBp WE/xhw6TcKOad2usbQrlRz04eAcPe5UfFbjrU/eYwf1wrw4wBsd0yTdWu1LW8mXMkjFG /bhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ALDqe2sxc5xF9v7cbCeCb+1g9YvMaEj0hFzblANG1ZI=; b=Tb0MBTtuveMZRphM8w5OujE045y6Lcq8sFj0LJ9QwvVtvsS/RmEqfQ2F6BS++wghy3 1waGIS4YtiZ70ZRANof9FxixGzMSApIOW3XWUqMSukP8ESq2k34bCFoHFD6aU9eoAUUs YC7culj1Y6p/azK0IzR3g0RPC3RPU2ypYmyi6+Nvh0ookmQMKLv9t9rN0HZwMar5uoSo 85pzsXWNyxgbIiswqoVUIhXuJL1nu5FznZRaLd/uqiz9lX9dDcZVuq1RnA0WMa567ye1 yve1e5FmttaTLEJjLVmlXyLKsCHkHOyZS2Y/GKsLZLKNRrBdADmEaYux2G4+EPAiT+dp tjzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="h98b/IUe"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090a449300b001faf9ba369fsi9495712pjg.164.2022.10.24.13.42.29; Mon, 24 Oct 2022 13:42: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="h98b/IUe"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234867AbiJXUl6 (ORCPT + 99 others); Mon, 24 Oct 2022 16:41:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234865AbiJXUlO (ORCPT ); Mon, 24 Oct 2022 16:41: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 727C91645F8; Mon, 24 Oct 2022 11: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 ams.source.kernel.org (Postfix) with ESMTPS id 08816B815DE; Mon, 24 Oct 2022 12:11:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6162FC433D6; Mon, 24 Oct 2022 12:11:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613510; bh=xYGfpluMhE2yfUa76Sd/ZU7uGJoQMeIwNU8LXhnTMoo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h98b/IUeurvCwgvm7jljHqw+1qeYihcDRsBAmcJxl3Uj6Mgt6iYXBX4fq/sf01MWz F4KxEpeyWJhk48tvy+/t728XiuW5jTD6KoGJRy+CfBGU1dxG06rXRAr4Yv4jHQTigy ZWKdrxnGJT3cIFD7TG6WR8CxcCbl+1C1/A1EfAqw= 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.4 165/255] spmi: pmic-arb: correct duplicate APID to PPID mapping logic Date: Mon, 24 Oct 2022 13:31:15 +0200 Message-Id: <20221024113008.201975059@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747603068498820106?= X-GMAIL-MSGID: =?utf-8?q?1747603068498820106?= 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 bbbd311eda03..e6de2aeece8d 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -887,7 +887,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); @@ -910,16 +911,16 @@ static int pmic_arb_read_apid_map_v5(struct spmi_pmic_arb *pmic_arb) apid = pmic_arb->ppid_to_apid[ppid] & ~PMIC_ARB_APID_VALID; prev_apidd = &pmic_arb->apid_data[apid]; - if (valid && is_irq_ee && - prev_apidd->write_ee == pmic_arb->ee) { + if (!valid || apidd->write_ee == pmic_arb->ee) { + /* First PPID mapping or one for this EE */ + pmic_arb->ppid_to_apid[ppid] = i | PMIC_ARB_APID_VALID; + } else if (valid && is_irq_ee && + prev_apidd->write_ee == pmic_arb->ee) { /* * Duplicate PPID mapping after the one for this EE; * override the irq owner */ prev_apidd->irq_ee = apidd->irq_ee; - } else if (!valid || is_irq_ee) { - /* First PPID mapping or duplicate for another EE */ - pmic_arb->ppid_to_apid[ppid] = i | PMIC_ARB_APID_VALID; } apidd->ppid = ppid; From patchwork Mon Oct 24 11:31: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: 9082 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp445570wru; Mon, 24 Oct 2022 06:12:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4wiIrDG9aw5sG4mWiA8kodzqshvQvqa9CIVgP7CXcOX4KfZYXDXrJ9f3XpY1O65YtJ70fq X-Received: by 2002:a17:902:b614:b0:186:940d:7e98 with SMTP id b20-20020a170902b61400b00186940d7e98mr10418802pls.80.1666617169476; Mon, 24 Oct 2022 06:12:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617169; cv=none; d=google.com; s=arc-20160816; b=nY4rVTccNDI8+hL+7smrDukZ0fhZT7pv866Au/bAlpFvSrZxU0Ms+DBLly0cvc5Gpv LtBnzfGrMh3okmR3QRqBTd05+OiY4g8kY6wDrP9Y9mdUs/OvlHyPzgy9iGyFaxUaqUYC 1NHJtBlYFBg30Upo1FMcKK4zwjlms+RmOxYPALaQg+Ip9myrf4PeXgqT1BvciNQSpvwk FlTiWO8vjjaGKFuACMUrWjhvk+7bLSTyl6/ZvAV4WkqoJGYLZxZzYxuruDurAJBy5naX qLDGXn5SRD8UkbgyMED3EgPa1210Um4c+dainsu3unrF5AWVVjOjl6kRXyVcMPXGnySL sW4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zxouHEbYU5w3UgsXkaQUzpj9LnuMVPe91CMa9QPZAp8=; b=zvsSeyIvBcTHN/j3RJ1Qu/0HdPnZ7vxeJyVx+JI0cLJ1DPp7W7BpAVuFmT03Ta8bjk ZIPFLrIPjxR2l8IXYJOOwrxtognnWVizYq7avZfTjP4Yh3trHz4ab5QZTLQ+zGoktfpE 6fG3wceRfbyYlnpUWtALbp+22/c2LdaxBY/AL8vgJmQM9kRSl9E1CsCvetZgaEcTACOj wokdqieR7Q6mQKfo4qIgzgUZa/E2M/kgHWP1aHWHEr7c62e/N0FmBWON9SauEc+/Xb/Z h8JRl3/rUrKjUakD2DpMhi54XB1dSyCFPWjmrCgkD6VbEhZQwt/HjEdItlsrzZxOiy9u Dr7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nK3obnwl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bf5-20020a170902b90500b001842f55e713si31452536plb.321.2022.10.24.06.12.35; Mon, 24 Oct 2022 06:12: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=nK3obnwl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235678AbiJXNMO (ORCPT + 99 others); Mon, 24 Oct 2022 09:12:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235871AbiJXNJx (ORCPT ); Mon, 24 Oct 2022 09:09:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60A3AA222B; Mon, 24 Oct 2022 05:23: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 E0D8C612EA; Mon, 24 Oct 2022 12:11:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1603C433C1; Mon, 24 Oct 2022 12:11:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613513; bh=Dzp1yNR7MhGQClgmsjrPeU8LYIs6j51LrN6Tl5etqIw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nK3obnwllSafgbh3CbwQWeGdTKLGc6OZwifjfFwQ4giJjOm1hnxze+3nLpeth9n2b VfjQWIfnszc2KBUxRLH3ccW9P2haNpiB6tmWpsO6mdZ3bAI0SiibxZdPVP4U5aMMzE 5hnCXGqUSs5eqIMA9wslTYiuT7KFrIhZhA92WC2Q= 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.4 166/255] clk: bcm2835: fix bcm2835_clock_rate_from_divisor declaration Date: Mon, 24 Oct 2022 13:31:16 +0200 Message-Id: <20221024113008.244913106@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574765343036968?= X-GMAIL-MSGID: =?utf-8?q?1747574765343036968?= 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 e637bd6b295b..e650379b3230 100644 --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c @@ -967,9 +967,9 @@ static u32 bcm2835_clock_choose_div(struct clk_hw *hw, return div; } -static long bcm2835_clock_rate_from_divisor(struct bcm2835_clock *clock, - unsigned long parent_rate, - u32 div) +static unsigned long bcm2835_clock_rate_from_divisor(struct bcm2835_clock *clock, + unsigned long parent_rate, + u32 div) { const struct bcm2835_clock_data *data = clock->data; u64 temp; From patchwork Mon Oct 24 11:31: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: 10232 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp643029wru; Mon, 24 Oct 2022 13:40:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6DVGAwzw66vtlhRwd06ic2kGEu8lqjvdigY0DS1Ek+02FD/lG0808bTWSDId4HLArJlEbP X-Received: by 2002:a17:902:e9ca:b0:186:8624:9675 with SMTP id 10-20020a170902e9ca00b0018686249675mr16494267plk.76.1666644016440; Mon, 24 Oct 2022 13:40:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666644016; cv=none; d=google.com; s=arc-20160816; b=O4mwEmrwvltv2AUT/qvJrJuKUY27PmSWfsvhDoL4BdStpFeh8q11/3Pp3Mj1jsKywY UQprQXg5MMuM/nU/6ug1eN02yUqalMyT/6WbvcpIqRkbXSVyvMgYDz2RCFkkIvXHrUG+ +GjPjWIURfiar3cu6/aeDU8DyRSESR46dwwgqdNnJf5oD6Fv1a/1u3Q4RzSHA+YKGfaY gpsxOP+LYhS7aPZMHsCCDzq5cyC0UT8nERVr4+zjbvjGdqVv4Dx+wU8k1nPIfr1LLECv EQFB7YSsbkI6SY6coUpMceP/jg0GCYuQhQVO5ZjWFi/uCNelkOX5RY9SxdgW2VDnK9aL ZywQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OOlbhsbp+/EqP16Q2Ki5GceeM+xRRKaaU6goS7nuYY8=; b=UYRb7kMawyU2x8YA8rHmkoYsTmGDHCc3zF/XjC3/bZDGjHQ/n6FoDlpMeqkoTw6RmA mIdS1kYGnuVsvMGtkFxCu9fqR1HS0gUmTWBD2refIsYeQU9T4L2lBV0BTb3KVhpcKggp u9dOWx+b78/JrFzvYx3AH35rpsN3kJW6vnxvgOq4vwrKyFRxswIkcrBlEwv6ELuG3VLy jPgQyi4VOqhCNrrrRD9qlDDIFS3OS2g+yofOgsspN0tWbW5DA9mPKcmTlZyh76piWyw1 oLQeMO6on4FB/GgyOb4FIcIYJp21iqV6Y0XFd28pw8Cx9fqbXEt++YzqYUYrvoPB48m9 eang== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Qpo41qI5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id na18-20020a17090b4c1200b002130053cad7si6932497pjb.7.2022.10.24.13.40.01; Mon, 24 Oct 2022 13: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=Qpo41qI5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234550AbiJXUje (ORCPT + 99 others); Mon, 24 Oct 2022 16:39:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234627AbiJXUib (ORCPT ); Mon, 24 Oct 2022 16:38: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 0E93C7CB41; Mon, 24 Oct 2022 11:49: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 33307B815CC; Mon, 24 Oct 2022 12:11:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F5ACC433C1; Mon, 24 Oct 2022 12:11:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613515; bh=Qaxm+KpYiwp6r+MQOOQTgNCb+e8i+Jhd85FQVsMX9j8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qpo41qI5cKAS/uMk/Vj4W61c528jGe5gyN3+kcBH6VE7luke398yRt91/gczcqrQj GIPUwoqaSE3XwhzCpjGD9RjVfgE210t6oWNxOgNzpkOX2XV+8j0s+s11QQ6kKvLK8f CLhXlqpJXuk9lGLIAXoAeuJg5s4pVoqC4+muRiww= 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.4 167/255] clk: ti: dra7-atl: Fix reference leak in of_dra7_atl_clk_probe Date: Mon, 24 Oct 2022 13:31:17 +0200 Message-Id: <20221024113008.294491304@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602916262679268?= X-GMAIL-MSGID: =?utf-8?q?1747602916262679268?= 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 f65e16c4f3c4..62ea790d79f9 100644 --- a/drivers/clk/ti/clk-dra7-atl.c +++ b/drivers/clk/ti/clk-dra7-atl.c @@ -252,14 +252,16 @@ static int of_dra7_atl_clk_probe(struct platform_device *pdev) if (rc) { pr_err("%s: failed to lookup atl clock %d\n", __func__, i); - return -EINVAL; + ret = -EINVAL; + goto pm_put; } clk = of_clk_get_from_provider(&clkspec); if (IS_ERR(clk)) { pr_err("%s: failed to get atl clock %d from provider\n", __func__, i); - return PTR_ERR(clk); + ret = PTR_ERR(clk); + goto pm_put; } cdesc = to_atl_desc(__clk_get_hw(clk)); @@ -292,8 +294,9 @@ static int of_dra7_atl_clk_probe(struct platform_device *pdev) if (cdesc->enabled) atl_clk_enable(__clk_get_hw(clk)); } - pm_runtime_put_sync(cinfo->dev); +pm_put: + pm_runtime_put_sync(cinfo->dev); return ret; } From patchwork Mon Oct 24 11:31: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: 9090 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp445966wru; Mon, 24 Oct 2022 06:13:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7C6wH5vjC5vq2hy1cSCe+DFa7appOrJzmHLLhj9A5xRXYRerDzhEW4gzXYJbE5yafSES7c X-Received: by 2002:a17:90a:e592:b0:20d:3b10:3817 with SMTP id g18-20020a17090ae59200b0020d3b103817mr23613217pjz.43.1666617207970; Mon, 24 Oct 2022 06:13:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617207; cv=none; d=google.com; s=arc-20160816; b=unRCuZzyAw6LOVFgFE8fURzQdiRye9LjNQtbzO/NQdymrK1eTUsKN5thHJgAM/Nfl6 SRfRDN7jL9EMFsAhTVzZLsTmPbTUzCosB9rE09Mj+3+46kKDrsOvP/3gYr9XOC1YtAEQ Ss7OEMMGu9hkMNVAufgYGWCKTeo3GBItZPvpDvg5RWYIA/+FjjgZpGULO3eypphQ8MyC mSytXbmeotThAvxnt1IiTIf/ydzWyANa5BsVe7RPbtk4ic7prtVRnTkrzua+eEhQpahG XyQE5F4j4kj+JhqDHZd8UOm3ybIWrtLDmJCbHWCQnW84ptgk3Z7MLQzk3f/T4rFDIS+M BYSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IxX/IiHrCyuc8PH3RAtoB0xqiOVh+QI6bQ/415RmINs=; b=fRrZzcL+rwCbl/0H+VkbvtTcs6YaDeSPMHZm4LiJqCxu92MNfE8FoGFESut6CguS/N 0CMm6dnbV7AYA1DBwr7H+Oeu113Mn6XkxsgRMqhvfUzk8UXKVxB4xwk7wG5VfRPcbc4a +cerhU0bMYFmpPUPHXDqHcRmI3QJdnJW5uFv4vx0A9xS/S2v6gW2s/waLsdTwiZAyR7y AWZGLRTWubCJPn6VFwQEgGSxESpk+BL+gC2ecI8Bw4+W0P7/5Ynm9zw9aTvEnmH+dwmp H0sDMYyHpC7BNBzSXm6/nTTnq3xwsQjRKolpxYFfshKB3/HhdOZL1I7Ii8CREceANt/L KxKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2iYhcub7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902f31400b00186989097d3si5410085ple.385.2022.10.24.06.13.13; Mon, 24 Oct 2022 06:13:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2iYhcub7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235766AbiJXNMv (ORCPT + 99 others); Mon, 24 Oct 2022 09:12:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235990AbiJXNKV (ORCPT ); Mon, 24 Oct 2022 09:10:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 665602717A; Mon, 24 Oct 2022 05:24: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 35545612E9; Mon, 24 Oct 2022 12:11:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43826C433C1; Mon, 24 Oct 2022 12:11:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613518; bh=+qZs5s2FdzLZ3zTM9H0xVRLIwdP/OwjXS0V/QMyZzRk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2iYhcub7UsPho6WrSBiobpc7tRWwV79Dh0BNH33SFmHG4Xy79QRQsGnp6Le6EJ2lc ImzZmnAGCE1Kj+Hjt9xPT+bZOAL233E7EcZHtk2UyGemOou3BhgFzJ53vuSSeRaKAJ ckzKLcYr2JGUqfAwV/ahJnyfEfz8toewS9NJnJvo= 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.4 168/255] clk: ast2600: BCLK comes from EPLL Date: Mon, 24 Oct 2022 13:31:18 +0200 Message-Id: <20221024113008.334497123@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574805554656985?= X-GMAIL-MSGID: =?utf-8?q?1747574805554656985?= 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 48122f574cb6..8a6c6b9c9a6a 100644 --- a/drivers/clk/clk-ast2600.c +++ b/drivers/clk/clk-ast2600.c @@ -579,7 +579,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 Mon Oct 24 11:31:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10223 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp642847wru; Mon, 24 Oct 2022 13:39:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6JVYB+Svx2mv2tT1wCLHiBqP9iXoYehHVSD+PJfe+YE7NKoTWFKjp6cQGE+RJEhY1gDyCy X-Received: by 2002:a17:906:8a4b:b0:7a7:3e17:7f91 with SMTP id gx11-20020a1709068a4b00b007a73e177f91mr6924665ejc.331.1666643985820; Mon, 24 Oct 2022 13:39:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643985; cv=none; d=google.com; s=arc-20160816; b=QDSsdipXHmSFG0huZjvO5crCcjFRW7rbdN02+YkNjfYczdCAJ+/LX62z9mGPkDNs4f JnELIfvEOgcR4KlZjDHuPSkz5b6zc7Irv2idA6chki8S2NbPD1hhAD3CpQXyZunldqek 1xEbDORsscdeqYD8/HRAKB05OLZAZmotgimR89sFspjUhAT3WQrZpoP4qxtme4pydLKO RAkR+pgcucrwKdK1Fwvnxk2Nkyf9GB8EBmrI0S9xc2+jgJVKjNRtASKmnTx9WWLCYQfH ug1TnIgJ8ky2vlbD35UQDXNBkaP34noiuqw+NyLctuXYsuF68fo8pVCwUsk1ZHausZlP 59Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Vdd0NehVAnX4d0T700GtqWmR0cOF83Ce2lYqbGSV9TA=; b=xCc+raRWwhD5Ih1YDdvgNPRlbMndiD1fOfC4TAQgFt1/5SaaKZsfvCTNNuxMbP3Gb2 aWFsPRrHzhhOYI5Ry1SXrIjLo/F2fgz5RsH9zEXj6+YgKMxU+hfQewOBT8GtHDm/llaB ykGO/LS+zPZ5wMfCgC60MvmbUsOD0ig6woydY0PPkp8IuAGrbP5l9pCHNFxkS4m4Gdmr GM3A7RsdPvNJiCcewd2JPjcaCD7l6/kb1YWPVrFWT0pE0hjayI3rqpHtEHRtt2mTq07b eJBefQaKkuiEtK6F2kllYYZ1DV7eWZuwY7j51x0U7S0JUIhfinZv4OKMxUlxQCJrmwrv 4x1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="yOTPdr/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 dz21-20020a0564021d5500b0045902845795si816340edb.557.2022.10.24.13.39.21; Mon, 24 Oct 2022 13:39: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="yOTPdr/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 S234565AbiJXUiU (ORCPT + 99 others); Mon, 24 Oct 2022 16:38:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234572AbiJXUhw (ORCPT ); Mon, 24 Oct 2022 16:37: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 AEF985B9F6; Mon, 24 Oct 2022 11: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 941E5B815E0; Mon, 24 Oct 2022 12:12:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E563BC433C1; Mon, 24 Oct 2022 12:12:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613521; bh=mpW9LaTnpHes5AevAZkGKgrZliGsNsmKn5pSYANPHqc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yOTPdr/vtz5heIWqE7AZgh5p6k2iMvWRyvA9KOrciS+Gzissuk0Jtt1PgpAXV9z2F WvLL82iKHYSVmMSOtOzOGaULCAHbj0oyOlprx2I13tJIjo1r1C+T/S0ba9FZdjcVAP Dk+/4xzhVJq1sELvf9Ra1aFXn5RG2EvbkI4PFMpA= 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.4 169/255] mailbox: bcm-ferxrm-mailbox: Fix error check for dma_map_sg Date: Mon, 24 Oct 2022 13:31:19 +0200 Message-Id: <20221024113008.383353567@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602883672309102?= X-GMAIL-MSGID: =?utf-8?q?1747602883672309102?= 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 8ee9db274802..f7191dbef6fa 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 Mon Oct 24 11:31:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8947 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp435657wru; Mon, 24 Oct 2022 05:55:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6iJSBuKoDZOEZhkm8H9JS8Pq0pizeiXEddlK6UYY4KWMgiWFH78GMcRRHsBOnrr3AH+nmT X-Received: by 2002:a05:6402:42c7:b0:461:c375:86b8 with SMTP id i7-20020a05640242c700b00461c37586b8mr4850719edc.40.1666616105733; Mon, 24 Oct 2022 05:55:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616105; cv=none; d=google.com; s=arc-20160816; b=U70YUei4XzCOr5FjxLC8hWjomiMwIKZlGdvgMOuTi7etoB7Sd9Bo2pXrph0GaALjPI aCDZLtdrVysFqC6MTPQ6t+q2PUKB1cfLCCRmscv6h8r8SMmQFV34aPfl+xL31dLZJdmG gmpl3UWvIPt/NpSqaBAHnRIxOnczXGWNAWptWrjVpFrh0cUI+HTjxvRTxDXAeo7y9jGS ryRw5gWYA9ELPuoOGcruhs0hbKLNCy7q7DUPoUbuHr6A5LgWVbZaLKyR6kxFjqJHMtkC gn4nozEIZeb6DiEDJ3bPRmKGvc8bgmC0/7fun3RgcaKZaCaVPCXWO1RrEHw+hFqMk7oy fZOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Iwk0Q6AW5z2tWT1rOoSDxoOQrmiRVYf8C4ikI+DXAq0=; b=BEUyf8XXJyL47YsfXSj1eONLxjCx9fkh7b39ZyjqBxWbZ1QdcIBlNfK9CIXIb+jdAB qqfakdYpj9vJnk83xF+ZpObLfRHJzIvjvdrSpYzP4AcVgGBC3enYOzLmTVZ7kszFNnxo oebWOAe2s+4TVbrIq7ConEvXGMq7xfL3GLEsKEiGMdIQwXxLSP+/h7yKsw3aQpid0sAA rHhHk3iKagAgFsbTPSh4DHUH9Gh0Jkh6Vop9z0Wjy4jGB2rWqXf+VLCt9UZ00o1zd1iG s0de133+dDXCEeb5CVFYVk5pgCmnQZstTD79cfNidR3jPN4XULHa9/yWT4FkjiCuEipV UdjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SayHFnRw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q11-20020a056402248b00b0044e8fe826a0si25078707eda.156.2022.10.24.05.54.36; Mon, 24 Oct 2022 05:55: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=SayHFnRw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234701AbiJXMxB (ORCPT + 99 others); Mon, 24 Oct 2022 08:53:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230319AbiJXMto (ORCPT ); Mon, 24 Oct 2022 08:49: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 D2A3755AA; Mon, 24 Oct 2022 05:13: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 7190B612FC; Mon, 24 Oct 2022 12:12:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 835F0C433C1; Mon, 24 Oct 2022 12:12:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613523; bh=9MwbfkNRjPJYllnZP1afGD7xpA8qeU7cGP2m/ldY7I8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SayHFnRw1TUWE3JG0L++sb1qma6XpZaWGOwJFff8UiFmvzwJU1DV8t1Uf/CPWc9P0 ZJRsiTChsPzZTGjpY0n/H2A4gW4HFkGQnR0qNVIwGu+oEK/S6GgmaRtuNXWU+UBIjI miKcKWV5yS8WAtppl//rFc7LqwncSOjH0vs7hbwI= 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.4 170/255] powerpc/math_emu/efp: Include module.h Date: Mon, 24 Oct 2022 13:31:20 +0200 Message-Id: <20221024113008.431017658@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573649602006749?= X-GMAIL-MSGID: =?utf-8?q?1747573649602006749?= 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 0a05e51964c1..90111c9e7521 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 Mon Oct 24 11:31:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8948 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp435753wru; Mon, 24 Oct 2022 05:55:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4dLCekgeuwRm6i8yG05n5Sv2F4QiU4xmGjh6/hm++8i5KefYQOKKKFRq4HTRoOWP9xwY8q X-Received: by 2002:a17:906:8457:b0:78d:b793:5511 with SMTP id e23-20020a170906845700b0078db7935511mr27198878ejy.393.1666616124414; Mon, 24 Oct 2022 05:55:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616124; cv=none; d=google.com; s=arc-20160816; b=abDuOLux++WPFTHtW9E53FvgtRYFUPdk6vS+fpa9HFasrVU+mPqZbQgtGBrdrudK9A ES4BP3kxNBWaJ4hRK4+3QbmApX3KQ7ECqtAZR0NnV9QbJRCIbD9h/X2ogdhCPMaLkR4X +RPEmuJxC7Gr5fG77AFYI1+OrFWx1pDfYKBPZLiq9oNTp/wv8CKV5jX+a+Prhkq3XHKd 4hMaM2KDgy9BiwMUp7P1XREreI4GjeNAp+uDfY5mRHNk1Exdxeg93+KUpb1cWlSNy39o ZsTjv2aoe+LZBTyNgmpfc8HQa1t8KSCnPuqpiRE1vXbhnRO0GS770suN5XEsjIE4kU1F uldQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RROoPqgo4uYddrnJLfWkSH89+kTVk+4o2wIEmEt3e/w=; b=TaR6ZgcaR5PLNi44d0x5gU6KYTc+Lw86ET5b2qex/ZKUvlKWe78/dhAD6kk9RkN5bV MLJyhQuPIuUUcnfLnP2U5OWN3a4rgtdLgChquemFBfGuqs6HuECG0uLE1dwg8Ambfb2S 1Ab6d/MSSqnkPPTu3/+qz3ORTYFAgASJUgGDbfNNduTbd8jNBBjOCOPzH0IR97QDffuj 3st03/xwyA1xHYUXyrB3m3aS77/wRNJbakdtcFJqHbV/hREv0Uk3j1S0GtO5wdY2UuKD TjFs1POaRJfD0ewnIQ7U5eQha2jHoGGzmyL37RBtag7lJ0B+V+d+S0oIn8H9vke9xVV2 zHqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=03qMsOTR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qb26-20020a1709077e9a00b0078db3762061si29424938ejc.439.2022.10.24.05.54.54; Mon, 24 Oct 2022 05:55: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=03qMsOTR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234525AbiJXMxG (ORCPT + 99 others); Mon, 24 Oct 2022 08:53:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232141AbiJXMtq (ORCPT ); Mon, 24 Oct 2022 08:49: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 6767192CD3; Mon, 24 Oct 2022 05:13: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 1747F612FD; Mon, 24 Oct 2022 12:12:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 289F1C433C1; Mon, 24 Oct 2022 12:12:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613526; bh=FpXhnLqOG5Yvh/g9j3Y6llbNQVhcq7oq+QMST9zMdbQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=03qMsOTRmFwz9bX+tXVaifosibJDbKfkCCexCDT4anMrjo/SwoylqRXhfLhDKQ94j 1m/QC98NV8K9vxgeYInBB+NUPM5OidU1ZPEhDuIw2zDAHEqr3HOdpPS9GUW/35KWiw iICDHHQX3e9HxQ9RPi8QGlqG5qIPnzpdXJb68rnE= 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.4 171/255] powerpc/sysdev/fsl_msi: Add missing of_node_put() Date: Mon, 24 Oct 2022 13:31:21 +0200 Message-Id: <20221024113008.469549959@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573668855645016?= X-GMAIL-MSGID: =?utf-8?q?1747573668855645016?= 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 808e7118abfc..d276c5e96445 100644 --- a/arch/powerpc/sysdev/fsl_msi.c +++ b/arch/powerpc/sysdev/fsl_msi.c @@ -211,8 +211,10 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) dev_err(&pdev->dev, "node %pOF has an invalid fsl,msi phandle %u\n", hose->dn, np->phandle); + of_node_put(np); return -EINVAL; } + of_node_put(np); } for_each_pci_msi_entry(entry, pdev) { From patchwork Mon Oct 24 11:31: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: 8949 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp435757wru; Mon, 24 Oct 2022 05:55:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4zYqNQeFWxSHDVxxLlwVtsNNuu/LlP8iuEZT2cGnhhkd1VYanA6l57fiQs5TjewTkwWyi+ X-Received: by 2002:a63:804a:0:b0:461:25fe:e7c5 with SMTP id j71-20020a63804a000000b0046125fee7c5mr28625652pgd.395.1666616124529; Mon, 24 Oct 2022 05:55:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616124; cv=none; d=google.com; s=arc-20160816; b=KjIvdi1IpBI4URME100Ntr7bUaObTSvGTMuD1gksL1UfOtiNDZlA8URlpmWUQq9LFJ 2dSFRt/kB/omDfLm1fPJVvlCoKVIeHzQPJ/oWYKoOI6BCJvhEJUVEnVryV9gV3PvhmF3 e/znB4FNimg0XdevpRSvl8xGpjN+tqwVT+7pKPt2rsGU1ElGLNWoEJ2iJu0tiSkerTek qhsk+7d+MfQIjF9x6uNi4I6nlUSpg+dBBhLmzUTKvLDvcs4sIOW5YdH6A3/EPlUaTL6/ 7aepocYCvS7xaE6ejcqdqBTEyszue2d15s9SiEcB0M5cqxXx7cL/FLQci7E5MD9n3Iig oW7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZeJTlCQ0Nrcjnw8GslUTJRF9NOEJ2QmtO/YwA20Sq/Y=; b=eOuT4o+QM17qFhm7sruI4SXCriBpgg7vXtM7I007HSdba5bQH2WiKlSZR/GOZYnWHl BnJJiNmXM5WNQU6KGMvVOBeJV9zl7c26YaMa/kgqwLTlaNhKSW2aEZQA9wqgFrSs5hu8 yGE2tlbq00ery3E20I/MYK1f6MtG9qQCXzo13psXEJamEeHXAAmw/v9z10Xp10af844S NhIyhqzOcEL3X4i/l2y8Op4o0eISrvkJeI8+pLqzZTg2QLQaXxuQeWBpVN1bvrSlE5un 4wSjHGfOTQPtJdYiisnadzKKO/KpfMDYwjThTWCBg2JvKhUiOKbsqF55dCBuunxNZ+Cu dV4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Epd8wVYd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902b08200b001747ed48ee8si30666297plr.150.2022.10.24.05.55.12; Mon, 24 Oct 2022 05:55: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=Epd8wVYd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234539AbiJXMxM (ORCPT + 99 others); Mon, 24 Oct 2022 08:53:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234529AbiJXMvg (ORCPT ); Mon, 24 Oct 2022 08:51: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 DE112101C2; Mon, 24 Oct 2022 05:13: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 AABD8612FE; Mon, 24 Oct 2022 12:12:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD8F9C433C1; Mon, 24 Oct 2022 12:12:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613529; bh=QbdfTwb918X465SnDLFPDScYTGIArpwH5oy7h7MXV6w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Epd8wVYdZAH4ZD2mICilEUKvz51CoGKyG9A7BF9fGGiR7DCGFna4mhOy12HZlzr2h nxYb/Z/t86K0x0NeaFH3xt+lh3+f8gNPpFjTxskcT4oJNzDrRuc7mcjWZPbhmm1kas tbNZcngOTQhJjBXyc+qr+PAFuH0xuodvm/7eN1g0= 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.4 172/255] powerpc/pci_dn: Add missing of_node_put() Date: Mon, 24 Oct 2022 13:31:22 +0200 Message-Id: <20221024113008.507791202@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573669578794435?= X-GMAIL-MSGID: =?utf-8?q?1747573669578794435?= 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 d876eda92609..d28433f0fc8e 100644 --- a/arch/powerpc/kernel/pci_dn.c +++ b/arch/powerpc/kernel/pci_dn.c @@ -325,6 +325,7 @@ struct pci_dn *pci_add_device_node_info(struct pci_controller *hose, INIT_LIST_HEAD(&pdn->list); parent = of_get_parent(dn); pdn->parent = parent ? PCI_DN(parent) : NULL; + of_node_put(parent); if (pdn->parent) list_add_tail(&pdn->list, &pdn->parent->child_list); From patchwork Mon Oct 24 11:31: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: 8960 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp436470wru; Mon, 24 Oct 2022 05:57:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4aru22a51VJGeSewbn74VhwTetRhkyM8UAHunjgWxCidjpUrnq1te75G4Eo1JTR4kV/olv X-Received: by 2002:a17:902:c407:b0:17f:8bec:e7f4 with SMTP id k7-20020a170902c40700b0017f8bece7f4mr33304833plk.156.1666616238473; Mon, 24 Oct 2022 05:57:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616238; cv=none; d=google.com; s=arc-20160816; b=oegJzaD7d4OrCprjoWRKAIUAlD/JP/B1j4M/Z2UH7SAy7vVwQ6tmyiv5Lw/7KbtlLs rxDoq9lYB/CH1yYZglYxFUgqJAFGzGJkcS8/0b32Gkod/UimN2T/UYlfXBYC+QWORQt/ 92PxgefLGqQi1kZmhwTnlf11IqYFhd2XU7Ngge2Ph1D3qY1cNlwQZVWJzbdQn3w4SZCk YaaYoNm+WRvHrbehitZCzlnB/h2Sw2uaHD0LPIzuONjp3HJMRiEZAKNizjxyxBllraqR VebVPPhAp2XPAkiZcojceFy63sIgUCdw9hsoMH3qk8V4dqC7T3XpZK0MYaE+pvje5NKr advQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pUSxf0b7e7cshvsZQ0DUN2vYxrMF8yuu21db3cu+vqo=; b=RVYCKiZy1fL67o/3jgjHsryFwchfvWkUw2K4qMdgOtzXdtIDEAWlWbPVO22Ee6Vo5e LEsh8xjKVuJqvJMdvNhZXU/rJapM5sW+s6NsLCKYX24HSa9makZalsRNdUqXe8z+lwG1 kPAnd9aph1Q+Nio5Tea1QE+yNNOXMNgA4SSonROB9WcNkJLYP10jt+i0RFuzTsBYjBoB /xeVPX+wp5q4iFl3DmGy22QsMuP4pz3If621O3XQWMa0YrzHW8TOujkX5B843v7ugme9 RQIu9y+ZcrSbOsEU9G21PwrHKTlJU5vvYlSyvN1GlQEYT5MVccdYDjQuAnluqiTyQD2f Q63Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vZadaG5R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pi17-20020a17090b1e5100b0020a47a4c951si17694139pjb.147.2022.10.24.05.57.05; Mon, 24 Oct 2022 05: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=vZadaG5R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234560AbiJXMxS (ORCPT + 99 others); Mon, 24 Oct 2022 08:53:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234533AbiJXMvg (ORCPT ); Mon, 24 Oct 2022 08:51: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 F093D9258C; Mon, 24 Oct 2022 05:14: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 EDCBD612F5; Mon, 24 Oct 2022 12:12:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A6C2C433D6; Mon, 24 Oct 2022 12:12:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613534; bh=hbtamw6ANcLlqJnUj99gi/JOS6QSE39ZeJmw7FKhYkk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vZadaG5RogQjdWakBnjc+TP0XXW1QKBc+/ywG3dWY1seIF9BxcKxAg9gyKUTosv80 k/3AhAPhGnE2SkXyEhdFVCDqczi2Dkg5DvcDBWatSK/GnFCFeXBoisJgYUA1SQdjoo xmXWkCcubIfTNFB9NtY+05JO2lN23boJlzzMAhsU= 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.4 173/255] powerpc/powernv: add missing of_node_put() in opal_export_attrs() Date: Mon, 24 Oct 2022 13:31:23 +0200 Message-Id: <20221024113008.547706982@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573788514933944?= X-GMAIL-MSGID: =?utf-8?q?1747573788514933944?= 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 38e90270280b..c3f968429161 100644 --- a/arch/powerpc/platforms/powernv/opal.c +++ b/arch/powerpc/platforms/powernv/opal.c @@ -776,6 +776,7 @@ static void opal_export_attrs(void) kobj = kobject_create_and_add("exports", opal_kobj); if (!kobj) { pr_warn("kobject_create_and_add() of exports failed\n"); + of_node_put(np); return; } From patchwork Mon Oct 24 11:31: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: 9513 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp481932wru; Mon, 24 Oct 2022 07:24:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM76TZc+Yxcme4zLyU8v4BlM1QPnRRcbNkuCeAWUR6Mbv6tKX/LaF9pyuHtg0Q8uadBmBiXh X-Received: by 2002:a05:6402:294a:b0:461:b661:d903 with SMTP id ed10-20020a056402294a00b00461b661d903mr6392341edb.407.1666621442856; Mon, 24 Oct 2022 07:24:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621442; cv=none; d=google.com; s=arc-20160816; b=HoceabVEwQ/aREhX4H7ISruFT0GmDl/VbRq1DwTMRwUGtPyn6bBXPS+j8nwGfd5rCA ATBUnn5mWzDm8QmlbJq4pmXfmKCPV9LBFdc7QjAlggCTzhNm1M2R4U/W29JbxAKY78qf KB+QYThnT4Lz26ItLA5N6n9csgwNElPqcBf9iRCbfc4dPJZwZCyKpA4iubzGWpG3Akxq nIiCGYI0JyTjB8NTJq2nv1yiCLt1tT+9lvpm5tucu81zu66WV7uY2FPvC6RIW5x+1HZU 9b4kgJv6BeexV4o5jS/HHsDzspKEyBW3fgI+JN87fPqlwV/LOksnba5COuOu4W9W/Fvg K1Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pIW9RJtYE0gAx7/0rNDNMzcHJQ4CpPLFzEJC12OSt1g=; b=dD+SPzryVOGy4NRFmDCUxiGuXPjo4TxYgbtCtp44xFYxFrYZxBJifoUEXfRe+xp7iO d6OzFsroFu0nFSk8jB5TKfYxQVI5ZoaIji/8iE79nxbEQ2ruhfRKg+0JMNl76zS+n6LK SwRwZQZ/4Ie4A87YjgWKiWVg3tDyVMyx84o2npr5HLl/mHcI+bSb2kn8aSKiLROFqanW bkUnVkvI42vpcWWCACrvbCnvY/c/kwcjkKDTWLAue124PIobPGHIfz/tMk9Git0oTQGS /txsHQIqUMvno/uZYS+iq6BkfKAPLkBcTKnvskteQskSVcfTGfxh/2halQxQanGmaNaq 7RxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YWqtFfOi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170907990300b0078db376206esi21761355ejc.783.2022.10.24.07.23.38; Mon, 24 Oct 2022 07:24: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=YWqtFfOi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235883AbiJXOWX (ORCPT + 99 others); Mon, 24 Oct 2022 10:22:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235284AbiJXOS6 (ORCPT ); Mon, 24 Oct 2022 10:18: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 4CA529591; Mon, 24 Oct 2022 05:56: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 9A354612BE; Mon, 24 Oct 2022 12:12:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF9D2C433D6; Mon, 24 Oct 2022 12:12:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613537; bh=jiBE9ldZ95s6Eq+IwVdkpKMHD+c7DRPI0PUQXSs9z2A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YWqtFfOiHxgC6MXJunjMBSFbJRYE+ZD4aRy6wetm4/VahkNYepenAZk52u/dFLAT1 reUY/On5lKN60qPFk5K2jAXqV9V4yKJko0DbiNNgK4OUTCdx1rBGtu9VULTJWdMKLG NVHrZfU1O/Z4QycJABrG6OYhhq/x3BpAdgHfDUpo= 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.4 174/255] x86/hyperv: Fix struct hv_enlightened_vmcs definition Date: Mon, 24 Oct 2022 13:31:24 +0200 Message-Id: <20221024113008.599077327@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747579245881530399?= X-GMAIL-MSGID: =?utf-8?q?1747579245881530399?= 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 7741e211f7f5..333e61e6dbe7 100644 --- a/arch/x86/include/asm/hyperv-tlfs.h +++ b/arch/x86/include/asm/hyperv-tlfs.h @@ -721,7 +721,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; @@ -729,7 +729,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 Mon Oct 24 11:31:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10194 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp641899wru; Mon, 24 Oct 2022 13:36:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6GV15Xf1dq3ykZx87ZCDsCLWSQtsW7puU/DhdlncWujDn5Lu7FJ80zyGQRXOvTG2gyCX6V X-Received: by 2002:a17:906:4fc3:b0:72e:eab4:d9d7 with SMTP id i3-20020a1709064fc300b0072eeab4d9d7mr29130085ejw.599.1666643809209; Mon, 24 Oct 2022 13:36:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643809; cv=none; d=google.com; s=arc-20160816; b=y9+/28oIF2Yi9RMe2Khw2BDbT7ZMqMaU9lU/G7yDDyfUFNgA0NbFlehwxVe2CYTAiu y+O+sK+aGk9nS8CeO2LmtKmKx/12UYbLLN6/RscLqpfVNsAWreoKYJ565NMcRO31hETT +zms6e1ua3FiR9hVdrOGmn21kdEP9weXKdEcw2hLyWRCuPpalfFdZ2ZPdmJAUmBPtgg/ CuEL7kU1yWC3ZZOKjkjDK4Qt2R/2AMCalSLus3cHvumOQp8ikqXnOn6Y9MX9YADZOi82 wMXPt+bkUJ11mA4MGZY+AmasFcolPNIsuA8klhB6opDZMn6aBPywouaAqwRvIYsSq37N mUxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uggJet0Komhaiy1sc5ND+HudRlIewWcl9B7Jcz0ntT4=; b=sW+ySNT6kzcEEVxmPHd4ojfimsmXpwdPgEE7M7VuXqmv28A1d0hPT5RVnMvjOE4Odp iCY+OHQ46fiQ1Rff7RJnIeOsE4jJG7ZHN9W1+npOV4fD+T17uVO89aCHSJ2i4qvzQXte axM8qDHhBCQFAGGTxiNCz5em0RGTtCIJfYWeY3eggVmAE935I+sNWesSg69TpuZvgZQM owlWok6mD1VCBYkM6FWO/oqDH/n4f61n+MQVO/x7TsQ0BfWDxYvZbiZLRG12dc/6Z9/s RYBtqri6T76Bt/DJ4+hgWNcJ/BzEtUXOqKOyJdbMUHHBYxyam8pFzIqguUtNPLATvuve jGng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ntqyWUT6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170907724100b00787abcb1ce0si663246ejc.679.2022.10.24.13.36.09; Mon, 24 Oct 2022 13:36: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=ntqyWUT6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231699AbiJXUXf (ORCPT + 99 others); Mon, 24 Oct 2022 16:23:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234129AbiJXUWy (ORCPT ); Mon, 24 Oct 2022 16:22:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6CCFB2DA9; Mon, 24 Oct 2022 11:38: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 0572FB815E9; Mon, 24 Oct 2022 12:12:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51EF5C433D6; Mon, 24 Oct 2022 12:12:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613539; bh=BVsRkkI+Jwqv+WohuOIvxh7su6MF9Z/mPphzuwKvqyI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ntqyWUT6loksrc7pc2BJAt2TC6gEOyuNOsPdOn3jHgTICFK0vEEFx9YcPL3Hq2RXJ 7/wb7TWJGv1NoJf7EQyeOtwcSIKOWu+/4bQx4nmwSdJmZ9S91UUI66f0A8lz4j7ON0 edQHQB3rSbo78iWHaIvYTU82otFBePdNTIwDxHYM= 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.4 175/255] powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5 Date: Mon, 24 Oct 2022 13:31:25 +0200 Message-Id: <20221024113008.637861914@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602698569157415?= X-GMAIL-MSGID: =?utf-8?q?1747602698569157415?= 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 eedd114a017c..95183a717eb6 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -155,7 +155,7 @@ CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power8 CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power9,-mtune=power8) else CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,$(call cc-option,-mtune=power5)) -CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mcpu=power5,-mcpu=power4) +CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power4 endif else ifdef CONFIG_PPC_BOOK3E_64 CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64 From patchwork Mon Oct 24 11:31:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10169 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp640588wru; Mon, 24 Oct 2022 13:33:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4eC8aGbKwMrbLFEUAgAtfdEpfVIS98Cx9saNJx6rPOjX+7P0GZIWb3Ck4n0wOuYi7Y3kZL X-Received: by 2002:a17:907:b0b:b0:78d:8877:9f9e with SMTP id h11-20020a1709070b0b00b0078d88779f9emr28883277ejl.693.1666643580922; Mon, 24 Oct 2022 13:33:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643580; cv=none; d=google.com; s=arc-20160816; b=f5sZh1fUJ0MIsJF24pVBgtSbD4og7v5oRyv8exWRRREEH/X/IJP7vOfn4x4x3IFeqK XRjWHMjNm12pdLffOZc/RdCFxploucvUtUecmoMj9HdFgYH/WFpc+2cyAx44eeR9Dibi cNcPmlfwCXS4T4oeAkw4Ru1NMMVb2kK2VWgVpHlfBhke2zU1jIXvfwhiJH9jpGQ47NQk AwKDQsNBl3cVt6iebbB3ZPnzqsAQ4Wygy4THFRdeB63FCGdWmz3RZcdo7KfOH2ZOr7ER f0OGXoxWGEtX2iEAvSvzX0KlsiHGMI3wVHYLfzp0qS7e18V/SojtIMI6LV3ePkMX8lnh +8Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=zi28PoMp9N3IwKTC7/rtffUE8+gdE2cmp0wQFlicLcei3l7pP6gNFtEB+6WTpkTC3g HeXdwEktvEMdeA+HOVNbyUortyeQvCJV+Mvhvrze6esUERi1Uw2wpzWXfjEvHBmz4Y8n DgRkKEAP0JUd57hcP3qzd16IGqRJoK4WwYAdttqKPekaBRh33HkRH7WCJ+HN6m7J8Ori SPQb69cqV6WwWlVRwFNrDBn3jacbt6WiVMfGB/uouX9mT8a1jyPRXn/augY6knr1n+D9 5NrTIx4UGLTL/QQ42Fazf1x/W1m2m1X4AHbUMg2DzCouI0iCQwRF9mufLdrNVoeZ51i1 b3TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Vk1oLlUH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h5-20020aa7de05000000b00453b9f11b56si598987edv.261.2022.10.24.13.32.37; Mon, 24 Oct 2022 13:33: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=Vk1oLlUH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234265AbiJXUW2 (ORCPT + 99 others); Mon, 24 Oct 2022 16:22:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230335AbiJXUVh (ORCPT ); Mon, 24 Oct 2022 16:21:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 777622CE1D; Mon, 24 Oct 2022 11:37: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 91C01B815E5; Mon, 24 Oct 2022 12:12:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE80AC433C1; Mon, 24 Oct 2022 12:12:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613542; bh=l0qQ2lCaxTmpz63zjBz0GZTyNJRYUHWb1NPdjSlk1wE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vk1oLlUHKYjalHdeF79E4YUqmxb9o97OZSa6nzISLlZvT99uZl2zxfeDjt7GNcwfa x4x1VL0JXIXLljqcwwFBluXormy/UC7OLVPwtjY7hVbuifEGX2iUfAxQbmmQIx6x/Q RX0kSOF1WNZXgEgc/5CUYHf3QhOFNtw2IIFd1YdQ= 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.4 176/255] powerpc: Fix SPE Power ISA properties for e500v1 platforms Date: Mon, 24 Oct 2022 13:31:26 +0200 Message-Id: <20221024113008.678272331@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602459473436803?= X-GMAIL-MSGID: =?utf-8?q?1747602459473436803?= 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 Mon Oct 24 11:31:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8952 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp435924wru; Mon, 24 Oct 2022 05:55:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4/275SthyoN/SvOqNigwY7ZLO5W057M1IeBp8ILec6gjN9t3fGfuU+JCB4wRtJthrJxm90 X-Received: by 2002:a65:408b:0:b0:42a:55fb:60b0 with SMTP id t11-20020a65408b000000b0042a55fb60b0mr28366039pgp.431.1666616153012; Mon, 24 Oct 2022 05:55:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616153; cv=none; d=google.com; s=arc-20160816; b=cu4IfEpKG2F4nTKLq7+MfDHfAowGe1gxUMkLDJTB7yec68Gpo4nt5WHa1RBPgEQ/hJ fboJEQvd6HIpXwaWz7EU+rzESArKXGFacyZkkHIYeZTrbiifNsn1g72flfl5Wx9yVlVj j/+28Mk/jtmJmSPmQZOPv98bQ5XaFnhJOhJJWF63S5TqH36tVNhUKbl3MrjfTLoK/ZIS q4SCZXJLcfGTmf5/0D1rPb1kOkmTxBQr9syfkZT0c2sytfNcH4ZDE8gO0xUNrm1XlPPE P9ZeKFpgSV1myFwPY1y4dH+w6Q1mO2Svaqi09sxIyGycf0UIJBg0KIg60sn5R5X3nxua 3TLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Lto0GJlPW9WHUFjTt8CkafVqZyrGSwO8ZPX0Z5t5eVs=; b=Mfn6DGUdSXzv77Tfp22N60KizbRomwI+1vUm9epm+yKkrZ97TCJy8ib06kRjIXxqI1 MWrUmV/+ZB0hHNkPFO3G0SNAXUtkd3GG1tqMGpH14VAEcpZR4oMto+a2W13dGjFero6X dd7JNK2rKmmcxKcnN8RNCzkj12jYZ/6ALHn2kZe/2bJyKDp6kOg69C/2ITGEkrSy56K0 3unmzdoTMP0/Bdjnp4D4+YCHwVxOH4YfSQc0/JQpE100AlOtr30OE+4MMHebL7eegPSi 5GX8WSLeVbantilA83SWqTn7A6aUloSdbzXimQS3/rVdTNy5/GPfIp/idlm3ITl47145 wK8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=N3dV3cMR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t14-20020a63954e000000b0046ae2a8ea9csi35812855pgn.733.2022.10.24.05.55.38; Mon, 24 Oct 2022 05:55: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=N3dV3cMR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230319AbiJXMy0 (ORCPT + 99 others); Mon, 24 Oct 2022 08:54:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234664AbiJXMwg (ORCPT ); Mon, 24 Oct 2022 08: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 43D45101E1; Mon, 24 Oct 2022 05:14: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 8170B6128E; Mon, 24 Oct 2022 12:12:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98031C433C1; Mon, 24 Oct 2022 12:12:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613545; bh=P930n1nSM3z63KMYHL4L/pCD1C+IPjaalcWZsoat+3Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N3dV3cMRgtThcS3ympUH0KXVUxDn/8eDZmbrvl4yovmx0vfAgRBs9Km0Cb6XWNeXh chUhkJVygkj3k8vj5InIqAy/rbIPIesMZyTVybyC2j53xnCxkKSgAb10eaJZXHscs2 j59DSxp9HjyzxvZHqqXnt2DjniSMHbY0/KEseZ9Q= 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.4 177/255] cgroup/cpuset: Enable update_tasks_cpumask() on top_cpuset Date: Mon, 24 Oct 2022 13:31:27 +0200 Message-Id: <20221024113008.721313707@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573699159630376?= X-GMAIL-MSGID: =?utf-8?q?1747573699159630376?= 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 9ba94a9a67aa..c7f4526ca64e 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -1057,10 +1058,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); } @@ -2014,12 +2023,7 @@ static int update_prstate(struct cpuset *cs, int val) 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, &tmp); From patchwork Mon Oct 24 11:31:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8955 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp436113wru; Mon, 24 Oct 2022 05:56:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM47SLq+FLNVkxrH26EN/R8V90YD7z3SsQtkFDhKWXUltN4ijhoh6zQNjljOMA0hGencpeKg X-Received: by 2002:a17:902:db0b:b0:185:51cc:811a with SMTP id m11-20020a170902db0b00b0018551cc811amr33168854plx.85.1666616177501; Mon, 24 Oct 2022 05:56:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616177; cv=none; d=google.com; s=arc-20160816; b=hZX/0ecjvhYbpF4jYIdZ+MAkTykjMa619wMelb2BBMXdByPB57yRHDX+yPdMSFbh3d VxP20hIIGXZ6xM1fZ48WWkW+XSWjqDob9yQDcvQ+RxZQKuaLhaITFY5izsTGg2p8LQMQ I3OGKpbb55BZMbHuCdK2kOTER1oomnEsQKhLV0FgWRdptOaMwTZ7xXhLF1/ZvpEjtX+Y lqZKdS9nHu00AReg8ij2r2Vx7nFfEkSJ33NzBYqnViPSoEJTVsFq7YTcWtKpTrFOHhuC rR3T+ehP29/HvZKiD9HaXgKKD0SthezZMOsIPm0oivsQEwCvy+FYR49Y6bG2xBU9jCXu NbJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=QFcPds9eeMzt18VznIZOjzkm08R01QCjPvwedHkmQaU4OxEiY5V4PsKMnqkJ6Be7W1 UnhEOBuoPYtPGLXmZaIkz93qSQdQ8FPqMZgWmdAotjddY3bYkFeEVxzmL4pQqQPjtr04 WodhVHXCVfPSqnEI/8+uDuC1UPESRNdw3FgJDIf1Ijsq4j2psgfe6CS6JmBO1cDP1YcQ RfULEGb1l+VTsQ8ixEBGbITl+ygGju34fR3SwApSxsq7/0j5RwuFf6GGMZTYXJnmJfct MYX39p/346CGvop6jobEqGT9pSfZ4dsxefdzipYHsafBM3EjD3ciXGoDRQNVOklsMvPG +yWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pbfIA83K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cr7-20020a056a000f0700b0056bc627dbeesi3268829pfb.124.2022.10.24.05.56.04; Mon, 24 Oct 2022 05:56: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=pbfIA83K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234455AbiJXMya (ORCPT + 99 others); Mon, 24 Oct 2022 08:54:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234523AbiJXMxE (ORCPT ); Mon, 24 Oct 2022 08:53:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48294326D0; Mon, 24 Oct 2022 05:14: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 24727612FF; Mon, 24 Oct 2022 12:12:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38E0DC433D6; Mon, 24 Oct 2022 12:12:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613547; bh=AlKGxA5oHb1mhMs88++LuDXBhLryEnVpofotGpHubyE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pbfIA83KIIxpBwWK3zzg0448uAACtnfj2RRDQqt6WR92AL/++gjC+JhYRV6rH7pxa /uHc9sSmnELJ+F1tZ04qyKql+OZxcutofNtWjlxkXZnMViYISlxJmGyLKomoy0TTQT ++okFCTuoBpcU+k3NjK8dmaiUfxz5aw+u6c88TDc= 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.4 178/255] iommu/omap: Fix buffer overflow in debugfs Date: Mon, 24 Oct 2022 13:31:28 +0200 Message-Id: <20221024113008.763948658@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573724814827290?= X-GMAIL-MSGID: =?utf-8?q?1747573724814827290?= 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 Mon Oct 24 11:31:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10183 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp641437wru; Mon, 24 Oct 2022 13:35:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Re6jQ39Z6vxOrJ9GazWeFNb2VFvCaCddr2Oi7u4RrCk72NygER1gym5C0f5SYsNk26Z7V X-Received: by 2002:a17:907:72c5:b0:798:1c8f:5bc7 with SMTP id du5-20020a17090772c500b007981c8f5bc7mr21138931ejc.119.1666643721371; Mon, 24 Oct 2022 13:35:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643721; cv=none; d=google.com; s=arc-20160816; b=L8v17WYkXLBSYMvMo7z+ZJyDsiJ3Nh9aPc4GqONzzPe14UF20inHUaxnqK53Q/CqIn 2HII4LerRynZA2qoVO7einDxiOxkbxaS0lm30VSRBqkt3DjIV0h1yDtwtqg0btmUNSfZ SrODJxNthw1yD0exVOpaTKQyfJzcclAnqKcxcNMeXiaLaFRS48b9U3W/LN7gubBtYG0y u0RhubofxJuq/70Zsrb7tWrrSDD2tTKv2cSxvpbJtmm82kqN1tsb7E20n7iSrqqwW/qm Fn+0jtOBh29rMZw3FfGPsBrp9eMYp6aPaIprw5qvfX9yAHotU5opA5JoO9s32TgTzF+J 0//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=q45SsG4p94KSdzE65sNEZzG3xX7TVecEGbTAKmmOT4Q=; b=cKnNcK/7/1aV8UWjamo8H+mvxYPdSX9goAnNeoeKI04ag1yXoqgSobbXcaWpQCaOK/ VwyHwVHTDy5gCd+C1KKNUyE6c+oQ/t/+SbOzZdHSkLIgUHXj6deGSRIkI5u82XHHsZDi jHBFu6CUYSRdC3PNJJWUbuld87bfcdLCghVy5YYQGZGDm51DaC/THveIZpVTgXcklGJo FytCiXEaolC92ce0wDVuPUm0cT9yOTybKHt+aQJ3qwO0zVWM/z8vBHPbCCO3pmgN9v0E izRoZLJEKkqwp0LPcgYNIRibEKu5DcMsRg5XLr+YhACxZIlYH7EIcgK2N0FA0qMd+rWO 1C1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="n/H54K16"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170906794f00b0078d23ac6981si677965ejo.790.2022.10.24.13.34.56; Mon, 24 Oct 2022 13:35: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="n/H54K16"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234212AbiJXUXv (ORCPT + 99 others); Mon, 24 Oct 2022 16:23:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234243AbiJXUXB (ORCPT ); Mon, 24 Oct 2022 16:23:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8AE8AC4AE; Mon, 24 Oct 2022 11:38: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 67A07B815E6; Mon, 24 Oct 2022 12:12:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C39E1C433C1; Mon, 24 Oct 2022 12:12:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613550; bh=2HjTKxmeeRJf9SO8vt0eJKqSwURDpwCV1KyIQ4MKMTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n/H54K16RPKpyppJljoHY38ghbRPd4YMIL7z+722W+JEkn2kYVuefDro9/V5DL359 bEEvIqinJkU6D8VAsKf5qzfShfDnnSpx/HtMV+FdTjIzVJn2i6UuoVihQDBCRSrNS4 2sIHG/goL/2DY3O/ZNrxxlwxTlGoNibruHLLpi6o= 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.4 179/255] crypto: akcipher - default implementation for setting a private key Date: Mon, 24 Oct 2022 13:31:29 +0200 Message-Id: <20221024113008.816417193@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602606805339608?= X-GMAIL-MSGID: =?utf-8?q?1747602606805339608?= 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 7d5cf4939423..ceb0c2fb2b24 100644 --- a/crypto/akcipher.c +++ b/crypto/akcipher.c @@ -119,6 +119,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; @@ -131,6 +137,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 Mon Oct 24 11:31: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: 10168 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp640566wru; Mon, 24 Oct 2022 13:32:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4K+qNyrw52Kqa4tKMQrDNYseEqf+CGY66NZpVUcv50MDFnOzf7R038TkGEMKZdwGPnar8t X-Received: by 2002:a63:2f45:0:b0:457:dc63:68b4 with SMTP id v66-20020a632f45000000b00457dc6368b4mr29495669pgv.228.1666643577440; Mon, 24 Oct 2022 13:32:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643577; cv=none; d=google.com; s=arc-20160816; b=nDWSGSLBbJyd3nTleSNshhQ1jHsmvylCjoh2avPa9xO666Mi8EAP3eZueSOaS+dK4d qh8HDFDBQ5ku4MG5MqWN4fbtX4Mo8Fg4B1j5NCIsibiWtcLPxolW+WzNiHE3GwR4hsxj lkAkiJfkD8lDoSEhxx4fG065AywtCR/lnSd1vrytWqpF+DmEhJuJdeI7ZNqEyPh+eq6t lzODnjIOunDowU1tgOwVksh4CIu8cWL76fq0ZmvA3LPMnXqPFVlOclRHppUSMIETlF6M C49NWQcTRY1CzdoUZXrytVLcYkBlMsX1LprzkncIABNZmFl1XYcPGNsViPpqyqYhlIBp k7PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=io5qfRANefCYz9sWd9kgRUXqmX1h4Bue7mawuWIr6DE=; b=wLkwuhFx7CMSJJkMHARhztI0/VVVJyqMyvmnXJg6+FDGUPkF70DkhhrjstU2mw7evH I8OqxnjBGJU0S+hCm01Wd9HrcP9bNFFj19qhQyoHAm+4ouwABpz0Zav5VJ4CaXczCcny hDSJ2OZLgQqsfcHMnkXb+B7p+SPdZV3W6B/47rQmlqlgMAtFqRHD6ouxVds4JWMaBSGJ NTrY6Vk3cuS9KywFkRWVPNqtzCqeHMpl2f+4LXctRFwGl9kaetC23bNDhv7B5lWGgM00 GTz/F0bPaTadPq7tfzzpXLADxIR33ca7DDs8mmLUTChAwthEzWz1+uHt2X7Jsn661Ct9 dtyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GIhWzstZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lk3-20020a17090b33c300b00212e70e2c25si11117399pjb.165.2022.10.24.13.32.44; Mon, 24 Oct 2022 13:32: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=GIhWzstZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234226AbiJXUWk (ORCPT + 99 others); Mon, 24 Oct 2022 16:22:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232593AbiJXUVy (ORCPT ); Mon, 24 Oct 2022 16:21:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46E8C19DD95; Mon, 24 Oct 2022 11:38: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 191A9B815F9; Mon, 24 Oct 2022 12:12:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67E28C4314C; Mon, 24 Oct 2022 12:12:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613552; bh=LFrupX4v25cr6gY6G5bOu9JuHOtT4txHADScSlAhRDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GIhWzstZB1KP93D6n2+Q8HN6EQH6frplJWSJIj/Yae2pjCHZ1/cstel/Ns9KAZL82 e33SCoAWPfw9EuLogflZ3qwaxR+wXD+7qx2Q/a/JvxK4MUsYb8Uf82SHSFZDGXrxi1 sIOLCkBPN172qc9LYPGoJNmjSf7PlNl6BBCyefoI= 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.4 180/255] crypto: ccp - Release dma channels before dmaengine unrgister Date: Mon, 24 Oct 2022 13:31:30 +0200 Message-Id: <20221024113008.851338831@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602456173972477?= X-GMAIL-MSGID: =?utf-8?q?1747602456173972477?= 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 b3eea329f840..b9299defb431 100644 --- a/drivers/crypto/ccp/ccp-dmaengine.c +++ b/drivers/crypto/ccp/ccp-dmaengine.c @@ -642,6 +642,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); } @@ -767,8 +771,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 Mon Oct 24 11:31:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10331 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp669349wru; Mon, 24 Oct 2022 14:57:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7wI847fXnRewmJjHEFAkcQSrztgmNSq1rQK3WP52cR0trg+9R1BSNquKAGWtDdqWS86lZY X-Received: by 2002:a05:6402:4303:b0:45c:cd3d:f5 with SMTP id m3-20020a056402430300b0045ccd3d00f5mr32438745edc.188.1666648632474; Mon, 24 Oct 2022 14:57:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666648632; cv=none; d=google.com; s=arc-20160816; b=cK62UT22dZXt7Nrw8BjWkRVzEN59iatf3zU6c9KEdoyZr0KNqFTOhhxQwWfepL3H3b Z+mRUSy3xhQUUkkYSBmnFRhYsztFe/8GmQvmL+JsS51qxJTf4ck/gQsGYO7L+NTbFkbb Zmy9F/9EfUaBwAMMOJ4PHXfpPU4kMN488T3IdI9cPPgtYPTQ/+LWiJzmLZMluWCyfNET 2GomDXsbFxjigGM5wGIG13T5p4SW50O4iYSiEsnu8wVQ6OPCDegQkwr3E1trDBvJx8ym 7bCjelgaXWqjxHDIxfJYBc81fFWo8O0IvriTXbPzfLK+YAKgdcPkhhlXqa9qry8WFv5T 2YSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/yIv/TiNzDkV862+WWJeo0gFEhSGBGJcXAw9+6YoxsY=; b=phK4umobDx2EuX6j3Fxly9Ysyg122pCHxEHLTif8r7tKKqSKInES6SGIvK7k5sN10l AJRghWv3IIjnbyBSr7rpAnWu1qMrWuZ6JvJBeSv+9Vf4gxBcov9c92xnI3NZepOFn8eR 4TSv7SLavSQ6KQo7yszfbgdkK8q0EdZf01Q8za0aQb8MHpL13bBDFYKNUNhRhLs9ifqP HUkQzlopqjw4Kz4VoWKb/aAjq0YdaVyABohZ5XBZ5QOrQDJKWTIRbxf0kdMudZqNbQz/ f3YcjgNVN0W8u2gPqmA2wNv1cLuuAO1zM4c4ZsTfYNdPb/KVWhnZ8cKsDLayC/OLmL3w mnZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qCiOgUxq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw34-20020a1709066a2200b0078239e3f846si227261ejc.1.2022.10.24.14.56.48; Mon, 24 Oct 2022 14:57: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=qCiOgUxq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231364AbiJXVsP (ORCPT + 99 others); Mon, 24 Oct 2022 17:48:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230265AbiJXVrw (ORCPT ); Mon, 24 Oct 2022 17:47:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D90B0A571E; Mon, 24 Oct 2022 12:59: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 A0C77B815F6; Mon, 24 Oct 2022 12:12:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 017FBC433D6; Mon, 24 Oct 2022 12:12:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613555; bh=fzcrBvCZW7mXwVLKymyezTswcQKSn+eSTCs7/2xGe8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qCiOgUxqXTEekqdxYFZOsiTrzb1xBKNoDq49wmNC29OMg5GsiggFCcUJbV2Di5Afn QudTPrzVQQXAeWSfGWZabvWYqUPRgm16x7M23ls5GzNuL6dZJZVKFi7nUBbjB62+C9 fYs15zvr4hGmi7IWq8pre7p4IQdlbw85YyxqlghU= 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.4 181/255] iommu/iova: Fix module config properly Date: Mon, 24 Oct 2022 13:31:31 +0200 Message-Id: <20221024113008.882222839@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747607756719807198?= X-GMAIL-MSGID: =?utf-8?q?1747607756719807198?= 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 a0637abffee8..6c19b09e9663 100644 --- a/include/linux/iova.h +++ b/include/linux/iova.h @@ -132,7 +132,7 @@ static inline unsigned long iova_pfn(struct iova_domain *iovad, dma_addr_t iova) return iova >> iova_shift(iovad); } -#if IS_ENABLED(CONFIG_IOMMU_IOVA) +#if IS_REACHABLE(CONFIG_IOMMU_IOVA) int iova_cache_get(void); void iova_cache_put(void); From patchwork Mon Oct 24 11:31: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: 10179 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp640998wru; Mon, 24 Oct 2022 13:34:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6pEzq6+/tfH5RUKfTF8ljyx3kDiJZt/TKYjVjGBTnGlXpO9pni/hctE5NV4ZB4I7pP5HbG X-Received: by 2002:a63:fa42:0:b0:44d:b59c:674b with SMTP id g2-20020a63fa42000000b0044db59c674bmr28942153pgk.207.1666643648538; Mon, 24 Oct 2022 13:34:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643648; cv=none; d=google.com; s=arc-20160816; b=tFsXbN/J4jO0Z7V0gJoqG907SqgDZ5mSjZOPclGQDginkiX+hkJwfdE/dX3k5SQkFJ 4Uu95E4x6HFoabR+ZLO1gAETFOv1E6xdS6FsXKcFuFqF8YBsPFPFLxZm0Y+G6ibFCrqI /B8xaGqHG95k8YdHPps3C7ZWpE8Ki5YJ3jbQPy5LhhXGTc88/m4WgGHrxoP51WvRHpMv 2H9B0qOCDvlIb8qfjh7GE2CV+qMCx03d7amC2DA9dH9jlQXiEeV49xrPQemc1YSVjToc SXn64/rhNBPOCBItcmgZnFH+/oGdPznXrcwy0M63SDIuD1NuVQFBh8448kpUkMoznz7U Wf5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qU+kDnk46VfLQCZRgoolvd5nN1yAqBzvdxQ6mwLzFBI=; b=QUHrZlS8Xm8ntlLgBvAu0Lq7h6BZoKpNj+RShPn1FCnfakwABUe1qT/Md55RB3tmTz DUkIMc3sagPIOCaQVSnPOmhl2fOqiVrLdDN3oZlIE1QYSazRTE0KSEpaQCod0yPQJKzq JEPjFzGCc6HbWPjO6rme0d+5cT1ajG+nQYRRX8ct8zW4RieWrwygfiZnu6zY8v7fvS4W nxZ4Bq3SQUQVjg4SOxkpdFKm7tSyG4BKIUvONVTVXXKVEZxZwp0RujU0G4grpMHw/AxZ EuO0J/9L6i5E/okR138VWot+mQ/bnsgfD6XcXiY0ksvI1CbBEt2z5S2foqRCGZNPCbZV A7+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IS5tlrVL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s197-20020a632cce000000b0046ec9ae4a2esi537083pgs.31.2022.10.24.13.33.54; Mon, 24 Oct 2022 13:34: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=IS5tlrVL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233986AbiJXUWb (ORCPT + 99 others); Mon, 24 Oct 2022 16:22:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233027AbiJXUVj (ORCPT ); Mon, 24 Oct 2022 16:21: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 1AABD19C06C; Mon, 24 Oct 2022 11:38: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 47C33B815FC; Mon, 24 Oct 2022 12:12:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96611C433D6; Mon, 24 Oct 2022 12:12:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613558; bh=ckVAof7XD3+KZgjd2lNRNmq00FBaNMFFiwAy/AVCHKM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IS5tlrVLmcsZTlU/ILYaL0CRqm6UlB4e5euhns52Za/V7+fXWpysdPx1xDzxRZNOT qy4bwN8CN9fQ4rYMU/Z4qaKV1/fCWHrrfcBZfpeIEtTMu6t8yPx9pEWROTngyWHBhP os+Zg3eeaJhz3XyP8TINi7/4AYulYtviWhc8NSKk= 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.4 182/255] kbuild: remove the target in signal traps when interrupted Date: Mon, 24 Oct 2022 13:31:32 +0200 Message-Id: <20221024113008.930922594@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602530402746839?= X-GMAIL-MSGID: =?utf-8?q?1747602530402746839?= 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 b14a7d4a2f05..5d247d8f1e04 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -187,8 +187,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 Mon Oct 24 11:31:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8964 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp436860wru; Mon, 24 Oct 2022 05:58:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5HQ7exBm+sPeP/e8YDy8Oa9pAb0TevQnTWgHcsJihYQO7zecAhUHhCmPrje3Ic6iJ2zCfH X-Received: by 2002:a17:90b:224d:b0:20d:8828:3051 with SMTP id hk13-20020a17090b224d00b0020d88283051mr37507103pjb.89.1666616297985; Mon, 24 Oct 2022 05:58:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616297; cv=none; d=google.com; s=arc-20160816; b=shUz2iLGK9Pqp3fhbNWjjYGn+NoJq29CY+eC1nIj3jRLWiA9HM34kAaIdfjv8sNNMT uj2M7bkOjXt+3OlRDSEXlPr8R0ZmiLxUTbQcwiGaURGS06w4PmOg4D5APU7FlJ6x/xiB j/jVJRS+BK/k+k3j7DgQVgXVXhjEX62YwxXqwvc2rNM8G1rXQjbnoWHedflPwLDKd5JY RE0wGX+mO9xrXoZ84agQIHA3SaOZhtF38zkVoCPnYq6hkwFwupqceqt4BHnaQ1/JLYNo 0SyjU44/B/CTrB2gB0QyU2iYR3mvPx2HRRnKE1ny55RDIdYXB/vgBZ43SaIDS/8n7isc nqmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DezC5LGKrTDiOt0yXtY3YAJjtyteT3YP8A2HwWPs8qU=; b=nwdgTzSX0PGy3u72VcSfGRajh/YAsgVQoo6IWgwGUmTkc4VUXEwTYhJn8MAGawSDdh EMtEf9pxqnn4DU8QMNv8nkFdhMLqwOaiDz7Cv7VC9ZHJVrOIkpz4NKfJAwxmdV54rTZi AnH+2SUBBwoWQbgcknbaLG1gfs7BkXvU9Z6qKSqSpRIV6G6st4pWSzMBlpMvo5Tceher B5ODXVmmtomOKOlqKWmE0uiuG6sr5a0Xm/BwfQi/3xKc6w2I87DjZxltDiOsc6m+cvlP meuY++oJX5V7yCYF37MLEGYMjU5wHQ3MC395U6ugCuka32eIRBuaBJf4TRNOwIsDwhpk AbvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qgDmtZSo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ls9-20020a17090b350900b00213255221e3si1486917pjb.1.2022.10.24.05.58.04; Mon, 24 Oct 2022 05:58: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=qgDmtZSo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234797AbiJXM5a (ORCPT + 99 others); Mon, 24 Oct 2022 08:57:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234369AbiJXM5I (ORCPT ); Mon, 24 Oct 2022 08:57: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 A789557E1D; Mon, 24 Oct 2022 05:16: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 B5AE4612C3; Mon, 24 Oct 2022 12:12:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCDCCC433C1; Mon, 24 Oct 2022 12:12:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613563; bh=afOYIS3FPYL4NSLiTIHXXLe3RlmHLDq9fyBIsk/Z1Ew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qgDmtZSo3UvobIAZcREQrAg2VEHgt6X0kHa5Nh6oAjjHi6yB5Qdtc0VVCpKL5IVd7 q/TmwNr5TEBdT43MnjjLiPipY1PxFvzxdJJ1W4SlS1Dikhau/noUEzJjXSjGXL2p5c C1ZyE7QKVBjrlgeSaEFaljWDwI0IrzE02Sik97DQ= 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.4 183/255] crypto: cavium - prevent integer overflow loading firmware Date: Mon, 24 Oct 2022 13:31:33 +0200 Message-Id: <20221024113008.979725077@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573850827982349?= X-GMAIL-MSGID: =?utf-8?q?1747573850827982349?= 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 781949027451..d9362199423f 100644 --- a/drivers/crypto/cavium/cpt/cptpf_main.c +++ b/drivers/crypto/cavium/cpt/cptpf_main.c @@ -254,6 +254,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; @@ -264,11 +265,12 @@ static int cpt_ucode_load_fw(struct cpt_device *cpt, const u8 *fw, bool is_ae) ucode = (struct ucode_header *)fw_entry->data; mcode = &cpt->mcode[cpt->next_mc_idx]; memcpy(mcode->version, (u8 *)fw_entry->data, CPT_UCODE_VERSION_SZ); - mcode->code_size = ntohl(ucode->code_length) * 2; - if (!mcode->code_size) { + code_length = ntohl(ucode->code_length); + if (code_length == 0 || code_length >= INT_MAX / 2) { ret = -EINVAL; goto fw_release; } + mcode->code_size = code_length * 2; mcode->is_ae = is_ae; mcode->core_mask = 0ULL; From patchwork Mon Oct 24 11:31: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: 9266 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp462237wru; Mon, 24 Oct 2022 06:45:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM661rRc2cww6j/xqv7enfQv1RqconFYLcTGsG9RvEGRp8CwZLw/GXZNZNh7mn01P7leDvSB X-Received: by 2002:a17:907:763b:b0:7aa:1ae6:900b with SMTP id jy27-20020a170907763b00b007aa1ae6900bmr2200578ejc.416.1666619135571; Mon, 24 Oct 2022 06:45:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619135; cv=none; d=google.com; s=arc-20160816; b=OEIpT1YGeAtuFFClG/h9OUq5liKVllc3Ee53vGQr2xJ31UkbGlnxcQRvGyD1DqPstP WzuPIWXPmwr4jf3WZVHZMJvAgq4Q2tCa/UQ3/h6b9xFuzfI495otj+QnIl1dZkuIHXVi znpUkkRDRhAaKxYhpkgblJouk5/HPxD76XiSb2h0pqQ569sVj7sIxHYPEza7VZ0Elzd3 C4SO/JLilAJttv5FDnWb3n6DU4BhXvtGQ44JS4J7N0FVCdvlDyccs6MByBnjU30QjH3H jeSlF3OnrC146nw2n4WYFXKKdjdsC/T08Vl0zbUWsp/UirgnW03RZOY//v2nkAMCYW1+ pHlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uW5wb3sVvTRrENcojP0jk3pSISBRN2g1TlGtyHZqLYM=; b=Fq7EBl6iqon3XXGfpMlGJuydrtXJQ7nir2mpkIMw0cCRqADiFVUCU7Fg+nhnBPCCfN fvseC33cM/CH/M7qHQxcQbh9wb/0A/ev+me/vKkzrRgeYEBNBIkKCcRzztexSWdJ3BQQ JtPZC/4jxo0k3cxWJ1BgX4ehdhhr6fI2JaSEPonIed2V4qzyQvGuKOEzkOF3QkpiVUxu gXyVa3gIALaKXVkOJ1wAPiKkkX6b0sgEIJe3tAyYlT5PZPPDahJO4R7+wiMs3QpcqJqn KKEpDHeVe8g2H0COt07E8GtKwhsM1dyvJgy0A0MTkxn2J0dot9NMkvFabecs1MtKW3d3 +Pfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fiV66G3L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw20-20020a170906479400b0078db3ae83d0si26710921ejc.3.2022.10.24.06.45.11; Mon, 24 Oct 2022 06:45: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=fiV66G3L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236248AbiJXNnI (ORCPT + 99 others); Mon, 24 Oct 2022 09:43:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236750AbiJXNlL (ORCPT ); Mon, 24 Oct 2022 09:41: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 C8210B449D; Mon, 24 Oct 2022 05:38: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 6237C612FB; Mon, 24 Oct 2022 12:12:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 749F8C433D6; Mon, 24 Oct 2022 12:12:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613565; bh=2AM3Eiz+r0aH+ko3xrd6rXYRvTAlxBHpaH2e5ElP4F8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fiV66G3LgKCTNwT6KE7Dxkydsv16fhPatOD6JFCDtEIm1ODLlcHpvbR02LyOzSAzz 9AfxQvhb9igSVWGvs1WmLpD+uRDbjEk/WiYYBxKjFFsagHQH1Gqs/wJ0clsqBdGjX2 pJOh7j57OfXeW5ElDPJ4yteenSUcWrHU2qy9J28o= 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.4 184/255] f2fs: fix race condition on setting FI_NO_EXTENT flag Date: Mon, 24 Oct 2022 13:31:34 +0200 Message-Id: <20221024113009.030107508@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576826956506011?= X-GMAIL-MSGID: =?utf-8?q?1747576826956506011?= 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 e60078460ad1..05b17a741ccc 100644 --- a/fs/f2fs/extent_cache.c +++ b/fs/f2fs/extent_cache.c @@ -729,9 +729,8 @@ void f2fs_drop_extent_tree(struct inode *inode) if (!f2fs_may_extent_tree(inode)) return; - set_inode_flag(inode, FI_NO_EXTENT); - write_lock(&et->lock); + set_inode_flag(inode, FI_NO_EXTENT); __free_extent_tree(sbi, et); if (et->largest.len) { et->largest.len = 0; From patchwork Mon Oct 24 11:31: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: 10182 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp641434wru; Mon, 24 Oct 2022 13:35:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6i387K7DhuX4Qf94z0hqUuXqrayXh1ssVxvEpx2gSmAMv1RVPNtBQzlaO1ynZ+0l7CKy68 X-Received: by 2002:a17:907:a40d:b0:78d:9f66:e51f with SMTP id sg13-20020a170907a40d00b0078d9f66e51fmr30056911ejc.654.1666643721238; Mon, 24 Oct 2022 13:35:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643721; cv=none; d=google.com; s=arc-20160816; b=r1+KUvGWDLf0+1KjknZ9H05yU+EEMm/PhgbGC7qg0tDb6Xd+Sh4tpeHGBelDzktvNE QVsGp0XQ0Zdo+iKCpRgs25S6/ZqKUZGwVuwe8adeuX7+/8Yh0TsXPO+VjO/W8TB4KjSK XThCF5qD6tQT1or94lgFVjx87KRfq90NKtRpo+iS/nNYwYfv0KfT7PbxCPCZEZI8VNbq mdHxrsOqHu272qBbMbgQBgxvBuJwYczihTMf4tfXL343GDGlRhq/padzpZcsgUpMNLVp 79QESssTtWyL2vijVB+0XvXbw8dwGAuU/SUxRLoaZoDUeQ94/JMorafcQjYf3u1VTuAe hmKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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/QvNjl0OGzAWu1lHK374GJ3q9jJ+z4D/Q2x/nh0b4=; b=MwcVYyS+MVnbS0NF5+KTftSYjcqyeEhtcf/tELj1ccaY+o2BQ5RNuL3m3zN5Q5vNx/ f6UMYTRejnnduwP8FNB9a+4/qvorUvWD8O+tpFwMlvy4hQuj/F4ATDid3qhmsPtBTPO+ Bhh2gA6sIOVgGLKVsKdTKU/OQJtnuw0eIivJp6jizUIce+Vp9YcgQ/c03C2GPS4292vI 24II8yHY0n+pi9ed1/HhUciopEFWR7JE2ZswxeJWse+xGAsothobamJq2PpN6Ikyjo7F grEAGDRTngkARFqgsDR37pdLoXt1K9tYJQwYjEsF9ZJNS7Xp9v90ueD8vssRi1p8qOd2 31LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WMaMx8ci; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf14-20020a1709077f0e00b007aaf5a45f5asi713001ejc.47.2022.10.24.13.34.56; Mon, 24 Oct 2022 13:35: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=WMaMx8ci; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231481AbiJXUX4 (ORCPT + 99 others); Mon, 24 Oct 2022 16:23:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234280AbiJXUXF (ORCPT ); Mon, 24 Oct 2022 16:23: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 18505FF278; Mon, 24 Oct 2022 11:38: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 B09C4B815FA; Mon, 24 Oct 2022 12:12:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11031C433D6; Mon, 24 Oct 2022 12:12:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613568; bh=cLGKtLbXVqnDb/ajd2omM5QR/yxh49jN/ogXfZjmH1Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WMaMx8ciqrORJh21IbDIz9P6I22+FWnmBF7rLWw9yKc+WFAmUqYDYfCZZDddcgxoO 7ZYIxeVbh41iPRLOQtoAbpVLf/e1/3D1KZe3ZICPuQZ7bjv2YcfykZEQY5KaC4GM8Y q4roMN/GPJY6gigxVfGuSyZ3cx6ui/gjiRvlhxqk= 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.4 185/255] ACPI: video: Add Toshiba Satellite/Portege Z830 quirk Date: Mon, 24 Oct 2022 13:31:35 +0200 Message-Id: <20221024113009.068729728@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602606971157568?= X-GMAIL-MSGID: =?utf-8?q?1747602606971157568?= 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 81cd47d29932..bf18efd49a25 100644 --- a/drivers/acpi/acpi_video.c +++ b/drivers/acpi/acpi_video.c @@ -498,6 +498,22 @@ static const struct dmi_system_id video_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE R830"), }, }, + { + .callback = video_disable_backlight_sysfs_if, + .ident = "Toshiba Satellite Z830", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), + DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE Z830"), + }, + }, + { + .callback = video_disable_backlight_sysfs_if, + .ident = "Toshiba Portege Z830", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), + DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE Z830"), + }, + }, /* * Some machine's _DOD IDs don't have bit 31(Device ID Scheme) set * but the IDs actually follow the Device ID Scheme. From patchwork Mon Oct 24 11:31:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9703 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp544593wru; Mon, 24 Oct 2022 09:32:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5GMFingoEG4YMUgclX4LvzLBqs7MrvitdSHWI00JbnMSDPFO1akYCg1WcD5mDV18eoGW4D X-Received: by 2002:a17:907:2daa:b0:78d:4dca:43e with SMTP id gt42-20020a1709072daa00b0078d4dca043emr28417026ejc.134.1666629147398; Mon, 24 Oct 2022 09:32:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629147; cv=none; d=google.com; s=arc-20160816; b=OqJDXd/EbKnDckwLfjK2RRtNw4zflprgvpz1bFVEhrHIlv/mFZKRqrVAvcldNffxjr 7+gI8oQaPev/PpRNm5wBG+cbmZRqtNPtYrCjgebLpyDx7P4N7oG7ctVF1ri8r9x3sQfb rm30L2VDqgeMp8mnpVFgnP4Y5mC9Wpaguwmm78NbrSRpVSI9jGOxKhK7Axbxzhlmilxh Li/XBs5/1Qo/rZ1Q5Msufl7WdxGhQ8yMUP9zIWn9S7yYcUl9Dqu7Gcn2y48Tj3mFXuMt eX4bWdbGdE6YgHegB0qkYVCEE/WEnoHpyW8pG+jlrMyjklZ1QryFJNCUQ0UzPnEvgx0b 5Qsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HMB8cwFxSZQq5hiwUjnCgLByHbQLvV/Q+JayaXkVQiI=; b=y6kqJwXHfnRQteEojoHAQGGG1RoDB3H4YLiFyYu7DCi3gE7CV4yZk4j0pqWHX8KmYl KaT8O62HrL1Do4xWc+cA+qR93miX9tJOXY7BlpnP5nVQLTxMJuixwCpfpsKI8kqsuR0Y 4vfj7fPg7HZrYJneAjDheZiSzlxEDtxvfCAuMXFmmfTMcmxXAv1ELH2GydlYhyBYfDZC ajRnmV34bFl46RDS+mrzezT8CU2aZ3L+KNSA5rdicvhSQLeVpq2KZSZw+YmmWW2CEUJT V3+ZLJ2DkKgjoD2YfD+OoZU8Y0I8T+FfOOQkYLXu01VKie5zX6s/xHoD4sMptMKWDVMk Akog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ogyiw3UG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a18-20020a056402169200b0045c9904fdafsi173632edv.74.2022.10.24.09.32.01; Mon, 24 Oct 2022 09:32: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=ogyiw3UG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234137AbiJXQQ0 (ORCPT + 99 others); Mon, 24 Oct 2022 12:16:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234389AbiJXQOt (ORCPT ); Mon, 24 Oct 2022 12:14: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 AA16A13F36; Mon, 24 Oct 2022 08: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 AD576B81611; Mon, 24 Oct 2022 12:14:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4B90C433C1; Mon, 24 Oct 2022 12:14:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613674; bh=7Biv/RB4g1yWRQ3Ir7P+DO9H5qF3EuPehLJSXWw6ecI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ogyiw3UGYFWGThVXqst2NGh83VwNsxJntzA7X6mn7uksyyCdNZUphR9U8n5+53ikV fONNJ8o07u/tvwzRLMLSWR5IlMJ70gIXh582Mc2W2YwY9V7/rN/dxz/cRQVAoSS7/g 8jWZH7QFOUecdvWtBgAhdnuA77H6mNCNfA2c5pV0= 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.4 186/255] MIPS: BCM47XX: Cast memcmp() of function to (void *) Date: Mon, 24 Oct 2022 13:31:36 +0200 Message-Id: <20221024113009.118456625@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587325023350712?= X-GMAIL-MSGID: =?utf-8?q?1747587325023350712?= From: Kees Cook [ Upstream commit 0dedcf6e3301836eb70cfa649052e7ce4fcd13ba ] Clang is especially sensitive about argument type matching when using __overloaded functions (like memcmp(), etc). Help it see that function pointers are just "void *". Avoids this error: arch/mips/bcm47xx/prom.c:89:8: error: no matching function for call to 'memcmp' if (!memcmp(prom_init, prom_init + mem, 32)) ^~~~~~ include/linux/string.h:156:12: note: candidate function not viable: no known conversion from 'void (void)' to 'const void *' for 1st argument extern int memcmp(const void *,const void *,__kernel_size_t); Cc: Hauke Mehrtens Cc: "Rafał Miłecki" Cc: Thomas Bogendoerfer Cc: linux-mips@vger.kernel.org Cc: Nathan Chancellor Cc: Nick Desaulniers Cc: llvm@lists.linux.dev Reported-by: kernel test robot Link: https://lore.kernel.org/lkml/202209080652.sz2d68e5-lkp@intel.com Signed-off-by: Kees Cook Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin --- arch/mips/bcm47xx/prom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/mips/bcm47xx/prom.c b/arch/mips/bcm47xx/prom.c index 135a5407f015..d26d9a6f6ee7 100644 --- a/arch/mips/bcm47xx/prom.c +++ b/arch/mips/bcm47xx/prom.c @@ -85,7 +85,7 @@ static __init void prom_init_mem(void) pr_debug("Assume 128MB RAM\n"); break; } - if (!memcmp(prom_init, prom_init + mem, 32)) + if (!memcmp((void *)prom_init, (void *)prom_init + mem, 32)) break; } lowmem = mem; @@ -162,7 +162,7 @@ void __init bcm47xx_prom_highmem_init(void) off = EXTVBASE + __pa(off); for (extmem = 128 << 20; extmem < 512 << 20; extmem <<= 1) { - if (!memcmp(prom_init, (void *)(off + extmem), 16)) + if (!memcmp((void *)prom_init, (void *)(off + extmem), 16)) break; } extmem -= lowmem; From patchwork Mon Oct 24 11:31: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: 9250 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp461290wru; Mon, 24 Oct 2022 06:43:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6m+okJLc5DxwvJ1WWTMpeX1Bx/cFL+BVey2ryfWFih8m76i77C69q+wIz1cbitp9+uLdU/ X-Received: by 2002:a17:907:97c3:b0:79b:3f8d:a354 with SMTP id js3-20020a17090797c300b0079b3f8da354mr14580141ejc.461.1666619014213; Mon, 24 Oct 2022 06:43:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619014; cv=none; d=google.com; s=arc-20160816; b=CUX8liwj37eONxRaSAoXLkNYRZmtiPDjucT2Oq7mJokoPKl+LUbUuY3JKC2yQY4074 ywDRS/7y6Xjm5DUPtAPLOwBCCYa7SW3dgEuUT9DmKfxU4t/stGgomUD8qxmwNgpyRJoN UFRf9h1g4qg5tQ3WQsdgyvz8glplAW7uxSFdpquJwnaPGgMYv9kMh/Es9EN7tpUVrhMj VCLqNk8F+YvEJ6oMzB2yp2bxL+Jw+zU5Vn2zmGJpvbBZJzfZVZU80P9BsPwVYClfnaVG HzBK8ryE74QMjP+bszMqi4snwRK2khLAgwfvH5PmGp8ymIdDNgmUvzlyfwXDp6GWa7SG 6Clw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/yDTfWCy8USd/4nXl5/TaL6ci1dkDOaS8nuKmakgsDI=; b=pavWBbpB+rqITNPpLa0y5Y5WPhskJBXIpiaPdRJAuVJfpqDPDWQ/RxT+O2G4nU9Von 2YqXVTP69p7YSNK+VrCwkli4cfd9/BeCqcHWwmp37S3lpF38JPJfrQYt1vWTUvIqzDgL PBWpTzT8Jbz0Z60Eqoiq4Lw07qIFyVopjoj1iZNBHBvVWDfX2F+nEX7jim+urpyqaQ4g /8HB+7/gfMtaWBmS4M+39laLmQJq1RUHFFagvaSIansX6sp+DJJh4yzdr6fHagoX3pOR +jlVwbaSC+hscMYYtnWtn9PW5kbmE74226zhM4TdIjXzxt9BmEtkOJWIZprVXyyRUEO3 BwLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GoOQgGqp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne34-20020a1709077ba200b0078e23374ab4si20985399ejc.365.2022.10.24.06.43.10; Mon, 24 Oct 2022 06: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=GoOQgGqp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236141AbiJXNex (ORCPT + 99 others); Mon, 24 Oct 2022 09:34:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236234AbiJXNaJ (ORCPT ); Mon, 24 Oct 2022 09:30:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F750ACA33; Mon, 24 Oct 2022 05:33: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 12EA36125D; Mon, 24 Oct 2022 12:13:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2408DC433D6; Mon, 24 Oct 2022 12:13:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613589; bh=ftzICmIaYa6X+2Y3LTRSb2ARZqMPbOVnX0qX51ONXuM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GoOQgGqpYAACXTO33lAzdSfdfxeBvbAfyXjTG0+3PccdsSkN0gIL5u6WNRxO4cdl3 etsV3lxNey1AJjxcNU/qT968uBUnqm9ClDd288JG8HYWSY5rBlkZHQM/BThYzJxJcm SnrMCS8yOjn5drHk85T9KGb766nyEgc1BfhhevKI= 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.4 187/255] powercap: intel_rapl: fix UBSAN shift-out-of-bounds issue Date: Mon, 24 Oct 2022 13:31:37 +0200 Message-Id: <20221024113009.157135825@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576699785906737?= X-GMAIL-MSGID: =?utf-8?q?1747576699785906737?= 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 925b0004a0ed..d5a505f32260 100644 --- a/drivers/powercap/intel_rapl_common.c +++ b/drivers/powercap/intel_rapl_common.c @@ -885,6 +885,9 @@ static u64 rapl_compute_time_window_core(struct rapl_package *rp, u64 value, y = value & 0x1f; value = (1 << y) * (4 + f) * rp->time_unit / 4; } else { + if (value < rp->time_unit) + return 0; + do_div(value, rp->time_unit); y = ilog2(value); f = div64_u64(4 * (value - (1 << y)), 1 << y); From patchwork Mon Oct 24 11:31: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: 10324 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp668611wru; Mon, 24 Oct 2022 14:55:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4nLsFFsdda270920hj5w9HrkFuwUPHbJ0e74WaL3OzkLdZJbpbdUA+cexhtjuNZjnveeq+ X-Received: by 2002:a17:907:6d9a:b0:7a0:d2d9:31cc with SMTP id sb26-20020a1709076d9a00b007a0d2d931ccmr12605609ejc.747.1666648517095; Mon, 24 Oct 2022 14:55:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666648517; cv=none; d=google.com; s=arc-20160816; b=ar9/xFRKmH0k2D/SEoHSApMG+coErs8wpq6DJb/hy275DDvDCczuG9lyCIbYvYN11Y nuGRkCOw5Y+UZuea+M+9V2lPZq06WFQWikZcDM3lcevDDng8KgZF5dIrew8BzxQFA2Kx lRrPDfY6uxjbfHimsuvuDJttsFxI2N4mN7eqRgiqLn/9oU2ryE+xw/asSoz3JfpAqQMv T1cquW58IuHbRufNLWKnHtR/vgLOk5Lg4FS+aPZtzX9ePfzkrXwIFONfC0aJk7w1nkCK AXDRA32Z2JssYhrkYsh/nwrZm4KPjyAWJLyLvrOiCvSKyR/SSY6Q+PWZ2QzgxSn2E244 IBAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tWzqNkGwZ46AK4R8Wrhrr2GPjlO23rnGKUbSrIRCb44=; b=s/beSxGTkzb/2r4PdM64KFrkZ2KVEDNoDjqMj3kPvfc3uwtaSfJXr11u/iWaEVHcTH 4kwDk3rITum1EhQ2GR5d8t42wPTQmt0nxfrf7Nldogy3N8BXiBEmz050ZxN9IcgrP6Sa 05SnTTvhBcIsSR5fUM9d4XQM8ZiGid4Aneag5b8e6X7WAl8D0J0xviNGK7tRXELf1lnP r39tqaOuN99cpcgpBaJsY1D75DSCjrSAMfgn6uPZuIT59PkfA5YirN4n7v3wQY4nbyeo AX8w4Zt8x7DeIq07uqKEbHqb0Xc15dQ79WTSgD0YFKrkBASwSNGjqzKjir7TpM0sCxRw Taew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hmOKx+zq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f12-20020a0564021e8c00b0045a22a21abesi955020edf.299.2022.10.24.14.54.53; Mon, 24 Oct 2022 14:55: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=hmOKx+zq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231245AbiJXVn0 (ORCPT + 99 others); Mon, 24 Oct 2022 17:43:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230512AbiJXVnJ (ORCPT ); Mon, 24 Oct 2022 17:43: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 4D7B02E8BAD; Mon, 24 Oct 2022 12:53: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 80AEFB8160C; Mon, 24 Oct 2022 12:13:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CDCF7C433C1; Mon, 24 Oct 2022 12:13:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613619; bh=WwLmp2q3LG4H7tU6nfLi2QNNkpGu3VvUBc/Mb+G7hoo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hmOKx+zqLgTr2zrTA/dwvZd+rGOzkYZXn/ydTR2bDuYqX2R2J2XR8LDqz1FjFfKFJ /N9zLENLidmVJe2o+U/E9BkKxNZW8mWz7aaZihm5/USMxX6neMKuGkQUNw7RMYMYx9 FeRzY6vk+4NC2lPKSsS77eRYG9FNwEpph8PyDq4g= 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.4 188/255] thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to avoid crash Date: Mon, 24 Oct 2022 13:31:38 +0200 Message-Id: <20221024113009.197311082@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747607635290458803?= X-GMAIL-MSGID: =?utf-8?q?1747607635290458803?= 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 53216dcbe173..5e4f32733caf 100644 --- a/drivers/thermal/intel/intel_powerclamp.c +++ b/drivers/thermal/intel/intel_powerclamp.c @@ -535,8 +535,10 @@ static int start_power_clamp(void) /* prefer BSP */ control_cpu = 0; - if (!cpu_online(control_cpu)) - control_cpu = smp_processor_id(); + if (!cpu_online(control_cpu)) { + control_cpu = get_cpu(); + put_cpu(); + } clamping = true; schedule_delayed_work(&poll_pkg_cstate_work, 0); From patchwork Mon Oct 24 11:31: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: 8971 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp437867wru; Mon, 24 Oct 2022 06:00:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7fzCLr7Prv63Ade0Il84AjGpCJAeBWNnE8+4eeXtOMkcDSYzB0SqcqyT5t/KBtXi9WAPuk X-Received: by 2002:a17:902:e5c1:b0:186:897f:b8ee with SMTP id u1-20020a170902e5c100b00186897fb8eemr12447486plf.151.1666616435040; Mon, 24 Oct 2022 06:00:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616435; cv=none; d=google.com; s=arc-20160816; b=gLK/O2kV/LIezgbfNLbyM4l96y4IyQDLxe5slVfRasI3XYlbl9LJROiMLpBS1hSnjh bYwThMPQwk6f6xM7lURfg5+HZddPdqBtV5HDvZs7sAdI94iVjLiBzRfeupGptim+R+sw tfBe8pdTCUM9tPUl+V9f8tyywLrH3oq7x8UUo3VwMK2YJHxJnJNYzy8XQtRvkcvFJESP yKUCeieB3WSTBWQ5FiD4p+OPW5g5UC6Al6oryhmDF2gzeSjPdZRGbNpToov+f8JFcQzw 2F4VcYoMKk+AwqrpE0rBnuh88W+hRSDPCQLPlf4nYj7QyY1TUtw9lHzTfTQfnwcrnrYP zajw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TG3FRj7yyWrVV+iuTPWGFwVcQ/wa5lJcYj0DH4TL21I=; b=dZuFTBDR410qBGwA8c2Oa52O/ztIFxUANduCQKcupyT9keyns2Vhp06007yI1EaWNl gt5YEaPKY41qt8eMXaOs0sgaM3LEhhnFnAIT7GgL4XU+/gL7/oDoAlYnKE5+KRzRpInD NZJn82Qz5tcHed6pT2BDSlMT83Vi7WTjO/VBGPHMeGy6eaQKPOLAMEorv8Nf0Z4Ywv91 nB4iaAvXmS9nAo0bEfhL3fzoTfVf1HYlzD77WlX6Hj/lTbZpCD3KaK4/CdWKsn13c+AH IT9TwzRvnedj8E043B9hji1cY3MY5RAKMKVLyLSV8iTwBPmb4JC1eozbV0MgfM/2PtBL Ox4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=N3lJStRM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a655901000000b0042ad0333df1si37128790pgu.479.2022.10.24.06.00.16; Mon, 24 Oct 2022 06:00: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=N3lJStRM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234845AbiJXM6f (ORCPT + 99 others); Mon, 24 Oct 2022 08:58:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234755AbiJXM5m (ORCPT ); Mon, 24 Oct 2022 08:57: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 E9A8B97EE9; Mon, 24 Oct 2022 05:17: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 D203861320; Mon, 24 Oct 2022 12:14:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B814EC433D6; Mon, 24 Oct 2022 12:14:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613648; bh=q35u9k51iKg4WFnPv2+Jft9j9x8EK3aRtf5Pa+iGBKU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N3lJStRMIfM1xWFYqREc3zv03PcsQNTZREFDYQk+pT9yVx9WozZGOrOlVilhzF22/ Wr5AjCofsHKgneEeFUqozvy/Km3bGtfIXKZH2yz+iNPksyqfK+Wqd9juu4GNyC7bVk kuLnDNBQIeOKtz3FztqY9EbZUVna89qVxZT0rJbA= 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.4 189/255] x86/entry: Work around Clang __bdos() bug Date: Mon, 24 Oct 2022 13:31:39 +0200 Message-Id: <20221024113009.238496303@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573994847897107?= X-GMAIL-MSGID: =?utf-8?q?1747573994847897107?= 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 65cf405cd975..26b35e75b701 100644 --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c @@ -759,6 +759,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); @@ -768,7 +769,7 @@ static void xen_load_idt(const struct desc_ptr *desc) memcpy(this_cpu_ptr(&idt_desc), desc, sizeof(idt_desc)); out = xen_convert_trap_info(desc, traps, false); - memset(&traps[out], 0, sizeof(traps[0])); + traps[out] = zero; xen_mc_flush(); if (HYPERVISOR_set_trap_table(traps)) From patchwork Mon Oct 24 11:31: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: 10177 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp640968wru; Mon, 24 Oct 2022 13:34:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6uSJD8eEAvaRse4nDrlcdMHd/lrboTBjRfT5UWzJLudy6QoefY1kTiK2RG1s5VByZDT3s9 X-Received: by 2002:a17:90b:11d4:b0:212:ee83:481 with SMTP id gv20-20020a17090b11d400b00212ee830481mr13322596pjb.36.1666643643166; Mon, 24 Oct 2022 13:34:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643643; cv=none; d=google.com; s=arc-20160816; b=edno8DCA1UpV0J5bcdXpoyBn6yU5mweQbuozDHOA28xDGqAjmNvt/0jxDKr61D3lEY KxwV/NkgLYa3HiqdDiEE3b3dABUYIuFuIcnlUY6AwkMfnl3mUxu/bomYJvZRKdN8dPjc F1a41sESFc2fQWyAsPJr5Wej7kvs2i0Di4dxmzqDza6ch6GIlu/ShyJiOIdlZv+kaLdV hpSt42/6MsURzc/G+FjhiXQQS3aTAeS7sLpFXPp0FXQjmDpoUWEv/im2Dg7wW/LLxzC6 foq6oB8o3YSacfdLMKc6AC+ouDuyBDsmRLYIRVq4ny1kzvpRQZjwtCFQ+gRkERqxBYVY 7TMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8c55dpzmAN84GlwUnU4VADz++Rw8GSMxTZI3Cl4Ka4U=; b=h2ObOVhnZhJokLy6GDniw9fd+oEDe1O2ADtAbTcKV5BTW3p9ZQloGQOKVbjMp5syEr zjVH2a3xO4QmyQlC/kYahLIWGdfvs6T5A8TEQualdC1iCYVzdg+qc4evy8eGqP3wTzbr JMTseZNtXmYggprRf+1i4GsJcGQ/w4A4axGBVw3f3i9T6NhnvjaLSI013UMSSNP0a6J9 OWNrAjq0MkWuE2tu/nrKeQkszedLaaEOFTfmltcAa7azlBpesKS2Z4+o2sp7foNndNvX RKjTGrZBb4LDX613hfyNMCNrLzIRsH6NnmGCxMwUHUee3RxI7sj1bAdcnkH1DYZtARD1 jvgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="G1/2DuQ9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a631745000000b0045f98453934si420636pgx.872.2022.10.24.13.33.49; Mon, 24 Oct 2022 13:34: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="G1/2DuQ9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234071AbiJXUX2 (ORCPT + 99 others); Mon, 24 Oct 2022 16:23:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232593AbiJXUWn (ORCPT ); Mon, 24 Oct 2022 16: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 EFB4589900; Mon, 24 Oct 2022 11:38: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 089CAB81618; Mon, 24 Oct 2022 12:14:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65E3AC433B5; Mon, 24 Oct 2022 12:14:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613658; bh=jW4elg5loCepsK7wp7uNpCRmDv18t0TzV6USqvCTJKY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G1/2DuQ9ML9AuXTR5ZpL5FzjvTCK7SPGkojbOPTEQoNNCIYUL/jwsX1PJHDLjShCO 39ca8JZMWSElbirANTLKUB/cruAhH0ILO+TgDv1P0hraDzCTa01d/mR+6TQoMaojWQ jQdWyAq2d5sEsbHwj6TIIaWgcW2rF5ElJpRQk3bI= 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.4 190/255] NFSD: Return nfserr_serverfault if splice_ok but buf->pages have data Date: Mon, 24 Oct 2022 13:31:40 +0200 Message-Id: <20221024113009.287889932@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602524821597721?= X-GMAIL-MSGID: =?utf-8?q?1747602524821597721?= 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 e61d9c435957..95bbe9d4018a 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -3600,7 +3600,7 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr, if (resp->xdr.buf->page_len && test_bit(RQ_SPLICE_OK, &resp->rqstp->rq_flags)) { WARN_ON_ONCE(1); - return nfserr_resource; + return nfserr_serverfault; } xdr_commit_encode(xdr); From patchwork Mon Oct 24 11:31:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8980 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp438678wru; Mon, 24 Oct 2022 06:01:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5G515P85evM2nACkueP6FNT+kx5LaTgC+5ZMOM0njzuTpP/vpUApJeDMS0qdaRoc0TQd47 X-Received: by 2002:a17:902:ef52:b0:17c:f072:95bc with SMTP id e18-20020a170902ef5200b0017cf07295bcmr32937910plx.28.1666616501135; Mon, 24 Oct 2022 06:01:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616501; cv=none; d=google.com; s=arc-20160816; b=gfU4gESl7S0YFfWvMllN125GodrmQ0TcCBDv4bE7ca3C8W/9hVPhiP/40oK37GmigD DZM2vGssSDmjNn3nncX6lBOWzJDBrUfCn2N4vFnmNftTZup4S33vyIdCi3KX5glwXw7o 2d9ImA4/3lpfloGLi+jqLuiAIxw894tv3YfzXSlMNBtlxcoIkRoUaxmukmoYcUn8/Z87 uymaRisuB0Dln4IYQwoVDg4Xu0S8tQ3gpOGmndi8keeEL/SBKspoLXoC2Slxq4oGZb9T bZL/wN60kW1PVteui28WvMpMYNj1H0VKJi58A54WJi/pTu/35ZGiSAFTP74aqZkRgX8K oBig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bHr7Vc8poUkIDCkAF8hTXXEVcpMtguMy/g/aZjZX69k=; b=rdzaORbmar3CFI0ojaas/qsRjKy9eKDK5FLjGMRLFzFZd0IsOicVjTVkQGgMQy+1U+ ElOKve4t9qfklZeIQLEo1KrWqbiEtrU3dRl64klXSOLwBPxa/b8yDF+5zIoBp9ql3XRX X50wKI46wN8jzAyAVSfvNMdH1jZZs9AHWllrMqnKq88Lpal4qLIuaqWKA4YMccB2MzjR VGDXD+5IA4rA4ZneahH9kAjZG0EbAiViNOLwwc+f7bleso9Q9nXu49YIyxNqHwcojpkC pK2+Kg7FGNXZP8fP0tRGuTSFkhrVtvZfynYco9mUnCVVML2BMrbQpaLO31kSsbrH0cm3 WIaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=q4iKpSgB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t15-20020a056a00138f00b0056bedcfac12si2204292pfg.333.2022.10.24.06.01.03; Mon, 24 Oct 2022 06:01: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=q4iKpSgB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234866AbiJXNA3 (ORCPT + 99 others); Mon, 24 Oct 2022 09:00:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234862AbiJXM6a (ORCPT ); Mon, 24 Oct 2022 08:58: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 51C4380E89; Mon, 24 Oct 2022 05:17: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 E39D1612B7; Mon, 24 Oct 2022 12:14:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05851C433C1; Mon, 24 Oct 2022 12:14:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613661; bh=IYCU20u2Xlc4syjuburP7Yh/EOeRGBaxDPCF296W3kw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q4iKpSgBMfO3i8e69AbpVqy5vmYCvTiaYktj4aQTYGxx/RONey0BeE39MhnVs8vmb iTl4dtIEFDkWzHhTmC3Hlo8rF+3NR48GpWJnzhy/AG+IhFTULQlVmp1gSUPu7sZLRw eHrA4ogp8mLjbpTIbcIZIfJzJsi0ZiK0+/JYcrQM= 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.4 191/255] wifi: brcmfmac: fix invalid address access when enabling SCAN log level Date: Mon, 24 Oct 2022 13:31:41 +0200 Message-Id: <20221024113009.327787852@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574063972764708?= X-GMAIL-MSGID: =?utf-8?q?1747574063972764708?= 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 14e530601ef3..7ec1630d9095 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c @@ -154,12 +154,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; } @@ -181,7 +181,7 @@ static int brcmf_pno_set_random(struct brcmf_if *ifp, struct brcmf_pno_info *pi) pfn_mac.mac[0] |= 0x02; brcmf_dbg(SCAN, "enabling random mac: reqid=%llu mac=%pM\n", - pi->reqs[i]->reqid, pfn_mac.mac); + pi->reqs[ri]->reqid, pfn_mac.mac); err = brcmf_fil_iovar_data_set(ifp, "pfn_macaddr", &pfn_mac, sizeof(pfn_mac)); if (err) From patchwork Mon Oct 24 11:31: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: 9705 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp544659wru; Mon, 24 Oct 2022 09:32:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM44zW/QxIyYIAa6wZQm8rhHFdif6Uyowf28Xc2x75JZxFk8c72jdT8JALJUW5ZeMu34VXsp X-Received: by 2002:a17:907:7d90:b0:78d:bc5a:913c with SMTP id oz16-20020a1709077d9000b0078dbc5a913cmr27987921ejc.390.1666629157005; Mon, 24 Oct 2022 09:32:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629157; cv=none; d=google.com; s=arc-20160816; b=R5RlNGw7rJMz9daPPOEyPMNbe1gFiTceoT0cgsAwPZ1amA+8pOUIq0ZqbvFVyfY0cs 2YcsvQCnf0Ez3WhyBsTa+BhQdmb+2YlUEGCriAvgQnJp8CteytQ8k2D4wy6d6YCH3CXV vyAhl82QII3dM97hku9tZLUxxZLQsg5sb081D6LnPYuiPG/E3i+eDds7gwVcIUwA4OPC jeIBiFZu6xh9MepR4hsi240pU8PCHc4CwkDx6AnuYymc9VcXseMBJkBiOXu0rJa+6NNR 489YL2ev3YQZlQWFQKtRq7SjaT5gv0PwqDbJCaLZrEr6gGUvzVzzPBtEK2yzMasOEnWk Nohw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jcNNBwm0hHxcEBvS88EjS6FZhN+FB/gdRHYIVuiaVXo=; b=ySjP4sTM5GW8GRxVCL1Rjt/Bf323NciSQ2FnGA9YxBKIxKZP0Wgi4aGLUEsAvazlN9 d0tgNPd4rHyDM5chCWpwZ3/LvonP2+oidLXwnf0JbhPrGWtbrlSVYNXEY2zLeEaDDlF9 TvhNcrM855fSXpBm7J2NVErIpnMktMSGPPvyRBNaSY7xsVzbtUXxnF9Gn6x4IMIAUci9 CPbnePdTz1rL2Azt6yCVz5HdAr3/FkfLhvRbm29Zx/WATtp0T5Yf9/SdUhaGIyjhfao8 VDyOtmy7bZiyfxuYbdY7z22Q286sTs2IdaFivhPI4lxPa7Z1vzXDQObr23vBpjbKNSvO 5PbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MmLkCL+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 c16-20020a0564021f9000b00456662097dasi210411edc.69.2022.10.24.09.32.13; Mon, 24 Oct 2022 09:32: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=MmLkCL+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 S234101AbiJXQNt (ORCPT + 99 others); Mon, 24 Oct 2022 12:13:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232556AbiJXQMG (ORCPT ); Mon, 24 Oct 2022 12:12:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 272F113E3F; Mon, 24 Oct 2022 08:01: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 52273B81612; Mon, 24 Oct 2022 12:14:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E777C433C1; Mon, 24 Oct 2022 12:14:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613664; bh=ZrB31+NJNwQic7KGl2gvkCCBKpq/6mExqiYHUP8iVO4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MmLkCL+C2WKcEXWeBYOlvRhySTyQheX+LkX94v/6sxPuQhNNuNtTKQgOt++b6L6nx nDquEiZhLKO+1dNbOksWsjCsy3EjDgjTmBrbmuklEqQH9jnqbT8Eg7uz2QXVEgBmnQ FG+3WDFj2I6b3ZTssbp7z520wk9OeKN2QKt3S2Nk= 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.4 192/255] bpftool: Clear errno after libcaps checks Date: Mon, 24 Oct 2022 13:31:42 +0200 Message-Id: <20221024113009.358175984@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587334824782922?= X-GMAIL-MSGID: =?utf-8?q?1747587334824782922?= 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 4b03983acbef..35984bd354cb 100644 --- a/tools/bpf/bpftool/main.c +++ b/tools/bpf/bpftool/main.c @@ -364,6 +364,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 Mon Oct 24 11:31:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9127 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456448wru; Mon, 24 Oct 2022 06:34:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM73UnK70PI7vgEbyst1z0pVQQPTqv4xbVFvxSr/LWEnAWMlN9b+T6/7xipwQVckCOuCluQb X-Received: by 2002:a17:90b:3e8a:b0:20d:4632:e487 with SMTP id rj10-20020a17090b3e8a00b0020d4632e487mr39192973pjb.78.1666618452596; Mon, 24 Oct 2022 06:34:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618452; cv=none; d=google.com; s=arc-20160816; b=g0o2Sm45PDNWiF0pMNNyIt3jvkP0Kesca3lUyNIkpof9Ky08YKlMjdm8vRU6mM32BU +LHG/T561f0SAnsYYfARIHEfaCxQbKgSRQStqBsbi3vq+STXpP/A19rx774a/YyfIEAY 23MEEwG51YO94P0izYhYt6brPvt9unFwdmcXEYBort508r9L09ZylJpB73kdphZTgIAt WYifOCiwdVjHJ1jIhUbggvHeHbKLu5FZRVBLTxAkK6HFLbs0RnaKGAcgdQ2oauoEnM1P MhuCZTgyEgy/dQPfN2sFlCLyUd6nuG1Ln+BetuwJKR0KPCOJJ0mIaGdZfda0h+4xCKIH GybA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QToXYaZOVlSkJrvhBqcAuCEGL/Hz3A5QbX1urKxKmFA=; b=myE+KdElFiqYiRozFHt2RmtvCuxuDPC84P9cmgTCF8d+zMBNM/QrGeR0L7q1TFooek kmAjiCv1bcN0QbrTRYgt6xTml4p7/ae+tOmBf3twp80jyK7hKwH4CrsRH8bUrXZp7rZj qFowQ4U0la02BI7JifMW1dN2PX6lnbEWsVPXUz5VoljxxwmoKM98Wv3eYjsO9SgtvLa1 2HPmjluXli2whzSQjgdKFNxV1267Yb9/Mvy31KC82/ACR0su5pcIbQg+sytdwDf6Fumz 6+15BSlGVZw3+kClzKQwgxLEz4Jj1iwvZQhrRM9zbBuHa0LXZD2Yam9tdkou/wtXdsSB vlkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nAYP8GDJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b15-20020a056a000ccf00b00537d8aa3bc3si36811897pfv.200.2022.10.24.06.33.52; Mon, 24 Oct 2022 06: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=nAYP8GDJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232059AbiJXNVZ (ORCPT + 99 others); Mon, 24 Oct 2022 09:21:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236324AbiJXNTz (ORCPT ); Mon, 24 Oct 2022 09:19: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 28BB9A7AA6; Mon, 24 Oct 2022 05:28: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 2F69E612F5; Mon, 24 Oct 2022 12:14:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43565C433D6; Mon, 24 Oct 2022 12:14:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613666; bh=gePGUbRyCmr1HqTy+cXj6xywnpe9R20ipRt3gOynQyk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nAYP8GDJLHWVJsCaaRExdA6yGO2zundKYuYWgI0IGxUSywO5ElPwCGbf9J5Teqt4m qcvzI5Wo/mglyg9xsCKMOLkpjMvuo9uYw3a7Xe7E3led6VKa+aJ462bC0VGcQwf3CY Y46k+Nvl/OdlAdBFTJgXY2NV65ykwbkSv4vh8Sno= 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.4 193/255] openvswitch: Fix double reporting of drops in dropwatch Date: Mon, 24 Oct 2022 13:31:43 +0200 Message-Id: <20221024113009.397443479@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576110440901335?= X-GMAIL-MSGID: =?utf-8?q?1747576110440901335?= 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 4f097bd3339e..63f36d6cd3f6 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -236,10 +236,17 @@ void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key) upcall.portid = ovs_vport_find_upcall_portid(p, skb); upcall.mru = OVS_CB(skb)->mru; error = ovs_dp_upcall(dp, skb, key, &upcall, 0); - if (unlikely(error)) - kfree_skb(skb); - else + switch (error) { + case 0: + case -EAGAIN: + case -ERESTARTSYS: + case -EINTR: consume_skb(skb); + break; + default: + kfree_skb(skb); + break; + } stats_counter = &stats->n_missed; goto out; } From patchwork Mon Oct 24 11:31: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: 8983 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp438862wru; Mon, 24 Oct 2022 06:01:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5+XOSWQtxWp+uWdEdpBLkTBvHpBhzmGUxt5iqh9fmTlooh8fEPjrVtX/MI1L+BqXXlr4gV X-Received: by 2002:a65:42c7:0:b0:462:7158:c863 with SMTP id l7-20020a6542c7000000b004627158c863mr28711447pgp.590.1666616513819; Mon, 24 Oct 2022 06:01:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616513; cv=none; d=google.com; s=arc-20160816; b=bhmXBfT7HQGeDVlyKajtmzjFwoJ2jmbjBRAN4ODqSeoHgICAhwngZntNNjGpC7zOPQ 1WUrtOqI3okeM7rWO5DVj3QwGXSEEGNuwk3pW9uN3/YiIQ7lbPHqf4Nq5KJJ++umUIOY 3sEzRVoxsezxvxQWzjxyDWLP4ydyOJXXf/ec4wqFn+0EgZlHmUcLbcIFcvXh/YeI5i9N upVQYhYRJsgT/lHoieXr8oVT94J6OkdSG3qXs+O0zk07I5+P/YNN6VUCu80W71knPxWd 9koGUwpRoC2eXGZip7uwAVtwQQKC56zmctsC2P5N1KRU+aaMj1Lx3/m3Z/OQAZRjSBv+ mC/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=JKVAtaPx6MvbX4+NsRQpoPgTkqL9Rb/lTwW0ikrVIlU=; b=VH1zuB7iFWy1zxrzZfuXwWKEV9pAd4rY66EyY6sBqv7xeZWMEhpv1zsVW7BHqHzviJ T8ulYoXp4v8HNALNfMDr3etseukQ/yW3hOM7ZLsFiiI3cAan7QvbEK2O7HiT4fhvrwlY y7iyd59hZnM+Alg9biAvvp+4RYZFISE4Jt6dGPxwdanB1vYXUKs/a4Izm5NYqweNnX7s cTUJiE/MecAD53flmGbgHlMW6w/ivuymGcG42/emdSMiVTT9uO1CfLwjKn1YAp1UiUmh 96Zyzw5eZra7lRidGLslXXOUJMF5Fwyl6tDem8E67miSfQVW3L48QuxqbJf//Ho4uNJx bSHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="XtLn2jT/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m10-20020a056a00080a00b0056bc1d790ebsi4968587pfk.57.2022.10.24.06.01.19; Mon, 24 Oct 2022 06:01: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="XtLn2jT/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234959AbiJXNAr (ORCPT + 99 others); Mon, 24 Oct 2022 09:00:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234872AbiJXM6j (ORCPT ); Mon, 24 Oct 2022 08:58: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 C217F97D55; Mon, 24 Oct 2022 05:17: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 CBBA26131B; Mon, 24 Oct 2022 12:14:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D99A1C433C1; Mon, 24 Oct 2022 12:14:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613669; bh=9XVHi6LjLIEvFxinmzDv+KRBll8JSc+JVj9D8ceuSkI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XtLn2jT/SCxL9A3hh+Q4DmnH6S12CLdeQlmklTEoDQHJH3W+Kb3WvMcQrE+JSmHYZ y4w+tbJCGY0j3vCTH+gdcEpzdARpjvTD6SbTlMoBZNIZYo8jkCJ8cFGLqqNg3D9g+0 6eBkBz6aEsLLl74OeTCE/AJ6O57Mt3ZJw/B8iAGo= 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.4 194/255] openvswitch: Fix overreporting of drops in dropwatch Date: Mon, 24 Oct 2022 13:31:44 +0200 Message-Id: <20221024113009.435496843@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574077819903939?= X-GMAIL-MSGID: =?utf-8?q?1747574077819903939?= 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 63f36d6cd3f6..41035ce0d23c 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -532,8 +532,9 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, out: if (err) skb_tx_error(skb); - kfree_skb(user_skb); - kfree_skb(nskb); + consume_skb(user_skb); + consume_skb(nskb); + return err; } From patchwork Mon Oct 24 11:31: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: 10187 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp641497wru; Mon, 24 Oct 2022 13:35:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6OaDzNXw4BbOt5wNKg13mm0Yll0XBFXnNOxx7I1OqFmiWm7tGvBN0IuH8i5818rttlrH2N X-Received: by 2002:a17:902:b907:b0:178:2898:8084 with SMTP id bf7-20020a170902b90700b0017828988084mr34531664plb.140.1666643731455; Mon, 24 Oct 2022 13:35:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643731; cv=none; d=google.com; s=arc-20160816; b=cYLe4K2Da68J/Li8bqPzXtoRfxVP+cy4h816OFYGXFgLNfxQMq/yQ33aVRlRglols6 tM7OQ7TrWuGX0BXrzrg4g+Y20nAXR+GNwk+wz5VxAQspT+UVGmap3Alid44f0el9U0nE H6se6LgEeI2oFy2stplcY3YEq/7nayWoKH7TKaVi/jDGIffIdbJP12w/n4aszZGKGh3H IdLSDXtyiJAZvw5mzLDJESrQQ5//nUgpoBIz2GEBcn/CRt0P7145Xprggtdp5gJJr35a rWwo/iuslied8xG3AO3OBZhUT6w4QAyBvMRY3VdIvRlbSU9jp/x/HNYU5hqBLo91UM1W ScCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oOlb2+i1ip6EWjora7aO+9h21b9U++R2vB7ip3QyFdw=; b=TFSWMONpup8BESECLSO+TcHl/ZmXMFlgtJK2h7ewLoTenFz7YmJJek6RYp3QhxUKC3 CchtN781yHAzJpYEDQ07zcOMNi2IZfQUyb/x+Fb/LViMLxQTdb6un38Gp8X4uVdUwQ7j /s71MwmThsmp8iCO5wE7w33tEdt90ntvvk88I8kngZNW3wHZepfymOxS+AVuQgzCN8Ze GxYyOFwWMVjHkDh//BENslSoPPkKYPGOL8/cIidXWvET+GpGyqnQzxoHf/L9AQMdKM1u NcSmoza95V/lE6M7pqtR6JP3gJFRXeNA1Z9dSXRUPjRUNeLhivGF+zMnEkz26QlB8z4K IMCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XRKF8Q06; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o11-20020a170903210b00b0018537cc29f9si492029ple.15.2022.10.24.13.35.15; Mon, 24 Oct 2022 13:35: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=XRKF8Q06; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233604AbiJXUZX (ORCPT + 99 others); Mon, 24 Oct 2022 16:25:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233454AbiJXUXY (ORCPT ); Mon, 24 Oct 2022 16:23:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E217413F48; Mon, 24 Oct 2022 11:38: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 21F1AB810B2; Mon, 24 Oct 2022 12:14:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 733A1C433C1; Mon, 24 Oct 2022 12:14:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613671; bh=NMLKHiEK9NjSAgTP2LcnDOFgdc0G48TbfOyUUvIGw5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XRKF8Q06Lv++LwgwFal8wutGEFQP4JUAgBftMbCdaZdqZJCoDYUryystFnh75p6CU 6Wq4AaUJGpVyUIgxXJHfOpfuuuIM/TKLhugTssi054x94TJilQNtlrJV5avscacUQr inK8hIZKCDe51xvI9H3uDHpJx466DXNPxbnA4xZo= 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.4 195/255] tcp: annotate data-race around tcp_md5sig_pool_populated Date: Mon, 24 Oct 2022 13:31:45 +0200 Message-Id: <20221024113009.475095136@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602617169787258?= X-GMAIL-MSGID: =?utf-8?q?1747602617169787258?= 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 2da4f852fc58..aeeeaf2d6482 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -3770,12 +3770,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) { @@ -3786,7 +3790,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); @@ -3802,7 +3807,8 @@ struct tcp_md5sig_pool *tcp_get_md5sig_pool(void) { local_bh_disable(); - if (tcp_md5sig_pool_populated) { + /* Paired with WRITE_ONCE() from __tcp_alloc_md5sig_pool() */ + if (READ_ONCE(tcp_md5sig_pool_populated)) { /* coupled with smp_wmb() in __tcp_alloc_md5sig_pool() */ smp_rmb(); return this_cpu_ptr(&tcp_md5sig_pool); From patchwork Mon Oct 24 11:31: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: 10192 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp641668wru; Mon, 24 Oct 2022 13:36:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5jZ0xCwrALxv/rAy4t1voTZcwhaEIGbUkLGCRssFxTzL/IOUk8aKRb9cUcKhKA2l33Vs3C X-Received: by 2002:a17:90b:3e81:b0:20d:bbe5:f332 with SMTP id rj1-20020a17090b3e8100b0020dbbe5f332mr64965935pjb.112.1666643764977; Mon, 24 Oct 2022 13:36:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643764; cv=none; d=google.com; s=arc-20160816; b=absvhPbU6bKSVCEYKBo3wG3h2Ry7VcGx2/LZ5ZlIELiQB/tBZV2jT6IA2L3LTK6+Mp p3K9oCppf3l0vrv2tdmz4YJ34MYQgTPw5fX+zhqPP8Z8weyyAypewmzDHvdzVIZTv03W 6r1xUQE9cCa+4JKxWc8OJDwbIWsNkmKcUS/8Oa/hB5/A2R1tIz0sMCF3LlaMYzzbCMLu t7QmiIvlkNuCth9jlH5iJSZb4/WW3VoZDIscd1dmsZfKwUqo2FMHy9OsdvpQSvT5xX3N GhfWHiHhrsq1l0Mpey8nGr45DiPEj89dd8QEEZS63nS4tGK1XjGo5F0y91+Wtx/kr3mh LDsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=kV98iufbgVy4x96wEmP57LtzzDg/D8MTdTfAXeZ5rASVi5p+9nAP6ZjSZ+OIt08+YV ZHOA5GDIJTiUZYs/QcFvvhumAL6YZEPzjMO3jyIDmIyFkyZeHzL2ijniR02tu5ESuzJ6 BzZ0yEqlmPxGcAvVXxHTbVJ2njoPQbxmal7cHdaYu6cEsBwhZKe/FqTJ2/WOpRFIknrV VvsRVtgy6lWvrUyVVPwJwALfy/jc/TEXUz6V8JmG0RKIGI0w5xWYtk0T+cG/DD5sEe67 DvD7f8f6T0DrzSKlW15vKfAbHOW5y6bMRsDXBGanvA0kVF3xlRaQishkcNd77+m5lR+9 LPnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D6t9KljZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a6381c2000000b0045fa6e37564si376442pgd.816.2022.10.24.13.35.43; Mon, 24 Oct 2022 13: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=D6t9KljZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233676AbiJXUZ7 (ORCPT + 99 others); Mon, 24 Oct 2022 16:25:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234402AbiJXUYd (ORCPT ); Mon, 24 Oct 2022 16:24: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 502949AFC8; Mon, 24 Oct 2022 11:39: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 5A07EB815F8; Mon, 24 Oct 2022 12:13:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADA66C433D6; Mon, 24 Oct 2022 12:13:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613592; bh=uFZzpqGeI0F+s1iei+vQqMl4q+FdPp2Sji8X1gj9HgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D6t9KljZ5o/O+VeOZzWV2Akv5ywqeMQfmlWHJmLywf54C4nJGRzLkbui1gabRFq9p LJ6FNbQVFk7XqRJlCMKT+Q10xCJPFpSKgF6dgzmTEToOabvcsko7oRhWEyPVDc6Y9o 7NvLQKcIjj68Okn9g7QGFNXUzJbqlZ2D8UstqP10= 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.4 196/255] wifi: ath9k: avoid uninit memory read in ath9k_htc_rx_msg() Date: Mon, 24 Oct 2022 13:31:46 +0200 Message-Id: <20221024113009.505907514@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602652678971144?= X-GMAIL-MSGID: =?utf-8?q?1747602652678971144?= 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 Mon Oct 24 11:31:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8966 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp436911wru; Mon, 24 Oct 2022 05:58:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4E1x1kX541cIwCeDanuFlSY3+do4Qrm44gLnAj2+Y82ds9AunX2d20Xx26eSCm41FkvtEz X-Received: by 2002:a63:ed58:0:b0:439:b3a:4f01 with SMTP id m24-20020a63ed58000000b004390b3a4f01mr28172404pgk.327.1666616305845; Mon, 24 Oct 2022 05:58:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616305; cv=none; d=google.com; s=arc-20160816; b=0UUBwcGLDzx6E0Isn5K7QSFaO4A5a7PY2IIz3/laSFzWgENFkDXXYWtn4eILPY+Bhc 0A8gSuJid508YDZrXtBollaG1bEY0/U/+Bgf8Ifq3TYACRT7Z8d+ZwR/Xpr2FKM23ukW n/yk5QO0n6pFz//EeymWKJk3bAg6QKWRZkz/pG5ZLyrPHf/lTMYbzUxPsJzeGtmmEU2b tFZORjZtOg0lFgjBULabHwqvEVoQo8R+6vKW7itjPPxxfO59yOfWl52tWiJKuCxEOHsh TwGVS5BXW7FXCOlMkRuvKWG/vom4y6QvfAV6UDA9Tzb0iJ9dSox91ak5tE2jZbyKTlxD Cpbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4BgnxY8Xq7pAa2cP7T34R31PX0cLoamtQqcxDEYuJgk=; b=V2/m8xHbHNTtaZJP59sqtXONzYeCucod11ENPznTE1VEjWeJm4YRVL5JWgk+BNP/EP 1ZMZmRrzKDRkDfvKtPlIRO6Xg+XyeUD51wqvwc0MPdAqNtddlSpAF8HwZWHN4DPpjOw/ XJkyzlJzA6MkhnPSEJ/oCi5YH0vDQVHHmr6foSs03Xtna5JraGeP14xZedoS01hZGlWo qE/x5OKqnIrU2iYTFPOlQ14AgKeBkQOmjEMuIeaom2y9i7FpxPGezNuLH5VHSbgVgC+R 12Y9pLR7pnEk4lAtq1T63xn6szlHmCquLxjszSiXtCoBd9FObG/siGae+kAMjA+Yb1Yb vgSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=i9vJlWz7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t22-20020a634616000000b00434ba40afd5si36534472pga.873.2022.10.24.05.58.12; Mon, 24 Oct 2022 05:58: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=i9vJlWz7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234803AbiJXM5e (ORCPT + 99 others); Mon, 24 Oct 2022 08:57:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232122AbiJXM5M (ORCPT ); Mon, 24 Oct 2022 08:57: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 94A4C95E63; Mon, 24 Oct 2022 05:16: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 3F8EB612BB; Mon, 24 Oct 2022 12:13:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51A6EC433D6; Mon, 24 Oct 2022 12:13:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613594; bh=3ZJ2Dr8BARql+3f/+Ul44E6zF7y3fz2ppwdvpIevRAw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i9vJlWz7oCU70JM6ftD8ti0BD3X1xNmgYImDcrCt+oZ8XrHZDWmVVPX8Dwswp+NDH 94Cnxg2bieWoCAaOIBU3mSNtIgrcuFH56su5AHcrkFKDSPOo6Tip2g225pSLCNYbKG xF1iyUJJu30MDQQAEgteRIt9MdW1o+pU4gEqFpVw= 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.4 197/255] xfrm: Update ipcomp_scratches with NULL when freed Date: Mon, 24 Oct 2022 13:31:47 +0200 Message-Id: <20221024113009.545061040@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573859736401770?= X-GMAIL-MSGID: =?utf-8?q?1747573859736401770?= 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 4d422447aadc..4fca4b6cec8b 100644 --- a/net/xfrm/xfrm_ipcomp.c +++ b/net/xfrm/xfrm_ipcomp.c @@ -212,6 +212,7 @@ static void ipcomp_free_scratches(void) vfree(*per_cpu_ptr(scratches, i)); free_percpu(scratches); + ipcomp_scratches = NULL; } static void * __percpu *ipcomp_alloc_scratches(void) From patchwork Mon Oct 24 11:31: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: 8969 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp437106wru; Mon, 24 Oct 2022 05:58:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM73KQyr9Xyaf073rGqRmo0oaev8qVtrStXBEfu/Tb4h1CAjPBKTX8ykqImv/CR87KLTpCzV X-Received: by 2002:a05:6a00:2446:b0:528:5da9:cc7 with SMTP id d6-20020a056a00244600b005285da90cc7mr33938910pfj.51.1666616324655; Mon, 24 Oct 2022 05:58:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616324; cv=none; d=google.com; s=arc-20160816; b=OPBYFG+R4vKqmUW/EDUaCz9M7qEglyVBQn10Ej2KIqOwp3lQTMYZ86W3h6Fdk0G9TB h7i9mm63CMYb7LNkbQtLt8e0UuV04FwE57aJoj/K+fGOMu1OaRrpxGRK2NZNQTxbtH9d lLRoe7y5P3N0uDQ5YpO/oWymqH4lchi9IJ/xbD1JcaTAbkNPVoZvumAhvFmzZhQvJnLe bPSVE1Gqom04nFMgakTI7eED9nCN5JIj8rplhOz7EX3azoSSh/8BPuP9GdEFZ6iDtY1j dyjdzOrTTD8jWSvhTxk8WuzmBwtKb69IT600J14rnlPBQNA9qRXRQvr8g6mFYp4L1tnN YXdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kHvgIABg3qqPXF3cnvJydRi8bKSbw6xuEk6QP3pxuqg=; b=fKadKQxbgdp4mPedlEUtu9FFLIbqDf8fV1hdTWVJAwHa9a/2VU4MLfkHW3F2FIOC+b HiRSnyC1pw1TOeFocTbypTtjFgy7keIXmt4jdZQzI7W+UWIx5Cvgb021lDYhWdv50cNV JPlmplpkx4dxf7VWnMSeEWMco08FpDqS4NaOQ9r+TtZEax6dhNpesKlycFyrbuK+B+Bb VZM/+do/504tXg3pKIUKrr86s/6SxuG3iY/pFJ3yLCwdPxcaZyruE8nAltJAkLf2M06g MhIoKRh1zys8LEuow6ibqDMXSOucuvxQd+ajlc4Qftu0l2bBMl+4ED6xYRbA9lBb6330 V6sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pk4kRJNc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z9-20020a634c09000000b00438d7ca729bsi33085862pga.207.2022.10.24.05.58.31; Mon, 24 Oct 2022 05: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=pk4kRJNc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234852AbiJXM5s (ORCPT + 99 others); Mon, 24 Oct 2022 08:57:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234849AbiJXM5Z (ORCPT ); Mon, 24 Oct 2022 08:57: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 C2C8E96203; Mon, 24 Oct 2022 05:16: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 D2FAE61311; Mon, 24 Oct 2022 12:13:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9B46C433D6; Mon, 24 Oct 2022 12:13:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613597; bh=DmKl3AC4K8Xq5BhfsENEDctHS3UNUA0S8jQKRCZMKjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pk4kRJNcjoxp6wSbMUXCbqUXRG5NFxFsHi6rYMpziP/m0x+oEbNngv8+eQ3R39+x5 4jLwZI3GgxJ6Wr4dIKHOA/C5ygE9pzm1A8Yg2QSXH2oY11D98hGCQzMR4WMJt29Azr 35SE/OSHW4Tb1QbKgRymmhN2ZQRukYfaN5sRiBuA= 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.4 198/255] wifi: brcmfmac: fix use-after-free bug in brcmf_netdev_start_xmit() Date: Mon, 24 Oct 2022 13:31:48 +0200 Message-Id: <20221024113009.576851342@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573879540035581?= X-GMAIL-MSGID: =?utf-8?q?1747573879540035581?= 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 edb79e9665dc..5b7c1b99273d 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c @@ -290,6 +290,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); @@ -361,7 +362,7 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb, ndev->stats.tx_dropped++; } else { ndev->stats.tx_packets++; - ndev->stats.tx_bytes += skb->len; + ndev->stats.tx_bytes += tx_bytes; } /* Return ok: we always eat the packet */ From patchwork Mon Oct 24 11:31: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: 10415 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp716855wru; Mon, 24 Oct 2022 17:11:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5FS0XKwpqOFgecFwAuH0w9E2ZzQ8aFGhHLO59f4Ha4VABG+j8Tbdg3UksYQl2Tvmpkb2I4 X-Received: by 2002:a17:90b:198b:b0:213:2574:7e0e with SMTP id mv11-20020a17090b198b00b0021325747e0emr5062734pjb.177.1666656699240; Mon, 24 Oct 2022 17:11:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666656699; cv=none; d=google.com; s=arc-20160816; b=FF/Huzkri4Lzrus+2x6vCZllgK+u0Rseyi5ubLag0g7Z2bmUlzbtfA6GHCBQT74b3E 05lfQtivwyE31zr5j6ICQIsrhcGdb0YJiCj8ckrf/biSsy5JtZUeLFYe1ejjtqYwJBof k99Pk7rdRn3fQiaOrDD/L6WXl3koWDkeEPbjyPIqfSeS7qMrZpkiqK0e19aY0jW2fmUX CE5XgeI0dxReoiS5RjZB3Zn1sbKWpG2lBjBN1tADbc1AtMBMMfXV6WqLx/q7kdC4jNrq wfdGEpZvLxtmPvV6UXcQVtUjCSeQnT6TRUwdcMEsbogP3sl0C2gpbvi3USp45PP0Od1j YjEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=l/3bhiy5xV8RtLF9sXPhXHWGDzyYEJ5HF8XoDz7y7S4=; b=k9km2BUxjMWj83ZlX5rBNAOTVD/vJSf8m9N4uVIowmu8YQ7chsMrQpy/oSjmJRZJec GPyxvrHvTLRIFaUtTqM00nQ5RlJgmhtStSR6PAMC3Pbqcuvt5zz4nuqYwzwKsJNG+Bph rxbPw2kPuiVPRbepZ8u4r77435Jusjm1i36aeA2sExV3zPRBzBZGOM/dX+dOCAyJPPDh sDWP5lhLgUYcCTprvNZqf50eVAfrNciMHduVh4SEa0nAepYmAe1bHNZ0Za9rVeGdf1Bc QGNTUC3LcyKX+BuWR0C3U0mKM7WzCbQwQeEjN6XkwuvXtJPCLtoGATJ+m4hjRwQdI2OZ mtTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="gThlMcj/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v71-20020a63894a000000b00434d869e339si905712pgd.512.2022.10.24.17.11.26; Mon, 24 Oct 2022 17: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="gThlMcj/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230163AbiJXXyZ (ORCPT + 99 others); Mon, 24 Oct 2022 19:54:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230234AbiJXXxt (ORCPT ); Mon, 24 Oct 2022 19:53: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 5073D2CB8E7; Mon, 24 Oct 2022 15:11: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 A04F3B81606; Mon, 24 Oct 2022 12:13:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7671C43148; Mon, 24 Oct 2022 12:13:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613600; bh=QKNgzoxYek1Ubv+lLGCk5GbVzg63S5k1MsO7eIVpwu4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gThlMcj/Y0KhmqC6bkTyEGeXyHPMeQKP52az+qp5NUpcBfFwMftUiPxv/FsJJyMDv E+ODPchtM7dHDsblVwvIS3fZywgdK5fGP6vkaNyc1O8gE49diCcEEnKOLusVM2PVNO 1Fjx1Qm/xPyFDA0y4XR5DP7lbkf03n5+8Vb4SPqg= 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.4 199/255] Bluetooth: L2CAP: initialize delayed works at l2cap_chan_create() Date: Mon, 24 Oct 2022 13:31:49 +0200 Message-Id: <20221024113009.626382689@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747616214850724442?= X-GMAIL-MSGID: =?utf-8?q?1747616214850724442?= 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 3682d2e1cd7d..442432f89be1 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -60,6 +60,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) { @@ -475,6 +478,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; @@ -3163,10 +3169,6 @@ int l2cap_ertm_init(struct l2cap_chan *chan) chan->rx_state = L2CAP_RX_STATE_RECV; chan->tx_state = L2CAP_TX_STATE_XMIT; - INIT_DELAYED_WORK(&chan->retrans_timer, l2cap_retrans_timeout); - INIT_DELAYED_WORK(&chan->monitor_timer, l2cap_monitor_timeout); - INIT_DELAYED_WORK(&chan->ack_timer, l2cap_ack_timeout); - skb_queue_head_init(&chan->srej_q); err = l2cap_seq_list_init(&chan->srej_list, chan->tx_win); From patchwork Mon Oct 24 11:31: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: 10163 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp640283wru; Mon, 24 Oct 2022 13:32:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7e7sJADXQk0n9H+pIPfn46uIt7E/lRSZQIIbi+f1hdJXH/MEV8wkARkSUWTCYjGnU+Kt3P X-Received: by 2002:a05:6402:354d:b0:45c:b772:5ef4 with SMTP id f13-20020a056402354d00b0045cb7725ef4mr33287058edd.225.1666643533191; Mon, 24 Oct 2022 13:32:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643533; cv=none; d=google.com; s=arc-20160816; b=dZ1CEyp0rOihasJNn8UmhxJ6ntXULEph0xt+yPb7VZL20uY7WNP+cpkC8pxcS06wd+ 2E2tpt6pVe+hn22hLAgBpdOEKYeAkrdAj+FuLIqg2b5oq9X8PZCJ1sU9EgnlzZoZwBx5 O4ubmMMEfUo/ibMffIKKAuwUID6+XuPPlXWh3xhxLB2aLiMgaSS/tWr1Jv1P6CSOD1Co ZHTe02rkpmp2HOqmxRBPOOvGhqoIWALSYqOZIaq7iDxmfHN3pCSBvsnPkdZTlJ9BvDXA LoZIfxzNWGVezbyYkJaXFeywrjxJXaE6RKJzg81hmaxh1cUMgYltSdzY+OAz4fZpigig BjGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GyxGt+SWXQTAwYz4R+BoKPDTe7QaEX+DSk21RVUtlkc=; b=agBQyGPOtGegm9MNh8vrwMZfLUD2LHg+FfnBRsjWLR9VoEHiQb+l92lwmAicM0kg+x qZJVDmWpyanvrklWvAtzIH4aMgzPxB0BBh/m1poHiNlE0qPTyI6ku9AY4EKMTtO13VsO obz4Wz8JHfENq7QvQzUneRMem62jAEInpOaWS8Unss+uQNigHeYH4zp0NXAS+lKLoHkR t24FSxNngcamJsTE0e+WajHQQGS7H3CV+YSmoKnO/WWmQu16WVHoCXl+JVVmU+3EVetf BZ5S6jxF/ns9iUzJYtQ1vR3rj1UlHp2pEmmrqo9vlV2EpM94wo4tbjZ3H6KmkK4sXmLq BJxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gVnODDD8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dz21-20020a0564021d5500b0045902845795si816340edb.557.2022.10.24.13.31.49; Mon, 24 Oct 2022 13:32: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=gVnODDD8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230374AbiJXUWG (ORCPT + 99 others); Mon, 24 Oct 2022 16:22:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234055AbiJXUVN (ORCPT ); Mon, 24 Oct 2022 16:21: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 A8D9A1217CE; Mon, 24 Oct 2022 11:37:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 72CFCB815FE; Mon, 24 Oct 2022 12:13:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7B1EC43148; Mon, 24 Oct 2022 12:13:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613603; bh=/BleCwNH4q+MxKT7DR0P99zio7f8ZwEn9aOrqdQJuJE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gVnODDD8/3VTsdPbxja7M9YOQInd2GFnrE6MP/4izB2rCBP+cYZ1lIaIraCVl61xR NocnxUXnqYNzntTVLUL0D5ivrdsmpROs6midWPzSR9Y4KRPGpu0Fd7TczDmqsv9T9W fctflicsPjwnGO5rl2YenEcnOBMzp//nkfR0VYlo= 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.4 200/255] Bluetooth: hci_sysfs: Fix attempting to call device_add multiple times Date: Mon, 24 Oct 2022 13:31:50 +0200 Message-Id: <20221024113009.665739363@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602409159637132?= X-GMAIL-MSGID: =?utf-8?q?1747602409159637132?= From: Luiz Augusto von Dentz [ Upstream commit 448a496f760664d3e2e79466aa1787e6abc922b5 ] device_add shall not be called multiple times as stated in its documentation: 'Do not call this routine or device_register() more than once for any device structure' Syzkaller reports a bug as follows [1]: ------------[ cut here ]------------ kernel BUG at lib/list_debug.c:33! invalid opcode: 0000 [#1] PREEMPT SMP KASAN [...] Call Trace: __list_add include/linux/list.h:69 [inline] list_add_tail include/linux/list.h:102 [inline] kobj_kset_join lib/kobject.c:164 [inline] kobject_add_internal+0x18f/0x8f0 lib/kobject.c:214 kobject_add_varg lib/kobject.c:358 [inline] kobject_add+0x150/0x1c0 lib/kobject.c:410 device_add+0x368/0x1e90 drivers/base/core.c:3452 hci_conn_add_sysfs+0x9b/0x1b0 net/bluetooth/hci_sysfs.c:53 hci_le_cis_estabilished_evt+0x57c/0xae0 net/bluetooth/hci_event.c:6799 hci_le_meta_evt+0x2b8/0x510 net/bluetooth/hci_event.c:7110 hci_event_func net/bluetooth/hci_event.c:7440 [inline] hci_event_packet+0x63d/0xfd0 net/bluetooth/hci_event.c:7495 hci_rx_work+0xae7/0x1230 net/bluetooth/hci_core.c:4007 process_one_work+0x991/0x1610 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e4/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 Link: https://syzkaller.appspot.com/bug?id=da3246e2d33afdb92d66bc166a0934c5b146404a Signed-off-by: Luiz Augusto von Dentz Tested-by: Hawkins Jiawei Signed-off-by: Sasha Levin --- net/bluetooth/hci_sysfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index b69d88b88d2e..ccd2c377bf83 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c @@ -48,6 +48,9 @@ void hci_conn_add_sysfs(struct hci_conn *conn) BT_DBG("conn %p", conn); + if (device_is_registered(&conn->dev)) + return; + dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle); if (device_add(&conn->dev) < 0) { From patchwork Mon Oct 24 11:31: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: 10178 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp640985wru; Mon, 24 Oct 2022 13:34:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7TYsy0ibkZ25v0udpnBRuOhYgoPfwh/Idy3iruKgIhvJ5ld3ZxgzsRUH5kIdY56HSjgOug X-Received: by 2002:a17:902:e790:b0:183:88dd:1d30 with SMTP id cp16-20020a170902e79000b0018388dd1d30mr35294108plb.62.1666643646074; Mon, 24 Oct 2022 13:34:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643646; cv=none; d=google.com; s=arc-20160816; b=ERex7TBnkPOsBB98zWvH0d8N1B2RxhqAIs4RyJvXUtIevaun/2FpxGe7e3tLt74Ro2 c22e5tTL7Nx08oN9DbX6UttaqTSBY8dUUJuyXwURS1hCi7Aik7cANamd4YDBcTxFNPZb kPBM1Q/p8ttAIZZGIs4HWZ6L6H40+AKWtslfX11Og3+ApMKXLSsZkf8+Jd+pMVVAygmG 73pRNAlC6zSdlCoIQdyAbBl8hr306l03o11Q0NhiLeQPAQd1TeDHP0E5C8h8G8H0W7FZ TxKWfuubq1QkG1gFG/jD+b02QZNpc14zQHvs/a71Z/ZQwnJVpkT79PbT7ulSeM6S/EyF GuXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qSilnuQKh3wu48WyIcdpNKPyo8Rb/ADYjdccpCk+yoM=; b=fTt2HEjiW+3TbB4SZn8HCY6sEtFiMiN18qecS9pg5RSd5hel/U7UG2Z4pgTccVdCqK OVUFtgFtWw8/6BHnM9ySsMJYz8j4RaIHVm7ZNLMMnHlg6hBSLVKUq9y5mXhZQOXC9sf/ 4AM2Pl55wpGwYeBCqYkP0HkM8S1CLbS+MOk2+bb+XPRh4r/sNpGlXHtOBjn0AYwgBOWC MVEb33r/Du+a1pG8eTnaNLsJ004qYsgX2IcY6wwi33ccr9tgLoKhCuRHKa/4hTap0anZ 6ZlXqHHNzptk8h5fNeP9ygBKMhfzs8aWQZa7Z1ThBJPUWC3pHcfZAR7pPZyIwmBnWP4s vGlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TEbV9PUs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056a00194b00b00563653bc151si737585pfk.110.2022.10.24.13.33.51; Mon, 24 Oct 2022 13:34: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=TEbV9PUs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231584AbiJXUXn (ORCPT + 99 others); Mon, 24 Oct 2022 16:23:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234138AbiJXUWz (ORCPT ); Mon, 24 Oct 2022 16:22:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF4F28BBAA; Mon, 24 Oct 2022 11:38: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 641A8B815F0; Mon, 24 Oct 2022 12:13:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 860E6C433B5; Mon, 24 Oct 2022 12:13:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613606; bh=LQ0m32+xLnc7SlLTPzhWZlsx030LdZRIcjFUrM6CNfc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TEbV9PUsMp2XVd6w0GCllpGAN+z03lH2WBe7k3XiLBaVna3cS0mA7xSUX6pQFiWot jtnX4sgJX/TTRGWl/LEpI6rSjYtz5SDkK7oQxJb/Bbb3vb1j6acy5cVKHwSub1DMfA m7unnr/i1MSMNh6uSk1q7YX4e7jkTabQBK/0XySI= 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.4 201/255] can: bcm: check the result of can_send() in bcm_can_tx() Date: Mon, 24 Oct 2022 13:31:51 +0200 Message-Id: <20221024113009.694860245@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602527821673824?= X-GMAIL-MSGID: =?utf-8?q?1747602527821673824?= 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 63d81147fb4e..fbf1143a56e1 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c @@ -276,6 +276,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) @@ -300,11 +301,11 @@ static void bcm_can_tx(struct bcm_op *op) /* send with loopback */ skb->dev = dev; can_skb_set_owner(skb, op->sk); - can_send(skb, 1); + err = can_send(skb, 1); + if (!err) + op->frames_abs++; - /* update statistics */ op->currframe++; - op->frames_abs++; /* reached last frame? */ if (op->currframe >= op->nframes) From patchwork Mon Oct 24 11:31: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: 10185 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp641474wru; Mon, 24 Oct 2022 13:35:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ZwFPdQdClXYNk7pAbcaH0/MywGcrOA9jMPtmLaLa4zA7GwCYxQLDeV3Rv/BdKPdLywFvc X-Received: by 2002:a17:90a:1b65:b0:1f7:4725:aa6e with SMTP id q92-20020a17090a1b6500b001f74725aa6emr40058738pjq.179.1666643728078; Mon, 24 Oct 2022 13:35:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643728; cv=none; d=google.com; s=arc-20160816; b=vK9OCJsnt78NTi5E+Kv10VLHs8KqnfK+nlgS+o3RG67URDyW54mWzzmg26pI/Gy8gV PNK/kFbdEZiV9Zc/b0iPDGJbzovqecdhWxlsaG0gJH0FSOMnacRYifAssCpAP4Lj0fU0 wZzyMa4hotoelvYm/E3pKuXzrbW3e+anIYANGSGN1qR4hGWBVHM5hnBEAskhUQMgij+g U2XzQ/yvo57JZcQrE96NClGg0/XtlBykxQQO+wI97eKYxhsMtLJZpeTdzVek5zj/Octn rC2TNXUjcTaZg/LHOg7bgWfOUFQTZ1PCZ0xdCQlXJQxbZcGm7aRJ/vaGk24o4XsLBN/d ZR4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rFkrgv48tFsyQD5nqYrOtg0LdzKN7uiq09nrCtyrIxk=; b=ViVFZqUhlfGLy22dqoBW2af0z4w0xPP7/liai1Gy8WxhKthOK2YLrfANBJz36WVfCd 8JLW+rI4/54wj0t7R/nMys2ed0h+xdcR7IHEMTDxHvO7M7YLdhya4Jv0FCXF2l2aKdgD +xS/muXMkWqjpp4LASkt0dFsvKknQ7g6B10f7KyYnEDw0P1ahHId5L0kGvac4FcqzMIg FSOyWOKPWm2zpIJPLOmIanvtSowTN6XNAddP30X5OrZ+cgviGOm0Cbq8bzq47pfwLh/Q g/XXxkpFilQc6SPInI9s9eiBljefD9mVdrD5IcJ/vpwNGDsNcB1W2Kd5kHK/hK2oGf7e 42PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="YazZ8VU/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l63-20020a638842000000b0043a107f33ccsi515152pgd.205.2022.10.24.13.35.12; Mon, 24 Oct 2022 13:35: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="YazZ8VU/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232689AbiJXUZI (ORCPT + 99 others); Mon, 24 Oct 2022 16:25:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232985AbiJXUXP (ORCPT ); Mon, 24 Oct 2022 16:23: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 32CD014D0B; Mon, 24 Oct 2022 11:38: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 070A6B81603; Mon, 24 Oct 2022 12:13:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60F84C433D6; Mon, 24 Oct 2022 12:13:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613608; bh=29BCPCbZfYMbwNEpy/5MBOlEcHtdxVBIrRAdPeoNTg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YazZ8VU/sqAh21HtZm0wna48dPwSEazeBumqFDgi6szXUgSgILg55xul41d2Bi+m5 DgdnNEFgGtH2cTqL/Luds4seT2CCAMIkAuHy/xSWC46kKxegzfyTLtCk/lmhItMmKD HVemTswSqmS2EyssL9b0UtX3BKRUuPleO/i/Srhk= 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.4 202/255] wifi: rt2x00: dont run Rt5592 IQ calibration on MT7620 Date: Mon, 24 Oct 2022 13:31:52 +0200 Message-Id: <20221024113009.735881817@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602613892846656?= X-GMAIL-MSGID: =?utf-8?q?1747602613892846656?= 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 c99f1912e266..9b56a4df2e94 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -4355,7 +4355,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 Mon Oct 24 11:31:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10180 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp641095wru; Mon, 24 Oct 2022 13:34:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4J/TwPxpaMIqzjbsIyd+JId3KEboi4Cust0P8cAZwaFd0cRsT5+3IMxwEUkLNLCO8hofsj X-Received: by 2002:a17:906:9c83:b0:779:c14c:55e4 with SMTP id fj3-20020a1709069c8300b00779c14c55e4mr28505989ejc.619.1666643664444; Mon, 24 Oct 2022 13:34:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643664; cv=none; d=google.com; s=arc-20160816; b=FFzjNKQByE7ftG42eozkQ1EjiphPuGG8y6hHunZZpPLBE2DBp5lZ9ZSL7FL/0LS0lR IX4tcPWrAsIxT8TEIAN4CXyLJJQMkrt/5L/Gc31NQpzSWGhI4SmQ4tr8VikdQ3FTgQqL Xg5ZOVx6aI9u/INTcDiWDKXyMnHg0e/4RYwb3mAdEWDoaQvaSzVaHnfPteBLGhMngjm0 N+d0sIUeZwALzAm4BuIaBJDHaadvpYZeVCCpPlUQ8l0/IH2lXZ1wJvyIVe5NbfTxZ5hW mAWzM+4PpXUjYPTGJlXROuui7HmVZWTV7TWh+A1+t0FzZVMz3uVdN8XhpBBPLX1hiYyl KgqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rWP7V/pE3WSzH94pBIcopZtmS0zEDsa4+kNCfPxSfj0=; b=HG3upfAH9rQMnp0x14uZ1Mn90vxRMhwFx2KM5jREyKLuzL8ZJzhdPP2EcGmunnZePf DAPJFg8iaeK4eAain1AGYmZvf3FJlEdEEY+P1gAMs+y2HN9XtY417A8KiRZmv0s0rDr5 z1Yb8QH0hrZF2z005m1MKq//6E7LHfJyZ1mlEK6imxtJdDt0P8DLW065PLXfdWS78sGg XCwSHyoK8lGFrOVxt8I1TJmn7MUz5SvnEqyGls55zQAbmV4XTAWg522S4qX2KroxSHaQ sSdqoujssbBhLDo+zsi39bAoT3tWE+dTmmuBglmuPiXPuI+zpkA8LDEVxPAO0SZarRyC MUdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Gl6gCrT8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cr18-20020a170906d55200b0077ef2f9c8b7si675156ejc.922.2022.10.24.13.34.00; Mon, 24 Oct 2022 13:34: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=Gl6gCrT8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234201AbiJXUWV (ORCPT + 99 others); Mon, 24 Oct 2022 16:22:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234205AbiJXUV0 (ORCPT ); Mon, 24 Oct 2022 16:21: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 52FC31911E2; Mon, 24 Oct 2022 11:37: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 A2033B81608; Mon, 24 Oct 2022 12:13:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01C11C433D6; Mon, 24 Oct 2022 12:13:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613611; bh=1gc9qdUk4QPrmHgqlVxH3cCbyRHrywczdeucThVyjiM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gl6gCrT8NUVZsCN5QK+RZBlbW6loOVzSj5/9QBdWBKK6+B5N/85vI9WYQuMOfVHQg lVncCF/ZO/8urX2C3HsHSlhRkR1OHALMrcvVjwORHfBHcIKVc7XmVt5y67KJRqJRKg VpxwmivNuvMcpsI3V0Z4OJd/Evor6DY+BL5Pn6eU= 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.4 203/255] wifi: rt2x00: set correct TX_SW_CFG1 MAC register for MT7620 Date: Mon, 24 Oct 2022 13:31:53 +0200 Message-Id: <20221024113009.778081899@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602547161792054?= X-GMAIL-MSGID: =?utf-8?q?1747602547161792054?= 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 9b56a4df2e94..20491ff6bb76 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -5852,7 +5852,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 Mon Oct 24 11:31: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: 9711 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp545123wru; Mon, 24 Oct 2022 09:33:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4krDpLP4V7lNA+M5J6dVrAFVvtkgPoDggEKHoiU67JzPvJ/BaNRvDhmmgFqTMVqmvKS9nV X-Received: by 2002:a17:907:948f:b0:7a7:5fc8:909 with SMTP id dm15-20020a170907948f00b007a75fc80909mr6013151ejc.658.1666629221697; Mon, 24 Oct 2022 09:33:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629221; cv=none; d=google.com; s=arc-20160816; b=nI/9uuSmET3ke7f+j54x1/EaSCiYJ6c00Yqacaiuqj/XrQxfzP6XCphzVlPhATq8rn CpnAUVvkp3W2i8zES0Km7Dmhmnip/FDTTslKx8FewvAVey7GKE7PGMqgKiCyBZRnN4QB DyNiWlrwc6x+BF0udLCtYpTM4GiJtvBUo8H/FwoSDCO43owIEdzWub6m04rmyDbj3WWu +ATcC61DU4N7+b2+0OJWG6kZlLW3ztu88aL42eRfCUtqd4YO5NZpUWjzTpc5kKML2BnB Eo1dAMrIq2qHknJKWU4tK8K4qb0X31n+LRUzPqMiW7qnth1Iz5klG2egS3opwt+5zXw5 eUzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2INU/VeavexsNPVc7654RiMaGi+6HoK7yaRySQ4nmys=; b=Gf6A5a7F2UNC1o3AvCJYmwqKYJNpsIaY3PEpzvBLhQJCcIPseqrH5Zjr8nk47DRogZ yVopXUDSj2cdCP0Ek5ce/TYo/R4dMVBFnv28rn463Jlz08TWB3ZegMGKcxC38/UCRai0 OhHnJvwpLpAqJORK4souXl24Cv8tyN54TaUySUIHxlVTizCo0Q+ckkfBUm6Q/xRi2Tia JpuGELTu8maVIpxMFlxMOfwWEs4qygm81I4nRfAmD2cnNsfSVmt86+4rWk/1I05ocUwk YMdfTu8Is/z89OREgvfoPWN0hx2iua3mllUvM843l+PoKnttMDWnG9uVi9pobk0JsQni PtoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hlSk5fZn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs36-20020a1709073ea400b0078e27ef9510si141135ejc.747.2022.10.24.09.33.18; Mon, 24 Oct 2022 09:33: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=hlSk5fZn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233366AbiJXQQt (ORCPT + 99 others); Mon, 24 Oct 2022 12:16:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234723AbiJXQPH (ORCPT ); Mon, 24 Oct 2022 12:15:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1152419023; Mon, 24 Oct 2022 08:02: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 4A37CB8160D; Mon, 24 Oct 2022 12:13:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95B13C433C1; Mon, 24 Oct 2022 12:13:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613613; bh=4tiZo8G5eXP4COk8VAfglXey3elPrZGGdqNUfwvzuq8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hlSk5fZnRIvlwM8F0hpinjxAJ937snNPcMwiQMYrvgBmpiF0Kp+KUpQmcZiGWYHa1 Gb1RSb1F/ooenaunAdKEc/q149VGWVochG6lJQGVIbsLaPF9X2LcXsGVjOTid3knsh SI0DbjBrYQGeBCo3xQJLgsjrFbxSPr8SildBmq3M= 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.4 204/255] wifi: rt2x00: set VGC gain for both chains of MT7620 Date: Mon, 24 Oct 2022 13:31:54 +0200 Message-Id: <20221024113009.816394402@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587402566509659?= X-GMAIL-MSGID: =?utf-8?q?1747587402566509659?= 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 20491ff6bb76..ab0d673253f0 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -5629,7 +5629,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 Mon Oct 24 11:31: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: 9383 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp478070wru; Mon, 24 Oct 2022 07:16:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7eAkG39Dl+5IMOsS6fddbSMkyYWuhZ0jPzAwwu9utLT9BmLu1HdGld3OBJuMRsi6lmGJVF X-Received: by 2002:a17:907:7639:b0:79f:d1dd:2f86 with SMTP id jy25-20020a170907763900b0079fd1dd2f86mr11749898ejc.586.1666621009321; Mon, 24 Oct 2022 07:16:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621009; cv=none; d=google.com; s=arc-20160816; b=IBHwJuw4Z4368DBCQy7HqocgZTSaTPIthc4fKFsbVPlULBnbiCmnM/t7fExK+q84kH /OZ0jcxA/qwQcAzWYzdb3MCk/FsZBwN2EzzLZX1lmXaluK6QilYxOOq4MB0aEbshnQry VvHfMtfpF+DokYn98FLJADYfRESUg1dXNryExzDOgLFgVnw7Tp/MoPFiIkzzwRzEakzb m7p/BzbFZ0s0mwkeZpEQ6Sjv4jTZLkVhhPRRd1xZ0Ns6RvP8BlCPuj4/JTUl4Rj+0e0m PHnG4o4dyV/l6eEItne4XQebvqmCr1FlwnHCNxOGXhsZzufNWKbq4Dq00KfUxDae76KO U6rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QY6xAejFJlWZG1zvBTNL0DI/lyyDQekAjroTbmdeCOI=; b=kT6RuSxPAP0r9ywrTw1CtpXPDBBFZNbM/7kWmVtKRLz/IlJT7VbYwPXlx/qnL66GeC +HSJ6J5FIn+rHOpOETjNLYX3c9VSoLd01ig7Ej47spI/c0fvAipy09Eo5m9axkBtQDfl tIOJOtGGZqbSm32yMICoKF3aJbo4NWfziPDWzU9PomSN1+7ZCHWUarZpwYAuqsNpoRw4 p1+V2q5wCBA2/PawMOBPqO3i94Yl0tUvHASFGrUdStWRfzi+JM+qDCHfi7BkzYmZdpOv QlCSozBWXqPprVrFuvp6Mb8gXMZ8PcGuzK7ZQPk21e2+wPP4DmOTYWJnokDNhttVHMOt L0cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CnbzUlbz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lb25-20020a170907785900b00741d9a1e2dbsi25165578ejc.1004.2022.10.24.07.16.22; Mon, 24 Oct 2022 07:16: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=CnbzUlbz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235712AbiJXOCv (ORCPT + 99 others); Mon, 24 Oct 2022 10:02:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233281AbiJXOB7 (ORCPT ); Mon, 24 Oct 2022 10:01: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 6F1CE8FD7F; Mon, 24 Oct 2022 05:48: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 2477B612F3; Mon, 24 Oct 2022 12:13:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36AD6C433D6; Mon, 24 Oct 2022 12:13:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613616; bh=xGI2wG7CiwyktkV1VprJ5NZ4V+fFPQKZUvtJ9ivpDGg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CnbzUlbzL+xwIKAy1DkM1QqKRDBe3jaJIb+4qwhWgPHUUmpXnEoSUpdtqWHFSaqUN wxvZQxbu8ugeOPs5IoZ8l+YFkEO0cOIWu8jn2oCooriVWQdNO2M8qZ7X1mzCPBlb/8 EqhyX/f/3ZZ27kNjR21lsJ0Jn+71CZX0Kg2eNv5s= 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.4 205/255] wifi: rt2x00: set SoC wmac clock register Date: Mon, 24 Oct 2022 13:31:55 +0200 Message-Id: <20221024113009.855226789@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747578791270568448?= X-GMAIL-MSGID: =?utf-8?q?1747578791270568448?= 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 ab0d673253f0..c303d52b6820 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -6115,6 +6115,27 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) reg = rt2800_register_read(rt2x00dev, US_CYC_CNT); rt2x00_set_field32(®, US_CYC_CNT_CLOCK_CYCLE, 125); rt2800_register_write(rt2x00dev, US_CYC_CNT, reg); + } else if (rt2x00_is_soc(rt2x00dev)) { + struct clk *clk = clk_get_sys("bus", NULL); + int rate; + + if (IS_ERR(clk)) { + clk = clk_get_sys("cpu", NULL); + + if (IS_ERR(clk)) { + rate = 125; + } else { + rate = clk_get_rate(clk) / 3000000; + clk_put(clk); + } + } else { + rate = clk_get_rate(clk) / 1000000; + clk_put(clk); + } + + reg = rt2800_register_read(rt2x00dev, US_CYC_CNT); + rt2x00_set_field32(®, US_CYC_CNT_CLOCK_CYCLE, rate); + rt2800_register_write(rt2x00dev, US_CYC_CNT, reg); } reg = rt2800_register_read(rt2x00dev, HT_FBK_CFG0); From patchwork Mon Oct 24 11:31: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: 10263 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp644055wru; Mon, 24 Oct 2022 13:43:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5m3/jHSLj8k85xOX3+gPupWrgm3Q5DJFJaCHMu9STV5bxa9qyKGY4spA6/04KGAG3aY8nG X-Received: by 2002:a63:4f12:0:b0:46e:c4e4:f8c7 with SMTP id d18-20020a634f12000000b0046ec4e4f8c7mr14578611pgb.587.1666644225671; Mon, 24 Oct 2022 13:43:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666644225; cv=none; d=google.com; s=arc-20160816; b=iF++BePnncuhZCFNJbsExMzI1oRpTpKVElX6DvDKcYk21BxzFpFOQB8aefZy9HYPGz p6RgzoFNzSNRAFHsuLTE+up4O6+quKPtPG8ZEwS2eZHRkJ2unrzYphhWEMYrOqWq2K6v BVhh8fqLN9wYJuHuQT9+3EDJ2ghFDdcVrqwYsK0y+cRLwDCRLwJ5rJ4fsGWUE3DoMeyu ++uvFBB1/w94eGBYr05zTiYzwUB0nN0prvU0pUD+wk8UBoD1cD1dr/v7pTcHv5kzIq/+ 2Cp3re48xwsT7ILrbKnxzHzv6Ek0wN0uIum1eHZV1URGIvOIEEOG3x+3ZFouPG1XuR0/ 7UQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yWlIrQev7tLcJsiOFbKD1yRbzbHxgPdE1+YktLqUbq8=; b=f3hsZRvyhKVAX+HcHORvdlvhu3kEX3u9dUlRTimbClrvSBfp1tGXCQo+2PWa01LwtO 4DkgFCosyMmkyXQNPRc5U4SR8+XsBmPbOI+KwfS93I4uZCif6LScVhlcVjCmrkHU6LI4 T6ut7ml2CNxMQi0m53DVjVtU3cxyh5/x3z4HcjCIT1nQ/u+ZW3dVyDyXvU0EUM8kpsuw mgWwEEaG6cO0hjBmMffTQJQvU+3TEo3xEZ+LBEz9LHEMnhb7+WcwYEAlvefa+wpdhFJ0 t7FsEXiDhKYxZ1gt+11jNij98SG+WpG2qZaizsnk8uvJ/0UVmQxNIlhd4yUI4nqfU6CE RxLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=j7XMBlrr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090a86c200b0020c4fd9306bsi9285473pjv.166.2022.10.24.13.43.28; Mon, 24 Oct 2022 13: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=j7XMBlrr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235013AbiJXUnL (ORCPT + 99 others); Mon, 24 Oct 2022 16:43:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234921AbiJXUmj (ORCPT ); Mon, 24 Oct 2022 16:42: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 00315B56D5; Mon, 24 Oct 2022 11:50: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 1C87DB81607; Mon, 24 Oct 2022 12:13:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73133C433D7; Mon, 24 Oct 2022 12:13:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613621; bh=wmy+iPEfdsJK+DXEJ2w1jBmGv7JXyMDV5sPofoS9duo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j7XMBlrr2+VK8ah87oKK5krHbxC8WVQMJFfrH+6H8aZqKnfpNCI/fdlsuOzMqH+eu uP1579G7OwHp0dO7qLw3rKYohNfB/n56cIMbM9hyakbiDEReqroQ5F0S5a2pGYvXhM UCKL10jNHtmScj7xNCX1caP4tH7LtPTbrkXKBXjI= 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.4 206/255] wifi: rt2x00: correctly set BBP register 86 for MT7620 Date: Mon, 24 Oct 2022 13:31:56 +0200 Message-Id: <20221024113009.890838423@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747603135545786958?= X-GMAIL-MSGID: =?utf-8?q?1747603135545786958?= 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 c303d52b6820..32d2528cdd5f 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -4154,7 +4154,10 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain); - rt2800_bbp_write(rt2x00dev, 86, 0); + if (rt2x00_rt(rt2x00dev, RT6352)) + rt2800_bbp_write(rt2x00dev, 86, 0x38); + else + rt2800_bbp_write(rt2x00dev, 86, 0); } if (rf->channel <= 14) { From patchwork Mon Oct 24 11:31: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: 9713 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp545306wru; Mon, 24 Oct 2022 09:34:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5zGQrlRGOguukk8EbPtpYftOhagJOZdml+5QJyPwzFqTXcEC9VMO1+UOWHS6x3yHuzkOWR X-Received: by 2002:a17:906:5dce:b0:78d:ec48:6a58 with SMTP id p14-20020a1709065dce00b0078dec486a58mr28339490ejv.209.1666629247706; Mon, 24 Oct 2022 09:34:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629247; cv=none; d=google.com; s=arc-20160816; b=szXz2z8CMyt4l95PiI++0ws/GQDlQ92gkpRQmEbNMfYsIAV0pRHOThmauGLB6mTTMW eZcuzmfcMY4rfad3cVmqPQDWd9bZia9whWcvY0NLJ4uRRIObTk/06K/QkRgEO+rHTZNU iZwiWcAWOltSILna94Xx86idvm7ep2wtNenyNA4hlFd5BcNyPurscFfxUhk75IhD0vDD 1hVxgv1F7MmSCnISDz2y8w7fGQXJwTCcuFKn64gqugWPPEJ2kqTQFpa5wkyZRbFMSbU4 v6w/v2u0ZEQGtYN4b80FFmqk4GRuD5UtPFULG6DpBn9IBstTf00C0CLmFss4r/2FqDlP 7vuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lJphkTtAzH4ld1qb0GhesCL3tRQCHwdy5c6i2VyL6xs=; b=a41VSxjvqpLLNkyr4jiergXTHtTGthu5tSN06cciw67WHPldtcDACXZE+mXq5r6w2J IwJGQXzAz3qWijcdFUlre1FiNTN6n0axo5Ivo6e0y7cYtNWfiXp4mxZLw8X5w2Bgri2U sNHjWrmxLwjTHaKar6WULaWJTl7Fkanxd5mycZEjpsYinn3cb2gbXWHkIEtMiMnd4XUC X+d84ary5Jm5+dRR6I8drAb5AEoiquLOR2cJ1aBVW+4WzGeIm/cg90BNLz5ifi6gr5lM o4inJMFc5wPYywvsfnhIdYRY1J49LoNFPArVLnGZHc/alxctIl7sdWFGr470xhQwa8i/ 7JRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=K3yQK3zy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hd14-20020a170907968e00b0078db719e54csi236658ejc.98.2022.10.24.09.33.43; Mon, 24 Oct 2022 09: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=K3yQK3zy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231262AbiJXQUL (ORCPT + 99 others); Mon, 24 Oct 2022 12:20:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233483AbiJXQRz (ORCPT ); Mon, 24 Oct 2022 12:17: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 52A8FB2771; Mon, 24 Oct 2022 08:04: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 BCB04B8160F; Mon, 24 Oct 2022 12:13:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EA7CC433D6; Mon, 24 Oct 2022 12:13:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613624; bh=9F/WwTjHJoxdBWqRa6iOQ5UCJYl2sd5H82WhROoztuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K3yQK3zy3WEFiKnUcCtpwVPLCl5Jbxeo2SpANvwHQs8kErhDgxXsKKsocmh03tDKj nLx1sm1E7k+dtZJkbQIQlBnpl8/RnGIQqIis/kAgESELcu3aqpy+tXgI3Scka1uRFv 7DT390vePutMIkjbTDPl9ErVUz8iYlW5whoQii/w= 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.4 207/255] net: If sock is dead dont access socks sk_wq in sk_stream_wait_memory Date: Mon, 24 Oct 2022 13:31:57 +0200 Message-Id: <20221024113009.925828540@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587430145788488?= X-GMAIL-MSGID: =?utf-8?q?1747587430145788488?= 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 a166a32b411f..a61130504827 100644 --- a/net/core/stream.c +++ b/net/core/stream.c @@ -159,7 +159,8 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p) *timeo_p = current_timeo; } out: - remove_wait_queue(sk_sleep(sk), &wait); + if (!sock_flag(sk, SOCK_DEAD)) + remove_wait_queue(sk_sleep(sk), &wait); return err; do_error: From patchwork Mon Oct 24 11:31: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: 8970 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp437140wru; Mon, 24 Oct 2022 05:59:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM60g2REYfO73E4EgB7lhLI0MXl4OEu0Z7ZQ8MVeBVbFmM2M5qOzxET5xT3fjrYe3AYdWcjy X-Received: by 2002:a17:90a:4311:b0:20b:e232:5920 with SMTP id q17-20020a17090a431100b0020be2325920mr38795000pjg.190.1666616341144; Mon, 24 Oct 2022 05:59:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616341; cv=none; d=google.com; s=arc-20160816; b=Hfdgm0hYK1lopTqp8zmCy7b7CbAChV+e37hrErFMDhqivPnAeYIxEoJ1ymN3SPgC+L nEbEZm2jV8a+0RoJ5FoCY/LxNoL4n20RL27ma7QH9D6ok1KBbeMBCd+lVU/s7KEPDhrm nLZwM3j8zz0nf2OyypaMFKoXs7T1ZV0bu0WCgHno481C+IkBLS1Arst3PHAunBSgc5LO iL84taeQL/xhSa4WzY3t5STHwWXyKBkJPywz3LjRuRvvSMkzb4JWYnosKrPg+yyyXiZq i1S2pRgUP/tMum91SouTMbH6pWP6J9H9ywoiBqHozPlDiBE0zdMV/jJ/75XXqodMit3/ X3pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xB+Pkg0BpTVZ3oxEFCJQxCzPE0EgDsalp749Czr4PDU=; b=0dfhugBDiGTuRCOdEScxbJ5iRC5VBUKZ3htGNbK7aQbMhUvjbG2ewjm1r1C8jn3Pbz 1s06DjeEcU78NAvD/F10WnjbtPrMwKsB9GT+3G0pCss+9/Z/PJ/uttyMkLFePeVrbugE 4ltRQ6qNfACnEiOnriqQ0Llh88/L+/ya8coEctMbUsStq7l6knQSOCfX0vK0CXBih/ml w9yPgvV0dtRnyXA2ID+KXPpj6asp8brPYJsEoqagRchGmclFtnutVM9aC9B1waTCEEpn gVlH0YWrSvzAt7hlecPNHwD1Jo3tL93Z9l7woi2S6P+NpJqQ//pU4VI6grVp3M+agoRR bW/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Z3U3kpma; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a630147000000b004632044b838si36373497pgb.650.2022.10.24.05.58.43; Mon, 24 Oct 2022 05:59: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=Z3U3kpma; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234889AbiJXM6a (ORCPT + 99 others); Mon, 24 Oct 2022 08:58:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234834AbiJXM5k (ORCPT ); Mon, 24 Oct 2022 08:57: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 ACA8397D63; Mon, 24 Oct 2022 05:16: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 9D4C66131A; Mon, 24 Oct 2022 12:13:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF092C433D6; Mon, 24 Oct 2022 12:13:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613627; bh=maJ8fNNyCcC99rqyWAvsYKYOT4uvsH7Am3h5FOC+4NU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z3U3kpmaW/P/JB1ExNpfCjsy4CZ9RZWRgrqW7GpWjABOvmIigqiinl7jwSMV46qc5 onA8/F0hN5six1PGWLR4I6Oau5BV9jh7KHyOwVjv4CKQk3XGZWcPCtyEIosPAucgdl MCAmO5eM1WHQvnLAW9BZbe53+8EJ7Pdimm6QQ2r0= 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.4 208/255] Bluetooth: L2CAP: Fix user-after-free Date: Mon, 24 Oct 2022 13:31:58 +0200 Message-Id: <20221024113009.958321735@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573896444776231?= X-GMAIL-MSGID: =?utf-8?q?1747573896444776231?= 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 442432f89be1..2d28b4e49b7a 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -4066,6 +4066,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); @@ -4095,6 +4101,7 @@ static int l2cap_connect_create_rsp(struct l2cap_conn *conn, } l2cap_chan_unlock(chan); + l2cap_chan_put(chan); unlock: mutex_unlock(&conn->chan_lock); From patchwork Mon Oct 24 11:31: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: 9010 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp440716wru; Mon, 24 Oct 2022 06:04:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7WHJzGfC2dXBvxIWUcjYJQsexB2ri6I+p78B6v65zqa9kZJuAr9abaFxKhvVyRI7EU/xal X-Received: by 2002:a17:902:c40f:b0:186:b221:f378 with SMTP id k15-20020a170902c40f00b00186b221f378mr2560254plk.69.1666616683395; Mon, 24 Oct 2022 06:04:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616683; cv=none; d=google.com; s=arc-20160816; b=tMcUeQAO8+/jV+vYFEkRH3oUU2I4fPJEjOW7350xQmHk4KsFkis96vp0zHtlOR0o/1 HhliB126nT18GS4m6nBRhQPD3pz/8Wfc1u8lzqqRdHFM27wYAyHnj1jc5kmGFJL8qi1D jvwE9nyZumBZ8vsM8pbfr7AJQsXdktKVKnS9Hj0tEGmUIdm6/LojOnqj9/Cpc6tjEfP0 8Mu7lt+aGZSWYL7ryJsvPmzSnCwScas5GHj2AcMuQK0ilBuhFj4MB3Uk3MFpeRnfCJ4T tZro8E5lD4+NkCUD7Clok4DgwKZ/1+vR+xOStTRCAxeXRaWyRiFSwx9SlWrHxGe+qJeb 1Ygw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gYfrvbIhLwQY07FpCllgUnQOm2W6keiu3/43KL2PPx8=; b=yBt2uR2gtuMz+uVQ7uscl0lCaAhGC7IYP9xICDryl7hqJh3QB+Hx++8z6MIuZQq9FG 2SKR8XHPj6XLCrG8tCZC3CAC5OIV+hHQ9meq46+J+Y2MYkXgsdmEYtYb+S72fC7hKDGA X8gfHvzr/JrKVI/oOnQhSeLajVkQOqzam22qMW6ecVMG/O9SWHg+0GhcsriIxPo7MlCN +R0yD9Q9o+ZJXabn93R1bH6AF39BjSObBe7DzyVdhgI/qCKh4Hwf9WZsO93HfldqqAvz GzZE11sUwVszt1wJG+AAIN6C+svRCm7si0xd3NBM+WUk3FnoXMulyEN2TDDqThY1fpAs O8iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PjsGWW5l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q85-20020a632a58000000b004394687b653si2139129pgq.253.2022.10.24.06.03.40; Mon, 24 Oct 2022 06:04: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=PjsGWW5l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235178AbiJXNDE (ORCPT + 99 others); Mon, 24 Oct 2022 09:03:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235226AbiJXM7l (ORCPT ); Mon, 24 Oct 2022 08:59: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 C63659AFBC; Mon, 24 Oct 2022 05:19: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 41B15612FC; Mon, 24 Oct 2022 12:13:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5880BC433C1; Mon, 24 Oct 2022 12:13:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613629; bh=w0xqP950AUhtyiNNQprU0ph6rEJaTU1Ue73KctpkwPU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PjsGWW5lSRDnXlG5/oVwc3jO75Uol41xk2tA0Y0dP8BVgm5jTrDjTYWDVJP4BnOfu +5TTRVoQQo+tl15eVGo2anlhj0l+eNaHli7iiC+QbznyZHrQlfvr/+Xk/rtyeDt+/X q4+yaDG+ciMcNiVp38Hx8CcO7Zf2/FyhZRgV85sc= 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.4 209/255] r8152: Rate limit overflow messages Date: Mon, 24 Oct 2022 13:31:59 +0200 Message-Id: <20221024113009.991748695@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574255405614271?= X-GMAIL-MSGID: =?utf-8?q?1747574255405614271?= 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 9042db982a08..dafdae6536a3 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -1479,7 +1479,9 @@ static void intr_callback(struct urb *urb) "Stop submitting intr, status %d\n", status); return; case -EOVERFLOW: - netif_info(tp, intr, tp->netdev, "intr status -EOVERFLOW\n"); + if (net_ratelimit()) + netif_info(tp, intr, tp->netdev, + "intr status -EOVERFLOW\n"); goto resubmit; /* -EPIPE: should clear the halt */ default: From patchwork Mon Oct 24 11:32:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9697 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp544195wru; Mon, 24 Oct 2022 09:31:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7IqeKmmZ16PLwEfbLIoC7jFKS/+3aLFHZ8OV+SYvmdHKYrAFBpbuWIig/t1Fp9TkhYMmQE X-Received: by 2002:a17:907:320c:b0:77b:6f08:9870 with SMTP id xg12-20020a170907320c00b0077b6f089870mr28428580ejb.249.1666629093817; Mon, 24 Oct 2022 09:31:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629093; cv=none; d=google.com; s=arc-20160816; b=W4xoPka6J4R36ze5exrC6+pnRBBjH/KewS1Th2X3SsqsjKwse7Wc+LSOcgmxoFC1VB utJ/dOnk0Hsd+HVAWDlPZlyM494TGp7QMSltheaFQBPV+HXz6rFPXNh+9ZlWPCF+0yWV IZI/yQFPYOA+nXV/WWTHuVt3DE6aaQw54YgwkIb59z5SQh9bvPwrkOs+k/Y4Vf9Ii5GK XMfwEzymL+zSjbj19KpxyI7XtKmk6RsZ8D5vXls7R4vXrEJcQ5yaDhtRb2+v3rlU+kP6 ZFWA9G/GHNiyyrH1YJ63Gijb9s/0bbkMP51TX63CbNEnykWB4J3KJOxhQFDeadcCcWsM Qovw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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+CBtv6NcSQDVsxrogK9hL4Zb85iewuSYeYXJMt2AW4=; b=Hn7MK9FmftBRWyH2xzmmGdJn3TKh7aDvW73lEYjXtB8p/BQ2z3xKiR70HKjJITlvf+ bht1vC/lPEjaaXnV7N30943gqztY5sI2jzaY10OfHyffiWuYPrGQLrEzbDlpwQu655x6 drR86ChtBUpoainEratHZ1OtVURgm1LGiRDnW//gly7NG5GdtZB7Crb8IRNsUWUNnbR7 zbwwi9Tawr8yMaL6XoYoBtH2yiOyD/z4qViGHJm2gDTqtwlEwUY6/gq6NUw0M2CTwZS/ nz3ckz/fZwt+pa28CBR0QtDI2fAZkysRP8yBlqf8TtlaKTCePndiKMBurmJ7odDyvCb9 CAng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v9SFwBsD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dd21-20020a1709069b9500b00781a32fd847si158621ejc.917.2022.10.24.09.31.09; Mon, 24 Oct 2022 09:31: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=v9SFwBsD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232346AbiJXQQx (ORCPT + 99 others); Mon, 24 Oct 2022 12:16:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234708AbiJXQPH (ORCPT ); Mon, 24 Oct 2022 12:15: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 8CB741839D; Mon, 24 Oct 2022 08:02: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 9D04FB8160E; Mon, 24 Oct 2022 12:13:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED952C433C1; Mon, 24 Oct 2022 12:13:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613632; bh=0vd4xZ6Gi6rBTeetuM7DB7G4THSGHgYqtg00cEzXFEk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v9SFwBsD28tk6/fDxDja7+4CTOEhzoa1wJv2DZKuFVSnPcMb6weN0ertFl1k0WsOT RKh46r7bSDBf9/QSsx6flenwFwzkbYJmS69HW0Wr/TVsvH+0m8eu1SWuw/uFxnm8r8 CTCGmCgn2mgpjeIiO9n7jx2ZM0NggECt9nZslpdw= 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.4 210/255] drm/nouveau/nouveau_bo: fix potential memory leak in nouveau_bo_alloc() Date: Mon, 24 Oct 2022 13:32:00 +0200 Message-Id: <20221024113010.021220312@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587268227967995?= X-GMAIL-MSGID: =?utf-8?q?1747587268227967995?= 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 f7603be569fc..9f9c70734180 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -276,8 +276,10 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 *size, int *align, u32 flags, 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 Mon Oct 24 11:32:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9715 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp545344wru; Mon, 24 Oct 2022 09:34:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6PUNyM8i51Eba89zWFiTwZ3E38ZwWU61q++cNwIHgXJHjfNuXkDTP1cY00DdEbqbwSiqe+ X-Received: by 2002:a05:6402:2793:b0:45c:d273:8c18 with SMTP id b19-20020a056402279300b0045cd2738c18mr32616413ede.337.1666629254101; Mon, 24 Oct 2022 09:34:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629254; cv=none; d=google.com; s=arc-20160816; b=ge/necpS0TFG0JPwS8A6JobnjK5MotF3U8acii7aK9Kxhjqy6ugsZZ8w+kuc4lEoN5 M8JjMAcxJSTXfNKkJ9JKKMVsn/2MtRZ0VjWoGR7jVXw7gIBc5sRPr2ntBwpGjrnG9qIX C554T/rEhnUg/iB8GqvnC+V2fn49kfCx9o2Zx3fAO4BpcmvEIv0wKLvf/ZdkCpbjNXJK Edcpb5D6jtga4t+i3STIqe5eyaaLQcS8yv2B9x7MUISXz30SfL0C/Ny+QZ/GaRWwDCGf GmxP25VpoddCKhE8W5D3tq+5WcA1uH6UTWNlX3mt7yGOQK+htGwDeJytuze0VfLtb3ll VvdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UiKTA0mrOAXPk35GCK2na4KqXYTfmK1knzk7dia2+RM=; b=xVnDPmRFDiqW6RxOyUOnBBFhikTfWNfTtn07HDTEBsMNLGoomqRuAe+ww7/DmlgN00 1Iieq+96dYdL4a6Hrt484MjDr8oCCpQnmMwAV47m1DA5+hshCApA1h00he7ylah8J7Wd nbHpID09qqv8cWix0aYGZ5Az86LTQQODrouGWqTU9LVzxU8a5ZhB6sa7mYiE/dX/DLU6 9Wr01XXBwAcCbo5VmPYMjY4KNLhJKWllqdTEBsH4EXYs/atBtUUteolJh+qtt+aozxgA cbbh6CgABX0zdS3TMsexr9KYhtTz/ZVDVRwZgKWCjzGhXKCyPbjD4etgAeiszHHAoiw7 0kcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="yWsN/mXI"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go15-20020a1709070d8f00b007879bb73291si145232ejc.807.2022.10.24.09.33.50; Mon, 24 Oct 2022 09: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="yWsN/mXI"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229817AbiJXQRZ (ORCPT + 99 others); Mon, 24 Oct 2022 12:17:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234981AbiJXQPg (ORCPT ); Mon, 24 Oct 2022 12:15:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE0374A818; Mon, 24 Oct 2022 08:03:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 38871B81613; Mon, 24 Oct 2022 12:13:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97506C433D6; Mon, 24 Oct 2022 12:13:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613635; bh=ymqqx1RvVFDAG+2fiPlsdd2DsdhocIdcqP2p+8HU/t0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yWsN/mXIaeV8SHdzv4jK7c2MMb8lgdj6oCFES+LIdWkyo0dtL+TPDOg7RXNWIfyCa qyGzLZnTQmV92YXEeO2Ny+O5mQpZRG+iP2rHYXoOvcbuSyWp6PxzeXv39paAd7PQpE yZNUils4idcw+0Z049K89P+dLNIiwUxYfy6anV7c= 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.4 211/255] drm: Use size_t type for len variable in drm_copy_field() Date: Mon, 24 Oct 2022 13:32:01 +0200 Message-Id: <20221024113010.055053979@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587436559253241?= X-GMAIL-MSGID: =?utf-8?q?1747587436559253241?= 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 76b6676b0106..bde71aa67784 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -473,7 +473,7 @@ EXPORT_SYMBOL(drm_invalid_op); */ static int drm_copy_field(char __user *buf, size_t *buf_len, const char *value) { - int len; + size_t len; /* don't overflow userbuf */ len = strlen(value); From patchwork Mon Oct 24 11:32:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8976 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp438157wru; Mon, 24 Oct 2022 06:00:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7/T9cPR2Pd02ZVbtCMPmQb3rnzvHG4G6RcfvxQibsZn+9wsthOt3k7R9cjwDdvlNlx1Su7 X-Received: by 2002:a17:90b:3a88:b0:209:f55a:962e with SMTP id om8-20020a17090b3a8800b00209f55a962emr39806811pjb.28.1666616446709; Mon, 24 Oct 2022 06:00:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616446; cv=none; d=google.com; s=arc-20160816; b=rWoTlijHLgqlymeFIogs/+pM+gO4nQeiIdrEw5g3IwGKGoGGmULj5hv73ZaiJRTlbl CMjBtr8hTeMrpBV+u2TWe91sldy68gdEyvTaIuXlwyuYZUvwJQ+6V/JpEKtPBPuPKHXl NXyRCeYNXo5/+gjCY4N9BcHp5oU8jajP7dWsegzVdVT4Q9jVeWgP6//W6okZzB6p4E+f z7j//Ea6n7/lXkcs2YjuRWea105jrTSzbvtW7CS96iUzaHQnU7aP0Ycj99q0GDhZBvem FKcSuz1rZWOwgMklsfhYGzuWy173cic9TSXynt6WOib8Et7O3lRQEYvMi6aJWH3lf+UN xQ2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7JGtZaRabdHUeRT0aKb04iLazgUFlii35/pqeEeRF4M=; b=gV0eMypQfvN3sO+C3YMhgBMVK9cgd37UR/2B1vUQNkt6c/uahGyJVdykWX9p2XUJtm f3JEr1SH1XxhTwAwkuCIxhNSMObQnqMEDsp7Uo2n/RahMN6AooYtkMBYn6wncltmxjgZ 6Ji8dgeAoIy5GABYEECvMIV9eZ9CYqaKOQ4F17KN8bEi5Oq5pfJxKxpnlEeCQhY2R+Lu EvZCcxcMLaNzs4cg7ltTykz4smH5kEMyi9jKT9kc2KrEPMU2kz6CXRLR9OQUUT1tQwuk gn5Ugg/5Guk2jxs3kE/GsK5RjUbeLVxdMIDZOMqXRn4G4fKvFDNWfDgbbvM8sxn9j8/Y vStQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cmiV3bfM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m9-20020a655649000000b004632ef90079si37323903pgs.858.2022.10.24.06.00.25; Mon, 24 Oct 2022 06:00: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=cmiV3bfM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234784AbiJXM6x (ORCPT + 99 others); Mon, 24 Oct 2022 08:58:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232318AbiJXM6E (ORCPT ); Mon, 24 Oct 2022 08:58: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 2FEE1963A6; Mon, 24 Oct 2022 05:17: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 5B9D761314; Mon, 24 Oct 2022 12:13:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 681E3C433C1; Mon, 24 Oct 2022 12:13:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613637; bh=Ey1wAtKe5D9De2EgKa9byTbAcA1ewlHvhtn2bJ/qdqo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cmiV3bfM6GkZvmwuNpe9h2vVxyfIlu3b0MNJT07BDZFA1iZbuc71q/BMFAvGrQxKt WRrSD59jrCB015beowFCCHRvkS/3f6Ig3brZtSwNoiDp7HFtojucGYA1tVhfooNr+9 6YswPwzp3o5qStEkiuPPOFrhZ4deZENrXzTrMeKw= 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.4 212/255] drm: Prevent drm_copy_field() to attempt copying a NULL pointer Date: Mon, 24 Oct 2022 13:32:02 +0200 Message-Id: <20221024113010.094630821@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574006982019662?= X-GMAIL-MSGID: =?utf-8?q?1747574006982019662?= 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 bde71aa67784..5b93150b1141 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -475,6 +475,12 @@ static int drm_copy_field(char __user *buf, size_t *buf_len, const char *value) { size_t len; + /* don't attempt to copy a NULL pointer */ + if (WARN_ONCE(!value, "BUG: the value to copy was not set!")) { + *buf_len = 0; + return 0; + } + /* don't overflow userbuf */ len = strlen(value); if (len > *buf_len) From patchwork Mon Oct 24 11:32:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8973 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp438024wru; Mon, 24 Oct 2022 06:00:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7LZhHnnqmqli6gvQqgqkAiynbNLmkjS5hd2NwtrUlCdyLWkPqo4/0RAafJu2rww9Q9CUkK X-Received: by 2002:a17:90b:4b88:b0:20a:cbb0:3c86 with SMTP id lr8-20020a17090b4b8800b0020acbb03c86mr71577066pjb.207.1666616449872; Mon, 24 Oct 2022 06:00:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616449; cv=none; d=google.com; s=arc-20160816; b=0v+SA4Wk1lPEOAsrSi7cTwlUX804WI3RaW+5ned4UwjwDREz3/YfgRgZuqv/w7jlOI TpnK691gHeZTnErMyx/z3mc96fZh/4OMs9DWkJQUO27H1kurRAJqfcYA0GsRYWL0tf00 tOQHtEDMGVRibKgcwNE61khvwlEdJgWCpol6IymSaLbR5Wzbx0fWjqDVqJGjWekWxJe+ qk1y3xeMHAM9wwsJn5ly4guYwLdnSOJYuGnJv2P/Obv46weF5dFheW2uVp8VOua7HMBn vVyOhoYDGfVO+sQ4SjZ58++HAjmri4+9HPlAgR2KJoI+EodQ2Oylv4eWdvosyN+IZ5dJ KaEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EOHZ/C2sGLzAOqAVEzTfcy1PhIkdX5F4TY+qivuWJig=; b=1Dr3mI9FUHYiQbjEBiAoH87bSdytNkYhVrNPrU371sVwflTJbElMItB418en+LcZmD PxIKYrObQq6OsyfC2neU29Ia+FYhvv6xAJoKIhsctLGDCf+gz3Vxx35ifDDrQgfOFQLG 2/+eXICTmpDjDbiY3krQr8bW57qQNG/gEoaYirBRcfEyi06Ejhc7k8SL+8haeCVHdBPC 1idCGqPqqp9cpPRuPCvfEm53+oDg7Hfx5kDPwForuS7Eweg4JGogc+EB396OWPGFYr/2 uBQzXYZITGax5VUF7iYc1ZdurjXm9JJfn9wHRTvP4o9kK4ns9c8Rh6Xz90RUjEjzQ6Yf xIlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=d8D+PbmR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t24-20020a635358000000b0043634245eb1si34709482pgl.311.2022.10.24.06.00.33; Mon, 24 Oct 2022 06:00: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=d8D+PbmR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234849AbiJXM6n (ORCPT + 99 others); Mon, 24 Oct 2022 08:58:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234876AbiJXM5p (ORCPT ); Mon, 24 Oct 2022 08:57: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 2F9B297ECE; Mon, 24 Oct 2022 05:17: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 ECC19612D6; Mon, 24 Oct 2022 12:14:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0767EC433C1; Mon, 24 Oct 2022 12:13:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613640; bh=IqXIc2zb1gPqjZAiZAuDXqBufstMjobSxTTlD79UXjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d8D+PbmRT7sRrmqpiqMAuHDvxfKDP74NiL9hVjpEEzQVgqEnPsyjHDDf8xaKZzhHP IMoO8UgnQzcgJa0xEZ7NNJH4mDjvkACdu4226HSUbV8ZTubf3PbUQ8NhyPpB1I/UaI /pseuRJibGlGPKpQNLpDDABqcJvuVgegWd+GqRHU= 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.4 213/255] drm/amd/display: fix overflow on MIN_I64 definition Date: Mon, 24 Oct 2022 13:32:03 +0200 Message-Id: <20221024113010.134102885@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574010193961148?= X-GMAIL-MSGID: =?utf-8?q?1747574010193961148?= From: David Gow [ Upstream commit 6ae0632d17759852c07e2d1e0a31c728eb6ba246 ] The definition of MIN_I64 in bw_fixed.c can cause gcc to whinge about integer overflow, because it is treated as a positive value, which is then negated. The temporary positive value is not necessarily representable. This causes the following warning: ../drivers/gpu/drm/amd/amdgpu/../display/dc/dml/calcs/bw_fixed.c:30:19: warning: integer overflow in expression ‘-9223372036854775808’ of type ‘long long int’ results in ‘-9223372036854775808’ [-Woverflow] 30 | (int64_t)(-(1LL << 63)) | ^ Writing out (-MAX_I64 - 1) works instead. Signed-off-by: David Gow Signed-off-by: Tales Aparecida Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c b/drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c index 6ca288fb5fb9..2d46bc527b21 100644 --- a/drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c +++ b/drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c @@ -26,12 +26,12 @@ #include "bw_fixed.h" -#define MIN_I64 \ - (int64_t)(-(1LL << 63)) - #define MAX_I64 \ (int64_t)((1ULL << 63) - 1) +#define MIN_I64 \ + (-MAX_I64 - 1) + #define FRACTIONAL_PART_MASK \ ((1ULL << BW_FIXED_BITS_PER_FRACTIONAL_PART) - 1) From patchwork Mon Oct 24 11:32:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9176 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458119wru; Mon, 24 Oct 2022 06:37:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6/gGL8SiTrLSwi1cTN1w4MUxoijpJae6DN8yG1sKWdX+OXb+dtFicSvWC8INp3e9pWNfy+ X-Received: by 2002:a17:907:94d1:b0:790:65a:3a18 with SMTP id dn17-20020a17090794d100b00790065a3a18mr26900150ejc.428.1666618624669; Mon, 24 Oct 2022 06:37:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618624; cv=none; d=google.com; s=arc-20160816; b=MOMu1nrWwPIVSEw2/0F7Vw/J1gAs1n5YdS1aNydq3LdTfBLlyFVkGP08oOdZ2mReyv 8vRlpNknArMW2IqVTF/F93T3Mw1pMjfbZyEqvVFmbFNkJGCxm12baJqg2wzNdKekqtR7 EJqRXxaL1nWv01hC6GksFiyZ6yF/HFOHxub6XBJESGYPPpEhKJv0/Z0QyCk4QZjporyM 43BG6sqacd63nlY8wW4iX+phkYHEbiUlhriTl0GtPvSS3IRvEz1Tlzx01alXaC6EQl+9 ElaO34pL4rSTZerwDddzs+35hdiX+2HYKxL1A2+iZosa0mHGbpSASaUKjrN3luq6dI9D dLzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=voZazJD3phgnsOh+VATDoWHikDK6pgAOv1nrwGzDiNY=; b=ChIET+lrHqTJe8dgkyTQ0XkBpOAHBXxLHYxv+MttM826LKB1BKJoS93Hh7Dt3bhRd1 pZ2V1cDUh0YvAVUspSVRkxK9o3zW0OVt12IJ4nFKn96PJUVoe7T88PZ1XQirOhbyq2XE fueGJgnA5qVJZWXEGaoe2HAxjGD8hDDeayL1nwkWNvOXeQZZg8Jvne9rsm16N5QYBOe8 U1u6h7jYSPJJdk5cEedvUDO7gecQs1BdLXyK2NjqKb33IVT2fs0nLO9L+hZ3n+dmynDN 9zxJscrni/S+9Xsa02OJvUtrNHRIYf/4QZVX64loNJEXM5n2bPpMaQtOc8ZKlG543EBN BZaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b2FAVM6e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020aa7c6c6000000b00461cb15df6dsi2111718eds.297.2022.10.24.06.36.31; Mon, 24 Oct 2022 06: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=b2FAVM6e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232505AbiJXNbb (ORCPT + 99 others); Mon, 24 Oct 2022 09:31:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235881AbiJXN1s (ORCPT ); Mon, 24 Oct 2022 09:27: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 07EBCAA3E3; Mon, 24 Oct 2022 05:31: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 8C6E0612DB; Mon, 24 Oct 2022 12:14:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C9A3C433C1; Mon, 24 Oct 2022 12:14:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613643; bh=Ta5mvod/xTVjJfuaXj2rb0yeljAOvEtb7iU+NeRk/2c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b2FAVM6egEaskD0FHTWMpgZ+BFiQRLtkYionctl4I6mur9iS37ptYPydfAUSAh231 a74XG+2DODMv37eeS66cgf1+vFJ6GEFgAkfOQS/JOf9d+wu4aY79m2zpd2xrejs5Br u90ZlaS7So9jozWTXvJIGqdO5Gwl17lDuH3kYyT8= 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.4 214/255] drm/vc4: vec: Fix timings for VEC modes Date: Mon, 24 Oct 2022 13:32:04 +0200 Message-Id: <20221024113010.173682818@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576290954329960?= X-GMAIL-MSGID: =?utf-8?q?1747576290954329960?= 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 7402bc768664..0c764fd8399a 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 Mon Oct 24 11:32:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9214 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp459216wru; Mon, 24 Oct 2022 06:39:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM71krlkmBD2LmcsCICgBb7ZGEgYVjl3+w3CdjAZUL1/len4r5DmXSn1X/c0UGDQrIeqTho1 X-Received: by 2002:aa7:df94:0:b0:461:aff8:d3e1 with SMTP id b20-20020aa7df94000000b00461aff8d3e1mr6764033edy.10.1666618746622; Mon, 24 Oct 2022 06:39:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618746; cv=none; d=google.com; s=arc-20160816; b=DZJ54ZMf4PlQmhRnfQTVW4GZBNE2XmrnMpEKMa1uYs7RF3/CFJjsCeiGS4OEXMwnkK F7waHBwpbr4Nnmi43DqgzzorcHPzlnyY+rKcdKM9muhkifiZFPBSiU4vq1s6hBgjYjC1 thBg543JUXNow30VTEegFdDVOmoKCQVdAWGzRfrln53s55IUFaWKXsX+fbeFv4U+yYMO b8y5UdMd/PQ5F/yGUefLzu1EaklCQP77MBw/wCM3bufnQEbKQCX8ud+zfU/Fm8jZr5HQ mxtntgXP+qxAG6AMkXv+p7Tr6x2pCqKStUvAgbGhBYSS4qr7LUnJXCxLcwvJvLI4Etbu /9jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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+GanfmrYRfG+KuK0n34qt69jU3LFeRsjKrPtKSCy48=; b=dyJ6ANc50QXUuATMUlVS/nfcqG4NRuCCDgdXFro20AVYtiE3jGyZbOiVGMxToj2Ykf iuzYOb6zU//PJb/rzJqh5RB8U8Wk+Ierzq5Mn37X2nKlo6hG66l5iEf+PyYsHj2ZcUFH 141/OZuNiig66cIBT6TStaOGc+p3HIFYMd44+tavlmTCNfdNVxcjqP+OVEmGRSQl57P/ EL8cE0WKrrlBT28h6TT7IUpTNkV9sUGkgTMZNdqaQN0O4xJse/LaK0dmzRSjsQoCexZ8 MVOpK0D+qij/XMw4qa44TnH0JVfbKN+VR7dCJjwq4DOMHst5+qUiHMhLqMVodHx37WvX HJ7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GDoiAWV0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga9-20020a1709070c0900b0077b83f3dc20si26181838ejc.63.2022.10.24.06.38.41; Mon, 24 Oct 2022 06:39: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=GDoiAWV0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236324AbiJXNfW (ORCPT + 99 others); Mon, 24 Oct 2022 09:35:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236288AbiJXNa3 (ORCPT ); Mon, 24 Oct 2022 09:30:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D502ACF43; Mon, 24 Oct 2022 05:33: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 32D126131D; Mon, 24 Oct 2022 12:14:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C7B0C433D7; Mon, 24 Oct 2022 12:14:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613645; bh=CZYsMphJMpaNrKDew+OX76nRYFASQeGDTo1/8Np2474=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GDoiAWV0UiurilOBbMQo6qwxayolhAbwEXQ04iKQfff8lVCQ1iGOy7amM5bnE8paR HDVkI3P3tT7QdQOFLxm2/GMVeCTffPFSSGygN52X5cI3vZxTcCFQLarATRlwS52TL2 lWEATvcKc163G21A+jsOTyF+x4Z4myfynPT+CYg0= 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.4 215/255] drm: panel-orientation-quirks: Add quirk for Anbernic Win600 Date: Mon, 24 Oct 2022 13:32:05 +0200 Message-Id: <20221024113010.204314378@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576419074486468?= X-GMAIL-MSGID: =?utf-8?q?1747576419074486468?= 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 f5ab891731d0..083273736c83 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 Mon Oct 24 11:32:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9699 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp544357wru; Mon, 24 Oct 2022 09:31:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7gLnlk7oqV08TvSjDHfvphUTqvp7T3ToeaYhPx3yodIDR4/gEPquq/jn3HfQLzZf0l9v6l X-Received: by 2002:a05:6402:2319:b0:45c:4231:de18 with SMTP id l25-20020a056402231900b0045c4231de18mr32398172eda.383.1666629112637; Mon, 24 Oct 2022 09:31:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629112; cv=none; d=google.com; s=arc-20160816; b=s47dalD0lQ73k2cztmMNs7y3TF6fDCh1VVumjlPB2S0WujoOAFQ1v6Q+ONb/HeDSv7 5bqXzD6XhTITnCZGBO6wM3LoZBDeJpvovbSluv/LgvD0M4CBABD7VYejATqeRifXq6Hd dZryFUFJ7Oi6cYjV/t0kGWDFSMm9bI5zOvWG4buRRffk+j/hNULrAufyW+DD5Cguc7+e DhfkkGq0D8kU88qTDO0cSnohQCjK5HNOWvcOMZO1LaN8+OJHobD/eacejslab5SWzEn/ MdKwqZ8UeG/I7HUemA86GMt1Vh8W3Te2er9CZ4aXP2s1wVU4QmLgMtoWlJrAM31cOf04 bO6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=Hfg6OHzzlF+pgdCoo/IBpht644hgghaefuP6MnNolmLL+BMmKeR1HPPUkXVAnTDOUw dyl1k+mb5qB0pKfe8A9gpeB1cABePA1WAjTpRO5hRFUvtdDBc55lmSVEYm/JUzqandae dhkq5KDdoeBPdEWALq2LWHhVs+1wGn4FfWxN/qwelC7shQFBWoquNgaJpZQMpAgQUBSy NkLrDqeuc85HRkaV1vaPkjdUEXiy2xJUKnXBXbHr/IsHqWq1ChSal69gbXaliryDK555 tOCvkgQTLdUHkLx7F3i6G9lBSjPM3jKtp5Sps4GNtQ3YwdrDONBo5YcVrrkk+sceM8mg dOrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tAXq7kOK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n2-20020a170906378200b00781ea213f99si151459ejc.173.2022.10.24.09.31.28; Mon, 24 Oct 2022 09: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=tAXq7kOK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234230AbiJXQRJ (ORCPT + 99 others); Mon, 24 Oct 2022 12:17:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234838AbiJXQPR (ORCPT ); Mon, 24 Oct 2022 12:15: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 294696110A; Mon, 24 Oct 2022 08: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 31003B81616; Mon, 24 Oct 2022 12:14:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86355C433C1; Mon, 24 Oct 2022 12:14:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613650; bh=VyRbyK2ww2404bbaV+nZGsh7aEeNQVyazO8tGuaL5hY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tAXq7kOKkAymH9RElguko6EA2AdxGtCj529TX+aBWSwhR90JbH+HA/+Pw8henBENc 8Mqf7LE1fGW0jVsp6GQ9b33/cXjkIB88rB3vidqpMFDj7zgfr7/xez3aQ6vA7jDs6D hhN/Cmh0Q8WqHwYpZXrRURgRiorVx4E7eH+XFw1Q= 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.4 216/255] platform/x86: msi-laptop: Change DMI match / alias strings to fix module autoloading Date: Mon, 24 Oct 2022 13:32:06 +0200 Message-Id: <20221024113010.243527543@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587288300829506?= X-GMAIL-MSGID: =?utf-8?q?1747587288300829506?= 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 Mon Oct 24 11:32:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8977 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp438169wru; Mon, 24 Oct 2022 06:00:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7935VAjktaAXEsu0nm6NxULroB0hX5DpzviK0g1ZrZdvEGha3hK8fS5eMhJlbQPaqUOfrS X-Received: by 2002:a63:e54:0:b0:46a:ff3d:5ee1 with SMTP id 20-20020a630e54000000b0046aff3d5ee1mr28579644pgo.194.1666616455240; Mon, 24 Oct 2022 06:00:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616454; cv=none; d=google.com; s=arc-20160816; b=nSv7372LXos+Wj8seqWL3DwugFiVegIEgAa0yM2i/+79Ew3DGzmhTv008y9+S4w80v ynP5t4GdEUTOjDE0ddSG0LUKO1toBtD3ZDKoe9avdXlpy2/DRuCuK9jmUMtm7jaDxipi NvrI7zydU9srQPq8SLuc25A4wajkek/rt25VQT6m74dnG5EAPLi4DnC3a3tpTe4s9PBk XQGKTLVsqTiqN9ILRimi/UDy4KUHXIbQ3g+Kk0fDJAmmibmNod0bat2uveEBM0GkiPNL CVdXrjRzShkjIxFvyX7XqsRBLyAFRM5a4f49xrQZOMW+0srmT36QzxMheHRZRl/1Edsm d4iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6H1Hvnwj2euc17t+bG5TWAgsWSzGQ/yT94DqGdOj5vI=; b=es9hB6JvXfGMZx6CPGd6mp8aEdz9qU/K7eZPaeZmgCOdmpvomIAN1C0eJ0YXhLQLX9 dNLmoWHlOREXfRCxzfMXe5xT1rSof7nokC3kDT1xfmBSg8M5jYykG/aCzRXZ87/nLvuK zn2cs+C9Vd4mYyahZ3Uc819Ljm7baasOcE49Yq4ugvOQfskP/YaSPAtnokY2TtgAedfI Swq3EnlFewLorIxSyzvRNy/V9+Uy9+c2gHXnwEWt0X4V97PeFaRdUMUJagsQqeCcVnXc 5iOe51eoTvYVU00HVNOoxUWYV6J/jpoteAzFnBCN7QB6q565aycwdyj+0L095w1UuDU7 W3tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gZQoDfI5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ij22-20020a170902ab5600b00186ab026646si2785548plb.394.2022.10.24.06.00.37; Mon, 24 Oct 2022 06:00: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=gZQoDfI5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231724AbiJXM6j (ORCPT + 99 others); Mon, 24 Oct 2022 08:58:39 -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 S234766AbiJXM5p (ORCPT ); Mon, 24 Oct 2022 08:57: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 8D39E97EFE; Mon, 24 Oct 2022 05:17: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 1EB0B612DA; Mon, 24 Oct 2022 12:14:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E5E1C433D6; Mon, 24 Oct 2022 12:14:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613653; bh=urIQy0Zs8PsVFMCiFU6u2HlfNH0+WH5JcKKHZdSsssc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gZQoDfI5mipgArkD345rVYo4NHfDH0Y0FFAopZ0Vy0d1C/4Ltk0ZNaqcZhozCVIrf 6eq+CT3Z3xNqL4yNYPNAOrHlEt1a3TIQSaP9cvUejSIxWP1PKrASEseWEIguleQY10 RpQxmRZR5NXA3icN6Pfb0zY1tHumUCtW3UXPJ+4o= 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.4 217/255] drm/amdgpu: fix initial connector audio value Date: Mon, 24 Oct 2022 13:32:07 +0200 Message-Id: <20221024113010.287686901@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574014972505606?= X-GMAIL-MSGID: =?utf-8?q?1747574014972505606?= 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 0e1cacf73169..cf80da354ba1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c @@ -1646,10 +1646,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; @@ -1771,6 +1773,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, @@ -1824,6 +1827,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, @@ -1874,6 +1878,7 @@ amdgpu_connector_add(struct amdgpu_device *adev, drm_object_attach_property(&amdgpu_connector->base.base, adev->mode_info.audio_property, AMDGPU_AUDIO_AUTO); + amdgpu_connector->audio = AMDGPU_AUDIO_AUTO; } drm_object_attach_property(&amdgpu_connector->base.base, adev->mode_info.dither_property, From patchwork Mon Oct 24 11:32:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9881 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp569930wru; Mon, 24 Oct 2022 10:29:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7uBgM9JlOg+txWpMF9iukNx8Lq7cDftTBCzd1UAQeGC1+pwZmNa/4bsmV+MjPId7fWao9c X-Received: by 2002:a05:6402:440d:b0:450:de54:3fcf with SMTP id y13-20020a056402440d00b00450de543fcfmr31136489eda.312.1666632572935; Mon, 24 Oct 2022 10:29:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666632572; cv=none; d=google.com; s=arc-20160816; b=Yd5IfNQrICtVkdtfCm1fLrT6PE22/tnoa1mV1zvyxXUTYA+RE2MUVvh042Vk9Cf6sO xKqaArWuFTpL7zM5M0dPjgxK6oy58VCGeHAvmsf8xIRN9OpkQPOLLYA0Ko6AwUajQOah 4AG9lPsgzRuX7oTyLjdRNEbXInULY55fBXV2qHEhnHGKP8tZVK9y+8CeqXVhOSanHxaM Wba35qwBous5kyjPkkqMt5tJwYoG6aVlPeB6Re0o9NlpErUU3NvTsLPFMEnuF5QeXahV OEdYnqgKklDBzG4fA3JOjHA8jQ1odS1iAAj3SDVby0FfvwbYxxMHlXkANEQKSnjpdpXp 9pJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Lbo1Bhtl5A+LUqgooRIXiM4VnLm29WKHNKzLNNmSJc4=; b=UUzEFjB4v7d1plLfzVZE5BzxFI/lCy/7scTn2mYXdAZ4zTZVFp/o/4wsIYwTZzL3hi TN5ydroKO4sgM2nZuS3HEEmvTkEcoUQqGYOzzUEdN2uiWmxQjPfHuYpAcyFgCl3OoY36 VhmRlCKDSwSkwoZ3lEKEZX3phW4lJtOuSfwLieJ5pHDqfWIsQ6QDDeCh28F7gGHS/kHS 2BBmcjJ3AgsZVfpBNEtgg70go8jWbWIx+kl3aa787z8dERumugyLNxN2lHXIBI3CEYgH OPj6aXjsHZX/19+gVrQ/PBUtmIY7KEC+NKw+WRP/WdQHas9jQVml7u7L1kzR0LXQYpxj ViwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tvLk25mr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n13-20020a05640205cd00b0045a16f47a9fsi315880edx.624.2022.10.24.10.29.08; Mon, 24 Oct 2022 10:29: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=tvLk25mr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233203AbiJXRTn (ORCPT + 99 others); Mon, 24 Oct 2022 13:19:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235551AbiJXRTO (ORCPT ); Mon, 24 Oct 2022 13:19:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B63F0558F4; Mon, 24 Oct 2022 08:54: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 BDAEF61315; Mon, 24 Oct 2022 12:14:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB67CC433C1; Mon, 24 Oct 2022 12:14:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613656; bh=lMngYpEaHn+GSZ8B6h5KSHU2ZLlH+zvHYVzQIpHhrHI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tvLk25mr24WEVsR+QuIAaqj43TIuJrCx/IG0Yy1bU5rJFZ3AilO7ysiYfH0QyY+b+ voO6kgWUkgNRW+lV8ZMDp98k0bR8y+6w1fXIu7zazfCzcSG3QGSKv6J20xdAjH21oH 7miTMiktpmP9ztqmJl/TiZBASxfQBrH6GLpNbhYk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Acayan , Bhupesh Sharma , Krzysztof Kozlowski , Ulf Hansson , Sasha Levin Subject: [PATCH 5.4 218/255] mmc: sdhci-msm: add compatible string check for sdm670 Date: Mon, 24 Oct 2022 13:32:08 +0200 Message-Id: <20221024113010.317114540@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747590916292576527?= X-GMAIL-MSGID: =?utf-8?q?1747590916292576527?= From: Richard Acayan [ Upstream commit 4de95950d970c71a9e82a24573bb7a44fd95baa1 ] The Snapdragon 670 has the same quirk as Snapdragon 845 (needing to restore the dll config). Add a compatible string check to detect the need for this. Signed-off-by: Richard Acayan Reviewed-by: Bhupesh Sharma Acked-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220923014322.33620-3-mailingradian@gmail.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/host/sdhci-msm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c index 8ab963055238..5e6f6c951fd4 100644 --- a/drivers/mmc/host/sdhci-msm.c +++ b/drivers/mmc/host/sdhci-msm.c @@ -1755,6 +1755,7 @@ static const struct sdhci_msm_variant_info sdm845_sdhci_var = { static const struct of_device_id sdhci_msm_dt_match[] = { {.compatible = "qcom,sdhci-msm-v4", .data = &sdhci_msm_mci_var}, {.compatible = "qcom,sdhci-msm-v5", .data = &sdhci_msm_v5_var}, + {.compatible = "qcom,sdm670-sdhci", .data = &sdm845_sdhci_var}, {.compatible = "qcom,sdm845-sdhci", .data = &sdm845_sdhci_var}, {}, }; From patchwork Mon Oct 24 11:32:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9746 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp548881wru; Mon, 24 Oct 2022 09:42:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM73OLu/Qsy8uYOxdIFtq7r+dB3r9xq/UdMX3PDNZCYTgfpxHpZ8SVRhLfx4/wdydmG7hfAU X-Received: by 2002:a17:907:272a:b0:791:994d:fb6a with SMTP id d10-20020a170907272a00b00791994dfb6amr28844572ejl.337.1666629764738; Mon, 24 Oct 2022 09:42:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629764; cv=none; d=google.com; s=arc-20160816; b=VR4Ud1NmOsFXf4KThwV+hFQehXo+LEtSi9vogXNM8WKv2qh+pNRHwLRcsbYyX84SEV YntTJ6cTOdq+TX2XmAzx6LWH5IFeIs5V4ibtMebt0GJHLygpF9vTDN8ureuflOkgFdOf zIrI6Z99PCzojxpS7Z8CAkF4dAsVKJHLHQEd//p91EcdW3SUXHD8nuWzAcqPrsmbJUZ6 j2Nq91S3gSnCZL1ObrmU8DIxNMIm4ffb/BnOmaIoyf9QMoq1I/sTs8WLYCZRi42vSDJ9 7Pk/Su8Mn1xqT56dJNP3aga9FlhodhvltVZg/ahWkPKU71M/yc8Ry0c4VsBvJ+BLHE5e uA0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Wcm1OJT5rEbhzNNC3c4ZEBQWKYW26Ux1AvhhI88pH/0=; b=HmkgjoD/b44amSyuk5l6B9PiQIDeBTQyTgpxxGp0BDtPePIeJO7Qgx2wcmzWnnH9Cy YA6hJ3dUS9OqlPZxeF8juDGiFKqhZLn2h7fxk0d8XSU7sNsev1zAuCuawdgZWQYdENsF 2N1a9pHwJXiGenOBa1iHep1vthIZ8od7EDQkJRAuie/IOLwIt+Y4rMJtz7BKyRShBX6i SrhOc5ym6UlJsZnEEFQN1rpZAMebgQxVdRHpl50qS6wXLlrxKfic4gd8iajaDPRNQ57j aTk+iMA80JF2I75t7lvJ1lmuaPBN7IyoTr2gy37viakj7lcuKM++w53QthObkBzfF1fk nERg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HddzcOfy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go15-20020a1709070d8f00b007879bb73291si145232ejc.807.2022.10.24.09.42.21; Mon, 24 Oct 2022 09:42: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=HddzcOfy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234596AbiJXQlx (ORCPT + 99 others); Mon, 24 Oct 2022 12:41:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233191AbiJXQlM (ORCPT ); Mon, 24 Oct 2022 12:41: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 659F51781E5; Mon, 24 Oct 2022 08:28: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 37291B81626; Mon, 24 Oct 2022 12:15:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D972C433C1; Mon, 24 Oct 2022 12:15:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613757; bh=+GcJMCJ5CtoL86fSWH/B6kOxUopDaB3OPk5ElHGv0uw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HddzcOfy6lfpAHE82ts1PWNYYj35d/euEYK+uMjq/VKaMsvWWAgNYsmyr2hxwUAFM vnjB1jtI9OS5PsipCc5FVxPrSoYEBPnLXOYRh2yu5JxvaGeuCdY+dHnsgRITqbpYRg VmUMcFaJO2owSAUPyPy616pmda0F47qtXYK8FSGA= 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.4 219/255] ARM: dts: imx7d-sdb: config the max pressure for tsc2046 Date: Mon, 24 Oct 2022 13:32:09 +0200 Message-Id: <20221024113010.358831527@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587972391072253?= X-GMAIL-MSGID: =?utf-8?q?1747587972391072253?= 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 a97cda17e484..363d1f57a608 100644 --- a/arch/arm/boot/dts/imx7d-sdb.dts +++ b/arch/arm/boot/dts/imx7d-sdb.dts @@ -177,12 +177,7 @@ interrupt-parent = <&gpio2>; interrupts = <29 0>; pendown-gpio = <&gpio2 29 GPIO_ACTIVE_HIGH>; - ti,x-min = /bits/ 16 <0>; - ti,x-max = /bits/ 16 <0>; - ti,y-min = /bits/ 16 <0>; - ti,y-max = /bits/ 16 <0>; - ti,pressure-max = /bits/ 16 <0>; - ti,x-plate-ohms = /bits/ 16 <400>; + touchscreen-max-pressure = <255>; wakeup-source; }; }; From patchwork Mon Oct 24 11:32: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: 8967 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp436970wru; Mon, 24 Oct 2022 05:58:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7JkeJQYA3Oqitd0jHFRUsVhN2YwUFoiIV2YTWUTxj5YfYXi6PgGG8STkUz0vsyTSXmDtUJ X-Received: by 2002:a05:6a00:1742:b0:565:c73a:90de with SMTP id j2-20020a056a00174200b00565c73a90demr34330523pfc.68.1666616315839; Mon, 24 Oct 2022 05:58:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616315; cv=none; d=google.com; s=arc-20160816; b=ctcoQ5KiLI4Q4ErFuyHAj8aW636gHVDpylUAu5FDgKma1+SZuaHs2mCApYauIOo55M xgsjFrrfYgjPdwOhooqBYQmYqJnyEgYFwcVzqJvCQbuEsaJ38Iz9b9F1U4SrFhu4DzmA lkcTeypsJwQxfgbsPD/2CN2JcN0tcsplLimMtFmaCooJmkNosAbUrmXpQ50D5wbm01cA lztdWEhT/OqWZroc75zplQzolB7g4oUeUf66kZDBL8qyzhsmrjWhn+nf/hZ04myATA86 kXcB8MiXSsvaurfjgdMi1v6JJmvYtkJp3FQnuV5AjIm3Y/LKnzTHlwa+rPFKFdc0tCnt pDIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=836laKeAEhLJVFJjg+O6WVyC3vXUE+zGbO1yg33OVfA=; b=DfcRWrODyi4LhLiA6XlT2Nc6CwPeDY9WcX2CyAWcugtR6ZJw+Ifgbmzyuakqn42M+J /0ZMVfUanNErR4uSduYzFics+IUqKHYrGaeuJOQzQWjdTDrfUnyfqtNH46A00xNfkesP mM4Zga/bxcpbtCkrF1UtfjmBxy1PCaB9F1++t/Yxj7qLGGR48wmNHps/69VnWBv4R2Wd FPa1NDk5CcISe7ytgy1WE87gBACDGDKueZj6ysG1NYk7FVKQBxdxaCWQqWSyZvbcuE1e mycPTa+K0hapNAmXasMij7PSt9/kByzEfNCQAg5KIlblMrVwAciL3QvGp0NSE1TeL9a3 RS3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OIjVai5O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e3-20020a170902744300b001865d57b179si15207267plt.47.2022.10.24.05.58.21; Mon, 24 Oct 2022 05: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=OIjVai5O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234851AbiJXM5p (ORCPT + 99 others); Mon, 24 Oct 2022 08:57:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234842AbiJXM5X (ORCPT ); Mon, 24 Oct 2022 08:57: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 D6E82F3E; Mon, 24 Oct 2022 05:16: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 58350B8161C; Mon, 24 Oct 2022 12:14:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE546C433B5; Mon, 24 Oct 2022 12:14:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613677; bh=WujIfs+j3/xvbLjYXAar1kXfZEkI/DTx3bR9YyKbnfA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OIjVai5Os/llvlEmh5XJulLh0Um+C7BIcGzG0WR+qnaJcfQpWIwARX38m9vvqSGk7 uICrxU48HkNbSfiJYQ54b6jpDC7feXAg0wUudJIv25AIByL/8HfAuHn9MKLlf1FCR+ zhJITuWPjTGlIi6Uok3EPJn3/JLoG+NtBMqMCl1s= 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.4 220/255] ARM: dts: imx6q: add missing properties for sram Date: Mon, 24 Oct 2022 13:32:10 +0200 Message-Id: <20221024113010.393558306@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573869571870962?= X-GMAIL-MSGID: =?utf-8?q?1747573869571870962?= 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 d038f4117024..013080e709f8 100644 --- a/arch/arm/boot/dts/imx6q.dtsi +++ b/arch/arm/boot/dts/imx6q.dtsi @@ -158,6 +158,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x40000>; + ranges = <0 0x00900000 0x40000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; From patchwork Mon Oct 24 11:32: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: 9706 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp544862wru; Mon, 24 Oct 2022 09:33:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Xniupv2162ZJfLWFItbvdFY6Ln8wbdWhZBXmYS2YBOUY+leO5KJS8nIB+zsj7NdJdYhiG X-Received: by 2002:a05:6402:1248:b0:461:fc07:b95b with SMTP id l8-20020a056402124800b00461fc07b95bmr1266205edw.56.1666629184901; Mon, 24 Oct 2022 09:33:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629184; cv=none; d=google.com; s=arc-20160816; b=nlV60iie4eiRZpyNsPgc6WY+os7mGN6kiYx92pkFfgea0K25BJoy7foL8+PazgsMfZ a0EJVByMSqpzRpLLUJdHW2MWbXIFSaHj7QM9iodGULN8OQOwX5x6IyUXeuOO1pGZ73qc pD/FruWeVqhiX+B/lILl+haK3ZeEyHvJs8wVwghp4nse/kzOpzdCaeK3ueWpC/j1Samz bs4/1A/vgG+OOy4kp7lSnPAEEmkwuO/kmDT7ypX4IUIIDkXk/U7YTPz79seumVhLOTQM 95joaPnsDH2fmYtxK1wl7TQBlVQs+yyV3CCTdh8Hc3pqxgwN6jw3G20MGOfmqrBUvDXn /Usw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eesncLIZ6kaPERSIKYXaM5dC378mpytD2o0orlmXxhU=; b=QG5+NXu2B7g9X9Ex2Mjf+AIF2JR2cEAB9RyFC6CQKniWOyd2CT8rZTApHhJuzBkBEz 59dTxSp9IANVqX6VuDF814tDc7mYtE/u1MAwa/j4kDOo4IxRZszfz3s7O3CClAZmbFN4 OcJv1Ji1j0v9VivQUK31FNqHLYXeMEnenjba/yDDX79xpUeZGaMiOBanfab+h7sPMjTD 7GkBbJ+irN+mih0abrgJQ+w7ljqYmbzPVDKGfRs9IbFkOluBbxMHKpPpZYDpszdNX3y1 DUdlJgijULu/u9RlaxmteMAyp4kUuArqJ4qd9hsDydBdt9QPACjzDxrt3HkyyQJHfoYK Yr9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Su2BQmug; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090617cf00b0072a477a55e0si161967eje.369.2022.10.24.09.32.39; Mon, 24 Oct 2022 09:33: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=Su2BQmug; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231425AbiJXQSG (ORCPT + 99 others); Mon, 24 Oct 2022 12:18:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233980AbiJXQQA (ORCPT ); Mon, 24 Oct 2022 12:16: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 E3FBDA98E0; Mon, 24 Oct 2022 08: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 ams.source.kernel.org (Postfix) with ESMTPS id EF7F8B81615; Mon, 24 Oct 2022 12:15:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50CC9C43470; Mon, 24 Oct 2022 12:15:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613705; bh=0M8T/RSl1GKqcZfgKJqFNTfBzkxorA9NBTl7op9L8k0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Su2BQmug6lC9R4mK082exeFtvNHn6XwPusSX6qbQ/Jg8LvJb0+bV3I3tHNUjvHGyQ GLDUr9meEfrVjVheJ3+vT/tYxsCX15Q/c98vDHNx5x7GBLTjHfQq2h0bt2vwNPlzjh 8XXqz9gSCIy5kXmWA7ZtkbGfqoV+IQuqroS9gPM8= 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.4 221/255] ARM: dts: imx6dl: add missing properties for sram Date: Mon, 24 Oct 2022 13:32:11 +0200 Message-Id: <20221024113010.433086169@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587363789043198?= X-GMAIL-MSGID: =?utf-8?q?1747587363789043198?= 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 2ed10310a7b7..4bde98033ff4 100644 --- a/arch/arm/boot/dts/imx6dl.dtsi +++ b/arch/arm/boot/dts/imx6dl.dtsi @@ -81,6 +81,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; From patchwork Mon Oct 24 11:32: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: 9487 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp480671wru; Mon, 24 Oct 2022 07:21:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7CEV8/1gZglYcrRJ22qeia7IehHmuQ2ERmA/S7q1WEi5BkWRxLN9akd4E+4E575+DKbMSY X-Received: by 2002:a17:907:9807:b0:797:a5ba:1327 with SMTP id ji7-20020a170907980700b00797a5ba1327mr20373321ejc.274.1666621287360; Mon, 24 Oct 2022 07:21:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621287; cv=none; d=google.com; s=arc-20160816; b=Fm/gdYpEJVL4JJgrIEe9DDPLSf3meLhZuGjhDppFGa3i+ifXDxCLiJHkn16JcGCWOo 4KDYE4XxJ8JzDVEUVX8xQdPOVQs8BMPIkVdWV6n/+Z+s5EMOVwto8SkQ3ePxGy6ppNVP 1XZem7I7y9DLBm3iS2LOtUhrrzxf890IykkJAC9Vd5cnUCUdmRck7ZKL0Jk2YIIODuYk 2Gexw1YrTc0nI71el+slEndOH5Wto9/LPgJ6qFOdOtNecIj6/7BHec41IS6CnK9ryFbl aplQDQY074f60F9Dn6/1xrKDJqwPSDstZWFFn4ffWxKhnSHRzFH/uTMeG7YcF5oWpWAV OB3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=itgmzacG4BDdYGv58xaMOPUI1Q4iI9pUCOPBfjHpSVw=; b=UfReYeg7IzPVfXrDb5TrbUW6BEYK9spBmk5ZqbIzw+/MnwQtIEqNKGuTgpPFH4sIY7 WB3K3OfWWJAWWC5wCGTNd6ldZNghNgTiVOu59RyE8Mz/InpUOEpBMZ6TDmZXZj6MbHfO H2dLiLHo1OLk2+3l9jWtRSiwvq2hC1SDodpuXaqelftCMWVRw+J+PAQaErlVKowv8ewP hh/OgpJD2PnuAgktFLC/C3JcTbZYfKuzVFFxZyd8JNDRN40CmO/OrNzSGJtugqbN7wr4 Ezw6BJc1IS+FpAbg/ojQbkCEr4PUZ3bNTui7R4HWvxtJ8HAlkEyVhQVeDZLwU7vi3XpL 3kjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZEzb9+u9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s25-20020a056402165900b0046178c62b6asi6508632edx.477.2022.10.24.07.21.03; Mon, 24 Oct 2022 07:21: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=ZEzb9+u9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235067AbiJXOSY (ORCPT + 99 others); Mon, 24 Oct 2022 10:18:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234357AbiJXON6 (ORCPT ); Mon, 24 Oct 2022 10:13: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 621E0CBFC9; Mon, 24 Oct 2022 05: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 29CA9612D5; Mon, 24 Oct 2022 12:15:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B31EC433D6; Mon, 24 Oct 2022 12:15:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613734; bh=sROAur3aGXlT8ifTU8ZjjjERgRM0DiGP+pQC/jW0V5g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZEzb9+u918+gVV+OmArRoCnxl95U4h1ivKtekWoN61dKTQk2zbRFzLfLdalvzC960 z6KrOqkP/WmMs6qx9xEMJMGD+7vCvKnjE5yEt+rPZ7eSLmwjx9PKAyX9phWLnywi+T dFlA9IB+23VyRPB8gwLw+YBVgmf8Q6LN0t/YyjkA= 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.4 222/255] ARM: dts: imx6qp: add missing properties for sram Date: Mon, 24 Oct 2022 13:32:12 +0200 Message-Id: <20221024113010.472250384@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747579083055208993?= X-GMAIL-MSGID: =?utf-8?q?1747579083055208993?= From: Alexander Stein [ Upstream commit 088fe5237435ee2f7ed4450519b2ef58b94c832f ] All 3 properties are required by sram.yaml. Fixes the dtbs_check warning: sram@940000: '#address-cells' is a required property sram@940000: '#size-cells' is a required property sram@940000: 'ranges' is a required property Signed-off-by: Alexander Stein Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- arch/arm/boot/dts/imx6qp.dtsi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/imx6qp.dtsi b/arch/arm/boot/dts/imx6qp.dtsi index d91f92f944c5..3633383db706 100644 --- a/arch/arm/boot/dts/imx6qp.dtsi +++ b/arch/arm/boot/dts/imx6qp.dtsi @@ -9,12 +9,18 @@ ocram2: sram@940000 { compatible = "mmio-sram"; reg = <0x00940000 0x20000>; + ranges = <0 0x00940000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; ocram3: sram@960000 { compatible = "mmio-sram"; reg = <0x00960000 0x20000>; + ranges = <0 0x00960000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; From patchwork Mon Oct 24 11:32: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: 8998 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp440020wru; Mon, 24 Oct 2022 06:03:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7o1Ez2ckHALPzrFDrYN/FY3d9PTojrOjwoq2dUBisEV1CYNxAhtTjbSzclI8A3pt5alq7X X-Received: by 2002:a17:902:7b91:b0:185:4548:3a96 with SMTP id w17-20020a1709027b9100b0018545483a96mr33492408pll.130.1666616607893; Mon, 24 Oct 2022 06:03:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616607; cv=none; d=google.com; s=arc-20160816; b=IgI5Wj6Lu3pfN8C8SL+nnoNcZAoiBmy+UzAIcuFrRR7Mh5SiVvVhKQqvEMDxa/CF8t muXh0Wr3fHW9aab6aoUHTZH3d7nKIw4j7u4nYWgkMufzHWFAWF1E7nSSWqsDoIo14n8g jMGjON7i0RLUwGN1cDzq7gK9o7aP+iwoqE+enLCI0XzZhrzR3MqlW8oNKL0MJufOg8Y6 dHZCH8ltaTFHynayylkc96XjQGdv7+oiFIA3NYLb3Pl+B1qFw79vxDjAEBHtBwDUsBPB jAlpJZQoyD9HL1A4s0Ejaxgliqm/VN3LGwZYknN/fGDlF95mSJ8XOv12nlB5eoOAKwso 9eSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=w8eH81P0D2H7ly+201FC2dj4xWtHS7TzTsYb4HAq2o8=; b=goZsbb+VyjvFEs1KpDdfmAo7/yFXlVd+QCWtlwbOvwbZQdQt+ELoPhiukvYKyLX+j/ MXDyj0IPSW5Qdvs8HSkCSC0DKhu/La1ULhPE4fDleKQUzG/psCBgxF2HoaA72Wz/d0Tn fVZNp2LMLW42hXYFjCAG/aSC0FyxO4gQ4vgqinqqYc05amMGSBUkG+91+vfsddhFtO4M 2wmHyLMse36BlZsuFaFPsOlxnDM6nfz0fwt6y+BwAfgVSJIOHAFk0S6QC1z88ByqOisk LGXZRKtwva4JBYJAA+iGBve6JMH4Xd6fE84O8NWzHNFhX38XfEBIHt2+KuSLq/8fa7fO qThA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IZOsDLvU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a635b02000000b0046f06416984si4045835pgb.622.2022.10.24.06.02.50; Mon, 24 Oct 2022 06:03: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=IZOsDLvU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234985AbiJXNAx (ORCPT + 99 others); Mon, 24 Oct 2022 09:00:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234842AbiJXM6k (ORCPT ); Mon, 24 Oct 2022 08:58: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 DB05B98C8D; Mon, 24 Oct 2022 05:17:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F13BD6129B; Mon, 24 Oct 2022 12:15:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F020C433C1; Mon, 24 Oct 2022 12:15:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613742; bh=4njr+0uwZgCoe7lobebxQnWYZISbUX7gYCrWYiJ/Vz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IZOsDLvU2aaASQBCm6PFAQFekBZrI+RJMlUjBrlzCGieueuC+qu28Iy1OS4ifUxWM ppFHyNXyjXKYPA+LKg29Kxwzg7UBuzR+zdTs2vR4ZZa5xP8nT25uollp1i90Z/CluX 4x9knpdaoWhE5CWqZFXEXZZHOob4cVvr2YWRyrF0= 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.4 223/255] ARM: dts: imx6sl: add missing properties for sram Date: Mon, 24 Oct 2022 13:32:13 +0200 Message-Id: <20221024113010.510438787@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574176392257137?= X-GMAIL-MSGID: =?utf-8?q?1747574176392257137?= 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 540880f0413f..852f66944c7d 100644 --- a/arch/arm/boot/dts/imx6sl.dtsi +++ b/arch/arm/boot/dts/imx6sl.dtsi @@ -121,6 +121,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SL_CLK_OCRAM>; }; From patchwork Mon Oct 24 11:32: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: 9021 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441360wru; Mon, 24 Oct 2022 06:05:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7p4G7tRcygebClaec7ecrNU9nj7qBnrJ6FOXTlTkG+gZKA6KI1NjbGS2fgVyXYMiH9QEmm X-Received: by 2002:a65:6042:0:b0:440:56aa:d5cf with SMTP id a2-20020a656042000000b0044056aad5cfmr27742967pgp.81.1666616738079; Mon, 24 Oct 2022 06:05:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616738; cv=none; d=google.com; s=arc-20160816; b=sD3uquPTuUK7pqWBwxhSeJ6L+rPiSxEa0slQNtM8/dO85xD853AiBS6gTxTWOIqwWk P7VijXlWPSeF6BmADIs6UQMAsKO4a82/ebIaLad40+SlG8LkSTrmXiLMtrQJHYoAXRhp s3mNHkhB3ILC0H3+acoGmMUznFrYdSXrEMe8HUGaAJckOry0P4c0RC1Uo07Y/HFGfp5E e4w8Y1q0O+5mlimFb21C3nnEqXYaIzjGDZZAopoU2IkXCAdXMT1Q4M+PF9EdUop9YjbQ jws8KdYN4xS8ZvEeFtxgfRWxG6FSzuuNW7ag+sC9iL6nlrYYPklJXP47VVLfgUbYXrLN jeCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mkDJEudjHbB18BFFwsOUQ4DVr66bfm3cNsKDySIyLWA=; b=CVK/WEmyI7j1XkpWSPrhvvFTBHxGhYtMiSXlQMgPbQrml/YJa953AqtePAsKdXUF7x Vx1KSQ4QHE1Mz2Fq7v388URVBtSpvpJiisQYylG9NK0dMUQNSPs5Fx2idd5CFMncgQXt 1HWhA4b3Iwjl2Yyub/5LHUaf+j3td/5zn9DeLvVmiN9TRoRYeW8wKvzhS+tLoxGTHrid jipN/tG1372dS4GeJkkftSDABTvKxE+mnancsvg2xDCST3P56BX+fWCCI+vOz46fS9dW OR4GUbHlX5aEb1ZZmgWxtDVn7ppXRgXAg7MYbw7odcR3+o+F5lsOWbb3+gBgeyNHIVT0 oMfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0GrnNjuX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j15-20020a056a00234f00b0053fafd6a529si34490410pfj.24.2022.10.24.06.04.55; Mon, 24 Oct 2022 06: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=0GrnNjuX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235239AbiJXNDu (ORCPT + 99 others); Mon, 24 Oct 2022 09:03:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234940AbiJXM67 (ORCPT ); Mon, 24 Oct 2022 08:58: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 9EB8C99382; Mon, 24 Oct 2022 05:17: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 633E861326; Mon, 24 Oct 2022 12:15:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B91AC433B5; Mon, 24 Oct 2022 12:15:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613744; bh=hRXEIUSHkTgU55ebQ2Zj8X+CuVHS1xsPX4dXikHKsPk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0GrnNjuX3yz/qN8Sj35rFXoYfLMxlZ07gwq1H2vH/HQrtKyH/FdLD3QedTiiME53D 2yPBjQ354MhRUNiMOpdCNZbv/oKJUy00O5gwCKOeYwlptW8t579jlx+oHpeWvFjw6N F+p9UoNh9KytpQIEu9ftbnYvUhCJAxQeCssinqH4= 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.4 224/255] ARM: dts: imx6sll: add missing properties for sram Date: Mon, 24 Oct 2022 13:32:14 +0200 Message-Id: <20221024113010.548895359@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574312628091743?= X-GMAIL-MSGID: =?utf-8?q?1747574312628091743?= 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 13c7ba7fa6bc..39500b84673b 100644 --- a/arch/arm/boot/dts/imx6sll.dtsi +++ b/arch/arm/boot/dts/imx6sll.dtsi @@ -123,6 +123,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 Mon Oct 24 11:32:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9061 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp444345wru; Mon, 24 Oct 2022 06:11:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6U99Rjmy5YmDNQONyy/6TMpcyE/T2Tlkc3jU+zlWEFXQUO8D8Y5dXAvParhQvadjk0JOdW X-Received: by 2002:a63:ed01:0:b0:445:4345:4a21 with SMTP id d1-20020a63ed01000000b0044543454a21mr28410749pgi.404.1666617064315; Mon, 24 Oct 2022 06:11:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617064; cv=none; d=google.com; s=arc-20160816; b=rf84MPnpKDmiG6lb2+nr8dH9apcn2eKCLbkbC7Oth0Ec+HeB0/z8HReClkjscbLAIX SbMhR9Xniqpz/wnfT8rRCaA6evLhQ1CZ7MLmMwVtcwwHQ9idREXo9i9GYSKERtus8HQ4 iP5oMLkx4K8IHThpTGjuj5R7xM6PhCfZ4q+gmoY0tvWthkez5DPqmcZVVevIDNwJY7Gj 6UQA1eMTKFqMpojJp7T5DWHNDbwX9Tgsx6uarOUx/5lr5e3q6HC7z2F/nj22GwcsZDxB r9I4kdGcPKZuTF3uF9f+uwgOiFk//wW9z5EdT/9OOdG2D1TT3vPTJ+XQD4eROt+3l3Bq 2rYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RPgdh1sSP9fqRJg+D7KWgTwxX0QHZ2858Pc69OAWPbs=; b=qlLfQu+UonBo1MLtGeVPyvdnGqPi5ekbE2amea3LqN5Qm/mwjObFElI4lF0zjEXsy0 1NoZDgBiqzHNVeeKW9O9xuONkwXYzapPOHO9/L9JwcorzTAcqHSakGqlD7JvnYNkj/Ev 6aR2RXI9BJtiv5rNLBXcFcjWLcHnLG14pBUMnwrjTjyvYLglVj10dVio7/NWB0/wNHaQ NNPxTbCQYfBza01diQ8qu1hNUfPAAg+LfitQT5PdHQdpt9gShDXx+YjmIeUJVWDvuxI2 1aP1msRd4zgReUN+AQbTevRFLRj3O2qlcnx8OKYWKZ8WwP/OQMYTXOD1zfF99gZ8yP4c +KPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B2hEBCpK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b20-20020a170902b61400b0017a0e8713cesi31839053pls.452.2022.10.24.06.10.48; Mon, 24 Oct 2022 06:11: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=B2hEBCpK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235523AbiJXNIn (ORCPT + 99 others); Mon, 24 Oct 2022 09:08:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235454AbiJXNIS (ORCPT ); Mon, 24 Oct 2022 09:08: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 98BCA9C7CC; Mon, 24 Oct 2022 05:21: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 ACAF1B81625; Mon, 24 Oct 2022 12:15:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17FA3C433D6; Mon, 24 Oct 2022 12:15:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613747; bh=BkieIoFSvHqO5CAjaIRjii/HdAjZVkk0SXF/cAxkg64=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B2hEBCpKd3HerjBe0oOQnumfLpb8v1nIlhYw10xYWPXiYWisaxAYz+SeBJOV8c28O yvzKS5GTMaebuL78XofSYbI5//rKnj+kEGfRNQ5h42Qvt8ErImA/4QQkyNH5jxvpFv F5auEgFFp0+3Q+J94EwXC7u1kn47DnScbcqRqPoo= 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.4 225/255] ARM: dts: imx6sx: add missing properties for sram Date: Mon, 24 Oct 2022 13:32:15 +0200 Message-Id: <20221024113010.582637725@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574654583474190?= X-GMAIL-MSGID: =?utf-8?q?1747574654583474190?= 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 531a52c1e987..b3e24d8bd299 100644 --- a/arch/arm/boot/dts/imx6sx.dtsi +++ b/arch/arm/boot/dts/imx6sx.dtsi @@ -163,12 +163,18 @@ ocram_s: sram@8f8000 { compatible = "mmio-sram"; reg = <0x008f8000 0x4000>; + ranges = <0 0x008f8000 0x4000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SX_CLK_OCRAM_S>; }; ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SX_CLK_OCRAM>; }; From patchwork Mon Oct 24 11:32: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: 9060 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp444251wru; Mon, 24 Oct 2022 06:10:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5yW12hJicZ/Er6SkyEn42cy0I1Dof82WNOY+Ds+zvMBsjkrQXU87l0S78l9zYPgzdr9ZVJ X-Received: by 2002:a17:902:ea02:b0:181:f8d2:1c2b with SMTP id s2-20020a170902ea0200b00181f8d21c2bmr34115034plg.107.1666617055580; Mon, 24 Oct 2022 06:10:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617055; cv=none; d=google.com; s=arc-20160816; b=Dvv7rGs4pEeshFgtyDYZBu1buiCLbkR2a+KT2+9mHK4z2qvWWWLsAa7g9z3oCv86n7 /31hIJ7RnZCSW8/M5xWYUMDQbkACeIRbRETC4q/rqq+iByFHovogV3FNHKFByeafEaEe naCqSKWIXPLib5B40/57KwbvMbYXDE2avgINo6rCptE9ndbEyV7Xcf7Q4EC4yuZvHFVi /1jEDvn5UPva59rsHA9VnwLdDY8y47bo+uyYL2yMTX9OlDvCmxm9CzL2pWBNnm+EJCcr ilWTmseFxhh4wgl8BHsrSC92vOrU9adnbv9cIxDHGeNLm7iJ9yxYK6pJ9xORyvXF+YHD 4sjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8TjMMIS81y4uEVjc5zor6Eo1FCewNxbWpCxV6OX7iVM=; b=dsRj5eTW20OdvmGmOBh8vIYqtH0/fgs63DEwEmMTzzDqIIN0wVw3dytS8NSUTfE0Yr 0N8hqfyQWOJ3ke2r2kOt6QMpWvqSllLG0wlEo94CcGSAaH67A92gdzoe5/CVkCJwaK4h Uzt+SX4p5v761epVGQFi2f+IGPvO8zpSo7BtdpJUnh48jmbgrGooRMUnzZbSIYz9l7J/ UTYfmVE9iLgdinxYBHyJnii9F7UTzYD/9Z2fykjvB6viO1gFbXmKF0fwsXQStMgwUO53 JjjCOptS5v+Xa0F8v5P/ZVuuNz/0KjTKKv1BAXtryEmKdMvQMYbgFtO9qfwYQS9SrO07 nr7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t9FYvUg1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a654bc1000000b0045cc8781244si37233562pgr.220.2022.10.24.06.10.40; Mon, 24 Oct 2022 06: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=t9FYvUg1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235498AbiJXNIv (ORCPT + 99 others); Mon, 24 Oct 2022 09:08:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235222AbiJXNIX (ORCPT ); Mon, 24 Oct 2022 09:08: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 0985A8305B; Mon, 24 Oct 2022 05:21: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 6C6D3B81620; Mon, 24 Oct 2022 12:15:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9733C433C1; Mon, 24 Oct 2022 12:15:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613750; bh=rCB0Xv+xi/SjS1Z1j3Vilkp/16M2refyx39jmGCCBTE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t9FYvUg1jBd1PDnt6FpIK5BousDMKVrVnHpFq/9GeY+OCCN7I6AX56OltRGSki+J1 hjS82INMvsb17EcpEI585ItbQQnc/tFUlKShPb0dAKxaNt2AqWZUaZms6IVF/tjdYp kfoBxOuDAW50oUwHwcIqWcOeEca87ibq5HRFxX+Q= 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.4 226/255] btrfs: scrub: try to fix super block errors Date: Mon, 24 Oct 2022 13:32:16 +0200 Message-Id: <20221024113010.623921155@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574645676549349?= X-GMAIL-MSGID: =?utf-8?q?1747574645676549349?= 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 e5db948daa12..45809f75692e 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -3849,6 +3849,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; @@ -3961,6 +3962,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 @@ -3969,6 +3976,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) @@ -3995,6 +4012,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 Mon Oct 24 11:32:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9063 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp444422wru; Mon, 24 Oct 2022 06:11:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7rofSY1UW0J1pb9mpcB2VHhG7sCzrJoCOfyDPMvl1scU3xVp8+mIuQVwlx01OefZFRU8YK X-Received: by 2002:a17:902:9684:b0:17e:71b2:bd16 with SMTP id n4-20020a170902968400b0017e71b2bd16mr33254836plp.163.1666617058981; Mon, 24 Oct 2022 06:10:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617058; cv=none; d=google.com; s=arc-20160816; b=AjOJIPrSUKTk6AkYFFjPixY8tQxv7LD+PkbcSLvwhnvUihwu3moPTyj+HHEW5v/qT1 7zFX14yEcf//jOcMxO7vfsgYo9u2z17E7Acnq+btFSYEXfIu9kcYQe8Rpo/pCBsaWlrC Lbey8QfUKCPbvMrslfa9vkfZa4BiRapp7GFLtkhBxEyDQypozV8l1TGEJIIXG30Bx1G4 7sJDdkOys/NbSUwL7K1tVsu2mwlVyIvJM1jA7G0phedBnnWwericxsIo7/GSWcjV98tG /XyKacI0/4orzaF5mX2sbmoJl5HoerJIqgrOzGEa9RdcJX+/ewGuoxvYHSqXDLmD/r4D VINg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4OtIR9M7Y9zUQ2XNz1yQCDbcSjx7lde0TisSuio08Rc=; b=gnL4OgvjLFhVn6KZLOVfLrJXRiib7XEUatV5gjmSV8MjZL4JK0rDgNtdt3B2U2bNCc dVMGGRXNjE1gJz+otNJ4hnQx78PFrt29ydgwfbJpuom6gcgtHF8I6uXqhefj+/7bcluB cI/+6MF08XlVCckzXmMoCuQ+J4J4CZViW3CdUNQOSgs2qWlGOd9gFFVlQZVd0DUGY2tx XCprzDgxUtxuBUuAIXuIidcnx6S1ETu3y/fUzbnWTX2+e8BwthhfKmMTR5TAgSABNlal 9NuOmMfUc3Ifr/IB521Y5Jdp99USpNsN+nXQHyLMxwIexWydjiwaSIRX4xWKXm9eJe94 m4Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zAaWAv89; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eb19-20020a056a004c9300b00563a0453c55si30765822pfb.268.2022.10.24.06.10.45; Mon, 24 Oct 2022 06:10: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=zAaWAv89; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235539AbiJXNI4 (ORCPT + 99 others); Mon, 24 Oct 2022 09:08:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235302AbiJXNIZ (ORCPT ); Mon, 24 Oct 2022 09:08: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 A1D8A9E2EC; Mon, 24 Oct 2022 05: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 ams.source.kernel.org (Postfix) with ESMTPS id E3783B81624; Mon, 24 Oct 2022 12:15:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 468C5C433B5; Mon, 24 Oct 2022 12:15:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613752; bh=FBILgOO9SOLZWeB7fDai1s80MSW11iIi7tuRqrZmg4c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zAaWAv89apMO3mNAULnqNKBJBclOMIfEeR8m829+lDl0UAECh0G+TjxjwuDYHlLVq ZyFNNum5Uc6M7aA2XXvfcwCpyWICJgXjUEVBtJsS+tx/LKGgoKm6J9aLDQiRMkdeO/ QDHKDvrAjIEhOMIUVUqs/yE/v5RHM8Vpzb4iUxoo= 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.4 227/255] clk: zynqmp: Fix stack-out-of-bounds in strncpy` Date: Mon, 24 Oct 2022 13:32:17 +0200 Message-Id: <20221024113010.654967542@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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?1747574649083306800?= X-GMAIL-MSGID: =?utf-8?q?1747574649083306800?= 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 6f057ab9df03..4ef201ac8252 100644 --- a/drivers/clk/zynqmp/clkc.c +++ b/drivers/clk/zynqmp/clkc.c @@ -679,6 +679,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 Mon Oct 24 11:32:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10326 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp668676wru; Mon, 24 Oct 2022 14:55:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5y06SCILZZj6SVPHkzHP99ZViJgxe+7mJidEm7Ue0XU0oOVpX5Kr2/SzGZ/Q6iXLC7Vaai X-Received: by 2002:a05:6a00:1823:b0:56b:f348:998f with SMTP id y35-20020a056a00182300b0056bf348998fmr4554387pfa.28.1666648527987; Mon, 24 Oct 2022 14:55:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666648527; cv=none; d=google.com; s=arc-20160816; b=TSbsD18HaZC+uR4Ua3o9rFYcBXpViuJg6JupUNzODkLrNcfTGdTE7X9DEMDYX1SWWJ j2WK5dxaRhiRgp7L0AW56uRr4CmYaJpgppyG7euaXXko3KwZVISRmFA0gjvj4A94yq4b i/iiXRd11LcAt8wnluIEJ2pJ0olIkx5g3ICX9FgCDrKSwCm2zBV1ctuDn75W+LBq/0hd 344WtKOyPa2v5khfV3Dgbd3KiNI/9CMvOpkaoJwpxRarZrTFyWmqR4JajWg3pxuwmSZD srMsVfwNWg2WhcSDoNzJmbqtn6qgdGgehkV7qgjU7xJZ0JD0Xj57chdOyyhR0vQNz9Rk fBSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FyZwhx8RBv5olgmBeGZMBJCq1zG8VWsYyYdvKl/9Ff4=; b=dhsbxZ8H6t1vt0pwAaAq4KO7YNnHIHH5KP4Pj+yE8jttvle2URuVh+R5s0RnoOZqoJ jMPtadAB1oC4uXi2idj6DWdCKUyqeoMHdz8gZMzwPdJl7BLFv9iQ+3DRrKGCtbG8cYkM qduVrglYPCrSdrrwan/iRTvq2n1xCmduFwDHAFaqFodwsPDJaCMWoRRCmDANAnFz/mtS mVmUshPpM59bEW8VjgmxlqPUUssxvNYYBmCIZsC1dJkMlM4yj9bL+f89HqOAtxoXTPJG rK4TDigNuJTsRByaUr/uC60dqNr672l5NJF8/BeFMGQlCnTzdQlJ17e8qHjifgcma7Yw a5lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ey0iDlGh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a63da0d000000b0045d8554a062si733226pgh.56.2022.10.24.14.55.14; Mon, 24 Oct 2022 14:55: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=Ey0iDlGh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229729AbiJXVqd (ORCPT + 99 others); Mon, 24 Oct 2022 17:46:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230403AbiJXVqK (ORCPT ); Mon, 24 Oct 2022 17:46: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 A43062EA949; Mon, 24 Oct 2022 12:57: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 8D73DB8162D; Mon, 24 Oct 2022 12:15:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E38DCC433D6; Mon, 24 Oct 2022 12:15:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613755; bh=taxUfp8kazFUkRPz0vnQPhk9pwyhF/QDE/9ci5+0rf8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ey0iDlGh5cfpWsp3teHGhn+ktil1HlINGL7s2Fn1v0m+lTTrnXEEXlzB+owQ8Q3wZ DnGAZBMoksqwLwyxJRN3Vhk+Er4D9jXq5qQyZh1eoeAZn4iimDJsPPo3dE8A5TqFpw TyUAz6gUldDPEuaGZAPwKm4sTGoEXQrUVM0/cEh4= 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.4 228/255] media: cx88: Fix a null-ptr-deref bug in buffer_prepare() Date: Mon, 24 Oct 2022 13:32:18 +0200 Message-Id: <20221024113010.704603529@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747607647199158328?= X-GMAIL-MSGID: =?utf-8?q?1747607647199158328?= From: Zheyu Ma [ Upstream commit 2b064d91440b33fba5b452f2d1b31f13ae911d71 ] When the driver calls cx88_risc_buffer() to prepare the buffer, the function call may fail, resulting in a empty buffer and null-ptr-deref later in buffer_queue(). The following log can reveal it: [ 41.822762] general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN PTI [ 41.824488] KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] [ 41.828027] RIP: 0010:buffer_queue+0xc2/0x500 [ 41.836311] Call Trace: [ 41.836945] __enqueue_in_driver+0x141/0x360 [ 41.837262] vb2_start_streaming+0x62/0x4a0 [ 41.838216] vb2_core_streamon+0x1da/0x2c0 [ 41.838516] __vb2_init_fileio+0x981/0xbc0 [ 41.839141] __vb2_perform_fileio+0xbf9/0x1120 [ 41.840072] vb2_fop_read+0x20e/0x400 [ 41.840346] v4l2_read+0x215/0x290 [ 41.840603] vfs_read+0x162/0x4c0 Fix this by checking the return value of cx88_risc_buffer() [hverkuil: fix coding style issues] Signed-off-by: Zheyu Ma Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/pci/cx88/cx88-vbi.c | 9 +++--- drivers/media/pci/cx88/cx88-video.c | 43 +++++++++++++++-------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/media/pci/cx88/cx88-vbi.c b/drivers/media/pci/cx88/cx88-vbi.c index 58489ea0c1da..7cf2271866d0 100644 --- a/drivers/media/pci/cx88/cx88-vbi.c +++ b/drivers/media/pci/cx88/cx88-vbi.c @@ -144,11 +144,10 @@ static int buffer_prepare(struct vb2_buffer *vb) return -EINVAL; vb2_set_plane_payload(vb, 0, size); - cx88_risc_buffer(dev->pci, &buf->risc, sgt->sgl, - 0, VBI_LINE_LENGTH * lines, - VBI_LINE_LENGTH, 0, - lines); - return 0; + return cx88_risc_buffer(dev->pci, &buf->risc, sgt->sgl, + 0, VBI_LINE_LENGTH * lines, + VBI_LINE_LENGTH, 0, + lines); } static void buffer_finish(struct vb2_buffer *vb) diff --git a/drivers/media/pci/cx88/cx88-video.c b/drivers/media/pci/cx88/cx88-video.c index b8abcd550604..547e18da1ad7 100644 --- a/drivers/media/pci/cx88/cx88-video.c +++ b/drivers/media/pci/cx88/cx88-video.c @@ -433,6 +433,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; @@ -447,35 +448,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, @@ -483,7 +484,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 Mon Oct 24 11:32: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: 9155 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457765wru; Mon, 24 Oct 2022 06:36:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4boMZA83Hc1ihJPtOPeiRYHJzopUSxm6J7UxV14fCOU7ZGYbWe/YCd4SwaGHhGcx9kAhof X-Received: by 2002:a17:906:5a6b:b0:7a0:b42d:f17a with SMTP id my43-20020a1709065a6b00b007a0b42df17amr10540748ejc.130.1666618589607; Mon, 24 Oct 2022 06:36:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618589; cv=none; d=google.com; s=arc-20160816; b=IIY5JxM1dQ3/lSgPzq3iU1UtKlHDeUhUMbeGRpRP58N7wT5J4JErFZb/S8X1Lybamu V25nMtbzGuEVvFAerwrJ++oKYzQT6TwVYPHGY3gA+bj2sgApjNjmWhEAyvMtWqiGyBLY N921hsH66m8gTIhwCGwWtlGIlt2Lwb5Uputky/i7DqH5QvgwV4kv80Z6CJE/GpwXDGoJ D+FQv9B9Et46D9JJoP9FzWDGOwURoFzjE+DEg9W0627UYlvcd/6QZxi8S++78ZpTtyMS 1u7IjVEvjgPTZz8EqhpXcExsvWW6cOG67kZV9lnW3FDsfujgmVxRYLA4E+k4fDHOJInj je3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nlT7iIWNxctPpkvJqbGorPPW0fFbU9yHyvOQqS4Gyt8=; b=Am3h+X8wKDjOgq0QUBrJw7Ic3t50BZGA/X3p4SiLyNb7a+7wY+jIYExLwcqOByRj37 imu3SzbdI/2933E2WePDEcCe++oiSFySSFNzgsbVWut/IRjRBTQK4zOKnuxd1k6AZB5u HRp0Ne5IwKhYiujCUNRsjWP7LO7/vZgEkwEgBdq0OYtB1O7kQsc0/1YRx9QoUSqm63F1 +VckGg59UQky3FtrX4gso35IqW97F8MZN52KP2OP6KaB+Xq/F/r18FIaPZPba+UqFgeu g4yuCqsAB4i22ALYMMmHyuOzirrzUBBsGrXgDjDbn0MUMrJbYCIqvgNFnRHAxzS7I7Tk z26A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vYQRJjFF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hq6-20020a1709073f0600b00787c0e9818csi32871961ejc.568.2022.10.24.06.35.26; Mon, 24 Oct 2022 06:36:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vYQRJjFF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235929AbiJXNVf (ORCPT + 99 others); Mon, 24 Oct 2022 09:21:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236402AbiJXNUW (ORCPT ); Mon, 24 Oct 2022 09:20: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 DA61D86F92; Mon, 24 Oct 2022 05:28: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 4CC38612E3; Mon, 24 Oct 2022 12:14:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C245C433D6; Mon, 24 Oct 2022 12:14:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613679; bh=Ku+s+zE2JUi5LkzFKWab//xnKW+xerFGSit2jWXOfwA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vYQRJjFF4O2Qjo9wdVctobCFU6ggwiNC4aWucvb7Vx2BDua8yknXEeYyIHTz3ue88 QWRdZtnPfElUQr47Be3YknlCSJM1Van1KoZrfmYWgzAdr5o7kKWPnNi26Bz8o36qOl skF7infBs9J2aABq1513ZWumbMhj5Uliqwo5UDKk= 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.4 229/255] clk: zynqmp: pll: rectify rate rounding in zynqmp_pll_round_rate Date: Mon, 24 Oct 2022 13:32:19 +0200 Message-Id: <20221024113010.749178104@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576254227142402?= X-GMAIL-MSGID: =?utf-8?q?1747576254227142402?= 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 18fee827602a..3a2a694e5bf3 100644 --- a/drivers/clk/zynqmp/pll.c +++ b/drivers/clk/zynqmp/pll.c @@ -98,26 +98,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 Mon Oct 24 11:32:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8974 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp438037wru; Mon, 24 Oct 2022 06:00:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7UvffM6PMIm+oyXJgzUgQn4AkqzkgxegEivbwZIRNme2TKhJtWKiDEPEZ4af3aGvirabyW X-Received: by 2002:a17:902:8693:b0:17a:f71:98fd with SMTP id g19-20020a170902869300b0017a0f7198fdmr33451547plo.25.1666616450755; Mon, 24 Oct 2022 06:00:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616450; cv=none; d=google.com; s=arc-20160816; b=keVPxxKxNJ6rIV8FMwDeBJrciIzSFk/PpAskJzFjLE9a9qApDoh6X8poIJELqLYSPR Wo5u+FsSjWPIdwLHj1C6rGYVZBIpGrOT9bjfT+LIh2ZK/Bbf2L4b3VEaQhsYBBrmpbvB lbT2do0zNvrGJ/VLcwhFQH98P2iDoNfh2hNiF/LznYETFMwnWAWNI0mfCaTIXCxMcbBk 1e2llgIqu1ZmRcYbeoU4Q/CGw+NlOpVn4Pt/VVjzzvZA41CcWvMjNANHmrBxeRKOV1nQ GqID7nwfAue83qCDJUlmu555C5lXzlPnwYYKz8RSteB0JfEMQ+04XG0m8+i68actBO7I 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=21n0LQKx1VoXAm4S4X6UdvZsMWwuaFrM6DLuWvuOCFE=; b=cxeHfLi3e6ln5xLnwWSwaiTSsvK3SoYPLxRba7qTRiYOL+NG7IHIyNuaP0j4ZMOcOe oGsHfKNc5k1HEsXItKl1+CCcOuoIbrmaZg7vrudTDkTbRIbymU6lKmhNApjp6xDjcvLx JT5HcbVCrXec/TKPTnolKUBoly80sOGige+gp9QtVa2x+vJgN2IXH7XUismqEP1RFdMo rDOfsZsqNrX/QriEHfZEZoWmJxgBew3DbF5XTCcl/43Fzko0ePyPoBZvxH3cAqXlvIQL xVKEcZYP/XbGBbIl/Mo76q72/9TyqPw/gZnpsJKWIn+x6jur8vnJwLApGIEKKlCH2dL1 ZEeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QNpHkygk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bm18-20020a656e92000000b0046ebb8f5cb4si12218066pgb.691.2022.10.24.06.00.32; Mon, 24 Oct 2022 06:00: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=QNpHkygk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234679AbiJXNAU (ORCPT + 99 others); Mon, 24 Oct 2022 09:00:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234807AbiJXM6a (ORCPT ); Mon, 24 Oct 2022 08:58: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 1B3F99835C; Mon, 24 Oct 2022 05: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 dfw.source.kernel.org (Postfix) with ESMTPS id E99086131F; Mon, 24 Oct 2022 12:14:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03832C433C1; Mon, 24 Oct 2022 12:14:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613682; bh=N/ic3nvsn6gbap9xn1FFJo7xJmazvDTuIdIeuNaNTDk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QNpHkygk6BHi8ENZaihv63PkVcrYAUjsvfPvpFIdzRiW9MNGziPn7E+DqrRPFbQy3 43SQNAzbzr/5+V7j765HrJA0WxTwDz+1shdVltTPjHRDFMSJNcTk3hsmNa/g5Yb7b8 om7LgwJzehwqJAnPYqqm5HQXtA+rU8gu4bmATbF4= 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.4 230/255] scsi: 3w-9xxx: Avoid disabling device if failing to enable it Date: Mon, 24 Oct 2022 13:32:20 +0200 Message-Id: <20221024113010.788560779@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574011784884538?= X-GMAIL-MSGID: =?utf-8?q?1747574011784884538?= 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 3337b1e80412..f6f92033132a 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c @@ -2014,7 +2014,7 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id) retval = pci_enable_device(pdev); if (retval) { TW_PRINTK(host, TW_DRIVER, 0x34, "Failed to enable pci device"); - goto out_disable_device; + return -ENODEV; } pci_set_master(pdev); From patchwork Mon Oct 24 11:32: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: 9034 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441955wru; Mon, 24 Oct 2022 06:06:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7w8Og9ozS5WWGB6pY6JPBqxR8Zgu8pHp/F2pasdplTqpTbWZ8vzcJUTpPEEKmxoc47UBHr X-Received: by 2002:a63:814a:0:b0:460:9253:bf8e with SMTP id t71-20020a63814a000000b004609253bf8emr27602355pgd.469.1666616800798; Mon, 24 Oct 2022 06:06:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616800; cv=none; d=google.com; s=arc-20160816; b=IqC+b8ucPudb1v4IYo4KRdS6hdXrmf6Jxk0gichPqjJ8EagIbjkDaomiP+zu5XV/Kq IomgbJh8MejWz5gOd3qVP2sIo8NOfj1dxczT3l27bzU5Ba5mkShrCuTk2mFPKWA+WF+G 3zJtZ5eUx8eNOMnc5p1CgtaPSiNRRRxUu5Ik53i0UzYP9m8Cul4Q8fVFwaGLmNxcZcms t8TeeulcfjO9ACF5so6QXQ65ERPqVXZUSo+iImSvGCcqMcrLRwGpmDoY2/k1n1aCG57y 5lsGpjq4pp3exYazTtXaYKZGZaIJd3HHwa2ZXzFjtvbNgZy+Ofl6S0B4hrZwCkK3JiH8 +kAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aFZh1fb57CzmOkjHSfXMFO9BXE05aLNfYtVigtAbPUU=; b=nD7812GVUb93B0g8dqsQBY3sou8I+xpCfdbB2JNvbKfKxsBaB2QFlhhd+WDiFRJBxP 2w4iIDSrQx3sxo8C5xwTYXmSASZAqCw1E+RAzurmBHx0vkfh9IIXEjhJPi/e/Oiyw5XZ +EcppUHupQAB7WL6M4y7ataVXpm6F4cpae4607wq/7GkX6Z9A7M1vV2ty+AbvlXpA1Kb 6HS6jb7mdxHbEKxmxWihAkkYsW73xD4kK3ilAqM0ZqJXjqQVnkRQjV155PeM2ShggEny gjg40Hz4qn/DxgHHbburUIM4iMsbVdEjIOYYUhx/vw5r5+AhX8t+9LUKunm9e/eIL7i/ ZfRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iQjuipbj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090b3d8800b0020382775a6fsi14793577pjb.149.2022.10.24.06.06.20; Mon, 24 Oct 2022 06:06: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=iQjuipbj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235330AbiJXNE0 (ORCPT + 99 others); Mon, 24 Oct 2022 09:04:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234954AbiJXNAq (ORCPT ); Mon, 24 Oct 2022 09:00:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A7D31C41D; Mon, 24 Oct 2022 05:19: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 841B66128E; Mon, 24 Oct 2022 12:14:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93B46C433D6; Mon, 24 Oct 2022 12:14:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613684; bh=azAkJqJbnTmmew6QdoYoIdY01RIbkpxXD1N808qO7go=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iQjuipbjFV7GZAhF0XTvuMjgPwvu61qfM76DPBNt/AFVHXNdRrMTnL2QXl41xGRt0 H9QRjUUoSFugl7RV0MmTSJ/BhmsfHZOBgW3Aplq8GfF69t3VI8eKmP/UZua/puDL1v wDkwFzPxbd+gPNziLomUjn20XohORU1AADSEECBk= 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.4 231/255] nbd: Fix hung when signal interrupts nbd_start_device_ioctl() Date: Mon, 24 Oct 2022 13:32:21 +0200 Message-Id: <20221024113010.835858082@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574378926940066?= X-GMAIL-MSGID: =?utf-8?q?1747574378926940066?= 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 09323b0510f0..610dc6a36a9d 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -1327,10 +1327,12 @@ static int nbd_start_device_ioctl(struct nbd_device *nbd, struct block_device *b mutex_unlock(&nbd->config_lock); ret = wait_event_interruptible(config->recv_wq, atomic_read(&config->recv_threads) == 0); - if (ret) + if (ret) { sock_shutdown(nbd); - flush_workqueue(nbd->recv_workq); + nbd_clear_que(nbd); + } + flush_workqueue(nbd->recv_workq); mutex_lock(&nbd->config_lock); nbd_bdev_reset(bdev); /* user requested, ignore socket errors */ From patchwork Mon Oct 24 11:32: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: 10210 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp642438wru; Mon, 24 Oct 2022 13:38:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7pEKrckfGG2pBZMi7VRgvRJPAmbUM46vTT1E+WCWuC01lPjHV/weTAuboCGtrz+a4rXMjf X-Received: by 2002:a17:902:da8b:b0:185:5723:5834 with SMTP id j11-20020a170902da8b00b0018557235834mr36115646plx.49.1666643908933; Mon, 24 Oct 2022 13:38:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643908; cv=none; d=google.com; s=arc-20160816; b=mpCX7j/BGD9E9IVmvS5k2HTQQhITCcRe9/aEYN1YrE2rn3//6fadEkBER+ECULvA+o yHAxqjr6qY7fyVgvB8UE91wFZ7fqePCO166wh0aH/aHReWniC9vPprIsOXlQ8hI0UiOh LFEvzms4UetdQB0jiBgIEkNOQyVUaLBcGcjKl/rqmszqISfTvFVlzyhnCzQnFD1yLMt7 jxB61dNBDSug5YT30TK0vvsHv2oOFfAlLjXp3WFvdvx508S4gJ9C/+bm7Lx69vpDhWe6 pgIDPm1KitdIWY1yA7QJdn7Pm8KUApIZz6++vy6SCUbxDkndBE7izrZUG2irS43eEj2/ 4iTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=TKHqc9ZLLrUx8+9DBnLFIAM0Clf2OztnfDWE4+pvhnRJfddtCl11jowBk0HL1UFEn9 a4hwaxi8F/0ioMOEscJ4siNi2THSN2rIkjGazhdRp9P5sXuHU6mMyTXcjJ9RF9zF454a hvR06yHK4XiiW2NDgEBddy1XUSV33Z10HbsOxSSVzvwe9BBP2vwSkF1myhuZx3Pr5tVT WMqDhY/Gqsxw33zRfO96vyXTbK7/RAsa/gFQ4M1JzIpEJ7OO0WnlGAVJssEOFQnNthFL 7RESIhKkMMMuXd2E86EE6ElYw7xy8NO8n7mr5IUXteCgbBCMFDj+OdGM36knCDHhWLYX wZyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ntChBk9W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170903018d00b00186b9b292bcsi719338plg.2.2022.10.24.13.38.16; Mon, 24 Oct 2022 13:38: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=ntChBk9W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234489AbiJXUgx (ORCPT + 99 others); Mon, 24 Oct 2022 16:36:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233946AbiJXUg0 (ORCPT ); Mon, 24 Oct 2022 16:36: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 E324C4E85F; Mon, 24 Oct 2022 11:48: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 DC420B81609; Mon, 24 Oct 2022 12:14:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F939C433D6; Mon, 24 Oct 2022 12:14:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613687; bh=PyVuP224LTfOgKeY7PGhWDcswJIc+RIZ/ujbhn1tRm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ntChBk9Wsm0sS2l8gIZc3CWz83wQmyOLz9tDPjq0ET3aDQwhB5tuaNsGxf5WF4kqx Jv9F3tnTtcVLyJoxwS2UMxCjzCQGWXBLaR7gC6wWjjNO/2BtNvLVEIGIbwzhO/BTEK lIchwTGG6j5+RigJmpw6en7671fxl/4THzoEMY44= 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.4 232/255] power: supply: adp5061: fix out-of-bounds read in adp5061_get_chg_type() Date: Mon, 24 Oct 2022 13:32:22 +0200 Message-Id: <20221024113010.884290799@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602803130873897?= X-GMAIL-MSGID: =?utf-8?q?1747602803130873897?= 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 Mon Oct 24 11:32: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: 10371 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp687116wru; Mon, 24 Oct 2022 15:45:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6D6Oo9hmVyJe3aLR+rbOfW7H0iyqmhGt0eESucUlO8Fi7HquaK7ho8YB16K1nNQ5sGXfrQ X-Received: by 2002:a17:907:75e9:b0:7a4:31c:ae0d with SMTP id jz9-20020a17090775e900b007a4031cae0dmr9695557ejc.79.1666651544012; Mon, 24 Oct 2022 15:45:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666651544; cv=none; d=google.com; s=arc-20160816; b=z6kqQYFFsJTiHu+/Ho90tIecQ9saFGFrjH8OQy7FmGGbkFUcB+poECBD64V22kxKVA oisVCbGbd1ou5j8kB7xK2nDM8DbmQaxgzT3Rv9AoT3yb4rY2CqlIUvu4w68UwnvgvfsV lYw/TdmBe4Wqe3tsbNRZvfga5pamXybS+9t8HoJmvSJWwgq57WFLEySxYqMWVMghcDSG xINp0aaaJLi87R02tl6kOpFTQbpLH0+03+AJJxU25habRqj6GIE6+9ZioxFqC2HE3uKJ B1L9TctPxARciOU7fmNPZ2+ZNJv1NgKuB1/KKyiddtWAcKnASkqpi/o22X0/d+hSTYtR OTXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dV+E+SVR+hzUjvYfGEUNH4a8MbNKJr+ppYqfr/L0XDc=; b=ypwQQS4BBpV24ArQpebqMfvJNHKz8pzkh57h2ukh0vzQPuo6/+OIJjgogykqkAGF2y 3AReysLxvS1t3CUNcWspRl8tZvZpd6LofqC2zl9kfx/zl3MkTosYp9Z8aHPlcX5XoF5D MK+CRfFjSFfTowr3PPO5lqW8ok+PY6JWjPemeQNCnmPEAvv8rovoUp5mvZnrjjvwkqeD lOra7cNXRmrumRpG/v6Finq1IlmX5/oGEasCnIHcvrr4cRnz0CW1oza+ZEJZ1zhuBZ6z ZnGL4W9AHz75cIyNeC3gpVElcEb4048K1yRrieX/jVJFDGBipD75qRje6ZRO4OD71l7A VjYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cG030Kg7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qb40-20020a1709077ea800b0078db1258ae9si984426ejc.555.2022.10.24.15.45.20; Mon, 24 Oct 2022 15:45: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=cG030Kg7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231890AbiJXWov (ORCPT + 99 others); Mon, 24 Oct 2022 18:44:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231878AbiJXWod (ORCPT ); Mon, 24 Oct 2022 18:44: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 328632D335B; Mon, 24 Oct 2022 14:07: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 8520FB81614; Mon, 24 Oct 2022 12:14:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D53FEC433D6; Mon, 24 Oct 2022 12:14:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613690; bh=uMn96ZJPzqLtHZX/cUqm+tqU3zBy+TvPlLqdqK0lCXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cG030Kg7jw7/AfUa9qmT0miAGxZS4+GFEx2AbLq4ZHwLjUmhFFG5dcP2QvDlxawOO 4SjCMHvDEH//rWBlvsF7cPRt1s+eFxPIgoHH4R1QuIDBpIu1bEnKTRPQ/Gv7BUoAIP DN0A6Abdh5QHRtRH8PhgSiAakiAw7e8O91OJZm5g= 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.4 233/255] staging: vt6655: fix potential memory leak Date: Mon, 24 Oct 2022 13:32:23 +0200 Message-Id: <20221024113010.934162613@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747610808952680054?= X-GMAIL-MSGID: =?utf-8?q?1747610808952680054?= 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 c1f9b263129e..18284c427b7e 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -670,7 +670,7 @@ static int device_init_td0_ring(struct vnt_private *priv) return 0; err_free_desc: - while (--i) { + while (i--) { desc = &priv->apTD0Rings[i]; kfree(desc->td_info); } From patchwork Mon Oct 24 11:32: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: 9716 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp545388wru; Mon, 24 Oct 2022 09:34:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM66yTz7pOExksFcuKWN+FuC/lmhIErzRuxTbezVUt523+QQQ+zUkROnbqAP9OmR39PHnRuR X-Received: by 2002:a17:906:8a4a:b0:78d:5ff6:7507 with SMTP id gx10-20020a1709068a4a00b0078d5ff67507mr28221236ejc.194.1666629258132; Mon, 24 Oct 2022 09:34:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629258; cv=none; d=google.com; s=arc-20160816; b=z4UeV41EczIFdNU4SBWatQxnpwNrAIfTyMRjIzl0JkJM562R6Xf2/n/XfnwgqBTKXw Jme0gqAzKdqfce5RslYPTP9YnSgL6SxF96h15iu3yx/Z5ZPTC/4DmW0t0hFjwjpgxEMX jLPkZhlWuD4rIYGama5njSdn1Um13HUbwswopBHAv3MH56QNZbuTeSRI08xN3an96DQq tsVlieqOGOzEjQPCR+GSdADwvbjkkvE/MErCHVW8lX+ZGKYCvA58bSO4Vbgq5A2p08lI LcxxyI/V2+w1mMHo4b//Vhbbcjc4L6GWiLpa0Uwgs9SjRWqOY9VmpSQBM/xlNlzmShyE vcEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rOh68a7GDNGzXdPBOxs5Et1CbHu0gBFH71n60XgorFE=; b=IRYVmUQjo6bkhLj7qJvlLn4O4iPArMerC2pQAFCyN0GxFR4AUPVMvfMZiuKH/bPNSm m5bJ+AA+EVejdkJtN26ClJ3tuzLNvqgQ6b4M1JfhZjG8v22O20VIKsX/S7/jkPMUCipx ClfP51DM6f5dtqxmXQzVWtySTL5qUoLP+I57sGUC0XjagnNiIMCk5yI5QTxxW5YTRvPd e/rVtcADglY4jWAdUHWsap33WFALSfQe9h0oWSh2D3Qx0/ylZFrKlrWaRp3/zCj9RNJy uRqVRlL3jbq7V+Tmh0ozMJw/bw7ObsaF+SiXeW9ZA5T6/ZjGBn+5hEykqnEgZN6W2OaC JNHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KWzzTtTe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qb21-20020a1709077e9500b00779c6c57dbfsi190394ejc.556.2022.10.24.09.33.54; Mon, 24 Oct 2022 09:34: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=KWzzTtTe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233383AbiJXQUU (ORCPT + 99 others); Mon, 24 Oct 2022 12:20:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233606AbiJXQR5 (ORCPT ); Mon, 24 Oct 2022 12:17: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 704241409E; Mon, 24 Oct 2022 08:04: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 2EF41B81617; Mon, 24 Oct 2022 12:14:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A30DC433D6; Mon, 24 Oct 2022 12:14:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613692; bh=DEYN2CX6xftlzs5WQJZllkRHZ5Y381wGi7pAeZQhF7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KWzzTtTeMfmRXl2EDDBCvWvJqCyBS0o2QbqAxa7AeM0cOPmGvcizI38PtW5MImGZ1 L+Wvpk7eGodYGx4w47/ZQ+3O+hbyNBOImlf4Zc+XHhHMW7jsWC0LPeSrqG0i9aTTiL R9LJ5NmHJvKX4P8xg87UEzVjhCE8GaVj+xLSg3gA= 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.4 234/255] ata: libahci_platform: Sanity check the DT child nodes number Date: Mon, 24 Oct 2022 13:32:24 +0200 Message-Id: <20221024113010.972718764@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587441061661663?= X-GMAIL-MSGID: =?utf-8?q?1747587441061661663?= 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 8a963d2a951d..c0ac25b80a1f 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 Mon Oct 24 11:32:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9037 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp442023wru; Mon, 24 Oct 2022 06:06:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5mrgAgP072Tuof6vrF6RbtVTgB6a6WtBWZzibJQqWPM1Hxrt4qMHNMHQHflYB7Fk+dapDI X-Received: by 2002:a65:5886:0:b0:439:8dd3:18d4 with SMTP id d6-20020a655886000000b004398dd318d4mr28063675pgu.430.1666616809177; Mon, 24 Oct 2022 06:06:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616809; cv=none; d=google.com; s=arc-20160816; b=UXBC2KnFV4Rnr4+2MjscSOBEPPv8orpkUwB6mXn4p64c4tiWiqFg6gQ7UFkLDs3pQy lI8nChxK7jMEsgx2GVhA6kouw9plt3q8GVsqU2JaRzm2OcvbXoGE5FoxPlpvatnIvabX W1AvFtPWb+tWnYFph6StJxWzS3Lep2zbLPKLSgRpOTxQhLtVMNwV5wQP3vLUQ6yI/maX MGZV3Mb+ITtdN7dB9i3yBeoUgeMKzpdap+FQaG8ixBVPBMl67J5IfIGmQas6WB2aGUKF XKrXCjbJHnWpxN9ycHaL+HxFrE8cOTyOkcJEmSCtrOlE5hdHMvs3glogNsPUP2H1b9o6 B3Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Y3lKKUJF8DYuQZiIe9FwJeWW5oEL/3qeoorv+p43kDg=; b=vic4TEZfh1eeV7pNySCpYxDHn1fD78/HgxFlLeJjmR8c4DKK8Ur5avkyuyf7IXHYxH bUsXR8Wgphau1U4I6UFLtNOmNu6jsRJ4YGOxDEPhBjkyepg5fSTcfv9mmJ2J6Ua3RIC5 g+OgDug9AOcJ6B/HPBCk+/kO2gIlfqcUNy7hxoGx0PUf6CGIFihsqdidscN5rlkKoQrB nQ4jBAk5qL+SnENTpAPSKHoquZs91dtiUPw9PxL/q+hz/SlB5YCbJasp01DFSjKh0+GB +Fn1n22J4uYqpuo+XuCN9+Ve0zIRSbiQCGU/mwFYn30bahObipIRh2fI4af8kPr4wlkJ 9uRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Zc6Jkkr1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b5-20020a170902e94500b00174ab1a7deasi32856610pll.316.2022.10.24.06.06.31; Mon, 24 Oct 2022 06:06: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=Zc6Jkkr1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235336AbiJXNGB (ORCPT + 99 others); Mon, 24 Oct 2022 09:06:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235192AbiJXNDS (ORCPT ); Mon, 24 Oct 2022 09:03: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 3A22842D48; Mon, 24 Oct 2022 05:20: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 B3182B815DF; Mon, 24 Oct 2022 12:14:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14E85C433C1; Mon, 24 Oct 2022 12:14:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613695; bh=/IDR0zTm2lJPM0MK7UW3XnXItapXnLnqvTqAjER0wR0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zc6Jkkr1uDcT3rD+29DtrQMDh5IiJpRf7EeP2/oTmpjUq14cEJLPBkYc/qJV7IlQx bz9Npyup3aP5Nr/WiFoEaEPrJPC59eIM8i7qemdU833GLpvAYuRTBRngWA8crn2fAA yCWR3irbOEI2kAjVKSS8CBHw5eMTMe2YEmr739NU= 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.4 235/255] bcache: fix set_at_max_writeback_rate() for multiple attached devices Date: Mon, 24 Oct 2022 13:32:25 +0200 Message-Id: <20221024113011.010431941@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574387095967466?= X-GMAIL-MSGID: =?utf-8?q?1747574387095967466?= 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 0b02210ab435..5767ff6c13e3 100644 --- a/drivers/md/bcache/writeback.c +++ b/drivers/md/bcache/writeback.c @@ -119,27 +119,61 @@ 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) { /* 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) @@ -153,13 +187,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 Mon Oct 24 11:32:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8981 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp438778wru; Mon, 24 Oct 2022 06:01:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7cHurPC2KCajmAzbFonSes35yk65P6woQQZBAQR05qyiDz9e21i0gfEVn8TM0yAanJxU4Q X-Received: by 2002:a05:6a00:22cc:b0:56b:f793:5ab2 with SMTP id f12-20020a056a0022cc00b0056bf7935ab2mr2065521pfj.3.1666616507007; Mon, 24 Oct 2022 06:01:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616507; cv=none; d=google.com; s=arc-20160816; b=Cntv2xFV6JyKdppvHb+IDBH3AhjDvlBEwQy2PPJ5wq4zYlUeZiYKUKwrT+w2lrTkr/ z2zyDZGjlVKLqObWaNfKgOG1LEkgk2zNI1fFvzZ4u2MitJCiOuQUaFp3P7qLut3igCCP Y0vQFlKMpVHSPJn3E+nJDVEUVkcOW0fi29O/9Ve0pTVH5PMDmVKGrKFDvtscnpp/BlHz IlqbKtAJUtDw2uRyxBPda0yEw8VGPy7IwxyTIYoA8KhJulY/iJ2m9GVjbLU57vUjEMuN yJEKVqG++y1ycK8nBa9eCnpnrTnzUBuyHyM/oagmfWsvW/GEkdpPE7Gx5AilBm12CxsN iERg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=N05PvQMjuoVbsExiZQ40AyYykK1VzBL877YRDSBUIsGnWVXiRaK4sxwCy9zI/cLioC A6uJXSGnNt26w15tyRoO96YZY6E5Df8/epxjxyyaeM9FlUy9fxvhHTqclvEzds2mqhO5 tG4F+Asx2zE193pvlfiHBeevSy05UK5TcRsaYISXhTsafmyIFCTueygNS4+R1QRSuHGl pj9epjB+bez1doIqgpoJ+OfBvWKyoXDwciGff/cdYu/QIvV1HoH5QULDmLMOXHG+htow QX9anz6A64wQ3uZFl5T5roJG70zTGxBhPFPLytSBrGzJw2AV3Dn7TswCPDTh9kiF7UAf JVWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dbA2uNCQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i3-20020a6551c3000000b0046b2ea05986si31579049pgq.63.2022.10.24.06.01.16; Mon, 24 Oct 2022 06:01: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=dbA2uNCQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234899AbiJXNAj (ORCPT + 99 others); Mon, 24 Oct 2022 09:00:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234900AbiJXM6f (ORCPT ); Mon, 24 Oct 2022 08:58: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 AB7CE80F42; Mon, 24 Oct 2022 05:17: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 8FE1A61313; Mon, 24 Oct 2022 12:14:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A26B3C433D6; Mon, 24 Oct 2022 12:14:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613698; bh=D8ozL383GaaeAGtKQvIA9IdpVRSMEvGm6dPoBfIkAio=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dbA2uNCQnV4h5HCOXnGkYLN/8Qb2xwnK99Pz6bY0LrLT31slTajDaLOOKic7kUjku bXDOiVY/PMxtlvnGpx1zpNV0fngK8kNB8xXBPkve+35FO2905MkNS40uOgM7W+ZqRr ND/XZHwhbUB2ksA29AoctX8I/KKNPdcDJ73siquo= 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.4 236/255] HID: roccat: Fix use-after-free in roccat_read() Date: Mon, 24 Oct 2022 13:32:26 +0200 Message-Id: <20221024113011.053440968@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574070402823294?= X-GMAIL-MSGID: =?utf-8?q?1747574070402823294?= 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 Mon Oct 24 11:32:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9048 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp442530wru; Mon, 24 Oct 2022 06:07:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4REFoEt94MAFlnHlOMlUAF42zXqA9Bb0bT9eSX1Nh7lUAWgCRYAGfeGSrxspbV9zeL9ZzI X-Received: by 2002:a17:90b:384a:b0:213:2907:a528 with SMTP id nl10-20020a17090b384a00b002132907a528mr1796309pjb.183.1666616859989; Mon, 24 Oct 2022 06:07:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616859; cv=none; d=google.com; s=arc-20160816; b=FS/EDF8O5QfAu3jsH7q5B7kibxsq+lgAyGVJuW4HmxZjv50XDo9BRjxwF6varo5KoO EFxbzQz2ijOUE8RA/28AvpnbbzOEg3gDkudX5e354EeRxlRQkHmpgnSJQzkOJ86SQ35Y zGnwgIkcQrFXQnA5qI4Et6IBCrgCgECu9KeuqB6de6Uz1UVBPWNv/NgDbPo+YetjdEJV gRawWLJ7XUTh/iMbhQn8vMyhzeSVstytlAkVOFrfvB6mrah/tTkxikVxieFiDKGrMbI5 1XV50ju2mZOGZynHDrXkUZvfULrhCnxuEILHWWqUYwJYdmXulG9f3r27bWVuRkHTn/zn sCog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=diX0t5R38edeHqGCs69Wbs9bT5+TgfTZV/TR0U8v6H8=; b=knEPWNMNRlmBxLrpMrk7bnasYADn72Se98Ou1LfE0qSeAuT202LK6eGTtyqoUdTBut jYwFcNw/vv5eoauQwFrF4gEF8y0E0UmPeRVqgh6+IZ4RTBFkeDjNCtv4gjdZXtzfrssE 4Zfmo7WQXhx/cN0vX4BPWDsnPSkjQ1ewMHcCzXVdsLsoZTQ97i1MxCfio5bW/s8+acSJ EQOk3g1kJerH67v47FWo/Ri5kroCEtwar0iY+oGBMQ5+PwaVNl+M1PYz3zizj66HJCrF 4kFUc04ijGcolnI7bpXhTIyvQMF8iNvWfR/xc1lpjKATQklTdbMvMzFwnDWHEt0AggHa JqMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1phj9hJI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ob2-20020a17090b390200b002131cee8cd2si2447918pjb.10.2022.10.24.06.07.18; Mon, 24 Oct 2022 06:07: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=1phj9hJI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235430AbiJXNGb (ORCPT + 99 others); Mon, 24 Oct 2022 09:06:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235389AbiJXNEl (ORCPT ); Mon, 24 Oct 2022 09:04: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 DBDE11CFD9; Mon, 24 Oct 2022 05:20: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 D800FB8161D; Mon, 24 Oct 2022 12:15:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F695C433C1; Mon, 24 Oct 2022 12:15:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613700; bh=U958TgnGMhTSJyzTd+nT/a15uKAEVhCFe4sNhWqOEqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1phj9hJI0c4yMoKNV7lA3qzJmZJQl3hKk6MplpgePFG6FaIQSJB4X6KPUY2ePCQqV hiox2cv1AFuErOE0rIPdLA8grrvc6wcMh2UorF1jQoarm0xRxthg/pNbl2K7DHlCoW QSkf+Kr8SirOWnie+5Vm3pUWHRZ7UFtcVhXtCXKM= 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.4 237/255] md/raid5: Wait for MD_SB_CHANGE_PENDING in raid5d Date: Mon, 24 Oct 2022 13:32:27 +0200 Message-Id: <20221024113011.091858069@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574440406386479?= X-GMAIL-MSGID: =?utf-8?q?1747574440406386479?= 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 a7753e859ea9..d0c3f49c8c16 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -36,6 +36,7 @@ */ #include +#include #include #include #include @@ -6334,7 +6335,18 @@ static void raid5d(struct md_thread *thread) spin_unlock_irq(&conf->device_lock); md_check_recovery(mddev); spin_lock_irq(&conf->device_lock); + + /* + * Waiting on MD_SB_CHANGE_PENDING below may deadlock + * seeing md_check_recovery() is needed to clear + * the flag when using mdmon. + */ + continue; } + + wait_event_lock_irq(mddev->sb_wait, + !test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags), + conf->device_lock); } pr_debug("%d stripes handled\n", handled); From patchwork Mon Oct 24 11:32: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: 9140 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457507wru; Mon, 24 Oct 2022 06:36:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7YCBwK20xKzBGgnRU2MYCTg2b6v9EcZySEoS/Eo0AoSQkYxc/nEqLkPwObDIxBHX/nDHQS X-Received: by 2002:a17:907:320b:b0:780:280:7b72 with SMTP id xg11-20020a170907320b00b0078002807b72mr28624822ejb.146.1666618567745; Mon, 24 Oct 2022 06:36:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618567; cv=none; d=google.com; s=arc-20160816; b=vScRlIke1Q0J9a+Iz4h50Y5u5KZVvSb2oNXNbzhmWdKpvdUrZHYb3ZckaN53n0Cvm3 cIHWlXoTmgeHyZeUCc8riebR50vb9O8PWsNLtgrNrY9W9SKbA20KH2YAUGwh+jSZRY6o sm+vDDR1C7mhxq55d3BavTII17lRFpmxla6459TZ7ErD2CL00685BTDChcXiYVV+25bl dXHuY61lFPmpP/v5vsWhT23UQ3MsjoYtjYWspbqJ56j+YPtq7/0JxP+aqCp8OY+mcBbD 6IoI9A5585x+srx81SwdcMYDUao6Cv2sCKCeOptQ3KEfq8A5YUf3QLPTxCrgIhBiLIIf zoAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+N+0qTYKnkYrxYc/Z4kqH7nNe//IlOfhOFTYwumv7vY=; b=dsbE8s32no4y2HC8K0EUrDkdkKke2hYcwTA9P08R270bewPK2XtU86fbBzYEceFtGD 7DyCQIkihD/Ej/UNNOQMDA+QJxCYF4vCwlNm/ha1dwi6x6kDPhf8EQhOoPP+5v6UAtma eMUJrPoM8IAVqyzgqWowCdFJFAyE0ymFK5sdGSiQN5msdh2fzsmY/1NlzPnuhYSVfZ5O B/cGQBtvpBzJCJB37QBLKLi79tKqO8/wMSqUh7IaOCBfeMhpx0+9B5XhkLp+3Y+HNMS/ xxUe9mhSJtIwei86zNMOu/jxlR4N+bWCFBnm95VSPfv5HyrgTy0BLJHDo5MOI5+NqNsT pF/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=L0eFR6gg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i10-20020a1709064fca00b0078261e73261si33314328ejw.567.2022.10.24.06.35.27; Mon, 24 Oct 2022 06:36:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=L0eFR6gg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231916AbiJXNV4 (ORCPT + 99 others); Mon, 24 Oct 2022 09:21:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236461AbiJXNUb (ORCPT ); Mon, 24 Oct 2022 09:20:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6C6B87092; Mon, 24 Oct 2022 05: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 dfw.source.kernel.org (Postfix) with ESMTPS id A68C4612FF; Mon, 24 Oct 2022 12:15:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3F94C433C1; Mon, 24 Oct 2022 12:15:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613703; bh=d7cJU7spTHf6ztf1HVsTpE8ruxo7YQj2hlsGHeF61lc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L0eFR6ggWZL+NVYkI+cKtBU13Je3K3dut6Oul3is1Nmb3SOfXcbV+mYxUU62Z/UPU oMWda3iaPF/tBOe4xkpczPjAdg1EZOnfftmr+fE3PJyMcUVOnOWZ7powlmr+iRzjH2 EI3v5glZlBR22PX2+qJHFcTJChr2A6/BvzJ9hS0o= 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.4 238/255] usb: host: xhci: Fix potential memory leak in xhci_alloc_stream_info() Date: Mon, 24 Oct 2022 13:32:28 +0200 Message-Id: <20221024113011.121916223@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576231396286961?= X-GMAIL-MSGID: =?utf-8?q?1747576231396286961?= 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 ef23a69c6553..6125a98ffbf5 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -650,7 +650,7 @@ struct xhci_stream_info *xhci_alloc_stream_info(struct xhci_hcd *xhci, num_stream_ctxs, &stream_info->ctx_array_dma, mem_flags); if (!stream_info->stream_ctx_array) - goto cleanup_ctx; + goto cleanup_ring_array; memset(stream_info->stream_ctx_array, 0, sizeof(struct xhci_stream_ctx)*num_stream_ctxs); @@ -711,6 +711,11 @@ struct xhci_stream_info *xhci_alloc_stream_info(struct xhci_hcd *xhci, } xhci_free_command(xhci, stream_info->free_streams_command); cleanup_ctx: + xhci_free_stream_ctx(xhci, + stream_info->num_stream_ctxs, + stream_info->stream_ctx_array, + stream_info->ctx_array_dma); +cleanup_ring_array: kfree(stream_info->stream_rings); cleanup_info: kfree(stream_info); From patchwork Mon Oct 24 11:32: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: 9054 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp443071wru; Mon, 24 Oct 2022 06:08:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6hy2iLx3tUrIBthL12BojhYieIlpDdCkdseGyYUCpneWUr4SVZ2c907ebuKmscNyc4zcgQ X-Received: by 2002:a17:902:f28b:b0:186:b069:63fc with SMTP id k11-20020a170902f28b00b00186b06963fcmr3083681plc.38.1666616924167; Mon, 24 Oct 2022 06:08:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616924; cv=none; d=google.com; s=arc-20160816; b=O7onlaaQjimrEtVqPNWvGr0DHc0Qdt8AOTpSzMnt27a/ld3nD+L0cTiWlOosT3/PwX 2b8M2Xp5xyEe9nx3gatrAbQmhJkT727UU8j/L83zMnhFOVxRww/yyxy0qFF1U1EWuYDq A417ljwurmC1jRf3VtvOIKBrF18cUGWGRiTHll/I61quM0GGD9Hmw/byQmDoBSJweHKM fiW0y3e50v5BIFTdPTHB/xkiGH+MmcO+hLHxSHu4Mq9+bC38Cn/eVXWia3ginPsXOO67 9RcRcWQch7nHfVlOrmsLRbYOLYh03MPs7h3JESbGw5y5N//1IcAYbZysLB0DUw3G0JNd 35Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WuxO5I/Q0IGJ5mS5tvLxOPcVP0ypG8rnZIY664CTwhY=; b=jijqDHg8N3J5fs0sn+F9hYGAHbBUwAfq1sQwLtj29bE+36BSp/W0tKGO719F5v1SgO iEmRy4HrjwS2FE03KZNJT38XHGkPT55lEeJE+pfErSpEdlzc8A6HRYdHMUTjn0SDoJl/ WjKzS8U7X7iOz/5vYPeB6ENiiTnfpXDyYDoxEEIpGFtl7xLX09dT1mXxYWVcdYmbeP3Q kWqnSXwGHvOGGWgq+ghuHJ3B2/ov0cTF+SOb0DocY2wpVrGY85Z6AU/+63SzbfSnzvnw nVCVFGtWpbXOTwG/0eBB45Q4JYVg7YXpHyQ3uM9eCYaHmVMQJqZ7URmACocP0n8Kpy/K 6Zig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bjNoZrnB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a621d13000000b0056ba7a9182asi5975176pfd.250.2022.10.24.06.08.25; Mon, 24 Oct 2022 06: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=bjNoZrnB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235464AbiJXNHB (ORCPT + 99 others); Mon, 24 Oct 2022 09:07:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234960AbiJXNE5 (ORCPT ); Mon, 24 Oct 2022 09:04: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 5FECA27FDB; Mon, 24 Oct 2022 05:20: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 926A9B81619; Mon, 24 Oct 2022 12:15:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4EF6C433C1; Mon, 24 Oct 2022 12:15:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613708; bh=HvREvjpTGd2nnADgQQw/gRZ+w1eD5zoouABPrVUj1hQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bjNoZrnBXCJghhlkddr9a4hAszZTF4uEXqAbOptsjhMBzi8P9DMF6tpda0W86RDb5 D1t9JMQRERyoxUqYegMqe84oT3vas/wBiomPwuJmrlbic9PKZEcJOPu881gxn8GKMw IyVdnlbthFlyYogKcHoymeq2jYZGN9LFrBQr9HBA= 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.4 239/255] usb: musb: Fix musb_gadget.c rxstate overflow bug Date: Mon, 24 Oct 2022 13:32:29 +0200 Message-Id: <20221024113011.161452156@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574507504463282?= X-GMAIL-MSGID: =?utf-8?q?1747574507504463282?= From: Robin Guo [ Upstream commit eea4c860c3b366369eff0489d94ee4f0571d467d ] The usb function device call musb_gadget_queue() adds the passed request to musb_ep::req_list,If the (request->length > musb_ep->packet_sz) and (is_buffer_mapped(req) return false),the rxstate() will copy all data in fifo to request->buf which may cause request->buf out of bounds. Fix it by add the length check : fifocnt = min_t(unsigned, request->length - request->actual, fifocnt); Signed-off-by: Robin Guo Link: https://lore.kernel.org/r/20220906102119.1b071d07a8391ff115e6d1ef@inspur.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/musb/musb_gadget.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 4622400ba4dd..8e83995fc3bd 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -760,6 +760,9 @@ static void rxstate(struct musb *musb, struct musb_request *req) musb_writew(epio, MUSB_RXCSR, csr); buffer_aint_mapped: + fifo_count = min_t(unsigned int, + request->length - request->actual, + (unsigned int)fifo_count); musb_read_fifo(musb_ep->hw_ep, fifo_count, (u8 *) (request->buf + request->actual)); request->actual += fifo_count; From patchwork Mon Oct 24 11:32: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: 8990 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp439475wru; Mon, 24 Oct 2022 06:02:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6HtsykaNDbc5jbRfcq9wZVnoJ/9R8ukEEOl9V7Q0+Chb/SZGbEvkiAxGjezwv5JYhhyzEl X-Received: by 2002:a17:902:7297:b0:17f:93b5:5ecc with SMTP id d23-20020a170902729700b0017f93b55eccmr32963745pll.93.1666616557710; Mon, 24 Oct 2022 06:02:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616557; cv=none; d=google.com; s=arc-20160816; b=kmINSglSJF0Pwf2DBC+sf/p/w4wRMdGylFVVLV99zAevqBSc8YbZvtEeviQQR34ycB mVUYXhd96L3fRQgbcEfAhssefPpSHeUYfm+USQfyvkN46Knj9fmLaepeJsKU7chhr9ea OEEACKI/vS4nZ1SNqCp2skLYwhggxIzL3G7MIFwdJ6hFvCSHbwsXvmBagkMLcRaiiSdU QaxmhPfAXLqyQ/RCXVG1bqb7zsAbiIwlADdQleUyJvCV7uWl1WuT6Sn7reeNHR6SXb6m 2rNtchHm7Di2znNFBUqQvXulv8Wt6u8sh47n2zHg0kDhsau85fApu02LAMH0xZVhUSL9 MN8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9SEQQBejgvCYb4i4gdFNtD1eAU+v00ORZRu1N0jub68=; b=nuVaUy8dE+qDnbos4ekWzVZ7G5fRkeIdkybKzexnX1cvYcYZE6fUjn+9m+HlWLwsAO eKGIT57UjCDWYK84peBFOitR7beNJIf7gEYuTlsLI8fszPgwd2/mzplL+ZMosvrqtshH fE3q+axXSttLzluL2Jpxltk6luNZZ9jMe8Dmr0YIm/DBmyr57C/F6MGY7O1lioXyGGeG bLmfcJKbGFK31jsfSLPOdxZbm6WtpTKqR3UnZckjilkzpS9RZGRdgqXvMJJ12h80MwXi iwdUzvi/90rN8nvcVVmBVlg/ID3o/NuNdtgjeKE3JvSrf559uamRromBnOVxlK6D3FQI Wu2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bnuNQ0Ih; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a1709029a8300b0017a0a2e40e6si5825575plp.159.2022.10.24.06.01.52; Mon, 24 Oct 2022 06:02: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=bnuNQ0Ih; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235067AbiJXNBP (ORCPT + 99 others); Mon, 24 Oct 2022 09:01:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234980AbiJXM7E (ORCPT ); Mon, 24 Oct 2022 08:59: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 04AB398C98; Mon, 24 Oct 2022 05:17: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 7ADFF61321; Mon, 24 Oct 2022 12:15:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C030C433C1; Mon, 24 Oct 2022 12:15:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613710; bh=9nmIX1CbbtzBfzsDqPxMj8VYIeUwmfAAsFdjW+FQUjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bnuNQ0Ihl36eNDc3FRqlzFVVntDZE3Bx/+j2CSYexMG7uq0ax6qZUH1XkC6AkFoKF OX3RLnbDt4X6Vsfw0Xh8B/X7TNokLQh1qc8M9W04VpY4AexsUopLAo2dnrfopCgd1o snm/rY950KpbCSOtJAxL88urFqsaVxlExesxMboc= 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.4 240/255] Revert "usb: storage: Add quirk for Samsung Fit flash" Date: Mon, 24 Oct 2022 13:32:30 +0200 Message-Id: <20221024113011.208750500@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574123520193062?= X-GMAIL-MSGID: =?utf-8?q?1747574123520193062?= From: sunghwan jung [ Upstream commit ad5dbfc123e6ffbbde194e2a4603323e09f741ee ] This reverts commit 86d92f5465958752481269348d474414dccb1552, which fix the timeout issue for "Samsung Fit Flash". But the commit affects not only "Samsung Fit Flash" but also other usb storages that use the same controller and causes severe performance regression. # hdparm -t /dev/sda (without the quirk) Timing buffered disk reads: 622 MB in 3.01 seconds = 206.66 MB/sec # hdparm -t /dev/sda (with the quirk) Timing buffered disk reads: 220 MB in 3.00 seconds = 73.32 MB/sec The commit author mentioned that "Issue was reproduced after device has bad block", so this quirk should be applied when we have the timeout issue with a device that has bad blocks. We revert the commit so that we apply this quirk by adding kernel paramters using a bootloader or other ways when we really need it, without the performance regression with devices that don't have the issue. Signed-off-by: sunghwan jung Link: https://lore.kernel.org/r/20220913114913.3073-1-onenowy@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/storage/unusual_devs.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 6a59950a63a0..b270be141b8e 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h @@ -1275,12 +1275,6 @@ UNUSUAL_DEV( 0x090a, 0x1200, 0x0000, 0x9999, USB_SC_RBC, USB_PR_BULK, NULL, 0 ), -UNUSUAL_DEV(0x090c, 0x1000, 0x1100, 0x1100, - "Samsung", - "Flash Drive FIT", - USB_SC_DEVICE, USB_PR_DEVICE, NULL, - US_FL_MAX_SECTORS_64), - /* aeb */ UNUSUAL_DEV( 0x090c, 0x1132, 0x0000, 0xffff, "Feiya", From patchwork Mon Oct 24 11:32: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: 9032 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441857wru; Mon, 24 Oct 2022 06:06:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7wayXB5UX9td5/XG3El3e1Rqvhl3/BRGiQCH6J+P5zB4L1rGh0jWXlqXjuFjhpO7xpkSak X-Received: by 2002:a65:44c1:0:b0:428:ab8f:62dd with SMTP id g1-20020a6544c1000000b00428ab8f62ddmr28281093pgs.211.1666616790884; Mon, 24 Oct 2022 06:06:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616790; cv=none; d=google.com; s=arc-20160816; b=Fo8NmnaAoS0XNfcN8DHUAJa+maz2K5UldmFiVZR0P3agWTdGIlH8s7HCHE/8+N3J6N i8j59C3SjxkQt0QrQXSWBgnubyqYqT5z8IoVX1uUhRbC2PjFJoWbKS953OE4MgLenTIe s72YIeowsPv4liYpnc37eB0OMSNsN3KnC16OTDqwNZyK9oYySU8g2oO3GVt+lvYpT4jx ePBehprFcOV6CcepLdXAeqjNyOrd6iE9KJMmwRAlGUMfvTenHr4KQRYdZjAOm4EwPeKk q9SIQZFGAPlukwF/tbTryVHUjspF/uwbU5Hbu/4RkhSLX+vzi3rLkuCeJu4QtIhajNxe CWlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8ixqPW9EUk5BAAOtyPHG+sfrscueF7CAqOROxLnjjuI=; b=vQM0S8xkHqpVY02Kts+4RqNEYCHeV3U/hzvhDwdthnVvKvWfEr9SqmM+F8NNplB/+s JEds0CrBrKiwQzR2aT8jm9iyv33TKA4UtdCO/ZY20w9mIdoWO/Q52UxRzL5XrWx3mkKC pKJiN30Jo4S26wtt6rLx0o4W+4Qw5xWeJ3GjnlTpTDKQt9U56KtqaxWQvqbynzbJfk11 ZnQ4GEBIir+OPT8SauV7ladyoz9EDY9Qv7zvBzvLmdiYVyZ3JFH/5THBA+6D7lemy5Rk qXZOgor+vobJ3e8zUrJPHXRjD7mAb0bkPGOxzfGnwcWhuDN8jt4Nh00B1N/hQSiT/RV7 zvhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Xdil3OZE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d10-20020a170902ceca00b00186b766d4a0si858967plg.325.2022.10.24.06.06.12; Mon, 24 Oct 2022 06:06: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=Xdil3OZE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235319AbiJXNFe (ORCPT + 99 others); Mon, 24 Oct 2022 09:05:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235039AbiJXNCo (ORCPT ); Mon, 24 Oct 2022 09:02: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 04F34402D0; Mon, 24 Oct 2022 05:20: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 16F456121A; Mon, 24 Oct 2022 12:15:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28E8BC433D6; Mon, 24 Oct 2022 12:15:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613713; bh=J5oKMssIsjmrgJfuo2UOL4CSllU/7RRHIsy23aCN6dg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xdil3OZEiK12nJUFWcFmiKF5Z0PR0Iqnqx+cbkwmxKdWE0+J1LIRCATSHq393HtGB hJJZi8AHKjuLFle0qujFGaNi2OcOHPV2wkghT9SxQnsLtKdzdloC8ZWJXew5n0dCBv X4rJ9jVnL6kIa3f48X1/1mqWC+n7SqvBBRzZ4og4= 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.4 241/255] staging: rtl8723bs: fix a potential memory leak in rtw_init_cmd_priv() Date: Mon, 24 Oct 2022 13:32:31 +0200 Message-Id: <20221024113011.243886897@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574367747173924?= X-GMAIL-MSGID: =?utf-8?q?1747574367747173924?= 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 8d93c2f26890..a82114de21a7 100644 --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c @@ -165,8 +165,6 @@ No irqsave is necessary. int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) { - int res = 0; - init_completion(&pcmdpriv->cmd_queue_comp); init_completion(&pcmdpriv->terminate_cmdthread_comp); @@ -178,18 +176,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); @@ -197,8 +193,8 @@ int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) pcmdpriv->cmd_issued_cnt = pcmdpriv->cmd_done_cnt = pcmdpriv->rsp_cnt = 0; mutex_init(&pcmdpriv->sctx_mutex); -exit: - return res; + + return 0; } static void c2h_wk_callback(_workitem *work); From patchwork Mon Oct 24 11:32: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: 9053 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp443070wru; Mon, 24 Oct 2022 06:08:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7rpjmhhPZ7HjimS55pAJ//b61T9HDvNa0bNZSmRqUAcNQYv020VngvAGne8E83PG4uxnyE X-Received: by 2002:a17:90b:1d0e:b0:20d:a61f:84b1 with SMTP id on14-20020a17090b1d0e00b0020da61f84b1mr65365637pjb.172.1666616924143; Mon, 24 Oct 2022 06:08:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616924; cv=none; d=google.com; s=arc-20160816; b=0CTSNu0Qutdg73C6HW2PZ/vzmN1dWPdRX/KA821nMOXZ+JEEOh6+QubKvmmSNta5yZ sFXwnSJEoVsKugNDMqXju5nglaZw/Lwvq+ZuQNzX8PBKKP4Wl8DneXEMgT9taHF1I7+A qphiyBp3jqljidpGQbE6zfNHQjOroNMJa4lDu85ysEtLGyxiOZotwqrBpQ1RbAfOXN6x ow2bnTpDbU0Fm40waP9ILzk63dp2Ucnb1I/3hIgrkJ+rYp4dvocOszGFNLQKic3URsNx 6uAaSpKxUVWsrm1pfEBbkhsWfDwgpBrI4yI+McwWlyyt9h7oK0XaZLnldbE/3VqDNIfG nL6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=g68N+8WEOflW10ZQeX8CKTsTZZiLJOjQ1Rr2ylmkeEM=; b=HM+0KWsK4ZxGM3xDr/wk7w0d5LriXFeZFV7MdToiHSQ8hXSm01P5OpDrfPHrjaagAn Tx+6rT/VC0HjZVJT9RQ48Md/sftEzvlQD1ozJVNkQUOkXE7INVYB65B7jqM45QZ211j8 7ePF7SCeIxr+A5EyxzyjsDF5wEXhPRm50O+f3hLNZK5Jas8FNq0acSJIgLAt67mAoH4K I6pYEmbqN7BUZzXglOcklsIvLqF6rUf1oXp5vaz5oTMIiuhFvsFNLVtod2ibuV6JWgKq iiXlIuy5UCLtsq2qkh8Whnb7sV645o8WorG5lO5SzS32VtiXkV331KHekylbwg7l7xvi 9eCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZnI8Rdn6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rj1-20020a17090b3e8100b00200e221e9a0si10263449pjb.149.2022.10.24.06.08.27; Mon, 24 Oct 2022 06: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=ZnI8Rdn6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235213AbiJXNHQ (ORCPT + 99 others); Mon, 24 Oct 2022 09:07:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235219AbiJXNFN (ORCPT ); Mon, 24 Oct 2022 09: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 E2ABB9AFFC; Mon, 24 Oct 2022 05:20: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 72947B81622; Mon, 24 Oct 2022 12:15:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C18E0C433D6; Mon, 24 Oct 2022 12:15:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613716; bh=HWJFCQPIjhn238FA1JB7Bz47RZsjflnrkViylqrq2ZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZnI8Rdn6eMKAFOVprNLZ5pyKoIm6P/ypLqvzG5EPUxqrmVSvmitNW0nz7/z5+xW0c wrGNEV9zC8Jmn+1nJ55OlzHbrgIdR/YHMujasq4ZzTv3nvwubSsqoTU2YEhJ4iDbGl 33G0zo5/PCQMWLxB9IDxuZ0nobh9/l9cCdM7YvXY= 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.4 242/255] nvme: copy firmware_rev on each init Date: Mon, 24 Oct 2022 13:32:32 +0200 Message-Id: <20221024113011.284523202@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574507738494482?= X-GMAIL-MSGID: =?utf-8?q?1747574507738494482?= 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 f1717f34b2f3..6627fb531f33 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2671,7 +2671,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; subsys->awupf = le16_to_cpu(id->awupf); @@ -2824,6 +2823,8 @@ int nvme_init_identify(struct nvme_ctrl *ctrl) ctrl->quirks |= core_quirks[i].quirks; } } + memcpy(ctrl->subsys->firmware_rev, id->fr, + sizeof(ctrl->subsys->firmware_rev)); if (force_apst && (ctrl->quirks & NVME_QUIRK_NO_DEEPEST_PS)) { dev_warn(ctrl->device, "forcibly allowing all power states due to nvme_core.force_apst -- use at your own risk\n"); From patchwork Mon Oct 24 11:32: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: 9083 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp445616wru; Mon, 24 Oct 2022 06:12:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5tD6R1ldoz5oStDO41QEZJtjoWZG7F0IUniWiRPAgkEzQAeIOZrPkg6cvMVdzvoJaPN2zz X-Received: by 2002:a17:903:283:b0:186:897e:71ea with SMTP id j3-20020a170903028300b00186897e71eamr12357451plr.123.1666617172878; Mon, 24 Oct 2022 06:12:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617172; cv=none; d=google.com; s=arc-20160816; b=vATVfCjxJuME4EyFwwE85r0uCfR/1YFpyoB9FdkdhzU0V95lYSIQLaVYMXZQNkjuwq i6cey7D04y91pm/BnykJXcFLD/0MVQIu8o4+2N0VZHURjtt5hsTdry4DvvmGMzb9/rxR qFS/mjNfVrNOZTbYByGpS9Tk6ysy+VqLj2vK3R6+RKhXM8h7PNQQvgrMCVyBJloOqT9w gmlRi7+pMHok4jCJ5Bj7pQu0QMXYUUsnACIj10LbDCgbdLaCNDIMWxYum0W4A36YV6xv MensAq9h4TxPEu53wWQEx5bkmCEQSry/5W26luegbbhssSmtgCRR6y5gatF1XuwqfG8+ g6Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7DxRvWtqyC9FvWnrNSveKfbAvdAYOxjGUjBJR53R608=; b=ScMMs5f5KWtj1gEKQ5GLGg7QTG6mdetW8rzKN8ERTDdKLCrVgWIogMVr8+XuVEgJRG OhW8iyXtAEOnUFKvkaGBmG6yECEbzkTFKY2U8nUHzPZ3nTzhAFDp3YtDS4qyuUYKwlah g338XcmPDWiRiPSIVsPPEqP9znU68al6wD3yIi1nTnAz3Ib6hgmusjn4daWbkyZ2vekl 78+jHtCVtQHbz+s+oKtxAwDbz1DtBy1AvDdMeZvu9YNfKvMexIkoRkh0IMkyAPnA6Id2 9yKOQ75HYSJoRdaJNRSLu27IwrSNRE7mNSTLzEYcupsfTOZz1YTsR/6Wdd+OFKyzHCmA Vviw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t3NEMBF5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902e84800b0017f863024acsi38949856plg.235.2022.10.24.06.12.37; Mon, 24 Oct 2022 06:12: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=t3NEMBF5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235689AbiJXNMS (ORCPT + 99 others); Mon, 24 Oct 2022 09:12:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235919AbiJXNKL (ORCPT ); Mon, 24 Oct 2022 09:10:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BB02A47B; Mon, 24 Oct 2022 05:23: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 09187B8161F; Mon, 24 Oct 2022 12:15:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63EEBC433D6; Mon, 24 Oct 2022 12:15:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613718; bh=j+67didnIPF+xzyve6MvUXmjz4nmKeBUiydpiwCnhUs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t3NEMBF57gAnl8lTkIIuLnagX7B+NrVvvzb6f/Jtn50jpCVRsu6KsYCxSFCcBSlZE TOEJPRMR6X458sRJwr2az39/r/YLePwraEdizw51kUoQQHRgh1hti1VryqsSdTSBMc 1/qUVRYcmK6/BCXkLKa1q7392Wyg0++/Urt25BnM= 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.4 243/255] nvmet-tcp: add bounds check on Transfer Tag Date: Mon, 24 Oct 2022 13:32:33 +0200 Message-Id: <20221024113011.330767504@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574768462731520?= X-GMAIL-MSGID: =?utf-8?q?1747574768462731520?= 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 eb5b39c2bba8..df7a911d303f 100644 --- a/drivers/nvme/target/tcp.c +++ b/drivers/nvme/target/tcp.c @@ -858,10 +858,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 Mon Oct 24 11:32: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: 8978 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp438363wru; Mon, 24 Oct 2022 06:01:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ZTdWCtI4YgYYz4JB7zFCG4cTAZH0yjiL5XnVEy866x9ipRlUoXvxIl9Z1lHbdhVPztO/n X-Received: by 2002:a05:6e02:1c29:b0:2ff:9ca1:a8f with SMTP id m9-20020a056e021c2900b002ff9ca10a8fmr7795828ilh.47.1666616475056; Mon, 24 Oct 2022 06:01:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616475; cv=none; d=google.com; s=arc-20160816; b=t/AgsAQoNLmep2PUHe/CTD0/V82evMy0mFeZccHzzyO93btTQh8rmfXzet1TFxIcLe nFy0gUKR1QduuQ89GDRBDvXd0f//5o1LtubJKPyW2ICvcOHnXZ2SGBWnfSFSR54O27r0 qSZ3u6yJ46oqfI51WBkIyNbN7P4U1e0iH88UvQwL9HNyXOF+w1Wu+VDKT3noLy1l6RSM GlsDQp+lqKdGsKtubx9Y0tzG7Wnm/md1Pz9p4MV1tB1AOoOEnik+FtZoJo/RSmNOx3T4 GmqpULPAeVUI5XZhUPKCjx+yCw2Lu8P+95onH0wI0pWIF8eC/s2To9+9r3ATHA5OpBq/ VM7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=10suO6Ku1BxCpxh9hBNndXSI7ZETMWQubE9F20GAvrE=; b=QhDGDh0OOaAJGc+HBBJms0QiW2tItl2NXXLn2WcuZFVHf08XvVb3wC3/BXY18mGVu2 TIP+nq9PkLGoM8Wih/KjAAxuSj7AmFpOj58xS3Ir30dqzEDbaNQktauX8xdfqoMDczqZ kUSCHxEJo3d0NNbiL+q1Z93rhLnBdEuGpyvg6fL1qaOB0fPxelmxPPHvJ48xPSy6jIQM 8HqtQnn4x+3pY4YoRkATNa1BMSQ7rUQmOCq27kxoDjeGErURN2CshbMFqjsn5TpqIgzl JiDSC8n7wrmPE286EfjOljnatkn3iUiLmwqqbIlHkN38c43rMom/+LvcARYc/4D+aVv5 Q70g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nZ20VDmg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h38-20020a63f926000000b0046ed15b5318si9257702pgi.98.2022.10.24.06.00.50; Mon, 24 Oct 2022 06:01: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=nZ20VDmg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234886AbiJXNAf (ORCPT + 99 others); Mon, 24 Oct 2022 09:00:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234896AbiJXM6d (ORCPT ); Mon, 24 Oct 2022 08:58: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 7A50B98357; Mon, 24 Oct 2022 05:17: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 EA5E261329; Mon, 24 Oct 2022 12:15:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03D4DC4314A; Mon, 24 Oct 2022 12:15:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613721; bh=9IwWBpBPAy1XPz+qmN4K1594agSedGaY6AGFztpHjGA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nZ20VDmgQlUxxj9jkCxBactClz8KR2e6oztdtkgvDV269uK1+6MRivDrr4/Vu8+m9 B50CUla8NIALk8ahdGJSRrmtUW8/4Cbv3pvuf4bkK5jmma/AAhwvUgWCDzVBVzpp5d KegnoHj1z/yj3NugtTu5KsPkb65mlAJaIGx+/GKs= 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.4 244/255] usb: idmouse: fix an uninit-value in idmouse_open Date: Mon, 24 Oct 2022 13:32:34 +0200 Message-Id: <20221024113011.373443793@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574036915316664?= X-GMAIL-MSGID: =?utf-8?q?1747574036915316664?= From: Dongliang Mu [ Upstream commit bce2b0539933e485d22d6f6f076c0fcd6f185c4c ] In idmouse_create_image, if any ftip_command fails, it will go to the reset label. However, this leads to the data in bulk_in_buffer[HEADER..IMGSIZE] uninitialized. And the check for valid image incurs an uninitialized dereference. Fix this by moving the check before reset label since this check only be valid if the data after bulk_in_buffer[HEADER] has concrete data. Note that this is found by KMSAN, so only kernel compilation is tested. Reported-by: syzbot+79832d33eb89fb3cd092@syzkaller.appspotmail.com Signed-off-by: Dongliang Mu Link: https://lore.kernel.org/r/20220922134847.1101921-1-dzm91@hust.edu.cn Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/misc/idmouse.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c index bb24527f3c70..ba2b6fbab9b8 100644 --- a/drivers/usb/misc/idmouse.c +++ b/drivers/usb/misc/idmouse.c @@ -178,10 +178,6 @@ static int idmouse_create_image(struct usb_idmouse *dev) bytes_read += bulk_read; } - /* reset the device */ -reset: - ftip_command(dev, FTIP_RELEASE, 0, 0); - /* check for valid image */ /* right border should be black (0x00) */ for (bytes_read = sizeof(HEADER)-1 + WIDTH-1; bytes_read < IMGSIZE; bytes_read += WIDTH) @@ -193,6 +189,10 @@ static int idmouse_create_image(struct usb_idmouse *dev) if (dev->bulk_in_buffer[bytes_read] != 0xFF) return -EAGAIN; + /* reset the device */ +reset: + ftip_command(dev, FTIP_RELEASE, 0, 0); + /* should be IMGSIZE == 65040 */ dev_dbg(&dev->interface->dev, "read %d bytes fingerprint data\n", bytes_read); From patchwork Mon Oct 24 11:32:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9056 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp443094wru; Mon, 24 Oct 2022 06:08:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5KnILBFD9hcAatSa9kTkEgjDLk8axGfBpMP14v+/Nx+SuAkz3D52DRcWnbYCOld5gSz9QR X-Received: by 2002:a17:902:e545:b0:184:2f27:b34 with SMTP id n5-20020a170902e54500b001842f270b34mr32974660plf.15.1666616925854; Mon, 24 Oct 2022 06:08:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616925; cv=none; d=google.com; s=arc-20160816; b=s3DMJVojaPCTd1ahoQWKzwBj5JZXormMTxwuwB6fWjpGf6giPD8iyIkO7VzTX0rm/n cITcmJz6AT7kHBtnZHuZcTL21jXIssklDSRZKLPUNqGF1ri3naGErhlkt32Nyy5bSO1d Jm8oXV0xNnPh+NcBrtQ73LW/OkwfW0Ae6nXG6rWhQgDvVCgvbUUpkofonMoKucV03zsd hEImyYdesTObMySi7s8M+wfSvRFRSBWaIB7t/fdmq3bysM18umfeRAOc2am1dgtpPk/4 S66HNTb0mKUAy+7RbIgsBk2vW9aVqA6TweVGRzCkucj2EKXh+YsFkJoFFiLciSUfQENg iaFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9EjKAyiskxHZZVVjfmOTFxCr7KUS4p9EzHhMuCgtJwA=; b=HZzETaPLb/L8o8EFLJ4rHR+dgTdgZSKu+hfDH0WhONhKvJ23gvqOYmJMREByXejAqt BCpYBoHR9MhtZKNaYJgbWM/MjWPrOSC0IRxvueAoOyvDJvkJot9MG6NUHMrUU1AtdFDF YE/Y8WEPl3DZ0IC0m/NPmPSTCah0WSIo0EW32PlqLPYgvvVusQrHORaxYEx7fV3zpWov PhUe4kuXufej/EHdgbTzdaThkIK18a5fH0Fpp1NKw3yMoj7NozPEnSac1vYGgABFLOkk KK3oqYfgpARscS5r8X0BXxqW5vsn3edOwmJr/faC98WpyNJ07E6XxlTFCMn1UddSTuoR bLGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xooVAMl0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056a00230d00b0053652e1c0b6si39658176pfh.12.2022.10.24.06.08.29; Mon, 24 Oct 2022 06:08: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=xooVAMl0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235329AbiJXNHf (ORCPT + 99 others); Mon, 24 Oct 2022 09:07:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235305AbiJXNFd (ORCPT ); Mon, 24 Oct 2022 09:05: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 61CE29C2C9; Mon, 24 Oct 2022 05:20: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 4488AB8162A; Mon, 24 Oct 2022 12:15:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CE50C433D6; Mon, 24 Oct 2022 12:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613723; bh=SbXe2nwOwKhBNsRxVbxJGpSzOkMliiXFJoOEnTh8kDY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xooVAMl05lQZmGmwVkyB/Y68xsmofZ3BJxSMPxO+IwHf+UCV9HDYWPMaYWtntAkqf RsEeg1qMNAhCdJh6OXg2TV6RtC74e9hNtaRfgKfrkGqetJ1oEc8Ql13vzXff+/OQYv Q7nAZRup9mmbLl7NCQN59IPB83+j6ohvpOn1JuhQ= 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.4 245/255] clk: bcm2835: Make peripheral PLLC critical Date: Mon, 24 Oct 2022 13:32:35 +0200 Message-Id: <20221024113011.414855682@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574509935298831?= X-GMAIL-MSGID: =?utf-8?q?1747574509935298831?= 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 e650379b3230..b4e6a7923233 100644 --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c @@ -1756,7 +1756,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = { .load_mask = CM_PLLC_LOADPER, .hold_mask = CM_PLLC_HOLDPER, .fixed_divider = 1, - .flags = CLK_SET_RATE_PARENT), + .flags = CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), /* * PLLD is the display PLL, used to drive DSI display panels. From patchwork Mon Oct 24 11:32: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: 9255 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp461552wru; Mon, 24 Oct 2022 06:44:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6HSW1NsSJCy2xS/fTPKrPd5d8XEntdMvlEDBzUc1ykPA01hFLia/+EjkJ0uVYnvPRbHePD X-Received: by 2002:aa7:c504:0:b0:461:122b:882b with SMTP id o4-20020aa7c504000000b00461122b882bmr19734751edq.14.1666619052898; Mon, 24 Oct 2022 06:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619052; cv=none; d=google.com; s=arc-20160816; b=ZWstLMSTmINcFwbhJM/LTEMI/j+8XsBvBLs/cvkNthBVm0ftREK+BziKqrkU8N2Y11 h5cFSQP7w6sC9eazHlv07QeMZiK/v1mnZkfoqGj0KbJS2PQexaH41ZF+pmBiWC1P6dz+ Ku+iD8lhmQeyg1R2CT/bIN4kY36P+upLI6K+djHRXpSlVBpxA8KQG7F+taP5XJq875tu vujCz88uX2WDIgOo3FwG/iEmoeOnJG9yE8OTk7VUsOnPsOEp3JLdcVh4XomWSvjL5gpu ut7QEuhRVBUAzFeGkPx/8mRKAg8/EI9WKf75Bnq5bbGUz6ePuvRbKpE9EfOMHHP4ov/V H/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=q1DeWLJ7xnd5qhnmRZnFFdpFiX8o2o3x61YCyeHzV3k=; b=lUzzOaTGN/fryHlkJJy6EJrCWymc1E0/4b2alsZma4YI9917QRj8PivIJ5qWKuSxTN 3/TsPcqo1R+TIP8DQLtgyokg+bjFOEp91G7E3GZE+dMxVUlxkL148TeRryQ9X3JbvOnU C64EmR1w3ZH7lLcssgNK8js0JlwJqjYWzeBOKiGfEdvyzz5MMSNEfvnPj62Lyfa6kOKD xaRUYyvlvt9qngrIPX8t23gK4XQ3i/xIQ80SR9F1Ki7+wflX0wqOeaaDmLurSA7ms2wy HyNz84WRWYrHTEbF1EUA/eH9Em1LlNPmouR+/MTSU3hQPdndqMmq1V4HyfmWLVWfara/ IZQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1JEpOgZa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056402320600b00461cdda451dsi2229502eda.435.2022.10.24.06.43.48; Mon, 24 Oct 2022 06:44:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1JEpOgZa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233733AbiJXNiW (ORCPT + 99 others); Mon, 24 Oct 2022 09:38:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236172AbiJXNe6 (ORCPT ); Mon, 24 Oct 2022 09:34: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 8B5D75925E; Mon, 24 Oct 2022 05:35: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 1FDD96132A; Mon, 24 Oct 2022 12:15:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B198C433D7; Mon, 24 Oct 2022 12:15:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613726; bh=B5IjQZsAWjCQMxDIcwqlkqYSdaq9puYmFTFdYNsrZ6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1JEpOgZaBxepwReSQmb4TGE25Ht1rylCprheb5LQIpABEEPGB0+9awVtF/3xTpLWB 8agZtxAeCOWCv6Fe15tFJcqpnl8StNOrx23Vof2I9FCUG3zJOL/XBR+7e3GBPi3y1T BTcP+Wgng6arTDzU3HK55mfngmy0nBagjbLsuFso= 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.4 246/255] perf intel-pt: Fix segfault in intel_pt_print_info() with uClibc Date: Mon, 24 Oct 2022 13:32:36 +0200 Message-Id: <20221024113011.445356713@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576740168628445?= X-GMAIL-MSGID: =?utf-8?q?1747576740168628445?= 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 @@ -3038,6 +3038,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", @@ -3052,8 +3053,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 Mon Oct 24 11:32: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: 8982 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp438784wru; Mon, 24 Oct 2022 06:01:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM56q0xxqGw1eWJ2B4jy9pGeGfLntcNPHw3ZNYOrd4fc0eYavD0zTIi4B+Yas08pHWv3enEU X-Received: by 2002:a17:902:e9ca:b0:186:8624:9675 with SMTP id 10-20020a170902e9ca00b0018686249675mr14656146plk.76.1666616507748; Mon, 24 Oct 2022 06:01:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616507; cv=none; d=google.com; s=arc-20160816; b=RwmRQCQ8KXkyoXQJQg6d6ijpa48GYNC/4nz6FrVEYIab+e7CH6z20VmpGjUyK20jT7 kbymwE3GwNZtHJ3rHbG+TGVPQe3gOC0A2mQdNBG4II8T+fGxEdJDRVG2wPLKanoo8Lkw nQctdKc45k43zi311uEnNYJJ6H7ONHIKvjUea2k2KdKRNCEFBJE9ptXyZgPJvnLqOgjr X5egCe/yOW08HyfO7WgU5Aoo33WoLhHVi3lqVYZkKRClrX1BOHkqP6ZpriSfE0kcuF3F rhaGEp8NyhwoB1l7OjAZHJgdILBEqRrDkmkvYwV9f5GeQzNBeKR7gt6Pq9BegamSPc6i c9Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8QkECf9anx+2gCuF1IU2cRy0SMmszFbrz5rMd1opX7E=; b=dynb6nGiz7YLe54sWSjJSP9TBKZ6hbZ3Nosv5PTHSJCD93nreDvYfEU8HLSkIMUsCx o3OO6srSNl+Z0EHn4QkSGlyidFsy2OK/Wu8A+zQzv83u1GGuEAOOPLsqX/fLSqkFHfnl wv+QiSYursba3soyIIOqVKNTiM880M8KK71+dfFrLkJ4GCUobdxy3Fzf74/qRvETLvLS HDqX4HSlleX4/IPle+wTvui/kxtyXq9sc6bwy5naXm+4f+GRY/7OScis6wrFgEgtTSyp Lwkr1bf3g6r6UtaaZXEyaX+TkyvZ6431Y8mylbtVR1CL35185sb8ykegp/8M4szO0v+M 89xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HFmcdPaS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a65624c000000b0043a107f33ccsi33410667pgv.205.2022.10.24.06.01.24; Mon, 24 Oct 2022 06:01: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=HFmcdPaS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234999AbiJXNBA (ORCPT + 99 others); Mon, 24 Oct 2022 09:01:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234927AbiJXM6z (ORCPT ); Mon, 24 Oct 2022 08:58: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 36B3B98CBA; Mon, 24 Oct 2022 05:17: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 E4ED6612CA; Mon, 24 Oct 2022 12:15:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3431C433C1; Mon, 24 Oct 2022 12:15:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613729; bh=vphyuMNTpGBaNmQQwhU17mOecsvvOTZxhLXb6ShGydk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HFmcdPaSrHIVU9EKgl/T1HkZG0Du0D7tn9U4deUkrW/OcXlCjpnnhsg0gqcCO7X7T aMtNExlG/xybaCV/P9lDuqCFTUEOei448kuESxszmaAZBecpeNvsxjJum7OXPLZ3Dy Zo93JvpvhOEFp+5hHfPWHwVbbMYSWfL8TIoQS7vM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Pavel Begunkov , Thadeu Lima de Souza Cascardo , Jens Axboe , David Bouman Subject: [PATCH 5.4 247/255] io_uring/af_unix: defer registered files gc to io_uring release Date: Mon, 24 Oct 2022 13:32:37 +0200 Message-Id: <20221024113011.493035765@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574070944261348?= X-GMAIL-MSGID: =?utf-8?q?1747574070944261348?= From: Pavel Begunkov [ upstream commit 0091bfc81741b8d3aeb3b7ab8636f911b2de6e80 ] 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 --- fs/io_uring.c | 1 + include/linux/skbuff.h | 2 ++ net/unix/garbage.c | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+) --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -3172,6 +3172,7 @@ static int __io_sqe_files_scm(struct io_ } skb->sk = sk; + skb->scm_io_uring = 1; skb->destructor = io_destruct_skb; fpl->user = get_uid(ctx->user); --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -659,6 +659,7 @@ typedef unsigned char *sk_buff_data_t; * @wifi_acked: whether frame was acked on wifi or not * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS * @csum_not_inet: use CRC32c to resolve CHECKSUM_PARTIAL + * @scm_io_uring: SKB holds io_uring registered files * @dst_pending_confirm: need to confirm neighbour * @decrypted: Decrypted SKB * @napi_id: id of the NAPI struct this skb came from @@ -824,6 +825,7 @@ struct sk_buff { #ifdef CONFIG_TLS_DEVICE __u8 decrypted:1; #endif + __u8 scm_io_uring:1; #ifdef CONFIG_NET_SCHED __u16 tc_index; /* traffic control index */ --- 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 Mon Oct 24 11:32: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: 9983 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp615278wru; Mon, 24 Oct 2022 12:25:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM51D+jkYTIpYLeZ1emuEcteWFgVtg4jpsmU6HmyZyKTRl0Xn355NsTdfdlRI1M/+kvannSD X-Received: by 2002:a17:907:2e0b:b0:7a7:d37e:4650 with SMTP id ig11-20020a1709072e0b00b007a7d37e4650mr6257786ejc.261.1666639559712; Mon, 24 Oct 2022 12:25:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666639559; cv=none; d=google.com; s=arc-20160816; b=QEhaskO72NduOaGoOeWEjDqzmN8SQh+4l1PpL2pCeBZ16lBC9vq79BwOaFCCQpKyWO m+L2fKXBSahU8bTev+9t8QVGkdLCaIO2+42Dx09osXnPQTTQwHROfDskNclk2GnSN4bn hJvxT5GbXWT7QOTVURKnbTUIKmGn8K+yjCU1yKn7BsRX6l6eRzWcmUKmNqLnD29OT2B6 p7HijOzQGxwt5+m18QaxNdzMwhk/X6qg+R0199J8z7KlIfjMFMlpCyPvuZYAzUKPj4gF SUk0DgdkmR9qoTuL3Z7vwuj+gMFUeOEEW8eQw1LIifq9tpJYaPKi1zxAGWtT9mM97Em1 YWjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=joj6Pws13CTw/b/6CzdcXp8QNlZFPu1/ybe5FFGraea++bjq51vH6OQfd+3aOFnSGP s35jwyMTh0s+mxWzBn0H+ABvQShZzBlIOz5I5lG+Kkk/iimEDvI6mmOc5ZIJopRWS4jz IbGnGVDbbuTKTIuWwnlPQVDIGyyZat2i9de28SywXrT++zNHKN8WvF6tkDQOJVWz2UBY foMp7O0VkFoVBenaTZk+WEu+Y4ntDCpf1DTqpmoyNfD5NssgWXCC3pNqQEPVtdoHHBYS CC+6m9ut8BrDtqC2wfIU0hqPNs3i16+V6WG5WHNHDRiPN7WkOrf+cF7g0IPdraDezmlX l9zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="k2C9/z8g"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dt19-20020a170907729300b007a137bfaa8dsi549944ejc.148.2022.10.24.12.25.34; Mon, 24 Oct 2022 12:25: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="k2C9/z8g"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232700AbiJXTOm (ORCPT + 99 others); Mon, 24 Oct 2022 15:14:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233433AbiJXTOO (ORCPT ); Mon, 24 Oct 2022 15:14: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 2107514081; Mon, 24 Oct 2022 10:52: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 440F5B8162F; Mon, 24 Oct 2022 12:15:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AB21C433D7; Mon, 24 Oct 2022 12:15:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613732; bh=OjZ0L2KyAgkZPt75DZB7YHk9PytepHMPjogVsy2mw0A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k2C9/z8gDGFrhTWEtxk4yyF68pP+6m5E4j7/yg08hEpJ+ygUswyBFRsviFcADzVpC 7FUrX7hdrgXWDgKk/+71PqCqe5Rk7cHy/BbXyVFUhligqjuZnr1ksI7ofjDqYNC/d1 y0QSfuxkvF8DnG4jQiWbt2QoNFFDRcW3z+M3hJw0= 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.4 248/255] net: ieee802154: return -EINVAL for unknown addr type Date: Mon, 24 Oct 2022 13:32:38 +0200 Message-Id: <20221024113011.539405016@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747598243037953314?= X-GMAIL-MSGID: =?utf-8?q?1747598243037953314?= 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 Mon Oct 24 11:32: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: 9733 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp548155wru; Mon, 24 Oct 2022 09:40:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5G4cL/g/958tx/XkgfCD1Ftxo/5m/OVbzEPOQY0tMCf5QbpqBLiSi3v/fWeg2RdFKY6Rpa X-Received: by 2002:a05:6402:4444:b0:458:f355:ce04 with SMTP id o4-20020a056402444400b00458f355ce04mr31984718edb.422.1666629657326; Mon, 24 Oct 2022 09:40:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629657; cv=none; d=google.com; s=arc-20160816; b=hg9/n48+RFGus9fMG5OpLkfeQgesVubRzMtRYwNzIQjaB2uf07RZF7NIGQjfEpQKh8 tfgR1YhforFLq3oMxRd+8xLF/NFbXcCn05wT/7yfV0e0HZN0zdzLSeYriNi+7XtCv5qB 49fhD/KMqBUdghywHqV6DheHXS8ix9GY4qmV9RbBqdwmzIDZZkJpdDGLlLyb711SRjoz FVA0MsR+RAed1FBPeimgoSgua6XSRRni6JYA68z49WpQ+29cgSeddkJe0PmGozdaRNT9 xY9Q0mIPHQL6uXVwiuoQCKK1B88RJfru2dyVfi3mbOuvggegRsTmPYfZyzfltWh7BpWc 3f6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IXgBo/m3rjtlAWmjdgHrqdRQPZjtwj+wuJm/E4uQGWY=; b=HJ3OxLVOn4o8qkfBNR54vX7ZdVPzLAfoREjR/lqHpXjd6qNFGXYZGQUi6paLhcKnb3 9ckLbp4ERkvRGKYPRteiolv2WtQKwUAgwEN9nR7R4haV3kvfG50y3GEBPK2whdhdzMHa Hiplqr+0sv2Qzr5TpKlYcfbMs25IJCoCJybtEXsx4BC8U4Irt5j1KhRp4OGRtPx9L5fs 8mJFZj7vWX3U4fXF8EA1q2CrtiQjs6g8WxmoAPA6kS/e5LFY3pt0UGMmy2cXS9yLD9Nt e8V7WsCVnKimAcB9Wrhys180q49sEwKgfP/zDDB/t/at5c5OlGiOZBCMrKuQbCynaLq9 Mmlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QJwHvvHy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a50fc07000000b00445f660de5asi221341edr.141.2022.10.24.09.40.33; Mon, 24 Oct 2022 09:40: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=QJwHvvHy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232344AbiJXQjI (ORCPT + 99 others); Mon, 24 Oct 2022 12:39:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234306AbiJXQic (ORCPT ); Mon, 24 Oct 2022 12:38: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 698FA18F0DA; Mon, 24 Oct 2022 08:26: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 76D87B81633; Mon, 24 Oct 2022 12:15:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE549C4314C; Mon, 24 Oct 2022 12:15:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613737; bh=dUlv4IUjZufYUsjXRHX/QmwZKP4NWeHS6rGyTNwFWuU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QJwHvvHyz0Z/AtKCzbo2MkumGWOJJcQ+KnbWLG/9eEBYD2TxytQsAeGfpplE0PqBg c/x3p+Rdlsn6Xbqqbs8Qd/s9g9WtNk9+PEETy9B7UiJiSfYHbUpEz5Fo/0V4ZO3lOc p23GE9zpZbc7zlrW2bnIxdhmUjwwf9MsLOPqq4PA= 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.4 249/255] Revert "net/ieee802154: reject zero-sized raw_sendmsg()" Date: Mon, 24 Oct 2022 13:32:39 +0200 Message-Id: <20221024113011.579988511@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587859653915705?= X-GMAIL-MSGID: =?utf-8?q?1747587859653915705?= 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 72637d5994d8..a92b11999e5f 100644 --- a/net/ieee802154/socket.c +++ b/net/ieee802154/socket.c @@ -252,9 +252,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 Mon Oct 24 11:32: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: 8985 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp439188wru; Mon, 24 Oct 2022 06:02:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4IDdMMpWgvKBZcIZiBx8v1KG3Y5BH7fMUjXRa9n1isyPN2HSs8WOGOpfUJ1ibnByw5B77M X-Received: by 2002:a63:4507:0:b0:43c:9cf4:f1d6 with SMTP id s7-20020a634507000000b0043c9cf4f1d6mr28925826pga.316.1666616541407; Mon, 24 Oct 2022 06:02:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616541; cv=none; d=google.com; s=arc-20160816; b=fGpeiuot7EF8Zr2BSltxlr8Q/CuWwK5EqfL/q01G3lnvZ4WYMomTRUzCtYTNu3KaWZ aPyiJrnJA75Swb9pYETv/HV8gxchL7cy/tT/TY0v/QGd1UwIh7oSwsnVCX4HRTMB/dvw tCumhgWujOYONGR5ph+U0PMGrqDpSLr5OinBrAOcNvXM9UuJRDEbVb/W6r8WubBpJYzs gf3d2N2rMkPtwVVhPSowXTlchaAKRDs9YyjKmxje8g9ORTweeWpfIK5EUaF8P5CkzpKD 8owh+KCvAcH6UNw8erA9yy1V7EM+jd+gE6BiuyNop1q5QC24rh0AGMSbMs/k4wJUNhJG w+lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pGMHBgq/x11kaps4EyzckQEw08t4uTzmnp5Kgnxj0jU=; b=0zgZ9vylrrRKc7yB+vzfkM27zaeJPYZJJTrqzLMCpt3M7vhNkSy/trMtx/Dav8136S Y2g/M0Gmvg5dDh17KhrrL5He1sRrktUyk4wDsuWy7GNL/7OPr3wGokPoGMwr553nQG9A arNAHTQPBz2MZtEvT0h5MEwyU01TCwgOpa235PZUpd3ZeY+4LXXMXnFss0YovMrEsL+V DisutgaW3IhocNMHVsIeeeW3+DsZPaakk3Vm2dpvKnwXP3/JKqlAJGvm9q0joPUf0byA fsFsVPtAxlOVYJfvLhZjDlmAddJalifNdXTwDpVMLN15PsqL6Gg7YY1oHssL3FlRqraI AXvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dxVH7Ne8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a630d42000000b0045a8a6b75fesi33791334pgn.499.2022.10.24.06.01.48; Mon, 24 Oct 2022 06:02: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=dxVH7Ne8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235060AbiJXNBN (ORCPT + 99 others); Mon, 24 Oct 2022 09:01:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234979AbiJXM7E (ORCPT ); Mon, 24 Oct 2022 08:59: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 72E709938C; Mon, 24 Oct 2022 05:17: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 54423612A0; Mon, 24 Oct 2022 12:15:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67CF2C433D6; Mon, 24 Oct 2022 12:15:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613739; bh=QR3O8uBGc8eFe5nbi7RUEstzEsOIsXyPelHp6Zn1iTs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dxVH7Ne8WvT78ALfv5lTlAiK85dySVsHB8C9t9NqG2l8w5yPk27UJzEOWVM6TtWte Zb+yibEJGcJTpou4ltEs1++AIdy/f6FG2TBNZj0V2EcDPOKX+4p40/aJbZK0j+1tfW xBQEs/MUNlFbbqYjYqwfPKcKcCLwUbWJKbpsaUYA= 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.4 250/255] net/ieee802154: dont warn zero-sized raw_sendmsg() Date: Mon, 24 Oct 2022 13:32:40 +0200 Message-Id: <20221024113011.611161417@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574106738535650?= X-GMAIL-MSGID: =?utf-8?q?1747574106738535650?= 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 a92b11999e5f..6d6c28581770 100644 --- a/net/ieee802154/socket.c +++ b/net/ieee802154/socket.c @@ -273,6 +273,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 Mon Oct 24 11:32:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9693 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp543887wru; Mon, 24 Oct 2022 09:30:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Y/NJTCm6dUIhDmI9aUcBUBvC2njJvJ904ifbMll0kXqmNTzKY2Tb3NnJQp8bltArxTpGX X-Received: by 2002:a17:906:7952:b0:787:a14d:65a7 with SMTP id l18-20020a170906795200b00787a14d65a7mr28620533ejo.108.1666629057316; Mon, 24 Oct 2022 09:30:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629057; cv=none; d=google.com; s=arc-20160816; b=RhI8/OSTcSpp0IXpU0FeLcBUWT1ZrHDO8XogSQrljYXA7lFpnC6npYfX+boTIn3C8e fzX7x2v+ne59tp4Urr14VI2MNhgxNzT+mjDakNjbu6Jo0pgpk0RAPMINzfsLYN+Ocznr 3xz1xpUecc/QlBD5kPZLQsHfLnScnJF8+owOHbELSVF6a0p5ttzUKBd6bKdexzu1BTIF Q7Y7BCZlmWMrwyrfUL7zQf7K4+0pacJGlcKURVMd4VgkCpoWr2odR5RfCtaxic91Hn8H zHxxU/nCnB7oGUE8Gv/GFm9YX7nth0U0ymhmjhkaTNAOdti9cO4EcFHvT+uIqXs7Yy2j vxkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yyBP1ee1zaBdqPAXJDDKXudQKq8a2xpdxA0ShsLGnHk=; b=ijO1tNGfHUio8dJUcG+P8cxxKHKh6m/isDXL6Bw/II77PmdayYRW3ygmA1vgEZY+l/ PBWajvkYfSHiSmKcLZPaogKv7JkcxT089RQkF1hMTbJa3Gq5eoLu6lVf0JCUVp3vMVUh DgX0qQgLVz5dY8Vto256El+cKrrPEEL5v9sh8y+FO4hbNM8IkrNbv8xATO/lKromq2J5 HI9iX1ZKAIIwtBqo+6wDqm5gDjkAxLxO+SQLXHEG4YPUGxeORrI0GV4qMYAy5ORCW32G V3UpCbMlw0JSeoM+/8uhCCKOsM9imWnX6K/nB1cuSGuFoKXJ+1nNxxn28uXgSuBRehiZ X7WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iRj5poff; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv11-20020a17090760cb00b007824b85978asi190814ejc.81.2022.10.24.09.30.33; Mon, 24 Oct 2022 09: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=iRj5poff; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231205AbiJXQPv (ORCPT + 99 others); Mon, 24 Oct 2022 12:15:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230092AbiJXQNn (ORCPT ); Mon, 24 Oct 2022 12:13: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 88192E099B; Mon, 24 Oct 2022 08: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 7A1CDB81629; Mon, 24 Oct 2022 12:16:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0EA9C433D7; Mon, 24 Oct 2022 12:16:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613771; bh=BMKP81An3DVtiRKCWskDLbP4VdOzHunvWVzA0laQJNk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iRj5poffXj2JZStYU6W9y7RvxMPhJRkwHcNL923JAbQM84Gn6dWwFcSLLk/RYqm8s vGBAQZ3OR4EoygFJUeWj/MxTPcwfNfoEECc6xK809vkuCNmJtQdOu1zWp6ZF0Q78Wy dLAlExomiVwkKJYOdHvHWZ8EHfTZ483nCw2vgYPw= 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.4 251/255] ext4: continue to expand file system when the target size doesnt reach Date: Mon, 24 Oct 2022 13:32:41 +0200 Message-Id: <20221024113011.659338565@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587230353025082?= X-GMAIL-MSGID: =?utf-8?q?1747587230353025082?= 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 @@ -2090,7 +2090,7 @@ retry: goto out; } - if (ext4_blocks_count(es) == n_blocks_count) + if (ext4_blocks_count(es) == n_blocks_count && n_blocks_count_retry == 0) goto out; err = ext4_alloc_flex_bg_array(sb, n_group + 1); From patchwork Mon Oct 24 11:32:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9069 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp444930wru; Mon, 24 Oct 2022 06:11:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7CM1oVlG+9TgKcK952yTqMVjtPhDfadlGkbz4UArs5gF5faLk9JSTZ7IhGxqf55G4mlVgf X-Received: by 2002:a63:1a60:0:b0:43c:9bcd:6c37 with SMTP id a32-20020a631a60000000b0043c9bcd6c37mr27591944pgm.125.1666617114423; Mon, 24 Oct 2022 06:11:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617114; cv=none; d=google.com; s=arc-20160816; b=k1EOs3kHfHGH1MNynrQl4s8l06Z6RpBz6yEW86iumVatCA6IAfKhIVdXnCxCbSxb9H A74mVIcczrJPoJVmeGLV3e/B/2O/3Fg520N5gvP2rhR0K7c9CMtHqsEiPDd/nTtjYZDi Szf6s0mbrdHDCbB88/cvYFF8LzaKClM8eQ1iefYUMol+TREFLo9GFFoNImQX5x3jUHTO 79mAmI3qRd1YbwMc5KGC1puwMD0G84RwwFprMIg4aOBQAzAMdTtQgau3GF/dcdYGtVW9 dbkysFHWlIlNzJ6Of9m9pMpz91IzW/OcD8zgJy5Jy3oR7tMv+09O0JB83xUzfbfEA7jn KlXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yFmWC5BiUq0jll7TqEt9WDWfUnuyKU49HAWIu+5R3tM=; b=TuEsiJpgVtr0MpRKBcynp/cGSU3zUNM/tVdYzaUe4AWcXAf5CbfmHUVxrCQ3Yk7hpx WQnJaCXDZCGurk0uKhu8dwUC492tzkNfPPnKmJHSoFgDKbU8CLvNIvzD27Jf7GvQ6c/+ 7j15so501LyV8cZQx4lag3GOP1wFeyB+f8H1S9nBTlhEHa78TqrAgTve9Nd3ykvM+a4m CbivTQq6W88CJUxRj0e1ptUpgOcx+b5pRBjoW8KS9jaKKGtlI8J4tbdqJP33LJClspic viQci3Wtl2lI0RCzwch0+axvltmLGQXQ+EFwpxF0oE9uVN2r4+d3FYyBxKvpvo1u5zSm oT4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LsFiuBzX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q89-20020a17090a1b6200b00212ea9177dasi7324417pjq.30.2022.10.24.06.11.41; Mon, 24 Oct 2022 06: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=LsFiuBzX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235547AbiJXNK5 (ORCPT + 99 others); Mon, 24 Oct 2022 09:10:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235436AbiJXNIm (ORCPT ); Mon, 24 Oct 2022 09:08: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 921839E680; Mon, 24 Oct 2022 05:21: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 CB90EB81637; Mon, 24 Oct 2022 12:16:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C958C433C1; Mon, 24 Oct 2022 12:16:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613760; bh=uHn0RqWAGuY2UsCqYwefavnRuYHwaMKMXxufWpPwynk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LsFiuBzX44km6J6UEJj/6G6ZRTrwmDKC7QLmMd0C7VEMVqKqkwIdHQVEMBUgGWnfl qMLzjqEfKS92BPX9IfMDouq1mRTM6BKdNYVGaxZguiLIEvQQDyAgymKROvXhmYlNo8 UuvDItQDEVyHn5sHb4chVU7MF83p0lWi3aIo5fM8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Kelley , Guoqing Jiang , Saurabh Sengar , Song Liu Subject: [PATCH 5.4 252/255] md: Replace snprintf with scnprintf Date: Mon, 24 Oct 2022 13:32:42 +0200 Message-Id: <20221024113011.699767171@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574707483708519?= X-GMAIL-MSGID: =?utf-8?q?1747574707483708519?= From: Saurabh Sengar commit 1727fd5015d8f93474148f94e34cda5aa6ad4a43 upstream. Current code produces a warning as shown below when total characters in the constituent block device names plus the slashes exceeds 200. snprintf() returns the number of characters generated from the given input, which could cause the expression “200 – len” to wrap around to a large positive number. Fix this by using scnprintf() instead, which returns the actual number of characters written into the buffer. [ 1513.267938] ------------[ cut here ]------------ [ 1513.267943] WARNING: CPU: 15 PID: 37247 at /lib/vsprintf.c:2509 vsnprintf+0x2c8/0x510 [ 1513.267944] Modules linked in: [ 1513.267969] CPU: 15 PID: 37247 Comm: mdadm Not tainted 5.4.0-1085-azure #90~18.04.1-Ubuntu [ 1513.267969] Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS Hyper-V UEFI Release v4.1 05/09/2022 [ 1513.267971] RIP: 0010:vsnprintf+0x2c8/0x510 <-snip-> [ 1513.267982] Call Trace: [ 1513.267986] snprintf+0x45/0x70 [ 1513.267990] ? disk_name+0x71/0xa0 [ 1513.267993] dump_zones+0x114/0x240 [raid0] [ 1513.267996] ? _cond_resched+0x19/0x40 [ 1513.267998] raid0_run+0x19e/0x270 [raid0] [ 1513.268000] md_run+0x5e0/0xc50 [ 1513.268003] ? security_capable+0x3f/0x60 [ 1513.268005] do_md_run+0x19/0x110 [ 1513.268006] md_ioctl+0x195e/0x1f90 [ 1513.268007] blkdev_ioctl+0x91f/0x9f0 [ 1513.268010] block_ioctl+0x3d/0x50 [ 1513.268012] do_vfs_ioctl+0xa9/0x640 [ 1513.268014] ? __fput+0x162/0x260 [ 1513.268016] ksys_ioctl+0x75/0x80 [ 1513.268017] __x64_sys_ioctl+0x1a/0x20 [ 1513.268019] do_syscall_64+0x5e/0x200 [ 1513.268021] entry_SYSCALL_64_after_hwframe+0x44/0xa9 Fixes: 766038846e875 ("md/raid0: replace printk() with pr_*()") Reviewed-by: Michael Kelley Acked-by: Guoqing Jiang Signed-off-by: Saurabh Sengar Signed-off-by: Song Liu Signed-off-by: Greg Kroah-Hartman --- drivers/md/raid0.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c @@ -63,8 +63,8 @@ static void dump_zones(struct mddev *mdd int len = 0; for (k = 0; k < conf->strip_zone[j].nb_dev; k++) - len += snprintf(line+len, 200-len, "%s%s", k?"/":"", - bdevname(conf->devlist[j*raid_disks + len += scnprintf(line+len, 200-len, "%s%s", k?"/":"", + bdevname(conf->devlist[j*raid_disks + k]->bdev, b)); pr_debug("md: zone%d=[%s]\n", j, line); From patchwork Mon Oct 24 11:32: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: 8984 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp439151wru; Mon, 24 Oct 2022 06:02:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM43BhsI46ciK/kzykf0AgHyG8CKr7awUvKtmNzQaWfdhG5qFZSbcLEhs9a/hGGqdVbQg1/U X-Received: by 2002:a63:2061:0:b0:46e:d84b:719f with SMTP id r33-20020a632061000000b0046ed84b719fmr10928848pgm.169.1666616538228; Mon, 24 Oct 2022 06:02:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616538; cv=none; d=google.com; s=arc-20160816; b=stYf5ZmHtJjEiOfAOqDo3n3QDps04HrLu7+//k6pKEJensWVttb+qKj+ur8uc0EO2w N1tAqv+PRCCYf2gv1Qr26d6hXr07W1rgre/przAJF/xAM+pSFs0JCj6/7X3LOn8/IPut 4pv/YFhXijB2KAMI4asMJDvSzrdRL37Dx+rfklXd82SZapQJ+g86lx1/Qi0y0EGeFvwp HOJgKzH2h4WxE+jPsx4tl9Q20jLmaUXNFumuFPbnmyrQGMmDY6drXEk0OW8avB5geBqN 2FL2cuNrckHJrwlyG9rK+IoCswdoUqB3e7i7r9w1Xi/vRUyeKoM0hIR90n02EPsdFs05 7/5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kEwL4o3NqrO09nxBfT1xEHO+A701WlFlAvf9elUGWFM=; b=D/A+3tHt+8l9Ijt6d2fYF2/M1P5QqZaahBShaYYbmoaYcB2NvA74Hj/nflX8BDGJQ9 2a52AuIshbdfE235y3RbcOuz+gyLzihNj8oeaRRPFE8h/+VpB+uN7ZIrCozNiuAkpzqZ lOdys0PP7N3yVl1IG9TodIRQG79ZZBAPqU/IxHRvU5oyMbV2R7lG4GtK6dFcYXSmNSPi WbvFE5GmhFaq1NEuuyRTndpttjamDhSxWNIA9IOJXYeLXQ9Gr3/artbNAW+hSXHqNF99 5/xQhabWm33eBOYCxeZaBN2++aw5MZ0VJIyIHUYZBzh0m/adn4btd/vK+qGadm0AzXP5 e5Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YRN1Tqoo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bd12-20020a656e0c000000b0043ce4eee5f2si35765417pgb.433.2022.10.24.06.01.45; Mon, 24 Oct 2022 06:02: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=YRN1Tqoo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235036AbiJXNBH (ORCPT + 99 others); Mon, 24 Oct 2022 09:01:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234946AbiJXM7A (ORCPT ); Mon, 24 Oct 2022 08: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 2A3EC80F64; Mon, 24 Oct 2022 05:17: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 B8BBD6132D; Mon, 24 Oct 2022 12:16:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C756EC433C1; Mon, 24 Oct 2022 12:16:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613763; bh=zftqSdqfvE2rZqRBOmyDFukm7cI5x5ZeXi9nAfOkjDs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YRN1TqooAlCTC3Dlzx0m7+ljJf+XHhBhITe+NghdEzUniAOp/vWK7NCISiylvesAV vegFYimDm0wlIcRKqgBiiPJfU1WgN0TJExYiCIJWSVfnLorsojv5QDO22h7RxKxQQ1 eyX5VuMHdQd+Emg3rPSI9lwv5a2mKuTBIn+8UhFg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ard Biesheuvel Subject: [PATCH 5.4 253/255] efi: libstub: drop pointless get_memory_map() call Date: Mon, 24 Oct 2022 13:32:43 +0200 Message-Id: <20221024113011.731732511@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574103336801302?= X-GMAIL-MSGID: =?utf-8?q?1747574103336801302?= 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 @@ -291,14 +291,6 @@ efi_status_t allocate_new_fdt_and_exit_b goto fail; } - /* - * Now that we have done our final memory allocation (and free) - * we can get the memory map key needed for exit_boot_services(). - */ - status = efi_get_memory_map(sys_table, &map); - if (status != EFI_SUCCESS) - goto fail_free_new_fdt; - status = update_fdt(sys_table, (void *)fdt_addr, fdt_size, (void *)*new_fdt_addr, MAX_FDT_SIZE, cmdline_ptr, initrd_addr, initrd_size); From patchwork Mon Oct 24 11:32: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: 9067 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp444735wru; Mon, 24 Oct 2022 06:11:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7K9qqGTFe0aeLBwlRcLk/dRhUY5yKDgVRiqo/0xaSGVi27tMvEhg8vgHYBIVMbaQF8Q45/ X-Received: by 2002:a65:41ca:0:b0:434:f92f:d711 with SMTP id b10-20020a6541ca000000b00434f92fd711mr28883006pgq.151.1666617097830; Mon, 24 Oct 2022 06:11:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617097; cv=none; d=google.com; s=arc-20160816; b=nZj4og1AhhZVLLAQeqNOSZPuv7ddiuqzCTGv+LnNxozMmH8dKh7Oj1oPdAXKQ+xwqg elUtgPMYzDi2O/tvQWlbn/7vvG2b0PDSsN5BMl4/qetKxuspzOe89Z4NmgNoCz2XGDf3 7X6j2yAe8leKn+ge9vMRSuH3wWUK+sBB8zXn4BJty+aImEGx2T72gk8wEE4v4PRfLush CnvF7s82/UzS0Lq2EDSQnF2gNlL93KK5bbkVCFk1slxw3218qRVTGX6LmhTUFL8vNH6j 3jUqzkxNR2ADp993GZ5DGeITgWzrC2ROKO23E6mNMvoi7t9ahdER6SpMxYiWu4zRzWkq gijQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CoDLl6skCLZRb/D/8V09W8TeoclmX0TjpigiErbV+wI=; b=Hat8vqFHSOuGUR8yTzY6iWnJPgqpml5klKoYohiOqH+m+dEsztn8szH3NOFYJHRUFX 2IfLGigj52NB2vslLXfqA7B0RSExPglF8Q4xy+z+pyCq9iLtvV80YElU7ofrRna2hNHm jnL6LD8cPOzJTSvXEabF+0NyvLWmjaY/whVnD4iZOfieseE2FNuuZB5tUWQtiORVGVO4 GcgGwhWWvBypgXuyazWLdN6zjKa1g4HVZW4hw2R5NZl93bkKex3SC0GG/XLhzPXNdoo0 cE3NCSL9+SqbroHew1lRTrdiOvD5rQinhuKnZgq0cownJc8K3uOz6w8EQuQ8gJAZO6Sa dKyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="1LAX/Df9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q3-20020a17090a2e0300b0020a6dcc726asi10096787pjd.50.2022.10.24.06.11.22; Mon, 24 Oct 2022 06: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="1LAX/Df9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235566AbiJXNLB (ORCPT + 99 others); Mon, 24 Oct 2022 09:11:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235499AbiJXNIr (ORCPT ); Mon, 24 Oct 2022 09:08: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 A05579F351; Mon, 24 Oct 2022 05:22: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 1B998B8162B; Mon, 24 Oct 2022 12:16:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6742EC433D7; Mon, 24 Oct 2022 12:16:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613765; bh=jN8HKtaypFvFTCSCJHHFG7U4FT7URJ0dNXwsL3qCoj0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1LAX/Df99iliksicGp5IfwdEZuBap2/UDDDEU1sYBevH54BYz/7Y2wBb/uvzNBno6 F+h+vnxoY+Z1oKQkkwzySIgFuCvMR/H1/PqgVXzXBj6femEmY8whm15O3svJw4VJXk ZMqjG0vOO6jtgQ9fUOh7N0QEV9F3a8pDtgxEln+M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Jakub Kicinski , Carlos Llamas Subject: [PATCH 5.4 254/255] inet: fully convert sk->sk_rx_dst to RCU rules Date: Mon, 24 Oct 2022 13:32:44 +0200 Message-Id: <20221024113011.771735051@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574690208487984?= X-GMAIL-MSGID: =?utf-8?q?1747574690208487984?= From: Eric Dumazet commit 8f905c0e7354ef261360fb7535ea079b1082c105 upstream. syzbot reported various issues around early demux, one being included in this changelog [1] sk->sk_rx_dst is using RCU protection without clearly documenting it. And following sequences in tcp_v4_do_rcv()/tcp_v6_do_rcv() are not following standard RCU rules. [a] dst_release(dst); [b] sk->sk_rx_dst = NULL; They look wrong because a delete operation of RCU protected pointer is supposed to clear the pointer before the call_rcu()/synchronize_rcu() guarding actual memory freeing. In some cases indeed, dst could be freed before [b] is done. We could cheat by clearing sk_rx_dst before calling dst_release(), but this seems the right time to stick to standard RCU annotations and debugging facilities. [1] BUG: KASAN: use-after-free in dst_check include/net/dst.h:470 [inline] BUG: KASAN: use-after-free in tcp_v4_early_demux+0x95b/0x960 net/ipv4/tcp_ipv4.c:1792 Read of size 2 at addr ffff88807f1cb73a by task syz-executor.5/9204 CPU: 0 PID: 9204 Comm: syz-executor.5 Not tainted 5.16.0-rc5-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0x8d/0x320 mm/kasan/report.c:247 __kasan_report mm/kasan/report.c:433 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:450 dst_check include/net/dst.h:470 [inline] tcp_v4_early_demux+0x95b/0x960 net/ipv4/tcp_ipv4.c:1792 ip_rcv_finish_core.constprop.0+0x15de/0x1e80 net/ipv4/ip_input.c:340 ip_list_rcv_finish.constprop.0+0x1b2/0x6e0 net/ipv4/ip_input.c:583 ip_sublist_rcv net/ipv4/ip_input.c:609 [inline] ip_list_rcv+0x34e/0x490 net/ipv4/ip_input.c:644 __netif_receive_skb_list_ptype net/core/dev.c:5508 [inline] __netif_receive_skb_list_core+0x549/0x8e0 net/core/dev.c:5556 __netif_receive_skb_list net/core/dev.c:5608 [inline] netif_receive_skb_list_internal+0x75e/0xd80 net/core/dev.c:5699 gro_normal_list net/core/dev.c:5853 [inline] gro_normal_list net/core/dev.c:5849 [inline] napi_complete_done+0x1f1/0x880 net/core/dev.c:6590 virtqueue_napi_complete drivers/net/virtio_net.c:339 [inline] virtnet_poll+0xca2/0x11b0 drivers/net/virtio_net.c:1557 __napi_poll+0xaf/0x440 net/core/dev.c:7023 napi_poll net/core/dev.c:7090 [inline] net_rx_action+0x801/0xb40 net/core/dev.c:7177 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu+0x123/0x180 kernel/softirq.c:637 irq_exit_rcu+0x5/0x20 kernel/softirq.c:649 common_interrupt+0x52/0xc0 arch/x86/kernel/irq.c:240 asm_common_interrupt+0x1e/0x40 arch/x86/include/asm/idtentry.h:629 RIP: 0033:0x7f5e972bfd57 Code: 39 d1 73 14 0f 1f 80 00 00 00 00 48 8b 50 f8 48 83 e8 08 48 39 ca 77 f3 48 39 c3 73 3e 48 89 13 48 8b 50 f8 48 89 38 49 8b 0e <48> 8b 3e 48 83 c3 08 48 83 c6 08 eb bc 48 39 d1 72 9e 48 39 d0 73 RSP: 002b:00007fff8a413210 EFLAGS: 00000283 RAX: 00007f5e97108990 RBX: 00007f5e97108338 RCX: ffffffff81d3aa45 RDX: ffffffff81d3aa45 RSI: 00007f5e97108340 RDI: ffffffff81d3aa45 RBP: 00007f5e97107eb8 R08: 00007f5e97108d88 R09: 0000000093c2e8d9 R10: 0000000000000000 R11: 0000000000000000 R12: 00007f5e97107eb0 R13: 00007f5e97108338 R14: 00007f5e97107ea8 R15: 0000000000000019 Allocated by task 13: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] __kasan_slab_alloc+0x90/0xc0 mm/kasan/common.c:467 kasan_slab_alloc include/linux/kasan.h:259 [inline] slab_post_alloc_hook mm/slab.h:519 [inline] slab_alloc_node mm/slub.c:3234 [inline] slab_alloc mm/slub.c:3242 [inline] kmem_cache_alloc+0x202/0x3a0 mm/slub.c:3247 dst_alloc+0x146/0x1f0 net/core/dst.c:92 rt_dst_alloc+0x73/0x430 net/ipv4/route.c:1613 ip_route_input_slow+0x1817/0x3a20 net/ipv4/route.c:2340 ip_route_input_rcu net/ipv4/route.c:2470 [inline] ip_route_input_noref+0x116/0x2a0 net/ipv4/route.c:2415 ip_rcv_finish_core.constprop.0+0x288/0x1e80 net/ipv4/ip_input.c:354 ip_list_rcv_finish.constprop.0+0x1b2/0x6e0 net/ipv4/ip_input.c:583 ip_sublist_rcv net/ipv4/ip_input.c:609 [inline] ip_list_rcv+0x34e/0x490 net/ipv4/ip_input.c:644 __netif_receive_skb_list_ptype net/core/dev.c:5508 [inline] __netif_receive_skb_list_core+0x549/0x8e0 net/core/dev.c:5556 __netif_receive_skb_list net/core/dev.c:5608 [inline] netif_receive_skb_list_internal+0x75e/0xd80 net/core/dev.c:5699 gro_normal_list net/core/dev.c:5853 [inline] gro_normal_list net/core/dev.c:5849 [inline] napi_complete_done+0x1f1/0x880 net/core/dev.c:6590 virtqueue_napi_complete drivers/net/virtio_net.c:339 [inline] virtnet_poll+0xca2/0x11b0 drivers/net/virtio_net.c:1557 __napi_poll+0xaf/0x440 net/core/dev.c:7023 napi_poll net/core/dev.c:7090 [inline] net_rx_action+0x801/0xb40 net/core/dev.c:7177 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 Freed by task 13: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free mm/kasan/common.c:328 [inline] __kasan_slab_free+0xff/0x130 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1723 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1749 slab_free mm/slub.c:3513 [inline] kmem_cache_free+0xbd/0x5d0 mm/slub.c:3530 dst_destroy+0x2d6/0x3f0 net/core/dst.c:127 rcu_do_batch kernel/rcu/tree.c:2506 [inline] rcu_core+0x7ab/0x1470 kernel/rcu/tree.c:2741 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 Last potentially related work creation: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 __kasan_record_aux_stack+0xf5/0x120 mm/kasan/generic.c:348 __call_rcu kernel/rcu/tree.c:2985 [inline] call_rcu+0xb1/0x740 kernel/rcu/tree.c:3065 dst_release net/core/dst.c:177 [inline] dst_release+0x79/0xe0 net/core/dst.c:167 tcp_v4_do_rcv+0x612/0x8d0 net/ipv4/tcp_ipv4.c:1712 sk_backlog_rcv include/net/sock.h:1030 [inline] __release_sock+0x134/0x3b0 net/core/sock.c:2768 release_sock+0x54/0x1b0 net/core/sock.c:3300 tcp_sendmsg+0x36/0x40 net/ipv4/tcp.c:1441 inet_sendmsg+0x99/0xe0 net/ipv4/af_inet.c:819 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:724 sock_write_iter+0x289/0x3c0 net/socket.c:1057 call_write_iter include/linux/fs.h:2162 [inline] new_sync_write+0x429/0x660 fs/read_write.c:503 vfs_write+0x7cd/0xae0 fs/read_write.c:590 ksys_write+0x1ee/0x250 fs/read_write.c:643 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff88807f1cb700 which belongs to the cache ip_dst_cache of size 176 The buggy address is located 58 bytes inside of 176-byte region [ffff88807f1cb700, ffff88807f1cb7b0) The buggy address belongs to the page: page:ffffea0001fc72c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7f1cb flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 dead000000000100 dead000000000122 ffff8881413bb780 raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL), pid 5, ts 108466983062, free_ts 108048976062 prep_new_page mm/page_alloc.c:2418 [inline] get_page_from_freelist+0xa72/0x2f50 mm/page_alloc.c:4149 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5369 alloc_pages+0x1a7/0x300 mm/mempolicy.c:2191 alloc_slab_page mm/slub.c:1793 [inline] allocate_slab mm/slub.c:1930 [inline] new_slab+0x32d/0x4a0 mm/slub.c:1993 ___slab_alloc+0x918/0xfe0 mm/slub.c:3022 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3109 slab_alloc_node mm/slub.c:3200 [inline] slab_alloc mm/slub.c:3242 [inline] kmem_cache_alloc+0x35c/0x3a0 mm/slub.c:3247 dst_alloc+0x146/0x1f0 net/core/dst.c:92 rt_dst_alloc+0x73/0x430 net/ipv4/route.c:1613 __mkroute_output net/ipv4/route.c:2564 [inline] ip_route_output_key_hash_rcu+0x921/0x2d00 net/ipv4/route.c:2791 ip_route_output_key_hash+0x18b/0x300 net/ipv4/route.c:2619 __ip_route_output_key include/net/route.h:126 [inline] ip_route_output_flow+0x23/0x150 net/ipv4/route.c:2850 ip_route_output_key include/net/route.h:142 [inline] geneve_get_v4_rt+0x3a6/0x830 drivers/net/geneve.c:809 geneve_xmit_skb drivers/net/geneve.c:899 [inline] geneve_xmit+0xc4a/0x3540 drivers/net/geneve.c:1082 __netdev_start_xmit include/linux/netdevice.h:4994 [inline] netdev_start_xmit include/linux/netdevice.h:5008 [inline] xmit_one net/core/dev.c:3590 [inline] dev_hard_start_xmit+0x1eb/0x920 net/core/dev.c:3606 __dev_queue_xmit+0x299a/0x3650 net/core/dev.c:4229 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1338 [inline] free_pcp_prepare+0x374/0x870 mm/page_alloc.c:1389 free_unref_page_prepare mm/page_alloc.c:3309 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3388 qlink_free mm/kasan/quarantine.c:146 [inline] qlist_free_all+0x5a/0xc0 mm/kasan/quarantine.c:165 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:272 __kasan_slab_alloc+0xa2/0xc0 mm/kasan/common.c:444 kasan_slab_alloc include/linux/kasan.h:259 [inline] slab_post_alloc_hook mm/slab.h:519 [inline] slab_alloc_node mm/slub.c:3234 [inline] kmem_cache_alloc_node+0x255/0x3f0 mm/slub.c:3270 __alloc_skb+0x215/0x340 net/core/skbuff.c:414 alloc_skb include/linux/skbuff.h:1126 [inline] alloc_skb_with_frags+0x93/0x620 net/core/skbuff.c:6078 sock_alloc_send_pskb+0x783/0x910 net/core/sock.c:2575 mld_newpack+0x1df/0x770 net/ipv6/mcast.c:1754 add_grhead+0x265/0x330 net/ipv6/mcast.c:1857 add_grec+0x1053/0x14e0 net/ipv6/mcast.c:1995 mld_send_initial_cr.part.0+0xf6/0x230 net/ipv6/mcast.c:2242 mld_send_initial_cr net/ipv6/mcast.c:1232 [inline] mld_dad_work+0x1d3/0x690 net/ipv6/mcast.c:2268 process_one_work+0x9b2/0x1690 kernel/workqueue.c:2298 worker_thread+0x658/0x11f0 kernel/workqueue.c:2445 Memory state around the buggy address: ffff88807f1cb600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807f1cb680: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc >ffff88807f1cb700: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807f1cb780: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc ffff88807f1cb800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb Fixes: 41063e9dd119 ("ipv4: Early TCP socket demux.") Signed-off-by: Eric Dumazet Link: https://lore.kernel.org/r/20211220143330.680945-1-eric.dumazet@gmail.com Signed-off-by: Jakub Kicinski [cmllamas: fixed trivial merge conflict] Signed-off-by: Carlos Llamas Signed-off-by: Greg Kroah-Hartman --- include/net/sock.h | 2 +- net/ipv4/af_inet.c | 2 +- net/ipv4/tcp.c | 3 +-- net/ipv4/tcp_input.c | 2 +- net/ipv4/tcp_ipv4.c | 11 +++++++---- net/ipv4/udp.c | 6 +++--- net/ipv6/tcp_ipv6.c | 11 +++++++---- net/ipv6/udp.c | 4 ++-- 8 files changed, 23 insertions(+), 18 deletions(-) --- a/include/net/sock.h +++ b/include/net/sock.h @@ -399,7 +399,7 @@ struct sock { #ifdef CONFIG_XFRM struct xfrm_policy __rcu *sk_policy[2]; #endif - struct dst_entry *sk_rx_dst; + struct dst_entry __rcu *sk_rx_dst; struct dst_entry __rcu *sk_dst_cache; atomic_t sk_omem_alloc; int sk_sndbuf; --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -157,7 +157,7 @@ void inet_sock_destruct(struct sock *sk) kfree(rcu_dereference_protected(inet->inet_opt, 1)); dst_release(rcu_dereference_protected(sk->sk_dst_cache, 1)); - dst_release(sk->sk_rx_dst); + dst_release(rcu_dereference_protected(sk->sk_rx_dst, 1)); sk_refcnt_debug_dec(sk); } EXPORT_SYMBOL(inet_sock_destruct); --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -2654,8 +2654,7 @@ int tcp_disconnect(struct sock *sk, int icsk->icsk_ack.rcv_mss = TCP_MIN_MSS; memset(&tp->rx_opt, 0, sizeof(tp->rx_opt)); __sk_dst_reset(sk); - dst_release(sk->sk_rx_dst); - sk->sk_rx_dst = NULL; + dst_release(xchg((__force struct dst_entry **)&sk->sk_rx_dst, NULL)); tcp_saved_syn_free(tp); tp->compressed_ack = 0; tp->segs_in = 0; --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -5616,7 +5616,7 @@ void tcp_rcv_established(struct sock *sk trace_tcp_probe(sk, skb); tcp_mstamp_refresh(tp); - if (unlikely(!sk->sk_rx_dst)) + if (unlikely(!rcu_access_pointer(sk->sk_rx_dst))) inet_csk(sk)->icsk_af_ops->sk_rx_dst_set(sk, skb); /* * Header prediction. --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -1570,15 +1570,18 @@ int tcp_v4_do_rcv(struct sock *sk, struc struct sock *rsk; if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ - struct dst_entry *dst = sk->sk_rx_dst; + struct dst_entry *dst; + + dst = rcu_dereference_protected(sk->sk_rx_dst, + lockdep_sock_is_held(sk)); sock_rps_save_rxhash(sk, skb); sk_mark_napi_id(sk, skb); if (dst) { if (inet_sk(sk)->rx_dst_ifindex != skb->skb_iif || !dst->ops->check(dst, 0)) { + RCU_INIT_POINTER(sk->sk_rx_dst, NULL); dst_release(dst); - sk->sk_rx_dst = NULL; } } tcp_rcv_established(sk, skb); @@ -1653,7 +1656,7 @@ int tcp_v4_early_demux(struct sk_buff *s skb->sk = sk; skb->destructor = sock_edemux; if (sk_fullsock(sk)) { - struct dst_entry *dst = READ_ONCE(sk->sk_rx_dst); + struct dst_entry *dst = rcu_dereference(sk->sk_rx_dst); if (dst) dst = dst_check(dst, 0); @@ -2059,7 +2062,7 @@ void inet_sk_rx_dst_set(struct sock *sk, struct dst_entry *dst = skb_dst(skb); if (dst && dst_hold_safe(dst)) { - sk->sk_rx_dst = dst; + rcu_assign_pointer(sk->sk_rx_dst, dst); inet_sk(sk)->rx_dst_ifindex = skb->skb_iif; } } --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -2137,7 +2137,7 @@ bool udp_sk_rx_dst_set(struct sock *sk, struct dst_entry *old; if (dst_hold_safe(dst)) { - old = xchg(&sk->sk_rx_dst, dst); + old = xchg((__force struct dst_entry **)&sk->sk_rx_dst, dst); dst_release(old); return old != dst; } @@ -2326,7 +2326,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct dst_entry *dst = skb_dst(skb); int ret; - if (unlikely(sk->sk_rx_dst != dst)) + if (unlikely(rcu_dereference(sk->sk_rx_dst) != dst)) udp_sk_rx_dst_set(sk, dst); ret = udp_unicast_rcv_skb(sk, skb, uh); @@ -2484,7 +2484,7 @@ int udp_v4_early_demux(struct sk_buff *s skb->sk = sk; skb->destructor = sock_efree; - dst = READ_ONCE(sk->sk_rx_dst); + dst = rcu_dereference(sk->sk_rx_dst); if (dst) dst = dst_check(dst, 0); --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -106,7 +106,7 @@ static void inet6_sk_rx_dst_set(struct s if (dst && dst_hold_safe(dst)) { const struct rt6_info *rt = (const struct rt6_info *)dst; - sk->sk_rx_dst = dst; + rcu_assign_pointer(sk->sk_rx_dst, dst); inet_sk(sk)->rx_dst_ifindex = skb->skb_iif; tcp_inet6_sk(sk)->rx_dst_cookie = rt6_get_cookie(rt); } @@ -1394,15 +1394,18 @@ static int tcp_v6_do_rcv(struct sock *sk opt_skb = skb_clone(skb, sk_gfp_mask(sk, GFP_ATOMIC)); if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ - struct dst_entry *dst = sk->sk_rx_dst; + struct dst_entry *dst; + + dst = rcu_dereference_protected(sk->sk_rx_dst, + lockdep_sock_is_held(sk)); sock_rps_save_rxhash(sk, skb); sk_mark_napi_id(sk, skb); if (dst) { if (inet_sk(sk)->rx_dst_ifindex != skb->skb_iif || dst->ops->check(dst, np->rx_dst_cookie) == NULL) { + RCU_INIT_POINTER(sk->sk_rx_dst, NULL); dst_release(dst); - sk->sk_rx_dst = NULL; } } @@ -1753,7 +1756,7 @@ INDIRECT_CALLABLE_SCOPE void tcp_v6_earl skb->sk = sk; skb->destructor = sock_edemux; if (sk_fullsock(sk)) { - struct dst_entry *dst = READ_ONCE(sk->sk_rx_dst); + struct dst_entry *dst = rcu_dereference(sk->sk_rx_dst); if (dst) dst = dst_check(dst, tcp_inet6_sk(sk)->rx_dst_cookie); --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -889,7 +889,7 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct dst_entry *dst = skb_dst(skb); int ret; - if (unlikely(sk->sk_rx_dst != dst)) + if (unlikely(rcu_dereference(sk->sk_rx_dst) != dst)) udp6_sk_rx_dst_set(sk, dst); if (!uh->check && !udp_sk(sk)->no_check6_rx) { @@ -1001,7 +1001,7 @@ INDIRECT_CALLABLE_SCOPE void udp_v6_earl skb->sk = sk; skb->destructor = sock_efree; - dst = READ_ONCE(sk->sk_rx_dst); + dst = rcu_dereference(sk->sk_rx_dst); if (dst) dst = dst_check(dst, inet6_sk(sk)->rx_dst_cookie); From patchwork Mon Oct 24 11:32: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: 8987 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp439329wru; Mon, 24 Oct 2022 06:02:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5MyCCYt37oCBc9eJmzZxJDsXuQUX4SxiiINJwF9k6jCX1Ye1W542nSxk1+rwDfh/8Ac0q8 X-Received: by 2002:a63:3fce:0:b0:45a:2bab:6002 with SMTP id m197-20020a633fce000000b0045a2bab6002mr28608992pga.454.1666616550686; Mon, 24 Oct 2022 06:02:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616549; cv=none; d=google.com; s=arc-20160816; b=JcB+dcUYVPDaLRti8VfYScu/klkuZfhqSZho8GYDFQrMrndivDpDMtprw/9nhgQkJ2 1DWS833gTN7qnfpP4LipwIra6Awcztlm3Gq8v2EG2Q8dTKGhMvd0gJvlKxLCaOdsv1XM CduET8yFTQSHgOOiLf7HYAKeIchjGW6qy4UQn6lgXoic7jqtQgjBuQ7Bx74bV2fqCxdI RILtdU4DHMYo2hIGh7gkzBWy2mWebg8EqgK/E+8DQkbflEig3k4TotbXM+4BNgywqAsz y8HsEO0qigBL5QsOD5dySA43m5tRtSCV8bvU6qHRiYAG+vEO9tJh9joJVXxeTWQso1jf tbZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9QCAc8H4Hq68qOimb31vQi6yMxlzTI0DGahLnJFfsKE=; b=b2ogjO6rXZ+d5SCKtsRJiqYp/CBcGTY0YSxkwmJmd9/jOYx4AH0ckbyqp9u3XPL2o/ JPBeGEcPdo8Lxk3NCkZJntDKA5jId6Ttpy9f+GGpycPGwSbECfDw+nQmxDjd1zhwgqcT cjuS2FZgHjeDzufRkJ0WUWKRHxTVnAdSqXwGuhYCCVGwyk9zUe4geAfQmet1wyLfEbDz mbD6508w7t9pb4mvIuRqDgnwitIe6IvrQEEi650xIKgT7+P6nV5BTkd2z6jQgBcYjtK6 xp69S0MdDz4AsdIwkjnwVwFDUGpoXodYBIvmT3Qb9DhfJ1+yswZJ0K9hXjugFCIUF1ac SK/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YdhWwyET; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id my15-20020a17090b4c8f00b0020d67a4e6fasi17878352pjb.174.2022.10.24.06.01.52; Mon, 24 Oct 2022 06:02: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=YdhWwyET; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235024AbiJXNBE (ORCPT + 99 others); Mon, 24 Oct 2022 09:01:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234930AbiJXM65 (ORCPT ); Mon, 24 Oct 2022 08:58: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 A0B2C9A28C; Mon, 24 Oct 2022 05:18: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 22BF761331; Mon, 24 Oct 2022 12:16:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38ED3C433C1; Mon, 24 Oct 2022 12:16:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613768; bh=iCYA+WieLEMO+7AeFrJuB0qA6FIj092/MecmdHKQVTE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YdhWwyETYg5Cy53QM7Bp/YWZFi8YkRym/pLlqiPhhMTC8XekVXi31GWMgSqZ03vg/ /6SpQWZ/dmNOAikTzKO75xa08kHGPf5Bymw00mCx/lxOztFz5YyrCy8YUnC2iiQC0P uSEYW7L7htVWG5g0PhN45r8BQRNmOVNCbLAaUjfc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Rafael J. Wysocki" , Chen Yu Subject: [PATCH 5.4 255/255] thermal: intel_powerclamp: Use first online CPU as control_cpu Date: Mon, 24 Oct 2022 13:32:45 +0200 Message-Id: <20221024113011.807775089@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574114996389254?= X-GMAIL-MSGID: =?utf-8?q?1747574114996389254?= From: Rafael J. Wysocki commit 4bb7f6c2781e46fc5bd00475a66df2ea30ef330d upstream. Commit 68b99e94a4a2 ("thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to avoid crash") fixed an issue related to using smp_processor_id() in preemptible context by replacing it with a pair of get_cpu()/put_cpu(), but what is needed there really is any online CPU and not necessarily the one currently running the code. Arguably, getting the one that's running the code in there is confusing. For this reason, simply give the control CPU role to the first online one which automatically will be CPU0 if it is online, so one check can be dropped from the code for an added benefit. Link: https://lore.kernel.org/linux-pm/20221011113646.GA12080@duo.ucw.cz/ Fixes: 68b99e94a4a2 ("thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to avoid crash") Signed-off-by: Rafael J. Wysocki Reviewed-by: Chen Yu Signed-off-by: Greg Kroah-Hartman --- drivers/thermal/intel/intel_powerclamp.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) --- a/drivers/thermal/intel/intel_powerclamp.c +++ b/drivers/thermal/intel/intel_powerclamp.c @@ -534,11 +534,7 @@ static int start_power_clamp(void) get_online_cpus(); /* prefer BSP */ - control_cpu = 0; - if (!cpu_online(control_cpu)) { - control_cpu = get_cpu(); - put_cpu(); - } + control_cpu = cpumask_first(cpu_online_mask); clamping = true; schedule_delayed_work(&poll_pkg_cstate_work, 0);