From patchwork Mon Oct 24 11:26:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9707 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp544929wru; Mon, 24 Oct 2022 09:33:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5xAtP8n3bqbQHyAzx2lw8QXh78rLs8wB6KtowluA+PKKuR+TXkW0dwgVTOXRGBIDGKQXDs X-Received: by 2002:a17:906:846c:b0:7a5:ccb:c174 with SMTP id hx12-20020a170906846c00b007a50ccbc174mr7307459ejc.583.1666629193814; Mon, 24 Oct 2022 09:33:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629193; cv=none; d=google.com; s=arc-20160816; b=i9Cm6hxX8aAI9ojX8AuskrJ82z2HDvMxRBKpO3dBkUi1WRh2egz6ShdqEebqf6CIFL pESZ6AJ/e8FQ6MdX4eQvDbqI6xXiHKoog0wLm19eufcnGktPulFyZZlENlkTh3N920qG lKd3nC8oPY4FE7iO64xBUGKnm19bOcOK2UFnAAxAH5C3xBZ8oH80MgPoKqF9ut6Y0+oY CuOe9lfLS5o6Tb1+i1Wkxxjj9nzbDen04/BtEYGK0ZvuX0Y3ZbS40lj0ap9L7vtW2wYF PY7jwPf2CCbHway7DUyJMkZOCMcA6VeRwaAMAFIozi4sUgE9F1UmUk61b61XLd0Vr6k8 Ze/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=JLX3+bbud0xfFoHAWSA6wno6dI4KVrCLC3YcG5qX26s=; b=c9umpJudwpJnMqd0iKmuhICMqU+Pjrn2FxoKa1UM8Lnv4SYlhGBMcVie5gge+qcvTQ Gt5CQX7/XKuEtKP94/I3SVyvQhd+PBOlgN8tNOfc+9c4kmSNw+1FBvmSIR/xl3NW9Th5 CDdZc68lvkTDj0hAS8jX0tmDGh8D1Jf7X6xBolEiTyeelXu6HO0qbOBcWG8IaUCM7Oid SAvUW5x6iXZPgZr42eKYSPD7IpkCLabga72uAwl4/XJDJ/v4zlXyyiPoCBffYE+oPOY5 z+92lu2kmyxDx8UnUX5oQTppUn9DH8n3FOB+UrnJCHj+2/zQBVEWVnr285mbqpYPHEOo pf9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YGRli9ik; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf34-20020a1709077f2200b0078df6780adfsi227551ejc.22.2022.10.24.09.32.49; Mon, 24 Oct 2022 09:33:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YGRli9ik; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234082AbiJXQQN (ORCPT + 99 others); Mon, 24 Oct 2022 12:16:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234356AbiJXQOq (ORCPT ); Mon, 24 Oct 2022 12:14:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4916613226D; Mon, 24 Oct 2022 08:02:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B8162B81338; Mon, 24 Oct 2022 12:16:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 190FDC433C1; Mon, 24 Oct 2022 12:16:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613789; bh=kMvBlkjmS9JmIfNXHRt9OvFXZBDg4ubqH1ggpRsAn7E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YGRli9ikFXP6c+x38J5LhiocB9zUh8uaK3NFd/BCJisOL9dJfFS162XAn8K0nZq7Z YBhe18gdkMslpV7ZKM39aKnIrxzVwl5LMhHk1EIrz6ENJ4tmi2doeWo5+woI+iI49H TAKpuhqKtJCPlGGVa43rSb4wvrk19DhGINw0thxM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.10 002/390] ALSA: rawmidi: Drop register_mutex in snd_rawmidi_free() Date: Mon, 24 Oct 2022 13:26:39 +0200 Message-Id: <20221024113022.624825696@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587373470081389?= X-GMAIL-MSGID: =?utf-8?q?1747587373470081389?= 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 @@ -1736,10 +1736,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:26:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9712 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp545195wru; Mon, 24 Oct 2022 09:33:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ALWcaf6SEDLo7RmZjHpirL/FjDKPAFDYGUdKnUjM7NiFuDtWsZ4pWkjrPiYZ88pxN8AXH X-Received: by 2002:a17:907:7ea6:b0:791:81f4:b0e3 with SMTP id qb38-20020a1709077ea600b0079181f4b0e3mr28857969ejc.164.1666629233769; Mon, 24 Oct 2022 09:33:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629233; cv=none; d=google.com; s=arc-20160816; b=J/cm5hHVBNYkOnWLvOS22cfmAUIX8MFvcODNrpmYo3+8txrJ5PmQ7aGRsTUclpxT1o 9ci6u4kHXn2lvPxcpnOcPHeewHCBfdd0LlmoUzSocWGxSnexi3V4al1+ZJ8/dC3zkVgo Wrn79qLlADODJ4KL6qDnRocXVsGfZWpyaeCDi7G35V8wMRuMo4r2kXw+Yf9ox2kC0YIi GfelyEXyNefeuIdT7ToOxTFZkVgfSgRXcTdrxF2eFxIjWyUw4j1wJ9YDpO0E7dJZyyOf MKa8tRqH8UUsbj2MfhUYIG1e3d/VVvMluOh7H/AMikEZMVyHnCZXoTOGVk70Rn0xDIZO 7L/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=e4WF8MZKOWxNjYn+IQkC7LfUxfwFrA/TYSxCWE4Pb80=; b=IiOyRcs4pYUOHHURhf4TWHLxjBLCR+9EAJVWJt1I4JIveKOeAZQO1AW+aq5ceoDJfD wGX9IPA6mABOPcLWhOs/abXbhwGWJaVxf+aXJyi+wAGPbUxNSh2nOCDws0zsEd/ONIJE YpKWzpbaUAFYUZPHw2axcfR6JKltih6+rkJp8RiDDRm6RIWqlhgaxNku25iYeK6IDYWC xidITUfJ1vZU75hTavmW305O71+Hiy+E2r3Dy/U2CKMBDL5kF4GNnr8JxeuSFGMVRO+U 5a9byvUgJJ4srQrldisiAME+SPYOIQuhZuA19bUR5LglQGjX3gvRcJc9r8gYk+e+b6/0 otSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=L0ZtmSr6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr13-20020a170907720d00b0078db6f488cesi297158ejc.112.2022.10.24.09.33.30; Mon, 24 Oct 2022 09:33:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=L0ZtmSr6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231698AbiJXQT6 (ORCPT + 99 others); Mon, 24 Oct 2022 12:19:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232196AbiJXQRX (ORCPT ); Mon, 24 Oct 2022 12:17: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 1D6C0A98DE; Mon, 24 Oct 2022 08:04:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 69352B81440; Mon, 24 Oct 2022 12:16:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6660C433B5; Mon, 24 Oct 2022 12:16:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613792; bh=QALW6qxGWjYOL34jei31N12I63Ao9E+i3afP07mCzJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L0ZtmSr6NWHTSCLEes4nMK/xxWxH+Bj8ZXbHT9g1h7HWLL/rXW6enNAzLoFHxZqqf ev0a0gkWugfaFE3n7dO0OpGzHbZEPh2ASshbo3rdecYYfwAwpPzBc3L9Wkv1zS0nRN Tw0aUl4ozsa6Cn5+0Lau3T4Cmbzo/6N76Y4M/IJ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.10 003/390] ALSA: usb-audio: Fix potential memory leaks Date: Mon, 24 Oct 2022 13:26:40 +0200 Message-Id: <20221024113022.677325981@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587415753051892?= X-GMAIL-MSGID: =?utf-8?q?1747587415753051892?= 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 @@ -998,6 +998,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; @@ -1017,8 +1018,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:26:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8986 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp439245wru; Mon, 24 Oct 2022 06:02:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6UlnJZZn/3uEriqNhCQjNDjiW+PrZzdqwT27kuA6/VXLJZgUWvm9QVKUfS308ji8G8DDDD X-Received: by 2002:a63:2212:0:b0:43b:f03d:856a with SMTP id i18-20020a632212000000b0043bf03d856amr28195937pgi.192.1666616546834; Mon, 24 Oct 2022 06:02:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616546; cv=none; d=google.com; s=arc-20160816; b=W7FFRwsmyh9xuJXWImbGvSgZSO++aioOfiM16zKX8kzRsUMgOo4vz5zSpqZqiK3GGj kJaBVUeytyeDT52M72upgEUVgDZSKbZVsFdkdr05pJhM8UEbvk7zvYWybgElE37818fW Eo4ynUM0iexPXYLuUuvy0987Nxw0xaF0lwX6EtWjfqGPAvpTXISCpScD6ZsxyhIdmU4/ wRia1DLJndhtZMFouOulSxu2BmyD3eLGxs3og4EX8ZJWO6At5aock0F1boVvFjLDAa8W jDAYvGEK4LgjZ4MnLR8UWkG/FVRVUZm1GDLB2BoEUyNScteJasBD6f6rRvGU2xWncJRv ci2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=jKt8lRa4GcdQtEx8vZEJw4m30LqVO/V6nGdM0scZeiw8VofJf7NMYEQwb7EmhHHYFn Wje6iyvv6Pq/362B14QMmM5EFTawvOWC+izzFUz5nS+UbW8QzLYKQJ2FkF4nkU/o7bNx EWDJrD0pYwkNAJ6kTd8C6EIoPbMPc5ao8ALTgRD+AW8u05/+wz2XqFt9GTJISWk3JRWx TprjALRgC3ivCRovVrSDrBDxSRnclgXnoVEl+/gsJTruOTuBvAFU5Wv9zFHRHfIkcU9S KmtfLuKLTgzpxFYXzKfw8d1da6soW8BjDZRikZ9lW0vuZWWQfUiDxCYIud1LYNCekGYv sDtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QBs+AQLe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a631f14000000b0046ae8195c0asi35799571pgf.611.2022.10.24.06.02.03; Mon, 24 Oct 2022 06:02: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=QBs+AQLe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235091AbiJXNBX (ORCPT + 99 others); Mon, 24 Oct 2022 09:01:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235011AbiJXM7I (ORCPT ); Mon, 24 Oct 2022 08:59: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 5515B9A9D0; Mon, 24 Oct 2022 05:18: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 3476461336; Mon, 24 Oct 2022 12:16:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A850C433C1; Mon, 24 Oct 2022 12:16:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613794; bh=Lo+CknCpFzfV4+jmHuHa+7rRUKqZ5GoheRpToAyZR2Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QBs+AQLe2eSR3JQ7gUySDUeUqrhQb7LiKoeOBl1x/Uvh7PV6OmFuAw7eVkfaYbxam KS7ks/uk/AC+oKMgr2vRyZVX11PZmw115opUQYUvm3sdS35bLxQV0JOAIADaO9JZNW zUqPGADv+9neSWp+uhq1zGlXn0b0HhCa1PaslT9s= 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.10 004/390] ALSA: usb-audio: Fix NULL dererence at error path Date: Mon, 24 Oct 2022 13:26:41 +0200 Message-Id: <20221024113022.716441526@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574112573763606?= X-GMAIL-MSGID: =?utf-8?q?1747574112573763606?= 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:26:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8994 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp439884wru; Mon, 24 Oct 2022 06:03:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4w7NEmFMU4pJspx/qmKjeZTCAizx+kSPmvCs3bMFhmvUcnDLbpiTscVfTVCOIqXqGa7NL7 X-Received: by 2002:a63:8942:0:b0:46e:c02e:2eaf with SMTP id v63-20020a638942000000b0046ec02e2eafmr13968553pgd.394.1666616608309; Mon, 24 Oct 2022 06:03:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616608; cv=none; d=google.com; s=arc-20160816; b=bfFuRE1RyO+cILjDHFlo/XrVVG6KFLhbgDA1NpJazXmKSyo6zfrGjcSXREKlbP4yAX m2rUrWuCjBh7bT3ik5LPG2jfhpLeW1RoIIGPZ75q05ZZcG6vail5Ak07MvCXPBdwrTvU oLE/x41anceOhCYxAnCdfmpxBfDn+JnbWiWGW0zT5i5b3RluvhGjm/IakxVBl4l/cHYR wcYiB5lH4myPb9KJO7kIoPMSKc40oo+6CZHKP8tuyPPoVfw61v+SS/eTmnxUoszKelk3 ElyCOidFUHyOxZ11nllOLRGTuLKHYeMQuORqC6HbYUbT00iym73giQK3u4c+JjGsLZT7 yatg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hqD9q0SdEqLRnVrN/9eUBaqCBBbZLCZidD/IzlXqgXo=; b=qnoM9D/i2MXnjilRH/V0yUSWc0dzkhcI2kntte79RDo3/LlBQYp3RcP+TE2CjoNavZ CQkBYvHoBIuXRrWAnoufMQnJG6N1rfj0amToUTfyc9vwiI9EYZpcQvNRNQTjm/peDrJL Y/aOxZ0+6pGIpM+h1EOaoJOIA58/V77iuI8RSsMfK1S+IuQEyJMDJ1S2DzdbLdvMhIXd nTvwHKpfGIrxNHKlWqbmUaivsaWZq94CU2cjQUJXYXWwM6rBdEi4hM1TIHFFXe6NykD0 CRhVwQabBW4xSDWhoffzOF6TBWkueJAAyHDNjqsmlXVnM/vtQRikzoecpaNyGaKC8xj6 2kVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LACqWbE7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090b390200b002131cee8cd2si2436567pjb.10.2022.10.24.06.02.27; Mon, 24 Oct 2022 06:03:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LACqWbE7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235149AbiJXNBs (ORCPT + 99 others); Mon, 24 Oct 2022 09:01:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235050AbiJXM7M (ORCPT ); Mon, 24 Oct 2022 08:59: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 8DC739A9D1; Mon, 24 Oct 2022 05:18: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 D2C36612B3; Mon, 24 Oct 2022 12:16:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0B15C433C1; Mon, 24 Oct 2022 12:16:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613797; bh=C7Sw+F0psfsIdMKZyZ8pozfOSTUPYIlLKRPvT+MdUd0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LACqWbE78aNVxDQDSBDXmox7MqlSfbOIxSELlbmdQwdXi5kuWemUOAT07l5O4dXuP jos2vB7XoU+IsCcm/f+f7KbQMiEVRVv8RP4GrJxAsAjmWXpKS0xY43A7ff5w4bDqWy aZmp2bQ7oIhB0yqXYhRnoKKqqLjpYlCwtutSaLBU= 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.10 005/390] ALSA: hda/realtek: remove ALC289_FIXUP_DUAL_SPK for Dell 5530 Date: Mon, 24 Oct 2022 13:26:42 +0200 Message-Id: <20221024113022.766721768@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574176923188231?= X-GMAIL-MSGID: =?utf-8?q?1747574176923188231?= 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 @@ -8774,7 +8774,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:26:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9701 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp544527wru; Mon, 24 Oct 2022 09:32:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Dr5dvqlgIOK2h6g+/cdShsEdN/t/9FQYfo8ZpIkY+VRN5UujxmgCQBuX1xoY4s/bgt0OJ X-Received: by 2002:a05:6402:2402:b0:45c:a1ce:94d8 with SMTP id t2-20020a056402240200b0045ca1ce94d8mr30657995eda.50.1666629134238; Mon, 24 Oct 2022 09:32:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629134; cv=none; d=google.com; s=arc-20160816; b=ws5megnhtDHJLB0RucM8SlOIcVP+SHkmI5fb36XVnRb07mAe4E5PvdYkah1DZc2FiF 9AUwNfiA5ImdAE5T7PWgR4PRWKF9q/BN9IdX/ZWeswyoSl2pmspfu5kzI8UWgFXWqyam xV2motfAEF9vg78uDX3yRhvLbbm3UwG787a70qz0N+D/5Y25N7B4TX3Qju424P2etcDP 16GYqRAYYFmba2GOlDVMp6Vxpcz4asR040l4hX+I+hnC2Ae/9NHtifz9lm/+l5MBpCa7 k95Av4C3vR9Z4SPNlTT0Pcz7SyOGot+w8kYdRx9VZE1LJIrdLIxW4dxc7wZF/smPiBQ6 n9GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YZ2af+C9R2joNuFIL1fBqwGPoJZpy8V10R0kK3uQk2U=; b=upMXoNobUaJnOTsIyP3DjqHFiZ/Mk1tEaE2hL/ulI5YCEF6duSeUHYOGhFf+JE0N/4 j3yA4MYjuzFvPh3zXrOIpMT0jK+/7Oet4gBbG63N6HSDLsUrHaukSwkk1OsBSqo6+ezd hAhLQXyfES/5tjnNXG5qvv9nqwFkokr3ionoW4eAOwl7mes33YXwK72QkUdyrHptHlRo XxsMJXJf5jKOwzb+3w5NZlOC3TgHwZPjrihDvjvTkVY27REWmmJnmCNY5faeHFNy4eQk 2RbesZNE6uTWPsmpD+QEiu/XfAxZR06KACMXhSv5kfUghIED1Tm68eV0E78L3O50Bt7K zHDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gAbDdcYO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nc41-20020a1709071c2900b0078e319dcca7si137625ejc.744.2022.10.24.09.31.49; Mon, 24 Oct 2022 09:32: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=gAbDdcYO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234259AbiJXQRf (ORCPT + 99 others); Mon, 24 Oct 2022 12:17:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234956AbiJXQPe (ORCPT ); Mon, 24 Oct 2022 12:15:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BA0760EB8; Mon, 24 Oct 2022 08:03:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3469FB8136A; Mon, 24 Oct 2022 12:16:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 869B5C433C1; Mon, 24 Oct 2022 12:16:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613799; bh=ON42auNoq/6lXJFVhSsIvjJPz13Pw5e0sfxqq8I3Rtc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gAbDdcYOlCWMFG5Ig1LUCT5EjdImwIqQgxsW+EI76ZE2icHUPeSlJPFnhpZOXJG6a 4HjVhobZOigYDjagHWST2A1zFQokhohm8pOAL6bUXKdLaDIoazqCKW1wZVp/KyvXrt B3rtO1ZKDd3fFqclL1tO5QE1lvjEeKHjURXfXYLU= 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.10 006/390] ALSA: hda/realtek: Correct pin configs for ASUS G533Z Date: Mon, 24 Oct 2022 13:26:43 +0200 Message-Id: <20221024113022.813671515@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587311023068392?= X-GMAIL-MSGID: =?utf-8?q?1747587311023068392?= 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 @@ -8164,11 +8164,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:26:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9700 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp544489wru; Mon, 24 Oct 2022 09:32:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4iKb34wqCxqxoVxJyF2xXoen6c2KbxmZarg8FEinpz1/t3RoFp2IpS6Fu1NasZKarPltF5 X-Received: by 2002:a05:6402:1052:b0:459:2c49:1aed with SMTP id e18-20020a056402105200b004592c491aedmr31519495edu.212.1666629128121; Mon, 24 Oct 2022 09:32:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629128; cv=none; d=google.com; s=arc-20160816; b=B9V+ddjSqol+iXj75DPOGwGocILlhDc4OH+Cnv8bAu3v73f47q4wX+GXIo3Kes1QXz 5amLaOUti4XeS++np0s+qn5HRRBboMC6vkESAfmm/KbD/Bvb3K7mceNtZJfEjzSAO4Br i0305fhhFp41/gYqWxeW+4lNxLjGc/SaXut2jvnaGDU0bwzOdagDd04dA4bm6yA4ibtr 9+K8lX0JhEsErYNX8Lqx8VyMTZk/A9jrlDii60QA1f2DWDjy4ajM+Uw4yUh1SvhkaHlv 1xsoyITTr+6oTsUVJJ4BrMDyClBW3DsyhL2tnklG4uaiz082WuDJir96wiKcJxdFHeXS Axsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GmW00KErZpI77BHFfgNqKp068zye5byssXLbjIocIus=; b=O1N30u8dJ4H40WQ1uYBFnFjJ8kygIRuUJqMc0Fw+Zkof7yhaIOaKxFJyKcFt9ixhGi 9J5HZySahqv9JNybfS/KiLnyQbm8nTZgOT/4d3z3MlMLfZQjsn9pAqag8WGIiAD/F5+E U/siI4dAldX8VxIKhjRhLKk8vQoIvIv1v3uapmFFt/BvT9/HwQsibcQgqkD4sZBw0LA4 y2SjtNviua0XaSqEYMkihncCAGHNCCur0oNScOVFGIjGlyc/YUmh0WaDzlrT86R9uvW5 QDRK1sKu6RVZBdCQCB61nHxMrZVyTybC9W7GtoJxFb72jH9xCaAVSXIpVDFk54JzimBz Ni1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aSWPkpF6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bh4-20020a170906a0c400b007806964b2fcsi153745ejb.447.2022.10.24.09.31.43; Mon, 24 Oct 2022 09:32: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=aSWPkpF6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234250AbiJXQRd (ORCPT + 99 others); Mon, 24 Oct 2022 12:17:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235033AbiJXQPl (ORCPT ); Mon, 24 Oct 2022 12:15: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 7B85961D81; Mon, 24 Oct 2022 08:03: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 C4D14B8154D; Mon, 24 Oct 2022 12:16:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2070DC433D7; Mon, 24 Oct 2022 12:16:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613802; bh=AbuQCeILg0kBhjn0otysosi7ZNgW+nFOsErXi1h/RQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aSWPkpF6i9lLW9xcTY/UNXMt/dpYu/xAMSUuel99jcBEGjY+Rglu/OcjP0oTuUZF2 DWs5Qub0Zzeh4bTzRX+kbpA2vBqENrJSFrpsz9zMketnZSB0h6gdqrDVVKIcbrofA9 3H+UxqNHR1ruzHPWa1pC/mzZrbGqClSLOSlfXnTI= 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.10 007/390] ALSA: hda/realtek: Add quirk for ASUS GV601R laptop Date: Mon, 24 Oct 2022 13:26:44 +0200 Message-Id: <20221024113022.861447525@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587304226606511?= X-GMAIL-MSGID: =?utf-8?q?1747587304226606511?= 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 @@ -8964,6 +8964,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:26:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9151 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457553wru; Mon, 24 Oct 2022 06:36:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6M8evQhZKfb8ieIDL7rmYk/NfirD9vrnRGYIYtgTzj5SDMnQQ1XCRVeiZJkD1DH4ZLBXLW X-Received: by 2002:a17:907:1c17:b0:78d:df89:26c6 with SMTP id nc23-20020a1709071c1700b0078ddf8926c6mr29275671ejc.20.1666618570879; Mon, 24 Oct 2022 06:36:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618570; cv=none; d=google.com; s=arc-20160816; b=BGCkuvWoCyKApB0XjEwbB3p3shLJ68eir6Lc0Wjm6GW12JWweF+LvzwWECHy/jjPzJ AU5DPVZE0OGSHrfjhKkPSfeWyvlhoHo91cBOk+ePVbNdAw8WEg4oY1YTBcXhzvnCBYn3 +NWKCRxe2dRqvKR91mVgy2rnEHDB1eh+twv0DB4hQ79TsK0w7fIVFgLPhIx5lFAkZLyd jUvEQfRZMQ99jVK74IVYUYGk9i5vGbUMpuyNvc++EyqHatYKB68d1+EixURV1dfP50oc iLcWIIB1UskvYO0tSYpQsp3cpl8PjiKUDKUAqq6Et5WdT78B899V0eyIhwECFHMfFcmk 5bxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PDBVCYuMQ8f9dOTzjWmiLlSMPw0C2091ScAULO2CzdM=; b=uQFrAxADZncDjyqxhp5VQ3MAcFg9/RdY+uXNsRb/He2EfdpDt/mEW7GLBN6uObsltx acYtkZCzv9UN3ipIMbgvhR4UAgWqQe6M8AMenhKUfQBXfliR647H/FPethEfl73dO8tV VNnwWl2ucLbQNWrBWlxT7lLKL8l3CnrlFnQPHkgsDC46qNRPEMFCVfuKGmZZxwRcOLpL b+E25dM+ExE8/wBvIyBD+9EoncPnyMMWakOyEtIp55s9pepFp0pBxaMt1vAvu+TtlRnv Uif4DU8q0AdIB6AkM2XoiYziVoGm/ZYdBryYMFx0ktCmJgdEF2CpoZsV+FYyGutQ94Of zNvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CcbgLdU2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hq31-20020a1709073f1f00b00783645da4e5si30769237ejc.582.2022.10.24.06.35.27; Mon, 24 Oct 2022 06:36: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=CcbgLdU2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233150AbiJXNWN (ORCPT + 99 others); Mon, 24 Oct 2022 09:22:13 -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 S233443AbiJXNVC (ORCPT ); Mon, 24 Oct 2022 09:21:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C07BF876AB; Mon, 24 Oct 2022 05:29: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 A035B61280; Mon, 24 Oct 2022 12:16:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0FE6C433C1; Mon, 24 Oct 2022 12:16:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613805; bh=hrbj3D/Rrt4me43Jff/FRrVgjPpISerWoFzxRiWQGmw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CcbgLdU2ot32++HaQ//l0Rp2rKllp3ByqKP2BTNktIlprKHVdJZ9uEvgKa5rTikq1 8pm5jEwr8wrI4d7wtCTU02yUNCqWBJjm5LhQTMRzhQ7vI30VoNlKKIYxGCWmjIyIDE vJPRAJpp+0F72PP6V8BGtm99SuIj6yYdjv9mQQ7M= 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.10 008/390] ALSA: hda/realtek: Add Intel Reference SSID to support headset keys Date: Mon, 24 Oct 2022 13:26:45 +0200 Message-Id: <20221024113022.910682345@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576234504734201?= X-GMAIL-MSGID: =?utf-8?q?1747576234504734201?= 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 @@ -8986,6 +8986,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:26:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9704 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp544620wru; Mon, 24 Oct 2022 09:32:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6iOihj0qJhU1nVWq9HHv6ckxW8M1OHIQNz1oCVT21gkIz30wRoYKWjWygTjORL3ab0XP1a X-Received: by 2002:a17:906:9750:b0:798:9ccc:845d with SMTP id o16-20020a170906975000b007989ccc845dmr19149972ejy.760.1666629151700; Mon, 24 Oct 2022 09:32:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629151; cv=none; d=google.com; s=arc-20160816; b=a0nf0rXPVIA4JFnGAAaut116GDzlvXlq4qIC4ONHuBPhvhBelNqM/S8F9X+OUljBnx DUC9yVtg6wZGaW4ZsI3f2whQEWuzWZzFe4tzrAF51eX6NeJHEEJ7768l9HPZH/Dw7CGL vaFuaxKIzqHm4f1IG+3R9LiIKB4h2y3qgWcc7TGPAjgfs/LYIvW8ehbENar56Cuv8cE7 Bi0+QdOdqzFGp9BNJiEYHYGy1L3SoFo1/2OzeK/0Vez5zgZe4O0SDa0mSZ/w7givmjB/ 4E6F4MQ5j81MwJ5gQEpZyQXi+0T6WicEgvIUfd5p6dgoC9kDt/xOJI/rVGWMiaRuUhz2 S1Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ICerq/AfOym981P0Y+JYGeCVM6Th1jVdBD5o94nQtNY=; b=a3bx0deXPND77+tkei/NXmV4ShysYwBULl3t9d8aa23Dhko5sl5aHqHv2sPQhq4xNF nAjtMavtOgUi8aD1aG1F9ncY/AKB/wWpuhzvct9hl792FGggzB2I3tjykVpS4/msiwT6 S5brevR6himVFWwFuD6l5w5DnfQr1h2CMKFBXGSYqyewww/yadsN8xBlhKbuG5An6hLK XVYb6UlripgtR6q8cvl4wCQ4ZQYRksMOdJnQKka8iyJC9yXhJiovzqWizF21ZHAtNIGy 8IN/2ezEmsaLkukCjiz9Mu/tsYVbVNZiLZOgFoeGTPWJzH1m/f+9lia/HiXsk/N5DNWT OpLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0ZVnhIMf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y11-20020a056402440b00b00461cf92400csi218851eda.488.2022.10.24.09.32.07; Mon, 24 Oct 2022 09:32: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=0ZVnhIMf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232907AbiJXQRo (ORCPT + 99 others); Mon, 24 Oct 2022 12:17:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235082AbiJXQPp (ORCPT ); Mon, 24 Oct 2022 12:15:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DB4D10B70; Mon, 24 Oct 2022 08:03: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 E6C08B81544; Mon, 24 Oct 2022 12:16:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45E2FC433C1; Mon, 24 Oct 2022 12:16:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613807; bh=0LcxMqzKBXHZAcPKt0pyDjPeM3azFWJ3SFXQ6kVQIP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0ZVnhIMfkVKTql0nbnY5j7N6fxgMEe9ZnOaTigLdCnzHqFmsXca4xnJWGVxZjWRgQ WmttXo61T7Ja6zQK9jJyV6vMvBgIvAAfilfSh7t/hRpb6SZ9C4Sd6rPCoR+npVgKvO 36pCRu9fpO6gKoCQl2kJm2gRkicBz+zvaOpfz2Zg= 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.10 009/390] mtd: rawnand: atmel: Unmap streaming DMA mappings Date: Mon, 24 Oct 2022 13:26:46 +0200 Message-Id: <20221024113022.943634207@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587329148554794?= X-GMAIL-MSGID: =?utf-8?q?1747587329148554794?= From: Tudor Ambarus commit 1161703c9bd664da5e3b2eb1a3bb40c210e026ea upstream. Every dma_map_single() call should have its dma_unmap_single() counterpart, because the DMA address space is a shared resource and one could render the machine unusable by consuming all DMA addresses. Link: https://lore.kernel.org/lkml/13c6c9a2-6db5-c3bf-349b-4c127ad3496a@axentia.se/ Cc: stable@vger.kernel.org Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver") Signed-off-by: Tudor Ambarus Acked-by: Alexander Dahl Reported-by: Peter Rosin Tested-by: Alexander Dahl Reviewed-by: Boris Brezillon Tested-by: Peter Rosin Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220728074014.145406-1-tudor.ambarus@microchip.com Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/nand/raw/atmel/nand-controller.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/mtd/nand/raw/atmel/nand-controller.c +++ b/drivers/mtd/nand/raw/atmel/nand-controller.c @@ -405,6 +405,7 @@ static int atmel_nand_dma_transfer(struc dma_async_issue_pending(nc->dmac); wait_for_completion(&finished); + dma_unmap_single(nc->dev, buf_dma, len, dir); return 0; From patchwork Mon Oct 24 11:26:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8988 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp439443wru; Mon, 24 Oct 2022 06:02:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7vOZ2H610salWiYmrSN2RwukcES08cvXbzF1woQqhu/l50hrGmdhq8qylLAVUKEx3WakPj X-Received: by 2002:a17:902:d485:b0:186:bb44:9459 with SMTP id c5-20020a170902d48500b00186bb449459mr359885plg.101.1666616565734; Mon, 24 Oct 2022 06:02:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616565; cv=none; d=google.com; s=arc-20160816; b=yWRHWlPshOW37KanHsb+ecJIWk/xbyZqWY/eUGLXqhlVoYlyiydPRDR7wA5ESNrQNg 70O1hOcRx2PhANvP6M8hfKRcBfdGH2YEjZxRFJLVAakmroyEKYYawMZK9KKd5E1l6q/a xQRcJ9dSaw22OdsIMxGfTgTUg5J4bY0MRBVLgS9rvwTSeg9/lKktOSvGhWFA7L87WQMM h2/6OWXhWCvakWdC/PwyS8Sl9LMxcQMdtMlR84283iiCziknPgnt3FeGDxE+Kitixk6+ 75Tal3aGt3Mn0RzGKCZfx/fnHZNBHZmXhQvzYTj5jy2FO3iHSIOSpGiw/0I2+XmzorAh MjTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2xbjc9z3iTAHZRokWY3K57VgfZJN4YQAHWMCobO9N5c=; b=pir6PxpwKVHROtp9USQJHGg3enSlC2E4rYcaeQMvjme3V2ALlHu/WUxHPEavfXGTy2 9Oxy9a6XJArck62BjtvmBzfVRsMPnueF7oMEz4zzp1Hz+XxuAktL489J3vxckPbsI0y+ l0yHjqdYgXVH6gSTJbLV84Hr1E/561F3I9x4mt7PaqwAtRiYQuJmjpRgp8Lyq+InSy5X AxBaY30ozl2rVRa/ubiBBxjIWou6hpaJizuMZBD0YO9k3gBelomNTLFCVlf0WUW6lQo7 qctVh+HJNLXJYalenIdX+Qnik3uPvsYDVaQ5dkxqH6t/HH54y5e8Tpcg7fTPfUBPwRp/ Cq6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vtiyyUWJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e23-20020a635017000000b0045a6c6c559bsi34747183pgb.305.2022.10.24.06.01.57; Mon, 24 Oct 2022 06:02: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=vtiyyUWJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235075AbiJXNBT (ORCPT + 99 others); Mon, 24 Oct 2022 09:01:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234982AbiJXM7E (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 9D4A495AC1; Mon, 24 Oct 2022 05:18: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 EC9F5612FD; Mon, 24 Oct 2022 12:16:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F320C433C1; Mon, 24 Oct 2022 12:16:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613776; bh=oUV8zeZQN2y6uAKtvwYQIIk6Cb4xc8dJvWlOpMz+ogA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vtiyyUWJE9TDCoiw3NwthZjG7TYL+JMCRD9PA6AzHJmUgeRpCqA4GE9tLIG/mgEoS WxMuU47oJXkHiejRpaUgNuJUwTik+75uNVeDM2r+9bjH4M1NQ8Xp7ILCb/YCG/3URK 1DyltbX2PmNG/ETC2plL4MkCEQWtvInSTdcxqB5Y= 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.10 010/390] cifs: destage dirty pages before re-reading them for cache=none Date: Mon, 24 Oct 2022 13:26:47 +0200 Message-Id: <20221024113022.976438310@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574131630562654?= X-GMAIL-MSGID: =?utf-8?q?1747574131630562654?= 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 @@ -3936,6 +3936,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:26:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10186 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp641478wru; Mon, 24 Oct 2022 13:35:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4T16z9xRjsiqvamyfoMx1vn944GUJq2yR5wKF11d245vdRztN6atoPnhKitjSP3/GEa6EF X-Received: by 2002:a17:902:cac3:b0:186:6ce4:f94a with SMTP id y3-20020a170902cac300b001866ce4f94amr22381460pld.145.1666643728852; 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=SgPesWEtC3bJ5NX7OCahMST9U4T4gwbFaQjhu5U/ujGySVKnVw+uE7EYxuatMIW36T 3QU2s2BRjT55r0evD4BX6U3KIvdKz73meaj+1XnHhOAEMzRU9VQnEAzhCtOwmEhQgN6u G8yvRXnJUp9Tqr/8qmlW89I83DU8jPtLIBbK5Myh+LRtd3vxwPyVxJiJfhuEF7bPSfMj U7tuHT3FphHmr8W5BVDMgkDkkwWjkC9jjKdkEjH4l5wscI3gn6zFOliiZbh8UBJH6vmq QN3Q1//tw6AP8YCFFA7wz/EJUzq3qS3VwJVYgJRsUyQE1pCLmqa4PK5zaePxVVJfFzj5 TU0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xIiFRRikePwW9pbr+rDL6GtxfJv2uYHgCFJ3GmTSh+4=; b=qIhHMwC16PGAO17LMBeChiLqI5oOunvruOzYYg7fjD6OQFFe7K0dn47xbEs7ZOLcFQ PtB9Lr8yxU52gyVvrK6pEns27Z3iMwtQnEp3sLLLUWq9ShGnsOLkw20q4n67WW6NiEit hNmaMUvmc6wd4KpSHBnWuvxCjF4tZfArr1U556zVJnAE0AayfHGfwSOQgDfTJDHxk24q UA6WIWnsNyZamR08lrQXDELcMouO4tXfTQJDNB1pmGcPyBH6Tm8DBo84osSc96wqBRIk rKTC+NEZqvjMvWjBN6JvoV55jlwTD1lp62uVtvYgP242kgcBftGzIJ6er251Oa2mVV7R m08w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Cm1XkriF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a63-20020a639042000000b0046ed15a820fsi492999pge.672.2022.10.24.13.35.15; 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=Cm1XkriF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233801AbiJXUZ1 (ORCPT + 99 others); Mon, 24 Oct 2022 16:25:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234286AbiJXUXj (ORCPT ); Mon, 24 Oct 2022 16:23: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 51884360B5; 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 5C4D3B811B9; Mon, 24 Oct 2022 12:16:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B10E5C433D7; Mon, 24 Oct 2022 12:16:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613779; bh=qYKM/knQ12F6UlTUM7FZHtkKGNyWjWZQpvghfT6Vky4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cm1XkriFDjlcpcNxjIa8GR2lwZk9G1t30K2A+4OxHS0RBnVznJQfKQm/gQvZfI8fl hnkTc8Cqr5fGD3XNRJmlpSxK4fzAWkOXCLOg4uLMCCUbj/AHLE6hONqJLFxN7egWQR yiYTCV+xe+YRII8JC7gRH9BTPM3REOPXN7lb9JYg= 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.10 011/390] cifs: Fix the error length of VALIDATE_NEGOTIATE_INFO message Date: Mon, 24 Oct 2022 13:26:48 +0200 Message-Id: <20221024113023.012197841@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602614392823450?= X-GMAIL-MSGID: =?utf-8?q?1747602614392823450?= 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 @@ -1075,9 +1075,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:26:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8992 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp439685wru; Mon, 24 Oct 2022 06:03:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5qT6TMBfe6L1yEs+DJgHXHot+I6TCQ01ZOkhVELb4/b+0uUbjH6Zec4C0NWEfHkgzl+END X-Received: by 2002:aa7:888b:0:b0:563:aa1:adae with SMTP id z11-20020aa7888b000000b005630aa1adaemr33394498pfe.15.1666616588495; Mon, 24 Oct 2022 06:03:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616588; cv=none; d=google.com; s=arc-20160816; b=DGNhVgV3cndCugf2dSnjFatB6mnRuCDKgZPcqZ2hdHpmVLE4if9gfeZ+IXeR+L/Lv7 jaTzjDY7uadDU30D5sPZuZTx2OZHiSRTdvBJVJz06tUEyLxsuShdeV8UaasQ0EEmF/u9 aLs38SElyz6GWZoc7DzGmlxAuf8sw7NHsDo2Vcvy+QfyU4VyoBiTP5anQgqJk5PQzq8q 0QlFvwsl1Dhvw36S4cSmDZ4L74wpIgYSDuH34BKzCN/Ys53VDypPu8JuWCljpuNbKOxY JzBZErYh1d9cOVrViAllq31nM+Bf8ZjPi35ZHQrKLwwWeO2TAlp+Gv7W0Yn3CrSsYhn4 GOdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jQQ3lBtOkQf+d1Gg3b/h1c8ZppgjH0DXRnlUpyoFj+4=; b=n0PnTxVOCtPx15th7qdNkuI1Nx+1saKGU+aQdtYdLTQ8hHC3jLja9NbvDLyprA64wc Dd5SH2bF6hCWU4q/zM1lXk+2w6RI+oQJFcmbDI6FIEmlUqe5etFAnJ6jxEAmFmfmFkjb FCQBCg3To62sL8D7hZTOGkCVJzTz8t95507XnwRCaDFmtlJZGHCbmH2YamTlgKd2inY/ dQZ45braq2JSTbp13VVaun8LNQXIP4R3nmMlOpxWcCitqYAtk9Gs2gwCf4TK+Kd7bnVY hXpfpy6sgO/rjvT8CGSmEJugQcBFnWgzacdlcGFfyN2AUniQO7w3YdEuLLYp4sh2y8OC Pfpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dUUV09MD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a630002000000b00455d13a2a6dsi33464009pga.571.2022.10.24.06.02.20; Mon, 24 Oct 2022 06:03: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=dUUV09MD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235131AbiJXNBo (ORCPT + 99 others); Mon, 24 Oct 2022 09:01:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235028AbiJXM7K (ORCPT ); Mon, 24 Oct 2022 08:59: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 7932098C9E; Mon, 24 Oct 2022 05:18: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 3D93F61291; Mon, 24 Oct 2022 12:16:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F1D5C433C1; Mon, 24 Oct 2022 12:16:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613781; bh=LKzotlONbnZIXGa7AgoINdc1KVArDb4wRqS7Xv8qXCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dUUV09MDR6R0tJqyHSdJH+uiNYvUBlththBsuokAtDdR+ETWE9xL5WjylAwMhpc4J 6QwnBoHQ7wuhDGCXBDv4/9fvnlzspZDyWVKoeWkSVTbuwp7uKybmKNMcZhsXyHZP7s RMLOEPxf3a0+lGe4M7wuqcAg/yeoF3tAXbZq9kic= 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.10 012/390] iio: dac: ad5593r: Fix i2c read protocol requirements Date: Mon, 24 Oct 2022 13:26:49 +0200 Message-Id: <20221024113023.062788940@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574155875104862?= X-GMAIL-MSGID: =?utf-8?q?1747574155875104862?= From: Michael Hennerich commit 558a25f903b4af6361b7fbeea08a6446a0745653 upstream. For reliable operation across the full range of supported interface rates, the AD5593R needs a STOP condition between address write, and data read (like show in the datasheet Figure 40) so in turn i2c_smbus_read_word_swapped cannot be used. While at it, a simple helper was added to make the code simpler. Fixes: 56ca9db862bf ("iio: dac: Add support for the AD5592R/AD5593R ADCs/DACs") Signed-off-by: Michael Hennerich Signed-off-by: Nuno Sá Cc: Link: https://lore.kernel.org/r/20220913073413.140475-2-nuno.sa@analog.com Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/dac/ad5593r.c | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) --- a/drivers/iio/dac/ad5593r.c +++ b/drivers/iio/dac/ad5593r.c @@ -13,6 +13,8 @@ #include #include +#include + #define AD5593R_MODE_CONF (0 << 4) #define AD5593R_MODE_DAC_WRITE (1 << 4) #define AD5593R_MODE_ADC_READBACK (4 << 4) @@ -20,6 +22,24 @@ #define AD5593R_MODE_GPIO_READBACK (6 << 4) #define AD5593R_MODE_REG_READBACK (7 << 4) +static int ad5593r_read_word(struct i2c_client *i2c, u8 reg, u16 *value) +{ + int ret; + u8 buf[2]; + + ret = i2c_smbus_write_byte(i2c, reg); + if (ret < 0) + return ret; + + ret = i2c_master_recv(i2c, buf, sizeof(buf)); + if (ret < 0) + return ret; + + *value = get_unaligned_be16(buf); + + return 0; +} + static int ad5593r_write_dac(struct ad5592r_state *st, unsigned chan, u16 value) { struct i2c_client *i2c = to_i2c_client(st->dev); @@ -38,13 +58,7 @@ static int ad5593r_read_adc(struct ad559 if (val < 0) return (int) val; - val = i2c_smbus_read_word_swapped(i2c, AD5593R_MODE_ADC_READBACK); - if (val < 0) - return (int) val; - - *value = (u16) val; - - return 0; + return ad5593r_read_word(i2c, AD5593R_MODE_ADC_READBACK, value); } static int ad5593r_reg_write(struct ad5592r_state *st, u8 reg, u16 value) @@ -58,25 +72,19 @@ static int ad5593r_reg_write(struct ad55 static int ad5593r_reg_read(struct ad5592r_state *st, u8 reg, u16 *value) { struct i2c_client *i2c = to_i2c_client(st->dev); - s32 val; - - val = i2c_smbus_read_word_swapped(i2c, AD5593R_MODE_REG_READBACK | reg); - if (val < 0) - return (int) val; - *value = (u16) val; - - return 0; + return ad5593r_read_word(i2c, AD5593R_MODE_REG_READBACK | reg, value); } static int ad5593r_gpio_read(struct ad5592r_state *st, u8 *value) { struct i2c_client *i2c = to_i2c_client(st->dev); - s32 val; + u16 val; + int ret; - val = i2c_smbus_read_word_swapped(i2c, AD5593R_MODE_GPIO_READBACK); - if (val < 0) - return (int) val; + ret = ad5593r_read_word(i2c, AD5593R_MODE_GPIO_READBACK, &val); + if (ret) + return ret; *value = (u8) val; From patchwork Mon Oct 24 11:26:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10329 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp668858wru; Mon, 24 Oct 2022 14:55:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM63Na/iD/TMQX74OiRXNtVmmc8V83Na7PyJgxE+UDFH6aCx5khUmgeTAwPeQH/pdRLlsH4N X-Received: by 2002:a17:906:2a93:b0:78d:b87e:6aab with SMTP id l19-20020a1709062a9300b0078db87e6aabmr29409559eje.157.1666648556510; Mon, 24 Oct 2022 14:55:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666648556; cv=none; d=google.com; s=arc-20160816; b=fMfzrKMRE3yxvCZIT5PNo1ccr1apoVYdCxZImwzqU8NBdPe+8cFoOVw1qv0A/Tvgis wpBwzC74II3yl1fNWkxjW/XIjPTPPDQcGt8tWbwSIjYH2DdtEPA94I1X71LZns3m4GmY /LB0pzGibB7tosJ6MQQ/ZvgmKznI2kaCzi2kh13EaMyhoKWJveCoILe2T3I0VbQLnVRY 1epMwO6yeGBw1y3SZRrWYUKY0jom/Ny7B0RJkZJ/ePvHDy5MuDpE/mtxbIU82I5SGkoz g3L0BtdnGvtuCa28B9LJ3g+V9GWHEmaWXLAB9QpNXXxy9+TZxxScCN+9eypRfkyN8vya P/rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bUz+5s37sHEm/1PxeiFhL6q43PpNa3f+qJgf9K8KdBU=; b=zXIVv5Mt1Cgvs4hNWwE5onH/MSgPFuGaUG5hKsWlJQ6O70Mv/lBJTPYRJ6PdY8fQZk e6FI/JJrVCc78utY28zHr8F8FTr+rMp6SCnhoFLnW7C4QhH/3sMnTM2NHHLeMKwEzO3W qLc3vlyPQb5hppLHq52mbwuDyUtQPTQ/N7iwUGPh2hgfhfwkV48qztgSSmwt2brj8gYn /qQ+h5dEXXwiI3uYK4aNSjz/wW6OGxn4xMQcg/pHejN2ehMsTMM8BeF4nRPNcKlloMss qKddjJ5iGAjQiW+QEuBWfMzcEoJAHSQcyBA0PLvdY9wX5kyDS8ZLaN6ZczIVHneGMO3y xAJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k79026Wl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sb42-20020a1709076daa00b0077b2e822b8fsi1022494ejc.76.2022.10.24.14.55.33; Mon, 24 Oct 2022 14:55:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k79026Wl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231314AbiJXVnl (ORCPT + 99 others); Mon, 24 Oct 2022 17:43:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230115AbiJXVnM (ORCPT ); Mon, 24 Oct 2022 17:43:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C39052E7B92; Mon, 24 Oct 2022 12:53: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 860ADB81186; Mon, 24 Oct 2022 12:16:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE044C433C1; Mon, 24 Oct 2022 12:16:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613784; bh=fS92YeGgAE7/jfevSZZ9qKCTlZHn8Zq5p+Rkx1Cwmg4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k79026WlTHzFCYKrjT841Bw+Vyh3BYTn9YUe+qWpoPhBm/wU/ivpLp80sYBGJhIkB CQ1wquyqJGfUFSWg2HgfjN0JzFor+3uWsbci5XcIg12AsZlEFeu0PVqfMJieHuQeIp Vwa6+mFoM33XDTblu4qLpydMxAtbOWZlanPb/LBE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meng Li , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Denys Zagorui , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 5.10 013/390] iio: ltc2497: Fix reading conversion results Date: Mon, 24 Oct 2022 13:26:50 +0200 Message-Id: <20221024113023.115390994@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747607676305304941?= X-GMAIL-MSGID: =?utf-8?q?1747607676305304941?= From: Uwe Kleine-König commit 7f4f1096d5921f5d90547596f9ce80e0b924f887 upstream. After the result of the previous conversion is read the chip automatically starts a new conversion and doesn't accept new i2c transfers until this conversion is completed which makes the function return failure. So add an early return iff the programming of the new address isn't needed. Note this will not fix the problem in general, but all cases that are currently used. Once this changes we get the failure back, but this can be addressed when the need arises. Fixes: 69548b7c2c4f ("iio: adc: ltc2497: split protocol independent part in a separate module ") Reported-by: Meng Li Signed-off-by: Uwe Kleine-König Tested-by: Denys Zagorui Cc: Link: https://lore.kernel.org/r/20220815091647.1523532-1-dzagorui@cisco.com Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/adc/ltc2497.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) --- a/drivers/iio/adc/ltc2497.c +++ b/drivers/iio/adc/ltc2497.c @@ -41,6 +41,19 @@ static int ltc2497_result_and_measure(st } *val = (be32_to_cpu(st->buf) >> 14) - (1 << 17); + + /* + * The part started a new conversion at the end of the above i2c + * transfer, so if the address didn't change since the last call + * everything is fine and we can return early. + * If not (which should only happen when some sort of bulk + * conversion is implemented) we have to program the new + * address. Note that this probably fails as the conversion that + * was triggered above is like not complete yet and the two + * operations have to be done in a single transfer. + */ + if (ddata->addr_prev == address) + return 0; } ret = i2c_smbus_write_byte(st->client, From patchwork Mon Oct 24 11:26:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9478 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp480613wru; Mon, 24 Oct 2022 07:21:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6TGFcPVD2bIoYPjQYwCrJZ7qActH3n4WWqhDaycMnFBVeWpv2fARD4VydAwScf3shlVFwH X-Received: by 2002:a17:906:8471:b0:7a2:859a:873a with SMTP id hx17-20020a170906847100b007a2859a873amr8733463ejc.730.1666621280114; Mon, 24 Oct 2022 07:21:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621280; cv=none; d=google.com; s=arc-20160816; b=J2MgVVepJpBI23VEjKvO5PEKfNkSc9kfadFosFWyU5euJTn9TCpn8tx++qQZReCW30 tc/IhM2Nu5voWGWbVyt5ZeNl8AREAP4CQDXyRy/6jHADFTL9ajRqaiMiWzFDKZlPCd6K A5tjz3aH+ZFF0AwVhQHGHTTel5Oj3PKTGYqWh5n7R82O6sLrK44QCAv9Q9RrL5R4wfaB rUAK5YR9DeBvyijYgnmDclRYPbVkjXfrdhPaLG1QjTruGepwZHkFo4V7X7rv1J/R9bgn 57glEubbIlMgkepNT1+oXW7KkU51BLsypYAaPLMQm4qqEu7zqAZXkdb5W39GKuqzPn49 W49Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gjJGEXbkkvR0vo9OkNAuRJKyNnf2UOv5tNkw3BcvuKc=; b=bsm359IWTLxcKVg+JEHCqHfMk+OqI+1Njhe3AysrdFREHaUlmG/E1lwpbsTcbVDs8O f6EiK9vHNC5F/bOyPLs8M3W6sPugWpCW5qa8rCqvn+xrZ9LiuflTRcByY56WEQUuV2aZ 4dT97dXZQusixfmCuOnkzoMvMp2P0sWEjXT6kfaivqbdKl3tzaxxQM25MiyKbSiHsx/o zy8i2MLTVpUe8hakqx2vwa6+0ymtedKJpX/QnEZ0dRQnBx4CXwEYJ+ZCOvNue9iJqKN6 sEnJaUpuxscRK0ojiR0Rg9USZBD6fNSo9YQnKaU4Ciuy9aaFRIiGr1qfNIonVcBcdfqb d8YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VpBqEwO7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go42-20020a1709070daa00b007a7b4b41ccasi3194869ejc.562.2022.10.24.07.20.54; Mon, 24 Oct 2022 07:21: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=VpBqEwO7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235084AbiJXOS3 (ORCPT + 99 others); Mon, 24 Oct 2022 10:18:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235547AbiJXOOu (ORCPT ); Mon, 24 Oct 2022 10:14:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B43F10B46; Mon, 24 Oct 2022 05:54: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 6649761323; Mon, 24 Oct 2022 12:16:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EFBFC433C1; Mon, 24 Oct 2022 12:16:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613786; bh=iHjA9UZZEe3lNIcO82e1PBlGNygInJEsytiPcnt3KpA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VpBqEwO7rAuwJ95XTA0CztlhAcqJOrLBb5Ph2z3s/PesDh/KAFqFzXaMzy5l5ESqr tCWqYgoVl5Z/GbPRg4IEm6CYw2Jxm6JLmGIdAKjKY9/OAXzQzYyhoCt++6x42nRKOT 9SB6kdFUmAyRfhKTbdy7oi6ysP8Jj5DxD0x5hbUI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Nuno_S=C3=A1?= , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 5.10 014/390] iio: adc: ad7923: fix channel readings for some variants Date: Mon, 24 Oct 2022 13:26:51 +0200 Message-Id: <20221024113023.162341121@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747579075349736531?= X-GMAIL-MSGID: =?utf-8?q?1747579075349736531?= From: Nuno Sá commit f4f43f01cff2f29779343ade755191afd2581c77 upstream. Some of the supported devices have 4 or 2 LSB trailing bits that should not be taken into account. Hence we need to shift these bits out which fits perfectly on the scan type shift property. This change fixes both raw and buffered reads. Fixes: f2f7a449707e ("iio:adc:ad7923: Add support for the ad7904/ad7914/ad7924") Fixes: 851644a60d20 ("iio: adc: ad7923: Add support for the ad7908/ad7918/ad7928") Signed-off-by: Nuno Sá Link: https://lore.kernel.org/r/20220912081223.173584-2-nuno.sa@analog.com Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/adc/ad7923.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/iio/adc/ad7923.c +++ b/drivers/iio/adc/ad7923.c @@ -93,6 +93,7 @@ enum ad7923_id { .sign = 'u', \ .realbits = (bits), \ .storagebits = 16, \ + .shift = 12 - (bits), \ .endianness = IIO_BE, \ }, \ } @@ -274,7 +275,8 @@ static int ad7923_read_raw(struct iio_de return ret; if (chan->address == EXTRACT(ret, 12, 4)) - *val = EXTRACT(ret, 0, 12); + *val = EXTRACT(ret, chan->scan_type.shift, + chan->scan_type.realbits); else return -EIO; From patchwork Mon Oct 24 11:26:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9708 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp544959wru; Mon, 24 Oct 2022 09:33:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5LFg+2A6oc5M9DlzyxY5HR2Lv1q2JaAOWIQKqU43w92G4PzZOc4s8XyzCh1DSJyeP+BKLl X-Received: by 2002:a17:907:2be9:b0:7a1:11a9:1334 with SMTP id gv41-20020a1709072be900b007a111a91334mr356740ejc.131.1666629197898; Mon, 24 Oct 2022 09:33:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629197; cv=none; d=google.com; s=arc-20160816; b=M2wOEDki7RZCOloGEeWfkbDj4St0ijVtWL6aHJvMr66ms5GWyUId9hwlu2L4ynkhnt BoDvZU/eumSm9w6h5WmxK+hZ8BmlYR5cZRy+JO4xLNKZDUDQ9aiYEHmK9Ek0SjFoHHd7 IIL1pkiv/2eIBWYAK/ZMZcEs6NtdH9dBcjW8Uu/nWvFKNdDHEe9cu60WcTlgtynPhU9l ciz+8qwupGiOn3bSnbO3rhXOUt52IkVuD3K4UIWRIlSj3NNBim6UlskezsOv9m88Wwar 4zpKbfvR4ntCOKaj97a8JWIjiiL7j42QAIaumfwhpaX3TrdRlTYJyEAlKCAVv23vBEj3 TDBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8FHYFr4Nwdv/iOPNXYj6eVcFWvQYx1EYUPazb6fkq3I=; b=hHIhwXtSXNx6VVo5TSPycuwZLSksbheU00xr6bZ048oOR+BdoGOjxcw5ymjpjb8AEY oqo7klAYFksyTfZBx/PglYRiq4IOH+sjceLxn/QjBCKzdjN+R4ZiS8vUESDNNzqrh2Sr DEbWzIFGWV+FS2RtRANXaKwqWzJzZ9WnyfWchdXCWcTWn22lzU6Cr/V+jvkPCsrgeeb+ O0wzZa+D7a8HP7khEGTwQMu36a7Xg57fOlxIu7HqZAwUhe2Var1aefCs5X+Gra5NdQNx 2gYY72uXRZuoYrk/NiwT9Ct/aw7Quka9eYOLmWrClNdNRiWDUhqr8mHgdF/oMlfvJh8y lTJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wsHALhw2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di16-20020a170906731000b00787b9cd2fe3si132694ejc.844.2022.10.24.09.32.54; Mon, 24 Oct 2022 09:33:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wsHALhw2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229997AbiJXQS2 (ORCPT + 99 others); Mon, 24 Oct 2022 12:18:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234166AbiJXQQt (ORCPT ); Mon, 24 Oct 2022 12:16:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61827A87B7; Mon, 24 Oct 2022 08:04: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 68A17B8161C; Mon, 24 Oct 2022 12:18:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C522BC433C1; Mon, 24 Oct 2022 12:18:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613895; bh=lHA+zVgSOdyqCjkiWL6eqbyOGZwAZZm29Yp/49MU+HM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wsHALhw2iBMMR+dox5CEXX2cqXdwUzcrTgk3F5Zeicd5jZFUmdGgwVL1XoD0OeCsB cwFouSpmaN6hy8PvZQLSt+YMc3MyoMo10nBUIErdaA6nrQBBG12CgLQBNoCz4QOPLB L16qCjzj/cZcE3e1Z0oh9OLJWTQxxt+mDcYRpLuE= 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.10 015/390] iio: pressure: dps310: Refactor startup procedure Date: Mon, 24 Oct 2022 13:26:52 +0200 Message-Id: <20221024113023.202992075@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587377737751907?= X-GMAIL-MSGID: =?utf-8?q?1747587377737751907?= From: Eddie James commit c2329717bdd3fa62f8a2f3d8d85ad0bee4556bd7 upstream. Move the startup procedure into a function, and correct a missing check on the return code for writing the PRS_CFG register. Cc: Signed-off-by: Eddie James Reviewed-by: Joel Stanley Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20220915195719.136812-2-eajames@linux.ibm.com Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/pressure/dps310.c | 188 ++++++++++++++++++++++-------------------- 1 file changed, 99 insertions(+), 89 deletions(-) --- a/drivers/iio/pressure/dps310.c +++ b/drivers/iio/pressure/dps310.c @@ -159,6 +159,102 @@ static int dps310_get_coefs(struct dps31 return 0; } +/* + * Some versions of the chip will read temperatures in the ~60C range when + * it's actually ~20C. This is the manufacturer recommended workaround + * to correct the issue. The registers used below are undocumented. + */ +static int dps310_temp_workaround(struct dps310_data *data) +{ + int rc; + int reg; + + rc = regmap_read(data->regmap, 0x32, ®); + if (rc) + return rc; + + /* + * If bit 1 is set then the device is okay, and the workaround does not + * need to be applied + */ + if (reg & BIT(1)) + return 0; + + rc = regmap_write(data->regmap, 0x0e, 0xA5); + if (rc) + return rc; + + rc = regmap_write(data->regmap, 0x0f, 0x96); + if (rc) + return rc; + + rc = regmap_write(data->regmap, 0x62, 0x02); + if (rc) + return rc; + + rc = regmap_write(data->regmap, 0x0e, 0x00); + if (rc) + return rc; + + return regmap_write(data->regmap, 0x0f, 0x00); +} + +static int dps310_startup(struct dps310_data *data) +{ + int rc; + int ready; + + /* + * Set up pressure sensor in single sample, one measurement per second + * mode + */ + rc = regmap_write(data->regmap, DPS310_PRS_CFG, 0); + if (rc) + return rc; + + /* + * Set up external (MEMS) temperature sensor in single sample, one + * measurement per second mode + */ + rc = regmap_write(data->regmap, DPS310_TMP_CFG, DPS310_TMP_EXT); + if (rc) + return rc; + + /* Temp and pressure shifts are disabled when PRC <= 8 */ + rc = regmap_write_bits(data->regmap, DPS310_CFG_REG, + DPS310_PRS_SHIFT_EN | DPS310_TMP_SHIFT_EN, 0); + if (rc) + return rc; + + /* MEAS_CFG doesn't update correctly unless first written with 0 */ + rc = regmap_write_bits(data->regmap, DPS310_MEAS_CFG, + DPS310_MEAS_CTRL_BITS, 0); + if (rc) + return rc; + + /* Turn on temperature and pressure measurement in the background */ + rc = regmap_write_bits(data->regmap, DPS310_MEAS_CFG, + DPS310_MEAS_CTRL_BITS, DPS310_PRS_EN | + DPS310_TEMP_EN | DPS310_BACKGROUND); + if (rc) + return rc; + + /* + * Calibration coefficients required for reporting temperature. + * They are available 40ms after the device has started + */ + rc = regmap_read_poll_timeout(data->regmap, DPS310_MEAS_CFG, ready, + ready & DPS310_COEF_RDY, 10000, 40000); + if (rc) + return rc; + + rc = dps310_get_coefs(data); + if (rc) + return rc; + + return dps310_temp_workaround(data); +} + static int dps310_get_pres_precision(struct dps310_data *data) { int rc; @@ -677,52 +773,12 @@ static const struct iio_info dps310_info .write_raw = dps310_write_raw, }; -/* - * Some verions of chip will read temperatures in the ~60C range when - * its actually ~20C. This is the manufacturer recommended workaround - * to correct the issue. The registers used below are undocumented. - */ -static int dps310_temp_workaround(struct dps310_data *data) -{ - int rc; - int reg; - - rc = regmap_read(data->regmap, 0x32, ®); - if (rc < 0) - return rc; - - /* - * If bit 1 is set then the device is okay, and the workaround does not - * need to be applied - */ - if (reg & BIT(1)) - return 0; - - rc = regmap_write(data->regmap, 0x0e, 0xA5); - if (rc < 0) - return rc; - - rc = regmap_write(data->regmap, 0x0f, 0x96); - if (rc < 0) - return rc; - - rc = regmap_write(data->regmap, 0x62, 0x02); - if (rc < 0) - return rc; - - rc = regmap_write(data->regmap, 0x0e, 0x00); - if (rc < 0) - return rc; - - return regmap_write(data->regmap, 0x0f, 0x00); -} - static int dps310_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct dps310_data *data; struct iio_dev *iio; - int rc, ready; + int rc; iio = devm_iio_device_alloc(&client->dev, sizeof(*data)); if (!iio) @@ -747,54 +803,8 @@ static int dps310_probe(struct i2c_clien if (rc) return rc; - /* - * Set up pressure sensor in single sample, one measurement per second - * mode - */ - rc = regmap_write(data->regmap, DPS310_PRS_CFG, 0); - - /* - * Set up external (MEMS) temperature sensor in single sample, one - * measurement per second mode - */ - rc = regmap_write(data->regmap, DPS310_TMP_CFG, DPS310_TMP_EXT); - if (rc < 0) - return rc; - - /* Temp and pressure shifts are disabled when PRC <= 8 */ - rc = regmap_write_bits(data->regmap, DPS310_CFG_REG, - DPS310_PRS_SHIFT_EN | DPS310_TMP_SHIFT_EN, 0); - if (rc < 0) - return rc; - - /* MEAS_CFG doesn't update correctly unless first written with 0 */ - rc = regmap_write_bits(data->regmap, DPS310_MEAS_CFG, - DPS310_MEAS_CTRL_BITS, 0); - if (rc < 0) - return rc; - - /* Turn on temperature and pressure measurement in the background */ - rc = regmap_write_bits(data->regmap, DPS310_MEAS_CFG, - DPS310_MEAS_CTRL_BITS, DPS310_PRS_EN | - DPS310_TEMP_EN | DPS310_BACKGROUND); - if (rc < 0) - return rc; - - /* - * Calibration coefficients required for reporting temperature. - * They are available 40ms after the device has started - */ - rc = regmap_read_poll_timeout(data->regmap, DPS310_MEAS_CFG, ready, - ready & DPS310_COEF_RDY, 10000, 40000); - if (rc < 0) - return rc; - - rc = dps310_get_coefs(data); - if (rc < 0) - return rc; - - rc = dps310_temp_workaround(data); - if (rc < 0) + rc = dps310_startup(data); + if (rc) return rc; rc = devm_iio_device_register(&client->dev, iio); From patchwork Mon Oct 24 11:26:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8989 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp439464wru; Mon, 24 Oct 2022 06:02:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM67A5gk2ZWYmtT55++2pAgzjsyS4WwJEwWnSxCA9PLRBmZ6Aotl2x0MkYk4Yh5Bf6jwQU9F X-Received: by 2002:a63:1f5c:0:b0:469:d0e6:dac0 with SMTP id q28-20020a631f5c000000b00469d0e6dac0mr27404848pgm.427.1666616567232; Mon, 24 Oct 2022 06:02:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616567; cv=none; d=google.com; s=arc-20160816; b=Sn1njn31Nn95iOu5KzNIf/6u+4dbv6J30QZO/tnafN/w0LTnc73/PIksU4JTzdU9mB HhjqgQT+IapdvE3LYZJdl8SL91+mlnYRvUUIpPdFXBzfrTkB5ySd50GusN8s6s5+s438 jaKaRHKoRxlAzpgbFJckXDC48/JdsiduzmLj3LGx2jCK1uyEnCLGoqPXN2ociUeadH/2 MnVzOJBZmX04Dr5xoJsdoL2218UDqj2umyW0oC9Czv9oCUKJ7zu+PoqxUpn+atgEVfoE AVpLrtco+ZHjVR/s2wKsxEnq/MvCDOMkn6hs9M/GMwECwGBPig4A+I4mVpDMtx3O5+IV e2lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=WTywaY9VIFyI27vzFgkAUOjWchIyrNCiIeFO+1NZ2s3kr1U9VSEdmaX+VKgBJV17bC gf3jEPzud9y9m3+zaFuEPILZpFWBGOz6UstCf6kdfumZ+BklirOaYip157NvTEyXQaPM 4dacHqGNR47i55XnWCg9Q9bplwKknBcVxYs0gexwcUI/xnz+SyMusF6JJH6cocYH1QCo o1j7SYLjXkl9HsAQWil7dJTmJHYTLFprk5GRB9E//iHmM8mm28q56FQBXcY/x/rb42/b yY/3z+MSArWj864jE2jqC/e1OXvwliJhDtCtC/I1QlMYPlx7PbXhXXrVFbwBMMpXRT1I nZeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QZlEmxuv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902e80200b00186b6a32284si1097200plg.548.2022.10.24.06.02.13; Mon, 24 Oct 2022 06:02:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QZlEmxuv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235117AbiJXNBe (ORCPT + 99 others); Mon, 24 Oct 2022 09:01:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235030AbiJXM7K (ORCPT ); Mon, 24 Oct 2022 08:59: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 CE66E9A29A; Mon, 24 Oct 2022 05:18: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 CFD1061218; Mon, 24 Oct 2022 12:16:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6754C433C1; Mon, 24 Oct 2022 12:16:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613813; bh=z6BUKnQXIYEmBq/uQLvhq8qTqLB0q2qvgDL8SK8Bizo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QZlEmxuvdTYLe6PnYRb5IECoPK/xEr+wpZBZC+xVlSBc+gfvazXoXweRWae7KR95Y qSLhP05TJxvMav7+GbfjEtWi5PXCSLJc6GixkrYuSrHkuDMLsPPUcuLagEIeJti/xL CZqq0pNmZLXg7ouVcA9BJYfDmpqNE9+6vQu5d3HA= 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.10 016/390] iio: pressure: dps310: Reset chip after timeout Date: Mon, 24 Oct 2022 13:26:53 +0200 Message-Id: <20221024113023.243733028@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574133561660202?= X-GMAIL-MSGID: =?utf-8?q?1747574133561660202?= 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:26:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9709 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp545004wru; Mon, 24 Oct 2022 09:33:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM71I6qN2XnxWgUJXuM9xaN+5D5ywwJhPJY/vu+OfKXqX3mKew0jVx2ABmJvILPc1rTwnwHf X-Received: by 2002:a05:6402:27c6:b0:461:e426:dc8b with SMTP id c6-20020a05640227c600b00461e426dc8bmr3063125ede.403.1666629204497; Mon, 24 Oct 2022 09:33:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629204; cv=none; d=google.com; s=arc-20160816; b=HbBURCgMHg13EOaXvKqet6IfdZK/oX3QXGsQVpmq7jAFZRo3Y9Iooq20ds5UhzOfcZ Ktv54beUSKw406UOT8teIHvqiuNDost2nxnUBIA7oDWeis8cQKocPWZ0RoMkLYIt8q13 8a2YwV/kqsRCC0wpzliWOXg6mlHnGSrx/8/KPbmp3XxAc9SN+DoGnFLq+3pjWgD9xsTt oDRcm1FxuPzZpqx/aZJiw3shWn6y+H2P3cidkHj9v40k6gMqq+V8Tw4IgTde7BkEiY8M wKyDBK4wav87cg1c7/b3+uErwGmn6niZyEfZZMOmwBcKLfyO5Satmpyhms0eoKmB02Xu 9S2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=uf9uOg+4N4emjEAQ8AzzKYly+igjTuSJuG2pV300YrRdCvRIZnfRHbXNyyIrJyFutb 67xoitTZC0eyS/DgP0IsX/UsknK9y/U8jmXfnxRI+bybtXzW7LPwkmZyLhtySv82bg+k bPUKUDXlfUd1CZN+OUOM0vbTpVJ/ur28zT3zSmHduuujEKXtHNdwlQwuyq/43E8QLcS9 SYrYuYyMZNVRHpgxrIPNhk3DekrzCzBM84ZMxJ0pcrqLecB4Rk/wt5b9t2HvJjU2Cgz0 yAwRIbwSeM6v5mKHfZzfgBuoAw4nKNhPKT7hL5DNtBLRrTppbZwk38ux34MDzbecF0au BLAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wVeq5JXh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id he12-20020a1709073d8c00b0078200e81b92si169083ejc.758.2022.10.24.09.33.00; Mon, 24 Oct 2022 09:33:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wVeq5JXh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234388AbiJXQSy (ORCPT + 99 others); Mon, 24 Oct 2022 12:18:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232212AbiJXQRP (ORCPT ); Mon, 24 Oct 2022 12:17: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 01CFAB1B95; Mon, 24 Oct 2022 08:04: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 6E0A3B81623; Mon, 24 Oct 2022 12:17:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C40A9C433D6; Mon, 24 Oct 2022 12:17:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613842; bh=yQyto2Ce9b73hWIW5ToDONrZ7wExoMDHWAq3LWLzMCw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wVeq5JXhUpiVNpqEoStVXWGgJiliFq2A0esLgR5njuj5bxu6xq2NxgWmcyI4NZJI/ fUGlBrJh5KRvtJajubzok8tPjJCyYY65erIIrh+LCFk0GZ/3ZcyQPqjQ/sr/BM25nh jE/E6tAaRX9Dnz2w5pp2rI074tII3okELa4QNP3A= 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.10 017/390] usb: add quirks for Lenovo OneLink+ Dock Date: Mon, 24 Oct 2022 13:26:54 +0200 Message-Id: <20221024113023.278687425@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587385219588774?= X-GMAIL-MSGID: =?utf-8?q?1747587385219588774?= 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:26:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9016 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441273wru; Mon, 24 Oct 2022 06:05:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4dWFNo6FigfV7PrmvhtnoQBTfCm225vCbPaz0WdUBLohFUj/+kVZSPx5WMPIKrjy6WjZW/ X-Received: by 2002:a17:902:6bc9:b0:186:878d:3c with SMTP id m9-20020a1709026bc900b00186878d003cmr14161014plt.72.1666616739830; Mon, 24 Oct 2022 06:05:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616739; cv=none; d=google.com; s=arc-20160816; b=QCgtcT41+bd2n0J4BRuxN/HbyQ/8WAyd4UaWiZaAnnBjhBkivPC1j7gI76i63/jmP8 1cT2tjjVWu/Q36v3iujepddi2Ew8Whn/7mei5EwzxRSLTt+ZQpvBxHhTlxcdY26kiBXZ zHsaIIevNwn/aUvCwbucnF57YitFbH/CTK25R8rmizH7GsWvzpxpMZUhsFKjLrJ1vDFE ziPKLw41Ws2uQQ9dVgDWgLaGCODehXyaI1Gc7eTFDLQhv8XjgM3ha2Se1TLTtr8LgnKj PHNvHniciNe+lmJgLJSIeinws7StTuSTlCQyaVVSaZsXWNm7fzBfyP442etD0LyZ+jlJ EH/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=uupszNGThibcuoV0lCdr6FdGwKbohbo2rPAHpTTSjgI=; b=nAdMof+bDa58E9xqn3UcIHW2sP7IaXPUjjHoQDz3fZ/dQNJOiyruJ/ozTUUdKy2l0g SFkR34kr1u+OefxdcCgdDglliehm+QO9DBw5J7gJigqpJfpFu6RORDTCxaand5r6Q5Gh hXV4w4o47SGPzHE5kwT2YK3t9srXWvGisSrVDqnDo/oofC1nIc+r2s1boEfmiAC4M826 qwKA4oMibbS5zhsoxbpb0pdXO/fxVq6t4MOLCnxKonu2JPiNOzuasxoRY/C003yZks3A f2CFgSwx5yFUu08YwD6AOiqPJqE6N44ryC2jvVcSn6eHUGJlIQbKOKBq1QJyeZI7Rejr EZ2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ziItpBwN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qe10-20020a17090b4f8a00b00213245b0b4csi1295103pjb.171.2022.10.24.06.05.18; Mon, 24 Oct 2022 06:05:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ziItpBwN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235386AbiJXNEl (ORCPT + 99 others); Mon, 24 Oct 2022 09:04:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234966AbiJXNAr (ORCPT ); Mon, 24 Oct 2022 09:00:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04B201A811; Mon, 24 Oct 2022 05:19: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 121B461328; Mon, 24 Oct 2022 12:17:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23500C433D6; Mon, 24 Oct 2022 12:17:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613871; bh=BFat5BEfy41jcfjN1LQSScF9bLmYMpIuSmHtawi1W2c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ziItpBwNfvpYgPx5FVsDo8xcc0RMNkFRbfs7hI9H3s76W0QpBLTPIi9IKPcGNTyPC j7U3g+CpuEfY9fS+ourMylc6f/yPu4Eng61g0Kzgudp6xTCk04wGd0Gid7KkDOKODK emPyA9inrSmQU7cotJuDNQ/UUvdZa1aDJVqRTPoI= 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.10 018/390] can: kvaser_usb: Fix use of uninitialized completion Date: Mon, 24 Oct 2022 13:26:55 +0200 Message-Id: <20221024113023.328176062@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574314209353697?= X-GMAIL-MSGID: =?utf-8?q?1747574314209353697?= 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:26:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10327 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp668782wru; Mon, 24 Oct 2022 14:55:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM55nbKaZ1+SB+5oE68YXV9ULANrsQaplzO1k0+yX1+rkraFItE05IwwcnOY/UfIaHaBk5OS X-Received: by 2002:a17:907:3186:b0:777:3fe7:4659 with SMTP id xe6-20020a170907318600b007773fe74659mr29264910ejb.336.1666648545520; Mon, 24 Oct 2022 14:55:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666648545; cv=none; d=google.com; s=arc-20160816; b=DxGb5qYK4EI6Utz3MJC8MKvVWAdz3KWygwHP20/xyWr4HdlR9krOxV04yMSDPzoZiE kbumaJx81FgAQwZoIxlTUaZYYS+CaYiw2qfim7pN+btRz4/ZPyxYZKVmOtqPmT0ZU3i1 jKO+Rp3Tvy6tVVWJZLXRje/s9UYjkZD2XIoeNWBT1VLaBI4kRBdkZOwM7f67+FimJlGF oK2uTFS3f72e963xNjGyyIVgmR6aHGz6B2ZRs7l+2tk49iG+MnDqIFfLUa0+LcX9xc9s f6kHkObIBdWK0GSQQGP3Btb7nSj+G4+YzlpLAtx1tqlUII6PzgpZxm1srS+R5WGy6AdO PgTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=NiaDPXfkCsNeVOAj25c2hwCyDPtef9yyfsGFt0u0KGJdxN7plGfkKQtixNwhCF0NeS 8cb7HdRHGaf0mYvnk/nODTRzAqIouoHbzFQHAthbl29fzvLylZPjXZGSGIwljuTOBA3t gyjgSEWDLf+d7wY57ibcXiYf3OTDcmr9TQ7fT6pev6pbXJdtJsI5TWRvo2Ct5zMypPUF 6OlicC4vSxv3M5FZgVF1mpvYawi4nWZAbSUjHInZCr/3A+e5vfL/s3jiLtZ396Z7oUvt DkVFNPQbDLGMTtPF4GwTONB2H0fGEI5d1o95FtPoLIlrs1IC6N7GBL6BSJDVF4088TS5 xNfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WBAGGF4V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h1-20020a50cdc1000000b00457053aadeasi804947edj.398.2022.10.24.14.55.22; Mon, 24 Oct 2022 14:55:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WBAGGF4V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230164AbiJXVqm (ORCPT + 99 others); Mon, 24 Oct 2022 17:46:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230129AbiJXVqR (ORCPT ); Mon, 24 Oct 2022 17:46: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 E4C9F2EA955; Mon, 24 Oct 2022 12:58: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 9D1AEB815A0; Mon, 24 Oct 2022 12:18:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0BD6C433D6; Mon, 24 Oct 2022 12:17:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613879; bh=FfZJQ7cgeQy24SFeoZdkQ03d0JuMApp87TbnvR3NJuY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WBAGGF4VP2/TstTJSuvbjFA+00r5iAsHYwq8vJTMpEjgQGA1xH8bqQ12NyKCjRnaN UVhV/fy1QYDBKboRK3hHCO7QQ8/5grDdI5Zjr1gh4091f94utsCs+E89Yryc+W3NA5 KK3hyEtvrNTmzMRLpGTzNv2OAgRmUeJCrimHim0U= 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.10 019/390] can: kvaser_usb_leaf: Fix overread with an invalid command Date: Mon, 24 Oct 2022 13:26:56 +0200 Message-Id: <20221024113023.359221079@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747607665495688996?= X-GMAIL-MSGID: =?utf-8?q?1747607665495688996?= 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:26:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10170 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp640628wru; Mon, 24 Oct 2022 13:33:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4SihnaxSFDXx+fGVyeg+VWoiVV802AVEo6wi/7Esw+vY15AdoHEpXiOC2NuiR/RIADGDkH X-Received: by 2002:a63:2d8:0:b0:46e:9da4:df67 with SMTP id 207-20020a6302d8000000b0046e9da4df67mr20255780pgc.176.1666643585245; Mon, 24 Oct 2022 13:33:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643585; cv=none; d=google.com; s=arc-20160816; b=FwrQGNyuYphW9luj0cUKq9wBiRSrdQSI53u9IaJTYvJmNB/seGdG+2Ap4FDrNzW+FV vyNh6RwicbtdII/ud4aq/5gQd33hgZRT1Nd9aSrNCV0/SauUvbel8aWLhEv5z9C8j5Gj isBasN8cDaa/a9H9JLi57WikVcow/fonNSnJjHRkD5fELAXaoUQct/wOLi4zQ7+gnIgd svBhB0Kll4PFLAZrk2U46d8BCq3aLWkSl/RHF1HrmCYTjRP3QaEbt9Kh2RWLUQA3/pbo JbDf7HuRUtWoJB84JE4GWhUEN8nVWNr9IskfHiL0JVBt7/0OIDyJyrddbJhnwIzP6LOK w3uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=ABFihHz9HxqkSEDzcY6bF8m8RQz3E4E8RnQEEyzAZInkRyrC9KkI6QgXUbOeX/axci 8UNdYq+MDT2xNOwVqDO2jrZjZAaZrS0rymb2Dgkep2HMVoiHcS2BT9mcF3nJSSKdNbdj 8CS4V7kKJaJ+gsl9mt7ftNmFKfVwSArF+O2WDOSB1037ojGb8/vSCShj+fXxVMxqb1Ap UICnDltUsNHafE+Qaq7Vjj0TLSm4D4sOE3Zl+EFaWCRHfYRTytZz4FR8gNNYVeTUlAyK +rerkw6Qa3SeNLOW7eoeM9FLJ+fX/sFZpUnPLr61fskvNwECGQbkQVysDHK1RpWIrlX7 TNiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MeWtdNEa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a63dc03000000b0046ef67cc137si448696pgg.522.2022.10.24.13.32.51; Mon, 24 Oct 2022 13:33: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=MeWtdNEa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234228AbiJXUWt (ORCPT + 99 others); Mon, 24 Oct 2022 16:22:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234149AbiJXUV7 (ORCPT ); Mon, 24 Oct 2022 16:21:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 205AE19DD80; 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 38269B815B8; Mon, 24 Oct 2022 12:18:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E291C433D7; Mon, 24 Oct 2022 12:18:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613881; bh=547xsTNwHNS98HazWD5C1d4zRtBg8qNe5JpQzIaOh8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MeWtdNEakBBVLoBvbCcEMvp9crjGRCAyxvJtpohK8nQgVKOLeOB/89R6QQ3bbrZXC Flf/VlTmMHlVflP/d0Zfew8Z+hjEuLZVyGGmSP+f2wPxGXNWvQpoJrtvOSKZpkH2hC hkTGAoEVOkgT937wfWp4arQLdr4Q4G9lIDx6Sp0c= 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.10 020/390] can: kvaser_usb_leaf: Fix TX queue out of sync after restart Date: Mon, 24 Oct 2022 13:26:57 +0200 Message-Id: <20221024113023.409427251@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602464154469367?= X-GMAIL-MSGID: =?utf-8?q?1747602464154469367?= 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:26:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9027 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441681wru; Mon, 24 Oct 2022 06:06:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM72LEFY38ABSyH95lyM/x3LGtWwRS0uCoZ9dftfQcpp7Ws8uDqHJS3MarI3zMKm3KMBNCsI X-Received: by 2002:a17:902:8601:b0:181:6c26:110d with SMTP id f1-20020a170902860100b001816c26110dmr32469249plo.27.1666616746976; 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=Edy79odJ0LzU2Oh3yW1dd1LqtrBzlYjAHOvG3mA8JTFG7n5BwZMqCh6vR8SjA0riWE IQuQ8/ZFaE1KU8iLQ57V3QRdzpEQPAN2dk61EVok64kLJxk3BmJWPf69iou1FX7xlLbA /iR78JiZ+mrWagkYyQ8619NYrhzCBUO80bEFrogXKqG0x7I7OmbNEdrhZeTWKh+hM6eZ z/J4+GnUPDdKXfbCNZ0AENJ2n/KfONwH97kK5NqiSm0DvJOYcFZVMXiMP/VVZkBTOO3N SMHwSQWZw1FEVwebSRrCuTFzJX2VCJJTCpedolBSHC5H6M4wr2dKgsX+pd5DZrCP7pS5 y8nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=hoUM3PtTjdj5flcqPYgUguof09mEGjVck1OMhGQQFiP/w6ZE5vU5MCbxq1/gm32cxF o8PsvpQXt9BoWDXhqdIYuSN86LtjMLULgkIT9iM6lNLGWJAVHnA1tGm239qTtROTLnqq jtfIz+RHdRbGBeCLkweKNIXo0Zgu833DkkG3HE92971sWTB2FZ3tArGq607WKkyjeuJU 1T0cbJXzAZRxmxJ3scaDsO3A7fbFhUKI9PNNM4JJ7RGhE4CSflnWuPWYiJxBFvlH5dj0 JHedmsBbYlaNbPLWs2U+t66kVna7ZFkVwCo5tkAdylwM5hKqTlqLaFnwrUXkmnP1z8V6 0ojA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=S3cq3+HI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y124-20020a626482000000b0056b52859251si9622319pfb.315.2022.10.24.06.05.23; 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=S3cq3+HI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235423AbiJXNEp (ORCPT + 99 others); Mon, 24 Oct 2022 09:04:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234946AbiJXNBJ (ORCPT ); Mon, 24 Oct 2022 09:01: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 4232D237C4; Mon, 24 Oct 2022 05:19: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 2ACEE612BF; Mon, 24 Oct 2022 12:18:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3CC15C433C1; Mon, 24 Oct 2022 12:18:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613884; bh=tuRrGyRDE5pfd9u7YgYcnNL8Vy+H8he/V121FPx+c8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S3cq3+HI7JAeIxf9YVurfkgVBuz0Btfmd/DJ8HPWjEHEvM79+ORAD0wdGt9ZWDe/1 Hmyy+jIrCze4dMEBTgaf2x4BVqLt4GGmLjRNermfoTuX4o0V+Mv5e58FbLk074kJ5b zSrmPD3cKCsIQ1kzvb4Ge/8gX2baFEFCCYptxW8k= 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.10 021/390] can: kvaser_usb_leaf: Fix CAN state after restart Date: Mon, 24 Oct 2022 13:26:58 +0200 Message-Id: <20221024113023.449163692@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574322040964741?= X-GMAIL-MSGID: =?utf-8?q?1747574322040964741?= 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:26:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9717 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp545814wru; Mon, 24 Oct 2022 09:35:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7NyVqiXH+y61aIlWjXxDGgZQ22R7bDnemh6VGIkhp8zhjk27PMt/ArQ3F47Zpu6NCN6E9F X-Received: by 2002:aa7:ca50:0:b0:461:9845:d9d2 with SMTP id j16-20020aa7ca50000000b004619845d9d2mr9316962edt.163.1666629317404; Mon, 24 Oct 2022 09:35:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629317; cv=none; d=google.com; s=arc-20160816; b=LrizKfHMmnlCLd/PIJMoIoQ0ItOu+TR8lLTol/A3vF2up/70toeYiewLsDqqwlpQcf D3yjtWqqpKv6fzsOu6hlIMlBztX2UCw3LpBkVaq9fWcopfTWzc+hyyusaOgksy4YxHHG 3Y1S0C35ULzoDFLuZEYHkOxJEOiDgrlSY6l2kqmf75VFQ/kWwI7VGyWW0HC9HKm04YR9 BUwA+RA/TLSqGBoHsj/XOTR8QfjGEbFVOxI2/14fU777NQ2DYJPq6uIy3/WuM52p2X8X tmhREOwdfp87SGEcQvJhAQWGiMXgEFIVrDdnOTfPJvEKQD4fOBn5yy+K3aAwG8QJ0DRy NI9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vtTib18NHmjhUoN5MkbdZwJAGz7OI6+4VpLAuALtZWE=; b=uu7TnhQbinfjxfuMnhCOFTA89kVNJdw76nVStCl5PxGtK9p2EoGLGALa+FKPSNKLbY QkNwpaKOydKZcApCr2HlIHbKy/8aqRQW3XW9AenQv8XJ9yiOKmEpBDSNoX9fe77uPtPS M3IGJY1P2s3DPcP777la3ds0fQu3KScT9J004KxJxDI7Ecn7adfcwVFeBv42aOIYmXDc q8mhwa3p7TPdefcdY/Acy5W9BqnIqy+BXDBhLjbEEwp8WDftDWUGlmeIaLm7Ai73J1Od ZIMQdyWRIWLb8iJO7vcrfyZ6P0z6U9uQOZMuObO8kgyKezQE8zgDm9/86zrRkjWGjniI x7jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="FP/CLo8i"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z66-20020a509e48000000b0045c9dbe290csi190087ede.406.2022.10.24.09.34.53; Mon, 24 Oct 2022 09:35: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="FP/CLo8i"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232133AbiJXQSU (ORCPT + 99 others); Mon, 24 Oct 2022 12:18:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234133AbiJXQQU (ORCPT ); Mon, 24 Oct 2022 12:16:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5458A8CD5; Mon, 24 Oct 2022 08:03:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 71A3CB815C5; Mon, 24 Oct 2022 12:18:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE228C4314C; Mon, 24 Oct 2022 12:18:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613887; bh=CAaygUI3d5Iwg9TpDcUtziCnjlVX7gq+/9M0cwLO+2o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FP/CLo8icwYp7Dvg7a3uJucey3Onu+8XdIcaSXei4vFln+A7e2ObrFuxxM8YWm/Mz gPX3fjgANh6Dmjvc5WCkWhVA3ZuMvY0OTM1tgYZuI2uCwRNvsQgGYJBRFU+67Se3M+ TQOh2KkHTxnAV94jGQnAKo6lWU88oQvt3U2c9cYY= 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.10 022/390] mmc: sdhci-sprd: Fix minimum clock limit Date: Mon, 24 Oct 2022 13:26:59 +0200 Message-Id: <20221024113023.498588550@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587503051906764?= X-GMAIL-MSGID: =?utf-8?q?1747587503051906764?= 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 @@ -296,7 +296,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:27:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9025 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441551wru; Mon, 24 Oct 2022 06:06:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6bjOVu/2wF2WXCHKpOwV/x0jFh5w1oaE3g/vluoWMC836kDN2RvLpWjnKJKkyK/beiq0Dq X-Received: by 2002:a17:903:186:b0:182:ecf9:6227 with SMTP id z6-20020a170903018600b00182ecf96227mr33868263plg.70.1666616763092; Mon, 24 Oct 2022 06:06:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616763; cv=none; d=google.com; s=arc-20160816; b=GX2KaULf3fk4hwsxiOofc3XCm5K2o6Ho09KfIcyDH/VNtxiUdgokMDnBXLR6S6K7aP wuvikbB9gQ2mR+iu2nNaIeBA/SmOWIOrgSxkD7yjwCKyULaKV+6xW1fXuOG+LmkSdh1x MUxN4+zrKmhNs83EqYoAqlortj+x5VDmqHVdmLZBwixMONibPFFoWUUHU1DO5Rfre5L2 gc0l61GGCof1QM+Cz9KOqsB5Ld8ownUhNaEy6Zrv6M7sN20t9wJVRu53a4Wjz+cEBgDq 3cpN5Ytn5n1Bhk18TKJn09DU/+5APuAKGpiAWB8nWHzztwLeehFlYLQgy3HR/uUX8fcc xcmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=ViLFRyJjUhkY+N7uH347J7uACmwNAk52A55gtuPvvA61beGPW5XfX+m8HFs1zceKXe gpUumAlykmD4mnBl9XbKi/YmNeX+ukMHcpjBLWZafazdR+gk+f2htc0YZUf1KY40yQf8 q6QMjthDIs9GlLydUaR66VuoYRKg3xDZmSFyFCMJ0TitIe2dqiUcgh+r3dJFAVG4zOZP Jed8ABXjRxFzRBdsoRpWVhG32TxEceaCeD4cb56jJJI96j5gMfgjsjPa6EEZcKk4hbO7 aEHF3prZSmDGzFuwuLivKxXUODtQMcvSnYjhSS940iZGSgto9/x3gZngW5pMWKQ5obWf mKIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fgOdXZXW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mg22-20020a17090b371600b002131849ea4esi2514659pjb.140.2022.10.24.06.05.39; Mon, 24 Oct 2022 06:06: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=fgOdXZXW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235018AbiJXNE6 (ORCPT + 99 others); Mon, 24 Oct 2022 09:04:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235113AbiJXNBZ (ORCPT ); Mon, 24 Oct 2022 09:01: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 D4FBE2613F; Mon, 24 Oct 2022 05:19: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 67B7F6129B; Mon, 24 Oct 2022 12:18:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C032C433C1; Mon, 24 Oct 2022 12:18:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613889; bh=Awcd/0SSmDN83dUDpNoaIq8lTcT014AjU8Qvxm5qHes=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fgOdXZXWvmuZEbsVKqvaoxIjR2SiFephtXXyEYO/34tlZP0q1IRVWx/dfZiYZCBmv bU2gu+otncjJ2YkVfGEHSDWbSSqqHPlN0IGiN2cB9GCtHmj1eME0k9nrAZSz8kRlr7 kCKfylLA3AihoiUPN15r/v+++a7nCBZw8z7+Vd3o= 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.10 023/390] fs: dlm: fix race between test_bit() and queue_work() Date: Mon, 24 Oct 2022 13:27:00 +0200 Message-Id: <20221024113023.535702880@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574339122091259?= X-GMAIL-MSGID: =?utf-8?q?1747574339122091259?= 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:27:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9246 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp461282wru; Mon, 24 Oct 2022 06:43:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7FJCRjUv5JeaoyDTy2N5tfwu7ypjXv9bOrypZwI8QnxTzaMq3h/ldw0tpdav7GbHpF9WdC X-Received: by 2002:a17:907:75e6:b0:7a1:848:20cb with SMTP id jz6-20020a17090775e600b007a1084820cbmr10257827ejc.745.1666619013604; Mon, 24 Oct 2022 06:43:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619013; cv=none; d=google.com; s=arc-20160816; b=cJigxFSsGGEq5IekcUjxINyJQJkvMsYUrvTQQYsKo1r4P1dRlqhfn66mT1nIWeAw9u m2xqxU3c+MMKOcqYHrb48avK4A+3pTLsRvoWfpKZp/EDuPkIyf6j2J3kSRM4ZFaVUJDq nLUNqHoZneggTheU7G0jFvVgIIjmbzUv6mVHsGvheI/P36TKgN1BR4F7kJJiG1Yn7zfJ S97mymUqM7Z0eqD0ZdbOPH/bk5ut0wZ713UVBcbQdU3Gicxn6flfWK0CkczzPVpX93XK qvsleBYpTkqMCjgiQsC+7+hTDpmio2ieXn8mtf8msr0/B7u7X0qekccsomzg6Fk8qQTN DWgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=SqdLm9zlHLjcBoWMnYzFRWIvoRk99q7IUYZIPWOKKi3o3XVKst/+t4eqROaKoL6oa/ JURHBHTttiHiBcOBk3zlGHAn6WJTXMaaqyFFsrxyyYOPQdYW0lSsV2pc6pcajsNwS7Fd jy7veGn31uACQ67cte9SvDBPytOv0RuxcHh8CIZdPSj4h1ftnGafk8nlISfPc65pBVV1 8Iz/T4WkidPZUTymsgfI5uG0qtNNaA0pZ1OAU/ciMzLQ+pLOVZaM9Rjx5AVqxWh+oLKl rdTx5LR5cuHkIb1j2JgBHFf5JoEiLXJJbt5To/aMBvin+46F3uVX9kS8+e9ODz6L+yFh reNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UjMUZmEC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b14-20020a056402084e00b00457205ae2b5si33494353edz.358.2022.10.24.06.43.10; Mon, 24 Oct 2022 06:43:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UjMUZmEC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236202AbiJXNfC (ORCPT + 99 others); Mon, 24 Oct 2022 09:35:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236264AbiJXNaM (ORCPT ); Mon, 24 Oct 2022 09:30: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 CC480ACA11; Mon, 24 Oct 2022 05:33:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0F20F61326; Mon, 24 Oct 2022 12:18:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CA42C433D6; Mon, 24 Oct 2022 12:18:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613892; bh=HyQXrJH1l3T0A4SR0/zGg1i70pBwz1wEYQUnliiTFqs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UjMUZmEC2YuGop6e9IuWDV8cAokfRWNPp0BVaUDXj8WKuAcwfBpxXOclPUqW41eM1 iH8KOrLLC/rXASeL0bw2qVzhYqsI4YF1p3RvoSmhgzqUbAmd+V6S1wwM7R1RvsCRwp GRy7zarnxg/V8NqNalKj4RGCZno8mjIfELK9mSKc= 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.10 024/390] fs: dlm: handle -EBUSY first in lock arg validation Date: Mon, 24 Oct 2022 13:27:01 +0200 Message-Id: <20221024113023.583457472@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576698394900394?= X-GMAIL-MSGID: =?utf-8?q?1747576698394900394?= 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:27:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8997 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp439987wru; Mon, 24 Oct 2022 06:03:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6kf2U4X5Kq32F2n5mrruqe4zR9y17jCM2f+hgsvX2S6SfbwAVMFf/MFEsgEv/hdlb3f70X X-Received: by 2002:a63:9044:0:b0:46b:2ea0:5852 with SMTP id a65-20020a639044000000b0046b2ea05852mr27954467pge.301.1666616616774; Mon, 24 Oct 2022 06:03:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616616; cv=none; d=google.com; s=arc-20160816; b=sYbx6+pZQ+gOJpzFaeIR/U9Y5M3moY5b8Wo40w9vRee2q9esMELHD29PhagxfMKLwI OYboIzuW4uwMxf0H1+e0orteMNuhuNau2zuMdHrJLlLmO8qKIiXydsQwiMp7HSsZLGEH fwRF4+BCKMhkHHaCIEjv0/4cYGraRRiG5oi3HNlfFBx9Yqed6JIPAEn4YIWrIks575Ah lQUpUNhIs5D+dX7qTj/kLx7YBwhlxVnTf/Bk+O6WLQAeHgz4/qrFl/yu04RhqvXSQ8qm 4wW9HU3QFVVM8ZxnWd6nlx+JBpODlvY3HkzfWwsQwwsy/RRwL30MylcqhNSI1TpX2PMA BJpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Iv5zl/akg9ZqxcFDKPOAexPRjUSYCQ67y4QCOnbAOn8=; b=FGZbZAW2IExDNMNfQd5IYAdWFsw+vAd9JYfKfcIeLMzAt70NxHuK//xFmdPuPDrXe6 wAJi1IklebJcLDeUzJBulGo6tT27tJ0PVe4edRRJZLlVH7B2oNGyVhKQf+MKha1Awmwn mpaGmKjbzb1A4R2BhRc5Xi6hWrs/k+F97Y4jE60pDYmjNVdutYPJBEbFjKxvxXHzMvcH uz7jjDnLtVMQZRlnDJN0jJmKNV8nF4WfXM631dumQdckk8J0XYfoAkpPapw61CEUj6hT xSP9V0/Mml0oqkYVemAT3Jl/apH2hE6A/jNcf5N7QOvrC4/MnpKRzVnfEksNkjiYbK3y 1MZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=itJ6N4RP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cp8-20020a056a00348800b0054096da12b1si30615812pfb.39.2022.10.24.06.02.30; Mon, 24 Oct 2022 06:03:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=itJ6N4RP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235092AbiJXNBv (ORCPT + 99 others); Mon, 24 Oct 2022 09:01:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235079AbiJXM7R (ORCPT ); Mon, 24 Oct 2022 08:59:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 768D89AC0F; Mon, 24 Oct 2022 05:18: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 8082361325; Mon, 24 Oct 2022 12:16:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92E78C433D6; Mon, 24 Oct 2022 12:16:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613815; bh=sAAZ5pRd2DSlqiAtcZGxWiOGWMZMMsEwtSJnTlmIEPk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=itJ6N4RPEFtzvGHX0oGVDQFD2qpLILHsh4hX850zhGyTf9QIwkPAefG8MiW6i3p4o VrJ7emUseJu7PE4uPbn7ihF1J87uZ18F8ugOse1oriBGMF4LN2X6c3rGmROi/VCKn3 U2+/F8TN2YIxrHxScrx6ybVJ9edn/s3jU9lGuGIU= 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.10 025/390] HID: multitouch: Add memory barriers Date: Mon, 24 Oct 2022 13:27:02 +0200 Message-Id: <20221024113023.636657531@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574185533567296?= X-GMAIL-MSGID: =?utf-8?q?1747574185533567296?= 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 @@ -1155,7 +1155,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; @@ -1236,7 +1236,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, @@ -1671,11 +1671,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:27:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9058 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp443235wru; Mon, 24 Oct 2022 06:09:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6NYbbQP0vS9PhZtMd6BgWJ0T+IF5LvKSu4teU2oeRC2VgMEnvJD7Rc25flzHeliMlIUj09 X-Received: by 2002:a17:90b:350c:b0:213:2552:21cb with SMTP id ls12-20020a17090b350c00b00213255221cbmr2357402pjb.94.1666616945200; Mon, 24 Oct 2022 06:09:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616945; cv=none; d=google.com; s=arc-20160816; b=GdpZK0ZZc8FwuRCWzsIyD8kRXSIe/7Ojh3uVQH2u2DHrWQ0dV075CLa23BXO2ZG2pq NjWOHAjrcKQh4Fh1IYamOPE/y5XsRWdjkkv5EH2N4vrvZJPIcu4dmDueM6CHO/1htTst JtBq3ZGz1HTjc3assf2z7vz3vvgZtaAXM3xuOWDB7/iigXJ7GsBoItj6W7owC8DPFSp5 q7MMvB6LFDnVrf21yhJ/35KZbHOctrP9jBfrw1mCi4LKUO8AnG6fi+ajX2o3KPkOqvd6 pSg79YvbpOlFoNbs5T7xCUt4IechTQqR5lP8XBrlf5LsJosEUsfwQbbuUBowiFZFDKN2 X2GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=RZEfXlaKaa4EzXx53N8gUlTu5bl9iuAy6HhA8PADGU4ie0uHxdewenw+dnNKgm7Jod LFtguJ4BHSszDeNypaombH5eoLWhTSNePKY1rVoTKMEQFiV0icP4QJ8uzoi+G4M9hHEY H1nLIfNSYqWtTtqRw2iSZXZfjw3FD+jgH7BmQz87//a8JA6TuIcl8W71/TsKJ6gpNvMd QD11KruVbkRpAz+0ta+75zeXJ79cNvGSqIduN0szHhK2sbwdAacyTpw+vxMMOHSOPL3w txj4tONAd8tSDFYwINsGt2l2v93Ml723mE3WJPQ47w/ZqYnz/X9379VuqNwWNXgeXi9r 4HIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="uee/msPy"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a634417000000b0042b4defce13si34793399pga.344.2022.10.24.06.08.46; Mon, 24 Oct 2022 06:09: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="uee/msPy"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234946AbiJXNIA (ORCPT + 99 others); Mon, 24 Oct 2022 09:08:00 -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 S235394AbiJXNGT (ORCPT ); Mon, 24 Oct 2022 09:06:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08A6682D2B; Mon, 24 Oct 2022 05:21: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 1591A612BB; Mon, 24 Oct 2022 12:16:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C5C4C433C1; Mon, 24 Oct 2022 12:16:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613818; bh=N37XKcVxYB4/HmKAQKuDmdp2IcQE9xotdgysPiZ17zo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uee/msPy/AAFfNBt1TeJfyWZnLF2PNDKMHFk5DRf2M1Ee9Cv+iDvFk1Nf8G4/KMOF waqlvFWUq2itZh8VhJKdyakvHQ9P3E1y4lZaTiI/xy3yjLbMo9CBc1kthWG9ENJ3Ls bwKpI1tDa59wp8CgRwcNbCdwuTDdZoW9D9eiRDBg= 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.10 026/390] quota: Check next/prev free block number after reading from quota file Date: Mon, 24 Oct 2022 13:27:03 +0200 Message-Id: <20221024113023.677892461@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574530226306060?= X-GMAIL-MSGID: =?utf-8?q?1747574530226306060?= 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:27:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8991 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp439677wru; Mon, 24 Oct 2022 06:03:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM554bvTR7KOGlgj4TakYYSvUt7Fdf2qbNK4KNH+oFFuNDFLjGoCnwWApyoWcXnubPTQL7Uk X-Received: by 2002:a17:902:ce82:b0:185:47af:a0e8 with SMTP id f2-20020a170902ce8200b0018547afa0e8mr33355027plg.7.1666616576540; Mon, 24 Oct 2022 06:02:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616576; cv=none; d=google.com; s=arc-20160816; b=J0/VT/7EAMqbR0nEZOm7a2fToLKApq8cfq0/MCnifL7LsL4mFZaDrSYadJUHmXUVAg g/n1TeE4c1qYupIJE5/Knp95IHWOMPQcaVUXuFxRoAeuCNV21uP/gAVUR8eKv4j/OHl6 rToOBn2rIOE94u8mW2lPSzU7oYuA/Tp44bay1FHLVRCYIzqI+9q4GEWqhYo212nn2I1D E0Ye9CDYkdMOpfPJRUoiSs6NMx3pwXsaw3D1UdcG1QwJK194fvRgFG9shkUuwIqGl4k/ JkdbmbYdu3rWBkzHwi8KH2drZ3Hzs1vYCSB3Aiuza/dg7nUKm8f/UPvRIAlG3x47rtAy s8Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6VgLHC/wEZR+WddmuBG1tP244G257F35YW+WPA6PR4U=; b=Cup4AL/jz0yDNeI1BrZ8UK4N1ipZa8ZaNPq8H8GGrsoxzixdwDL35ioEvui7zRM1mP NvyaW7wlpI75ounG2KYxakeK4yz1t+xIG4ydsVPH3txiUv0hcqXK3XnaZg4w9jLv+PHg Y7RMwTMFdKth0sjiYH/WiKq8q4PnKfLAwHfwKSn48XOaZ+trMTHx7u9pme85DN0dASp3 tgUTUN2vkUAWhvbKMi/F4Suo6hjo3jbVd5Fa/2Bu9aD9g9Pt/Zw6Q3BcnCxdFfHHdpvQ H+3V9zjlHtUAIyjjqtwXQP2/XGDW/W33pvrENJR4xZ0Y6tO0fLD3joNXJU5XvInD2xRW c7lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gz6cl9D1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g20-20020a63dd54000000b0045d4e861cc8si32412723pgj.276.2022.10.24.06.02.38; Mon, 24 Oct 2022 06:02:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gz6cl9D1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234912AbiJXNB7 (ORCPT + 99 others); Mon, 24 Oct 2022 09:01:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235101AbiJXM7U (ORCPT ); Mon, 24 Oct 2022 08:59:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60C409AC12; Mon, 24 Oct 2022 05:18: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 B6A6D61252; Mon, 24 Oct 2022 12:17:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7DA1C433C1; Mon, 24 Oct 2022 12:17:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613821; bh=Om7/WGg2QmwJwy/GGvtmo+GRr3hThQYF+KNt7roy7cg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gz6cl9D1Qrb8NJGcgTIiRLRdRKhBHilgNfIIPpq0h+BHpjLoUGsvuH0UZxia/UylI wKCaqWe376n0sAc67z2L9xAJAayE/ffpfusyv76HzeMSts2ViJg2PAZ6v/0iJOHnl0 L99654ULRHYgfBPxqr6G5CqbZf14qGCRcKH0e9mk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guenter Roeck , Patryk Duda , Tzung-Bi Shih Subject: [PATCH 5.10 027/390] platform/chrome: cros_ec_proto: Update version on GET_NEXT_EVENT failure Date: Mon, 24 Oct 2022 13:27:04 +0200 Message-Id: <20221024113023.716713539@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574143661459794?= X-GMAIL-MSGID: =?utf-8?q?1747574143661459794?= From: Patryk Duda commit f74c7557ed0d321947e8bb4e9d47c1013f8b2227 upstream. Some EC based devices (e.g. Fingerpint MCU) can jump to RO part of the firmware (intentionally or due to device reboot). The RO part doesn't change during the device lifecycle, so it won't support newer version of EC_CMD_GET_NEXT_EVENT command. Function cros_ec_query_all() is responsible for finding maximum supported MKBP event version. It's usually called when the device is running RW part of the firmware, so the command version can be potentially higher than version supported by the RO. The problem was fixed by updating maximum supported version when the device returns EC_RES_INVALID_VERSION (mapped to -ENOPROTOOPT). That way the kernel will use highest common version supported by RO and RW. Fixes: 3300fdd630d4 ("platform/chrome: cros_ec: handle MKBP more events flag") Cc: # 5.10+ Reviewed-by: Guenter Roeck Signed-off-by: Patryk Duda Signed-off-by: Tzung-Bi Shih Link: https://lore.kernel.org/r/20220802154128.21175-1-pdk@semihalf.com Signed-off-by: Greg Kroah-Hartman --- drivers/platform/chrome/cros_ec_proto.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) --- a/drivers/platform/chrome/cros_ec_proto.c +++ b/drivers/platform/chrome/cros_ec_proto.c @@ -748,6 +748,7 @@ int cros_ec_get_next_event(struct cros_e u8 event_type; u32 host_event; int ret; + u32 ver_mask; /* * Default value for wake_event. @@ -769,6 +770,37 @@ int cros_ec_get_next_event(struct cros_e return get_keyboard_state_event(ec_dev); ret = get_next_event(ec_dev); + /* + * -ENOPROTOOPT is returned when EC returns EC_RES_INVALID_VERSION. + * This can occur when EC based device (e.g. Fingerprint MCU) jumps to + * the RO image which doesn't support newer version of the command. In + * this case we will attempt to update maximum supported version of the + * EC_CMD_GET_NEXT_EVENT. + */ + if (ret == -ENOPROTOOPT) { + dev_dbg(ec_dev->dev, + "GET_NEXT_EVENT returned invalid version error.\n"); + ret = cros_ec_get_host_command_version_mask(ec_dev, + EC_CMD_GET_NEXT_EVENT, + &ver_mask); + if (ret < 0 || ver_mask == 0) + /* + * Do not change the MKBP supported version if we can't + * obtain supported version correctly. Please note that + * calling EC_CMD_GET_NEXT_EVENT returned + * EC_RES_INVALID_VERSION which means that the command + * is present. + */ + return -ENOPROTOOPT; + + ec_dev->mkbp_event_supported = fls(ver_mask); + dev_dbg(ec_dev->dev, "MKBP support version changed to %u\n", + ec_dev->mkbp_event_supported - 1); + + /* Try to get next event with new MKBP support version set. */ + ret = get_next_event(ec_dev); + } + if (ret <= 0) return ret; From patchwork Mon Oct 24 11:27:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10262 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp643994wru; Mon, 24 Oct 2022 13:43:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5R31iI+LKLGwDgRZMqeU1gU9nCcYZkSaZ6N9av+bd5nGBMn0rDeCqgHu1IdEuO5PcAjixS X-Received: by 2002:a17:90b:1b47:b0:20d:cdf2:c02e with SMTP id nv7-20020a17090b1b4700b0020dcdf2c02emr40388495pjb.233.1666644214446; Mon, 24 Oct 2022 13:43:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666644214; cv=none; d=google.com; s=arc-20160816; b=rNZ681c5hBtRa+uLIdbM076L4nifuFHnt7SKQWekYYCp1rCx7EI+sUXXS/NssZWSKW x2Uip7vHKnyGPQSTlTlTz4QMCRW3KO78gwUxL7P4l1rOkYiVNpBDfJxwvPn7yPcTPVYH SzVj5c+DANo/LYsrCiYgK75k6GX/kM4oRlZBjJ/ARgOSMegMdxZMHZ0bOujBk477MnG5 6x+O8KS5jUgn1wch9JduQ60cwVCUmn1jG4aZWHF6ZssmzebOwVIvW8H2E70gzTvOyxsj KGrJDRqon3WnpN7nKfejUTKUsbVstjCBHjxHQUHCHu8UJOSjQ/PG/PzlkYT0WnYFkEJU iY2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=fxw4g8glKJ1sAMl/DwpSO0L9LhZzGqxEzRm1ghS5ZnbnbuCW6xq9m0c5pQjiiapN6W NgIwt+Qv/xK5YOD/rrRBQuy1gPxqlLiKIiC37dGzNJVEu+LSyBiT5ltnc7CgxUs8Gn/4 opVrF2vcXlXnQmq4rFfwSlCZWiDMl+fGqZfzLcdt23yhyyxxB87uO+zDRTTIbYqHcdNG 2mXk6RO3uck4U7V2wNwEcSh3U4x+SS+xx4ukSIl5reWZgNr8XKcCG0qNc2lJj7GwEIKd Re9cqnw0FO7FwUJxVwnKWs62BS7UOm9kVhqvn+uaBxj06RiwABCJR7kEZ3GnpC4wt4Hy hYzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZHSUXoJL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id me5-20020a17090b17c500b0020aeaa98ed4si11909170pjb.93.2022.10.24.13.43.21; Mon, 24 Oct 2022 13: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=ZHSUXoJL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234674AbiJXUmv (ORCPT + 99 others); Mon, 24 Oct 2022 16:42:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234929AbiJXUlw (ORCPT ); Mon, 24 Oct 2022 16:41: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 2EDD8199896; Mon, 24 Oct 2022 11:50: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 20886B8159B; Mon, 24 Oct 2022 12:17:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F565C433D6; Mon, 24 Oct 2022 12:17:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613823; bh=qpkhbREp+upQTVqTctmEWCOKn9PVcpaTOkNdIdq7NqU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZHSUXoJLLSltKgq3pfqTMAks4fjfphmYVFBtWJPSoktu1DpTskwKXzR/B6to2jhpw fdwi/JRl/7cBmJSTjyaDC0TnSLGwnfDGrwOZmDXOnvvaStC4wRmvp1CLVd+63irBZQ 3l9p/KOJenRbKR4sOjErbU+KBBx1ZPz4XGJmG0A8= 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.10 028/390] ASoC: wcd9335: fix order of Slimbus unprepare/disable Date: Mon, 24 Oct 2022 13:27:05 +0200 Message-Id: <20221024113023.772109112@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747603123776097636?= X-GMAIL-MSGID: =?utf-8?q?1747603123776097636?= 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:27:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9695 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp544114wru; Mon, 24 Oct 2022 09:31:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6mn4+yZUySY9LK9rw1MTKyFmmMBG4ndh2xZls1hGlolQRqtWHc9lmO1nJN9PmkhZq+CCZY X-Received: by 2002:a17:906:9bc4:b0:7aa:9184:d95d with SMTP id de4-20020a1709069bc400b007aa9184d95dmr2368387ejc.349.1666629083146; Mon, 24 Oct 2022 09:31:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629083; cv=none; d=google.com; s=arc-20160816; b=yzBEB0uTOeZeWKjufspKZlcf6F5I+wLUIRkkxwHsmXQeSjaYwD6T/8SIDXTdJUdC/j NdXFbEZi6vUVpVDPoKxvyq1NRr1+xj6QpYGP9gmBliPpPFzFOTzM9+AOVBulijtK02HG Aj0PUccsGY/Di07hYlBCd/NbK9eOLvakS9xKVFe+u4GvuWdxksiy0D8Te33ed3qG19zB YX8Q4/sOzEKsetIiNswprgHySCGYDxTB9JbQFwPQ1wEzQItne76r1veDxQZGADkPOZtO 887tty7YKmWNlqWodftX/9Q7czZN1QeGVjjfTKsA9E4nFQnDEMY8bO0cWdnHUbWaY17+ tL4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=96ZynX+/xOGPt7+NKwAQsmehrRxxvU8yP8sdO7gZBaE=; b=NiIwHyqwRbG6/e85wG/xXOaIsHeYzthS1vN6kXRMsPe+jlR342MO9WK8kzSyjBVw18 2iKJMSx1Qkq5ZGU2pfHeypS3UV5OnjM/fLWJYeKmyVD/iZ2Maxercw5O5XZe6+BPaLzC NISmyfYuxzlhnI+IxdMN7QHjfTns8DpYAM9jIlm1HkM/mdlCCoN9qQqFVj/UFZ4oMSJ2 tP61bDLhPJH7sU8BLmPURgwse4Km2lK4mtZHOPCk+BN25BRSHToOG6Dfb3IXv3Ub7Zuy rHyjdoENXSmoYjPGCL7jT6vxS2Fc2425OfJq2ilcdSS0IBA+rztoBPmzfRm7VHtsjud4 0CDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="H3Z/unaX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa12-20020a170907868c00b0078dffe01cbesi165200ejc.4.2022.10.24.09.30.57; Mon, 24 Oct 2022 09:31: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="H3Z/unaX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234140AbiJXQQd (ORCPT + 99 others); Mon, 24 Oct 2022 12:16:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234533AbiJXQO5 (ORCPT ); Mon, 24 Oct 2022 12:14: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 EF752DF4E; Mon, 24 Oct 2022 08:02:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A60DFB81262; Mon, 24 Oct 2022 12:17:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F34EC433B5; Mon, 24 Oct 2022 12:17:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613826; bh=PVaDbcEgz6seddyXDXdU/WaBmcLKoTNo/6qbCXoQBPA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H3Z/unaXR2i+arL2JyhzrIH7LyQcc12Wv1GoWUyST0bmKoDoOeY5XpIInZCLtibWh +W7aGsT6JogyZRFEQTIfuqQ6LKCN6bWqQzAPCb9BX6TOzrT6wZdwB3eNmZSDMe/ZjK 5lkv76fVG2RS4V/9sGnuZD3KmzArVWlkLR//vry8= 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.10 029/390] ASoC: wcd934x: fix order of Slimbus unprepare/disable Date: Mon, 24 Oct 2022 13:27:06 +0200 Message-Id: <20221024113023.823381366@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587257076486031?= X-GMAIL-MSGID: =?utf-8?q?1747587257076486031?= From: Krzysztof Kozlowski commit e96bca7eaa5747633ec638b065630ff83728982a upstream. Slimbus streams are first prepared and then enabled, so the cleanup path should reverse it. The unprepare sets stream->num_ports to 0 and frees the stream->ports. Calling disable after unprepare was not really effective (channels was not deactivated) and could lead to further issues due to making transfers on unprepared stream. Fixes: a61f3b4f476e ("ASoC: wcd934x: add support to wcd9340/wcd9341 codec") Cc: Signed-off-by: Krzysztof Kozlowski Reviewed-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20220921145354.1683791-2-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- sound/soc/codecs/wcd934x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/sound/soc/codecs/wcd934x.c +++ b/sound/soc/codecs/wcd934x.c @@ -1829,8 +1829,8 @@ static int wcd934x_trigger(struct snd_pc case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: - slim_stream_unprepare(dai_data->sruntime); slim_stream_disable(dai_data->sruntime); + slim_stream_unprepare(dai_data->sruntime); break; default: break; From patchwork Mon Oct 24 11:27: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: 9698 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp544316wru; Mon, 24 Oct 2022 09:31:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6cjFJ5q/47N+fsj7WATNKlG5lkYul0gkGnckUXOCj5KGgm7uK1LP4ehvB7dpzG8tDIjTWb X-Received: by 2002:a05:6402:3217:b0:461:d6d7:7f19 with SMTP id g23-20020a056402321700b00461d6d77f19mr4095897eda.109.1666629107543; Mon, 24 Oct 2022 09:31:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629107; cv=none; d=google.com; s=arc-20160816; b=XsWAlcvvd5m7bImdPjWh2YI3wu7oL4EbwL0CfZNLwlsoov72Y5RHf7l+77QsVv2GTP Uk1J4ZG423Szt5PcAvIeqE2TXmexUazmHT3vGU88Vhb3gFp9ccRoKBU7V40ojqWbi8nS LYaOPaFLmtdvTZ4ICkwm9Zq4JwdZuCqYOU6c/q6xuSpbZ1i5PCr6wpYS4EfehrQHPK32 jX2JESkt5xq3dhXo1qVW6+k72RiIVbDFrTeXNI+r/h8XkrtXTmawWsE+XAl2D0JBOzB1 MvX+/mnuyTpUWxNiZ7roVYIWmH+eU75ECZvZFLcGknIwGMk8t3gocqu2+MRh4Y9rGgvO WfTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kAy4NrkKR2QiHW/iYdPqZ67JivxqMxR6zRtn6zBBxY0=; b=YG9ISuWfwOrhpr0T2+U+zFAA6KlxcptmtNLMLtvZ+de2iULIXPW1yvlE/is3OE/dFi IWn0eWVqid16ei09lLHXu4PQA5ZGescpzzWVQo7LftPtM8j84FDICBkxK3YYidqjKHjT jEPFtRWYjrR/kDupILSUkzk7H4jY5PXGR6WR42kkExZUT9QiY+dnWb7mx5xaVvDeJFdD kMkYFMDDzF7Wk8V52x/CoB8mItKACAuKZoWEaLmLOOlkWvbyMu7t4gP8VGfG2famGhhx Ic8u1KU6XE38Wb4spbSM8RW+rrrRhSxHFi845Td118AOhGHwJhNUgC2fN4cP9gFzcGfs 87Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pw2sbVyD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eb9-20020a0564020d0900b0046154884604si233502edb.482.2022.10.24.09.31.23; Mon, 24 Oct 2022 09:31: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=pw2sbVyD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234091AbiJXQRF (ORCPT + 99 others); Mon, 24 Oct 2022 12:17:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234809AbiJXQPN (ORCPT ); Mon, 24 Oct 2022 12:15: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 EA8B7459AA; Mon, 24 Oct 2022 08:03:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4B8C4B81597; Mon, 24 Oct 2022 12:17:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A12A1C433B5; Mon, 24 Oct 2022 12:17:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613829; bh=pz2UwXMRKNrNA4L+NtDLBqs3w52XvYBv/P4Jt38nelM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pw2sbVyDktc00PH/ZqggElW8sSdFG0Pe6Ecj8hdM7FRLRTran1NWYy8BJl28mohXP srQsXG12GZyn1PUUjkTeDNLjHtOPeUcZ2O6qRuceVqj8oSk6ExD6LWD4mvEQtVz+zR pKXwEBWEgKTS1PL0Z7o5S3BvZTvhjdVS+ho8nf/c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Mengda Chen , Guenter Roeck Subject: [PATCH 5.10 030/390] hwmon: (gsc-hwmon) Call of_node_get() before of_find_xxx API Date: Mon, 24 Oct 2022 13:27:07 +0200 Message-Id: <20221024113023.875915601@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587282953262758?= X-GMAIL-MSGID: =?utf-8?q?1747587282953262758?= From: Liang He commit 7f62cf781e6567d59c8935dc8c6068ce2bb904b7 upstream. In gsc_hwmon_get_devtree_pdata(), we should call of_node_get() before the of_find_compatible_node() which will automatically call of_node_put() for the 'from' argument. Fixes: 3bce5377ef66 ("hwmon: Add Gateworks System Controller support") Signed-off-by: Liang He Co-developed-by: Mengda Chen Signed-off-by: Mengda Chen Link: https://lore.kernel.org/r/20220916154708.3084515-1-chenmengda2009@163.com Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/gsc-hwmon.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/hwmon/gsc-hwmon.c +++ b/drivers/hwmon/gsc-hwmon.c @@ -267,6 +267,7 @@ gsc_hwmon_get_devtree_pdata(struct devic pdata->nchannels = nchannels; /* fan controller base address */ + of_node_get(dev->parent->of_node); fan = of_find_compatible_node(dev->parent->of_node, NULL, "gw,gsc-fan"); if (fan && of_property_read_u32(fan, "reg", &pdata->fan_base)) { dev_err(dev, "fan node without base\n"); From patchwork Mon Oct 24 11:27:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9710 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp545045wru; Mon, 24 Oct 2022 09:33:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5MXJHtGMd8tomeI7Q28rbngdfmcI1/gp+m6uW6SPPVponr++8s4JI8bR6w5lPYuVbkGs11 X-Received: by 2002:a17:906:b08d:b0:782:d526:3e36 with SMTP id x13-20020a170906b08d00b00782d5263e36mr28530295ejy.358.1666629210124; Mon, 24 Oct 2022 09:33:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629210; cv=none; d=google.com; s=arc-20160816; b=nvSKLN8TWaiqMo7dRuwMO6EwM4c+anW9Q/43KdBBSahXJml3JL3G0LBPIfxdcb9LGx 3YzfnlOsGsptZRn5PL77Fn77iIybH88JCKFhNscS8mVDm7TBcysplBg43XHTB2+lP2kf 7SoX1Dg7LksTxmQbeCXNG5Q8H80/13kbwcjnwi1kOwFbepo59xzwnv62FFbx+bBhXn8C ysd2A95oJAIKlNreMtK9y+X6jkckZOZ9A6FlL9Ah+NGGLfwVH5ISfK4G5y01ePGubEZI 09hb4zxGNr9+EhLqNzbRiQ+EfbIextOPtX/hK3lbYc3frWk+ILOGxHRQAwSRH7tuKm3Y KmWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=e0oyloDANX4qZ7yYao6NhCN7UInk2+mtNG14rMuVRw8=; b=kT02RYUNnVqCt3OWsW/M25AaRosMOV/WbaXEgwgOpUyRVgVt4xZ5JOmn9fIgHRJHdq xj9cJ/dDMQIrZifMD40U5NY8FojmQBPgXumTF2nMlMSNdGgzeGzgRhZqPboHgLjJfFh0 nAx/m/PJdH9rJ8YLvRvQPNFSBqaBiN1zrOv/T6iHaGKAubXgWrcLs3nN11ZGqya522z5 R9RAfQVwGR2Rm1FIXuP+k6TLQ1pGKRiBNMWGH4cFaa4frxFIUtmtjKqtbTre/03aFN6S 8hABwmB1Yyo2PLqxSM/aZY0P/Fu32r1Jh1cSXftwltCpyyk3nfLm+r5HWRmeyTlMzIch umkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=S2TryclG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a1709065d0c00b007827639faffsi170224ejt.760.2022.10.24.09.33.06; Mon, 24 Oct 2022 09:33: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=S2TryclG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234163AbiJXQQq (ORCPT + 99 others); Mon, 24 Oct 2022 12:16:46 -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 S234570AbiJXQPA (ORCPT ); Mon, 24 Oct 2022 12:15:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 885E3EACA2; 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 DD502B815A9; Mon, 24 Oct 2022 12:17:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FC16C433C1; Mon, 24 Oct 2022 12:17:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613831; bh=beAhWKXvQm9GjdNfxG+/MZqHkyVEr24AhaspX2hWJsw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S2TryclGSrn5flJ3BFy1pxfyok2HCusvJJ+C+pdH4qnPeDpVNVpjUHGamPWXTYl8g dBGAUrmkM8H3TPr0VtZd7ZLd9a1ttcmTevaBtqhki13GYfXUN8BF3+L7M0a+paErJn CwuIaPW6zon3DCqXQJysW0Saty82pPxyjjFud3J0= 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.10 031/390] regulator: qcom_rpm: Fix circular deferral regression Date: Mon, 24 Oct 2022 13:27:08 +0200 Message-Id: <20221024113023.929146219@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587391112386860?= X-GMAIL-MSGID: =?utf-8?q?1747587391112386860?= From: Linus Walleij commit 8478ed5844588703a1a4c96a004b1525fbdbdd5e upstream. On recent kernels, the PM8058 L16 (or any other PM8058 LDO-regulator) does not come up if they are supplied by an SMPS-regulator. This is not very strange since the regulators are registered in a long array and the L-regulators are registered before the S-regulators, and if an L-regulator defers, it will never get around to registering the S-regulator that it needs. See arch/arm/boot/dts/qcom-apq8060-dragonboard.dts: pm8058-regulators { (...) vdd_l13_l16-supply = <&pm8058_s4>; (...) Ooops. Fix this by moving the PM8058 S-regulators first in the array. Do the same for the PM8901 S-regulators (though this is currently not causing any problems with out device trees) so that the pattern of registration order is the same on all PMnnnn chips. Fixes: 087a1b5cdd55 ("regulator: qcom: Rework to single platform device") Cc: stable@vger.kernel.org Cc: Andy Gross Cc: Bjorn Andersson Cc: Konrad Dybcio Cc: linux-arm-msm@vger.kernel.org Signed-off-by: Linus Walleij Link: https://lore.kernel.org/r/20220909112529.239143-1-linus.walleij@linaro.org Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/regulator/qcom_rpm-regulator.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) --- a/drivers/regulator/qcom_rpm-regulator.c +++ b/drivers/regulator/qcom_rpm-regulator.c @@ -802,6 +802,12 @@ static const struct rpm_regulator_data r }; static const struct rpm_regulator_data rpm_pm8058_regulators[] = { + { "s0", QCOM_RPM_PM8058_SMPS0, &pm8058_smps, "vdd_s0" }, + { "s1", QCOM_RPM_PM8058_SMPS1, &pm8058_smps, "vdd_s1" }, + { "s2", QCOM_RPM_PM8058_SMPS2, &pm8058_smps, "vdd_s2" }, + { "s3", QCOM_RPM_PM8058_SMPS3, &pm8058_smps, "vdd_s3" }, + { "s4", QCOM_RPM_PM8058_SMPS4, &pm8058_smps, "vdd_s4" }, + { "l0", QCOM_RPM_PM8058_LDO0, &pm8058_nldo, "vdd_l0_l1_lvs" }, { "l1", QCOM_RPM_PM8058_LDO1, &pm8058_nldo, "vdd_l0_l1_lvs" }, { "l2", QCOM_RPM_PM8058_LDO2, &pm8058_pldo, "vdd_l2_l11_l12" }, @@ -829,12 +835,6 @@ static const struct rpm_regulator_data r { "l24", QCOM_RPM_PM8058_LDO24, &pm8058_nldo, "vdd_l23_l24_l25" }, { "l25", QCOM_RPM_PM8058_LDO25, &pm8058_nldo, "vdd_l23_l24_l25" }, - { "s0", QCOM_RPM_PM8058_SMPS0, &pm8058_smps, "vdd_s0" }, - { "s1", QCOM_RPM_PM8058_SMPS1, &pm8058_smps, "vdd_s1" }, - { "s2", QCOM_RPM_PM8058_SMPS2, &pm8058_smps, "vdd_s2" }, - { "s3", QCOM_RPM_PM8058_SMPS3, &pm8058_smps, "vdd_s3" }, - { "s4", QCOM_RPM_PM8058_SMPS4, &pm8058_smps, "vdd_s4" }, - { "lvs0", QCOM_RPM_PM8058_LVS0, &pm8058_switch, "vdd_l0_l1_lvs" }, { "lvs1", QCOM_RPM_PM8058_LVS1, &pm8058_switch, "vdd_l0_l1_lvs" }, @@ -843,6 +843,12 @@ static const struct rpm_regulator_data r }; static const struct rpm_regulator_data rpm_pm8901_regulators[] = { + { "s0", QCOM_RPM_PM8901_SMPS0, &pm8901_ftsmps, "vdd_s0" }, + { "s1", QCOM_RPM_PM8901_SMPS1, &pm8901_ftsmps, "vdd_s1" }, + { "s2", QCOM_RPM_PM8901_SMPS2, &pm8901_ftsmps, "vdd_s2" }, + { "s3", QCOM_RPM_PM8901_SMPS3, &pm8901_ftsmps, "vdd_s3" }, + { "s4", QCOM_RPM_PM8901_SMPS4, &pm8901_ftsmps, "vdd_s4" }, + { "l0", QCOM_RPM_PM8901_LDO0, &pm8901_nldo, "vdd_l0" }, { "l1", QCOM_RPM_PM8901_LDO1, &pm8901_pldo, "vdd_l1" }, { "l2", QCOM_RPM_PM8901_LDO2, &pm8901_pldo, "vdd_l2" }, @@ -851,12 +857,6 @@ static const struct rpm_regulator_data r { "l5", QCOM_RPM_PM8901_LDO5, &pm8901_pldo, "vdd_l5" }, { "l6", QCOM_RPM_PM8901_LDO6, &pm8901_pldo, "vdd_l6" }, - { "s0", QCOM_RPM_PM8901_SMPS0, &pm8901_ftsmps, "vdd_s0" }, - { "s1", QCOM_RPM_PM8901_SMPS1, &pm8901_ftsmps, "vdd_s1" }, - { "s2", QCOM_RPM_PM8901_SMPS2, &pm8901_ftsmps, "vdd_s2" }, - { "s3", QCOM_RPM_PM8901_SMPS3, &pm8901_ftsmps, "vdd_s3" }, - { "s4", QCOM_RPM_PM8901_SMPS4, &pm8901_ftsmps, "vdd_s4" }, - { "lvs0", QCOM_RPM_PM8901_LVS0, &pm8901_switch, "lvs0_in" }, { "lvs1", QCOM_RPM_PM8901_LVS1, &pm8901_switch, "lvs1_in" }, { "lvs2", QCOM_RPM_PM8901_LVS2, &pm8901_switch, "lvs2_in" }, From patchwork Mon Oct 24 11:27:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9150 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457511wru; Mon, 24 Oct 2022 06:36:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7/9opQCbbP2WueH863zQPGRU40gJJZSaLVUcpmJ3FNLxdRySMcpeAguUSbx6Sc9JY49R0X X-Received: by 2002:aa7:cfda:0:b0:461:9d22:3484 with SMTP id r26-20020aa7cfda000000b004619d223484mr8518716edy.142.1666618568047; Mon, 24 Oct 2022 06:36:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618568; cv=none; d=google.com; s=arc-20160816; b=p9nMGY59BPpMjH/dtymB39RJ6QsXfwGE/PqmRm5Uv3gmXXGcMzf+HgAA2fyCeyQklX sOP0oFW1cMSnGzx8woxLiKavcE++UpMY49JP2gWsz5uk5BRP9JSEMFTaVaFDW9WaH5Dl 6B6/nY7O5Bcgrgeae2sVXLHHKspNbuKW/yQukZPhm7iNyiGYqW6WB7nBtLEJiz8ejVm8 XIlTWUF8huToKTso+HXFc7bIvk+56q4F2kRepTpSYzdFhmTfQ/jillqXVPsAcPFehizg rMB2lsKHYL4GeIqalEzvGt7YmhhyKWYtczpTh408VkQ3AeDsvZaanDRYeock10aiVtxH Mcow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=M142iH/iKf0IxJX4vLVbstggAf87phS7m7Xr3pR+a0g=; b=UyaNkwktiUd2lBun7mvBJd6L/URBHZCA7lKc3Z7w9RkfLAf1VQCAoIHj2qGNE1bJCm 2I4+DorqEe2ZBleiG1lgu8s+/C2lpE/hd3mpNe/bStGgYtUWvYsgL73G25O5QnMf9HGQ C9MdnsZrxmvKu9/fja2BiZyhjmNjZgWqThhmIvxcU1FMOuY0GV0DjZdW1L6dRZzHPJAW elPp11unPa2ZeYJc+nzYnrnUCf1VV6hwW9Iu9BHzkdg0aCAGY38BttDFNP11VCq76uMm RZfH6lop5TvL2od3PKv6s3nRmrgwJf8mBqQ6A/6YhE8nDpXs6h/YLZ6YVBcMGjSEIWNg 80bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WThflEEw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x69-20020a50bacb000000b0044eae9b2c48si25885682ede.273.2022.10.24.06.35.27; Mon, 24 Oct 2022 06:36: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=WThflEEw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232936AbiJXNWl (ORCPT + 99 others); Mon, 24 Oct 2022 09:22:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235889AbiJXNVE (ORCPT ); Mon, 24 Oct 2022 09:21: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 71E8F9FEC; Mon, 24 Oct 2022 05:29: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 CB35F612B2; Mon, 24 Oct 2022 12:17:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAD07C4314B; Mon, 24 Oct 2022 12:17:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613834; bh=aU9Gt0iPwBDPKa7IP91JoYytDNje5Z60j/ahmFf6kbQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WThflEEwSpY+tgyVfqhasp5ErKM6ofFnSCcHvR8wCQ46SOpUa7rFTl0Oz8lmBfY// WSXc5xOaywj/5vMt6kPY3BAPtZcINDBjnyV9LtUitgQ2M35HyorEViuiBv8e8mZsgh rex2oE+Gk72LMlbA/AJbO3UwT8TTCwhNLbzoo5fM= 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.10 032/390] RISC-V: Make port I/O string accessors actually work Date: Mon, 24 Oct 2022 13:27:09 +0200 Message-Id: <20221024113023.969661405@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576231619137463?= X-GMAIL-MSGID: =?utf-8?q?1747576231619137463?= 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 @@ -114,9 +114,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()) @@ -128,22 +128,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:27:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8995 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp439966wru; Mon, 24 Oct 2022 06:03:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6WnRWJSVoQ9XVpt8VTMmP2o2JbFa0nisCzPwJzTgBTzV7EKqCgUr5ISd4+WnoS2Vi3C688 X-Received: by 2002:a17:902:d484:b0:17f:7437:565d with SMTP id c4-20020a170902d48400b0017f7437565dmr33153048plg.154.1666616615058; Mon, 24 Oct 2022 06:03:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616615; cv=none; d=google.com; s=arc-20160816; b=QHXhx05yAFjgUA3sVkynILB5avHmUKq5n3fy87la9oR+kRImQnB7q23kPfJHiJp2oo tPlJbXwZEN5Yepv7ZDmmMHk4aB95jDGSGs+NQGskpHv3rsvI8xgXFPUBxBRUO72cw1Nn eOScTbnDpiPNemv1jSqgyz8Ai7+0Vsun+kjhbbpTza3A0CHl/Zqfj/qoTwRbLa1i8G27 J9Y8DHBXEciW5Fr0Cxd5Wh1Gt/sjLt2briMVb1KCQGxcngpykL9XYHFZq0RlmjgNAKI7 yX6nop4hGoXYrTWm2WX0APLuBLAUkRRGFNnjnwt9XNqT2GAVTWgbW2XUhAPolFjevF0b C1jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=CdL2yyccXwDfVn4Tp6XFWjNra1sr/e3hsqVcWkxo9W6bSnJwRsMvYpDwOr4xHxXwe4 kxXEK5vLlfRQrdnEy0PHKJkR4OgmO4LYog4YzqhruHexfOBT0l4Xtts0OrPFIe9w7ZS4 5wQEH6HUJ+qVWDx+wVzkk6YHGqrbTvnqxfnsLlIwKzS2OtEbrB3K2P+Ow5SCPhntLJsY u0+TetYx+G7Lo0VhhkdIvKAsQ1xWbtEaZhqfHAZJ5bYnwDAKcQgbxZyQF7zLoMY7lmcF UnEXWeQ0KopFDN58G5RVXDZDgHUO4zB6TTYfpqXK0t7oivrtNTl7wWMgegwFeamcJtHp D5Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uQwAPuVr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a632c03000000b00460c67afbd9si9779823pgs.771.2022.10.24.06.02.47; Mon, 24 Oct 2022 06:03: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=uQwAPuVr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235053AbiJXNCK (ORCPT + 99 others); Mon, 24 Oct 2022 09:02:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235144AbiJXM7Z (ORCPT ); Mon, 24 Oct 2022 08:59: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 E5B569AC1B; Mon, 24 Oct 2022 05:18:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 714AF612C3; Mon, 24 Oct 2022 12:17:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 843A5C433D6; Mon, 24 Oct 2022 12:17:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613836; bh=Ys3ka49cccFJzfsTCTuZ+erQPYHY5yRX3BygybRzjkA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uQwAPuVreDBRQzb+Q1lJi5xqGEWZueMXhWTDUFg4n97djBTGqA2tCFDo/aRf1Tkef SDmuZXwAkdQ1PDrwOKhl+S+JX5CgdmrZBzfsIp+OwGyCO4jVOHBAsFnhKAvD0U0Ly0 C9SOsHEgmZ+xmrGntU23iZEPxkaZ6P6iqf6Z56V4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller Subject: [PATCH 5.10 033/390] parisc: fbdev/stifb: Align graphics memory size to 4MB Date: Mon, 24 Oct 2022 13:27:10 +0200 Message-Id: <20221024113024.012872639@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574183710510695?= X-GMAIL-MSGID: =?utf-8?q?1747574183710510695?= 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:27:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10376 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp689216wru; Mon, 24 Oct 2022 15:52:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5vHLndVZtRbd0+ecth7WgEF8oY9BENfz9GblgYUEk59Vj15NHgQajm8Cju5wsc+pTr9Y92 X-Received: by 2002:a62:fb14:0:b0:56b:de9f:10ba with SMTP id x20-20020a62fb14000000b0056bde9f10bamr6304915pfm.30.1666651974730; Mon, 24 Oct 2022 15:52:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666651974; cv=none; d=google.com; s=arc-20160816; b=E9HdrvnOWWYTXc6FAIytWCBRXNjxL/M6/qaDSfy+HliWuBW12NHXxFDtB4mKF8vAMF 1LpxCsp3/42Ci+N2oN+hvGKtdVmHKArFTXSWpkLsJ+Eb5fMYDskvKi2zn2FQtBRpI08m qssah/vLwu7Miypdn/y5EHdVOyBJkTTlKhP8j0kg6n6BgBJBL0DBhSznwF6tazLHwXza FpAQqtCOGMBG8ITf3C2yW9fzl5CSK90p8ahWuLH5LCZvdXoRPXBUO3acDxwNlty73LB4 pwISQ3R1vLGpdPnTuprznQEHEk6XSnakidu1EvfKRBKu6bgHThJEmVAeo2JlA9BfR8WY bPTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=Tvv9N3anvXFsLXvkC+3K0jhRXV62vUZzAXdu3sdHIMdPmOQ632Zh5DP+130eSWNbb4 5Z9DJ4iWrzrjV0fCf2bOV47zdbIkxyJo+j6zxcMzsymz9OCJGAf6WT1YDAqSPo6kSBOG PKZmh7yOagNIEiA2tvMnGhZQcD6uqneCYsBm2TxKFQMdpaD3JObnbi4rjE55a4amIV1u hOy9dgaxVMjr7WQrmWvmmUUZSRif2ppBGDHrweoMLYcnb9tpp/xsPQUk+sWLMoTN9mdp D57JoI+RbEQnHjSCU9cfwDCdwqXdD/YYO9LTcsvBc0n5mBfxCHfIofBbOxzBQGbb9lcJ mbow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="btM/N0s+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q18-20020a170902eb9200b00182bccf6195si786925plg.596.2022.10.24.15.52.40; Mon, 24 Oct 2022 15: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="btM/N0s+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231927AbiJXWvS (ORCPT + 99 others); Mon, 24 Oct 2022 18:51:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231714AbiJXWup (ORCPT ); Mon, 24 Oct 2022 18:50: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 3ECBC3200D6; Mon, 24 Oct 2022 14:12: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 C89DCB81367; Mon, 24 Oct 2022 12:17:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27F31C433D6; Mon, 24 Oct 2022 12:17:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613839; bh=u8jCsQTg+AUQ8MfWiYmhRVCIrhrvAtAfKvtbHgYSGJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=btM/N0s+PIiLZQmqKVPV4MLgrgtZ1sdQQbf3JqezH8yJwDyaiRZohVRulUIWHxpJl IpZpNOiqkwmgV4Cv+hBh8y1xNji+tw/jWmagqoOTOWlnq7d/dOPvXNfIYJ8XgYZvHw SyhbVFbZFD6A7m+v8g/CL0+qosQ9SfMkAUQlXg0Q= 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.10 034/390] riscv: Allow PROT_WRITE-only mmap() Date: Mon, 24 Oct 2022 13:27:11 +0200 Message-Id: <20221024113024.063589708@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747611261298777160?= X-GMAIL-MSGID: =?utf-8?q?1747611261298777160?= 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:27:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8996 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp439967wru; Mon, 24 Oct 2022 06:03:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5N1GuYf7m8YsyD4eQyQrKWXDD7faC+ElbJSg8r7jIbeCz4HkHS+4xxJBfHzAYySgXw7UdE X-Received: by 2002:a17:90a:7787:b0:20d:3093:ae7f with SMTP id v7-20020a17090a778700b0020d3093ae7fmr71156015pjk.226.1666616615006; Mon, 24 Oct 2022 06:03:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616615; cv=none; d=google.com; s=arc-20160816; b=AeXinX8ARdBxf74KzJmlkqJjPKo6bZ2gdi+HCXmIFiR9ImDOiKP5wJ2UIF/FnuzX9N n3oL0OGQJHNgzc//ORKLVPbi6QwioolX7Zblx2INXqDSKuyHIqyUHJqFNCDx+8h1Jcc2 pvmTWTntjHamMCv3X5XCYgA5pSzJ1IguOIV9XJjJTpEJaXIhU7Fultjc6PLlVFsq8oqv 6FzP9mL2FqQBzSrtQ+OvG8zcugn4toU3l8sdBCUlL6CJNCK9Dsz4P8q22T4jdVz8FK+i AB4KEr/0iUI9EdykXdNUrmhXVbhQgVY+JeLraayHIAXRToWHyN2uLXlDYFLQbqRVT84X C3bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hgUxNtk3XEIPN9JxG9DlwPWJDzAzbHU2Ehao+CAA300=; b=WZZZBOic9ZLKuYr0i6+pp9JaXdWbshfvs6NWd/1HLywN87Ummbc7i/wY6MAF6Wg5gh nubioBpuBrZTbCeVgbfYih0GrYITR43/VNqfPlblhr/Ejv0QgzyVU7pdqI/AwFtTeMfg +1cwEZ5MKgDkuuljROJmWj+A9c/nJrKYHMnUGhoB7JgXmwPsQEE36QX5mudW2aAmaVrs O0aUt3RMkconqmX2cquvXwXWqKNT8r0nXQWl6qsB1Pzr9U7dTNdFY4pN3DwigOrnj/54 luIRgpG9K40VODb1McJ0f/vPYXy4UAzwvlsVZh54OlUPaRRMKFrfZ/5NFyg3X0+sNG2K wB3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=x9MjdjA9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lp12-20020a17090b4a8c00b002130f4827afsi3677280pjb.87.2022.10.24.06.02.50; Mon, 24 Oct 2022 06:03: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=x9MjdjA9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234764AbiJXNBz (ORCPT + 99 others); Mon, 24 Oct 2022 09:01:55 -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 S235097AbiJXM7T (ORCPT ); Mon, 24 Oct 2022 08:59:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5FB99A2AC; Mon, 24 Oct 2022 05:18:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 531E8612DA; Mon, 24 Oct 2022 12:17:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63701C433D7; Mon, 24 Oct 2022 12:17:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613844; bh=RLkjsXNCeD9Aft4ml7uTuapdTsXixKA/dEjOa/v5+hA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x9MjdjA9KM/qObeu1WF3d/so3fvtkRATdxHxjy7OnnuUhnmBgDvPMS8nni7mV69Pn /kD1+DxodV849x1fsG88eqJiO6b15Uw68VLpQJVbjha0B9jmh0ipB6pv3XmNl5l3F4 zECNN902EttNzRqCNGfGTDjcPCdjkK6zgM+Ss5Wc= 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.10 035/390] riscv: Make VM_WRITE imply VM_READ Date: Mon, 24 Oct 2022 13:27:12 +0200 Message-Id: <20221024113024.103392568@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574183716409701?= X-GMAIL-MSGID: =?utf-8?q?1747574183716409701?= From: Andrew Bresticker commit 7ab72c597356be1e7f0f3d856e54ce78527f43c8 upstream. RISC-V does not presently have write-only mappings as that PTE bit pattern is considered reserved in the privileged spec, so allow handling of read faults in VMAs that have VM_WRITE without VM_READ in order to be consistent with other architectures that have similar limitations. Fixes: 2139619bcad7 ("riscv: mmap with PROT_WRITE but no PROT_READ is invalid") Reviewed-by: Atish Patra Signed-off-by: Andrew Bresticker Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220915193702.2201018-2-abrestic@rivosinc.com/ Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman --- arch/riscv/mm/fault.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/riscv/mm/fault.c +++ b/arch/riscv/mm/fault.c @@ -167,7 +167,8 @@ static inline bool access_error(unsigned } break; case EXC_LOAD_PAGE_FAULT: - if (!(vma->vm_flags & VM_READ)) { + /* Write implies read */ + if (!(vma->vm_flags & (VM_READ | VM_WRITE))) { return true; } break; From patchwork Mon Oct 24 11:27:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8993 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp439881wru; Mon, 24 Oct 2022 06:03:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4J2D4syf+ZU4Zm7sg3Dxqm9kJ/Xbuy9RCgubO2K+2pc6176e6nbMK1e6G4QuM86XxsqTN3 X-Received: by 2002:a17:902:8215:b0:178:6946:a282 with SMTP id x21-20020a170902821500b001786946a282mr33936475pln.162.1666616608113; Mon, 24 Oct 2022 06:03:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616608; cv=none; d=google.com; s=arc-20160816; b=uRfC93ytMENg9jOL5QeqxYbrJf9tZ0tzYd54HUloK5SEk5zeECy+rlJzR5WHh7Fxhj tCO3oGBicZCEfCXet8M0MfVD8c1y/q/zO+EdlCpGSP+7/qlS1Jxr58GoLexszpQ7owZD AIL7vvgCH/58Ug8ViV7dzEI+EtKpZFPF+rBUBt23M4v20ptgezPZznp0FJSJUG6swI2S ZKocAjAKRAEP9zs7WyiPLFIChufe3fkFySNBurASJ5GuklqavQeuwpmq37pjCwwGBv6x LB3k3zp9Te69U3yuglWQgAPB3Fw1kDgbbv7n+fbKC2u0GcKRgM5bpXcoiOhNQF9VqfsX W0Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2SKRsv0L00ej14tNzRc6CY10JuwzV6sL5p5Olv8OY+I=; b=uxhaPZo3qU5JLuoF++MBYoBpGPDrE/7SBcsT5hpUFO+DpawK5WjBZKzXHmOy5saOLm G15OREQAOTsgqiLMINomPHzPZ181BfbF5xGJFB6xrXutDvoJrNKZUfYFrAEpCahzD3zV gTgUTNfUlO6aLPI2kuJ0UC7xsa72WVXeIxDp8mlkN3YgOn0dkis1z16b+BvvPZZ+dAx/ 5dXcBv4cxhBCURCr3rLdpCgOxyzNkk+A2TiTixyRqWPKvMjmbdoaosAqG7jp15Wb9cCd /t4F2SA4RUtezLwlhdRDtRrXPohhGGeQ47YWoaRVVBhuOrBVRRlBl2vpP8sIIo3HeBe/ 5KKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="j8/hWM6+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a632a58000000b004394687b653si2137213pgq.253.2022.10.24.06.02.43; Mon, 24 Oct 2022 06:03:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="j8/hWM6+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235001AbiJXNCD (ORCPT + 99 others); Mon, 24 Oct 2022 09:02:03 -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 S235110AbiJXM7V (ORCPT ); Mon, 24 Oct 2022 08:59:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07E6E80F67; Mon, 24 Oct 2022 05:18: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 DEC82612D6; Mon, 24 Oct 2022 12:17:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB8A6C433C1; Mon, 24 Oct 2022 12:17:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613847; bh=YgOEx818IrQxGo5DVu69YsFYIA0M4LK5XBmFFGCtB00=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j8/hWM6+emjNv2uIo4uBx8G64o6RUr3EJsYqO6pk1ipUwhNvp1y9pP2CI5mzqD2ah ZBZbdqqIv8m8i7UQM+oaVd8qxGhT4DNgazoG4YCBH37eeLXyiSop1JZ0EZ4w3Q3zgv XZBWLlbZfD5wAxoR2zTNohI50QduC0wuXB3TVHYE= 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.10 036/390] riscv: Pass -mno-relax only on lld < 15.0.0 Date: Mon, 24 Oct 2022 13:27:13 +0200 Message-Id: <20221024113024.151598905@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574176138472957?= X-GMAIL-MSGID: =?utf-8?q?1747574176138472957?= From: Fangrui Song commit 3cebf80e9a0d3adcb174053be32c88a640b3344b upstream. lld since llvm:6611d58f5bbc ("[ELF] Relax R_RISCV_ALIGN"), which will be included in the 15.0.0 release, has implemented some RISC-V linker relaxation. -mno-relax is no longer needed in KBUILD_CFLAGS/KBUILD_AFLAGS to suppress R_RISCV_ALIGN which older lld can not handle: ld.lld: error: capability.c:(.fixup+0x0): relocation R_RISCV_ALIGN requires unimplemented linker relaxation; recompile with -mno-relax but the .o is already compiled with -mno-relax Signed-off-by: Fangrui Song Link: https://lore.kernel.org/r/20220710071117.446112-1-maskray@google.com/ Link: https://lore.kernel.org/r/20220918092933.19943-1-palmer@rivosinc.com Reviewed-by: Nick Desaulniers Tested-by: Nick Desaulniers Tested-by: Nathan Chancellor Tested-by: Conor Dooley Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman --- arch/riscv/Makefile | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -37,6 +37,7 @@ else endif ifeq ($(CONFIG_LD_IS_LLD),y) +ifeq ($(shell test $(CONFIG_LLD_VERSION) -lt 150000; echo $$?),0) KBUILD_CFLAGS += -mno-relax KBUILD_AFLAGS += -mno-relax ifneq ($(LLVM_IAS),1) @@ -44,6 +45,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:27:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9137 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457486wru; Mon, 24 Oct 2022 06:36:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM487JIpzhQKaUXw0zWm+6N0nAsem6Sk67WxTwhy9q0QBGw27/V0Qeh+TXMUA9ZxZfy2OPGo X-Received: by 2002:a17:906:eeca:b0:730:6880:c397 with SMTP id wu10-20020a170906eeca00b007306880c397mr27573485ejb.593.1666618566323; Mon, 24 Oct 2022 06:36:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618566; cv=none; d=google.com; s=arc-20160816; b=Eoci25Op1OPUTGyT940UG+bTySEDyeDzlBv3k7E8jT+Fw6TjQ2fzUp7i/XqgTLmxYr AiReSy2F4R5YPg56RWxI48GN7UqhT6d5MDTfGmDaaGwlaED+7yUkCrUVB1CRKRC9k4WS 77PbSsa5oE5MOqYXAiUWLvP6iet84GDN+nxK2Aq+vQHMUioIPz48w8UWu07N0M/fkN+F 9TxCQhqHy7yYNbNnZgZUZ6pL0W+mgoNYk1x5Z3alh08fag/Obeik1849Xbxm2QVl0ZSR Wjj9BGIN3JmrMceAJeMng5EIdDRjk3WFDjSWpWQEYNXOx/Ufs5i2DgYLtw+V7lBX6vCq EvuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=lUxf3fSAVygpFFNwYy2UYWi0Tkq0s/oC8ik4eWQ8jBEXgewuP1REUw0MMSbRzx/8ZB sdnTwpHTZDKoVxHRYBdzXPRN/DCJhOXShrqxe/WadHbZp5aPqmH0uS5twXbO4ldrBxVE LHp73PjFbB8z5f/vcskgzGlxC1YRjp2NCCFAXvp7Qo3H86CBXszqy8qFVItIhSxf5N27 W7e5NHlMs5hdZWcBye4mhn4g06aMinL2tOj0L54mgzWFDbSnSzrEte/cjkFmk4F0qu8v 2nspbRwbxztuzH6aUtBHzOQQN61PuFbBkcwkbf91tiz+FOzO9XKNTQPTZgm4X+G2nyYi zFEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xAzQ9259; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170906135700b007470b52f94esi23041264ejb.199.2022.10.24.06.35.26; Mon, 24 Oct 2022 06:36:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xAzQ9259; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232547AbiJXNVj (ORCPT + 99 others); Mon, 24 Oct 2022 09:21:39 -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 S236403AbiJXNUW (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 BB30A1A20D; Mon, 24 Oct 2022 05: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 dfw.source.kernel.org (Postfix) with ESMTPS id BA4C061314; Mon, 24 Oct 2022 12:17:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBE36C433C1; Mon, 24 Oct 2022 12:17:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613850; bh=uBbLc8QAgT9cQGnph4PMHqBIqShqWIcTjog/nTwhBok=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xAzQ9259mo7XcfnjvBhTCwnQQE8lO8k6Wr1tA+xKsXNA6KBTyfCrO45mtaoO3YvoW TCPjbme9MqNpSlmDwfHM31cmYBtfD1IQVP69z1CkHl/I4wAB9gEwqIblUMN3r1ph2U UcJQRCksfTlz3o6Op25FUxp83KX2MLeAudt2Rtro= 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.10 037/390] UM: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK Date: Mon, 24 Oct 2022 13:27:14 +0200 Message-Id: <20221024113024.190058996@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576229795035316?= X-GMAIL-MSGID: =?utf-8?q?1747576229795035316?= 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:27: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: 10139 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp637287wru; Mon, 24 Oct 2022 13:24:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7MmF9fXnrm2UXjVbgiDCmIzo69QBNvu7o+e3SS9B1RMgHZQsfy8+7U6PW/Zlb0knveSi51 X-Received: by 2002:aa7:d385:0:b0:461:8cd3:b38b with SMTP id x5-20020aa7d385000000b004618cd3b38bmr11523769edq.172.1666643039827; Mon, 24 Oct 2022 13:23:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643039; cv=none; d=google.com; s=arc-20160816; b=SqgVL5mEjQGb65xkb77FDZ8hBtOZTbqFVppDzH5WIUJyeflOyyYXR0Xw0aWJxzQuLX Ux5xk9GrAUb3O4Sb2cBqDJI0sWi19jd2FXsJvzDExx2jphYZjX5cFxYOwojk5GvYx+5x 9grSoANlnfqeyDFEk9KPwly13wSmic4a7ILEThovLQ0DzUQYG1OtxH1NVFHLqDBNXrln ap1hURDdEDibHa7gD6jddz1dyFIH0x09BkgUefDmG+r4vovVzq3yaBxKpqQ6Mf/AHaQc +60KXqPMTB/L6cgUaH3cYCuRq2rW0CwSiOupsXnK25vJaoDuTGxlLbpdUANFeTQdWKbO 3ISw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hcGYiMlPvuQII6VixFbASPaNdGwELsqOqc7aw+edUhg=; b=GyAY+1zMLRA0Crl0betAKxWh+FihM1Zv8JzbIbwYl1gSn69oNdwN+RL2tv3qcHIbRq Pk5VzRXZ0eHFFaGLa3VZ+L38X9D5dvbp/1J2yhtkocxL/ex/taymkGh8NolftHlznsC2 BW8syoh4fZ8/kXHCQPPEZXx483JC09/9sCIawiFTR1sXaLLNjnD25ssS/5B9UHL991qP +qZdtbtD+k10fx117HxmzfC9uhyrapZANQlMwrf0U5vCBTlX3SWlNAtSQ9GcMX4glMgW 8LIbMuj5ep6n10hrjwv1zHNplUJMjWxcnJlnttOabO4Xy+WlCEE1Z7nwWi2SBqGR83uN XjQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OYCfn9UW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s18-20020a056402521200b0045ca15afe1csi626307edd.553.2022.10.24.13.23.32; Mon, 24 Oct 2022 13:23: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=OYCfn9UW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233988AbiJXUOe (ORCPT + 99 others); Mon, 24 Oct 2022 16:14:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232012AbiJXUNj (ORCPT ); Mon, 24 Oct 2022 16:13: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 9849D981F6; Mon, 24 Oct 2022 11:32:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4CE73B81598; Mon, 24 Oct 2022 12:17:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A38CC433C1; Mon, 24 Oct 2022 12:17:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613853; bh=adJuxEBQxYEv/I8sxZnRSjADWw+N27RR7P06eLcjfnU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OYCfn9UWQVbvCwKwSQQWwSwDziR+BiKBJrh/yw8qaNwxsmy5Du7BlMFrrnWbhSSrG 8YCxkzfY29iEpGGMmgSjVwTLwRMV2VAv3Yt32kwXn3gN0qYp1wEphihTTtUYdtM/0w qhf5DVlNdDt/pIqe2zzirs8nAgti+phKJBUhoA44= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rishabh Bhatnagar , Christoph Hellwig Subject: [PATCH 5.10 038/390] nvme-pci: set min_align_mask before calculating max_hw_sectors Date: Mon, 24 Oct 2022 13:27:15 +0200 Message-Id: <20221024113024.232587126@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747601892289109655?= X-GMAIL-MSGID: =?utf-8?q?1747601892289109655?= From: Rishabh Bhatnagar commit 61ce339f19fabbc3e51237148a7ef6f2270e44fa upstream. If swiotlb is force enabled dma_max_mapping_size ends up calling swiotlb_max_mapping_size which takes into account the min align mask for the device. Set the min align mask for nvme driver before calling dma_max_mapping_size while calculating max hw sectors. Signed-off-by: Rishabh Bhatnagar Signed-off-by: Christoph Hellwig Signed-off-by: Greg Kroah-Hartman --- drivers/nvme/host/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -2624,6 +2624,8 @@ static void nvme_reset_work(struct work_ if (result) goto out_unlock; + dma_set_min_align_mask(dev->dev, NVME_CTRL_PAGE_SIZE - 1); + /* * Limit the max command size to prevent iod->sg allocations going * over a single page. @@ -2636,7 +2638,6 @@ static void nvme_reset_work(struct work_ * Don't limit the IOMMU merged segment size. */ dma_set_max_seg_size(dev->dev, 0xffffffff); - dma_set_min_align_mask(dev->dev, NVME_CTRL_PAGE_SIZE - 1); mutex_unlock(&dev->shutdown_lock); From patchwork Mon Oct 24 11:27: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: 8999 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp440031wru; Mon, 24 Oct 2022 06:03:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4E5TtpKBZ23ImpOr7kjivMw6GgnKi/KiowxuxtA11nKpqXExbx32Bd7Y9JnknD7NtkrSrr X-Received: by 2002:a17:902:768c:b0:186:b136:187a with SMTP id m12-20020a170902768c00b00186b136187amr2804571pll.94.1666616620014; 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=0wWF2rx4hP1Kkqj/3XVy6unbIaUieVFvKz4X4yY0j1PevxQXe7N6DsVQ0eCVLtz164 mtm+SGWNkqlrLH+Yc/PAFB7mJSuY0SVbIJw42DyxB3uzEDSezs9XxWZ3BbIdJp8gXzD6 ZCqNN7xeF8923H/mABfTdYHsgJ0KdwhwP/D9+lGsN+WykMYY+mS+nHRuinz8tQEv1i7P sa9/YiH7gGQifhFtvH7ql2gBjXdbZriz0xuZ3Gvg5l0MtAJUfwJXsS6tmxaW+siHWsy1 2VgfSAVqIJU5gPJL5/bOGypfup+HbviHXWuzMnuoKYmXhtdZoZsEsDws/D8QZE58VMRL XZMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=b4qccJppdpzrYQ15KlsdNnHH9IFLyUHbGt/CyKf2LV0=; b=ZP39EP5+iDoZ0WyK/AriDBCk8xgEq+qnMQmg+yA9QR5iH4U/NTPaudaEmCdKYCp7sS jedyaL/pldBOdH8+EDum0W7QdJ/BEc1B+wGjgKclzJLQx2XBl72nSMPOpRpy9hEIsVAn lDFbjl48tILNh8V4UXr+FE72q7j6TH3QdC80pbGipYVNRSXZ7sF26ajXImz3+RKMdChm igcu9XTrNpi0D+xnbUBoxfYiGfAwzyJdOdXX52qdErNJeOo0NECRGfAtUrlq4PqTlR2a 9LiZF9/nRLkj5AdvCG5FuHcUl+NMXy6MKFhY4pdFxemnm3qEVZGmS/UUmJdfHflxgXJJ 3gtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ztJWsFYT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q29-20020a635c1d000000b0045131d08c18si36655532pgb.244.2022.10.24.06.03.24; Mon, 24 Oct 2022 06:03: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=ztJWsFYT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235052AbiJXNCq (ORCPT + 99 others); Mon, 24 Oct 2022 09:02:46 -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 S235184AbiJXM7e (ORCPT ); Mon, 24 Oct 2022 08:59: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 01D279AC0E; Mon, 24 Oct 2022 05:18:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2FBC96127C; Mon, 24 Oct 2022 12:17:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47357C433D7; Mon, 24 Oct 2022 12:17:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613855; bh=rFx6IledfGJHPDeud7Kp7IvT8JMftQdELoVzKu025jY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ztJWsFYTYO00keghj96qiGErgULdPEpVkm14lZbzEsjOlj2JpjQ5LvY6UloDPYoPe i5Xak0GAlQc2UBVhEcCMlZtste2gwWjDf3jJ66UjMY4duMVQ1lQPJlI5LIY0JThSc0 zW+r4QzFd6YRQi1UVPthJfBlKbqZZlFALpE7Sw50= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Emil Velikov , Dmitry Osipenko , Gerd Hoffmann Subject: [PATCH 5.10 039/390] drm/virtio: Check whether transferred 2D BO is shmem Date: Mon, 24 Oct 2022 13:27:16 +0200 Message-Id: <20221024113024.266842727@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574188729241293?= X-GMAIL-MSGID: =?utf-8?q?1747574188729241293?= From: Dmitry Osipenko commit e473216b42aa1fd9fc6b94b608b42c210c655908 upstream. Transferred 2D BO always must be a shmem BO. Add check for that to prevent NULL dereference if userspace passes a VRAM BO. Cc: stable@vger.kernel.org Reviewed-by: Emil Velikov Signed-off-by: Dmitry Osipenko Link: http://patchwork.freedesktop.org/patch/msgid/20220630200726.1884320-3-dmitry.osipenko@collabora.com Signed-off-by: Gerd Hoffmann Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/virtio/virtgpu_vq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/virtio/virtgpu_vq.c +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c @@ -601,7 +601,7 @@ void virtio_gpu_cmd_transfer_to_host_2d( bool use_dma_api = !virtio_has_dma_quirk(vgdev->vdev); struct virtio_gpu_object_shmem *shmem = to_virtio_gpu_shmem(bo); - if (use_dma_api) + if (virtio_gpu_is_shmem(bo) && use_dma_api) dma_sync_sgtable_for_device(vgdev->vdev->dev.parent, shmem->pages, DMA_TO_DEVICE); From patchwork Mon Oct 24 11:27:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9002 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp440042wru; Mon, 24 Oct 2022 06:03:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Xp7PF2NmJUgth2AJviqTv+1Ix0z8CSHBAPMVz1xbue1NNPwwI1MlHNeKZc5M4ijebrna0 X-Received: by 2002:a63:b64:0:b0:439:8143:c184 with SMTP id a36-20020a630b64000000b004398143c184mr27750765pgl.22.1666616621208; Mon, 24 Oct 2022 06:03:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616621; cv=none; d=google.com; s=arc-20160816; b=XmS03MZpfXvTNMYQPKHKvwNBIeJ5X4l7xqBk4D1RhC/uTkAWPBd0+zcUskZFM8ixyh nx7ioUWw9iGoD6PpCscDFGSMGtQQal4duWoqDrmSX3X1d5KgS51Obh966KDaSPbpiSsD AMZAfKe0hYDIYwy1Rr/LCSu9OdKUwe6o+a9cNZIr0hILm9jATObcC3BBUZVH/V48LEkS A22TftIWOxi3dRv149JJwa781vi5EBzadbJF/ZgF9TyGz4xFuULmX+/s5dKRw+e3qEyX IQjiBljBtcm17x6D5pwUXo1Oz+RPpFKG/zi+rWqKf0mtMRTyglgMKoBVWC3YJA/QsS3y MG2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kHI3whNSxNlxSvC+5gweH4/7CuSyDy7qsZAm86I5RPA=; b=IAH0BQmzZ/BreOf6WF3eLXoQtSqHIUgStY84pIdVyhi3mZi0hDSYiXu2+dUKKSOi5g JupHbkhxHfZWJLusekEOmdhcTJufNi0LkD59u75qJ32wDZu3cBY5Pc+42AgZj9hYlkYL RqloSzkRzpum/tBA7/rkoaEZ/28qGcz+jxMk3AV74kUj0DDa9TSX8Tu5d+LpB/jijuc0 ScZPVORvSvFcPgn9CUqrcUy6iDzGtXW6QeDDiwkHIvP/xy2+MaF9vFIpOmmLmcwJoW6v tbtBhFbeLzFD4lyMuYU/UDX7V3FUKYCMQCf0EdEZNkIVsEtqLe6zpYJ8drZ/qqgIVIlr Wtdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=K6brJhVN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ip14-20020a17090b314e00b00205d6cc25cfsi17634249pjb.72.2022.10.24.06.02.57; Mon, 24 Oct 2022 06:03:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=K6brJhVN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234969AbiJXNCT (ORCPT + 99 others); Mon, 24 Oct 2022 09:02:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235150AbiJXM7Z (ORCPT ); Mon, 24 Oct 2022 08:59: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 BE8979A9C4; Mon, 24 Oct 2022 05:18: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 C4845612CF; Mon, 24 Oct 2022 12:17:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6A9AC433C1; Mon, 24 Oct 2022 12:17:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613858; bh=+1wtXQ/SMp/UBtgYnYz8DzxTxECRtHjyku2Osan6gRI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K6brJhVNU3wAohLZhOld/hYI9xhl2ypt2l66usIO7tHsX9hYBJP+hV3Y1p37eJ+H4 GsOvSNyMqmv36CfrX/6T7gKIppH9HZZNkPmWJF+AOj6qoMJIOuD+hzcFUBJX8nHFuL rxlhqpCoRww8p614Yj3GXpRDyeEjsyf47YJfLIGk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Vetter , Takashi Iwai , Thomas Zimmermann Subject: [PATCH 5.10 040/390] drm/udl: Restore display mode on resume Date: Mon, 24 Oct 2022 13:27:17 +0200 Message-Id: <20221024113024.310920666@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574190242360290?= X-GMAIL-MSGID: =?utf-8?q?1747574190242360290?= From: Takashi Iwai commit 6d6e732835db92e66c28dbcf258a7e3d3c71420d upstream. Restore the display mode whne resuming from suspend. Currently, the display remains dark. On resume, the CRTC's mode does not change, but the 'active' flag changes to 'true'. Taking this into account when considering a mode switch restores the display mode. The bug is reproducable by using Gnome with udl and observing the adapter's suspend/resume behavior. Actually, the whole check added in udl_simple_display_pipe_enable() about the crtc_state->mode_changed was bogus. We should drop the whole check and always apply the mode change in this function. [ tiwai -- Drop the mode_changed check entirely instead, per Daniel's suggestion ] Fixes: 997d33c35618 ("drm/udl: Inline DPMS code into CRTC enable and disable functions") Cc: Suggested-by: Daniel Vetter Reviewed-by: Daniel Vetter Signed-off-by: Takashi Iwai Signed-off-by: Thomas Zimmermann Link: https://patchwork.freedesktop.org/patch/msgid/20220908095115.23396-2-tiwai@suse.de Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/udl/udl_modeset.c | 3 --- 1 file changed, 3 deletions(-) --- a/drivers/gpu/drm/udl/udl_modeset.c +++ b/drivers/gpu/drm/udl/udl_modeset.c @@ -400,9 +400,6 @@ udl_simple_display_pipe_enable(struct dr udl_handle_damage(fb, 0, 0, fb->width, fb->height); - if (!crtc_state->mode_changed) - return; - /* enable display */ udl_crtc_write_mode_to_hw(crtc); } From patchwork Mon Oct 24 11:27:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9005 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp440418wru; Mon, 24 Oct 2022 06:04:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5aHBcdeSHWI8hOHklwG3ZYVuiJF5fYjoyZFc0evPBf3VTu+jg5xR52iUZH9hfSA/MFc/r9 X-Received: by 2002:a17:90a:ab06:b0:20d:8764:b97a with SMTP id m6-20020a17090aab0600b0020d8764b97amr39061934pjq.7.1666616644352; Mon, 24 Oct 2022 06:04:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616644; cv=none; d=google.com; s=arc-20160816; b=cUd6YpW/SCsGoY7MkB8LGXfHsUryKg0xRvXXPfGfL3ZoyBjL+FZ4G2V6AFiXxkHyVA SeEUgU8iyWHm4WWtkwizLewTyglI5+K6MwWStr0Kj1huCvRHX0FdbmZWGsU27bzcF1qJ WVYvbDdb4QQ7/2jUkEzPQrPjdpdfSUpO7Q6BRiq5DwtVHLz7UUFJ1EiMcvBUDFBehJwM OCuzDaLSQfPJZOMobryQEslbEQGVP1w6HyKIOXL5q/Za25wvxhPnmy0sVK05MC0zdBRX X1mnV+zjm6mejhl2Z76Sk41bO+IE2ZHD/dYEpgtfo4XCnQ5smQJzqoxu0AyZ2kVKR3e9 v23w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AmsdnmlkCJ/HuzVv0W09SYfLcNT0Qmgjudw7/HO50BQ=; b=v1KyfiOgR534XIur+GCzxd1/d8lecF19k7IhHc1SWIg0khtAcc1zq/WNIMvC3mzRRo yJKphlhQy7G3+4O7lH/b/DXg9ju57ZSNr10vnZKajg0vaCxX52WqTyjUrfneUoVMy9Kn JP35lRAoYjygtB8NNQdkQincwpPLyU7jnUDU9DKf2R5kVAPa41sJQmINogGozcU9gnTb YpXxya3+SVDDXza8VgSiMg5qOpjsrPvgb0loaSJlmeswv+NiiMWzsBbzgxVzAnMvv6Ro bv0NaiZl8ogLMg0TSYEtHWuYIo83uiIEb8sIainZiyoJOz9XgWQnDV10Fw1tKoM0Ag9v Y5BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YOEkcqVR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 71-20020a63054a000000b0045c16005914si35741750pgf.423.2022.10.24.06.03.24; Mon, 24 Oct 2022 06:04: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=YOEkcqVR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235077AbiJXNC2 (ORCPT + 99 others); Mon, 24 Oct 2022 09:02:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235172AbiJXM7d (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 695619AC31; Mon, 24 Oct 2022 05:18:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7FD2561311; Mon, 24 Oct 2022 12:17:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D077C433D6; Mon, 24 Oct 2022 12:17:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613860; bh=E8zRWJgVGId9cs8kWTiDR2jfYW9wv4Ht58bFMgmBLW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YOEkcqVRdBQ6KQipBUpNxjinP93lEFcEjwRDl3N7OPP2EHCUL5/8H86A8Aw7RlM0f G8CUY8xsCjIv5rSuhizrgoTJwZmdhrS/LjJrwP5OiqAY6gt+5fwCEYAUWWgI6yAByV BtBPU11LRK1eemZvePpIDPvTg6wSpaBd6X6Q3G2Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeffle Xu , Christoph Hellwig , Jens Axboe , Khazhismel Kumykov Subject: [PATCH 5.10 041/390] block: fix inflight statistics of part0 Date: Mon, 24 Oct 2022 13:27:18 +0200 Message-Id: <20221024113024.353587445@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574214363258512?= X-GMAIL-MSGID: =?utf-8?q?1747574214363258512?= From: Jeffle Xu commit b0d97557ebfc9d5ba5f2939339a9fdd267abafeb upstream. The inflight of partition 0 doesn't include inflight IOs to all sub-partitions, since currently mq calculates inflight of specific partition by simply camparing the value of the partition pointer. Thus the following case is possible: $ cat /sys/block/vda/inflight        0        0 $ cat /sys/block/vda/vda1/inflight        0      128 While single queue device (on a previous version, e.g. v3.10) has no this issue: $cat /sys/block/sda/sda3/inflight 0 33 $cat /sys/block/sda/inflight 0 33 Partition 0 should be specially handled since it represents the whole disk. This issue is introduced since commit bf0ddaba65dd ("blk-mq: fix sysfs inflight counter"). Besides, this patch can also fix the inflight statistics of part 0 in /proc/diskstats. Before this patch, the inflight statistics of part 0 doesn't include that of sub partitions. (I have marked the 'inflight' field with asterisk.) $cat /proc/diskstats 259 0 nvme0n1 45974469 0 367814768 6445794 1 0 1 0 *0* 111062 6445794 0 0 0 0 0 0 259 2 nvme0n1p1 45974058 0 367797952 6445727 0 0 0 0 *33* 111001 6445727 0 0 0 0 0 0 This is introduced since commit f299b7c7a9de ("blk-mq: provide internal in-flight variant"). Fixes: bf0ddaba65dd ("blk-mq: fix sysfs inflight counter") Fixes: f299b7c7a9de ("blk-mq: provide internal in-flight variant") Signed-off-by: Jeffle Xu Reviewed-by: Christoph Hellwig [axboe: adapt for 5.11 partition change] Signed-off-by: Jens Axboe [khazhy: adapt for 5.10 partition] Signed-off-by: Khazhismel Kumykov Signed-off-by: Greg Kroah-Hartman --- block/blk-mq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -105,7 +105,8 @@ static bool blk_mq_check_inflight(struct { struct mq_inflight *mi = priv; - if (rq->part == mi->part && blk_mq_rq_state(rq) == MQ_RQ_IN_FLIGHT) + if ((!mi->part->partno || rq->part == mi->part) && + blk_mq_rq_state(rq) == MQ_RQ_IN_FLIGHT) mi->inflight[rq_data_dir(rq)]++; return true; From patchwork Mon Oct 24 11:27:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9003 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp440303wru; Mon, 24 Oct 2022 06:04:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4BgDoKzxLAMeWLmpArTFsLmh4krbJdxNDqw+JcdTSew2Sev/lmzocqsOcM8/HYSe8bejS9 X-Received: by 2002:a17:902:e80b:b0:183:7463:f628 with SMTP id u11-20020a170902e80b00b001837463f628mr33477160plg.19.1666616644798; Mon, 24 Oct 2022 06:04:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616644; cv=none; d=google.com; s=arc-20160816; b=FmU5ChmyrHQM38zOrdQ2Z2xuq4yK4lwyDTm9Hl/UCPbydtvM+BzIgWzwovJWrW8zXj hLMqfbH8OrtSfflO5ZIj7WPvg20N55ZeiYX15lUAISV1rqVOZA0OkVaq7w/cQ46LvghX scHd5NbwqWJcInkqRG2l2oZWDSHZUiwj9cN7ZsOSUMYEu46jm1LfxnUSYZKGlSENym8h ClGrWTErJmAaKNpsRXwVIKVPUSM4qpmd//njjdk1b8Mlk5z9A/ewTIf2oOZjIt9w+x1o drfVh/dutywNfkF5+WRy84NHZfg1h/ohO9I9tXqVcEsSTcqKc0hp1qVRIPZscZsUa1SN T+xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ld7JOZLtb/FB7M/IoOYE0lYaSDlO8v2HFgrqtUBStvI=; b=CcKeC4QBsTby0ZHIhWDPqTY5StexAJck7hVVM1G+nRSIkSYbm+gF1z8Vqcb5y6JYLN slw79hDoJcsr27GFRiiWyhFaGqxWBJgxEey79FVa5XjWg2dXii8iAQz9SzL37b6oBxoF 665PWJzDhL+Mn1Asf+4Yzq8A64PRHyPcJIH7ygOTWLdklSAiv0O3ZepWWEgb5ntJD4Ua JIKgwKgAbKisAIqF4sUdcsLTGPUWZOIcYsr+NQg9IveTH01zSkvtBsgBlDEBChlCtRtA Vb+HBy5zT4z8+Ojoo/3e34K/K4aI6kkkDVLN5V0WUitox1i13T9EuZf2IM1kQyaq6RtX Byww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=So6idco7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ip7-20020a17090b314700b00202eab3e1b5si10986495pjb.10.2022.10.24.06.03.33; Mon, 24 Oct 2022 06:04: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=So6idco7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235089AbiJXNC5 (ORCPT + 99 others); Mon, 24 Oct 2022 09:02:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235213AbiJXM7j (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 C150D9AC3E; Mon, 24 Oct 2022 05:18: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 4525A61320; Mon, 24 Oct 2022 12:17:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55FEAC433D6; Mon, 24 Oct 2022 12:17:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613863; bh=tmj7cEVGDBCQselsv8wG2LDghm14ih3ZoJfiAIEa8Ow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=So6idco7cPMbBY5wMI0SIf2nBGHv3ThHqIYjVRD5hRwhgXBRwQV/HTEOXad3Sf9iM Z9VRqu0g4+n3gJtm/snyCtxUwojKJpdAf8PVTpAnx2zpF9oM3wiCp6u+D1Pp9anwVZ HW7EjnqVAf+/zGtwC67mz06CVcgmhOPWbBzrh/Ro= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Carlos Llamas , Catalin Marinas , Andrii Nakryiko , Liam Howlett , "Christian Brauner (Microsoft)" , Michal Hocko , Suren Baghdasaryan , Andrew Morton Subject: [PATCH 5.10 042/390] mm/mmap: undo ->mmap() when arch_validate_flags() fails Date: Mon, 24 Oct 2022 13:27:19 +0200 Message-Id: <20221024113024.402510437@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574214958770894?= X-GMAIL-MSGID: =?utf-8?q?1747574214958770894?= From: Carlos Llamas commit deb0f6562884b5b4beb883d73e66a7d3a1b96d99 upstream. Commit c462ac288f2c ("mm: Introduce arch_validate_flags()") added a late check in mmap_region() to let architectures validate vm_flags. The check needs to happen after calling ->mmap() as the flags can potentially be modified during this callback. If arch_validate_flags() check fails we unmap and free the vma. However, the error path fails to undo the ->mmap() call that previously succeeded and depending on the specific ->mmap() implementation this translates to reference increments, memory allocations and other operations what will not be cleaned up. There are several places (mainly device drivers) where this is an issue. However, one specific example is bpf_map_mmap() which keeps count of the mappings in map->writecnt. The count is incremented on ->mmap() and then decremented on vm_ops->close(). When arch_validate_flags() fails this count is off since bpf_map_mmap_close() is never called. One can reproduce this issue in arm64 devices with MTE support. Here the vm_flags are checked to only allow VM_MTE if VM_MTE_ALLOWED has been set previously. From userspace then is enough to pass the PROT_MTE flag to mmap() syscall to trigger the arch_validate_flags() failure. The following program reproduces this issue: #include #include #include #include #include int main(void) { union bpf_attr attr = { .map_type = BPF_MAP_TYPE_ARRAY, .key_size = sizeof(int), .value_size = sizeof(long long), .max_entries = 256, .map_flags = BPF_F_MMAPABLE, }; int fd; fd = syscall(__NR_bpf, BPF_MAP_CREATE, &attr, sizeof(attr)); mmap(NULL, 4096, PROT_WRITE | PROT_MTE, MAP_SHARED, fd, 0); return 0; } By manually adding some log statements to the vm_ops callbacks we can confirm that when passing PROT_MTE to mmap() the map->writecnt is off upon ->release(): With PROT_MTE flag: root@debian:~# ./bpf-test [ 111.263874] bpf_map_write_active_inc: map=9 writecnt=1 [ 111.288763] bpf_map_release: map=9 writecnt=1 Without PROT_MTE flag: root@debian:~# ./bpf-test [ 157.816912] bpf_map_write_active_inc: map=10 writecnt=1 [ 157.830442] bpf_map_write_active_dec: map=10 writecnt=0 [ 157.832396] bpf_map_release: map=10 writecnt=0 This patch fixes the above issue by calling vm_ops->close() when the arch_validate_flags() check fails, after this we can proceed to unmap and free the vma on the error path. Link: https://lkml.kernel.org/r/20220930003844.1210987-1-cmllamas@google.com Fixes: c462ac288f2c ("mm: Introduce arch_validate_flags()") Signed-off-by: Carlos Llamas Reviewed-by: Catalin Marinas Acked-by: Andrii Nakryiko Reviewed-by: Liam Howlett Cc: Christian Brauner (Microsoft) Cc: Michal Hocko Cc: Suren Baghdasaryan Cc: [5.10+] Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/mmap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1856,7 +1856,7 @@ unsigned long mmap_region(struct file *f if (!arch_validate_flags(vma->vm_flags)) { error = -EINVAL; if (file) - goto unmap_and_free_vma; + goto close_and_free_vma; else goto free_vma; } @@ -1900,6 +1900,9 @@ out: return addr; +close_and_free_vma: + if (vma->vm_ops && vma->vm_ops->close) + vma->vm_ops->close(vma); unmap_and_free_vma: vma->vm_file = NULL; fput(file); From patchwork Mon Oct 24 11:27:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9043 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp442246wru; Mon, 24 Oct 2022 06:07:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Eomifi1+tRdt+yg636HJxYz5SjLmU8XLVLajmvpilzstXOJCj+H6wMm/bjueUawn5e7KX X-Received: by 2002:a17:90b:524f:b0:212:c22f:fbd1 with SMTP id sh15-20020a17090b524f00b00212c22ffbd1mr23863895pjb.155.1666616819471; Mon, 24 Oct 2022 06:06:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616819; cv=none; d=google.com; s=arc-20160816; b=GcS38JFflgNkLn1sjQCbUylwWi3nHzBfW/tUNhZ62zSp1INbkssdk6rpB6KVUQ4fDh XyiNawH9b7E9axB7kQsXOw8YWzLxRfm/vaX1nArUrZPQgMaRaxy8J91CX65DmfTcF+HD g2K3OaBb6VxvG/OjQU5Hmj4iYgJkq0dLmpqt8gxbzpYunTwxlnpfXV4odt1Bm5MKasfq WpISkn5zZUF9BJS6XIuS8/XyEdhL53zSBze/+2ofFm8ShQu/8hULkNJuU0PosV1Mg/fC jc6m2mCii3ksS0+g42kGW4O0Uz1FVxtAHDmnTOc/rgili8qVUgVhaSaodOVSxPCaH3p+ fpow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=O26/tkqIrn5APQ6RIhQ+QlcZa7VX0J9hPB/Rc3buo5U=; b=PJ51ZmHBQjdbr1egEYHMUjjySw7I8lbEpXUfBSJJTlpUIw9PYcIcRBe3MwlhcYvgF5 7tI9WGwjQ+Cs86f1NNRPRV9dYZ5UK5wYnKen7YUHIxptNMcrEfwfy5OgS0EtYVVp40MG 9qCRBeJut5r5THX0eOf4Mlk1WolwjHn/oe5kY3K6iN96hLUS5vzSuIgnS6yk/6axVVx7 pbRpWLXqiDmFI0A+EJLAn6HYdbWuPasXqNt1IiYRozjLUjzYlauerLA0tsCCjds5bWJn THcT14m30OjxIaOwk2lv5Mu0IjyVONh7f8IuA5VG8F3zithIex6vAKG2Iy9tTiQCHjvX /5UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=I5hOa6cE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r30-20020a63fc5e000000b004600f27528fsi34253014pgk.175.2022.10.24.06.06.40; Mon, 24 Oct 2022 06:06:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=I5hOa6cE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235314AbiJXNET (ORCPT + 99 others); Mon, 24 Oct 2022 09:04:19 -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 S234926AbiJXNAn (ORCPT ); Mon, 24 Oct 2022 09:00: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 043191A39E; Mon, 24 Oct 2022 05:19: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 D3E6A612B9; Mon, 24 Oct 2022 12:17:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9761C433D7; Mon, 24 Oct 2022 12:17:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613866; bh=ZvsCPR12oufQrHYLoNm365mtLVcr9BbTjaxXV5rh9Ik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I5hOa6cEQG2N3f/tDSSfuouyFPpiz3oQen9PZsw3aCca2HxUHtXjIrySpTe8xlriZ PAbk3xZ4xPcanHKLB4VX+v6il/TREF5Z4lkP9P280wZwitqQ4CGGpHQV6bZF5MhA6a 70da6dMvIlIEU/YMEiCqyR9DVine7/FGta1smvDs= 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.10 043/390] PCI: Sanitise firmware BAR assignments behind a PCI-PCI bridge Date: Mon, 24 Oct 2022 13:27:20 +0200 Message-Id: <20221024113024.452410361@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574398195241804?= X-GMAIL-MSGID: =?utf-8?q?1747574398195241804?= 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 @@ -210,6 +210,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:27:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9064 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp444487wru; Mon, 24 Oct 2022 06:11:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Oa7aNTRbKfAaKT0VWbITdkEgF5+4hTxt7XJ9hEngidtB2sYnVEA6p3DPnt1b5NgnD3DFG X-Received: by 2002:a17:903:2347:b0:181:33f0:f64e with SMTP id c7-20020a170903234700b0018133f0f64emr34742860plh.106.1666617076626; Mon, 24 Oct 2022 06:11:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617076; cv=none; d=google.com; s=arc-20160816; b=Lgh1m4U7W2Tk3g+MEqxip5AHoykWPRgVVXTF5/l58NsZEZ2mRXwm1KAQktRrmqdHfC ZpBSwtzab94F7gdChd0sYDZx6RoNAcbMY8qHD1f9uhZbsSDg+ygeidaJxDWRF1UJC04D Ba2TJ9aoNxIY9CCF5CgfOGxPafSKVRN1Tgh/u/u+rR8+fM9wlYggv5Q2O1Xl7IVf3tNj 4Ejd1gu3Lswv43bQO1Cndo8tBwGvra25G4XUePPk3uXX1awyLqjmgfcxdCniBoM4OqMS EzYbe4WX+rjQ4aQTU6e6LgWRG/IT3N0ys9SnSGSXVnrhGfzodHxqnw0pHoLuUZHTRlE8 NPXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+LKN5+Eg7FxgD9yxKrDIVNuci2hpFSLkHH7nCxtENiU=; b=bEPdfNM/L+Jw6FIEmv3m2ilwkG10MjGC8v1Vn/19z0wUXPrqn/Nd77yIqoaH7UsNMz frBIEx2UzXOwT+Lmg+vIDaYG30eeGhxpmWA+VmxUk467FmBhMaTf6vbrWihVHUPROavJ LskPSJOKQjeYRMPOUr2iOHl4sRd5ipVX2+G3+dvfH/QDDPtoJd1PWLD9IoY6+33Biemt l0Fvz/swXvTi/647iB36yw7PS4jUqQSKw4qIUahqJRaetKADlgpDK2u2eqvT1qQpkC6i tuFKaObk0hpgfbOYXlrAxK5Mh3qmZD02OQmuAPc5/fZD7h8IXrxgCYdEgiYxds3NmtAK Fr3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wqoy5r9A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q34-20020a635c22000000b0043c9db24662si34901503pgb.269.2022.10.24.06.10.57; Mon, 24 Oct 2022 06:11: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=wqoy5r9A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235454AbiJXNKl (ORCPT + 99 others); Mon, 24 Oct 2022 09:10:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235398AbiJXNIh (ORCPT ); Mon, 24 Oct 2022 09:08:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86D079E695; Mon, 24 Oct 2022 05:21: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 73916612B7; Mon, 24 Oct 2022 12:17:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86366C433D6; Mon, 24 Oct 2022 12:17:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613868; bh=8j/hBLOsYo8yX4R150T2KOPNdqBx1AJPZk1FWeqZP6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wqoy5r9A97FgNBIihVjXI0Q/0ML/L+l6F7ouqfncRLXzgFwZFkkj0AoBSosK+C1xT VsIlQdIPhRK8Fcqkl+cRCUJmOFe0B6kKAgpzO9LeN7I9lclLbqaqacdT/rwublECsX azemMnXy2EAZ390lb2N/T1YelbK9hDHmGEP/qK3o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anders Blomdell , "Maciej W. Rozycki" Subject: [PATCH 5.10 044/390] serial: 8250: Let drivers request full 16550A feature probing Date: Mon, 24 Oct 2022 13:27:21 +0200 Message-Id: <20221024113024.492214172@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574667640278231?= X-GMAIL-MSGID: =?utf-8?q?1747574667640278231?= From: Maciej W. Rozycki commit 9906890c89e4dbd900ed87ad3040080339a7f411 upstream. A SERIAL_8250_16550A_VARIANTS configuration option has been recently defined that lets one request the 8250 driver not to probe for 16550A device features so as to reduce the driver's device startup time in virtual machines. Some actual hardware devices require these features to have been fully determined however for their driver to work correctly, so define a flag to let drivers request full 16550A feature probing on a device-by-device basis if required regardless of the SERIAL_8250_16550A_VARIANTS option setting chosen. Fixes: dc56ecb81a0a ("serial: 8250: Support disabling mdelay-filled probes of 16550A variants") Cc: stable@vger.kernel.org # v5.6+ Reported-by: Anders Blomdell Signed-off-by: Maciej W. Rozycki Link: https://lore.kernel.org/r/alpine.DEB.2.21.2209202357520.41633@angie.orcam.me.uk Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/8250/8250_port.c | 3 ++- include/linux/serial_core.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -1021,7 +1021,8 @@ static void autoconfig_16550a(struct uar up->port.type = PORT_16550A; up->capabilities |= UART_CAP_FIFO; - if (!IS_ENABLED(CONFIG_SERIAL_8250_16550A_VARIANTS)) + if (!IS_ENABLED(CONFIG_SERIAL_8250_16550A_VARIANTS) && + !(up->port.flags & UPF_FULL_PROBE)) return; /* --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -100,7 +100,7 @@ struct uart_icount { __u32 buf_overrun; }; -typedef unsigned int __bitwise upf_t; +typedef u64 __bitwise upf_t; typedef unsigned int __bitwise upstat_t; struct uart_port { @@ -207,6 +207,7 @@ struct uart_port { #define UPF_FIXED_PORT ((__force upf_t) (1 << 29)) #define UPF_DEAD ((__force upf_t) (1 << 30)) #define UPF_IOREMAP ((__force upf_t) (1 << 31)) +#define UPF_FULL_PROBE ((__force upf_t) (1ULL << 32)) #define __UPF_CHANGE_MASK 0x17fff #define UPF_CHANGE_MASK ((__force upf_t) __UPF_CHANGE_MASK) From patchwork Mon Oct 24 11:27:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9694 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp544064wru; Mon, 24 Oct 2022 09:31:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM41oxsVbyLtY9j0IfdQBlNRMNVwt/nlSDvPOZKqH9aMbrVdiG0wqf2cRTo3J78oJwfDSXbt X-Received: by 2002:a17:906:3e01:b0:781:6462:700f with SMTP id k1-20020a1709063e0100b007816462700fmr28779152eji.307.1666629077408; Mon, 24 Oct 2022 09:31:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629077; cv=none; d=google.com; s=arc-20160816; b=UlaRBcuQR4octbOLgLZ0l4tbu8xazGZFq3KvoYimk9QSTHMgEC6pQ5MmHWd1pLEB1x UMhnikZFOimIcKFMpQoy+TYXZAd+eSJQllZA0cjrjsQHlgVRKvImAhBxY6UwxFgdTjj8 aGkNtKOgYOvk59qECnsPITLsYFKv5YwO3sbrk8T8J0rKKzmLWHJuElFjsOTFQt73+GSU DOMheoZpQ3CBXzFnu32LoJuFamdQtIbY1l8fkKOorAQt3FTN8bkF4cBrMQZj+UQbLxo/ RcNpOLL9OE7Bq8+EnR5T3IG1PNJMGbQ5TPV1UeKrxKrmd3e/1KeVaiaSPkbXFmc+SWp9 j1hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sDNnzG1og7ay60z5PbBjB9i3ZIfRH5ut9Gn4TDL61uY=; b=XFO3RvoHxFOkWff4wxzuu2zkPmhOmvDdd30HaUbMrikUG/d4tGhFBPo/amCMWDXQKC +mBLUmv0K/dneZzOJwT+Uc43kYQWvuO/tvk+lJZgjqqOb1Avmh6jRDiF6YRzoPO+ldZ1 ssPxZ2Oqvwmsm+UCzmUi1e0gavr0D4CleONd5yPR6ek7RxRHinwkOcLo58iSnEpEH+4z m4TqtD2oDgciMUXf3qmh9lOu/YQUmlmZlUkkzSubCKqV4LLlFPWHfAo1+zsAF4hd0EcW LG+FZcgr6ptWUxDr3PXt3jDho9dAGlqTzFl5S6uo1z0CwYddWnab5RCGQ21wJL0oox5Q c4pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kNDsNQgp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c4-20020a170906154400b0078ddff4b3absi133672ejd.423.2022.10.24.09.30.53; Mon, 24 Oct 2022 09:31: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=kNDsNQgp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233907AbiJXQQR (ORCPT + 99 others); Mon, 24 Oct 2022 12:16:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234003AbiJXQMc (ORCPT ); Mon, 24 Oct 2022 12:12:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 796594D808; Mon, 24 Oct 2022 08:01:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5D40DB8159E; Mon, 24 Oct 2022 12:17:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0C01C433C1; Mon, 24 Oct 2022 12:17:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613874; bh=TnC0nw3vGFM0fLbfbRouKq97FKMT/UbbDwEy8JkEgmg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kNDsNQgpNDEE8mh4DIr0iQEjkVfmpGjrDaFztez22LKU1pXuDlAi7A35Fzn9ErcYk 2zyP6n3bYs/a/fcTQXnqQSps9mnKH8V9H1rmaBkciNDuRBxVD8eMn0lalRZ+3WmItY Tx+XK9liyzGpf8pXvG/JF6ZFXv465opMUoZ6Etug= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Rui , Wang Wendy , "Rafael J. Wysocki" Subject: [PATCH 5.10 045/390] powercap: intel_rapl: Use standard Energy Unit for SPR Dram RAPL domain Date: Mon, 24 Oct 2022 13:27:22 +0200 Message-Id: <20221024113024.537040134@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587251059922842?= X-GMAIL-MSGID: =?utf-8?q?1747587251059922842?= From: Zhang Rui commit 4c081324df5608b73428662ca54d5221ea03a6bd upstream. Intel Xeon servers used to use a fixed energy resolution (15.3uj) for Dram RAPL domain. But on SPR, Dram RAPL domain follows the standard energy resolution as described in MSR_RAPL_POWER_UNIT. Remove the SPR dram_domain_energy_unit quirk. Fixes: 2d798d9f5967 ("powercap: intel_rapl: add support for Sapphire Rapids") Signed-off-by: Zhang Rui Tested-by: Wang Wendy Cc: 5.9+ # 5.9+ Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/powercap/intel_rapl_common.c | 1 - 1 file changed, 1 deletion(-) --- a/drivers/powercap/intel_rapl_common.c +++ b/drivers/powercap/intel_rapl_common.c @@ -979,7 +979,6 @@ static const struct rapl_defaults rapl_d .check_unit = rapl_check_unit_core, .set_floor_freq = set_floor_freq_default, .compute_time_window = rapl_compute_time_window_core, - .dram_domain_energy_unit = 15300, .psys_domain_energy_unit = 1000000000, }; From patchwork Mon Oct 24 11:27:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9031 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441801wru; Mon, 24 Oct 2022 06:06:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7vFvugIkzlFnTJHXukOnA5Kngfd969A8LzGxa7e847wqrX/9UQvtFivd6GmY5kLv19TuR5 X-Received: by 2002:a63:ea4a:0:b0:439:4695:c0f8 with SMTP id l10-20020a63ea4a000000b004394695c0f8mr27762125pgk.440.1666616785767; Mon, 24 Oct 2022 06:06:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616785; cv=none; d=google.com; s=arc-20160816; b=SsFgMVb4885WVI0Bh9nff7pSTSLgkhF+Jof3C9RR1Xc2xiYIX0cFJQmeAWtvjWaPOH pBnF0B7jU2UeUOKdAzojCB3A4RLbs5y3yakuvaRzbEtrQEKo4zOHw5hEhZrOetxV3ZCN 7bGeXPjsae1QMUpoxPCJCYG7o4jH1kV/N4V0eUZUaQpdZA/t5gANTndTXENLu2yHPGaa sv7wtyAZDfsvfXA2lISqG/o4Xsq2okgLs1Gm0urOuFY8rQsNKjHKM3DC5NfT8l/jeMvj 3dgJ0OEvcjdT3ojwKTwirIokzLfcxDIccYvHWwG3tdNU9Lnn1uInNlla4j9LBiVySO2S J7HQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=xr/znSwFcgk+vbJqWA5tm/XFViNwmLz1Znzt2RT/PXwAIjQU4OqkfHB9rAyRs7aIC6 9TUzT9+3Ea1YsJO3J5jo5TrmRV1xFrXiUz6uSjvyF7aM61KTAd54KeKNQaq8jnJPzJyN XQtjI/CmrX4okRfkCLyp6c2Kf4GgIXAp17VzcoMWdLj7cSNv4OxeFjTdjYgNDGmi8Enp 31PshLAWaav5YK62/wCIiFrwyxiXh+QxYprx/kV4w8r4SpxvR5LIArkc/jN/keck5X9e bcc2FvymVc+mo3xMM4Hjk5Nap+BgnMeqJiAgVnU67elWQxjNYv3MUnv5cbXUtmta2K37 T7OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sPgmWXWz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jf17-20020a170903269100b00174c5fdc8d2si2201949plb.307.2022.10.24.06.06.03; Mon, 24 Oct 2022 06:06: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=sPgmWXWz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235350AbiJXNEf (ORCPT + 99 others); Mon, 24 Oct 2022 09:04:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234956AbiJXNAq (ORCPT ); Mon, 24 Oct 2022 09:00: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 31EBF1D67E; Mon, 24 Oct 2022 05:19: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 49CD6612CD; Mon, 24 Oct 2022 12:17:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5ADC7C433D6; Mon, 24 Oct 2022 12:17:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613876; bh=9YSJ36wjFxsTEnFDQT7Naqs+miqmLf7RXIRtV46M3DY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sPgmWXWzm2yDu50biT2E7yZdLRDIgwoTL2ipUS9LZvt59uKcm8hWq/NTFbg8Eg9GW JERCc2hIw2UydorsWH7qHuHv1L1GJu3G3jNkbBalzzjzesFDq91KdOW3oSfE29H1Gs Z4AzNFkrruJ910pjPHKkocXv3QnRXW/A2uhRw4Rc= 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.10 046/390] powerpc/boot: Explicitly disable usage of SPE instructions Date: Mon, 24 Oct 2022 13:27:23 +0200 Message-Id: <20221024113024.590390052@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574362439249749?= X-GMAIL-MSGID: =?utf-8?q?1747574362439249749?= 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:27: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: 10191 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp641664wru; Mon, 24 Oct 2022 13:36:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4vowttqgO/2LpsxlgEIbnWq0ZjHPXgprSo+47Y7rPFaSJm3M86wxsZ8uZbLMFMYpaMNlql X-Received: by 2002:a17:90b:4f4d:b0:20d:2225:4275 with SMTP id pj13-20020a17090b4f4d00b0020d22254275mr41189362pjb.191.1666643764239; 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=IaRqPoPVzsDF3G3UmTLEKbCUpsZXBdVxGQaXIFCt7WWnRWCrApgPNgaqkZ4OOwITf2 UAAwJN7q+EtFU/5lmEvUzfx5gXt9djavpm8A25Y6RX7gnG29PMSEYySEKyvnAoUMhZ7m Z1+zQbZ/koATXzrmZnEFjC6qIrdb+hGPeaVu12zizKwSBIhAA+hM+lGLAqzwr3ftRNUr nL9IwhQlQoApvy6hlghNpIIBKHBboddjuTdGHBUTYlDOCdHv6m6mFZq4TMAd67okWc/F iPd3J0ghggGgGVIoM+UWuBwNNB8aBXEVKUSdjAu0LnIbIpUzgkPQt1FIYxJAlL2SzR3T hMig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ijfGelvjzcojUuIMQUB0fg1bR2GTIsDcRepXOTxdN28=; b=GBhAA7yyH9Mx9cJza9HFwSQdvUf2vfCEljn83lFFO0DONYHpiwOm6MJXs7oVF7zb42 qlsSCwN7fVtGGyW/yL0hYu4s3uSb3zICbl9kM/IfoPON2olE7kbRXvftKh7fSb25lzP+ MdQhKZKDpOjkVOGfMr0fdTjvmZLvrA9ngSglHeVsXMrHlACvhG8tcDKPhIpmHfmub6ZZ b+yyEanP5nPtR0/CvVSeubQOlwocg/5q6PT4nCwsrQnRPggq6vLAANkIVeZpV6Yg/cyB Bs8tQ7q4mnlg/UoVvfb2szTbu2udRdENU/3uPTJWFNGLx3t2patlQV5Z9EnUUi/sa31P QQdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Aq3zO1Q2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056a00084c00b0056183db44afsi800716pfk.102.2022.10.24.13.35.45; 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=Aq3zO1Q2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233619AbiJXU0F (ORCPT + 99 others); Mon, 24 Oct 2022 16:26:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234420AbiJXUYh (ORCPT ); Mon, 24 Oct 2022 16:24:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4ADE55B53F; Mon, 24 Oct 2022 11:39: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 5F4FAB81644; Mon, 24 Oct 2022 12:19:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5764C433D7; Mon, 24 Oct 2022 12:19:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613982; bh=2yfSzVrbOONMv0fjShFNQd3PpV2azSYsA/H7JtJyXRc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Aq3zO1Q2tSUb/hJwnAwKxbVPL56rJiBYRaveoe75WjaUXKKaJftxo/11yyxqEXy42 OvB9Pes/MbMNRg8NINCbhEzIZBTJ/m5lbEBTWE+gjM6cHOBJlUtJYiEeow+XuDljSa vcPPubkbDBxJ0gb1jG1sY9Bp6N8/ZOlGhWKXsAH0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guangwu Zhang , John Meneghini , Saurav Kashyap , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.10 047/390] scsi: qedf: Populate sysfs attributes for vport Date: Mon, 24 Oct 2022 13:27:24 +0200 Message-Id: <20221024113024.629144741@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602652057935202?= X-GMAIL-MSGID: =?utf-8?q?1747602652057935202?= From: Saurav Kashyap commit 592642e6b11e620e4b43189f8072752429fc8dc3 upstream. Few vport parameters were displayed by systool as 'Unknown' or 'NULL'. Copy speed, supported_speed, frame_size and update port_type for NPIV port. Link: https://lore.kernel.org/r/20220919134434.3513-1-njavali@marvell.com Cc: stable@vger.kernel.org Tested-by: Guangwu Zhang Reviewed-by: John Meneghini Signed-off-by: Saurav Kashyap Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/qedf/qedf_main.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -1917,6 +1917,27 @@ static int qedf_vport_create(struct fc_v fc_vport_setlink(vn_port); } + /* Set symbolic node name */ + if (base_qedf->pdev->device == QL45xxx) + snprintf(fc_host_symbolic_name(vn_port->host), 256, + "Marvell FastLinQ 45xxx FCoE v%s", QEDF_VERSION); + + if (base_qedf->pdev->device == QL41xxx) + snprintf(fc_host_symbolic_name(vn_port->host), 256, + "Marvell FastLinQ 41xxx FCoE v%s", QEDF_VERSION); + + /* Set supported speed */ + fc_host_supported_speeds(vn_port->host) = n_port->link_supported_speeds; + + /* Set speed */ + vn_port->link_speed = n_port->link_speed; + + /* Set port type */ + fc_host_port_type(vn_port->host) = FC_PORTTYPE_NPIV; + + /* Set maxframe size */ + fc_host_maxframe_size(vn_port->host) = n_port->mfs; + QEDF_INFO(&(base_qedf->dbg_ctx), QEDF_LOG_NPIV, "vn_port=%p.\n", vn_port); From patchwork Mon Oct 24 11:27:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9022 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441410wru; Mon, 24 Oct 2022 06:05:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM74N72RPNBF11GAn3YupzY71r58OANsGtiUd5pFgDobak3M8fRgBrVpLTkGnaxstZCgkoWj X-Received: by 2002:a17:90b:350d:b0:20d:5438:f594 with SMTP id ls13-20020a17090b350d00b0020d5438f594mr75568585pjb.216.1666616752678; Mon, 24 Oct 2022 06:05:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616752; cv=none; d=google.com; s=arc-20160816; b=R59d3QtsKw+VSsPxzXNS/hkDRGdAsyil/gRj1mni6pNtHZ36iWIFGUrGx9HjEh+LXt f4DZv7fwpUNTyv+9CAOYegMqFX6P/oB65ZXgDVAdwOz02uwMcBl6OZXGhnwwEvDwgPm0 gGZCi/O10QYYBGiEwNnnAFjTvEl78NeRN/jNKdJdMJ4bo1czYkA8QNFBqMPOS0ZXByXz Odpo1nR+vVP+850WpDsdmtuCqXqrFKAomNfnu/bMnjy03TkgtqUOLAUvsbF4WOIe0p5z qjnpeyZTKsxUgbSEcVYMtUa82J/HUgtt2v+EEzZARg4wtbOio2w0CGvCf2ySHT3b9/YU iGBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=R1nuOcBaVMow6jMJ7eiDkRk+iYDx50eTA4qclaF4Ud4=; b=RowbUE7gKrBSSH/FOi6XJKLfa/Q2BPPYpSprxFNTDZukD2q3eGP/G7A+Bowdg1C5Qc VmxIO5gyFrZVGxEdYk0KhemXcGt8+CduCfBxfZdWknHCohtrQh5damOsNEKo2vij3n/U hwYh3kDgZ/wkgLpqPcar9SUDm6pAawaa1LJLeKZ/k9b5L7jJ+4DKzApS3aZYjlo4X729 PxBOyrFE5EGVoduMuKZS5EFY3S3/bingJiCPpfbET08eMiM7zaxg1YnefbMhVKZLSG7S ZXLMI89lqsZcgCDCZ8b6XRjgzdC4JLPEXfdOf995s+weO/TmwgyyQH1jySoiUd9PpvXU kR6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mhxdBmLP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e23-20020a635017000000b0045a6c6c559bsi34755489pgb.305.2022.10.24.06.05.26; Mon, 24 Oct 2022 06:05: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=mhxdBmLP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235445AbiJXNEs (ORCPT + 99 others); Mon, 24 Oct 2022 09:04:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235049AbiJXNBK (ORCPT ); Mon, 24 Oct 2022 09:01: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 69F2B2870B; Mon, 24 Oct 2022 05:19: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 8204C6131A; Mon, 24 Oct 2022 12:18:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 970B2C433C1; Mon, 24 Oct 2022 12:18:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613898; bh=+xNnPHy9Ia7x9ClVvk0qMD1ZQWrB9NkkQ9bqD48pXi4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mhxdBmLPkmxhX6PIqiv7glFVNKh63Ks94K/7QeWk+NcM6yIT5lyAbB+0xXVCR0SZ1 TBhidGle/lieDPbapm5hxmMYrZ/dtkSGAG9nXyor7FhYJFgX/ChfMlntX1homxfRSE pruwFo16cTRCEYAmHR6b+umLXP91itxOnawuN75Y= 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.10 048/390] fbdev: smscufx: Fix use-after-free in ufx_ops_open() Date: Mon, 24 Oct 2022 13:27:25 +0200 Message-Id: <20221024113024.680384175@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574328404918786?= X-GMAIL-MSGID: =?utf-8?q?1747574328404918786?= 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; } @@ -1740,6 +1748,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"); @@ -1760,6 +1770,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:27:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9653 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp534305wru; Mon, 24 Oct 2022 09:10:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Lwg/8GnP1skMcXMfeUJAZBNq7FpNJiBBsYAKISYuCtavwxBqAI/WrAeY8W8k3HkS3Mt+a X-Received: by 2002:a17:906:6a04:b0:78d:ee09:d956 with SMTP id qw4-20020a1709066a0400b0078dee09d956mr27473233ejc.698.1666627855963; Mon, 24 Oct 2022 09:10:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627855; cv=none; d=google.com; s=arc-20160816; b=jZYCQJMUdH8I3ldiuKDUVV0xw5gMnjpCnKEKkeq1+aes33YCc/vUPg9/P+oWMo9n1i fQBjofH5ptw2JmGbAIsJjqkvwWQtJVIPwaTh4YyM3QbGrgRYPQhDHT5NtEWRGDEU/orz P9earm8iUfeIbQcH+ajAKerG8mI9kxEZ7ISo+zfZWJxlE7BZ9Z4frQ+rIoP7JlqdhPfx rAj6eRtu7LaVbtiOM/WAMZ3CcDYj/5UNOMGMq6QSckv7YkBaFzwcuNdKkbCwDW744NKi s/+fBt/mDd1vIG4171V1pl+VGFfTgfUdZdJydn4RZuiJBTfqK3zXzOvCsETq8AZ3hYez AVdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OeL3m5AC9YJS5UGyJofO6hamGoivCXP5cRNAJYp/YwU=; b=iAUKoVzEiElPyfqg7cM59aBeub939ywJxJxvgJHtWj/gBEwg9A5atGcSwaX4Pj1wDe MX0kcMDVxuk9KNuwEX8jO9sm6TpDblP6Og7ndsUdyn8v6klfzlDwKH8V2lsWfqq/J6rf 5VZ689Z6DrqcU41zbBWHp629vq1J9g6Z9MX4QJS4sgnftcBY63MtGRBqikiHbmyMfjNZ 6l2yx2Jy/AjdPdRMDh9ke5193gWjmBnu6yKcyU1/UxxsDzSKXfOAAMuQPYJvYrNb5KW/ EQjxLPuf9ua3Fsqd5oSB19iER8C/+Lj6FDTN/yE//mapFaY3q9yxu97/61MBXz857dR+ aqvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TMLYSoU5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l7-20020a056402254700b004612915d1a0si153818edb.507.2022.10.24.09.10.32; Mon, 24 Oct 2022 09: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=TMLYSoU5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233492AbiJXQIm (ORCPT + 99 others); Mon, 24 Oct 2022 12:08:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233505AbiJXQEp (ORCPT ); Mon, 24 Oct 2022 12:04: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 F262013F6C; Mon, 24 Oct 2022 07:57: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 D99FBB81630; Mon, 24 Oct 2022 12:18:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D139C433D6; Mon, 24 Oct 2022 12:18:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613926; bh=Q39EAbnq4NOHgHPvPqteBhV/UhoTJX8hhLH9VJiuayQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TMLYSoU5j5rc/9ZJmCPKR53VLoi9qWCHlamM24FEXi3QR45Vgk1ARKuvye2OxxUUB Ppt6MEa7zTwijqxfUE8p5zd7TML8xJ5YTnyAeFM56FFOXxwlJ4svJhVsaGCJp65Pjr WyObJzo0z7y8+y8Hu88VWXDw7Gj3kt1dtqYzawRw= 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.10 049/390] btrfs: fix race between quota enable and quota rescan ioctl Date: Mon, 24 Oct 2022 13:27:26 +0200 Message-Id: <20221024113024.720487503@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585970600616006?= X-GMAIL-MSGID: =?utf-8?q?1747585970600616006?= 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 @@ -1158,6 +1158,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:27:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9047 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp442377wru; Mon, 24 Oct 2022 06:07:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5kRURVpmgiM+91hHaG35NHvwSy2c2SrC4h3dG9MuCpcxX5RAOl4vjVr/uIwr/+mA68ZW5y X-Received: by 2002:a17:90b:4a90:b0:20d:5c5e:1622 with SMTP id lp16-20020a17090b4a9000b0020d5c5e1622mr74966863pjb.50.1666616844871; Mon, 24 Oct 2022 06:07:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616844; cv=none; d=google.com; s=arc-20160816; b=pnPsFdPeoSGMZSnXpIdYtJPybxwh154CJnFAQxvWDqY3qCkx/6LMIF5KKTYoNTWcn9 OFYEclp7cx24GGzoN6WZkDYvd+DX1xaUbX6JWK5VrxIhbj/+/eymIcL+tTBNchTcRdMW pAWR/KEZFjwGknTpHrZFNSw7Qt6Q7PAEpxIGb2D600CaCO/5emXw7CfppViXg2hHGbIA PPJ2XtX6dbPTqk0Zg7E1qIXTr7rgMb5GIXbdB4QPCrt64TDsJ0YFvWi6IJXTNf3RMTqV Uv6UTR7Xgg79VuGjmpgtenqVkXWc9jUjxkAf6tDa4q2lASGcr5vw2h2PtRrpzWyIqBQ6 KXaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PApGhNdxYJN43T2HWwPE5wK5hWD9pHFLwjBNlQpw6LE=; b=ue+n70urm7li7uE8KEG8Qy9WShCZKhjAbE31X+JnW2rjhPT9uALTKDzYHQ+msYA4z0 8+csMtmOXLBoSBGV1n/jbMRT6v8Zt4FU6o10FLPbHNFyI2rQqWxhD8BNNVsEUnOF3EZC 75gjR/mcO+IvFgGhzb/zYbBMDb6LBK8mee91QYnsjqYO1ueb9rx+/pQCNwb6G28mzWNq TpJoLPxvX4rUo7SnYA4NObAswJBoVBhMP621ayOjnWx9BrHL1odBzkjI0iBMWlN3mvFb MiSShD2aIdW72U3Htnz4zjcH6NxVi0GZ8dexKVUaAgmi7NrtUdpRLMMzxCK/1+rvYL+a 2Zqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=192WOMK6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u16-20020a62ed10000000b00562331a3562si30229512pfh.130.2022.10.24.06.06.38; Mon, 24 Oct 2022 06:07: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=192WOMK6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235338AbiJXNFh (ORCPT + 99 others); Mon, 24 Oct 2022 09:05:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235166AbiJXNC4 (ORCPT ); Mon, 24 Oct 2022 09:02: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 0C29C3FA36; Mon, 24 Oct 2022 05:20: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 03E7F612CF; Mon, 24 Oct 2022 12:19:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 184C3C433D6; Mon, 24 Oct 2022 12:19:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613955; bh=MQ4sZieayU4xazipjvklwUwGMXXkKmbKgFkPDFPU528=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=192WOMK6b8TKUJOkSXrRMyROdBUERiTmk69cX1y1yOdIo0JHlvS04vVr2QDq3ixq7 vU/g1zzbzT3X6OEOb5peK/IEWu400ZoXgbyJw/1xGB1RaKhstg75AizGQAXo2NrL3b pAOTi2a8NkkdYqbHMK2YB4MhqAmyVRtgnsYxbDpM= 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.10 050/390] f2fs: increase the limit for reserve_root Date: Mon, 24 Oct 2022 13:27:27 +0200 Message-Id: <20221024113024.763778817@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574425096798414?= X-GMAIL-MSGID: =?utf-8?q?1747574425096798414?= 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 @@ -267,10 +267,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:27:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9035 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441960wru; Mon, 24 Oct 2022 06:06:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ShHA+NmFb5Zf7Y9QZ7KMqp56TaWGr0oENRqE/PeYkPTukVrI4v9DoEu2VAdXapBaJpUJz X-Received: by 2002:a65:6e0f:0:b0:43a:1cd4:4ae6 with SMTP id bd15-20020a656e0f000000b0043a1cd44ae6mr27546105pgb.289.1666616802294; Mon, 24 Oct 2022 06:06:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616802; cv=none; d=google.com; s=arc-20160816; b=UG3Ai1eRHYeMwcLCgQSRgopevq1cwPuIsrDX8lJ8CjtEvRmwZ7LC+N5oKaIoTocLKb DGlDjZ5QGaFdSSQzoo4rdeREQg234Hnl4cgj7dSonIr/j2LspReOOCEB4ocqAeVzQ/JJ GtLbad04AWq4UoyeeejkwkE4aLuIFqUvcfi1a4fmabEEpDxIvaQ/Wvsx/hmv22IOVbt5 uydv+XuJVdgiWkq1r3lHCbhFtOf9O5l11JzXMIxjRERwSVKtbQweKgTRTT1mAUiOP3SC tv1m1z+C17CLI4kSzY8XGUnPYHLhGp1U5BfdrhVpXzXmIJBxIMLGs2lvUbCG1kFpfBk6 2ZAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cllU7x2TgW0CFuJ0I8YEf7g02ZAUsrABGuoOaxfzQ6s=; b=B+rghPeVnJk6EDJMhrdcNUliVQjkXuZzPX0kE0LF9+nF5mct1wr25sfub+T7AvP2Cg +pHJrLyGM17eNIdYWUuvGTQ1LNWAtt7D45TyI1W5F11zgDoy1t6pl9Wppwb8slodnxJn /YGvH9boJhHcoKAs3gcqRoswVCs+8IywMov26bDCGiCPonSGZ1dIG5DN4tL8XuQmLHN+ 3+g+Pm3wiYjzFf73WT7y4I3qavWChZVS+kc8hSUU9t/VKdXsbXiMhotC3bMkXW1lOydS DJ8GkU8KqBZI3+33KlqdYHnE5NrmIxtCM330FraZDDWFEo6ciuWAuVk6d3hU4kHB6i96 2DQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=om+PYy+4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s19-20020a056a00195300b0056183db44afsi38498541pfk.102.2022.10.24.06.06.22; Mon, 24 Oct 2022 06:06: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=om+PYy+4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235255AbiJXNFu (ORCPT + 99 others); Mon, 24 Oct 2022 09:05:50 -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 S235193AbiJXNDS (ORCPT ); Mon, 24 Oct 2022 09:03:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 895DD42E76; Mon, 24 Oct 2022 05:20: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 9B8C161257; Mon, 24 Oct 2022 12:19:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE796C433D6; Mon, 24 Oct 2022 12:19:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613966; bh=oLbaysdckFsCFXPruC8D3Mw/qR8/jEbOJJDf6dgc8hM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=om+PYy+4f1lOPGyy2dWpbhO89z9kHWIHG+DO+to3Ht540KY17LQK+8eGXtVWbiSHg rcah3H0QXWnsrpy86r4fHM85JMi6sp6p56Ol0NE4Q6p3azJO4IIw/VZkUGLk/wtpmD 3YVLL27Jya1SVxunmeixounO7kVPHhGukuNJmtMM= 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.10 051/390] f2fs: fix to do sanity check on destination blkaddr during recovery Date: Mon, 24 Oct 2022 13:27:28 +0200 Message-Id: <20221024113024.804522470@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574379902118959?= X-GMAIL-MSGID: =?utf-8?q?1747574379902118959?= 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 @@ -136,7 +136,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); @@ -144,6 +144,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); @@ -181,6 +188,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 @@ -235,6 +235,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 @@ -661,6 +661,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:27:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9042 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp442245wru; Mon, 24 Oct 2022 06:07:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6D6qFyN7hbXzP/GF/tSKXYrHVmXI48LU+8kMh9FSZ4dU1dYQ39FUDT5hP2I7A/5cbBigxn X-Received: by 2002:a17:90b:1648:b0:20b:f0ae:2169 with SMTP id il8-20020a17090b164800b0020bf0ae2169mr72270465pjb.173.1666616830104; Mon, 24 Oct 2022 06:07:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616830; cv=none; d=google.com; s=arc-20160816; b=revNI3LkycNJE6z2zciMNDjRb1YzgPwHmXnoD1McYfFunlfe/9fOu1ZPSLBgMQ6QgI Iyu2rp8MvSzGBbih/CiuJ1WGKfmp4kRe8QcQmLurhbDe7ILVIIK6Oty9VUV6SQ9uMjJf 4DTzsx8M5uA4Wtfn17q+u+7mgFdWB8XygUEHdcrLZBXcgSIzaicLu9Wbj/VSVDwxgg76 MU+Rx8uOGXYTeMV8xXAkw1JwDq+nqHfpWwvwxKaBVk1kQr57CiG6uxN1gut2e/tgPEUf 3ICch31Rxm4brudR4C3+/R7pjQAwma8a8ZHsYv7kzHSSmlO+Ny993OeG6S6FFUUOeGgx fpSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qV7rjmUJ3mlEg1Y7JCqkPrfhCbnyQZBHJb5ZjfaP8lU=; b=UIk/SOjKxkneIAq4uVLBxROo6Q/uE92g1abGPUn8kEh8wME3RxusHPKWxMiQ2mzQXN px56YUeQ6LL/RisFkEKchodXCHdtUNDZ04PQRrj8hUOW4BqHX15lsrR1aS6yKwtiO6I0 GVt3HdzbKcA9P/sQpP3RV/5b5qgx+1TexI/aHtWRvKe6+Wf/wxjkXJvPk31l9ylnTzEm +Sk79EVciEkblLSrECeKc75/CeeXJANU7aIa+ZLnTpabu5MpRivSUoE1AYyCQBzWqE0P vuaapU+Q3BkqyU28SiQ3Pvz090NSiSbzn+/OoiK+lT1aGMGxt0xuDlrv39WWwJmFgItB p/vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HaLG4wTx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020aa78dc7000000b005669cd93898si29465277pfr.233.2022.10.24.06.06.50; Mon, 24 Oct 2022 06:07: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=HaLG4wTx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235380AbiJXNGR (ORCPT + 99 others); Mon, 24 Oct 2022 09:06:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235343AbiJXNEa (ORCPT ); Mon, 24 Oct 2022 09:04: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 8957342E59; Mon, 24 Oct 2022 05:20: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 409BE611B0; Mon, 24 Oct 2022 12:19:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52EF1C433C1; Mon, 24 Oct 2022 12:19:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613968; bh=d7FUz7ZekITfTM4wA8NgK0dQkSexU0vVYwnJ8dNbTvo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HaLG4wTxfQrf5sHgZ46p4IcASCa5CmndLRN1WY2xQ8QJS28SyMa8RTJQfhoTzp1Jb cGNdkrVkrBqYppXYTFTG4rF/+pXXkNdNxJA1PFiNeOsMTXuRWDJlyBDrjh1zyGlllX c1DPv4k+M2mfvzQKPnDPlOG8kAQ+BxC/GKKi+pio= 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.10 052/390] f2fs: fix to do sanity check on summary info Date: Mon, 24 Oct 2022 13:27:29 +0200 Message-Id: <20221024113024.853480982@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574409578905238?= X-GMAIL-MSGID: =?utf-8?q?1747574409578905238?= 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 Signed-off-by: Pavel Machek Reviewed-by: Chao Yu --- 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 @@ -977,7 +977,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); @@ -1003,6 +1003,14 @@ static bool is_alive(struct f2fs_sb_info return false; } + max_addrs = IS_INODE(node_page) ? DEF_ADDRS_PER_INODE : + DEF_ADDRS_PER_BLOCK; + if (ofs_in_node >= max_addrs) { + f2fs_err(sbi, "Inconsistent ofs_in_node:%u in summary, ino:%u, nid:%u, max:%u", + ofs_in_node, dni->ino, dni->nid, max_addrs); + return false; + } + *nofs = ofs_of_node(node_page); source_blkaddr = data_blkaddr(NULL, node_page, ofs_in_node); f2fs_put_page(node_page, 1); --- a/fs/f2fs/recovery.c +++ b/fs/f2fs/recovery.c @@ -437,7 +437,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; @@ -463,15 +463,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:27:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9039 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp442085wru; Mon, 24 Oct 2022 06:06:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6/Gj+jDqmN73c21UUezuItDLdce2bGdQEQ7EI5Lz2N0N2sw9L7SU2+N1XWaCnib6w3PpF8 X-Received: by 2002:a17:90b:3141:b0:20d:49d6:30b with SMTP id ip1-20020a17090b314100b0020d49d6030bmr70859964pjb.223.1666616814527; Mon, 24 Oct 2022 06:06:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616814; cv=none; d=google.com; s=arc-20160816; b=f9DlPKMEFEZ2vxU5POUj3GwoDxXZ5fBuqeebjxpWNYamFgIkJHzNF5EEa2nt//EnlF 26E1Uc8AQmwR3MvbDuS1cj/I+E1GfbaVg2LZGx2rilriKj/1ctTSMUpQBSxmari5upGP mx4gvRnMRHNaUQLQaJVqBpCgqC67a/kNlb+Tt9gnaiZVeVCfsupoQcKhzziZgmaZh5Hu nVq2uZFo27g3oAY/kSS9Ry5VHj2YIhuJE64z9q4GD0GpwGkwyM2jvVi+tRwjsZWZwS0R 4ExDpQnkqTtElDOJovjUbraxq8/7cbj8tkfFqdKc7ZSEfwpW1PlozAf4YBBg4WxGRx47 FbIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wZPxi2FHspOrUvPKLX0hasprZ91j50U1MYBVGhjBYgM=; b=BONfIfuKv71t20+HM+90xTnXPm8Zvgi3nur+F5AEsmdiC7IHz3s15tk2psvcGdW3JC WqJSvQiMEs+cTJvMDMsL7VQ+DAQSwypFheeHnt0wCWbUZ2bpJvcNWn3fxxEpWAR1ofEF 1C6DCrPaMWRvBbBnSxtRSuCkXUBJ7CUz5owyUJHLStQPYLPaLEbtL5BpplcaIJSKPIxW n32hjdvr0QmkaHZumcR+ILrmxUxaHlobNSfz9DhFghPPY9BEUnb/fXj53uF0dYTriBCn c0VF0U2E2i/senLyVnPZyHnNaRR6rVTXSRH6wvXfYaBUf49K1xMQwCm1XFgMhX7joyC5 0XUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pDQqV9s9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902d88600b00178af7f1832si32586926plz.216.2022.10.24.06.06.35; Mon, 24 Oct 2022 06:06: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=pDQqV9s9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232388AbiJXNGJ (ORCPT + 99 others); Mon, 24 Oct 2022 09:06:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235224AbiJXNDl (ORCPT ); Mon, 24 Oct 2022 09:03: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 7562111821; Mon, 24 Oct 2022 05:20: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 DF4FF61291; Mon, 24 Oct 2022 12:19:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F25AFC433C1; Mon, 24 Oct 2022 12:19:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613971; bh=D4hibD4zy0sXG40th7Pdzjhko9OObAeTXdWrhJZa2ZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pDQqV9s9UDrGJ7wfnbj2LEjgQxRWd239Z/W7/Vydf65avNTnG0jjUgP/96VQPsvKM Q2r7s2mNfzA6Vwoq47WJJBvha/KdEpFv6Nc+OpCmcPd/7vKd5xBq+Nc+Xla5bfdd4J ECOyEn8yrIzOboeeDA6pk9RfDuEi6Gvgg2E4AoyU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, glider@google.com, Nathan Chancellor , Nick Desaulniers , linux-security-module@vger.kernel.org, clang-built-linux@googlegroups.com, Kees Cook , "Gustavo A. R. Silva" Subject: [PATCH 5.10 053/390] hardening: Clarify Kconfig text for auto-var-init Date: Mon, 24 Oct 2022 13:27:30 +0200 Message-Id: <20221024113024.895215368@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574392661998221?= X-GMAIL-MSGID: =?utf-8?q?1747574392661998221?= From: Kees Cook commit dcb7c0b9461c2a30f6616262736daac6f01ecb09 upstream. Clarify the details around the automatic variable initialization modes available. Specifically this details the values used for pattern init and expands on the rationale for zero init safety. Additionally makes zero init the default when available. Cc: glider@google.com Cc: Nathan Chancellor Cc: Nick Desaulniers Cc: linux-security-module@vger.kernel.org Cc: clang-built-linux@googlegroups.com Signed-off-by: Kees Cook Acked-by: Gustavo A. R. Silva Signed-off-by: Nathan Chancellor Signed-off-by: Greg Kroah-Hartman --- security/Kconfig.hardening | 52 +++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 20 deletions(-) --- a/security/Kconfig.hardening +++ b/security/Kconfig.hardening @@ -29,6 +29,7 @@ choice prompt "Initialize kernel stack variables at function entry" default GCC_PLUGIN_STRUCTLEAK_BYREF_ALL if COMPILE_TEST && GCC_PLUGINS default INIT_STACK_ALL_PATTERN if COMPILE_TEST && CC_HAS_AUTO_VAR_INIT_PATTERN + default INIT_STACK_ALL_ZERO if CC_HAS_AUTO_VAR_INIT_PATTERN default INIT_STACK_NONE help This option enables initialization of stack variables at @@ -39,11 +40,11 @@ choice syscalls. This chooses the level of coverage over classes of potentially - uninitialized variables. The selected class will be + uninitialized variables. The selected class of variable will be initialized before use in a function. config INIT_STACK_NONE - bool "no automatic initialization (weakest)" + bool "no automatic stack variable initialization (weakest)" help Disable automatic stack variable initialization. This leaves the kernel vulnerable to the standard @@ -80,7 +81,7 @@ choice and is disallowed. config GCC_PLUGIN_STRUCTLEAK_BYREF_ALL - bool "zero-init anything passed by reference (very strong)" + bool "zero-init everything passed by reference (very strong)" depends on GCC_PLUGINS depends on !(KASAN && KASAN_STACK=1) select GCC_PLUGIN_STRUCTLEAK @@ -91,33 +92,44 @@ choice of uninitialized stack variable exploits and information exposures. + As a side-effect, this keeps a lot of variables on the + stack that can otherwise be optimized out, so combining + this with CONFIG_KASAN_STACK can lead to a stack overflow + and is disallowed. + config INIT_STACK_ALL_PATTERN - bool "0xAA-init everything on the stack (strongest)" + bool "pattern-init everything (strongest)" depends on CC_HAS_AUTO_VAR_INIT_PATTERN help - Initializes everything on the stack with a 0xAA - pattern. This is intended to eliminate all classes - of uninitialized stack variable exploits and information - exposures, even variables that were warned to have been - left uninitialized. + Initializes everything on the stack (including padding) + with a specific debug value. This is intended to eliminate + all classes of uninitialized stack variable exploits and + information exposures, even variables that were warned about + having been left uninitialized. Pattern initialization is known to provoke many existing bugs related to uninitialized locals, e.g. pointers receive - non-NULL values, buffer sizes and indices are very big. + non-NULL values, buffer sizes and indices are very big. The + pattern is situation-specific; Clang on 64-bit uses 0xAA + repeating for all types and padding except float and double + which use 0xFF repeating (-NaN). Clang on 32-bit uses 0xFF + repeating for all types and padding. config INIT_STACK_ALL_ZERO - bool "zero-init everything on the stack (strongest and safest)" + bool "zero-init everything (strongest and safest)" depends on CC_HAS_AUTO_VAR_INIT_ZERO help - Initializes everything on the stack with a zero - value. This is intended to eliminate all classes - of uninitialized stack variable exploits and information - exposures, even variables that were warned to have been - left uninitialized. - - Zero initialization provides safe defaults for strings, - pointers, indices and sizes, and is therefore - more suitable as a security mitigation measure. + Initializes everything on the stack (including padding) + with a zero value. This is intended to eliminate all + classes of uninitialized stack variable exploits and + information exposures, even variables that were warned + about having been left uninitialized. + + Zero initialization provides safe defaults for strings + (immediately NUL-terminated), pointers (NULL), indices + (index 0), and sizes (0 length), so it is therefore more + suitable as a production security mitigation than pattern + initialization. endchoice From patchwork Mon Oct 24 11:27:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9672 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp535038wru; Mon, 24 Oct 2022 09:12:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6IEGlKaVrhGN8yQ5PauvTMRxJI3AfYXilkiLKCKOPFgRyO7JqO0lr/LUR93uEjLhUsngXf X-Received: by 2002:a63:d845:0:b0:44b:d074:97d with SMTP id k5-20020a63d845000000b0044bd074097dmr29317848pgj.32.1666627935770; Mon, 24 Oct 2022 09:12:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627935; cv=none; d=google.com; s=arc-20160816; b=Jw3n2p5Wt/jNs7LkHlO1xnUTP9B2M/Hoq4EotKwk4I7o0XR2qC7NO3Le8bDk2AAd90 JeMlOxl8gxROetBYCP4huCePMDxhN+qpPhubQ0ig/5A+xt1aw9nwG+0KbkI6PdhVTJhn iDzUd9iy2740UmzbaFePQ2pH4CiAu4u87zWw0euhOKWjv/ykmLTI/6fTacYidNB6cu0M PVjmwHrpwsu5bkue2zi7citG2wXOS+mRYyHyHsDu4CNp4RShkCC4pTg+hgoqfBQa8ggq 1pYMUgmhSWsE0bruMab78UqVVc9Wr2FwL6BjXeL8R9UF6FPYmMIBFIBrrinQTnreYVpJ /qUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0wgQF0BRaqnvcxmX5ZRIpwb2bXHfCoSzh2aPYw2nroI=; b=En3JIgybf6rGN679dt089TqhXiKwxKK5RKbbJLNo+NFJf8yQCMxyxW5flzZ16638aH pCKcSRVJcZX3dl9DWKD8NpidFDIjTHDQm8g33H47IC1I6boAV9RERlzx8QJB9Y1a6WnO fvsCJ1txhhDmXysfuMo53uZLXuRY+atMZ/tuICGesi0FlPD3OV7ITT7oPFUnx6isjtFZ RdAaQXgEVZlXW1lcZPJDI+zL4cOeAb+Flps7gJSst+2/9CBmffrtZ7MhrnRSZWRzzuI5 nTfGX6lhJKlv70gdqS2D5jPYJp82bQy4QeBOZ7Qgt41mSUWGfLokdOj5PHe3BPAHAWwO /lnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ENRieYn5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id on6-20020a17090b1d0600b0020d4b43d8b5si10593974pjb.103.2022.10.24.09.12.01; Mon, 24 Oct 2022 09:12:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ENRieYn5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233681AbiJXQLd (ORCPT + 99 others); Mon, 24 Oct 2022 12:11:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233931AbiJXQFM (ORCPT ); Mon, 24 Oct 2022 12:05: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 00C4732B9E; Mon, 24 Oct 2022 07:57:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4CB57B81649; Mon, 24 Oct 2022 12:19:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BB55C433D6; Mon, 24 Oct 2022 12:19:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613974; bh=s4PXUvrWJNB2JneVuy9c+iXwcUUBogwyTXM3UHtjRok=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ENRieYn5gjnLy2gkDBvHv0QCNvizhUdIBOD9HIH5vlJOlW+CuGCnIEx/idGNykN2j AKKHutCK8bHNnRnnZCEsO+lcpczm1AVkoOUtZcn6+aX9evS97+JwEv4fiR99hG870S i4rvlaaoRBkrMImnD2y6D1aNNqADgT7Y4tefpGSE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masahiro Yamada , llvm@lists.linux.dev, Will Deacon , Nick Desaulniers , Nathan Chancellor , Kees Cook Subject: [PATCH 5.10 054/390] hardening: Avoid harmless Clang option under CONFIG_INIT_STACK_ALL_ZERO Date: Mon, 24 Oct 2022 13:27:31 +0200 Message-Id: <20221024113024.928307739@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747586054379211613?= X-GMAIL-MSGID: =?utf-8?q?1747586054379211613?= From: Kees Cook commit f02003c860d921171be4a27e2893766eb3bc6871 upstream. Currently under Clang, CC_HAS_AUTO_VAR_INIT_ZERO requires an extra -enable flag compared to CC_HAS_AUTO_VAR_INIT_PATTERN. GCC 12[1] will not, and will happily ignore the Clang-specific flag. However, its presence on the command-line is both cumbersome and confusing. Due to GCC's tolerant behavior, though, we can continue to use a single Kconfig cc-option test for the feature on both compilers, but then drop the Clang-specific option in the Makefile. In other words, this patch does not change anything other than making the compiler command line shorter once GCC supports -ftrivial-auto-var-init=zero. [1] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=a25e0b5e6ac8a77a71c229e0a7b744603365b0e9 Cc: Greg Kroah-Hartman Cc: Masahiro Yamada Cc: llvm@lists.linux.dev Fixes: dcb7c0b9461c ("hardening: Clarify Kconfig text for auto-var-init") Suggested-by: Will Deacon Link: https://lore.kernel.org/lkml/20210914102837.6172-1-will@kernel.org/ Reviewed-by: Nick Desaulniers Reviewed-by: Nathan Chancellor Acked-by: Will Deacon Signed-off-by: Kees Cook Signed-off-by: Nathan Chancellor Signed-off-by: Greg Kroah-Hartman --- Makefile | 6 +++--- security/Kconfig.hardening | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) --- a/Makefile +++ b/Makefile @@ -816,12 +816,12 @@ endif # Initialize all stack variables with a zero value. ifdef CONFIG_INIT_STACK_ALL_ZERO -# Future support for zero initialization is still being debated, see -# https://bugs.llvm.org/show_bug.cgi?id=45497. These flags are subject to being -# renamed or dropped. KBUILD_CFLAGS += -ftrivial-auto-var-init=zero +ifdef CONFIG_CC_IS_CLANG +# https://bugs.llvm.org/show_bug.cgi?id=45497 KBUILD_CFLAGS += -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang endif +endif DEBUG_CFLAGS := --- a/security/Kconfig.hardening +++ b/security/Kconfig.hardening @@ -23,13 +23,16 @@ config CC_HAS_AUTO_VAR_INIT_PATTERN def_bool $(cc-option,-ftrivial-auto-var-init=pattern) config CC_HAS_AUTO_VAR_INIT_ZERO + # GCC ignores the -enable flag, so we can test for the feature with + # a single invocation using the flag, but drop it as appropriate in + # the Makefile, depending on the presence of Clang. def_bool $(cc-option,-ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang) choice prompt "Initialize kernel stack variables at function entry" default GCC_PLUGIN_STRUCTLEAK_BYREF_ALL if COMPILE_TEST && GCC_PLUGINS default INIT_STACK_ALL_PATTERN if COMPILE_TEST && CC_HAS_AUTO_VAR_INIT_PATTERN - default INIT_STACK_ALL_ZERO if CC_HAS_AUTO_VAR_INIT_PATTERN + default INIT_STACK_ALL_ZERO if CC_HAS_AUTO_VAR_INIT_ZERO default INIT_STACK_NONE help This option enables initialization of stack variables at From patchwork Mon Oct 24 11:27:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9995 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp615896wru; Mon, 24 Oct 2022 12:27:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5vAiXxek2RF8huTHqGkltJfeeZ76L4DK20QUDev/tuyEapACBlbGqvEhmnmeWag8ArLdau X-Received: by 2002:a05:6402:2687:b0:45d:3a94:348f with SMTP id w7-20020a056402268700b0045d3a94348fmr32019626edd.48.1666639649602; Mon, 24 Oct 2022 12:27:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666639649; cv=none; d=google.com; s=arc-20160816; b=vhsBcczmRGwwiFdvvjsJiKb8QrbhmTdQRY59VZYOZO+QynYQ/GQpBH4k6PFmMrdhmi 75evjhgFsP6KG5isY5fUzyoXuAYtJf4T51Wa6Bs6PJ5KgklNp1zm5iS7YerpG480En5Z e1Gob8D8nbiaVS4cWz8BX7IhlkZ2u56SmIp/6gfjZXcNWRh2OZ25NcplDidVgWSPvIkL 7TSkyZ0ZeqNBjoPmgDFqrEP3x0Fc5DLWOYu53xXXJThcqD6n7golFJiObh6z1UDgqpHo 2t30DKxzy73+tuzEp9GxDmPiphZJREb7MoqiwQMrPZZelWhJDQfJbdNAChgozL7gnTj0 2zpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nQOgj4goGyp3T1fozmT47OvTKMGzR+aMExeSOuxtUQE=; b=n+HmxeGlKyxOZ5D3OlNaBeJ9mNyPUYBTDgglJ3Fb0JtFkBmZYdI+ILH6dN6PmqXJJi K5MYUD99SUnJ8U+s8wD68CN8mhWajqSvims1LqZYqxlpA36MrJZg9n4qC9y5bD72ezmp xTEvbi72dfKSGPliZEX4Q8LasTerhTyoYqTRkeMaoYS7lDfgB9guxaSNysyXFT0yIRvv 7zdn2wGGHvZw4xQotN1CpwBlsNDaVECn2tPkeMxkkNhChCrFSFgJfSmXyhZ1sUI+Yf70 8KiHxy94ism6uV0+OQtqTosxBzkmsdZKf/g+RgtRhiwXGELQ3CZrs6GvZ3/5xlPWH5sV yNNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Y0CzeDKy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170906709600b0078d4b605b71si541792ejk.338.2022.10.24.12.27.05; Mon, 24 Oct 2022 12:27: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=Y0CzeDKy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232384AbiJXTZX (ORCPT + 99 others); Mon, 24 Oct 2022 15:25:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231863AbiJXTXJ (ORCPT ); Mon, 24 Oct 2022 15:23:09 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAB7C20351; Mon, 24 Oct 2022 10:57: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 sin.source.kernel.org (Postfix) with ESMTPS id 6F661CE13BF; Mon, 24 Oct 2022 12:19:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B34AC433D6; Mon, 24 Oct 2022 12:19:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613976; bh=6w1m8oTCk9uzWFr7+T1Vk2k2FAMBopqrgJZpxzytLWQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y0CzeDKyCSEmCuUMjLnd+gUt73PzT0Ht9NdPR6jnPko1Ue8xaeegCz9kwvv7mlz06 MpQw7p9BWqPXm+lsN+P/Cc4h2YNSx+yGZWNk+0LgPJEKEJIaJP6FgFSG88jSbJNPw9 dJSunFrfrEvKwc/px0O9O+zOqRczaCBS9f5P3BlM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Masahiro Yamada , Nick Desaulniers , linux-kbuild@vger.kernel.org, llvm@lists.linux.dev, Kees Cook Subject: [PATCH 5.10 055/390] hardening: Remove Clangs enable flag for -ftrivial-auto-var-init=zero Date: Mon, 24 Oct 2022 13:27:32 +0200 Message-Id: <20221024113024.968446156@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747598336922901807?= X-GMAIL-MSGID: =?utf-8?q?1747598336922901807?= From: Kees Cook commit 607e57c6c62c00965ae276902c166834ce73014a upstream. Now that Clang's -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang option is no longer required, remove it from the command line. Clang 16 and later will warn when it is used, which will cause Kconfig to think it can't use -ftrivial-auto-var-init=zero at all. Check for whether it is required and only use it when so. Cc: Nathan Chancellor Cc: Masahiro Yamada Cc: Nick Desaulniers Cc: linux-kbuild@vger.kernel.org Cc: llvm@lists.linux.dev Cc: stable@vger.kernel.org Fixes: f02003c860d9 ("hardening: Avoid harmless Clang option under CONFIG_INIT_STACK_ALL_ZERO") Signed-off-by: Kees Cook Signed-off-by: Nathan Chancellor Signed-off-by: Greg Kroah-Hartman --- Makefile | 4 ++-- security/Kconfig.hardening | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) --- a/Makefile +++ b/Makefile @@ -817,8 +817,8 @@ endif # Initialize all stack variables with a zero value. ifdef CONFIG_INIT_STACK_ALL_ZERO KBUILD_CFLAGS += -ftrivial-auto-var-init=zero -ifdef CONFIG_CC_IS_CLANG -# https://bugs.llvm.org/show_bug.cgi?id=45497 +ifdef CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO_ENABLER +# https://github.com/llvm/llvm-project/issues/44842 KBUILD_CFLAGS += -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang endif endif --- a/security/Kconfig.hardening +++ b/security/Kconfig.hardening @@ -22,11 +22,17 @@ menu "Memory initialization" config CC_HAS_AUTO_VAR_INIT_PATTERN def_bool $(cc-option,-ftrivial-auto-var-init=pattern) -config CC_HAS_AUTO_VAR_INIT_ZERO - # GCC ignores the -enable flag, so we can test for the feature with - # a single invocation using the flag, but drop it as appropriate in - # the Makefile, depending on the presence of Clang. +config CC_HAS_AUTO_VAR_INIT_ZERO_BARE + def_bool $(cc-option,-ftrivial-auto-var-init=zero) + +config CC_HAS_AUTO_VAR_INIT_ZERO_ENABLER + # Clang 16 and later warn about using the -enable flag, but it + # is required before then. def_bool $(cc-option,-ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang) + depends on !CC_HAS_AUTO_VAR_INIT_ZERO_BARE + +config CC_HAS_AUTO_VAR_INIT_ZERO + def_bool CC_HAS_AUTO_VAR_INIT_ZERO_BARE || CC_HAS_AUTO_VAR_INIT_ZERO_ENABLER choice prompt "Initialize kernel stack variables at function entry" From patchwork Mon Oct 24 11:27:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9661 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp534524wru; Mon, 24 Oct 2022 09:11:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4NffbxWq4coikhSaGvqTSNM62t31x/9z0EXqzSwE+wAHYPYZYopP+Fzhl40TMsaJyKmi5E X-Received: by 2002:a05:6a00:4192:b0:563:5e95:1db3 with SMTP id ca18-20020a056a00419200b005635e951db3mr34472703pfb.14.1666627874640; Mon, 24 Oct 2022 09:11:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627874; cv=none; d=google.com; s=arc-20160816; b=u1F/IuQSvcL4+k4JgzSm910Qw/VsqxbrqBdwZgFGFo7ZYayTNf+saEYgiA41VtXYRe 1reP9cIzcrck3WILOnpkOno0XgDpf0ZrmT5FwlwcfPVHleSXy1J5bkJ2Pt5Q7Rkjl9qz /RO9Fk5od6c7JVAoApxPlfti0NrG2/IO0mucqXYN+cvRdO/HWjpY9XXr6aE/hLnkIp4G 1CKSfOJeo1jcUPaJeXj9i3cGJzYG0jWf1jDANJQU3s/U/P+H7+Lp4bKl207Fi+FSyQil 9tJy32CAcbWFraE/z1YVUVh1d0/L9/eQUGzurRyzIUUqpFqLN1dg6j60ixDPkrhZcAAn ZtZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/U/yr4JfCGI3+QaE1tPgeaVdqO/m81flMyydc/I35hA=; b=0KqFq4LyfJIp3X5EwwJwSg1ks2wkDCvmC2EQ7p1MjeALePvy//lj4CI7+U+TB3QsO4 D8B3nXgYeg8a7znYE0AOQKyaO7/mPHNBYEyO+wG1ccaiaZqDk2QAEOw+FmJBolPtKlm9 FvFQg6/LDaodnErloKxFammz+sx4zhzSZHUFFe2uS/xa7VdJW/XSyQgTnamBRKW1Nvoa 8R7L6bbJPv9AbVHff7SURqOoeKUCO7/7IEVaEjK+HWAlGsQlPgPe/tPe8wWJdK802nGT IxNgvTiZ5aY10/U0rKhwU0FjhEyscwZaAdy+m0hvceUameia3MsZIgo8fd2OIpfgAmw+ tyoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=C1JbzQIq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v24-20020a63d558000000b0046ed15af9d1si9563016pgi.213.2022.10.24.09.11.01; Mon, 24 Oct 2022 09:11: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=C1JbzQIq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233857AbiJXQJP (ORCPT + 99 others); Mon, 24 Oct 2022 12:09:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233671AbiJXQEx (ORCPT ); Mon, 24 Oct 2022 12:04:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C260B14D29; Mon, 24 Oct 2022 07:57: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 BFBC7B81647; Mon, 24 Oct 2022 12:19:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17D14C433D6; Mon, 24 Oct 2022 12:19:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613979; bh=/tfY/D6Dr1Tjzeph7TEUSjiYk1e6n24XThlyzr692f8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C1JbzQIqs9X31ZZym3fxxSidBX5imMGybIjJcmsJF+QeRHU8o+OqvwsuP3J2r8536 3egcb6p/bmVd67WP6ISpC3rasRL2zOJG/QN6Bh5NpYlQukTT88XSmOWjdVgvk6ptwX SczUgQRWa+SfKepht8lYxjxOemjbFJWgKm2ICH4Y= 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.10 056/390] jbd2: wake up journal waiters in FIFO order, not LIFO Date: Mon, 24 Oct 2022 13:27:33 +0200 Message-Id: <20221024113025.016206957@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585990423859433?= X-GMAIL-MSGID: =?utf-8?q?1747585990423859433?= 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 @@ -581,7 +581,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 @@ -173,7 +173,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); @@ -199,7 +199,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); /* @@ -894,7 +894,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:27:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10165 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp640435wru; Mon, 24 Oct 2022 13:32:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6q8LW/5ySVxPOqC2HB+YmilLJ2aeAoZx83olHgTPF++GLYEiYL0wppiKCgJlReGBezDVjD X-Received: by 2002:a17:907:d10:b0:79a:a1fe:8be5 with SMTP id gn16-20020a1709070d1000b0079aa1fe8be5mr16173017ejc.125.1666643559996; Mon, 24 Oct 2022 13:32:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643559; cv=none; d=google.com; s=arc-20160816; b=OltpODlGkVhaPPbkiMj0oTbbCixQYpR3c4Zq+6lMz+gG05bqUq4dMa2gDjn1NA+CkY OZbmcBHpQgmyxfkPBa2t+pjTBbKKiFGmAUNsGb/koDWPvpOt7NCfmUzodOX86wfQ12HD S/FgSPciK1Euci9f1WFUB2JbWKucEpnZ+S92aTHXrrVN/AeqGtzQnHc6ujTImPP/cxnj D9BhqVbO3z7WiZN5WU52VmWkeqQWOciGh3TNc62bP6bwGyGj1Pq1aRA8FfqbxOuSHC5h ypMvNMKyI+S+6Ydl+BYRrbZ0IYtbQfKNKg7lsgVHW+fbS7EI9i22+2Xc79GfPPo3X+v5 hUsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KDN0Q2R4dKq06tkiDRWSjZK+IYROnp4qZtR+qD7XMeg=; b=dVBDuEXOy9ycynkeu4i/J408ia/jTbuI9dvIw6eXugRCciwCWaIR0R47iYYXkWS8i4 KxovNC/S/n6Ff7Jy2AyWphMHivhwzs6TwYA6Ak3PAObiUwCSON1kiFb1Tz8OdSxrC2RU nV+dzt7ZGL2McPAYyieuJLWphJXV0IcU4tup35lW2bQRY74Y8yw5OQvJTG8Tww5qV1Zj 8kDaycGIhWHRStQP/jZ676jMntEkcy8MuQFxjnKUj2LM1XUxgFpv8qOGOKcDcA1yPkWF Db/GzzWZ8vNIYtoFRiroHB1Rn+a6lNOouR7mC3QcSaScHY0lTwtKwG5ND1ELWWJWyvO2 LS3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WCmNqjAi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id js17-20020a17090797d100b0078d459a1ce9si695020ejc.693.2022.10.24.13.32.15; Mon, 24 Oct 2022 13:32: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=WCmNqjAi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233082AbiJXUWQ (ORCPT + 99 others); Mon, 24 Oct 2022 16:22:16 -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 S234124AbiJXUVO (ORCPT ); Mon, 24 Oct 2022 16:21:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DD485FF5D; Mon, 24 Oct 2022 11:37: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 D78F5B815C8; Mon, 24 Oct 2022 12:18:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3158EC433B5; Mon, 24 Oct 2022 12:18:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613900; bh=dQ1FrTEtjY+nOpJPZkZ19Nk4MsjhXPguPPae1bpJD18=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WCmNqjAiq/yhacwK4WXjQMwApe4Lk8xCGbEZVyQ22ioxHmOoBJzn4Eu2j+y9sbVXr hROVd/kaa8yY7qgs8uoHQS5s2Oyitpv87BEPl3UO4tGx2quHBlqc7QEHCUnri8x5qM xbL1yrGvmYMdg9nGP7wdes6H+Zxf1CsqK+EXc6YA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ye Bin , Jan Kara , Theodore Tso Subject: [PATCH 5.10 057/390] jbd2: fix potential buffer head reference count leak Date: Mon, 24 Oct 2022 13:27:34 +0200 Message-Id: <20221024113025.065426067@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602437727386026?= X-GMAIL-MSGID: =?utf-8?q?1747602437727386026?= From: Ye Bin commit e0d5fc7a6d80ac2406c7dfc6bb625201d0250a8a upstream. As in 'jbd2_fc_wait_bufs' if buffer isn't uptodate, will return -EIO without update 'journal->j_fc_off'. But 'jbd2_fc_release_bufs' will release buffer head from ‘j_fc_off - 1’ if 'bh' is NULL will terminal release which will lead to buffer head buffer head reference count leak. To solve above issue, update 'journal->j_fc_off' before return -EIO. Cc: stable@kernel.org Signed-off-by: Ye Bin Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220914100812.1414768-2-yebin10@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/jbd2/journal.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -926,8 +926,14 @@ int jbd2_fc_wait_bufs(journal_t *journal wait_on_buffer(bh); put_bh(bh); journal->j_fc_wbuf[i] = NULL; - if (unlikely(!buffer_uptodate(bh))) + /* + * Update j_fc_off so jbd2_fc_release_bufs can release remain + * buffer head. + */ + if (unlikely(!buffer_uptodate(bh))) { + journal->j_fc_off = i; return -EIO; + } } return 0; From patchwork Mon Oct 24 11:27:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9692 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp543876wru; Mon, 24 Oct 2022 09:30:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7lzDLmvoE7hEfUGWKufdU4FgEQvE2aPGSRYo2dB9lnWiyGa2oc1qFZJN0u7QfBXL2NFpqI X-Received: by 2002:aa7:d348:0:b0:45b:8ae3:ee3d with SMTP id m8-20020aa7d348000000b0045b8ae3ee3dmr31474745edr.428.1666629055456; Mon, 24 Oct 2022 09:30:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629055; cv=none; d=google.com; s=arc-20160816; b=Fuq3TrgVDZ/M04qdZvTBMAmb57aSdhg+2lwpw9140WEB1nK5xgKJBIOCoYr7PxcWaV 7E3JZs/YlKwjBG6lsyT/sIZ5NfLfnEJqNW5LmTsENINLMLCz2c0TJO8dWv5iKil+Zeud gAHw+Y7KvaYTBjTBZA/jk8ifTaJeLa1kyCChv00DELI8KMZS1SVt7Xuf7odFtEzYRVpJ S7yNTaGA1u874B4vI+Svy3Mrfldx55Xyy+sL1kmgjhY7I+BpqircvbcjR9lLp6CxiZHE aDxVvVFYscVizyZykIUmwmx4XJyeoHHP0SLNvbOGYypnnoTLJ0FD7o6uSVcHG6Ad+tEu /5gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZpBr4CKsIGRY7mj69SUu+FSlaC/44f14FZMEqLngs1Q=; b=yQw7euxGlbiWdcn8g4zsMOda+rd+blcbQoQ5PwwGT3HJN6+/poBHzXYnDnS8axUmce SXGZ5Fkead1Pv1PAqfd7K5XWct88Bam967mGhK974rwauDrhj0ZYuAOuMbVDBID9JfX8 +F6F7ubhRfXANIE91iLtCoT1bheBQueK/OBnk3Djve+RmczdgUBSzkKOdZcJFJKywqBY ndC7UCOnYIUXrFT3CNZJ+qDR/WLghNy8dZmwHTJcgvQdtf4R/ShalPrx7C/3ulNY+/ac /zFGIOd0dgwcEKx/0RPNSIJRc5jFtGTziRNiyQFYNn/7Y/OkEKO7QE3gAZOHtaWCQ4Mo JA7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MnQfBGzA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g16-20020a50ee10000000b0045d3e06e4d5si127900eds.389.2022.10.24.09.30.32; Mon, 24 Oct 2022 09:30: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=MnQfBGzA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234035AbiJXQQE (ORCPT + 99 others); Mon, 24 Oct 2022 12:16:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234271AbiJXQOb (ORCPT ); Mon, 24 Oct 2022 12:14: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 AE29F127BEC; Mon, 24 Oct 2022 08:02: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 76C36B81627; Mon, 24 Oct 2022 12:18:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CAFF8C433D6; Mon, 24 Oct 2022 12:18:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613903; bh=RHgpOY34xrHo3qmUkhEOiFA/j5Y4V8+PQcbcKFKYUqE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MnQfBGzA7jOq6+8f0iRoObSl/CnLHTAB8XDa+uERDZojAthdO8rG5IgFSdDIolylT 8ScLnzqA/Z2x6LOjE+hIF+tV2zp+lfVgrjRkk3980mOXm7N+Q2EPCR/JtPAF4YLxR4 rCjUUgNiBXIq9vs2DalK029JaEFMmJNWwC787bGI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ye Bin , Jan Kara , Theodore Tso Subject: [PATCH 5.10 058/390] jbd2: fix potential use-after-free in jbd2_fc_wait_bufs Date: Mon, 24 Oct 2022 13:27:35 +0200 Message-Id: <20221024113025.110853995@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587228449117629?= X-GMAIL-MSGID: =?utf-8?q?1747587228449117629?= From: Ye Bin commit 243d1a5d505d0b0460c9af0ad56ed4a56ef0bebd upstream. In 'jbd2_fc_wait_bufs' use 'bh' after put buffer head reference count which may lead to use-after-free. So judge buffer if uptodate before put buffer head reference count. Cc: stable@kernel.org Signed-off-by: Ye Bin Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220914100812.1414768-3-yebin10@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/jbd2/journal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -924,16 +924,16 @@ int jbd2_fc_wait_bufs(journal_t *journal for (i = j_fc_off - 1; i >= j_fc_off - num_blks; i--) { bh = journal->j_fc_wbuf[i]; wait_on_buffer(bh); - put_bh(bh); - journal->j_fc_wbuf[i] = NULL; /* * Update j_fc_off so jbd2_fc_release_bufs can release remain * buffer head. */ if (unlikely(!buffer_uptodate(bh))) { - journal->j_fc_off = i; + journal->j_fc_off = i + 1; return -EIO; } + put_bh(bh); + journal->j_fc_wbuf[i] = NULL; } return 0; From patchwork Mon Oct 24 11:27:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9714 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp545314wru; Mon, 24 Oct 2022 09:34:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7s+xmhqQCCP5ITGA64cmmdS2DJkKMAn1kulz5q6I+aZFKwKHgVS85Z4moCa3Y7L3zV0IWE X-Received: by 2002:a17:907:2d0b:b0:78e:674:6b32 with SMTP id gs11-20020a1709072d0b00b0078e06746b32mr27899375ejc.226.1666629249816; Mon, 24 Oct 2022 09:34:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629249; cv=none; d=google.com; s=arc-20160816; b=Qwea7Z9xIWeg8AZyMhWRHvr/grHdOhOJiOznD7R1rb8G89XmFpU0WGB3j0N12+yv4M lPs0wBNOesdIZwGdGpcGGJiQSNEICXnyHxLdGBgNnHOc9K/EOXv2m1m2LHeRnmtbLq9l DVg88/lXv+W3yPguKcNzZqkRMseuX1wNP2REu6s/I+wXlLLIylzUw7KWlfhRGoGyHJil oRJIp1mfWU+cXnA0ModBG6tA2NA6Q5f59/3YjrQvv/fHPr7dd99xYDLqwJNfjEEP5sYd NaONko0szznqYVzSeAoydg/FaLcbThJHLRQoI/7FFF7LCgYVFoDORpV2PuIAmKcqQ2o9 hKaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=J+VM+zBZxb3Vn8CGSa1yNCzIUpKgdkvXVHvjiENLezo=; b=mNIIdPHwx17JAZ0dmuRfyTD0xOxf45/khGHA4x2rgOnire3EDWuFMknzO1WwkG/oUm d9twTzaN3wbuBZisoCtLyJpm5ZKZ7w7XZUhjxnbjA4ycDiasYZaaTZrDZ13j4rAR6vSe /r94U8FzblqjXjyvbFPuQVp1nHLNcuMv22XcEVACu32KYQ026A9y9TDCBGh7aL5/jitm a6PzXH9ME+scQPGAtkEZKy2EBcFlrQyDeHfj6w1CeM/vhFEiSlDvbyeCKKhjXp5qRX6A 4OWrR9Tp3F6MPWJPYSaHrIihYcQen3WRdzer7Z0118K4LGx1f3B4rrzc72MQnSErZbqW 88cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="vGlaruj/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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.33.45; Mon, 24 Oct 2022 09:34: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="vGlaruj/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233022AbiJXQUQ (ORCPT + 99 others); Mon, 24 Oct 2022 12:20:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234257AbiJXQRf (ORCPT ); Mon, 24 Oct 2022 12:17:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0739538A29; Mon, 24 Oct 2022 08:04:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 06819B8162C; Mon, 24 Oct 2022 12:18:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64B9EC433D6; Mon, 24 Oct 2022 12:18:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613905; bh=uVz+BDY/wMcdakK3a2zAGCIAkzkiJQgDSwU4vNQtw5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vGlaruj/hGXKrkl3SQXIDjL8QikNrnJdtzuac1oMml+4Bt08Lx7+E4OsUprKH+Me0 p/GrwQElybSWCKwtis3GjcCIcP+sD3Ms2SIZvAGxefeIvKqPREHt+fqERyRuDMrAdF rYz/cxJNS2sgyrSQ7c5MNthwsGQ+Zju8D1MzwrjM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ye Bin , Jan Kara , Theodore Tso Subject: [PATCH 5.10 059/390] jbd2: add miss release buffer head in fc_do_one_pass() Date: Mon, 24 Oct 2022 13:27:36 +0200 Message-Id: <20221024113025.158258028@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587432092352472?= X-GMAIL-MSGID: =?utf-8?q?1747587432092352472?= From: Ye Bin commit dfff66f30f66b9524b661f311bbed8ff3d2ca49f upstream. In fc_do_one_pass() miss release buffer head after use which will lead to reference count leak. Cc: stable@kernel.org Signed-off-by: Ye Bin Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220917093805.1782845-1-yebin10@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/jbd2/recovery.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/jbd2/recovery.c +++ b/fs/jbd2/recovery.c @@ -256,6 +256,7 @@ static int fc_do_one_pass(journal_t *jou err = journal->j_fc_replay_callback(journal, bh, pass, next_fc_block - journal->j_fc_first, expected_commit_id); + brelse(bh); next_fc_block++; if (err < 0 || err == JBD2_FC_REPLAY_STOP) break; From patchwork Mon Oct 24 11:27:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9696 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp544126wru; Mon, 24 Oct 2022 09:31:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6J0xWcAIbO7DWmtMCWUi71oHOZt+UFe6BhF2uTQziOMhROLCrsigSTAG/pvY9b1Pnwe2kI X-Received: by 2002:a05:6402:2409:b0:456:f97b:3794 with SMTP id t9-20020a056402240900b00456f97b3794mr31573353eda.145.1666629085038; Mon, 24 Oct 2022 09:31:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629085; cv=none; d=google.com; s=arc-20160816; b=Q2vrccWTKAHHdSmHwHFd3a5Rq0gNeqdSRLJPtsJ+qaQh7dzu1IUMHts4CgIiHNtuhY A0NtIllYtG33wrwii8y6bLUCTdmilQgFj8CyPBvk1ulnQkEQXD4f+nyNuyWfk9SldIq8 Iami2EW1IdV1mrfoNgydXyXFyCijR8a0axMxhPzIQdygJz211d/FvFgxcYZw5CHeCqUY ywuLwXy2O+9JAtxYjNYOR33wnLec1S507Y5pRm+rC1O4Cz3cYwX+BNfi38S095ufFn3T ROJxMlgxtOwkTowxxwV7pZJR/4cJfwIh5UYWEu7E2tf1y+evkdBx+Wbr4ZDCsBUUcw06 MV2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ehf+lmd8ZjopviSRxJ5+rsFjdQYziNZAAd/913JyTYU=; b=UOrU7hzeCBmUJhM92/yZfjhj7/1dwiLsj1vWDcDwH6KCZgta7XfQFstYvTssG6dItG pvi2csCmG5dtLNlKQAx/CXryQqJJYDie0NkB8AWX9Ue/n1RG+bUtUNLglu1FBaBp9Gpm 8hOJAzS8IOb53x4K0N1/RL6yESJdghxhFJI1x/67BQZND40Ul/JHcFmrZU4eMG6cRtGp RKixmL96YNZViQaS/4oJumXPQOTMmC/Ns3DBAsaelBnmwoBVPSeQCTx4JrYESJghVvEx sL1v5HQmpeTS7bpMVg1jH7LxVL+Av0IwST/T7tAENupBzys6y4UBENvfLChsV2Ia+Lgp 0S1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iEaJAuUh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u3-20020a05640207c300b00460346c1763si152814edy.449.2022.10.24.09.31.01; Mon, 24 Oct 2022 09:31: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=iEaJAuUh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230126AbiJXQQk (ORCPT + 99 others); Mon, 24 Oct 2022 12:16:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234554AbiJXQO7 (ORCPT ); Mon, 24 Oct 2022 12:14:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9A28134DFA; Mon, 24 Oct 2022 08:02: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 A6C36B81639; Mon, 24 Oct 2022 12:18:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F34EEC433D6; Mon, 24 Oct 2022 12:18:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613908; bh=ChU/ww02ACpyHpa+pKCFFhqDDbl0ru9AfAh7lCblT2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iEaJAuUhqw7FQ8A1v7UboLxNhN+mkEi1neA9Nlc/cG8EYhKQGpYm2PK0kKKu4Za3N GFQpEd9M4hWxAWvCu7K3G8mW+YzI0A8x6a2AQ4hLiefcfb5Hr6DeZatsRMvyh+AU0w WFgKeNT2l+gv7l0vIM4cMcv3aA+qHgLH4yruF9y4= 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.10 060/390] ext4: avoid crash when inline data creation follows DIO write Date: Mon, 24 Oct 2022 13:27:37 +0200 Message-Id: <20221024113025.196924417@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587259308400693?= X-GMAIL-MSGID: =?utf-8?q?1747587259308400693?= 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 @@ -529,6 +529,12 @@ static ssize_t ext4_dio_write_iter(struc ret = -EAGAIN; goto out; } + /* + * Make sure inline data cannot be created anymore since we are going + * to allocate blocks for DIO. We know the inode does not have any + * inline data now because ext4_dio_supported() checked for that. + */ + ext4_clear_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA); offset = iocb->ki_pos; count = ret; From patchwork Mon Oct 24 11:27:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9062 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp444414wru; Mon, 24 Oct 2022 06:11:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5QAkn2WgQld38FEWTdxap24Z82W2GjCW7bkNM3lkf0gxGBHqAqDLzeBzkwOwq13Wdkdp47 X-Received: by 2002:a17:902:d492:b0:186:970f:57dd with SMTP id c18-20020a170902d49200b00186970f57ddmr9665746plg.86.1666617069241; Mon, 24 Oct 2022 06:11:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617069; cv=none; d=google.com; s=arc-20160816; b=ue9TcEVBrMUJTCVWsFBnOg7l7WWxId1lVs6FjYe6ab+74A7BMvPGHNxsaYEGoSCvHe rcZFCq4f5F+R94/YhjZZ75lEXmSgSlLfsmMC/vlZGQfNqSNTSt6vCySINs089JON0jds r+o4t0TBAnkcHPFwm7GywUB1t1Pw4uduqNAeUpAzQSmHxHLSLTBiEIhmQ/h8AxKgpsty PwShtZ9UUdfq13X2NurJCxitz2tCIOtIdwTkAgoLAE1eGewI2bVomZoEy0dFkQ0Vwdb8 DxfEbV43oGyiFEMi1HTZdZiC4cFF211Dtah67KYOWTprSZSp+5nJrURw0k35OwFskyAc kuDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VMd2DQqTf+80FgiXFYA9BpPQEv1obcRnWAOOD7q5Jjk=; b=KgUNByrgUlacYoQFawGnZl72x+widGrTbYEi90qlvky9D4ZT1tTIYD5wYRZU6yWjKg E7iDSCdMjguTBhhzijaO1M9OWc5XHNP0JHLVfLXaX/mpRJOxlqSJzucE6r6pAmHPvetD WrKuUauy1YgveOZMC4iO0G+SYKMEeChU2pCtCO1v4QQEbKx5yQ6Gwe+HEFPNPXHZW31V XQ1HyV53G0p9QgBf97jtTe//G+TizfiL+hHLHzBbZ7VP+FPFqRUPGsCj781cxVRuqMEV mgWJJFel8YgAs/PRBKsX4vc+uMZaWVz9fGhIBx93CxhlKTEOdoX44vZQjNlBehhtNRcn HInw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wnuQVx3k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kb10-20020a17090ae7ca00b00200a43d4d58si11256444pjb.80.2022.10.24.06.10.53; Mon, 24 Oct 2022 06:11: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=wnuQVx3k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235229AbiJXNKc (ORCPT + 99 others); Mon, 24 Oct 2022 09:10:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235365AbiJXNIf (ORCPT ); Mon, 24 Oct 2022 09:08:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 479A19E2D2; Mon, 24 Oct 2022 05:21: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 7F8B7612CA; Mon, 24 Oct 2022 12:18:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 909A3C43143; Mon, 24 Oct 2022 12:18:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613910; bh=RBKnYXo0P8Gdr0iW4+OH2qxp8/SChGU9LmI+sWXfp0Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wnuQVx3ktGY+L+bUJ27Okzpt8u7cpUd38yxrn+3NnnvpZdPcy8MyWJI5x78IW8x7G 1DZ3wMbjGgv90tmFx27zqg6aygkiF6utX00d7aiScuPxq3YK/3zQ0NiZ6QChsNKFkL +1wT7pyTOclzwRLgRgA+krUYVx1EquULxarwXCdI= 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.10 061/390] ext4: fix null-ptr-deref in ext4_write_info Date: Mon, 24 Oct 2022 13:27:38 +0200 Message-Id: <20221024113025.230782272@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574659845651254?= X-GMAIL-MSGID: =?utf-8?q?1747574659845651254?= 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 @@ -6273,7 +6273,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:27:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9702 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp544574wru; Mon, 24 Oct 2022 09:32:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7GNwjDYbDKEEqfit59lLIts/Hts/cEgKqxkgtHtJRuflP7COrAYQAkuWyL99ORhL2cYQ8X X-Received: by 2002:a17:907:984:b0:77f:4d95:9e2f with SMTP id bf4-20020a170907098400b0077f4d959e2fmr29228583ejc.176.1666629144002; Mon, 24 Oct 2022 09:32:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629143; cv=none; d=google.com; s=arc-20160816; b=OC/czlwSx0FfcgqUQrK1cXJAUypIOyC3Xfej4K7gSpJ+5lSyQbNA3LWU5lQSBSEnZK xyz3ZR4WtMi8IhvlERlfFA8hozrWrTU7ue4InP2Mf0GbUNcR09CKLfXLgCw8lsiJlyeU AwP/JEJoHeOynTFVIiRuhf0mFEh4usGuStRJaKzVWQmk1a2ez4HMPZNrDTIfQOL9iUIr W2kcksPeIRGpacSG3NidU5OSYgI5VPFKsC+XGP5U7uWIPE5JlHb4uhUkIGOHvrG0i955 W3DvxOb36aMZXAaZIySjbD2xcOXgAikyRqWRVn0fxQtco333IXegvEtyJykaPGy8ItrI oi1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=untL2wP4029fh2STWPV+ZONKPlOGBnjIIb6/zYRySLI=; b=QLi2X4Jw2iYJKtI1CDddiz/20XWYos2v/scE2nVWDhrFUmcICyyV75ukI4WJrsIoM7 dA1SIFPxVgmc27DZdhyjX/LEPNB7FGhBeHjwFdgkUxHhO50ENClIfMrVc/+UO+2L50PK nEmL+rF4LylFIjYTXfvjvPw7jiUgjVSOAQhkk0WM9xDk7tQsxdKB9BLMwhv4GYpsOvqS fuj5XoUKYOCT+pUz4gaTNXJhThxxfTAOIKAt8Hfav+tvt+gQXzI9ZX7tjZBQpFIXICy6 rAUWdfj32uJXwTm79RmkkZjI+OYQimtmqiHSamz8ZEPSBf2zy+6VGLDyNa3Nw3NboSae 9AVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JSFNgbNE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hq28-20020a1709073f1c00b0078db137967dsi204813ejc.566.2022.10.24.09.32.00; Mon, 24 Oct 2022 09:32: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=JSFNgbNE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232632AbiJXQRi (ORCPT + 99 others); Mon, 24 Oct 2022 12:17:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235067AbiJXQPo (ORCPT ); Mon, 24 Oct 2022 12:15:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CA7F52E4B; Mon, 24 Oct 2022 08:03:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CCC89B815C2; Mon, 24 Oct 2022 12:18:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D5B6C433C1; Mon, 24 Oct 2022 12:18:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613913; bh=cDE7mdxA2GnHKcv/HGZn7QWb8vlWewY71vte2eP/0v4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JSFNgbNEeH9lVQTLjudiEZBbYoWQm/LSgcUs268UKfS0GM2vS60VbIfuPDjHrFohm dto+FQSAIT0QGkQADW2gMXnNRxpVkKXgAFQ1uQZKQY90Q7zM6nJoCWxDgRG0VlQoWh JFBcZHZG3NJYzC4sWSEzUEnROYfkfbT2cV8Sxs50= 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.10 062/390] ext4: make ext4_lazyinit_thread freezable Date: Mon, 24 Oct 2022 13:27:39 +0200 Message-Id: <20221024113025.269897167@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587320888124239?= X-GMAIL-MSGID: =?utf-8?q?1747587320888124239?= 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 @@ -3550,6 +3550,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:27:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9028 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441745wru; Mon, 24 Oct 2022 06:06:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5opCqIvUIp5JS5CC9mYSz41G/YRFndWAzPf2nbo5WOyVkJsDoobmhUCIQiEm9T5RS0d01x X-Received: by 2002:a63:5a50:0:b0:429:8580:fc61 with SMTP id k16-20020a635a50000000b004298580fc61mr29006010pgm.215.1666616780372; Mon, 24 Oct 2022 06:06:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616780; cv=none; d=google.com; s=arc-20160816; b=SjAhNKsc6XPrlvIJrCeoZtsgcPT4xE+vol/rhumJDoD2dnLQ1NbOSm9Bow22SPQnK4 nurjhV0GvSVWmpnH+hzw2CL2Czc8j+WJUcDm+3Iy2BS2gtvSGhfT1EZ0JZz+wf0u2ku9 klg3P1TIcky+cmRZdDngV+/PGmYu58EVviqwgrrLEciEe0cLdVe1EKQSsgkawWtDAK9P zTLXueOXRa6DCBxhoiGLHQFsGXJL5WVtNWqjLaZroz1Tr80iH2BLhS0WSeoAdzAA3r8T bSbRwzx6vduoJgUFgcD+eaEeDeVryLsHGFd0fM1VYHQnIWtoHFxO6BOBrXZA3Q86rlkZ KaOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=x216VQvHYjNgIpdOK41xJyQn9hNTOQ1XoGJya8MFtEA=; b=i8j3PRmLe8F2BdsK/RGErfewb/A9zP8JO50Hao01cD9DkzhH/af22Dlu6ZPPGMIgkm hO7NimOYfSXZ/AaBTbGCjUWEHXnmmahC4u0mFtJGM9vChU26T9pVyLFD98H/CV+0izBr E+g/vHDJvrDq/BcydxBUlSI0brS6ahECqHXwRUp16j9S+86x1Cg+X2zABpNVaPWCHZjc kpber6iZH2IfKq1331RIdyrvEO5rwR2pLWTpmnWCvLmCAzJnrvlTLvr4HN2o2LCg5GAd sIQo864PgwwBhxnIU7h0X7Ct0QSSjmSRFxo+nOoWjkJGTlAD+WTo1EMWMD2eVKmLBZ0d KGtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="iRYPsgh/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m16-20020a170902db1000b00186ba4ba494si439188plx.475.2022.10.24.06.05.57; Mon, 24 Oct 2022 06:06: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="iRYPsgh/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235159AbiJXNFI (ORCPT + 99 others); Mon, 24 Oct 2022 09:05:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234817AbiJXNB4 (ORCPT ); Mon, 24 Oct 2022 09:01: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 DA76629833; Mon, 24 Oct 2022 05:19: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 AE5ED61017; Mon, 24 Oct 2022 12:18:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFDFAC433D6; Mon, 24 Oct 2022 12:18:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613916; bh=27Hf3qBM+M05HOpUtzlV8FDc4ctAK6wPLlqXLlJMDOc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iRYPsgh/K92UUj0KtVoE+ysdmSRyORJFzYD7Gz6wcharhkb8lqQSkvl9USIqsBiJ8 IYZRIezMOqeUgSI3gFPC6j6dMWCMFNwlb6c1ee56lckEN1p0AyGHHqCp9wWYRBLRY6 /AOusEVU7Z4K/5+GfE+RK9prTLs7LCmYn8GP06dQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , Lukas Czerner , Theodore Tso Subject: [PATCH 5.10 063/390] ext4: fix check for block being out of directory size Date: Mon, 24 Oct 2022 13:27:40 +0200 Message-Id: <20221024113025.307918321@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574357305968934?= X-GMAIL-MSGID: =?utf-8?q?1747574357305968934?= From: Jan Kara commit 61a1d87a324ad5e3ed27c6699dfc93218fcf3201 upstream. The check in __ext4_read_dirblock() for block being outside of directory size was wrong because it compared block number against directory size in bytes. Fix it. Fixes: 65f8ea4cd57d ("ext4: check if directory block is within i_size") CVE: CVE-2022-1184 CC: stable@vger.kernel.org Signed-off-by: Jan Kara Reviewed-by: Lukas Czerner Link: https://lore.kernel.org/r/20220822114832.1482-1-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -125,7 +125,7 @@ static struct buffer_head *__ext4_read_d struct ext4_dir_entry *dirent; int is_dx_block = 0; - if (block >= inode->i_size) { + if (block >= inode->i_size >> inode->i_blkbits) { ext4_error_inode(inode, func, line, block, "Attempting to read directory block (%u) that is past i_size (%llu)", block, inode->i_size); From patchwork Mon Oct 24 11:27:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9030 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441789wru; Mon, 24 Oct 2022 06:06:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7bSSMhk6k6fzwYucpjR178Wr5J3xe1nlkww70KUBp6uuADTCyW8o7iwBB3/WIU4YEKIz9p X-Received: by 2002:a17:90b:1d0e:b0:20d:a61f:84b1 with SMTP id on14-20020a17090b1d0e00b0020da61f84b1mr65354129pjb.172.1666616784770; Mon, 24 Oct 2022 06:06:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616784; cv=none; d=google.com; s=arc-20160816; b=nXAZ12HRQuVXkyMnZIsyZRf+evSg2Bery6vGTKjr4Wzse8IQcHjhXcRm9/gsBHswOH sEBmtYOLgLsW6lOIkyA1bBAS8mBAr/JozznBWTTJJFsPRfGwOVHyOKlCK7+G6ZT8FeoP dx2zCp7DC15Yg3ad1G+Naa6K5ewvSsT3r1iocUBxIHJp31YUaHt0O/nn214CbRuY/I0X qwqMUjRXfcdZ4Slbyeujq7qXDUq979XaWz32uIsXThn/4gBBp9UFRTknJMnodrPJh35R 5pziUhj84ORkkyVLu38WhL/53AjG1FBnxBxJr3fItr4jEQ8cIT4HjkyXEMPHpwp2Z4EZ 7oVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7TaXgPK0L3jbe3KnU4IlaPxAlLVw+cOSJOXGOBV/j7U=; b=YImVtiAMU6ODYmgTY+RhA0KXdJMIaRnCjBhy97Xu+6xamFJphp+qoSp94GwsYeOfjU 7CyKCFq0037bReT2OC7zLwlX4A3T/7XSez9UKtbrAblFVoVXdOIlZO+ymxmW+VGws1ul tyr+FHUZcuyd+wFwMm4aQmc7pMRC2S3nyYyth+HzG2+gdSKcr4iKESXaP88B4m6NVf+Y 8EjRqy7lsSd42BaZF8lMfYXKYGLZ1epXMe8J0sfS4Hp6yFgnAhbLtwztGkUkNYZDdY3Z h1t4SSplxcyo5MbahhNBHSmozgt2B/os01kahPFwDtVfhw/jgocXxyF+B4JpGjhfuv0v UF6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ys+h9LLB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z5-20020a056a00240500b0053708adb535si36177984pfh.257.2022.10.24.06.06.01; Mon, 24 Oct 2022 06:06:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ys+h9LLB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235244AbiJXNFS (ORCPT + 99 others); Mon, 24 Oct 2022 09:05:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234950AbiJXNCS (ORCPT ); Mon, 24 Oct 2022 09:02: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 701D72BE3D; Mon, 24 Oct 2022 05:19: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 41A7461015; Mon, 24 Oct 2022 12:18:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56E83C433C1; Mon, 24 Oct 2022 12:18:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613918; bh=KF7sCAIdsozvMpIIucsXaQ/gNGcJr/ewwbxuXNv2Q88=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ys+h9LLBapuE71RGENcQ8bYEPDUfWZx+uOncRBon6Rld7u36TBSBRTETx/Pd2vdSV cxIP2nIR+Pnh+qsls56jwGZX3DuFfr8nKGBpYM35/83ZuTrCvEyfv4Kvo8gUbnRXY2 eIB7GGcyyOJrBVZ4TrjnjBVE9CsuzaZR3LXALKNc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Lukas Czerner , Jan Kara , Jeff Layton , "Christian Brauner (Microsoft)" , Theodore Tso Subject: [PATCH 5.10 064/390] ext4: dont increase iversion counter for ea_inodes Date: Mon, 24 Oct 2022 13:27:41 +0200 Message-Id: <20221024113025.347225145@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574361338125165?= X-GMAIL-MSGID: =?utf-8?q?1747574361338125165?= From: Lukas Czerner commit 50f094a5580e6297bf10a807d16f0ee23fa576cf upstream. ea_inodes are using i_version for storing part of the reference count so we really need to leave it alone. The problem can be reproduced by xfstest ext4/026 when iversion is enabled. Fix it by not calling inode_inc_iversion() for EXT4_EA_INODE_FL inodes in ext4_mark_iloc_dirty(). Cc: stable@kernel.org Signed-off-by: Lukas Czerner Reviewed-by: Jan Kara Reviewed-by: Jeff Layton Reviewed-by: Christian Brauner (Microsoft) Link: https://lore.kernel.org/r/20220824160349.39664-1-lczerner@redhat.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/inode.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5769,7 +5769,12 @@ int ext4_mark_iloc_dirty(handle_t *handl } ext4_fc_track_inode(handle, inode); - if (IS_I_VERSION(inode)) + /* + * ea_inodes are using i_version for storing reference count, don't + * mess with it + */ + if (IS_I_VERSION(inode) && + !(EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)) inode_inc_iversion(inode); /* the do_update_inode consumes one bh->b_count */ From patchwork Mon Oct 24 11:27:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9038 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp442051wru; Mon, 24 Oct 2022 06:06:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4nfLI7aOfLxZPBGia0QXx07DGH6+53kax0YBlVXuS+0JbiBs+wv+7epKUTTaoJ6x84L9YT X-Received: by 2002:a17:90b:4b0c:b0:20d:233f:5dea with SMTP id lx12-20020a17090b4b0c00b0020d233f5deamr38045907pjb.241.1666616811715; Mon, 24 Oct 2022 06:06:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616811; cv=none; d=google.com; s=arc-20160816; b=Q7HO5gKNZkj9DWoe6jrnP2CVlZizBjNv8HZ0KugxgK+OmoNtRd8NGUFUcskerqDR6I 32scSxC0IqA6idSnIKo5RLw/bXK5a+jcTlCLX2XBLy3j384p+QmrvC/0AK3GgtXPtp5f jv9NP5z4Jg/ibhYT9Tqc6Pb+FX47qM/cZLz2ftG7d/yiN+N+fErp8ztF1hRxMuEnWD/R NUebmK8NvoBagAcmx1u4aLjyKZwi9a4rSy7Lq5MxKPVDeXQHzJIwgjedz8pM8zlRPPFA RCuMnthc4P2+1t2u2zY26NY22EihhlmGgbGsJOBgLWl/vMsplj1ukUkjRa+iwgjL/J9c 34vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OtRnNJ81IBt3HCmM1zj5pUTAG8iic278N0LUgGLc438=; b=lCTkL5pN8LqsNraoT2BU3klm4wQX2vX9B0laY6yjGMVtzMcu5ohttPdu4DeQtdXnox MtLESpJ3duxz9xovRgWNXqzuFNJ8N8oog2e617sIKVnU6CnVfIzylae+9FZBwfDTyrq8 hGqcaXYi9KtDHsLMgwU4RyYVNs32E+tlG7Ar3TIzBq7qbXS+SMmOfnQ23Om1jz0tB3tj k+MJNZ1EfmexW3/hAGr/pEct7uRrhPMST5tqoYTVuCv9ygkBgd4eNGlgyH6QA3an7Zd0 ZiicpiVnzqncKQcSV5Tykt/SeteGS+m4VGo/wMtsxLleUx6FPnnXa6t0CNC6SWniE29E FSQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oQ5seF0o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a656944000000b00460cb60836esi35437220pgq.659.2022.10.24.06.06.34; Mon, 24 Oct 2022 06:06: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=oQ5seF0o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235275AbiJXNFX (ORCPT + 99 others); Mon, 24 Oct 2022 09:05:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234955AbiJXNCT (ORCPT ); Mon, 24 Oct 2022 09:02:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 703092C10F; Mon, 24 Oct 2022 05:19: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 D831A61218; Mon, 24 Oct 2022 12:18:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAC0EC433D6; Mon, 24 Oct 2022 12:18:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613921; bh=vwwx69rsb2FIxihCa6bfk7flG0j7C7NEHsW48/SnURQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oQ5seF0om/VALfHykfCZe1ITSWGWJZ3coHEGjFq3lw31hpbeIBn4kTRv17mGVV01F RprSpuvutmizxpSoYmOfdwBo8aCnySFBx/XJC5v6ImhvkOpClgFamtjN31KWS6Da91 J2EsPrT7b6xk7JZDMEpHVGxDGyiIetW7JDNeOZRs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Zhang Yi , Jan Kara , Theodore Tso Subject: [PATCH 5.10 065/390] ext4: ext4_read_bh_lock() should submit IO if the buffer isnt uptodate Date: Mon, 24 Oct 2022 13:27:42 +0200 Message-Id: <20221024113025.388075487@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574389788035770?= X-GMAIL-MSGID: =?utf-8?q?1747574389788035770?= From: Zhang Yi commit 0b73284c564d3ae4feef4bc920292f004acf4980 upstream. Recently we notice that ext4 filesystem would occasionally fail to read metadata from disk and report error message, but the disk and block layer looks fine. After analyse, we lockon commit 88dbcbb3a484 ("blkdev: avoid migration stalls for blkdev pages"). It provide a migration method for the bdev, we could move page that has buffers without extra users now, but it lock the buffers on the page, which breaks the fragile metadata read operation on ext4 filesystem, ext4_read_bh_lock() was copied from ll_rw_block(), it depends on the assumption of that locked buffer means it is under IO. So it just trylock the buffer and skip submit IO if it lock failed, after wait_on_buffer() we conclude IO error because the buffer is not uptodate. This issue could be easily reproduced by add some delay just after buffer_migrate_lock_buffers() in __buffer_migrate_folio() and do fsstress on ext4 filesystem. EXT4-fs error (device pmem1): __ext4_find_entry:1658: inode #73193: comm fsstress: reading directory lblock 0 EXT4-fs error (device pmem1): __ext4_find_entry:1658: inode #75334: comm fsstress: reading directory lblock 0 Fix it by removing the trylock logic in ext4_read_bh_lock(), just lock the buffer and submit IO if it's not uptodate, and also leave over readahead helper. Cc: stable@kernel.org Signed-off-by: Zhang Yi Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220831074629.3755110-1-yi.zhang@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/super.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -188,19 +188,12 @@ int ext4_read_bh(struct buffer_head *bh, int ext4_read_bh_lock(struct buffer_head *bh, int op_flags, bool wait) { - if (trylock_buffer(bh)) { - if (wait) - return ext4_read_bh(bh, op_flags, NULL); + lock_buffer(bh); + if (!wait) { ext4_read_bh_nowait(bh, op_flags, NULL); return 0; } - if (wait) { - wait_on_buffer(bh); - if (buffer_uptodate(bh)) - return 0; - return -EIO; - } - return 0; + return ext4_read_bh(bh, op_flags, NULL); } /* @@ -247,7 +240,8 @@ void ext4_sb_breadahead_unmovable(struct struct buffer_head *bh = sb_getblk_gfp(sb, block, 0); if (likely(bh)) { - ext4_read_bh_lock(bh, REQ_RAHEAD, false); + if (trylock_buffer(bh)) + ext4_read_bh_nowait(bh, REQ_RAHEAD, NULL); brelse(bh); } } From patchwork Mon Oct 24 11:27:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10166 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp640448wru; Mon, 24 Oct 2022 13:32:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4qFMN7c2ajbqHBnb621rrnbRrQBbyi/QQHdD1AUiHG5vJxw3UT2XjOW2ZEkKAkUeM4w1Va X-Received: by 2002:a50:c387:0:b0:461:3ae6:8cdf with SMTP id h7-20020a50c387000000b004613ae68cdfmr18668345edf.131.1666643562091; Mon, 24 Oct 2022 13:32:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643562; cv=none; d=google.com; s=arc-20160816; b=bmgXyoGS4X0vdXWkssi6HOrsmIgEYDB34a3hbzFpeIc3+brbR4WhU0M/W1WoVcKKon kVhDDDNbGeuq04OToDPKSJU3TkCUrqRSlnWzG+ywI7aLba7P8C2vb/L5ahbGgGRAa+R7 9UzYN1deXklp8l4FPZf7UJQmaeNXBAKxIprkSEEHPpsVtGs0wZ2NrTLvqquAER13dYnX Fzuq0nddi/vOH8zEbZSRKTDBPLmemcyWKjWkkS38C/bz7DtNAyz6pxeIUVUDBMvB7QIX NiEk6VmduU2xuKywu+MmKJKop8EBvga+1O3gA4NXz3pEfkFBP17kA5KY6gaV9kjKIuLH sMhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9Cd82BAJ0LxGQiNOsNbvyQ0yqL0e0q92ONsYVTZ8lx8=; b=f3g8SJFvk42HmMuoZ4HNuqS3o//JpIfC2KUbkUqIl9GiGTWtkeSleDQyu9XHUo2Fqu J8g88J8coCSmEg2spbogF9KQYyrVFoBYdZapiIQ/8G/SVdK3GAOe/Grv1Ar+OV6iMwgA V29YMb9A27K9Fqy4RC9qxHeJ4CZDK5rQB1y35JWKtPRDGAKM8IY8nRCUx8xxAPtWWki9 fzMnxlQEFebRCsBx846rrrZ8BxSC2qm7AOx6n0HK6uPE8qEXhh/z6c97RuRohtPIvztj gOFt69+QKGyjMrKk1KOh3LXx71Dm6R5nqokScXh0kWnZu5+C+QLr0IFeonVDSOfOr9Wi ONhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="RRg/8gh1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r28-20020a50c01c000000b0045fca739593si751128edb.188.2022.10.24.13.32.17; Mon, 24 Oct 2022 13:32: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="RRg/8gh1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234038AbiJXUPB (ORCPT + 99 others); Mon, 24 Oct 2022 16:15:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233984AbiJXUNv (ORCPT ); Mon, 24 Oct 2022 16:13:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B78CB9C21E; Mon, 24 Oct 2022 11:32:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 32EC5B8136B; Mon, 24 Oct 2022 12:18:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DCE0C433D6; Mon, 24 Oct 2022 12:18:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613923; bh=Mvez4XHFuHfJYqsWpKqrKcQB1U/xD2vMwrvXbRgd0Z0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RRg/8gh1LB6CmXm2a/SY4fwHl0lYgGWqsPVl4vtUfoqCWpF2gHZaQ0IFXNu90+fah 11fU8J5YFkCDPVGobOD3YYjsrUCsQPFJeooVr+88wMpAx5VqrvQkcPp9eMDedooXlg vEPJfOdNQp34GtsdIxptDcpWBv0KjvS50kOqHyK4= 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.10 066/390] ext4: place buffer head allocation before handle start Date: Mon, 24 Oct 2022 13:27:43 +0200 Message-Id: <20221024113025.428180726@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602439888939195?= X-GMAIL-MSGID: =?utf-8?q?1747602439888939195?= 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 @@ -1175,6 +1175,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:27:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9666 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp534826wru; Mon, 24 Oct 2022 09:11:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM79bLfkhX7SOotY9jwEzzeNgToDD5WRuw0BxaL56zl/f2tP6drO69/4Rh4kR5MP77RYWyTB X-Received: by 2002:a05:6a00:4192:b0:563:5e95:1db3 with SMTP id ca18-20020a056a00419200b005635e951db3mr34475188pfb.14.1666627909856; Mon, 24 Oct 2022 09:11:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627909; cv=none; d=google.com; s=arc-20160816; b=arSXTHtar6z+X2DECoT50CdVQ325Qvnv+cWia/XRmBoXj+AkMkYxEBspqJ8ckKChQU j/nx/wuFee3hOQXtMdvFD05u7regV760WpRZ51F7v2i4sSvOH9ToDi9kEDg2bA0fxrh3 OM4MfjsmieGlhOFgVqlkXlFBnnUrEzLmX9qQM9TD0hdQfug6wz2GJn47nNCpv6PUL2db lmGwjj+5n8e0i1VrEQ6NazKLe3O1rZxBq9ijgyrIc9x1E/9eWIO25rXlL2eohgqxOPZP 7qviLQ9GBKktUUH+X3u6vnyujFnh4dBzmpsuPOteIKGiH+BCyh/sG6cZruxq0WHNPqEC WBDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OZaGlkC9BrYC45iEbTf/k4AjzfP59RwUHesCmmtaaRE=; b=AxkcJf7xyv68Fwbiwo3Xc6z7314dBfCGmlhAH55vZUIAS/SyN9wvZSNrG6TZsinMho G51hZN8OWmbE4XIiBcRGXZmZEJD/GZTdhGOPd+UH+aUCsImFhN7KaMMxkqBA+g1KW4+X JE1cyFRDX4IAtiq8uBcLt/bmx0JREfC+TTne9q1WmwdtvHq9phHj79HCZBO0vVZHYn8g f4eG3lzEu9mZ5en2hqgcb7tTO3W2qcPIyHneRUJQtD7wBrLeiGt2/qUEpdnXaKfwfnqx X6d/f8kDlQfQrdNrfgRSqmIqGl0Vs4pj16CI0wJWzSjFgpRDQwnANcXel+3S48kP8SEu LOPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PylAocf4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a63e916000000b003fea0415b5asi37620758pgh.834.2022.10.24.09.11.33; Mon, 24 Oct 2022 09:11:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PylAocf4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233300AbiJXQK5 (ORCPT + 99 others); Mon, 24 Oct 2022 12:10:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233308AbiJXQE1 (ORCPT ); Mon, 24 Oct 2022 12:04:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90C8A11DAAD; Mon, 24 Oct 2022 07:56: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 884F7B81628; Mon, 24 Oct 2022 12:18:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D57A2C433D6; Mon, 24 Oct 2022 12:18:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613929; bh=m3P8wj85nmlYhKsgy0AO2VM9B2JZ7cdOZOIryw76RFw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PylAocf4SMHS9doyQtmq/mYotgGuq9o1P8LshmgPvh9B3xzVMHlM5iz4fyZkohzRV 0FVsjxnTNLElW65cCEdZEUN6yW9AkXa3jf6Wz/vk2m6OwRhjVXnqbLQyuxAOOzGfOV COOIGcUYXKdp2e2i4sP/L00PVwxsq+Uu6XhHhIyE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ye Bin , Jan Kara , Theodore Tso Subject: [PATCH 5.10 067/390] ext4: fix miss release buffer head in ext4_fc_write_inode Date: Mon, 24 Oct 2022 13:27:44 +0200 Message-Id: <20221024113025.457319106@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747586027137470719?= X-GMAIL-MSGID: =?utf-8?q?1747586027137470719?= From: Ye Bin commit ccbf8eeb39f2ff00b54726a2b20b35d788c4ecb5 upstream. In 'ext4_fc_write_inode' function first call 'ext4_get_inode_loc' get 'iloc', after use it miss release 'iloc.bh'. So just release 'iloc.bh' before 'ext4_fc_write_inode' return. Cc: stable@kernel.org Signed-off-by: Ye Bin Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220914100859.1415196-1-yebin10@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/fast_commit.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) --- a/fs/ext4/fast_commit.c +++ b/fs/ext4/fast_commit.c @@ -766,22 +766,25 @@ static int ext4_fc_write_inode(struct in tl.fc_tag = cpu_to_le16(EXT4_FC_TAG_INODE); tl.fc_len = cpu_to_le16(inode_len + sizeof(fc_inode.fc_ino)); + ret = -ECANCELED; dst = ext4_fc_reserve_space(inode->i_sb, sizeof(tl) + inode_len + sizeof(fc_inode.fc_ino), crc); if (!dst) - return -ECANCELED; + goto err; if (!ext4_fc_memcpy(inode->i_sb, dst, &tl, sizeof(tl), crc)) - return -ECANCELED; + goto err; dst += sizeof(tl); if (!ext4_fc_memcpy(inode->i_sb, dst, &fc_inode, sizeof(fc_inode), crc)) - return -ECANCELED; + goto err; dst += sizeof(fc_inode); if (!ext4_fc_memcpy(inode->i_sb, dst, (u8 *)ext4_raw_inode(&iloc), inode_len, crc)) - return -ECANCELED; - - return 0; + goto err; + ret = 0; +err: + brelse(iloc.bh); + return ret; } /* From patchwork Mon Oct 24 11:27:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9679 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp535522wru; Mon, 24 Oct 2022 09:13:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5//JOP28jom6BfqUkzslxnncnI4FXjmKy1Vkbb13Zve7pECGmPU33It+E1UgZdjvjkXDtt X-Received: by 2002:a63:b5d:0:b0:45f:d7d0:5808 with SMTP id a29-20020a630b5d000000b0045fd7d05808mr28422639pgl.330.1666627985462; Mon, 24 Oct 2022 09:13:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627985; cv=none; d=google.com; s=arc-20160816; b=YZFpjC3DN4tH42PPUYNlyQN8woTylASmJmYsIZWpHNNmZzpuo+4znIoEE5XYNd1bVl KkwhbLjDHZVEvy62S4uoOjLSN5movoI/CFQNdVL2OSAbfBsq8XqOF6r1worjCx8TXCYN jLdI9AGdiWbfyjHBYexSeJBo9USFH27rZjLKwbT6UC0hzYTt8IYqw1+PfyuoMIZy+w8w mlCD/Hu43B4aWcyvTA6VQdFY2z55I5Ue7Gy3xxDeePB7VzdOiiD4w0RXQXjdWrWLtS3T sVXzVwt4iN8+AIQVrooPpz0uuLzXzRv4yCPFzXXIPBu9cz8zcg3rUy0cZ+zuNYwL972W l44g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=h847raATzme5uJXVNwT5pENdfBtw44WO7ne0H0gAFCs=; b=WY3OLn42/jUKc9qV+Ujg8KNgscVLLAMRefDr/v8AuwizSPOxJfzVQCASapL+Q3mVoE Xbw6nQxd3/OYbuM8ataG8jdSEplzJb/ZuDbEHk6YQaVi38w51Fnzz46ICAycNHY3V3v9 o27mRmZny3j92CBCem2I3YgYzgbfZHafRYpABf3llxHwxPPW8DUONF2+CInz0+QJ+FPB pier+azZJy1RvZsTRgoyGK//ekpqmrSkD2PUov7cWdoEpDz73ezfU0Cpoc6ub/fxTHVN ALLBSkK1GOhg0u/DkizxylMjf/dqPgEbd4Rb/xQ8I2YvOX3klrcdcEk39Ybe9EXyQC56 iyRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=reliQMNp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y40-20020a056a001ca800b0056baa6cfd49si7789pfw.332.2022.10.24.09.12.51; Mon, 24 Oct 2022 09:13: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=reliQMNp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233887AbiJXQMM (ORCPT + 99 others); Mon, 24 Oct 2022 12:12:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232783AbiJXQFa (ORCPT ); Mon, 24 Oct 2022 12:05: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 7236065A2; Mon, 24 Oct 2022 07:58: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 1B540B8163C; Mon, 24 Oct 2022 12:18:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77FF8C433D7; Mon, 24 Oct 2022 12:18:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613931; bh=LPRtJd9WOtczlaBhoc6jlt3gikaryNM1+Qp05AfSWsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=reliQMNpPYzp8SXr7Kb/sSxPBapoYMMs8wbuPqjcpVmGY9reFjW5o6nhsp68fmOMp MnJ001Kvtl+OpE6bBj6WkKklRG5YXyAP8J3GPFmy8BYTTj7CoSNguR6pbnrT5rEipx 9H/AEvSQv0DQN7/Qf91E+NiltoYTePoxLbu1BX68= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ye Bin , Jan Kara , Theodore Tso Subject: [PATCH 5.10 068/390] ext4: fix potential memory leak in ext4_fc_record_modified_inode() Date: Mon, 24 Oct 2022 13:27:45 +0200 Message-Id: <20221024113025.497311766@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747586106918840655?= X-GMAIL-MSGID: =?utf-8?q?1747586106918840655?= From: Ye Bin commit 9305721a309fa1bd7c194e0d4a2335bf3b29dca4 upstream. As krealloc may return NULL, in this case 'state->fc_modified_inodes' may not be freed by krealloc, but 'state->fc_modified_inodes' already set NULL. Then will lead to 'state->fc_modified_inodes' memory leak. Cc: stable@kernel.org Signed-off-by: Ye Bin Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220921064040.3693255-2-yebin10@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/fast_commit.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/fs/ext4/fast_commit.c +++ b/fs/ext4/fast_commit.c @@ -1391,13 +1391,15 @@ static int ext4_fc_record_modified_inode if (state->fc_modified_inodes[i] == ino) return 0; if (state->fc_modified_inodes_used == state->fc_modified_inodes_size) { - state->fc_modified_inodes = krealloc( - state->fc_modified_inodes, + int *fc_modified_inodes; + + fc_modified_inodes = krealloc(state->fc_modified_inodes, sizeof(int) * (state->fc_modified_inodes_size + EXT4_FC_REPLAY_REALLOC_INCREMENT), GFP_KERNEL); - if (!state->fc_modified_inodes) + if (!fc_modified_inodes) return -ENOMEM; + state->fc_modified_inodes = fc_modified_inodes; state->fc_modified_inodes_size += EXT4_FC_REPLAY_REALLOC_INCREMENT; } From patchwork Mon Oct 24 11:27:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9023 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441419wru; Mon, 24 Oct 2022 06:05:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7TRcz7OO3c2wMeIorNsJNPSusj+RSEOE52q7FkB9kNGrInB+jDa6ZsK3UksaF5mf8odLwf X-Received: by 2002:a17:90b:1bc9:b0:20d:b990:5028 with SMTP id oa9-20020a17090b1bc900b0020db9905028mr63050353pjb.111.1666616753477; 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=w07d0TBhWUN4cSqILBwRjJuZW8Bor1F9R8SGZpW95Sq0EP4i7fteiDme9lSsjy9DRg oMwHvyTWMjZjFFfnxH3nWm2DLaMwfa3JUkms9576oTu1c8iWsLXPW3fC+IgsqV1mroFQ TgMOwm3iPOgBP4MLiJwf/FzeTtKbCYOAbF1ZUD02asQXDC3FX99Y5btekb1BHE0G2PX1 eDNNho9izlzCIdfwnD9BJs4XqOdaXFOo5DCOCys9HANyBA5sAlEoIX4p6J5QTnF/lAxg ufDRF5hxMjIrcVfB5X1QIG8Ge7kfl5Kgq7JAT1dC1J7+WeinuWRPNpgmxFk0DrIk8SDm IGVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KbWh7xYV5wvMCDK/R9glIU9iwkurd9EL1YCngka/RDs=; b=IcybSnCP0JF5/rc1gK3cwLfsYqr6Oiia35wV0WHHHa826Li5Cy76UZYwjEwFZeNc/p suuCk34tO8HNTfTV+TvOVmMKcBO05Aoc3Y1Qzubwy0Fr4qMTt5T5mEGLmBhxlVfbFvzJ mJBEdpV33QADwOPACU2Z9rJ5miwu72alxmoo99qciTD7/N2HuKdf3V7AWty7G8ijGrmH Kienx6JPwuMy4tkHla7cgwAQvkDISinrMV7i7AQfnDKnuTis25uZKEbHsgG4A3AW2RZ/ 1ARs0+FUDwDODC7qSXz2CxUtfy9dw8mw4EiZfYh7ULTVRYQbQC9quw+riJfIt3kAZqOM h/6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CwnfWVmV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p16-20020a170902e75000b00161739962ffsi37392829plf.163.2022.10.24.06.05.30; 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=CwnfWVmV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235468AbiJXNEx (ORCPT + 99 others); Mon, 24 Oct 2022 09:04:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235114AbiJXNBZ (ORCPT ); Mon, 24 Oct 2022 09:01: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 173AC2CDDB; Mon, 24 Oct 2022 05:19:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 025EA61014; Mon, 24 Oct 2022 12:18:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 151DEC433C1; Mon, 24 Oct 2022 12:18:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613934; bh=vRZRcG52HvItJnHU8ZwO+iF8jCky5QMMnaeL1wxRTTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CwnfWVmV3EUJXUqlXg5zrjhLrj5q2yZJOEAgUo1IlbqqeGBej5QNE0uIh5jQKGtjH L5gMt6w3qDq7Shv++iJtiwSXsKIKD9ZzHAP6r3PJqzyxQ7fVmj4416qFJ3uyJhNMNT ZkeTsfKBs7z+kcCKaOF7pjqMIvTkXovz8YNyMcSc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ye Bin , Jan Kara , Theodore Tso Subject: [PATCH 5.10 069/390] ext4: fix potential memory leak in ext4_fc_record_regions() Date: Mon, 24 Oct 2022 13:27:46 +0200 Message-Id: <20221024113025.529118096@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574328626684955?= X-GMAIL-MSGID: =?utf-8?q?1747574328626684955?= From: Ye Bin commit 7069d105c1f15c442b68af43f7fde784f3126739 upstream. As krealloc may return NULL, in this case 'state->fc_regions' may not be freed by krealloc, but 'state->fc_regions' already set NULL. Then will lead to 'state->fc_regions' memory leak. Cc: stable@kernel.org Signed-off-by: Ye Bin Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220921064040.3693255-3-yebin10@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/fast_commit.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) --- a/fs/ext4/fast_commit.c +++ b/fs/ext4/fast_commit.c @@ -1584,15 +1584,17 @@ int ext4_fc_record_regions(struct super_ if (replay && state->fc_regions_used != state->fc_regions_valid) state->fc_regions_used = state->fc_regions_valid; if (state->fc_regions_used == state->fc_regions_size) { + struct ext4_fc_alloc_region *fc_regions; + state->fc_regions_size += EXT4_FC_REPLAY_REALLOC_INCREMENT; - state->fc_regions = krealloc( - state->fc_regions, - state->fc_regions_size * - sizeof(struct ext4_fc_alloc_region), - GFP_KERNEL); - if (!state->fc_regions) + fc_regions = krealloc(state->fc_regions, + state->fc_regions_size * + sizeof(struct ext4_fc_alloc_region), + GFP_KERNEL); + if (!fc_regions) return -ENOMEM; + state->fc_regions = fc_regions; } region = &state->fc_regions[state->fc_regions_used++]; region->ino = ino; From patchwork Mon Oct 24 11:27:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9033 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441936wru; Mon, 24 Oct 2022 06:06:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5GS/sDPeQq/EXQcBGx6tUK+JuD+8DQk6srumK9IXLsbr9v6EDG/ObXDSfGbjKUouozBoup X-Received: by 2002:a17:90b:3ecb:b0:212:ce31:33c3 with SMTP id rm11-20020a17090b3ecb00b00212ce3133c3mr20153644pjb.53.1666616788404; Mon, 24 Oct 2022 06:06:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616788; cv=none; d=google.com; s=arc-20160816; b=ZtduqlQF4/xdCspXF0ieHqkRfYHJ4PQ5TYs490Rm1FNlzt8rF4BOmTTvQP19wMVUok cJOjjqAsADuQeyO6yY923k1ZQiZnbd77frJ3cvWw7vW+132C0m294ZF+LOSNneClbg8Q 0fuotaZ7lGK7ye0dHP0Q5M7qZFOhQAiCj7lKsFKOfZ6wOJbq/4sT7bRU0Alwb46Q+S7I GnzOdLvMWVe/VSeYPHgoPu7oBKTeWSGPkgY/+yNxZ8pvO4NOWs6uzPATu49GV1W4Zo1Y R9P5xfeE5KCYvUx82OnYdBP2XdGI3EvnRYEBE8mM+E0qgcnfAsDdpyvROi3llE0+Yhs/ 5R4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=e9pqHciSb8F0n4dHq+X4swKD+Y984k6tRnAZhXzVDfo=; b=lXpVmWiBxsI633P1ouW2pBOUyQc8t848ZMX3cpi8rQoOkA8mpiBVcQEWhmep4LYypv ltKxqPovnBCN0p5b5ZV3aBlBodAGMYOe2QR8tFQWTg9Sz2fU550jfbdn3zjd/ikTywNN sYsGETJY6MFFdrB/W3HerQlgPLBtdSiG+flAyFhyxbf63TdBzhNJ61+FhmJKfMCEll3m ZYgu/rauW1yYCjR4CnUUJ64mQ2kiwqpR2FA5bvkZU+uGopa92cGAMuF6yfMskM/EgNwC dLeiRi9n2aljjJ4s43ykfT6iDqOrlAnMsJdjLnjvZxcvrMzjHcoK6QIm+d4MPHBfijg5 LGbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="E7N/fsxG"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h68-20020a636c47000000b0043961d06e6bsi33238272pgc.787.2022.10.24.06.06.09; Mon, 24 Oct 2022 06:06: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="E7N/fsxG"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235310AbiJXNF0 (ORCPT + 99 others); Mon, 24 Oct 2022 09:05:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235102AbiJXNC3 (ORCPT ); Mon, 24 Oct 2022 09:02: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 DB1231094; Mon, 24 Oct 2022 05:19: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 913B4612B3; Mon, 24 Oct 2022 12:18:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A68CBC433C1; Mon, 24 Oct 2022 12:18:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613937; bh=33E8OtbXA+omniS78pGr4BYD5QNAbqZlBs6p6TcOjE0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E7N/fsxG+O9YnNEcxiqNLaIAdWoOoBvrPxH7K5DxXfQ18z2cua4x3xF7yCkU+IqJg nKbpeArs0e9vRVrtpYlR8GQjp99JBM3Ijz8cnUyqidZjgPthawVtX9/fzKQqqzcJCq 2xyBa7zKU1OZtwqEY18hWMjm5YElXIeuA+6Rl05o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ye Bin , Jan Kara , Theodore Tso Subject: [PATCH 5.10 070/390] ext4: update state->fc_regions_size after successful memory allocation Date: Mon, 24 Oct 2022 13:27:47 +0200 Message-Id: <20221024113025.576979255@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574365247762560?= X-GMAIL-MSGID: =?utf-8?q?1747574365247762560?= From: Ye Bin commit 27cd49780381c6ccbf248798e5e8fd076200ffba upstream. To avoid to 'state->fc_regions_size' mismatch with 'state->fc_regions' when fail to reallocate 'fc_reqions',only update 'state->fc_regions_size' after 'state->fc_regions' is allocated successfully. Cc: stable@kernel.org Signed-off-by: Ye Bin Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220921064040.3693255-4-yebin10@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/fast_commit.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/fs/ext4/fast_commit.c +++ b/fs/ext4/fast_commit.c @@ -1586,14 +1586,15 @@ int ext4_fc_record_regions(struct super_ if (state->fc_regions_used == state->fc_regions_size) { struct ext4_fc_alloc_region *fc_regions; - state->fc_regions_size += - EXT4_FC_REPLAY_REALLOC_INCREMENT; fc_regions = krealloc(state->fc_regions, - state->fc_regions_size * - sizeof(struct ext4_fc_alloc_region), + sizeof(struct ext4_fc_alloc_region) * + (state->fc_regions_size + + EXT4_FC_REPLAY_REALLOC_INCREMENT), GFP_KERNEL); if (!fc_regions) return -ENOMEM; + state->fc_regions_size += + EXT4_FC_REPLAY_REALLOC_INCREMENT; state->fc_regions = fc_regions; } region = &state->fc_regions[state->fc_regions_used++]; From patchwork Mon Oct 24 11:27:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9654 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp534309wru; Mon, 24 Oct 2022 09:10:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6QspaRnKbtASRSjGZCssAJqF47GnoQ3oYwSYFSCkTVOtRwya/ARHe/c/JIAKIazxML0Zh6 X-Received: by 2002:a05:6402:2802:b0:43a:9098:55a0 with SMTP id h2-20020a056402280200b0043a909855a0mr30843014ede.179.1666627856138; Mon, 24 Oct 2022 09:10:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627856; cv=none; d=google.com; s=arc-20160816; b=RqACI/ZZDmA84jETcFGf5HRBIrmzlEyXl5B8VHJrJ8WzLxopSFAsY8sg8AZK/sjstS uMOx6O13qLN797NlKdkMM7aJ/h8uY74x91OFzBVTAq06fQRCbffBNDGHlsl6TaUfbyDL 8Y46EhsIZoUj3VixR2YlO2hnXIqdlPUg4ZyHoatc9i/XdurO9Nv460ZTT7Cf623TiLbt xu1qgE+7/aF4bZ9NO2X57rBa2+v5IcEE8zwvip3VYSjxpmvp8OzU+xpqrGSGuh2UMYHJ bFkmmS8gC7jOWayjOAxAc1CBFHhRr7RLHL1UeZl5liamffBtzqhqUz1nv3QjHkeYkIuL paww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=McW7G6MpafCoocDC+IcWqb9i9He2YuKub2dbHhacA7zAiMROd6aStg7gJYM/NPL/kG HLtFjxDrSwXKeXOkhbjp/QmjYin0umDOYrnUAEM2xHkWK+ZpDq+2c+fOWZSFH+1wWmUb 5T5tZ2USioeXJsSSYVFinUpOQKWq1qcs7TGSAKbbyCwPcG1wp+L9+fumpNUlmMIDde8o jg8uv9Arh3KYKq0dPjv9c8LWlIVE5t7H9AQR5QYV6SIw6BsFh/TyiwMNGGJJTZvfPYfz Mf3uw64Jl7ohT4g4AfLVpG4gw5WnFkctuGP/R1Ovh+kbLxFCWgrPDRUTtbBOPXGVWEVa Ffug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bAuStvL8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n23-20020a056402061700b00458cba4c78bsi121916edv.416.2022.10.24.09.10.29; Mon, 24 Oct 2022 09:10:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bAuStvL8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233101AbiJXQIT (ORCPT + 99 others); Mon, 24 Oct 2022 12:08:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233395AbiJXQEl (ORCPT ); Mon, 24 Oct 2022 12: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 4AD47111BBB; Mon, 24 Oct 2022 07:57: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 DA310B8163A; Mon, 24 Oct 2022 12:19:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BBD4C433C1; Mon, 24 Oct 2022 12:18:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613939; bh=QU6jcTM5tFiqBhEpEDUebcCTZlgBib+XeTwuUsseiyE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bAuStvL8n+lQiHWahcSDtFr7g52zwqg7u/XJ6cuwOM8+L9RYBMnWwqFhpLZOLWiqR ngeOD0JjjfPuWMPCzp1qsFSDKNRKHe1iVNCjUAPSQLMELOQp1MW2FOk0jlLUtRx++t JZTk1TYn9Hr0lL+ia4mCbUclVpBWjfE2n+YU7mqM= 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.10 071/390] livepatch: fix race between fork and KLP transition Date: Mon, 24 Oct 2022 13:27:48 +0200 Message-Id: <20221024113025.612651507@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585971087693559?= X-GMAIL-MSGID: =?utf-8?q?1747585971087693559?= 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:27:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9655 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp534379wru; Mon, 24 Oct 2022 09:11:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ogtX9X+5GM7v4RcjOl2S8b5ZZoFTnT+nTbXVnoEmi4RD+Eyw5xf7WyoHqhbwYpe25JqVt X-Received: by 2002:a17:907:a47:b0:79e:56dc:5373 with SMTP id be7-20020a1709070a4700b0079e56dc5373mr13821296ejc.148.1666627861785; Mon, 24 Oct 2022 09:11:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627861; cv=none; d=google.com; s=arc-20160816; b=n+o+4h7ktl/f9komcNDnuSgOC1KbUG8/spKpbENzUh38Vr9lel63k5Ebg0XZFFnTBv LmPlNLmF5tgOQLqjpAdEYOD5Hr0d6nLNPq76wqByPbaI/NvYk7Eu3RlsCmHONz6mDSl0 3Tjx+fzUy9G8F6c1YSKdX9K+Ct07YzdG2Wh7zcNg6nymwuOxYZrYoWkILQV0KgagtRpC yY1BPjtrv+7RGU+lDz7t8a97Qalr+2impUtlDvEn5cbnBsLXnvYSP/bB7hEZqvzCJg/P sChtI+bkeWOudzsxNY3e3cGuXfiUIqRwKm9tq+bpDhhbr9BR7YHBtveLlc1TQ8VkDuHy G3ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WlsELkqmMdddD+14ARogECvREY6WQCKsAG+TPNFQ/gU=; b=RvE01dwZU789hIJdjoc52aLChLAMl+tT5fo8Tdvp9E3yNS9t3J3JflnMj5tfq2+Tna uQLYhvIgt1koFNzReerWlnNiJZHkWeqVwDEamhYpqKnYeqDFilOdzLUVOXBBXDy5sBev DiuYLz+lsfJioBaVyRuOuLgqc1Z9gnBkjLyD9IfR5SYRtm5qceFSpNPiIFCTIKVZTk/w cGNhIJ/R6dGt80Pv+kAwe9yE4fPuajS7urDgReXG32oi+nJGBCtZX1fH6UoZfbrM5C+g kvmS5pxXb8RS64jjEawZXt17pr0ddVSu8z/Dri/z55ONLnlz9UGvTeYQkSU9JecQPuV5 g2WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ObsFjA/D"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056402278800b00461e3e1bc3asi183523ede.317.2022.10.24.09.10.35; Mon, 24 Oct 2022 09:11: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="ObsFjA/D"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233505AbiJXQIr (ORCPT + 99 others); Mon, 24 Oct 2022 12:08:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233514AbiJXQEp (ORCPT ); Mon, 24 Oct 2022 12:04: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 2EAD338D; Mon, 24 Oct 2022 07:57:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7A81CB81636; Mon, 24 Oct 2022 12:19:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2CF5C433C1; Mon, 24 Oct 2022 12:19:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613942; bh=UT5fI7Gb2UDT1kmiKJtaR8esT5aLLjyI7sXIdG9xXfI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ObsFjA/DkvhqdP+dl4UytrP6bxtCvffExgLJ0aAoimi0ZAkZHzAusQKsA1nSKC5X4 sxKVnnutY9YNI5kVTP5u6cc6NgAuXmSZY/97x+rvBfpyqpn6RjU47Ehiiz+gPNOclB QRV5oMt/2nrZDJ9oenh+IqX4LsLm6MxQGqWI2tPw= 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.10 072/390] ftrace: Properly unset FTRACE_HASH_FL_MOD Date: Mon, 24 Oct 2022 13:27:49 +0200 Message-Id: <20221024113025.663127307@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585976717046231?= X-GMAIL-MSGID: =?utf-8?q?1747585976717046231?= 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 @@ -5662,8 +5662,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:27:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9677 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp535371wru; Mon, 24 Oct 2022 09:12:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6s+7BiACm56WD2/rv7iQINOBa5VmCPLND6TK+aKmU9GplbavCUk0FUpqVtIYec4MYN8u+R X-Received: by 2002:a63:1d5a:0:b0:46e:d157:39ef with SMTP id d26-20020a631d5a000000b0046ed15739efmr12621995pgm.231.1666627967677; Mon, 24 Oct 2022 09:12:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627967; cv=none; d=google.com; s=arc-20160816; b=z8q7+FKpEtjyXzExWh7BqpLHVvteR6Qb5VCWpPeV4QGsiVfbzBtwOQhshdgikT1LiH ig8hSlxbOkmD9SUNhrUJmPzE23EkVlxmk5AIXYR9GzLN4xvUbGX6nHzNAkw1W5/CW9zM kF39XZzSeG13DTr6becaxkOo8T9km8VtVtxySN7LzrV+8jqb+CTHIYd3qDNFKdOCpSkG l9f/VIlVE8/SM4/AxFK7pOS0V2Uwg5j36MQ0nZd99AF29PRyOd+Y9oRfZ3EWlMBegv+b RStP73OlJq4od9pDzlxmE2VvbmcWUVleolJO4V9uCk84O3oxtYOSJ6EiqzGjHYZypXpH vk1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=343LmzpUB4KSWg1kdMtOfoq0N0MH6kyLvZZEgQ0tuYU=; b=sQjlGA5D5s6Wuld9LnY6T0GnNf8HpGjAd5XfVamzKGf67mJsabibmYNCbKwRwlMnUd OMjiMvBAssYWJkvJ37mNEiZLHbTWFYR6YCv7+pPi7lDbcWyiv8Y09adRlHI9m0hR0IYx 8BUlOi6+MMz15wH3GEHZznyYRa6gxuXX/H32Rqd++v+uSsAbG74Zqe9tzDqz7SHa+8Tn S15Jub3btiW+qZyDJHwe4XoDXXnqUOeQbHEDopqSttPh7egwhg1CYvk4JgfMNyVE1KLG D2EgzCwEyLRrFtnh2Q0989PR0I1iNFDq+cfNUElOLDqkLcpLydd7aarthPVwwGyoIMAa qcrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MDG3YtQk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d16-20020a170903231000b0017f762e2dc6si40419161plh.613.2022.10.24.09.12.34; Mon, 24 Oct 2022 09:12: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=MDG3YtQk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233828AbiJXQLz (ORCPT + 99 others); Mon, 24 Oct 2022 12:11:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233285AbiJXQFS (ORCPT ); Mon, 24 Oct 2022 12:05: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 20851402ED; Mon, 24 Oct 2022 07:58: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 14785B81643; Mon, 24 Oct 2022 12:19:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CEBEC433C1; Mon, 24 Oct 2022 12:19:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613944; bh=Oy2e5v0wyuWevJiJGMBDmpHGI+F+5JgU4yTSBkPrXsQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MDG3YtQk67q3+TEebYfqu4p1lMaiSvsHelBhZM++3uXLs90fCB9Q6nlE2uPPvfThF 39R1w3m3gVD0bJAYXDjbKIWRPMZVAAtMbWP/ZYECzVokyN4+Qqf0k3rXNVjj6YZ0DQ Oza308IKUCsCrG1gBR6IufzA9LIPEAZAFDYTG4A0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Steven Rostedt (Google)" Subject: [PATCH 5.10 073/390] ring-buffer: Allow splice to read previous partially read pages Date: Mon, 24 Oct 2022 13:27:50 +0200 Message-Id: <20221024113025.707448543@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747586088013801670?= X-GMAIL-MSGID: =?utf-8?q?1747586088013801670?= 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 @@ -5341,7 +5341,15 @@ int ring_buffer_read_page(struct trace_b unsigned int pos = 0; unsigned int size; - if (full) + /* + * If a full page is expected, this can still be returned + * if there's been a previous partial read and the + * rest of the page can be read and the commit page is off + * the reader page. + */ + if (full && + (!read || (len < (commit - read)) || + cpu_buffer->reader_page == cpu_buffer->commit_page)) goto out_unlock; if (len > (commit - read)) From patchwork Mon Oct 24 11:27:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9029 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441777wru; Mon, 24 Oct 2022 06:06:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM48JMPb+nSFV/cteWgR9/tYSXQkYXvCXB0tATSWvNnuMWYBR1YEHbFZb+FmwGTB84EpCrxk X-Received: by 2002:a17:90a:a401:b0:20a:da56:b073 with SMTP id y1-20020a17090aa40100b0020ada56b073mr38873704pjp.1.1666616783597; Mon, 24 Oct 2022 06:06:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616783; cv=none; d=google.com; s=arc-20160816; b=DkaMrZJGD7iP0G3ctczQTFhVWTQExKDkiEHY+4WPulqP6MuSxgwbKiZv8Gpa0Bgq2O r7SfCFueLngBXcc7Fi7720WAx3QmREIWgMwGgMZpkqDLjlboWCLFNDXyV3OKaGYtJKdP dytgtXW+dLuj3f94LlB5jMafjTD47TG6mUyl+PFXvNaJ3jGwbOc7SN1M0puqAl6C7AKi yHtB0lUMUlfvvso3y4tEcIZl2qiUN3V3yU4NFgVK1LKUvAv3R814fCiXLSicwsOrl9l2 y8hvfoHFKVaWS0FO+QwDviB7xnAVE/9cfk3lgkAkZ1tOFBcRN7ONTOc7T9SIF8aI+YXh oNqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=55BmYCgW8UYGV5F1LnPajnKAXfB+92StyzY+WcG0CdQ=; b=QyV2UoKZ1SDirKeC9qRoGp+8FY18JwRIuCBf8ERGKoEf4hRWiGQzN+amni6XLIzOkx EsTaTSBWnoRxbPWoQA+we+o//r1SjKFaqYL4yHwr9RH8izYd3i93YggmC3bjV+k+Hf2E 8vSZLygFgY82UJ+B1wqhqw/yfEXIZvgQTRScxoLu+XsEzKVGm1JSTnlwD2YlmKIomw+B GGb6aeJxX5Hwgufk066Z89TEBBXXh1tHMoPwIr5gYCBJu18jpYcrMTjESILwTJu7XcKO U6G4hdDE7zG3gkdjlpqIJEsJdTRpnDsE2um8t7OXTsYngZu4O1fUID7BV6heiGcdfswP 4fKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1RPQulf4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s138-20020a632c90000000b0044db77667ebsi34986326pgs.3.2022.10.24.06.05.59; Mon, 24 Oct 2022 06:06: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=1RPQulf4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235179AbiJXNFL (ORCPT + 99 others); Mon, 24 Oct 2022 09:05:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234949AbiJXNB5 (ORCPT ); Mon, 24 Oct 2022 09:01: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 7ACB5360B0; Mon, 24 Oct 2022 05:20: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 08E2361252; Mon, 24 Oct 2022 12:19:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18F05C433C1; Mon, 24 Oct 2022 12:19:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613947; bh=4/kpqSPyOkGTlBf5NsgC+YqUfzjRPva5Nu1gW9najIw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1RPQulf4Ckb9JG8ExoyYhYsOyevlcHlV5l7eqxKT9Ldb3PUakMh9XMbJSkcnU/Rdm kw15lR+b/3MzaQv6M3TalbTIaxy7qAP5jieor3FKAvbaQn+o4F5JeE1wLGhErTUHSs tC5EPtkRKfh65IomXKeTgAJ7/9odzQnHR4aI+Z7c= 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.10 074/390] ring-buffer: Have the shortest_full queue be the shortest not longest Date: Mon, 24 Oct 2022 13:27:51 +0200 Message-Id: <20221024113025.760158677@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574360519880905?= X-GMAIL-MSGID: =?utf-8?q?1747574360519880905?= 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 @@ -888,7 +888,7 @@ int ring_buffer_wait(struct trace_buffer nr_pages = cpu_buffer->nr_pages; dirty = ring_buffer_nr_dirty_pages(buffer, cpu); if (!cpu_buffer->shortest_full || - cpu_buffer->shortest_full < full) + cpu_buffer->shortest_full > full) cpu_buffer->shortest_full = full; raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags); if (!pagebusy && From patchwork Mon Oct 24 11:27:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9026 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441643wru; Mon, 24 Oct 2022 06:06:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6dY3BIwwvqaTL3/VbU3KchPJBGCq3EjYu0SD8JjkRlgOguTlqjlMvwp5Orfj9tS6th3y05 X-Received: by 2002:a65:62c7:0:b0:463:9c67:5fe2 with SMTP id m7-20020a6562c7000000b004639c675fe2mr27971793pgv.443.1666616771524; Mon, 24 Oct 2022 06:06:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616771; cv=none; d=google.com; s=arc-20160816; b=EpKtDY2p1RxnEYY8rZ6oKHNLHXO+NkrwashUFZ0uvQi0X2pHxaCiGi7fGu+UTh+TY+ 7ElH9iHihcOZS4YwTNZs8mGj+fj9IMMcH3CZcB/8l/kvhLXZBH/ycWRhy6kNHuNZLvTm MP8JykD4/sW+B/DCBxw/6llRfZJ9v+6e2rItQ6mH1tUZAzwSK2s8nJTABrMJJbHn1SjE vPaFSVTEWZr+8ZRs27RRnsXQiVa2x3jWxHBzDyAzdNk/FlVFZjWfa8eHzq6z6DEUlaOE a+hlkMvOWO7/1BepTGSmYVwPj4mQ61SKOcPcJkVZ/vTKwLALqOwpAHN/gSKmtNNDR30W DJPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oU7nyBJPJ0Kvenl8tqnNJVBAw7ziBxJRuRWMs+zWN68=; b=KgX3XiDxaKciz2yLTrCQ8tgCTgcfAjSVdhOC8knlrxc67KCYCcOzUQzsKEzKwE+Cmr MoknukI+wVlBWjb5mOwf/j1Xzu0Icw8UBhdb9SqO+aH5nr1MmjQjODqs/a/Lc3GMpkt7 LcDqdGNyyAqvG0+BvnFotB+jZTK4g7RaC1kd6Z/3+59lO8vluzEqfFuVfM28Xwx7Mmm5 t88XuD3Q0aRU+eRW/o0XaQx5FzsImnHLTIXUNb26HoBgsPvTmJUX6BIxQUShFJnYA8ez pCUonDORJ2b04G4Czw340/LI5EoBJv37mHJWRRhCqL2GR6o1y+rwsqqJ9CcV2Xs+1/sZ aLYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DX+A5a5U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a6381c2000000b00434bfa4c2d7si1407789pgd.317.2022.10.24.06.05.51; Mon, 24 Oct 2022 06:06:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DX+A5a5U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235099AbiJXNFC (ORCPT + 99 others); Mon, 24 Oct 2022 09:05:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235147AbiJXNBr (ORCPT ); Mon, 24 Oct 2022 09:01:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AB403609F; Mon, 24 Oct 2022 05:20: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 9583B6127C; Mon, 24 Oct 2022 12:19:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB136C433C1; Mon, 24 Oct 2022 12:19:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613950; bh=jSUSX011/c+RLBZj1ZDUOWJuC2nRC9752Bn9eWu4wEU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DX+A5a5U9+8EisKrDYkKO/0shrhl+XInDO6tL89HMdyWP3EBA9O+zg6WFsUefX1dy guzJbOnkb6RC2+59V7W1gU/4jkn8qFrzdvGidE63vsO8mA9CuZj2e+6vD34IUD+Oe9 YYSmsAq/nIo9LgklTe7zP8PB7i2LyHqL6WbYBTBc= 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.10 075/390] ring-buffer: Check pending waiters when doing wake ups as well Date: Mon, 24 Oct 2022 13:27:52 +0200 Message-Id: <20221024113025.809508175@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574347771364601?= X-GMAIL-MSGID: =?utf-8?q?1747574347771364601?= 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 @@ -794,8 +794,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:27:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9997 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp615939wru; Mon, 24 Oct 2022 12:27:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4u7qeEYruIj4dS7rumVfem50Woy23AMVnamfwGL9MljId2hY7zbdBv90ZhFTsyUUwqRUPY X-Received: by 2002:a17:906:cc0d:b0:78e:2c06:8e70 with SMTP id ml13-20020a170906cc0d00b0078e2c068e70mr28292961ejb.732.1666639655951; Mon, 24 Oct 2022 12:27:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666639655; cv=none; d=google.com; s=arc-20160816; b=tyhuQplFhqP8dyNftQz4UkwEDfFV3/mDXE6PLOXIHQpvRcU3DaP4wJFfOHoCdwpwtp eLHEc5c3MOeVTPKten9uTLMht82QGXCfiY4VX3SF9KqifaSX3iRni/ags6FiPtCQjvRu mdNwOf8I2LL0auOApIwv4T2aO11fZ8dXZ1RdnFkdsnEwHlsPPkJdE6D7oLwBOMJnWamK LtVP2zu0baym9kOQKilcKf8F3mdL9YegJswKN5azPqpCaCermlMeOKGcmFIVunUgYIkx 2NMFYKuJEyVkutB2bVuh4GQBNn+jUN1e7Gtn7dTZmoDZ83uOGvyB1Qc5IgLqh51k+ufK lAGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/TJKSuJOWF9B9/v5cVmfC9VqNccdQxFkNoy64Rx1hso=; b=DKVW1DPkjtEmsoDXNAv8cy+VIEy4ydIAHuFvGQQGeW4PEFoVYaznzb1DPuJiG/xFDr ntxHv2Qpk2cS8F0TPl1chA89UdLE7qSmJ6QVIinusivaAH14+8PR+gB/f2J4qYI9mH2o NB13E8Yqai6AhF7g8zvlkbcys0gVAZuQNap4CSyGWAytjmNu9NdI6ljVJydX2c7uM8/K IuHS7BA1NcLYfSgibBQejZyVzP0J2URI2kEmEZJut8LodctdzrixVgNFcywWmR80UOrJ 1VdKW16sZF0PYlKMVuDpgVTO5mkGXmu3tNzEcmH6tbWjyA1wDMotOxFaFOc3YruZ1Hq3 G0gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XVMPVI8o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170906391200b007806c141214si537249eje.153.2022.10.24.12.27.11; Mon, 24 Oct 2022 12:27:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XVMPVI8o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232403AbiJXTZa (ORCPT + 99 others); Mon, 24 Oct 2022 15:25:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232082AbiJXTXK (ORCPT ); Mon, 24 Oct 2022 15:23:10 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEB1317FD4C; Mon, 24 Oct 2022 10:57: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 sin.source.kernel.org (Postfix) with ESMTPS id 80BC5CE1366; Mon, 24 Oct 2022 12:19:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7192AC433C1; Mon, 24 Oct 2022 12:19:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613952; bh=Y3eT2xE4uYU2PLlz1rAVKbLGZkqNAWjS8soALy34X1Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XVMPVI8obe3lCWzdsiR/nvFUR/+LREElt2+6QoRGpGlznSg0a00a4cRR+kJQR33Qr uB71FzPyQvaFinPN+2+WQHjx8KQyRe9sjLNsviuJ9xtDmfQmXDT8WCeE19FPIH0c++ QACBTCXdz0ApkT50R3sC1T6bQICbZYUv96DcT/7o= 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.10 076/390] ring-buffer: Add ring_buffer_wake_waiters() Date: Mon, 24 Oct 2022 13:27:53 +0200 Message-Id: <20221024113025.849362575@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747598344267845025?= X-GMAIL-MSGID: =?utf-8?q?1747598344267845025?= From: Steven Rostedt (Google) commit 7e9fbbb1b776d8d7969551565bc246f74ec53b27 upstream. On closing of a file that represents a ring buffer or flushing the file, there may be waiters on the ring buffer that needs to be woken up and exit the ring_buffer_wait() function. Add ring_buffer_wake_waiters() to wake up the waiters on the ring buffer and allow them to exit the wait loop. Link: https://lkml.kernel.org/r/20220928133938.28dc2c27@gandalf.local.home Cc: stable@vger.kernel.org Cc: Ingo Molnar Cc: Andrew Morton Fixes: 15693458c4bc0 ("tracing/ring-buffer: Move poll wake ups into ring buffer code") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- include/linux/ring_buffer.h | 2 +- kernel/trace/ring_buffer.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) --- a/include/linux/ring_buffer.h +++ b/include/linux/ring_buffer.h @@ -100,7 +100,7 @@ __ring_buffer_alloc(unsigned long size, int ring_buffer_wait(struct trace_buffer *buffer, int cpu, int full); __poll_t ring_buffer_poll_wait(struct trace_buffer *buffer, int cpu, struct file *filp, poll_table *poll_table); - +void ring_buffer_wake_waiters(struct trace_buffer *buffer, int cpu); #define RING_BUFFER_ALL_CPUS -1 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -414,6 +414,7 @@ struct rb_irq_work { struct irq_work work; wait_queue_head_t waiters; wait_queue_head_t full_waiters; + long wait_index; bool waiters_pending; bool full_waiters_pending; bool wakeup_full; @@ -802,6 +803,37 @@ static void rb_wake_up_waiters(struct ir } /** + * ring_buffer_wake_waiters - wake up any waiters on this ring buffer + * @buffer: The ring buffer to wake waiters on + * + * In the case of a file that represents a ring buffer is closing, + * it is prudent to wake up any waiters that are on this. + */ +void ring_buffer_wake_waiters(struct trace_buffer *buffer, int cpu) +{ + struct ring_buffer_per_cpu *cpu_buffer; + struct rb_irq_work *rbwork; + + if (cpu == RING_BUFFER_ALL_CPUS) { + + /* Wake up individual ones too. One level recursion */ + for_each_buffer_cpu(buffer, cpu) + ring_buffer_wake_waiters(buffer, cpu); + + rbwork = &buffer->irq_work; + } else { + cpu_buffer = buffer->buffers[cpu]; + rbwork = &cpu_buffer->irq_work; + } + + rbwork->wait_index++; + /* make sure the waiters see the new index */ + smp_wmb(); + + rb_wake_up_waiters(&rbwork->work); +} + +/** * ring_buffer_wait - wait for input to the ring buffer * @buffer: buffer to wait on * @cpu: the cpu buffer to wait on @@ -816,6 +848,7 @@ int ring_buffer_wait(struct trace_buffer struct ring_buffer_per_cpu *cpu_buffer; DEFINE_WAIT(wait); struct rb_irq_work *work; + long wait_index; int ret = 0; /* @@ -834,6 +867,7 @@ int ring_buffer_wait(struct trace_buffer work = &cpu_buffer->irq_work; } + wait_index = READ_ONCE(work->wait_index); while (true) { if (full) @@ -898,6 +932,11 @@ int ring_buffer_wait(struct trace_buffer } schedule(); + + /* Make sure to see the new wait index */ + smp_rmb(); + if (wait_index != work->wait_index) + break; } if (full) From patchwork Mon Oct 24 11:27:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9036 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441998wru; Mon, 24 Oct 2022 06:06:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6M0H3cQACRXgLhDaBgkO1Q66RaQv2lzr0EG7G+KhBU+J9ngZH0nT7c1gjV8QAHUX9fv2FB X-Received: by 2002:a63:1450:0:b0:439:3806:9b91 with SMTP id 16-20020a631450000000b0043938069b91mr28028424pgu.407.1666616807478; Mon, 24 Oct 2022 06:06:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616807; cv=none; d=google.com; s=arc-20160816; b=WyKYhqXBWcR21bs7vOdeA1NQ4dnHL35/B10sKgz2CCvbqmjoIAePHydyG8P1svFC+L 6fy4YvmQ/I5LFULaRVS1bGo80kucxR5TJYdMCoKcUWk17DBBqwXw+v2cDLjRqGSLuX8m 0wSvesH7rpCre9M5Ek3FbfJnTQRq9mhOMjdh2afBNC+fw2mWXov02dtRSoEA17EnnZd6 +60OewydjOt1xaJq3/Rc9FFosh+guZfJh/mPfINIULY8Zf5wQKXXUjJ64qKaPc4YZ5uh QDL74wK1sVpS7QBRk/VzIr7sEGskJrgZrsV2YC9RewBGPNjZBu0eFtJAmHOUJHVrYk6W 5qyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vKXapLpkKFb2mNx55j7co+BWgCa/wgsndGJJDF2sBFo=; b=vZDflk51JTPaP+KYI/GlO8hAiCk8ooUvvGUUTeqnDoiOYxx96n2EfhXB3YC5jd3E09 Cvs+tpSkBBiHVQChVQxmxW86HN93UicFJrf3VZZdDLG/4y914bVMiLHI66qu/yecFJGI Um/jzmvbFrCXGwuLBkim05n555KqCTO+AKz+1QY+j6Bj5Dov5SXEkfcSmnJYP5CFuRG+ rQNgZxyP7qBVqGETKR2pgwhil74Fcoaz2fv1+O3+e6o8A6uEGWbtkqNcbXo+cGoakPIG 9Bn07XtYFrgXVoMr8KQ9saI+k0/kBnf5snGZksr4IYhpTdy4l/WVfvKpE1zQ5AzMjSo6 oxzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iG59MAau; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id na4-20020a17090b4c0400b00200b6023910si11470208pjb.2.2022.10.24.06.06.29; Mon, 24 Oct 2022 06:06: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=iG59MAau; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235315AbiJXNF5 (ORCPT + 99 others); Mon, 24 Oct 2022 09:05:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235191AbiJXNDS (ORCPT ); Mon, 24 Oct 2022 09:03: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 989AD41D09; Mon, 24 Oct 2022 05:20: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 A9B606126B; Mon, 24 Oct 2022 12:19:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC5D0C433C1; Mon, 24 Oct 2022 12:19:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613958; bh=I3y/55kGf2+72u8WCZDiB2aS5Gd6iV9p1fqG9QXkCo0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iG59MAauLzdkXKAXsm5ppqr5DLjXvxdzZZ3ijEkeg4p9vxQh7on7MmxteCoxJW4fm vpbcbStp00ns3zeZy9aBp69UMqbZIzx4ooC1c9UMmmcO9bX6cJjyNKssLTMoE/4rDQ lPsg7CUgN5G3sNaZlapRzF9kzhXI12KZo5nKbcok= 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.10 077/390] ring-buffer: Fix race between reset page and reading page Date: Mon, 24 Oct 2022 13:27:54 +0200 Message-Id: <20221024113025.898078389@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574385465095009?= X-GMAIL-MSGID: =?utf-8?q?1747574385465095009?= 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 @@ -2531,6 +2531,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; @@ -2542,6 +2545,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); @@ -4356,6 +4362,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:27:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9684 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp535669wru; Mon, 24 Oct 2022 09:13:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6mTkls1dMJqJWUivHWlor/SUbBYr5bEDfCijXIvcVSWhXftKs7STBSeLmrIUmq3WDj7MBi X-Received: by 2002:a17:903:11c8:b0:179:de93:bd7e with SMTP id q8-20020a17090311c800b00179de93bd7emr34528290plh.95.1666628001622; Mon, 24 Oct 2022 09:13:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666628001; cv=none; d=google.com; s=arc-20160816; b=PewVSJXdWEsOkSzSV+V9/pNmFFNOrKhAcVH+xIwOuIM5tarU2aVskiwxvzIfgGtGWs ezFmnDalyIwZ97io6IHKrg1flYgrVnOBGz9U9Wefp7Kh8tg0UI1ypzQJqK/+LhiQdZ8y nWpZ+3hbIyyWR6R+8MEBIDcOlgZWMLtwl3tRL30zveVTnERdKtKgjBkH4Aq/UucVLJTb rTS3rzHG81YP7uSYAnjs2S5UNEW1bpeseOa2/saWO6M3ymy4mcb+Rl3MGdlyYYiWQh3c xYRrzFrF8axUwN+BILbS/NDxXwH0SEL3xvRTbRhE5aU1ywKxpJISxXH91brY4pH2303V p8TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+mYj6UGfr7j54DE44Hr7Vt4Kdtpf5JcB+g/GcxJBUOM=; b=PX3fPWvlaOJynov5TFExqqg7fDGO4aLL6nyvz60Qry+bCkcFXQENgKoSayL7p2oru4 lLHSEY+RbwH0Q/HTkMScVVrCphNePi6fIGNCGoUY91gozSdkJWnj/PlyY4OKze2O6bnA hemHeQtakMiqVavsHytpiWVoilxbKHTygzktIsydyEBO458tkyY0Us11zvysUveEqybj IaH8Au1p7yQXjV0kqpb4uL+ITXO8j8oscJ1wS+/ih2mCdZA41Om2O+8uHPVVeTh8LiF/ TN+G2qpmg8DFj63a+hGZAtJHzuX9wp9vq69ZNoaWeB8YIkV7aiuTHhQzvKE4n+LbAYx6 pxiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WKKbbspS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 17-20020a630f51000000b00450200a1087si32646542pgp.61.2022.10.24.09.13.08; Mon, 24 Oct 2022 09:13: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=WKKbbspS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233691AbiJXQMq (ORCPT + 99 others); Mon, 24 Oct 2022 12:12:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232592AbiJXQHD (ORCPT ); Mon, 24 Oct 2022 12:07: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 188925C97E; Mon, 24 Oct 2022 07:58:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 09C01B81640; Mon, 24 Oct 2022 12:19:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61EF0C433C1; Mon, 24 Oct 2022 12:19:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613960; bh=YHlGoIAmAenQP3/GZa8JYaGtlSrrfBGnz47Nyu7CR1M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WKKbbspSP7rcDChSZ/R6qjbx06vE3svapO3IKVXOkmgcyO4Q4hxSTEy37OVUPBSO0 KbxQlfK+G9WQyVTYWew+rOqNW0tdZphIfLh6/m07HHSDdq0ar2l4CkwTlsoDeegjUc FgLkJFxKx5cFZ4MwwoJ0j4i8DdP7dWbFEVvA8PEE= 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.10 078/390] tracing: Disable interrupt or preemption before acquiring arch_spinlock_t Date: Mon, 24 Oct 2022 13:27:55 +0200 Message-Id: <20221024113025.947333118@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747586123513401253?= X-GMAIL-MSGID: =?utf-8?q?1747586123513401253?= From: Waiman Long commit c0a581d7126c0bbc96163276f585fd7b4e4d8d0e upstream. It was found that some tracing functions in kernel/trace/trace.c acquire an arch_spinlock_t with preemption and irqs enabled. An example is the tracing_saved_cmdlines_size_read() function which intermittently causes a "BUG: using smp_processor_id() in preemptible" warning when the LTP read_all_proc test is run. That can be problematic in case preemption happens after acquiring the lock. Add the necessary preemption or interrupt disabling code in the appropriate places before acquiring an arch_spinlock_t. The convention here is to disable preemption for trace_cmdline_lock and interupt for max_lock. Link: https://lkml.kernel.org/r/20220922145622.1744826-1-longman@redhat.com Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Will Deacon Cc: Boqun Feng Cc: stable@vger.kernel.org Fixes: a35873a0993b ("tracing: Add conditional snapshot") Fixes: 939c7a4f04fc ("tracing: Introduce saved_cmdlines_size file") Suggested-by: Steven Rostedt Signed-off-by: Waiman Long Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -1197,12 +1197,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; } @@ -1338,9 +1340,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); @@ -1367,6 +1371,7 @@ int tracing_snapshot_cond_disable(struct { int ret = 0; + local_irq_disable(); arch_spin_lock(&tr->max_lock); if (!tr->cond_snapshot) @@ -1377,6 +1382,7 @@ int tracing_snapshot_cond_disable(struct } arch_spin_unlock(&tr->max_lock); + local_irq_enable(); return ret; } @@ -2198,6 +2204,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]; @@ -2410,7 +2421,11 @@ static int trace_save_cmdline(struct tas * the lock, but we also don't want to spin * nor do we want to disable interrupts, * so if we miss here, then better luck next time. + * + * This is called within the scheduler and wake up, so interrupts + * had better been disabled and run queue lock been held. */ + lockdep_assert_preemption_disabled(); if (!arch_spin_trylock(&trace_cmdline_lock)) return 0; @@ -5470,9 +5485,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); } @@ -5497,10 +5514,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; @@ -5953,10 +5972,12 @@ int tracing_set_tracer(struct trace_arra #ifdef CONFIG_TRACER_SNAPSHOT if (t->use_max_tr) { + local_irq_disable(); arch_spin_lock(&tr->max_lock); if (tr->cond_snapshot) ret = -EBUSY; arch_spin_unlock(&tr->max_lock); + local_irq_enable(); if (ret) goto out; } @@ -7030,10 +7051,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:27:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9041 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp442178wru; Mon, 24 Oct 2022 06:07:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7fqG+nSqnIppeCwld24FCReGkxNklWnrubGun4+9ohsZiJ5cJ4U1s8TGio61iEUR6Ok62x X-Received: by 2002:a17:902:9690:b0:17a:4cf:edeb with SMTP id n16-20020a170902969000b0017a04cfedebmr33575848plp.129.1666616823603; Mon, 24 Oct 2022 06:07:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616823; cv=none; d=google.com; s=arc-20160816; b=ZP8PWZHMHlb+URquPs2Es1NdMf8Me8GHI3euluEpx1y7s/AI4FfedBk+SMx0D8fHcY /H1k2yABBU01WMl3o44Gl8BsIZKftCaKESccKtFIYWFNdINLAj6TrH1c43/vHZKAHOpJ yFaxTHEqKTiEhawJ2qRFmnsMS2yobj/Toc6k3yKA95XlCUeC0V+A1YHZtQ+22aawHiyv 8huGjJUXCpoWkyLTyKTCYWcV4mp7/4gsBp8gTTRJlqCwigWtLCLY/RTuhSO88byNYtxi R5PJBIV2Ij1rpC2rTgFt2Pn9k2Rw7kD81bwnCDDXK+Z7b1lK0LIcTEG6KsPwJcKWZ2w/ OveQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YIZJxYFOxsWsM8oU6SrZj7lnzU6tgTkmxibZzChKJt8=; b=RacyzdB626TI8qR5l47tjLf6L3YfQEd5YqyAnhuLpv48JTvZeQW3tTofAQjcs+TCGS YcPwFoiIwPs6g4k0xa5EHuoywUTO8gMZ2kUyDmoQ5Wh8jxUCr+CbtmsiheE79WCE1cIJ 2gSw+V3koSrrfbG6bTNAibT/Y+DxiJV/1usuwhiI55NTKQL82nhjeH5sHKoyJmW2FGpr ns1xAkTc5fSqZJwRpjRLSj30RbgTpnqAVDxlbBl608q8LJFRdfBCHlMOY7Ye36UKFXlI RDwTQYHAPobV81s3L/NxDSr4F6O/InDPi/ie9a29kWt17D7Ka8fdnTUJJBhK/H/eZM5U Viog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uSGRuwF8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nn1-20020a17090b38c100b001fddf1a3380si18453508pjb.109.2022.10.24.06.06.45; Mon, 24 Oct 2022 06:07: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=uSGRuwF8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235292AbiJXNFn (ORCPT + 99 others); Mon, 24 Oct 2022 09:05:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235108AbiJXNC6 (ORCPT ); Mon, 24 Oct 2022 09:02: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 981414152E; Mon, 24 Oct 2022 05:20: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 02BBF612A0; Mon, 24 Oct 2022 12:19:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 169E1C433C1; Mon, 24 Oct 2022 12:19:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613963; bh=Rgjgdw2DC7kp/77ebZizQDTOOM9pa7o69IMwmu0EMHI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uSGRuwF8KJRt8kwHS3wWKNl56WTlRdiXiHSVpEP0JWCCVXk6rUMuiB32sk6IcVBKg aOQpeOvfy3M04lTGwMC1GJW1o/SPw2EnTKhw7Nte1buWrzD9PP9/+g73127K9smjxZ N+NH04rZ1sQJGfWMh/PO/A2o69DG5zy6Y65pS5Gg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mario Limonciello , Mika Westerberg Subject: [PATCH 5.10 079/390] thunderbolt: Explicitly enable lane adapter hotplug events at startup Date: Mon, 24 Oct 2022 13:27:56 +0200 Message-Id: <20221024113025.979475295@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574402116595587?= X-GMAIL-MSGID: =?utf-8?q?1747574402116595587?= From: Mario Limonciello commit 5d2569cb4a65c373896ec0217febdf88739ed295 upstream. Software that has run before the USB4 CM in Linux runs may have disabled hotplug events for a given lane adapter. Other CMs such as that one distributed with Windows 11 will enable hotplug events. Do the same thing in the Linux CM which fixes hotplug events on "AMD Pink Sardine". Cc: stable@vger.kernel.org Signed-off-by: Mario Limonciello Signed-off-by: Mika Westerberg Signed-off-by: Greg Kroah-Hartman --- drivers/thunderbolt/switch.c | 24 ++++++++++++++++++++++++ drivers/thunderbolt/tb.h | 1 + drivers/thunderbolt/tb_regs.h | 1 + drivers/thunderbolt/usb4.c | 20 ++++++++++++++++++++ 4 files changed, 46 insertions(+) --- a/drivers/thunderbolt/switch.c +++ b/drivers/thunderbolt/switch.c @@ -2413,6 +2413,26 @@ void tb_switch_unconfigure_link(struct t tb_lc_unconfigure_port(down); } +static int tb_switch_port_hotplug_enable(struct tb_switch *sw) +{ + struct tb_port *port; + + if (tb_switch_is_icm(sw)) + return 0; + + tb_switch_for_each_port(sw, port) { + int res; + + if (!port->cap_usb4) + continue; + + res = usb4_port_hotplug_enable(port); + if (res) + return res; + } + return 0; +} + /** * tb_switch_add() - Add a switch to the domain * @sw: Switch to add @@ -2480,6 +2500,10 @@ int tb_switch_add(struct tb_switch *sw) return ret; } + ret = tb_switch_port_hotplug_enable(sw); + if (ret) + return ret; + ret = device_add(&sw->dev); if (ret) { dev_err(&sw->dev, "failed to add device: %d\n", ret); --- a/drivers/thunderbolt/tb.h +++ b/drivers/thunderbolt/tb.h @@ -979,6 +979,7 @@ struct tb_port *usb4_switch_map_usb3_dow const struct tb_port *port); int usb4_port_unlock(struct tb_port *port); +int usb4_port_hotplug_enable(struct tb_port *port); int usb4_port_configure(struct tb_port *port); void usb4_port_unconfigure(struct tb_port *port); int usb4_port_configure_xdomain(struct tb_port *port); --- a/drivers/thunderbolt/tb_regs.h +++ b/drivers/thunderbolt/tb_regs.h @@ -285,6 +285,7 @@ struct tb_regs_port_header { #define ADP_CS_5 0x05 #define ADP_CS_5_LCA_MASK GENMASK(28, 22) #define ADP_CS_5_LCA_SHIFT 22 +#define ADP_CS_5_DHP BIT(31) /* TMU adapter registers */ #define TMU_ADP_CS_3 0x03 --- a/drivers/thunderbolt/usb4.c +++ b/drivers/thunderbolt/usb4.c @@ -854,6 +854,26 @@ int usb4_port_unlock(struct tb_port *por return tb_port_write(port, &val, TB_CFG_PORT, ADP_CS_4, 1); } +/** + * usb4_port_hotplug_enable() - Enables hotplug for a port + * @port: USB4 port to operate on + * + * Enables hot plug events on a given port. This is only intended + * to be used on lane, DP-IN, and DP-OUT adapters. + */ +int usb4_port_hotplug_enable(struct tb_port *port) +{ + int ret; + u32 val; + + ret = tb_port_read(port, &val, TB_CFG_PORT, ADP_CS_5, 1); + if (ret) + return ret; + + val &= ~ADP_CS_5_DHP; + return tb_port_write(port, &val, TB_CFG_PORT, ADP_CS_5, 1); +} + static int usb4_port_set_configured(struct tb_port *port, bool configured) { int ret; From patchwork Mon Oct 24 11:27:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9668 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp534903wru; Mon, 24 Oct 2022 09:12:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM79eunVM+AAtqYQtJbtM8cVrzqJrK/nyLqXXylF1IKec3wKhGwALZ4wUEyiP4zl8afy9XBW X-Received: by 2002:a17:902:b092:b0:17b:833e:74f7 with SMTP id p18-20020a170902b09200b0017b833e74f7mr33746209plr.149.1666627921217; Mon, 24 Oct 2022 09:12:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627921; cv=none; d=google.com; s=arc-20160816; b=dXFRVtpmmK6a33D+9x0m2LiGq52boqNJ9GMw/HZ8k1q+vADy4Qj/To4bTYtQ6IYx4G vlEFsqDydD6WrXkj9ojlwzW9jPzG40YQTsacAAqjMVgLXLCujXnur2Cg8g8HICsD4COz wEqt8DwJwfRCf4KvBBPJRX0juYg7IB3Mx0z0497SkP5OvrlIrQl06R4pxOgOzOATIhiu 299dY75xqAcb+osh04LKm1jF6AMIiEynBxzW95i1C523dtcmjfBqrh9v0AKCMZzQgoer anCP5Vh/B79yPCWSAsy8QEKrM8DzE8NVLDzlgPnEsBYsbCv+7wU42iQpzEaHmxB/cj8T iZbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=g0kx5KQFSJx2cxZRV5cBgqYgy2f3xnBe7gG1Nlhe3lQ=; b=ZGz3frxGUfrQ0nbzlJp1i3fGmKOsKxje2F0ikL4+FG0oRB1Cb7V2/SMd6mGGerNyth hWEXQdAe7KB1vV5YXQN/ijkHLdx1kmMz/gf2ZIwW6TJ70Koc5mhaw+yJ4QndpnO/TEan TtvyKj3DKLA9k6zbHEB//vGenu3xOfSk8ia6VWdqJjnfRmSvIELcMAL/pLeMmvWwyC/t uyWq0Dd4+u/Z4eNZK5J22bGouxlrZhE2+CxvS4Fzsd69vNT1syLG8YR98IGCh4aomuwf ylIgZDhHSYDnpX1Fs8Iiek4+oeeGKBCUWqrlWOHXRTFlqqO+3ZfinNj82hZkN8MvBbqs K02Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DBMCRuHL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902ac8700b001868a25da0dsi8529102plr.40.2022.10.24.09.11.47; Mon, 24 Oct 2022 09:12:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DBMCRuHL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233102AbiJXQLG (ORCPT + 99 others); Mon, 24 Oct 2022 12:11:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233839AbiJXQFC (ORCPT ); Mon, 24 Oct 2022 12:05: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 89AF211E472; Mon, 24 Oct 2022 07:57:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4F92CB81658; Mon, 24 Oct 2022 12:21:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A588BC433D6; Mon, 24 Oct 2022 12:21:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614069; bh=7drasZaXyRBxiatrZXSHUCbArSVbNrOy1uqnbBkzW9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DBMCRuHLTuNvSWVk+0onFKSQcMf/rYxtW/hvdSoj7cnDmftN0cSSvJ2uj97MRrDss R1//qsZ5+JeQQIiDhGgoWNW6EFTtalEpMi5DCyPurObgDP7Ax+Y/oZvjRzUX/5s+0n cllcHb2gvDdChsjLhdSy5+ZdYWkrxkQz0OisP9h8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ard Biesheuvel Subject: [PATCH 5.10 080/390] efi: libstub: drop pointless get_memory_map() call Date: Mon, 24 Oct 2022 13:27:57 +0200 Message-Id: <20221024113026.018659861@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747586039250156775?= X-GMAIL-MSGID: =?utf-8?q?1747586039250156775?= 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 @@ -281,14 +281,6 @@ efi_status_t allocate_new_fdt_and_exit_b goto fail; } - /* - * Now that we have done our final memory allocation (and free) - * we can get the memory map key needed for exit_boot_services(). - */ - status = efi_get_memory_map(&map); - if (status != EFI_SUCCESS) - goto fail_free_new_fdt; - status = update_fdt((void *)fdt_addr, fdt_size, (void *)*new_fdt_addr, MAX_FDT_SIZE, cmdline_ptr, initrd_addr, initrd_size); From patchwork Mon Oct 24 11:27:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9669 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp534946wru; Mon, 24 Oct 2022 09:12:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM79wIeRuFHMbgyzuKkvc1nSeAsj2O46CmCBYBBXSTHuEsZFKmDqEQLvV7Al5pVHgYD7W3Dt X-Received: by 2002:a17:90b:1c82:b0:1ee:eb41:b141 with SMTP id oo2-20020a17090b1c8200b001eeeb41b141mr40663297pjb.143.1666627926400; Mon, 24 Oct 2022 09:12:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627926; cv=none; d=google.com; s=arc-20160816; b=QO1rYu9wo6zzKWW9vL2VdNM4faZjMXCXUCnHKDm+SOA4+lBls/GnXdeaMZg/MrvOgD 1kxSRndtoKVlGlWsVFqnvRKQNPsYSDtgG8dqDjrimOC0+wMOGt0bnvQqt4J4CteN5gMH ZvkYTCd7FDE1Qg7WSTyV2yNomgFkI8KjWhKLMOsWViSlr1udkYs5EzZ0YZ88nCR/GYHt +ak8HbeABvyns/hdRpry9eBhbH0l+/mSn2/2BWFJiI+zggsSKPmA4l79M7loQPpnn8e5 MDp4C+0gdqzPg+zjNOpyVITJcHIEqCs24+MPGNHvz+HdYgpNPOmbOJxQnnay2AckKCeC g3qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=s+zfwSn/Qv1etNEHoGqgi1JPj2GjbHvlDzWrqsLI/Fg=; b=jVCB8vrpHh+l200f/FsnZ7QoebxqwBVx1uApdXaC58CcNeSDv4mn6ZMz8HyLeN4SlA B2+bWAZ+fBtLHKxpWP0xRYK7OPexQcCQwVFefLal9pe35i4EXLr4rVP7q8W+XSnszgVr 0UAuUb8dgd62ThWo3l0OvB5d2k5VgGEzbyiRL/fZ71255RLYxZRVGu4z3tIkQKgya9++ BLoaz2NGGDPi+re7EBkaeQOTR/A2MNkcvxsHd+sg8lYidnaB9Sz+2wBWxj4+rW6Bo4j+ DQ9fgFnF6OXKGpYUYgL93X8vUjmjAACjCblY6De5Ma5Apz49zlylfCHv7ZKwuw6NoOGR iPrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BMcGcqvx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j190-20020a6380c7000000b0046ecd36adbasi10335023pgd.635.2022.10.24.09.11.52; Mon, 24 Oct 2022 09:12:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BMcGcqvx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233524AbiJXQLS (ORCPT + 99 others); Mon, 24 Oct 2022 12:11:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233881AbiJXQFJ (ORCPT ); Mon, 24 Oct 2022 12:05:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C7D621275; Mon, 24 Oct 2022 07:57:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3580FB8163D; Mon, 24 Oct 2022 12:19:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 896E8C433D6; Mon, 24 Oct 2022 12:19:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613984; bh=yQxYSUD1p+TOWduy77WsLk9SCj0jFWYR+4HO5HkbBW4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BMcGcqvxRjJxya4MgpWyfHZynGFeM7hwhB9fQ4Q2ymsbpRFGmWqDWtd4yK9B6yqjz VbkBbjbGHbieCviW69P9KL3DTGfgwreD8q0BfBXE3WKaDYj3laq35ccWF3hB3kUJWz 51yf5VsS8cTu38Z1d4oDx01TgkBBDgm/NlMyZaYU= 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.10 081/390] media: cedrus: Set the platform driver data earlier Date: Mon, 24 Oct 2022 13:27:58 +0200 Message-Id: <20221024113026.064484686@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747586044345897158?= X-GMAIL-MSGID: =?utf-8?q?1747586044345897158?= 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 @@ -399,6 +399,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; @@ -469,8 +471,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:27:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9414 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp478608wru; Mon, 24 Oct 2022 07:17:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5bAJurri8Z2EmsJJEpGGRmAfn0n+uMpg28tCIkKP8J6pyAaSi7XnSbiwqde8mmN7ldEX/z X-Received: by 2002:aa7:cb87:0:b0:43b:e650:6036 with SMTP id r7-20020aa7cb87000000b0043be6506036mr31537428edt.350.1666621058628; Mon, 24 Oct 2022 07:17:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621058; cv=none; d=google.com; s=arc-20160816; b=nBLbKb20TQtKdCoxBoBTCJhUevGehgJn+ZFQbJPM0ZOrG1211qYc8U4su+A25rfTFw 7JouMXy7SMrnLImArnro9GO0DvqUSHAjZDwu1uNCv0zXimgFqV8Ejs7cq5mhebw1fRz0 6GmGlb3riOK3PyLc+cbE8quctZPaM9sIu8rF0M2/YA83338txKzfptLeXsQx9t5gYx2C olZy4Qd2qz/qLAx48h5v7R288GnXWJnrgE6TxE+s3fJJvL2oEiy/lILgUymIt4pUh1OH M2wNM0ifwZSbUVoTkR7Qkn8NFQ25GtJDseTuJM5NXvCFRc4X1sLAXkeL9RKVE8hiTYdn iABQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=D8zlEWEDdmNAdxIkH1Bh0nK4p5rnnuxWCw/oFGKwAN0=; b=DpEl9tZbl/sOwFp/PTrs6C6V6CFePFOhwUVP6Z9LZ5vZnVR5zG0k/4R9HQfeWxTmeg HB/fwMUWB7Lk3l244iLY08BBpDmqd+D5aTHp7aBZzQIkfue6YyAju15oyd3D7+eQt/d8 dEQdGjHqu0MrQRyfMSju94lRVCwcBHuzLdt6AwEwKC8Qb2Xxh8pV5pN2gx72JwlMwhVY vQr2Xtkhn6VJCD5S8b14/ut4jhNlfZFfnyeSAOYs+iYxb3bpKC97Uew7RrcOvdxYEQEv LPY8lP4RVDNSDtYCd6EHw0fpvsGada+V5LIRbtTjx3knt/e7nyzIx126CPa0u7RfbyNN ucDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v0UWxV8C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa43-20020a17090786ab00b00782ece08669si28777090ejc.13.2022.10.24.07.17.13; Mon, 24 Oct 2022 07:17: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=v0UWxV8C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236631AbiJXN5t (ORCPT + 99 others); Mon, 24 Oct 2022 09:57:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233393AbiJXN52 (ORCPT ); Mon, 24 Oct 2022 09:57:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F9E754181; Mon, 24 Oct 2022 05:45: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 77339612A4; Mon, 24 Oct 2022 12:20:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84A3CC433C1; Mon, 24 Oct 2022 12:20:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614013; bh=AEDN9xuNlbHo/e5IAl0M+CHnwhGvTQQAttrpcw65NuQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v0UWxV8Cx6I5E2mMOj1nPEBHZS69QDf14bAs0kiDv9BtP3o95wDNRI6EKpTOlQ/uV qwXRzY34eyiN7ZEQdNBRRc+wNN4i3TDma6c9aHRRh/9ec9jJVHcKxt1J3k9GvrTp4Q hIDWmuHEAC+4RqNfXH8HFu5JqLWUXPp1x/kJIlsU= 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.10 082/390] KVM: x86/emulator: Fix handing of POP SS to correctly set interruptibility Date: Mon, 24 Oct 2022 13:27:59 +0200 Message-Id: <20221024113026.102951946@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747578843466900874?= X-GMAIL-MSGID: =?utf-8?q?1747578843466900874?= 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 @@ -2039,7 +2039,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:28:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9683 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp535657wru; Mon, 24 Oct 2022 09:13:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7wSWZ9Dltfx9wHit/DVXtPctcT+kmoWXYCKj9hiMb1r3T0JFLuGIUfLUHM7FcPh3O5JBbn X-Received: by 2002:a17:90b:4c4f:b0:20d:4f5d:6b7c with SMTP id np15-20020a17090b4c4f00b0020d4f5d6b7cmr75803455pjb.77.1666628000348; Mon, 24 Oct 2022 09:13:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666628000; cv=none; d=google.com; s=arc-20160816; b=WCKW5WJTHlFnpXHt1u/ORHn+I3KgQCieQiI3Uwe9r9ztPlfEb3BVkuJrVqSFjGbAsL sCAZZUMGLBCULkaI71geacbaXBysy6EAfiiV3mf/JIxsfotnv32MFaPiHn01XOgCq+mX oMEITdGBpR1v4sZcjr2+zXS8mJFCr11KV+6PFRBvOrZqshjOogaEod9sGb66H+Tkucst QI4iIdwYAPcHvDby1w0FkYZhC7sCMQVb9v7TNHarlfr8EadyqwwxYslkSjIxTC74Qj9m 47D1rz4Mz5bMjEQWiySsLsKYiQOIzKBZsrHvPmJhQvp3ZUjtAeiVIn3xGVbtDSO4YPcW U8Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XquGB7ztmj1GrtE7HZsYGBL70p6hz5x3qyHAJLyOtK0=; b=J7HCjqZK6ccMEIqPJ+wLAV8l1SItoIIO6fHO4Ynkpc5cKOTYhwT4Ry1f4yP4ZKbs/s FIOpiBTIeqN6AglZCLLUjFHKMqzS2whQJMiKHqEEaHHWcguz6XGRBs+uaJC4ppOMVpdt FSmQlOJEygarwbtzLQMJms8b9+SbCLJgpZdx6xaiwwpePuxOuZt8LorrYZVkru62FeFY 3UR2uHD9z9oC1+yqsfQFfzHGcoXQR0rba41W1gMIqBP42/l2DsNQa0vik1E6IAGpqVDs Kb8vcArdbPlVmBga0Pbxf1vc5Jfy74IoUkPz3qzGsG9hrzd3kDGjKq+ui7qg7JpMGjZi hidw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ENj87vOC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 186-20020a6301c3000000b0043c474c8942si35355229pgb.673.2022.10.24.09.13.06; Mon, 24 Oct 2022 09:13: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=ENj87vOC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233791AbiJXQMl (ORCPT + 99 others); Mon, 24 Oct 2022 12:12:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232233AbiJXQGn (ORCPT ); Mon, 24 Oct 2022 12:06: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 F37AC9411C; Mon, 24 Oct 2022 07:58:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 06EC3B8164C; Mon, 24 Oct 2022 12:20:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5AA08C433D6; Mon, 24 Oct 2022 12:20:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614042; bh=oQk4boIzQr0mKRH6Myy62e23A9F+E219r+zhxeCBOcM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ENj87vOChg0wLIQUf8t8qM9lr/LvNOuqmoWmmu0b4YLOLDjF6DcyF8jCMdMcFEYz8 lXXNNgnNhQDJk5RK2u64kvhYMHYoPePH56bFCOrD2vqPA3P5LtVAzOdH1AaPuaRbVF a2hhKq4BAUR9301ZgnGAmYD+BBtl3Wl64XpMs7SY= 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.10 083/390] KVM: nVMX: Unconditionally purge queued/injected events on nested "exit" Date: Mon, 24 Oct 2022 13:28:00 +0200 Message-Id: <20221024113026.150551408@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747586122299340157?= X-GMAIL-MSGID: =?utf-8?q?1747586122299340157?= 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 @@ -4183,14 +4183,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); } /* @@ -4530,6 +4522,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:28:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9663 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp534580wru; Mon, 24 Oct 2022 09:11:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6I9ZxO4lulGPdVB1bpPKmkT/7DcJ9QvfuHIeGISEKCdinOO9KwWXCta4DHPFqNRDKhfUhm X-Received: by 2002:a17:902:f710:b0:178:a692:b1f7 with SMTP id h16-20020a170902f71000b00178a692b1f7mr34395667plo.112.1666627869882; Mon, 24 Oct 2022 09:11:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627869; cv=none; d=google.com; s=arc-20160816; b=mV2g7Yx0pGlZ4LEv711EwY5zJ5KmtQUt0K60vf1gfbG4QK06riIopq07oQ/sBMcOf2 NzAAnmFzgRAkA/lUsqAdptJCJO+xUXG9bfKzTmDLupZ4SxkiYjFQmHwyv7XRn/okR3G4 cRH6SregKP/RbmwlVGWxiJA3TDG8ffzP55LTp/le3lMedmZf9Dc6FrX2oQDUDMvfziA3 pHs6l02CFByfC0dQsRk6if9UwRrn0PH1ybwhspsxh2+pTTTXhKZjqGfNV8DtRVreVyC7 QhL2YoH9uz1Q2Ut9pnRrqFUWcTVqIYIVsS3igWxpNHnC7MwzEj/JtcSssGVfcbzPw9G1 uHOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0WIx5pK4C+Qu5a75B83oR5EPO/shrBAGzTizzCKeQdU=; b=q9byObOsliafG3fG/GCO5yUTpIoCQfsnzooL0WV6u4Fry8uN//2h1Lfh4ud7qLDrJK mU4KyyF01Xcz6yMKrMq066VDH+OdqAw8rAj0btVJ0q5j8IAjAFxeQPqS6Nqdd3VaDQsx zlvdIINKHE+vVnmdkWwCKrdK0SQkfFyR2HR5F4awK01NZtv7Gf5+NVF60s1dEglTs6x7 P/mWobzTw2tfIaTbNtWKj7yY5R+AzbINJ7o/BHlq4Mw9yTBRYb9lZhNEjqmHab81NXia SU6GHAY0Gyax+VfydCUlTHtuX/fhfUw2tOYXav3N6jydFsqzY4WkVzbRbFnOfZBqFNgo QxOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Pan2IMCh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h189-20020a6383c6000000b0046ef67cb979si5554740pge.82.2022.10.24.09.10.55; Mon, 24 Oct 2022 09:11: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=Pan2IMCh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233603AbiJXQJE (ORCPT + 99 others); Mon, 24 Oct 2022 12:09:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233609AbiJXQEu (ORCPT ); Mon, 24 Oct 2022 12:04: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 6173F11E47D; Mon, 24 Oct 2022 07:57:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7B423B8149C; Mon, 24 Oct 2022 12:20:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5389C4347C; Mon, 24 Oct 2022 12:20:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614053; bh=BCxFshy9jgZajd0Dv3BRZtJX69rjxlktrDgUo09c0OU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pan2IMChyz0l5MhOmQQ365N7lMvMSX1jUW7fpbi6NhYmmyPGehrLoREHi6E4bOlFQ WAu6CYhvJclahEUMDYwwL9qGWmKGc02iMIKsW9jSJ4WT/dU4B7WqcC+8a+CEFiJDnH F1N/phjsvrbGDozutcYPp8/BvFGBi8GPa/++y5LM= 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.10 084/390] KVM: VMX: Drop bits 31:16 when shoving exception error code into VMCS Date: Mon, 24 Oct 2022 13:28:01 +0200 Message-Id: <20221024113026.186431777@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585985447336077?= X-GMAIL-MSGID: =?utf-8?q?1747585985447336077?= 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 @@ -3776,7 +3776,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 @@ -1737,7 +1737,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:28: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: 9081 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp445529wru; Mon, 24 Oct 2022 06:12:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6QrcZCTbILuxQ2luNFszhwmewyB9UwNLgiwmD6G6z68xUG+EP6ac1gOEeHmXY1B0ld9N2J X-Received: by 2002:a17:902:778f:b0:17f:8347:ff83 with SMTP id o15-20020a170902778f00b0017f8347ff83mr32956323pll.146.1666617165479; Mon, 24 Oct 2022 06:12:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617165; cv=none; d=google.com; s=arc-20160816; b=VRJrIfOwcVf6dGuiF8heu+fclqLZUNKOpZjC9Z2DRM2ccN+0QJI7ZnWLx3tV9kdNXR KsVDsx/LoOvMVDKD843coKorNxg3I7KKbCoM1JYebLwp4t5BS5w6FAemH6e1uTvc0d1f 7sRRp2c94hz84icVi1YjLMHlqgxaz1o6k594rQ/uFeo05cdVgsvDm1vzkTmXAugOkC56 +pIQI6WdsGNrVIL2BBVRpw2M4hsu6kkTVF1pvPnCMwyv9c6jPqGb1pG+tU2HH+1Sksbw +hKLwotT3f2VyR/6ClQts0NvcN8tWiDF8TdC5qJrm+f4deCC+05Ghb1nPNIkhx4pbBSH HNZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=K/uOf0SUzijjEeSOOrVTXr5R6N7cfa3tA6My4fiILe0=; b=X+5KBwWwGP6oU/vU5kZFyr+I9InGTveetUua7z3Mz7S8Ai/NWPGjS1jVwZxGP//s1F 5DAkmTcfga/giI2GPdtbKpd8yhNOBxwo+WsbCTiZgVZJsr/2iX2H/Cvy8RHmxvbhPNsX g56J88OYhtOFNo1tQ7Q/fKtAHTr2t5GnC/nshwG9PDJC5rVjdT8V+SXCO23k8iphQNqG azBnBwUhjNBvuk7Nk1Wr409pXIyC4My/jziuKYhX9n4xuJJMjE3mGoNNoZaKKaC7OL1C vUcRbT+kPrHpJyubxMcXY2I59sSQ1QLPnPUzvpbso5n4cZYMUQga1rAPUZ3m308cH/OJ FD7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MiPBXoMo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i71-20020a63874a000000b0046ebe02836fsi11342827pge.504.2022.10.24.06.12.31; Mon, 24 Oct 2022 06:12: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=MiPBXoMo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235661AbiJXNMH (ORCPT + 99 others); Mon, 24 Oct 2022 09:12:07 -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 S235869AbiJXNJx (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 8F3E9A220F; Mon, 24 Oct 2022 05:23: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 631E061017; Mon, 24 Oct 2022 12:20:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 718DBC433D7; Mon, 24 Oct 2022 12:20:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614055; bh=yMjsvMrwdteaqkm298N96x25owWkPZMp9jiYpvA0zcQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MiPBXoMoKD4JtR7suqU09PV9J6dqFXx+l+o93b9emNnK6AmmifgORPxmYmhhlJgni Bh56M+4VRIeOxhq4y/U9ZQUFNqM3NaI4pdHBfkVsJH7ALoCWs+RWjqlNG0ghZMC/Wn ONte77Cxj9jvV2MNn9mELngqOvk4hqmJLou/JCL8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Alex Elder , stable Subject: [PATCH 5.10 085/390] staging: greybus: audio_helper: remove unused and wrong debugfs usage Date: Mon, 24 Oct 2022 13:28:02 +0200 Message-Id: <20221024113026.227109380@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574760781360876?= X-GMAIL-MSGID: =?utf-8?q?1747574760781360876?= From: Greg Kroah-Hartman commit d517cdeb904ddc0cbebcc959d43596426cac40b0 upstream. In the greybus audio_helper code, the debugfs file for the dapm has the potential to be removed and memory will be leaked. There is also the very real potential for this code to remove ALL debugfs entries from the system, and it seems like this is what will really happen if this code ever runs. This all is very wrong as the greybus audio driver did not create this debugfs file, the sound core did and controls the lifespan of it. So remove all of the debugfs logic from the audio_helper code as there's no way it could be correct. If this really is needed, it can come back with a fixup for the incorrect usage of the debugfs_lookup() call which is what caused this to be noticed at all. Cc: Johan Hovold Cc: Alex Elder Cc: Greg Kroah-Hartman Cc: stable Link: https://lore.kernel.org/r/20220902143715.320500-1-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/audio_helper.c | 11 ----------- 1 file changed, 11 deletions(-) --- a/drivers/staging/greybus/audio_helper.c +++ b/drivers/staging/greybus/audio_helper.c @@ -3,7 +3,6 @@ * Greybus Audio Sound SoC helper APIs */ -#include #include #include #include @@ -116,10 +115,6 @@ int gbaudio_dapm_free_controls(struct sn { int i; struct snd_soc_dapm_widget *w, *next_w; -#ifdef CONFIG_DEBUG_FS - struct dentry *parent = dapm->debugfs_dapm; - struct dentry *debugfs_w = NULL; -#endif mutex_lock(&dapm->card->dapm_mutex); for (i = 0; i < num; i++) { @@ -139,12 +134,6 @@ int gbaudio_dapm_free_controls(struct sn continue; } widget++; -#ifdef CONFIG_DEBUG_FS - if (!parent) - debugfs_w = debugfs_lookup(w->name, parent); - debugfs_remove(debugfs_w); - debugfs_w = NULL; -#endif gbaudio_dapm_free_widget(w); } mutex_unlock(&dapm->card->dapm_mutex); From patchwork Mon Oct 24 11:28:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9186 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458449wru; Mon, 24 Oct 2022 06:37:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Sj9yB6/1gztC1KeHZ/nAck7KQSs8ZLOrIex6a/WxVnoIIyVYFv296QiZl5Bk0LzMGFti4 X-Received: by 2002:a05:6402:4446:b0:457:eebd:fe52 with SMTP id o6-20020a056402444600b00457eebdfe52mr30463958edb.234.1666618655944; Mon, 24 Oct 2022 06:37:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618655; cv=none; d=google.com; s=arc-20160816; b=QbaUyEGrEQQwxvTbOizELbnbhYVbEABm0iQPkCXmaHf1P9eSi5f1A1vARD59msajeF RtpC7KpWjXnw++kcu0+C8i8vIhgQZRuNVFL9W6EOEt+/ZzFynI4GGRU9mUASLDybmQsd D5It198Hjwm1Lk3DLUsisekZfUNvgl1hrWL2ZAkRv9cXX52ovT4+cxx+NUbiJA1qYUiy twZ4SgSvMvjz462PaEaf1K9Br+4vCR43zp7e9Bq7xth2TSROMOLft7rbeElGKyKKq8SC ULXXkZeTkTI6fmKc0NX2ElkHl//RSaKCEZx6BnQh5qddUB07ggF8vmTVFzhQVAvyCnk3 7vkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RDvm04YhO3Iz0Ztma9S3rSoo4sdkGW5mWpMUwAAZtP8=; b=xZCMqW6sGnXwDGsom3f9I78iGK+xqQa6ReHyB2soXiFsLYgzHK2CbO2t8R3YS6Hzat 5i6DDZazynu500o5X43u8CS2fykttypyxQgTMi2uq1OyhEuAFwHdMu7xtT9p0wYkwZvG JQiUP0ACzaZHZajJAJ91A8NduUqPJGK+r/gWQuMHAFN4vkWR5NfYhluN5+xdOUJPD3KS M7U4fnAaXrulN6fsXNe/I18eiTvi88VH/TyjVZjocPuhkyN/muzRufSlPLWHWOIwBedy ftlHyQxVVtm3n26+GnNe5glscN9Tnulkqr4QDVRB00wawYnCOFEW6gUfYQ4vWpIezozV xHeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nJRbICKp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z2-20020a056402274200b0045cf3f51a34si32814344edd.24.2022.10.24.06.37.03; Mon, 24 Oct 2022 06:37: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=nJRbICKp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232706AbiJXNcG (ORCPT + 99 others); Mon, 24 Oct 2022 09:32:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235949AbiJXN3K (ORCPT ); Mon, 24 Oct 2022 09:29: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 0CC81ABD55; Mon, 24 Oct 2022 05:32:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0715E6129B; Mon, 24 Oct 2022 12:20:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 183B8C433C1; Mon, 24 Oct 2022 12:20:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614058; bh=ttjB1SlCZ5M3JOhhGTJWbx96VkemfaVc5WhLA3e0RMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nJRbICKpaqXHFfMgtK8ztBBAXnFK9yA6v7v9GXlf+FpZlWWUSZOIN2zb0CEDqUJbW LfhohFWDKSe+WBpnQRies87+kT5X4706ivh+keX8eA68DwWPwkGYuwDJCsdzwNJVoM PPtGc/bSq+YluHjvmrftABwGYZWyqq/9IJPbuEgw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lyude Paul , Karol Herbst Subject: [PATCH 5.10 086/390] drm/nouveau/kms/nv140-: Disable interlacing Date: Mon, 24 Oct 2022 13:28:03 +0200 Message-Id: <20221024113026.275222128@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576323621086637?= X-GMAIL-MSGID: =?utf-8?q?1747576323621086637?= From: Lyude Paul commit 8ba9249396bef37cb68be9e8dee7847f1737db9d upstream. As it turns out: while Nvidia does actually have interlacing knobs on their GPU still pretty much no current GPUs since Volta actually support it. Trying interlacing on these GPUs will result in NVDisplay being quite unhappy like so: nouveau 0000:1f:00.0: disp: chid 0 stat 00004802 reason 4 [INVALID_ARG] mthd 2008 data 00000001 code 00080000 nouveau 0000:1f:00.0: disp: chid 0 stat 10005080 reason 5 [INVALID_STATE] mthd 0200 data 00000001 code 00000001 So let's fix this by following the same behavior Nvidia's driver does and disable interlacing entirely. Signed-off-by: Lyude Paul Cc: stable@vger.kernel.org Reviewed-by: Karol Herbst Link: https://patchwork.freedesktop.org/patch/msgid/20220816180436.156310-1-lyude@redhat.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/nouveau/nouveau_connector.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c @@ -500,7 +500,8 @@ nouveau_connector_set_encoder(struct drm connector->interlace_allowed = nv_encoder->caps.dp_interlace; else - connector->interlace_allowed = true; + connector->interlace_allowed = + drm->client.device.info.family < NV_DEVICE_INFO_V0_VOLTA; connector->doublescan_allowed = true; } else if (nv_encoder->dcb->type == DCB_OUTPUT_LVDS || From patchwork Mon Oct 24 11:28:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10229 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp642978wru; Mon, 24 Oct 2022 13:40:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4nOMqP2FWE74310CE2JNE0mw+oKcdYpRrbcMZMbeuQp2iSmri5E4tBAWiTGR/4rGQGfmRy X-Received: by 2002:a05:6402:440f:b0:435:2e63:aca9 with SMTP id y15-20020a056402440f00b004352e63aca9mr31539419eda.162.1666643918987; 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=wSFZDaidpkz07a4D+Yn9qoGaCHm5VEQRplHkJdJXX80KnieaZ04YoTmGHB2EjcS1km F7TlxMQ0YphRxbp8gES363B1MG6haTHW3qVwFv2T+k2kMeTs/xdkQ3/A0r+/V5jInT9b FqhZXqPORz/im78O3uspQue0aRYDp8A0ZtTYVMgHy7MS2g2TaDmHRQsiIh7ri/zkQ1av YukEHQf2el6vvCYZZ9RiicqIiHeJ3L37U/I+iDZ1T0+bPdaxiWjqg/41XDk20QRSBB01 UDbL3OozP85AqtxTG1mIfBuG+hA2a1WhdbnzxzzqJEmLWLPqovyRYk4muIqhLaD0sKNe rGLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EhEpLBwEPkfop66jDBN5rBKzoJ28+Ssv1y7gIb05C80=; b=iVSIjkCbEI99DpM8R26YLWn5ud9L27CrLA/XQZRkpplfMPqK1YGqzdPTfxevXVsBBh vzpN3vsTpK3Ee1f6GYNrAlB9/RK4Kr5tTzFDh5P0uL4lzNHSjEi+WkTOEF7Z3l5w+q9C EpgtZTBgFjfXO1NhdJY71YWET/iJ3p6+kGFYnnTrfdQvWfawTVVpjKAJLWwhrMQQSowl K3qqgm19RR8LXc/yC+cmpI80YgZS/kv1h1s6/lx+F6wg9MAEniboF3VI9mx4wRKcn+7H OR8mrNjVd+FMC2tuaZZH0N/n0dCztiVQSIZNhvNyat4nqUTwBFqinVgrBPrmd/9x5Ixx 8QNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ENc/ghuX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y9-20020a056402358900b00458d1c48708si816576edc.303.2022.10.24.13.38.10; 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="ENc/ghuX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234398AbiJXUgp (ORCPT + 99 others); Mon, 24 Oct 2022 16:36:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232285AbiJXUgO (ORCPT ); Mon, 24 Oct 2022 16:36:14 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51EFD11A94C; Mon, 24 Oct 2022 11:47: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 sin.source.kernel.org (Postfix) with ESMTPS id A884ACE1361; Mon, 24 Oct 2022 12:21:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA2A3C433D7; Mon, 24 Oct 2022 12:21:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614061; bh=eVeasfURuMgmaTvvToTss6SexbhGhp6bCKFrrjPznQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ENc/ghuXYOmQuslo5vEbfLIFNnbAUyIdP6ltAktPYGVwKZBZFY+m/PclSdEQv+SgR GKJrVh0g0+3ZruQGthTZbco9DnmvADvcyPdvx6HSswH5kmKVEUIWzoyHYh8Z9XZb1x eA6PwycAA6Q9aKd9mJJut/G12nmLcT2QGaloFTJ0= 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.10 087/390] drm/nouveau: fix a use-after-free in nouveau_gem_prime_import_sg_table() Date: Mon, 24 Oct 2022 13:28:04 +0200 Message-Id: <20221024113026.324682327@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602814152766282?= X-GMAIL-MSGID: =?utf-8?q?1747602814152766282?= 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 @@ -89,7 +89,6 @@ struct drm_gem_object *nouveau_gem_prime ret = nouveau_bo_init(nvbo, size, align, NOUVEAU_GEM_DOMAIN_GART, sg, robj); if (ret) { - nouveau_bo_ref(NULL, &nvbo); obj = ERR_PTR(ret); goto unlock; } From patchwork Mon Oct 24 11:28:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9076 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp445405wru; Mon, 24 Oct 2022 06:12:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5hE59Nrt2jaet5SaSyjwuhoSaSY/G3zE7pCmUVtKqgd7KrfDy/BnycFEOQzI1jR7A8BQOn X-Received: by 2002:aa7:8011:0:b0:567:70cc:5b78 with SMTP id j17-20020aa78011000000b0056770cc5b78mr29445293pfi.29.1666617152861; Mon, 24 Oct 2022 06:12:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617152; cv=none; d=google.com; s=arc-20160816; b=dxDikkLmkuaPpJvdwGkx+bAApsmDbtt/NX22ZLlFFnKUu1/1FMAbNNVhzyqkbuB8u4 wSyF+D3h/p9T6zqW3okCCrvvTCyDBwviFv4k2QrHS/API3NbX8UyFVHdDxmxRKglb40P dRa6ttcdYcccucl8BpHaDK3AN+WjIVsRk7++XTWDzTnmZ1a14i7d4sESYdr/Dti3AD4S ytD3q7sFZkg/8P/Q/Ta+heEuLkjL/majkvaSktWFqb3Rv1hWed/oUvdpazBnm2ot0Xe9 8sDpNmCwhySgoBW4+DW7iXOzk6tpHAMxXxKeAJrbRgYlIjG1fM9Q6L9cDtj1Y/6ah1Kk QV/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=YcB3eGJe9e9p4paCQ7+AF3kP6H31XypoMrWouUy/IFw=; b=VJ/1qqPh7orSVq/pQ0kQ5BB7XKWqG8omaO63Bn4svMBfvm03WNF8KtlNskTS6P2l6H zzEFVTsS5OkEGphu2UgEQ070Hahuo06Gz/X43oWfvNAet7ORuM29rPGEaXE7JJO1+Saa LzupFPsZhE9SkvG25fkt4tRmP+iTq3Atv1QVkDOKUtl2Uim9BKwCTHcGlhWFmo+3Zrd6 bTYLoMVAS90tDBgSnzvoGg5VyVWzDK/b77hhUYIe5kyDdma0X/h26PBQxkbl8DTIo2E0 Y9NlugzQTp5g1gSihMoUeq/QEr60lTy8c8sWHrin5yjBuBEq0C7w9AsChve1i2yPXyMv htgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KyToFdnp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u6-20020a170902a60600b0017efeb31274si31602835plq.507.2022.10.24.06.12.19; Mon, 24 Oct 2022 06:12: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=KyToFdnp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235638AbiJXNL5 (ORCPT + 99 others); Mon, 24 Oct 2022 09:11:57 -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 S235771AbiJXNJf (ORCPT ); Mon, 24 Oct 2022 09:09:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DF2D9E6A5; Mon, 24 Oct 2022 05:23: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 4F6546127C; Mon, 24 Oct 2022 12:21:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60EBEC433D7; Mon, 24 Oct 2022 12:21:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614063; bh=+8exnQkO5cPkK3GBupL+S7+UcQ06cZXA82c60+9X4Yk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KyToFdnph6cTVfpLIYAMdeTFDk+Cj4XfLob6oXjhnrxu2l4UiIejrxd45WDxmXKVO b4xqmKqeLgPEx2Ujxsbu7p4nKs3tofnRxi6JpgJXllAK/cZ8v0/N3FHz9D6bp1WGhq hFdJ4wyUNw5c6s1LzilVzPsEGD6bTrQAjJRXf9UU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juha-Pekka Heikkila , =?utf-8?b?VmlsbGUgU3ly?= =?utf-8?b?asOkbMOk?= , Tvrtko Ursulin Subject: [PATCH 5.10 088/390] drm/i915: Fix watermark calculations for gen12+ RC CCS modifier Date: Mon, 24 Oct 2022 13:28:05 +0200 Message-Id: <20221024113026.377332060@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574747710972272?= X-GMAIL-MSGID: =?utf-8?q?1747574747710972272?= From: Ville Syrjälä commit c56453a00f19ccddee302f5f9fe96b80e0b47fd3 upstream. Take the gen12+ RC CCS modifier into account when calculating the watermarks. Othwerwise we'll calculate the watermarks thinking this Y-tiled modifier is linear. The rc_surface part is actually a nop since that is not used for any glk+ platform. v2: Split RC CCS vs. MC CCS to separate patches Cc: stable@vger.kernel.org Fixes: b3e57bccd68a ("drm/i915/tgl: Gen-12 render decompression") Reviewed-by: Juha-Pekka Heikkila Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20221003111544.8007-2-ville.syrjala@linux.intel.com (cherry picked from commit a89a96a586114f67598c6391c75678b4dba5c2da) Signed-off-by: Tvrtko Ursulin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/intel_pm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -5145,10 +5145,12 @@ skl_compute_wm_params(const struct intel wp->y_tiled = modifier == I915_FORMAT_MOD_Y_TILED || modifier == I915_FORMAT_MOD_Yf_TILED || modifier == I915_FORMAT_MOD_Y_TILED_CCS || - modifier == I915_FORMAT_MOD_Yf_TILED_CCS; + modifier == I915_FORMAT_MOD_Yf_TILED_CCS || + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS; wp->x_tiled = modifier == I915_FORMAT_MOD_X_TILED; wp->rc_surface = modifier == I915_FORMAT_MOD_Y_TILED_CCS || - modifier == I915_FORMAT_MOD_Yf_TILED_CCS; + modifier == I915_FORMAT_MOD_Yf_TILED_CCS || + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS; wp->is_planar = intel_format_info_is_yuv_semiplanar(format, modifier); wp->width = width; From patchwork Mon Oct 24 11:28:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9660 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp534508wru; Mon, 24 Oct 2022 09:11:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM72z71FuwXFJ/QMPeHH85DfZzvvLF5mkzOUSp/+r9NChLIshkaC9YIuS3poED3c5iGWxPto X-Received: by 2002:a17:902:e886:b0:186:6eea:cd35 with SMTP id w6-20020a170902e88600b001866eeacd35mr21817059plg.116.1666627872910; Mon, 24 Oct 2022 09:11:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627872; cv=none; d=google.com; s=arc-20160816; b=QpmjiF5EgwkVLHd2syacyep00nCfpnit5gHEeYWuvzx5BTI+0ZnL1lRMzClEo2vDEw YYjeM/t9yy1QZ/6uwrNy74/ge9PBcPogGoNb2x/xexuVJ+WIhdamcHlZSkc2f0SiS/h2 ADRxj1NgaDKiSHTLFzuQP7qNJikcUkQjSGuKfxa+VPaedz9mE0dR/iMARhyQw/PvsieS U4sNFPIN6KqfhZ13QJT37hb4BFxLvOqi5nON+V9+T/hQC6oPaA1kkgJ3w0FrCIKqZHTX noe4MyYKGaCD2zIcg7oaJtkFDKpcGkvHNjDqo7BAXBopFyT9xS/5YCHSOWHVGKnGh9KM bE0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=m94lW5Ts1A9msfu4A4wHJdGCGk82VyzjcsaQsTtydg4=; b=y/T+rDkXGjA/JnrbUvWeKH4QclrLSH5aTQnSkG+PSGDyC7dyuUicY1z97vslR4BDJh 2P0SVYG514uYWWnF4rdf59iwHiehPqe/SZsX9ptWXqanetjy0fyDcgOjDkLTP6W1X3Ax jbi7ruOPp/nT8lhClbTVJxcv+FuArwK63VtRlpvrKFo0yGSBWYcWAoMP3XIBKN89dY8Y Vct3ngn0EsdG9AI7WD2rBKirwncKlpb8qWPp0tCO3yGBip80XbPYOrj5NtlezA0I8LwC txdiW4hY0wKWu0KZ2v68Bhhqwcn/YQXYnAp869q8Drxtg9YvqGp+LL0GJ68GJ7eoBQQz 31Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="gJFjr5/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 b1-20020a056a000a8100b0052ee88f59c4si37165966pfl.372.2022.10.24.09.10.58; Mon, 24 Oct 2022 09:11:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="gJFjr5/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 S233672AbiJXQJH (ORCPT + 99 others); Mon, 24 Oct 2022 12:09:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233646AbiJXQEv (ORCPT ); Mon, 24 Oct 2022 12:04:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A8EA2CE04; Mon, 24 Oct 2022 07:57: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 B160AB8162A; Mon, 24 Oct 2022 12:21:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CE4AC433D7; Mon, 24 Oct 2022 12:21:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614066; bh=r5FDIp291EgvdDjpw1Sd2GAdYsqzp0QZFybu9zO3DO4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gJFjr5/GRbIxFIY5+NJZtgCAk7fxvNOPYrf0QsMoXEJSy3RT3NgWOncHEZUs2zu8V Q0oluqB/JjX1BH+0fKYYz3tD59RqMAoaK/y9BIb1pa0/BcOTGblsL8ztotu/wkCFQj EuRCCKH0ov1Dox+kUHRUASKItA7hI2NUoWE0//Co= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juha-Pekka Heikkila , =?utf-8?b?VmlsbGUgU3ly?= =?utf-8?b?asOkbMOk?= , Tvrtko Ursulin Subject: [PATCH 5.10 089/390] drm/i915: Fix watermark calculations for gen12+ MC CCS modifier Date: Mon, 24 Oct 2022 13:28:06 +0200 Message-Id: <20221024113026.417641197@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585988552158195?= X-GMAIL-MSGID: =?utf-8?q?1747585988552158195?= From: Ville Syrjälä commit 484b2b9281000274ef7c5cb0a9ebc5da6f5c281c upstream. Take the gen12+ MC CCS modifier into account when calculating the watermarks. Othwerwise we'll calculate the watermarks thinking this Y-tiled modifier is linear. The rc_surface part is actually a nop since that is not used for any glk+ platform. v2: Split RC CCS vs. MC CCS to separate patches Cc: stable@vger.kernel.org Fixes: 2dfbf9d2873a ("drm/i915/tgl: Gen-12 display can decompress surfaces compressed by the media engine") Reviewed-by: Juha-Pekka Heikkila Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20221003111544.8007-3-ville.syrjala@linux.intel.com (cherry picked from commit 91c9651425fe955b1387f3637607dda005f3f710) Signed-off-by: Tvrtko Ursulin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/intel_pm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -5146,11 +5146,13 @@ skl_compute_wm_params(const struct intel modifier == I915_FORMAT_MOD_Yf_TILED || modifier == I915_FORMAT_MOD_Y_TILED_CCS || modifier == I915_FORMAT_MOD_Yf_TILED_CCS || - modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS; + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS || + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS; wp->x_tiled = modifier == I915_FORMAT_MOD_X_TILED; wp->rc_surface = modifier == I915_FORMAT_MOD_Y_TILED_CCS || modifier == I915_FORMAT_MOD_Yf_TILED_CCS || - modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS; + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS || + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS; wp->is_planar = intel_format_info_is_yuv_semiplanar(format, modifier); wp->width = width; From patchwork Mon Oct 24 11:28: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: 9040 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp442092wru; Mon, 24 Oct 2022 06:06:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Ky9EsoSfFQGtsymwGrlthpuiNJk6z7IjEfmIQgLgbU0v8JuwgB4+Uoi93pWmmtqbm5Ko1 X-Received: by 2002:a17:90b:1e03:b0:20d:7f0:7671 with SMTP id pg3-20020a17090b1e0300b0020d07f07671mr37596096pjb.174.1666616804431; Mon, 24 Oct 2022 06:06:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616804; cv=none; d=google.com; s=arc-20160816; b=t7UjdPvSWcf1yJC8luck+aW4yyw31qjHketvFjNZiQ/GNeGW3Szb1neLTkWbTOzmqa 8LAylwyIAlYkIZcC3OKNdKrYEFe/VvhxwERtT4W79HhV2mMRIDvrnlpKMaQOEt+a+LOA G40yAC0dejovBOyQhQmdeA6Q6DYCATsZNA9Y9gDhIDKyPyI2tYrVwg6mYpDoERRFXQS/ tdIrjuAT3yvZpjpojCWf3g4BKK5mEli36FsUAo75olpnZTq7FnI6+55sp+crD1A9kR4F fEV3BI+W2zyGTkGPbe8MP7VJ+rA3GOG3stKCLxBvoay/D+xOXOKTyb0JMEh1FAMgpf91 zKyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=g4c6D7GKTR71Ui+TwqwJXv/gFEFnwbhNAQIRu6khp+I=; b=n9rps9qbe4ZGqQc3qVpX/k0pgHCTpb/GpeG+n8Wre6dL8tCtvgqjMWCaqMjBJF4Xbd cFprQJJ+IKUOLudpuH4ZeUKfy2m7ZTFCsxHG8PgUAejkzu2f9WbCw3GrorJPkGUAJmGg fNT4zPG/Y29RVJDVvL13u+9UL5vM8jRYpMXbpeZealZ5IaSHaGccuw7VFS3X90h5Nxt/ e28XyHMA7vdubL5dMESG5tdaZhdoYSn7Jvjdm9RQZHZugIQgvA+wLoOevHoyPVV6cNqu SmAUKwONQcZcSmFQLJs8bUz2VB+2GOaKvSovpTGcdtSyZkRdQBzoFfM3ezi3vfURR83m mZ4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=q72Xb02L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b11-20020a170902bd4b00b0016db0d4f4c9si14203063plx.65.2022.10.24.06.06.26; Mon, 24 Oct 2022 06:06: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=q72Xb02L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235289AbiJXNFy (ORCPT + 99 others); Mon, 24 Oct 2022 09:05:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235186AbiJXNDR (ORCPT ); Mon, 24 Oct 2022 09:03:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC795476CB; Mon, 24 Oct 2022 05:20: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 1DD9F61278; Mon, 24 Oct 2022 12:19:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32E22C433C1; Mon, 24 Oct 2022 12:19:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613987; bh=OC+4YFwol8l1oBUKyo623Veq+MdVfA92yvZEweBhY3E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q72Xb02Lif2pbYa8ZxtVHGKaUXTmT/v8v/8zJenaIf3UEolFelmegICoSilFtYgXH B3Y67A0VOxSHYdIclaz24Mo60iAigNhEAbPp/ABKiYS20AOyvxym3C+ENmOcHcO3dZ VdNtwNimCHFGoUXrEFw8eMIjlHjXArnvuJfDXBHo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Paulo Alcantara (SUSE)" , Steve French Subject: [PATCH 5.10 090/390] smb3: must initialize two ACL struct fields to zero Date: Mon, 24 Oct 2022 13:28:07 +0200 Message-Id: <20221024113026.456599204@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574382563307110?= X-GMAIL-MSGID: =?utf-8?q?1747574382563307110?= From: Steve French commit f09bd695af3b8ab46fc24e5d6954a24104c38387 upstream. Coverity spotted that we were not initalizing Stbz1 and Stbz2 to zero in create_sd_buf. Addresses-Coverity: 1513848 ("Uninitialized scalar variable") Cc: Reviewed-by: Paulo Alcantara (SUSE) Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/smb2pdu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -2294,7 +2294,7 @@ create_sd_buf(umode_t mode, bool set_own unsigned int acelen, acl_size, ace_count; unsigned int owner_offset = 0; unsigned int group_offset = 0; - struct smb3_acl acl; + struct smb3_acl acl = {}; *len = roundup(sizeof(struct crt_sd_ctxt) + (sizeof(struct cifs_ace) * 4), 8); @@ -2367,6 +2367,7 @@ create_sd_buf(umode_t mode, bool set_own acl.AclRevision = ACL_REVISION; /* See 2.4.4.1 of MS-DTYP */ acl.AclSize = cpu_to_le16(acl_size); acl.AceCount = cpu_to_le16(ace_count); + /* acl.Sbz1 and Sbz2 MBZ so are not set here, but initialized above */ memcpy(aclptr, &acl, sizeof(struct smb3_acl)); buf->ccontext.DataLength = cpu_to_le32(ptr - (__u8 *)&buf->sd); From patchwork Mon Oct 24 11:28:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9044 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp442288wru; Mon, 24 Oct 2022 06:07:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7hnntVp0sVHkyCnjJzlXcm0Uk2L2kRHxTFbwKuk/EvCGD2eFvB1DUvylmr+y5OVAg9XSca X-Received: by 2002:a63:8641:0:b0:46e:c693:2e57 with SMTP id x62-20020a638641000000b0046ec6932e57mr12893846pgd.341.1666616835799; Mon, 24 Oct 2022 06:07:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616835; cv=none; d=google.com; s=arc-20160816; b=soEy9Oh5vt5JkDvlhaqWQvMesCP8f4jgtg9C86eQL0m0I6d6icmK7eh4li35iAENZ8 y4xS/6DUCgXKUmIWX67Z6+sgsnUML+Xl6VaemaRS8yxAnEPdpJF1lQunqGTTUWRMEk/E DrwTzr8T0a6jnICosxgcONm/CKryvhsyM989p666M27gRXKgubfOE9j4YKFnUKKKtoNQ CJHJGLV2ofuhQTPDTh5toLh6wTTfLAjzdqRYbQ/i9br2mlSMDB9t8encXvFxF/taovER ApwD9ESykVKYmenSSJpdHuRITDEV/T5UP1voFkSHWtY2ul9dWzSgIU0r9Ac4sx36Si6S cXiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=inShbefJOXhhWNZxZYRsQXVhI3ihjxPxEDKiDXRfHbsek4OUNLnCX21xln0OX67GpC KMu2Km8m2ESSn1Oc15/mVDX2nMvkC9tQFt8hr6u7pvSPl+V5BIcDwkPSHUTfNpzVyapV 1CfXXVD7ef33Qus4BzJ7qMo6brdxozSHaxLV3LNAgn01OGD7ok/Cp6XHDSru/R+HmtWN kc+i7fHlnNM7enSMAgBCOrSYCGGXu+fM5TNRMV5WM47P5VJ6VxpZr2ZbQ87HL8Mjr5ZT xe6E1BBU+OtXc414vN0yBhhRGLakoF+6VBuK2FdZSTwubMyFnofYbA3Y5Q8kixdjCACS AFmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cXdP8FyS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r22-20020a6560d6000000b00462fbd5b46bsi31812034pgv.35.2022.10.24.06.06.56; Mon, 24 Oct 2022 06:07: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=cXdP8FyS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235403AbiJXNGU (ORCPT + 99 others); Mon, 24 Oct 2022 09:06:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235339AbiJXNEa (ORCPT ); Mon, 24 Oct 2022 09:04: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 32C3D481D6; Mon, 24 Oct 2022 05:20: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 BB57761290; Mon, 24 Oct 2022 12:19:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC018C433C1; Mon, 24 Oct 2022 12:19:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613990; bh=QOgwnGXtJ5WnEebGLcaB/JmKLZooNWI4me6Yyig3MGY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cXdP8FySH0xqUD52fcZa7P8pupP5CY/cL7bpccX5dcURa8AXDhJSit+vHmbCCVXdn 6f4dtfkftC37LPvA6mzkFzGK0fabBCzQ2sjQybG+fec70/xiaGFqIgEwBQO2UN3wkb wavF1WOiviRSjwM9Yc3viuIBo7lnYSQGmKUq1fqk= 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.10 091/390] selinux: use "grep -E" instead of "egrep" Date: Mon, 24 Oct 2022 13:28:08 +0200 Message-Id: <20221024113026.506157090@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574415125288695?= X-GMAIL-MSGID: =?utf-8?q?1747574415125288695?= 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:28: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: 9049 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp442568wru; Mon, 24 Oct 2022 06:07:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4LOwXknsRrwRiBhlLH5Z5OS/W/RYOgvaDQmD59RFejO/3gvyv+p4vjGvFbsBBLiBowBmlR X-Received: by 2002:a65:408b:0:b0:42a:55fb:60b0 with SMTP id t11-20020a65408b000000b0042a55fb60b0mr28411020pgp.431.1666616863372; Mon, 24 Oct 2022 06:07:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616863; cv=none; d=google.com; s=arc-20160816; b=TF6O5wxP6D1r1zoYX1kH9smTDYr8sDU6f2emoY5dSIti8KBE/Rtwz5zRIqWV3apZ3g HzIKUwnLLoORMN7FbMY+oQ9Zqxz0ylf08GnNdSoAnNUtuNGovbmzbd/W2GKrMAemeSKQ VpGQKhn2fy9uBvQ5dikysb9RP0BpOUdXCUG6vaORmicRWq1pIC9zqwgoPv6itRila2J9 UcFqGoXhNbMP6wzRazP05fdi9vZbwTpbq+1LXOUqEHotJscLpoOew6eVeWNOJ76KbDRB 9Wz1cvek/YyMxXZj3tnPINctaCeTcaGqb/9dUCGbJOyADSmZiLWBr4TAHf+Yud85pDcW tdKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gh+YMn+XtmbAX6MdyACHByFc1Qmd6QIL7nL3AsNHBJ4=; b=DGJQmjQRAr6TnpHaVL92pxsvgFgZfrpcCgntu6N7eBZJj0JiEU5QzZWrfOWZkvXc7x 8j1+4vagcNaQBXzzJXm15CPCQtIcJZoLqCfwrgVISyWBUUztK91/c+puL+QVPDleB1Ir HuaK20k9zHL3i3JP6Uf06bR850W0YNozpSnoPJc3JjF/MT/Jta4iCZl7BX8qGuPoYay/ UVltXlg3eTTLDZ8RL6aO1qpDDnFJ0PUYS0hD+XkE3s8GAD/TJjGcEL9meTouMYqRHNxl xxuaxEpJwB322QV50ihkGVniYX8gTSviDjZAW3LT+UTBtec6PJVhRwGAU2dqEiztoXpL S/xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uf3ORQ4d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t26-20020a63535a000000b0045ce0eba52esi37415875pgl.114.2022.10.24.06.07.21; Mon, 24 Oct 2022 06:07:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uf3ORQ4d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234966AbiJXNGZ (ORCPT + 99 others); Mon, 24 Oct 2022 09:06:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235372AbiJXNEj (ORCPT ); Mon, 24 Oct 2022 09:04:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72BC74D4F2; Mon, 24 Oct 2022 05:20: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 5E8A66129D; Mon, 24 Oct 2022 12:19:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 735A3C433D6; Mon, 24 Oct 2022 12:19:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613992; bh=hn6W96T8z04EogJtNH5PSoub5gNDEco86kNA8E7waSg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uf3ORQ4dFYf2jalbFOn8wQ1Jkl+jTLa/Q6KS96IdeKWQuRyEHqFzCPdsnZnmYbI6R zRS0Dm58loifcCRkHEhLqgKKu6OcmkSr6RwbJY11f5i+fOUsc7fU4rfzRX1tEjTgND yj9iBvIld/xhVKKj0s5Gwr5/wl6pFSEzEj6IXTX4= 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.10 092/390] userfaultfd: open userfaultfds with O_RDONLY Date: Mon, 24 Oct 2022 13:28:09 +0200 Message-Id: <20221024113026.545715262@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574444447494121?= X-GMAIL-MSGID: =?utf-8?q?1747574444447494121?= 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 aef0da5d6f63..a3074a9d71a6 100644 --- a/fs/userfaultfd.c +++ b/fs/userfaultfd.c @@ -974,7 +974,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; @@ -1987,7 +1987,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:28:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9051 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp442699wru; Mon, 24 Oct 2022 06:07:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5r7w4vmByVznHXJEJHiEZb24jjW45b6/QPF06X3rQUfEHM8EoPtjDHYVukpHH3apYLPan/ X-Received: by 2002:a05:6a00:1389:b0:566:1549:c5bc with SMTP id t9-20020a056a00138900b005661549c5bcmr33782406pfg.8.1666616878577; Mon, 24 Oct 2022 06:07:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616878; cv=none; d=google.com; s=arc-20160816; b=wtGkE9L1onTQs8Ko/HbozPzjdnlzBHYHrCBA9OQZB/l6v4yWv7+vAbjsTOIthfH4oH ZydX+xX4DDRSFaRMTH8Xd0/lP+vGay4jCI1rjTLXjRL6q19nRc52WpvKmTXspfCHBEDc OjhLv/f1KX8WVfF6+mEUpNn8Wrr5uNGdQBOxAwVEghMSukq7IgoJr5I6vIm3g4jXnC9I H6yKjpwKp34BK7hC4HuDkmbAq9EAAGw+6ihSPd/qPBb7ZSB0NwXC2NanaKTYnCWizyux aqvn1BAunDGtmnlNdm5uaIreKW/Bs0NU8SCDYwFdusp/8q57msy+gcxK4oHRCAQuBE+y nZeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/FSFo6mf7eMkL0wMWQgBAXbqaoy3pwSZaxsNpeXAa4g=; b=Z7gtFN0PLvuWOc5eZffm4ywOHjNjDmWEj7GfElcLiEocnagkki4vNoBHeWiABp4R0f hbDiOeeHnWwhFpFDvWAqPfGKBAAOWdydpssWHplZaXVF0PQOnfvHIYl76sWS3ZEvdUW4 HC5DvmXrV+07dw89S8DKOY7aUvdMJLtzGq5+zZDBntWwRiDdfs+vzUUUiI83wFue0jMZ gGX0A0qQ0uYFKfVF1VdgW+ANwTKoBpneqX7LYelmvqDaqL4kcUQeIrbeDAjCNYQqENdg rGEQ3JRntF+oVMWwskmktswB6D0JfQbKHeo6fh+HlfE1ejqNeAchLboekc879y7UAsSW H93g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cDGYHXcY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w6-20020a170902d3c600b001783af487d1si31329511plb.533.2022.10.24.06.07.38; Mon, 24 Oct 2022 06:07:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cDGYHXcY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235443AbiJXNGi (ORCPT + 99 others); Mon, 24 Oct 2022 09:06:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235427AbiJXNEq (ORCPT ); Mon, 24 Oct 2022 09:04:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FB1A50046; 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 dfw.source.kernel.org (Postfix) with ESMTPS id F3B77612A1; Mon, 24 Oct 2022 12:19:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14C3FC433D6; Mon, 24 Oct 2022 12:19:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613995; bh=tsYIEnNeNXBKuktBDiK6adMOHZqbmAxFQCb+rNO0Bnc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cDGYHXcYj1oXCbQh2Eq2kT6/KJBp25eLY7LCGtRgnNISRm1GxuUoU+RtRe1wrU2Tg 7lypydVEn17UE7bW9uKY0Yc9LuKQsqk/NqGVIXqzPY+Ih0yFdvPjkRRiUtScEjh99A 8th+Hc0EGcnFgY6UgvADIqX6o9HSbWCcau5TefOk= 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.10 093/390] sh: machvec: Use char[] for section boundaries Date: Mon, 24 Oct 2022 13:28:10 +0200 Message-Id: <20221024113026.593659571@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574459888007005?= X-GMAIL-MSGID: =?utf-8?q?1747574459888007005?= From: Kees Cook [ Upstream commit c5783af354688b24abd359f7086c282ec74de993 ] As done for other sections, define the extern as a character array, which relaxes many of the compiler-time object size checks, which would otherwise assume it's a single long. Solves the following build error: arch/sh/kernel/machvec.c: error: array subscript 'struct sh_machine_vector[0]' is partly outside array bounds of 'long int[1]' [-Werror=array-bounds]: => 105:33 Cc: Yoshinori Sato Cc: Rich Felker Cc: linux-sh@vger.kernel.org Reported-by: Geert Uytterhoeven Link: https://lore.kernel.org/lkml/alpine.DEB.2.22.394.2209050944290.964530@ramsan.of.borg/ Fixes: 9655ad03af2d ("sh: Fixup machvec support.") Reviewed-by: Geert Uytterhoeven Reviewed-by: Gustavo A. R. Silva Acked-by: Rich Felker Signed-off-by: Kees Cook Signed-off-by: Sasha Levin --- arch/sh/include/asm/sections.h | 2 +- arch/sh/kernel/machvec.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/sh/include/asm/sections.h b/arch/sh/include/asm/sections.h index 8edb824049b9..0cb0ca149ac3 100644 --- a/arch/sh/include/asm/sections.h +++ b/arch/sh/include/asm/sections.h @@ -4,7 +4,7 @@ #include -extern long __machvec_start, __machvec_end; +extern char __machvec_start[], __machvec_end[]; extern char __uncached_start, __uncached_end; extern char __start_eh_frame[], __stop_eh_frame[]; diff --git a/arch/sh/kernel/machvec.c b/arch/sh/kernel/machvec.c index d606679a211e..57efaf5b82ae 100644 --- a/arch/sh/kernel/machvec.c +++ b/arch/sh/kernel/machvec.c @@ -20,8 +20,8 @@ #define MV_NAME_SIZE 32 #define for_each_mv(mv) \ - for ((mv) = (struct sh_machine_vector *)&__machvec_start; \ - (mv) && (unsigned long)(mv) < (unsigned long)&__machvec_end; \ + for ((mv) = (struct sh_machine_vector *)__machvec_start; \ + (mv) && (unsigned long)(mv) < (unsigned long)__machvec_end; \ (mv)++) static struct sh_machine_vector * __init get_mv_byname(const char *name) @@ -87,8 +87,8 @@ void __init sh_mv_setup(void) if (!machvec_selected) { unsigned long machvec_size; - machvec_size = ((unsigned long)&__machvec_end - - (unsigned long)&__machvec_start); + machvec_size = ((unsigned long)__machvec_end - + (unsigned long)__machvec_start); /* * Sanity check for machvec section alignment. Ensure @@ -102,7 +102,7 @@ void __init sh_mv_setup(void) * vector (usually the only one) from .machvec.init. */ if (machvec_size >= sizeof(struct sh_machine_vector)) - sh_mv = *(struct sh_machine_vector *)&__machvec_start; + sh_mv = *(struct sh_machine_vector *)__machvec_start; } pr_notice("Booting machvec: %s\n", get_system_type()); From patchwork Mon Oct 24 11:28:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9071 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp445006wru; Mon, 24 Oct 2022 06:11:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4EjZSvR613xTADNr1iIjpNH10RnV9RorQUlN5Ri/UCDx0Ix6KaPmZXJJzXoRFh6fa8l4Al X-Received: by 2002:a17:902:f687:b0:185:4163:3368 with SMTP id l7-20020a170902f68700b0018541633368mr34022113plg.25.1666617119177; Mon, 24 Oct 2022 06:11:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617119; cv=none; d=google.com; s=arc-20160816; b=0N56qH8UJzJ7t7lsaV+lBgYR1DHAX019rt1u9o7ddF5qLUa/jrCxFRqJZs/xvooOGH l4RxM2wKf0Jo6UdIlFK2Kbj39yiXPr3CjuvzvHhB+HBBB0xW29UIvhs32Ux4dW7qAey2 pdaITWkY4dLUqw7nKJzrU8vbngLnYb3GqNNOznoNmFUM0CQwwwyyPhwpIcSCEAkOTNtJ RlFUuSSbXsnedwkeHvjaPerXQsRQV43rEdoA7zO+xJ2TFSu84ULhVrbtkDP/pMrFZZj1 mkbMmaz4s9k7v2bkfk5d9KDecpE8gn1EAlB+VQ9QHJQ8r4kHD+760RCtZCR6jdTIJtQ0 bloA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VNm8nY1hBhOtYIrZQ71g/ZpjzM3UCUkFcSGjOD/ehXA=; b=Mk4xECvUTv/kmKO4ryHp+U0FWKOFOezDYkfqCmfq9S1y8bPNntCc/HHnYNLSPYws2x RLdemHHxNMXAfuAWusO8OS3ZZszEQ31pXnew85hKBYnB0FFvld8vydsUI7A7R6IAcO40 1VNwA3QrVrbxQ+2QRbXKJPQq0HXuN6EPbzZcaljSnSaJD3roYmeHa/FHgYhlnflGkZ+t c0p8W+xtd0SNJRybyk9dCBfHQn49XuPwgH252oEMdRQAJa8ncY1MRDODfqAyDiXtO3E2 1g2YVCzg9Nx412HPogeI/g8O7YnmW5hNUdlv6QZ58iolEGg6I1LRJ2+25+UDXERb3YU5 PeSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SBdSz84r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h12-20020a170902f70c00b001782a6fbc7csi33598375plo.463.2022.10.24.06.11.45; Mon, 24 Oct 2022 06:11:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SBdSz84r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232100AbiJXNLa (ORCPT + 99 others); Mon, 24 Oct 2022 09:11:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235554AbiJXNI7 (ORCPT ); Mon, 24 Oct 2022 09:08:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C78CD9F346; Mon, 24 Oct 2022 05:22: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 9C33361281; Mon, 24 Oct 2022 12:19:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B35FBC433D6; Mon, 24 Oct 2022 12:19:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613998; bh=+uBp4s5k9w8OaQPz9fOORY0Wxie4lKxtfkqZIUFQYQw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SBdSz84r2PuOpPm5nrsWPAyWo7UJvpl1l1KHpRe5jbV3opKrv+5XoBbV9jLVll2ne UVixWpKrAA+f2/GlBWBBZbtF8vqqpzMt3ipJaMAdRLnk1NTUL+7amdm7WrHmd9kkf+ 1iOvIboklVsttToggmr943kYt2tsEYdex0JExQDA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.10 094/390] MIPS: SGI-IP27: Free some unused memory Date: Mon, 24 Oct 2022 13:28:11 +0200 Message-Id: <20221024113026.645371712@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574712353316448?= X-GMAIL-MSGID: =?utf-8?q?1747574712353316448?= From: Christophe JAILLET [ Upstream commit 33d7085682b4aa212ebfadbc21da81dfefaaac16 ] platform_device_add_data() duplicates the memory it is passed. So we can free some memory to save a few bytes that would remain unused otherwise. Signed-off-by: Christophe JAILLET Signed-off-by: Thomas Bogendoerfer Stable-dep-of: 11bec9cba4de ("MIPS: SGI-IP27: Fix platform-device leak in bridge_platform_create()") Signed-off-by: Sasha Levin --- arch/mips/sgi-ip27/ip27-xtalk.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/mips/sgi-ip27/ip27-xtalk.c b/arch/mips/sgi-ip27/ip27-xtalk.c index 000ede156bdc..e762886d1dda 100644 --- a/arch/mips/sgi-ip27/ip27-xtalk.c +++ b/arch/mips/sgi-ip27/ip27-xtalk.c @@ -53,6 +53,8 @@ static void bridge_platform_create(nasid_t nasid, int widget, int masterwid) } platform_device_add_resources(pdev, &w1_res, 1); platform_device_add_data(pdev, wd, sizeof(*wd)); + /* platform_device_add_data() duplicates the data */ + kfree(wd); platform_device_add(pdev); bd = kzalloc(sizeof(*bd), GFP_KERNEL); @@ -83,6 +85,8 @@ static void bridge_platform_create(nasid_t nasid, int widget, int masterwid) bd->io_offset = offset; platform_device_add_data(pdev, bd, sizeof(*bd)); + /* platform_device_add_data() duplicates the data */ + kfree(bd); platform_device_add(pdev); pr_info("xtalk:n%d/%x bridge widget\n", nasid, widget); return; From patchwork Mon Oct 24 11:28:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9045 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp442326wru; Mon, 24 Oct 2022 06:07:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ZXAzl7l1+Gs1nn+KRCgHTGdDzw8h7mAu/wMR3UMoM2Rluxzm6NrvDDQd6bW/kYuL2FGGH X-Received: by 2002:a17:90a:4607:b0:202:e22d:489c with SMTP id w7-20020a17090a460700b00202e22d489cmr75482389pjg.80.1666616839568; Mon, 24 Oct 2022 06:07:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616839; cv=none; d=google.com; s=arc-20160816; b=GjND9LMonSYnv64ve5nPSYgYTrvU+bdv71uTwDtKslzX5e8vRYZG8s7w7yWDDAJrZk mytZmhGq22dtkg7r+1a9glTXyrbWI6oT444BXtMiMvbrFcK/lXzy3MYzlvPnlPZJMvk4 N4LFHGo6oCj4z/SvUb0DFIQTyvgcTdBM0nshikrb7xorrIQsR7EMZXsathCS8OwI/Fuq lW+daaZTN3D81DPGapR/ImnY3w139d52rTN+Ig8VtMosZOm9YenoX4hiEW3ezSpodPcd bCFp87mLUWVsqUs02UNG2SS+1Gw4HNySEdik6rqBqLKuv/7S69q0FOLks2IH0EWWMF5B iDkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=x9m6WPALQFDIMGjgpepRIbnUnUVRQtbQeXkhEKFbXv8=; b=Ck5lHzHWU9xOHM3urZATJUFZxU6SDokdUNu1DT8YHzURr6DG02hItpFD9QX1GRirFY tCSRj9/D5RDJu0hMuG11B3AQN6c4C+B4iIaJckRwtYHtq33sevfsEwc7mGE4d8cbHkZI fCnjSxhZTFQfYq2+tMBDuqLodMJpCH1j1WYckoH6FvcOT6Y4U9IdummlvvkcUUjIFs25 YgxjSPo5Os9Vzv32csmV5gKRIHFgeUMaumMF1EGXiTLrhdP6g3hJhgk+gWB27Y5adzYd xlAehjJrt6JdMsHvN/I+p1tYkOdaff0qcZLW72e3KEl8ysFlKJMV6b/h1r9w8QEulCaZ 80+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GHe9yUtP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z3-20020a170902ccc300b0017a50d7258dsi35197560ple.97.2022.10.24.06.07.01; Mon, 24 Oct 2022 06:07: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=GHe9yUtP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235374AbiJXNGM (ORCPT + 99 others); Mon, 24 Oct 2022 09:06:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235260AbiJXND7 (ORCPT ); Mon, 24 Oct 2022 09:03:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C46F520A3; 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 dfw.source.kernel.org (Postfix) with ESMTPS id 495C2612BF; Mon, 24 Oct 2022 12:20:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5566AC433C1; Mon, 24 Oct 2022 12:20:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614000; bh=HOZhK5nwydeR/Bd8FjHVUeZa+EqAKfMdTpBZvPcFDdk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GHe9yUtPwic5G43el58ZVHEySR1L47q1UlR1uDb2gkfLCDVVyDGiQWbM2tAhGfem2 7pzBr9TUV/WlkNooivOhbyC5jljPshYa7GnM154AqfFpdshJsO+F9ipj+UYvStFcyk srP0Fd+uYdMdwhkiIdcFUo3CUgM8Fk26feuOwqsc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lin Yujun , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.10 095/390] MIPS: SGI-IP27: Fix platform-device leak in bridge_platform_create() Date: Mon, 24 Oct 2022 13:28:12 +0200 Message-Id: <20221024113026.686783570@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574418828780398?= X-GMAIL-MSGID: =?utf-8?q?1747574418828780398?= From: Lin Yujun [ Upstream commit 11bec9cba4de06b3c0e9e4041453c2caaa1cbec1 ] In error case in bridge_platform_create after calling platform_device_add()/platform_device_add_data()/ platform_device_add_resources(), release the failed 'pdev' or it will be leak, call platform_device_put() to fix this problem. Besides, 'pdev' is divided into 'pdev_wd' and 'pdev_bd', use platform_device_unregister() to release sgi_w1 resources when xtalk-bridge registration fails. Fixes: 5dc76a96e95a ("MIPS: PCI: use information from 1-wire PROM for IOC3 detection") Signed-off-by: Lin Yujun Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin --- arch/mips/sgi-ip27/ip27-xtalk.c | 70 +++++++++++++++++++++++---------- 1 file changed, 50 insertions(+), 20 deletions(-) diff --git a/arch/mips/sgi-ip27/ip27-xtalk.c b/arch/mips/sgi-ip27/ip27-xtalk.c index e762886d1dda..5143d1cf8984 100644 --- a/arch/mips/sgi-ip27/ip27-xtalk.c +++ b/arch/mips/sgi-ip27/ip27-xtalk.c @@ -27,15 +27,18 @@ static void bridge_platform_create(nasid_t nasid, int widget, int masterwid) { struct xtalk_bridge_platform_data *bd; struct sgi_w1_platform_data *wd; - struct platform_device *pdev; + struct platform_device *pdev_wd; + struct platform_device *pdev_bd; struct resource w1_res; unsigned long offset; offset = NODE_OFFSET(nasid); wd = kzalloc(sizeof(*wd), GFP_KERNEL); - if (!wd) - goto no_mem; + if (!wd) { + pr_warn("xtalk:n%d/%x bridge create out of memory\n", nasid, widget); + return; + } snprintf(wd->dev_id, sizeof(wd->dev_id), "bridge-%012lx", offset + (widget << SWIN_SIZE_BITS)); @@ -46,24 +49,35 @@ static void bridge_platform_create(nasid_t nasid, int widget, int masterwid) w1_res.end = w1_res.start + 3; w1_res.flags = IORESOURCE_MEM; - pdev = platform_device_alloc("sgi_w1", PLATFORM_DEVID_AUTO); - if (!pdev) { - kfree(wd); - goto no_mem; + pdev_wd = platform_device_alloc("sgi_w1", PLATFORM_DEVID_AUTO); + if (!pdev_wd) { + pr_warn("xtalk:n%d/%x bridge create out of memory\n", nasid, widget); + goto err_kfree_wd; + } + if (platform_device_add_resources(pdev_wd, &w1_res, 1)) { + pr_warn("xtalk:n%d/%x bridge failed to add platform resources.\n", nasid, widget); + goto err_put_pdev_wd; + } + if (platform_device_add_data(pdev_wd, wd, sizeof(*wd))) { + pr_warn("xtalk:n%d/%x bridge failed to add platform data.\n", nasid, widget); + goto err_put_pdev_wd; + } + if (platform_device_add(pdev_wd)) { + pr_warn("xtalk:n%d/%x bridge failed to add platform device.\n", nasid, widget); + goto err_put_pdev_wd; } - platform_device_add_resources(pdev, &w1_res, 1); - platform_device_add_data(pdev, wd, sizeof(*wd)); /* platform_device_add_data() duplicates the data */ kfree(wd); - platform_device_add(pdev); bd = kzalloc(sizeof(*bd), GFP_KERNEL); - if (!bd) - goto no_mem; - pdev = platform_device_alloc("xtalk-bridge", PLATFORM_DEVID_AUTO); - if (!pdev) { - kfree(bd); - goto no_mem; + if (!bd) { + pr_warn("xtalk:n%d/%x bridge create out of memory\n", nasid, widget); + goto err_unregister_pdev_wd; + } + pdev_bd = platform_device_alloc("xtalk-bridge", PLATFORM_DEVID_AUTO); + if (!pdev_bd) { + pr_warn("xtalk:n%d/%x bridge create out of memory\n", nasid, widget); + goto err_kfree_bd; } @@ -84,15 +98,31 @@ static void bridge_platform_create(nasid_t nasid, int widget, int masterwid) bd->io.flags = IORESOURCE_IO; bd->io_offset = offset; - platform_device_add_data(pdev, bd, sizeof(*bd)); + if (platform_device_add_data(pdev_bd, bd, sizeof(*bd))) { + pr_warn("xtalk:n%d/%x bridge failed to add platform data.\n", nasid, widget); + goto err_put_pdev_bd; + } + if (platform_device_add(pdev_bd)) { + pr_warn("xtalk:n%d/%x bridge failed to add platform device.\n", nasid, widget); + goto err_put_pdev_bd; + } /* platform_device_add_data() duplicates the data */ kfree(bd); - platform_device_add(pdev); pr_info("xtalk:n%d/%x bridge widget\n", nasid, widget); return; -no_mem: - pr_warn("xtalk:n%d/%x bridge create out of memory\n", nasid, widget); +err_put_pdev_bd: + platform_device_put(pdev_bd); +err_kfree_bd: + kfree(bd); +err_unregister_pdev_wd: + platform_device_unregister(pdev_wd); + return; +err_put_pdev_wd: + platform_device_put(pdev_wd); +err_kfree_wd: + kfree(wd); + return; } static int probe_one_port(nasid_t nasid, int widget, int masterwid) From patchwork Mon Oct 24 11:28: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: 9670 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp535004wru; Mon, 24 Oct 2022 09:12:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ec4vWUhSxQThygukyHugJb73xMo1OICt02/fW8fxUKV8xZ20J0lldDfQV+ydMNzM2beqD X-Received: by 2002:a17:902:7c0d:b0:178:a6ca:1dbc with SMTP id x13-20020a1709027c0d00b00178a6ca1dbcmr34495676pll.115.1666627932181; Mon, 24 Oct 2022 09:12:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627932; cv=none; d=google.com; s=arc-20160816; b=RlzCmbTMPDfLpQuzQyTYM6sphFleO2+GTBIBLOX2nxQ8QhMblKZHbSV/YoIgm/etgU 6pRasaBH3wP9AgFiQi1Lrj4MrS+egdNFr4ur7mlOoNA9KzSRaFodT3nLWzxtJRw4Cank PWoL3uEw8kTlcD/BJ2Lm6UpSBHM4imepNvDm4cA+xpZ0Tlh6hajrcNA4S8clgkhvsmC0 cI3zFU6Sxy8T6rKE1xm+TvnwF7zD3kYSdyCt9PP9NI02lO6DiJrX+5cPzhccq+kFBFQA LL7dJMqdhHOQe3WdAmFEEC+7ZQ1MsYKyTrzXv+F3/byG861Wn7JO8Ce8YCbeE0gusqiO Z8xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1CutrfnPJZ5u6Aos5cfMf76SifiZZ+L9g/aUEY0ly4o=; b=E1x/4sdbKS9/+Dc1mZOHh9eum0LfNOzI+UEBYiJXEIDa48KpuI3tvH9eJnk88yFv1v Iai5zW1ZXKX6H1FYfayraeu5K3CmJChDrFa7KdCPDv5T+rbMkfEz/xmN/5ofqMpW17e1 TZu14NKk0zfPP9MqKYyoZ6Suv3vJxVCkQZ/mW+fQFuErgkV1Rtl9KxyV+DRlJvVd1Pc/ 706/YJeM2WN7f2Q65NeDG3z0wmPsq4+YsMdfGCOaBjpYPfLfsn2BbZ0VjUH+dvlvuq88 1CejQuwyca9DxHUJj1OarUd/2uULfD6p9ARYjXPqAqQWUGxQF3EwI7En5pTl/EaeY5mr AtYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1q50m4xH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170903228500b001868a4db3d1si9669765plh.48.2022.10.24.09.11.58; Mon, 24 Oct 2022 09:12:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1q50m4xH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233413AbiJXQLA (ORCPT + 99 others); Mon, 24 Oct 2022 12:11:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233765AbiJXQFA (ORCPT ); Mon, 24 Oct 2022 12:05: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 780D7111B94; Mon, 24 Oct 2022 07:57:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9F766B8164A; Mon, 24 Oct 2022 12:20:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0663AC433D7; Mon, 24 Oct 2022 12:20:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614003; bh=M5oEERXuvUHrrYr4fvO/JcOAz2Fo/EAEiLu3hsYkgyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1q50m4xHLVJrOfrw+A/w90xIGw6aEut18hirjTunss10uUQPq/TVoOpNqjexfZ3ru B9yBD7U7WOeLz7e1Uep5Wiro5lj9cCB2axIiimRKGWBxCyTVvIZHtvkBMN15HPeNPt AsE9iscM+LMkgubys1xcPLN8Zhr3Bj6cEhZGo3Yg= 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.10 096/390] ARM: 9244/1: dump: Fix wrong pg_level in walk_pmd() Date: Mon, 24 Oct 2022 13:28:13 +0200 Message-Id: <20221024113026.737057802@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747586051004528975?= X-GMAIL-MSGID: =?utf-8?q?1747586051004528975?= From: Wang Kefeng [ Upstream commit 2ccd19b3ffac07cc7e75a2bd1ed779728bb67197 ] After ARM supports p4d page tables, the pg_level for note_page() in walk_pmd() should be 4, not 3, fix it. Fixes: 84e6ffb2c49c ("arm: add support for folded p4d page tables") Signed-off-by: Kefeng Wang Signed-off-by: Russell King (Oracle) Signed-off-by: Sasha Levin --- arch/arm/mm/dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mm/dump.c b/arch/arm/mm/dump.c index c18d23a5e5f1..9b9023a92d46 100644 --- a/arch/arm/mm/dump.c +++ b/arch/arm/mm/dump.c @@ -342,7 +342,7 @@ static void walk_pmd(struct pg_state *st, pud_t *pud, unsigned long start) addr = start + i * PMD_SIZE; domain = get_domain_name(pmd); if (pmd_none(*pmd) || pmd_large(*pmd) || !pmd_present(*pmd)) - note_page(st, addr, 3, pmd_val(*pmd), domain); + note_page(st, addr, 4, pmd_val(*pmd), domain); else walk_pte(st, pmd, addr, domain); From patchwork Mon Oct 24 11:28:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9649 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp533292wru; Mon, 24 Oct 2022 09:09:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ibQC7ysccx+13YFm+DM7CW4D7tv17rrtZTV9cDo3JOckxwAU+MMPPCu5LGJilZ+Z7wpQl X-Received: by 2002:a05:6402:e87:b0:456:c93c:5361 with SMTP id h7-20020a0564020e8700b00456c93c5361mr30653669eda.88.1666627758494; Mon, 24 Oct 2022 09:09:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627758; cv=none; d=google.com; s=arc-20160816; b=uaa4Qn98fmczzcRpXI13E0s12bupzaQd6RsIFAyRz35e+6z20Yf/MioSYheAij2XYR iaksdIuWglJ7U/dftw7oFvfEThap6cm+yeRMNoF27593DoyKcxtPKO3n3ohU1s/mtiAt vgA++3B2xcMk6p4Uwjzf3FGAFn5ZZY6MNq6169vURVX+12QUzWblZU8hLEI62iaGh159 arFnGgqjOKMKz+wNlptxisqzbk+4G+zzhFRPNJdGgPFpFmgR8IiFCMiQE5hL+llOAwmG xVAazu+MQl4ck3WYlq6uSM8hWaIhSmeB3acdJeilyE6Raqq50dDS/IFBuG/vCna9cYj4 GgaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6WJpchAnm2AYDrbuAGdQpuZFt7lkJfrI2YvMtIEo/cc=; b=SWrfbOF/OLKSFTATWmkuSIZulLu29pxeDaQ81Sd1hU/UdkxejiEuFKHokjRVsq5MOF 6BBn4gAuNJKvXIZvXt4yWAMoM+PxH7ddnthiwMsnd1JLGDDB06NNDZr8qQhtB16zGaik dOG5LnHTlLrGzRwH4RoAp//saBvxxYX2V75yG7XauuAykVtVxLXbtPzbnQwxYtW3PdT0 dqCwWJ/jUsf0UIXgnqiu2sEn6i6dBb6y/ETrPE/6Kx1zZ/DbAt3bGrJrBM/hRPWyiE2k 9967/k3hWPQlGk8w7kDVqJKuXn/G41c+VZJLkzR0PO5hqM9nqIbsOu8EMANU6M4i8joi ixyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MARKIkgJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r10-20020a50aaca000000b0045cdea002e4si166064edc.66.2022.10.24.09.08.50; Mon, 24 Oct 2022 09:09: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=MARKIkgJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233417AbiJXQIF (ORCPT + 99 others); Mon, 24 Oct 2022 12:08:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233284AbiJXQE0 (ORCPT ); Mon, 24 Oct 2022 12:04: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 134AF11875B; Mon, 24 Oct 2022 07:57:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 50D62B8164F; Mon, 24 Oct 2022 12:20:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99A68C433D6; Mon, 24 Oct 2022 12:20:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614006; bh=CifxF7W0vyRSTNa9fDJ55Z8Vyy7rXSy4F/Ob9GWNSg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MARKIkgJbpZnoyM84G8+F0KpZwMF1VYfu9Ph95ubmsaUBJUepxkMMjnF8a49zBGzk 0l8l06GL8e8pGIiZHhAvqgaylvtx195yXSazOZ6egjFhJy3YM8l5jjJ5X4kzzGfqGd df+3tvaoJPBuvWU4UnNq6HZjCedGjj/VFOvlYzBE= 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.10 097/390] ARM: 9247/1: mm: set readonly for MT_MEMORY_RO with ARM_LPAE Date: Mon, 24 Oct 2022 13:28:14 +0200 Message-Id: <20221024113026.786635168@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585868336964435?= X-GMAIL-MSGID: =?utf-8?q?1747585868336964435?= 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 86f213f1b44b..0d0c3bf23914 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -300,7 +300,11 @@ static struct mem_type mem_types[] __ro_after_init = { .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY | L_PTE_XN | L_PTE_RDONLY, .prot_l1 = PMD_TYPE_TABLE, +#ifdef CONFIG_ARM_LPAE + .prot_sect = PMD_TYPE_SECT | L_PMD_SECT_RDONLY | PMD_SECT_AP2, +#else .prot_sect = PMD_TYPE_SECT, +#endif .domain = DOMAIN_KERNEL, }, [MT_ROM] = { From patchwork Mon Oct 24 11:28:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9651 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp534193wru; Mon, 24 Oct 2022 09:10:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7VMizm6KQorJ/PBvRGyAcHU+Je6fpJeVYnINarSaFKf95E8KY8mfD1hfQXY01KOm+1I4UU X-Received: by 2002:a17:902:e8c3:b0:177:f078:7871 with SMTP id v3-20020a170902e8c300b00177f0787871mr34447679plg.90.1666627844213; Mon, 24 Oct 2022 09:10:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627844; cv=none; d=google.com; s=arc-20160816; b=PPkvEue86XXevEPdFlJ4SQYOHYhfXIdp236OxcodcINAD48sDVb01WhMAuMXsqd+2s ABxBh1ArzzxAnHrO2DQIi9IzyltjW3pz5V90EaMsXftn7yVB3CZXb/fHl/RmHkdTpmDD AFkJFqKg9XHU4o97bwWm9l+6d64JQJQPCqz4IQ+dWOE7QwXaCccgBQCiN2V1TkkeSV6L aMkHFTVSMVsCf8+PSjXSaPMrNiYMJcgAMBsL28LRVrkDirEISVMbUQmk20BZsnD6Xkf6 mSgAn1EVOCur459VOScNBBh7wBDViHRmGXmmcFKFBql+evEIAO6fN7/VrVhNO+KHCBHj CAQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=K4l43jaR0B92t29F2muHhccMNTRGpmNRFhKOby5lRRk=; b=aqvuY/aML8WEkFdrh4wQ5ksBVgQAr3i+Gh3GpgO5/iO1tuEqkTbtnvHcz0q6tD0267 UZ62gLP2m6hyI42aFf/4HN/X8H1Hufw5KY0DtKMaj19tcHvFlSFXAhAy+EIyw1wjIBcS WtZ18UI7iUrnjUgqXts0QGB4WMUeiWhtzYVp84xj0YYo5s7n9+ht2P0GaAD4O3fVrbzF js1uwSrQf8Flp9dal89IcHfjgr3CYKB4dVpQDQXIL6y4jyDcdQEzyZCc7oF8j8WKq6Gq GN8sueNd5L+s0pQdzjHpolz7T/R9NrweSGZ5lcVZz/MNOa1JRIypSMs0xThRwTCCmkgH ctig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eL3NQIod; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a8-20020a17090a854800b001fe4eebefe5si8565220pjw.135.2022.10.24.09.10.30; Mon, 24 Oct 2022 09:10: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=eL3NQIod; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231424AbiJXQIZ (ORCPT + 99 others); Mon, 24 Oct 2022 12:08:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233400AbiJXQEl (ORCPT ); Mon, 24 Oct 2022 12: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 89BE325E8B; Mon, 24 Oct 2022 07:57:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DB583B81645; Mon, 24 Oct 2022 12:20:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35566C433D7; Mon, 24 Oct 2022 12:20:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614008; bh=CuwPXSO5nQD6+tQbPlDUkxV3DhhtWO58vcsfSI7QTA0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eL3NQIodQmRch5yYYddPDcm9q0FuiuAiJuPZI1Fu416+6r6/qa8azaBHRpfEXnsVZ RtA86RjVaQDVCpr6b6EX6LleWeX2th/p1ZXotzmI8xQgtW23mhJeu67HFVjxj/CYHM 12pJAvS2dq+XdzBDQsapRCVMP8GU7H8w29GTWx8M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sami Tolvanen , "Peter Zijlstra (Intel)" , Kees Cook , Sasha Levin Subject: [PATCH 5.10 098/390] objtool: Preserve special st_shndx indexes in elf_update_symbol Date: Mon, 24 Oct 2022 13:28:15 +0200 Message-Id: <20221024113026.825316947@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585958669643785?= X-GMAIL-MSGID: =?utf-8?q?1747585958669643785?= From: Sami Tolvanen [ Upstream commit 5141d3a06b2da1731ac82091298b766a1f95d3d8 ] elf_update_symbol fails to preserve the special st_shndx values between [SHN_LORESERVE, SHN_HIRESERVE], which results in it converting SHN_ABS entries into SHN_UNDEF, for example. Explicitly check for the special indexes and ensure these symbols are not marked undefined. Fixes: ead165fa1042 ("objtool: Fix symbol creation") Signed-off-by: Sami Tolvanen Acked-by: Peter Zijlstra (Intel) Tested-by: Peter Zijlstra (Intel) Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20220908215504.3686827-17-samitolvanen@google.com Signed-off-by: Sasha Levin --- tools/objtool/elf.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index 5aa3b4e76479..a2ea3931e01d 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -578,6 +578,11 @@ static int elf_update_symbol(struct elf *elf, struct section *symtab, Elf64_Xword entsize = symtab->sh.sh_entsize; int max_idx, idx = sym->idx; Elf_Scn *s, *t = NULL; + bool is_special_shndx = sym->sym.st_shndx >= SHN_LORESERVE && + sym->sym.st_shndx != SHN_XINDEX; + + if (is_special_shndx) + shndx = sym->sym.st_shndx; s = elf_getscn(elf->elf, symtab->idx); if (!s) { @@ -663,7 +668,7 @@ static int elf_update_symbol(struct elf *elf, struct section *symtab, } /* setup extended section index magic and write the symbol */ - if (shndx >= SHN_UNDEF && shndx < SHN_LORESERVE) { + if ((shndx >= SHN_UNDEF && shndx < SHN_LORESERVE) || is_special_shndx) { sym->sym.st_shndx = shndx; if (!shndx_data) shndx = 0; From patchwork Mon Oct 24 11:28:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9046 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp442331wru; Mon, 24 Oct 2022 06:07:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5CYjd+EObAuTiaShKyMo9NvViD2F/LBoBZrzIkoB0SkIBwAUbdGH+ZHtVChiGZdk8aAccN X-Received: by 2002:a17:902:c407:b0:17f:8bec:e7f4 with SMTP id k7-20020a170902c40700b0017f8bece7f4mr33351645plk.156.1666616839978; Mon, 24 Oct 2022 06:07:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616839; cv=none; d=google.com; s=arc-20160816; b=jOBDO2TrTqe7zRmO0VC4mUjH8bbTWK6kfxaT3nJ33YebPCyO5+naZn/c8QBKd4OxBZ 2mkatiqD6msgLuH9+xr7ArPXNtWOuWIeBxihC1aBKhLEPDpnLzMhhOkbJ3JcdRb5rHYs jPNi41HM28301wdSI+lLzGzipLdNeSkwGyVyXSoS09UX2gZM6ShRJXaRcMyMyOkRt/Mu OPY1IPfLsz08dgAXtL6l3LeA/WhKCKVe/rTKO8yCiNHdIJRnRUdYaK5wIA+EG5LfqZIM yN8q0tCls3CDS4YUlYCA9AqYWYnxKbdptiB/6l3LbzJ0jjr/c2hybLyNWoy0jR/He9sM JFIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3NeK362u9SYuxz8x7Mlvkg676U58gTI3svCgQqoY9YY=; b=X9jVkZXI2YMEfZ3CuortDplf/6V7KnSE8YK0qZ5BkrPHl8JfzqQC8XxM74Or113EEk aGe51hyQIYVdmUvqSVJSilKSvBZplxMuP+iEv3mwPQpDvw86uwoeyQ8pV8QbOniRl8F+ Oc7cSzHv6ix2tAPhwyRXDNKOyopuJsMTb1mAw1/gbb2ppDuEqPWr0Gwu40DyZtvQTLqL 4KgxbjbMgJzn9BUT/57j1Cfj4rbOLuPEBck5Q/fVIbjqzKNIJAK6+gVWy4A/aoOoxBBo 8iqb2ZLGQD0yR8s/ZVt1iogrAwESRZTSUM0pu5tyGcFFLJpHFJhWc4p6kVcw4qQFb5pa 2bIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=J87SWjvD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jf17-20020a170903269100b00174c5fdc8d2si2203754plb.307.2022.10.24.06.07.03; Mon, 24 Oct 2022 06:07: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=J87SWjvD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235417AbiJXNG2 (ORCPT + 99 others); Mon, 24 Oct 2022 09:06:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235383AbiJXNEl (ORCPT ); Mon, 24 Oct 2022 09:04: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 2DBA45282F; Mon, 24 Oct 2022 05:20: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 C925461017; Mon, 24 Oct 2022 12:20:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBDB3C433D6; Mon, 24 Oct 2022 12:20:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614011; bh=kaSLeQO+QPkHMeHmXJ59FjLAZu2CjkLZn8B3+ZzYINA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J87SWjvDQETYh6LHZnA/smt1L3UPptjDC/4brVnHGEPn+f1WOWMW8ymp/9076ZG8K kUVSbNIHQw6+/FZb7Y7fOpNq4fMkZGkZdJ/iGG8tVM7N8/ObUu28DUxT4c0wEkKXTG YtQAWnxW4bPQ69EMhr2UGnwsgpXMw75gy/cFfDPA= 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.10 099/390] nfsd: Fix a memory leak in an error handling path Date: Mon, 24 Oct 2022 13:28:16 +0200 Message-Id: <20221024113026.874772555@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574419285054948?= X-GMAIL-MSGID: =?utf-8?q?1747574419285054948?= 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 f9b730c43192..83c4e6883953 100644 --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c @@ -815,8 +815,10 @@ __cld_pipe_inprogress_downcall(const struct cld_msg_v2 __user *cmsg, princhash.data = memdup_user( &ci->cc_princhash.cp_data, princhashlen); - if (IS_ERR_OR_NULL(princhash.data)) + if (IS_ERR_OR_NULL(princhash.data)) { + kfree(name.data); return -EFAULT; + } princhash.len = princhashlen; } else princhash.len = 0; From patchwork Mon Oct 24 11:28:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9055 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp443069wru; Mon, 24 Oct 2022 06:08:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6fhiAd19yN8DUlMq3Q/K86IRrZikFQD6Ve60ruGBSZW/rSP9VvVX6zYBmfIMj72gShQn/w X-Received: by 2002:a05:6a00:1505:b0:56b:6d78:3304 with SMTP id q5-20020a056a00150500b0056b6d783304mr14341829pfu.44.1666616923998; Mon, 24 Oct 2022 06:08:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616923; cv=none; d=google.com; s=arc-20160816; b=nR861tX/mDvGyXAVFpuENUeb//XjM5q/QuGgH/rSHyFfviN65L9IfL/ab90MI54nB0 KAjqlmTcVBs9oRMhTQxVKs0dRNkIHHaUsIYl19A9iLdeZyMIop1ADzpd7vCPfLO1k1aj gk9Cc30tVXh5xukJiec5aLvLvEwMyn2YzpEe3nksVaAweuEmz+87d45zppSz2Ik0XSNp hfUb9ue1D+3QzotTOW90jsU0gH4A76KPirj35Y9AhUcRDHwdTHjM9Rl+nqCjmZrxd1Qr nLMawl+9Oj4gia5R2KY3yzf+QamEuMBO8G/evPxvoBoU4grXRb5z5l29srFDJdfl5LN1 lJuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1nGl0UhO7jMP2W4DUd+tdArh7p/tKj28k1KVvF4Vuv4=; b=b2BonyzGd9anM4VHVZJvIqJ75JbIBmww4ejqMwSVRi5uvb8SumT4rdZG1R/yZn8KQ9 F4NwlrZy6unigo28lf7qNpQZrWPYpFkzhgxUUoRLKIafiU6px06HykbKnrkd2vp9Hz86 x7BM/fYfphYflw56zYrxS5ugDkd0CgorB3xwh2IM5BHi00A3j893MjYPc/6jVG9hsksH 2XkqgXq4LU+qp6d4pfDh8/LAW5dJC9SFQM5+FYKXFPNHJFEsIPUtLyCtjdjopXRirTHj p6nZzp6Z7oySdrKCG7l0U1hU5XzRVxJEFrXNVb2o4OojaE2jvl0UrhNmeuPGsaSoWHfJ EmRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=x1tHH8Lk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f6-20020a17090a9b0600b002009ed52bf6si14854099pjp.19.2022.10.24.06.08.02; Mon, 24 Oct 2022 06:08: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=x1tHH8Lk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235180AbiJXNG4 (ORCPT + 99 others); Mon, 24 Oct 2022 09:06:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234765AbiJXNE5 (ORCPT ); Mon, 24 Oct 2022 09:04:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B289882612; Mon, 24 Oct 2022 05:20: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 15045612CD; Mon, 24 Oct 2022 12:20:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27C82C43144; Mon, 24 Oct 2022 12:20:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614016; bh=rNQYDcUVXn/gvEku+qTsHCMt6tZHLfUPTBw54RFZlAc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x1tHH8LksS1dJFuzDnMD9fDXey7kQGXnwAXc03eradnLGVs6Z2bkCIldbRQFo1kNu wHf2Ze+NXfqeQpg3bCN6HRO8e4Ih2NKKCGpFFye9IdrQfHURFLBiXeb4Egs/17mmsv XX1ZdB2UYei0j8Vr7923UCr5RrhnX3yuy4MXcIrI= 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.10 100/390] wifi: ath10k: add peer map clean up for peer delete in ath10k_sta_state() Date: Mon, 24 Oct 2022 13:28:17 +0200 Message-Id: <20221024113026.923199530@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574507340989707?= X-GMAIL-MSGID: =?utf-8?q?1747574507340989707?= 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 b61cd275fbda..15f02bf23e9b 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -853,11 +853,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); @@ -869,25 +894,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); } @@ -7470,10 +7477,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:28:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9052 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp442854wru; Mon, 24 Oct 2022 06:08:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5pyDPppDC5k1OJ3j10ouowk53SPw9ybkXPzaC0u9Xv4IAPx+6N627JmY+yZDdTt9Fm56tk X-Received: by 2002:a63:8942:0:b0:46e:c02e:2eb5 with SMTP id v63-20020a638942000000b0046ec02e2eb5mr13909243pgd.141.1666616896596; Mon, 24 Oct 2022 06:08:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616896; cv=none; d=google.com; s=arc-20160816; b=idCK6jTwwqwE/4AZBSEODVxvc4g9OlTK1uVBwgmPSx8CQE1bt/pDlayA09kzmNZabs sRzlqYCIRUYNRaljVtInFFOP/5eta0YqGd8jS14Cih01BZEFeCbFD5PGm5gOrdgSLwPU Fq+mztNEK+GWEb4Qg9L0ioTZ86LOAS6njtVOtyX7JgMoVtQyL8vA3t9ZMlRosPiVtrv3 64jxjscMYWBHP6tcGOkqlMJC9vcs8yeAWUFddb4MmejZw/gLJScXZLMO6i5U9fxoBJyI dHl1dcf3IcPvRhGcDKl1eius7xaC/0FW4JP8rFH3B7wOzui6ucLW2KRT5RQgiD+Vi4MR 9PKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FxP8tT6eyVu7nv5a42B920pgQ2+LVokTr+HFeQWW8Uw=; b=uzLyuIre8/qUJCR+mI9l6q7T5lPG5PR0gisB4TnXrHNbmxNZxRXXXIS3qtSKeTQK5D /FgYyiXJHEiBHIhaLir0gvir6nrW+Tm/sRzCkNrE58F2p5zzInuXwlW57H1kZHN3Ppd8 iySpBfouu44nN6AW7EL9YQoEVy9X4vLYfnv61hOSOC9RikM86Cpxc9PY13vFX/mae5Xy HC95Q2qvKgcfJ3XSzX5O5dFdK4X19UdRVqrqui35pjexUXSRYNbzpo6X6sG/cEXwcXZW GeLDWQD38luVVQ4WwzayMEIK//lQg/5dc5du2kFk4BNzWFXvameaiYQIrqWhRL565srh 437A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XSxeO6gD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b7-20020a656687000000b0045160a30fcasi31643366pgw.388.2022.10.24.06.07.59; Mon, 24 Oct 2022 06:08: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=XSxeO6gD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235451AbiJXNGs (ORCPT + 99 others); Mon, 24 Oct 2022 09:06:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235448AbiJXNEs (ORCPT ); Mon, 24 Oct 2022 09:04: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 19E3A28E05; Mon, 24 Oct 2022 05:20: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 AEC246121A; Mon, 24 Oct 2022 12:20:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3FFEC433D6; Mon, 24 Oct 2022 12:20:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614019; bh=sIn65kFsw5TkwhcgJC0jUs3XxU0PmlPv+E8myZA6wO8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XSxeO6gDX1vx/8IKmv1YxgebKq8sGp/FSbB8Q4UZiHVDbdM49uavXqC6Yf25sLYzp AitMfqHVbXHiBJt1jK8TGorAJBfCtYaWCE+vnMCJQM3gLebKtDMs/z5L9QpJSV1ow8 9bXE1qEV5Sn9EMHvDh1D+XUoizWGQqhVTXPu7qPw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Machek , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Wolfram Sang , Sasha Levin Subject: [PATCH 5.10 101/390] leds: lm3601x: Dont use mutex after it was destroyed Date: Mon, 24 Oct 2022 13:28:18 +0200 Message-Id: <20221024113026.973380803@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574479206039262?= X-GMAIL-MSGID: =?utf-8?q?1747574479206039262?= From: Uwe Kleine-König [ Upstream commit 32f7eed0c763a9b89f6b357ec54b48398fc7b99e ] The mutex might still be in use until the devm cleanup callback devm_led_classdev_flash_release() is called. This only happens some time after lm3601x_remove() completed. Fixes: e63a744871a3 ("leds: lm3601x: Convert class registration to device managed") Acked-by: Pavel Machek Signed-off-by: Uwe Kleine-König Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/leds/leds-lm3601x.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/leds/leds-lm3601x.c b/drivers/leds/leds-lm3601x.c index d0e1d4814042..3d1272748201 100644 --- a/drivers/leds/leds-lm3601x.c +++ b/drivers/leds/leds-lm3601x.c @@ -444,8 +444,6 @@ static int lm3601x_remove(struct i2c_client *client) { struct lm3601x_led *led = i2c_get_clientdata(client); - mutex_destroy(&led->lock); - return regmap_update_bits(led->regmap, LM3601X_ENABLE_REG, LM3601X_ENABLE_MASK, LM3601X_MODE_STANDBY); From patchwork Mon Oct 24 11:28:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9680 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp535565wru; Mon, 24 Oct 2022 09:13:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7LOYjDSWuuY2/+tFGI7mxoakwJdEesYpjwaTYRga9tmVHaVL1P5n9EFvgQck4BeyPP8pJh X-Received: by 2002:a17:90a:c258:b0:20b:23d5:8eb2 with SMTP id d24-20020a17090ac25800b0020b23d58eb2mr38371564pjx.85.1666627990269; Mon, 24 Oct 2022 09:13:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627990; cv=none; d=google.com; s=arc-20160816; b=JA+BToEiaE98B1B6GhpF3eCw86tncdIRsgC2j5SQyXR52kR7zrsSebRdc1wTp1MKzg 6EewsrzA1nP7lG0/0k5XQ6WX3O0659Eh0WYnAXRbSapnintif3KsnAZaxzCziKwrkLD6 p8rE2mS316OGfDT39G+LF0IsmxFS5ujkS4hfOQqDHoa9qj5twszXaw8xZqTaVLjgZgKg 8BGFmvMfGK12CBJT4gDdgM5TeNdk+bpF2Nz+BWrwvvOCLSbHSJucDolPrrVexiZVP2H0 LpfgPKlwyC95XZMiEjhAtN0UOBokD/dWH+oU3m42qBmBbtlNwTOE91hytfRsnc5xyqaD PsMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DiKZfw5OrjXcuVZIIV+EJyTpWnGEi484QH5Xtd4eZU4=; b=Q9OFb46eWyh+LNCW/UZIAzBGqP/nlpCYxun0EZR5iMfvTmyaGvfU47wKgCO7/PdvMM VqjJpc5iDXKh55OnYTC7PGP9QnvstMBkAEMHLw6qqYcuMD8xBEg170TqEHNwFJaFahFB LuwO/oTS4OzL7u0t1vKjoiq/9rLLHBuCXd9vv7OTOZ90PQjXn9fCNuUV1xekXoHiUKRy njWLImxBicr9mmdlYRQ9nDSEfg04wy/+n2doF9wmmeiUpCEwYVirj1rnYmYNUMoFgSC4 o+o4eDGAX1adQRno0tBfxdv9dOqAJA0JHL//MLoHx45C8PUBlf9ehPQSDgXAv5bC571O SvuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=r7Yym9za; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id me4-20020a17090b17c400b0020dba4e1b21si530681pjb.0.2022.10.24.09.12.55; Mon, 24 Oct 2022 09:13: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=r7Yym9za; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232797AbiJXQMZ (ORCPT + 99 others); Mon, 24 Oct 2022 12:12:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232777AbiJXQFa (ORCPT ); Mon, 24 Oct 2022 12:05: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 72486264BE; Mon, 24 Oct 2022 07:58: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 1BF06B8164B; Mon, 24 Oct 2022 12:20:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63155C433D6; Mon, 24 Oct 2022 12:20:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614021; bh=JTuqz7XI2XwjVG0MMTdnj7U3jbDzFHngQ8w9OjJuMJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r7Yym9zaMJtdAqE69NhWf4XMsZh+0EtmfLILz54tdpvrz7JLofO0C2d6t9by3C2Q4 uEESPq6lPGvdWlFDDeNVDqwBljaiZRGySReHm4mprVzy5xSLJgwHbnvBMygY5cZ3ga 6zvOYRexv4O+1XgMPvph05y6wpuhL7DDcjTcEz74= 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.10 102/390] wifi: mac80211: allow bw change during channel switch in mesh Date: Mon, 24 Oct 2022 13:28:19 +0200 Message-Id: <20221024113027.012358409@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_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?1747586111780776558?= X-GMAIL-MSGID: =?utf-8?q?1747586111780776558?= 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 8010967a6874..c6a7f1c99abc 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -3357,9 +3357,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:28:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9077 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp445415wru; Mon, 24 Oct 2022 06:12:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Um+Px6LshXWAlUNQkr1T4k7EsgUHbKz+TmKzfpeJql8/J6P1bMquRc89suQfzU0o29zDs X-Received: by 2002:a17:902:d4c6:b0:186:850a:4f09 with SMTP id o6-20020a170902d4c600b00186850a4f09mr14714013plg.77.1666617153984; Mon, 24 Oct 2022 06:12:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617153; cv=none; d=google.com; s=arc-20160816; b=KW3J9wV82V1V2ljUC8cO8IOzHB62TCI4TBxEfyRjYIPT4x5+Qpa6sU4sNcXz3W8t65 BTtSHSIuznPpwfl+zpVObjSh5Gp5pEZ9Y0G/8kWrISotYLa16115ImNGeyexWCHdJ8Ht GvtCGN0REDbZoDlrXrLWy9JAcH+5dwcQUOfO2RkltsSK73njZCaTBG6vVaUByPzpQ+nJ A+4qeGhlEaHiMwTitTbsNTC2C1uBlHDemxioTBCrqBrU1iRBu9TLSYSEgcfDZ9MRF2jy 3Qkc8QpLxBHxuTfPWTptwz5wSo1ID27EPrEn40uyvuUhNlmwczkY23zbU0wb+wCHMW+o 8Q3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=E69hr2fUkCzNDsf5b15x0y6Hz+LBLNVjdeD6fkW/pDU=; b=0gvJruhjJDSEO1KtrpQgwLUUpjixoNWRbsN8wG6mBaCeNQa17ArGUB8bdPFYNDMr0x xDPvjO+eNaHDJKTBZLlY9N7iWIwZHc/XvrU0Xpi8y03b9GdzIaB92tDBNxWTZvwB09D5 MaIG7ZdaOH+ZABZzpefaXDBdlC7OiljPoxodXEvCKyPvYV3guKL4mAdz0HOhPHmirL9s UT6ogCZqyTj3sxqsxoOVEu3h6nyGqI4MupMgu2baQp5xXQxcbzDeVVFxY0anwf9AtZ8k 68Qc4VEE7wWK5G8K5e7B2brS791CyegQ7gnzcUnPpVoiqeJJ1HjUBdm+boxLpNI6lhzy dTAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="DGNg8/nO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y13-20020a17090a474d00b0020a880cf1cbsi8637924pjg.134.2022.10.24.06.12.20; Mon, 24 Oct 2022 06:12: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="DGNg8/nO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235648AbiJXNL6 (ORCPT + 99 others); Mon, 24 Oct 2022 09:11:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235800AbiJXNJk (ORCPT ); Mon, 24 Oct 2022 09:09:40 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20241A030F; Mon, 24 Oct 2022 05:23: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 sin.source.kernel.org (Postfix) with ESMTPS id 14C9ECE1323; Mon, 24 Oct 2022 12:20:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07669C433C1; Mon, 24 Oct 2022 12:20:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614024; bh=MDq74IDoaSx8NT65BkbK9O4FQ2r6jWC7helViqns7qE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DGNg8/nO8KpojkhvCZYzbc/zOfDKT/LV2foTfWPpsW0qXnqCa4ubUGnQQTVaIcC+f jIpEo2qku5Ej/p4RrvU1vYLa/mjzGCmAkrSiwlvxJh3mFx+WueIrZ7Dxmk90aK34t2 0jR73aYfPrI2jBv1iGLOF6n6zBZLVGCYAPVbhKbs= 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.10 103/390] bpftool: Fix a wrong type cast in btf_dumper_int Date: Mon, 24 Oct 2022 13:28:20 +0200 Message-Id: <20221024113027.058117575@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574748510320267?= X-GMAIL-MSGID: =?utf-8?q?1747574748510320267?= 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 0e9310727281..13be48763199 100644 --- a/tools/bpf/bpftool/btf_dumper.c +++ b/tools/bpf/bpftool/btf_dumper.c @@ -416,7 +416,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:28: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: 9682 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp535623wru; Mon, 24 Oct 2022 09:13:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5uYcuhAG+9ApKq/z2dJcpgV5sfXJITYalI0wyBOJzfb1IM6r8sv/5LnKKzF5cXX2sz+AKU X-Received: by 2002:a17:903:124e:b0:179:da2f:244e with SMTP id u14-20020a170903124e00b00179da2f244emr34332413plh.169.1666627996602; Mon, 24 Oct 2022 09:13:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627996; cv=none; d=google.com; s=arc-20160816; b=VQj+A6jy0j3Z/gtNLXPofxGv461TADceYlw51vzFJTZyEhxlaOb/bv+R7WQxCRgpzv vYlvXugrpb/I+BDbmNY0qgq5pt/D43K3U1qVPfNuKt8AEWriE+VXJ26muEGzXBWAp6PK b/5YZPo5tAZ3CbMbABVOsnWqzPFTXuCk7sBQLO/AEQ4VJSvZjEZedEwr3krYidtlqmSF lHJ/5F93qAXNpGnLP8T30D/RbuGxNu6ej5CiWx4eoJsBUoSfHzF6NGt5SKZD1rU0DsEM QQZzZOgNNgPpEAUAScIJHUKn+9Qfvz65ozufkzEMzmqQOsbHgUJnWw2GY01fu9BuSlFO 32bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1SLUKWCGmB66dYqcLSnFazvp5hUW6/FmhLUOspQSX28=; b=ba2iqV/ee9WPtbXg7Cyl2bjxN1Ai52EvTDEtSjbVwwo91JaeUIWVYhenuOU9/dx6zR aQe2lHCzrfDdbwrrLytu+hb4cqY01LfDc/GxElrRX/pW09IrECj3Gp084FFLl+ZqaNa/ jZPKJcAWBS2bIAFuc+rrkRQEgqBNKk2x8aRAqFR/NqGs2Rcx9lA325H+z+i/vjeIoJJ/ fGVDtWHVzXC8YfjqStlh45vap6Fesv3nYVVZ2QDc6HMQbRLU5xsz5U3JbCYqQ6r5B0Lm HeySA27eGnaS0iA9amy+WMz8xHuHz+izWB8TsFVdCimfwuV9kK5ZJJVbDE7fpyW3cLxS Pb4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RIweRbOU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f7-20020a17090ace0700b00212cae10683si8181367pju.69.2022.10.24.09.13.03; Mon, 24 Oct 2022 09:13: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=RIweRbOU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233628AbiJXQMj (ORCPT + 99 others); Mon, 24 Oct 2022 12:12:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233050AbiJXQGK (ORCPT ); Mon, 24 Oct 2022 12:06: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 3CB5F3337B; Mon, 24 Oct 2022 07:58:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3EE20B8165B; Mon, 24 Oct 2022 12:20:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DFDCC433C1; Mon, 24 Oct 2022 12:20:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614027; bh=KTZcokemeTem35PNMjBQHPCVWK2pq04hPNhpZ0yUFtw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RIweRbOUdJCd3qfpQYoQRTHd9cuYtQiVXnEtZMVyO3cJsAD7XGuKxLAv0R6Roj9Zj Q0IJNmQxhqOiLwEwmEADnF9P5SNLIyoL6TN95s0dE8aNe3LjbNHLVX2gFy6gEZapWf PBeMjPJJlJ2kmvi5CMpOQJq0VKVtOk3s+2XGnz4k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Matthias Brugger , Mark Brown , Sasha Levin Subject: [PATCH 5.10 104/390] spi: mt7621: Fix an error message in mt7621_spi_probe() Date: Mon, 24 Oct 2022 13:28:21 +0200 Message-Id: <20221024113027.110321621@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747586117851930647?= X-GMAIL-MSGID: =?utf-8?q?1747586117851930647?= From: Christophe JAILLET [ Upstream commit 2b2bf6b7faa9010fae10dc7de76627a3fdb525b3 ] 'status' is known to be 0 at this point. The expected error code is PTR_ERR(clk). Switch to dev_err_probe() in order to display the expected error code (in a human readable way). This also filters -EPROBE_DEFER cases, should it happen. Fixes: 1ab7f2a43558 ("staging: mt7621-spi: add mt7621 support") Signed-off-by: Christophe JAILLET Reviewed-by: Matthias Brugger Link: https://lore.kernel.org/r/928f3fb507d53ba0774df27cea0bbba4b055993b.1661599671.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-mt7621.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-mt7621.c b/drivers/spi/spi-mt7621.c index b4b9b7309b5e..351b0ef52bbc 100644 --- a/drivers/spi/spi-mt7621.c +++ b/drivers/spi/spi-mt7621.c @@ -340,11 +340,9 @@ static int mt7621_spi_probe(struct platform_device *pdev) return PTR_ERR(base); clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(clk)) { - dev_err(&pdev->dev, "unable to get SYS clock, err=%d\n", - status); - return PTR_ERR(clk); - } + if (IS_ERR(clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(clk), + "unable to get SYS clock\n"); status = clk_prepare_enable(clk); if (status) From patchwork Mon Oct 24 11:28: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: 9461 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp480150wru; Mon, 24 Oct 2022 07:20:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ouw4/KzJr+dL3q03Jd7mW4ImoXhN2J9UwiiKrRTXpKVF4WKm/GS3O7bVaCqL1OJeqVlYV X-Received: by 2002:a17:906:794a:b0:7a0:72b8:2368 with SMTP id l10-20020a170906794a00b007a072b82368mr11001192ejo.601.1666621230343; Mon, 24 Oct 2022 07:20:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621230; cv=none; d=google.com; s=arc-20160816; b=0k2G7q/6CrdgLZ7QaEbjqfh9DCejP710TX1t2RSjZtnM7HbRyPpKZUPZ34zgiptweb 4/jVWWteRPN19Jb7xErOhDIn+f6I7iL0n02l8hoGlN+FGC7DibrDOejA9Y1EGv8v8qHN iwMvq/IY5whEFwa6QtbFk9fNxuAZaluYo49NA181SDyiW37ezWi8swQImIlsvZtI7f+1 4s79Dgsg3TMrXY8/1BkCL+IQuyZiRJT+9FT1RFVViDKA5ijOWpoBPYWKVxH+naCQx27w rLQtaojz42QqC4G2nhAy/hvV7rBPsPPqPe8fjWQd7F1OoiTPWx+dfsj6mC0lGON3VWSp 4gqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Jigm99kcCoNnm/wv2FYQEIRoBaiRTJW72Y2h1KJrSpM=; b=ljjDIZS0CTh3N1JHisEWHldHbdoFBjm6GXMQ4+yCghKsb9DcSVlc76M9Fc6hbD0hQL xxZSeD9kQSx7lwEvLx9cGF/5L9FcaqdLU+DdM5lFlUAsXotWtK84yb6tSSk9jQKCT9Qg SMY7W3NxNtoK18KUratN/3vtwUDbCwkLThCjVAWVkSXwhbtc1BYn0IHWP7P+6onzwVlt 8SpV9GXDfG9DWx/nF7FNo7Hqk8br8PkWe4QVoN+7oMxdO9Ph9RFTjSPNMmQEKCC5iVba ejd+ZfYkQYQSGEWj2MmHJxeGwpK9QF3OO8Ohj6S57q1dOuxHrLffODHUpMBcuK4ugMxz 2ufA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kyLUN2yc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j6-20020a05640211c600b00459548157c7si33033032edw.407.2022.10.24.07.20.00; Mon, 24 Oct 2022 07:20: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=kyLUN2yc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234419AbiJXOIy (ORCPT + 99 others); Mon, 24 Oct 2022 10:08:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237289AbiJXOFQ (ORCPT ); Mon, 24 Oct 2022 10:05:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A28D24315D; Mon, 24 Oct 2022 05:50: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 25D9761278; Mon, 24 Oct 2022 12:20:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BCC3C433C1; Mon, 24 Oct 2022 12:20:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614029; bh=S+wL1Br80nM3uFX/YVg4sGngKat8IEBMLav3+KJKpow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kyLUN2ycmGBUW/r91Z6eBi0+obxHQ6lG22M888ZcExpzXrC5cNIc0A2mjklgy0JlY N0KY9Sg/SmRR1abCMcJPdXGrzflJvSvvn5AQVmXNg55M4sH5ryZBcs/tk8eUlnL1DO 6iN6liTPNZeggxiFIYrFcqgm3WtuyyEVLo9Xtaqo= 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.10 105/390] x86/resctrl: Fix to restore to original value when re-enabling hardware prefetch register Date: Mon, 24 Oct 2022 13:28:22 +0200 Message-Id: <20221024113027.151193203@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747579023203391336?= X-GMAIL-MSGID: =?utf-8?q?1747579023203391336?= 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 0daf2f1cf7a8..465dce141bfc 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:28: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: 9662 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp534527wru; Mon, 24 Oct 2022 09:11:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5yQU4uxklJobYKqAX704UrIpZ7M8f15f9PX94j+T7v8OiKmwKqPdqerLdYfWIDPeVkEmK2 X-Received: by 2002:a65:45c1:0:b0:461:5855:8d86 with SMTP id m1-20020a6545c1000000b0046158558d86mr28411400pgr.436.1666627874789; Mon, 24 Oct 2022 09:11:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627874; cv=none; d=google.com; s=arc-20160816; b=V+f8B4KTuVB1KHHlTXdrWGfwWdTdXGBxAorF/g8EnqgN1JdLnhDq7AL0jE6B8Ny86g j+RU9nSRvIGB6OtFUkSU9Suqy+FN010/UXkvmT66Ng+yvu12uAHC/IMKjT+w2/4XfgPa mnuTxHblbSp/bq9epqTsSS9BTj6xwAR7p8L2rEpkB7lcJup2dU4LCQyU2e6NX7TWUT2k g+ZVog8qtWN0QbanPczNvpZo2omcpHC7r7UQngKrYJjlLFkoWAMox8i3B0LnUQM3Saq9 6kCGOP/gjlMmPmjLeOfFSpHZFZSBLe170Wvy8hDVQFzvJGNEP5S5qSdXzT+Gr1uZkJHK SkQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kOC0fZ+gXywZK//FDdKImoTEfrBjW2CPNINv9vsSX1g=; b=yGzoEb3SjMc6n/N5Q+4zaSFOWdZnPCSv+TI+Sm+anCwaxIo8PWz2kip+mLzoRN1Id6 PQNjIg7DKjZZesGF/ZYEM+w6LXmW57fzVGCdbcSh8hBdKGLAS/0y85AqWmAaGeemo+Wm 6Nbjm0jYvX1TDwa5Ngw71y9XvIUz9PK6XwJs3SyOOx0hAgieM/Own1SmzGoZ0G9rLR4j 7ASKJdEgRnepAVt7Y21X3wlEbNms+exKcS4hqjsudIDHKT4IFZ93qJ1aAJyjj/Yt9e8Q Vk3iIkI8POb4D+8+8JQJl+/ABwKHiDMd9qqsauHhZTBYu3P/vSp+VYqrN6U4C8eI/ij1 aAPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Z4duEwLj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u18-20020a170902e5d200b0018388edd187si41933788plf.56.2022.10.24.09.11.00; Mon, 24 Oct 2022 09:11: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=Z4duEwLj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233756AbiJXQJK (ORCPT + 99 others); Mon, 24 Oct 2022 12:09:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233642AbiJXQEv (ORCPT ); Mon, 24 Oct 2022 12:04:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 332EB2037A; Mon, 24 Oct 2022 07:57:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7A534B8163F; Mon, 24 Oct 2022 12:20:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8142C433C1; Mon, 24 Oct 2022 12:20:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614032; bh=wpKkHDRmyTSy6cvFrclZFS/LNJIZ/HR7B2aaDTv16G4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z4duEwLj9KZW+1HmYDnPsp5zo2PGKfF+m+/Pn05fZobZHPLW7snYXqwmuK11gl8Ji 1nvVj8qT/js/Nr4zFRKobdlTbTu0rsa3YyhEF7X/XEVgUUqvBcSdzlk83B81zqU/EU LVKByTtanpwhpZeP0XerTTllbJ3cesEwaxAew15A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Chen , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.10 106/390] Bluetooth: btusb: Fine-tune mt7663 mechanism. Date: Mon, 24 Oct 2022 13:28:23 +0200 Message-Id: <20221024113027.200760921@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585990072367039?= X-GMAIL-MSGID: =?utf-8?q?1747585990072367039?= From: Mark Chen [ Upstream commit 48c13301e6baba5fd0960b412af519c0baa98011 ] Fine-tune read register for mt7663/mt7921. For mediatek chip spcific wmt protocol, we add more delay to send EP0 In-Token. Signed-off-by: Mark Chen Signed-off-by: Marcel Holtmann Stable-dep-of: fd3f106677ba ("Bluetooth: btusb: mediatek: fix WMT failure during runtime suspend") Signed-off-by: Sasha Levin --- drivers/bluetooth/btusb.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index a699e6166aef..eb6e33d168d8 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -2816,6 +2816,7 @@ enum { enum { BTMTK_WMT_INVALID, BTMTK_WMT_PATCH_UNDONE, + BTMTK_WMT_PATCH_PROGRESS, BTMTK_WMT_PATCH_DONE, BTMTK_WMT_ON_UNDONE, BTMTK_WMT_ON_DONE, @@ -2831,7 +2832,7 @@ struct btmtk_wmt_hdr { struct btmtk_hci_wmt_cmd { struct btmtk_wmt_hdr hdr; - u8 data[256]; + u8 data[1000]; } __packed; struct btmtk_hci_wmt_evt { @@ -2934,7 +2935,7 @@ static void btusb_mtk_wmt_recv(struct urb *urb) * to generate the event. Otherwise, the WMT event cannot return from * the device successfully. */ - udelay(100); + udelay(500); usb_anchor_urb(urb, &data->ctrl_anchor); err = usb_submit_urb(urb, GFP_ATOMIC); @@ -3238,9 +3239,9 @@ static int btusb_mtk_reg_read(struct btusb_data *data, u32 reg, u32 *val) return err; } -static int btusb_mtk_id_get(struct btusb_data *data, u32 *id) +static int btusb_mtk_id_get(struct btusb_data *data, u32 reg, u32 *id) { - return btusb_mtk_reg_read(data, 0x80000008, id); + return btusb_mtk_reg_read(data, reg, id); } static int btusb_mtk_setup(struct hci_dev *hdev) @@ -3258,7 +3259,7 @@ static int btusb_mtk_setup(struct hci_dev *hdev) calltime = ktime_get(); - err = btusb_mtk_id_get(data, &dev_id); + err = btusb_mtk_id_get(data, 0x80000008, &dev_id); if (err < 0) { bt_dev_err(hdev, "Failed to get device id (%d)", err); return err; From patchwork Mon Oct 24 11:28:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9057 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp443222wru; Mon, 24 Oct 2022 06:09:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM68QjhWEyqmqAQyW7EBBU3Mf7Id6GfEOYM2VV1ynbCpll6flw77F4SCc3mTqWoHI9+kxCyG X-Received: by 2002:a17:903:2284:b0:178:349b:d21b with SMTP id b4-20020a170903228400b00178349bd21bmr33575057plh.49.1666616942195; Mon, 24 Oct 2022 06:09:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616942; cv=none; d=google.com; s=arc-20160816; b=bT65dLggZ9lYr1J0SJ9ITCLgYdVzhR+IOyQhzWzVc0VvkGZeSKTycqcSo/hGlMIXx4 DTRTdPHElZSNP8vqxQ5NlI5R2g7InO4BJepYy4B6wBMy+Hrp66I/H5iRURB9xxRZKScC qnVPAjXZ331yoM7FSO+zFfRZWB2ojzQxEfn5COe2yifjdqEPORBWHZTCaX70EK86yEPo 6RvWrOEC0cRbokgh6KtZZMaFvW5ga5QT6L+H4czk8aDKeUyjC5YzRZTkEfnYaCNeF48K Sd2/OFNebMAVD6cQ8W/mQ7LRP6Nsm7I18GFb3gfQ7H7K1z7knlwSKWzjQCYrU+MEnHBB 1SWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vxFAGEv5To1aNe2VFz0QtNbvZ2mOzAUVl8dn4S3vZrE=; b=cqXCsuk7xMgNmjyNIYoxYnoQJPrqM60Sz9tkUbH4chsc9bnNtnTZw4eG+56j+Ub5cs qgqLbYZWusDwBAW3EaeEG7SWbKflUUIEnQcdFkMAvVkclmjYw8hds3VO2QOY5HfHL0Bg PoxNOhBXpFtvyO/SgFhRpFcVQ/YYp7Uu32LFK2V1+qtRt35oSgoiPagRskJH++x8RAOm QfpHwSIuIw5DHCQlnqS0mxrAKAItkcu2PdOHMQkggivZWJ4M4/Zx574kgxqNwwaOBbGS AzaGygVWlxXbHzSDcPTSC5XD+TyLJlkTJ+eckcsyE0CCzqg45fX/eW0WORzmPkbG3wvd O5fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mOeot6D9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bc22-20020a656d96000000b0042b807728e3si6138534pgb.762.2022.10.24.06.08.43; Mon, 24 Oct 2022 06:09:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mOeot6D9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235387AbiJXNH5 (ORCPT + 99 others); Mon, 24 Oct 2022 09:07:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235360AbiJXNGJ (ORCPT ); Mon, 24 Oct 2022 09:06: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 EA91B2CE22; Mon, 24 Oct 2022 05:20: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 5F27A611B0; Mon, 24 Oct 2022 12:20:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 750B2C433C1; Mon, 24 Oct 2022 12:20:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614034; bh=nL/pAzm+dIZFsdEKGBzZs3U4ggfZzyn+WAnDW5EQt4w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mOeot6D9ih3nzfvvNX5WN3spDLUyPR9tvuJ5Y/agP0H+HHpxSuB8Nk+25hNMQ7DW1 bN3SZLa7ZAzWEapUD0fWMguRvJXAAt4vvftNI1AwqiSst6VvE4ojisMTaWumXt/hC2 UWJ3xC1zoDQ1if5bD+D7cwRerB+/qyvmqEwhOcmM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.10 107/390] Bluetooth: btusb: fix excessive stack usage Date: Mon, 24 Oct 2022 13:28:24 +0200 Message-Id: <20221024113027.248824888@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574526831358858?= X-GMAIL-MSGID: =?utf-8?q?1747574526831358858?= From: Arnd Bergmann [ Upstream commit 10888140f09c3472146dc206accd0cfa051d0ed4 ] Enlarging the size of 'struct btmtk_hci_wmt_cmd' makes it no longer fit on the kernel stack, as seen from this compiler warning: drivers/bluetooth/btusb.c:3365:12: error: stack frame size of 1036 bytes in function 'btusb_mtk_hci_wmt_sync' [-Werror,-Wframe-larger-than=] Change the function to dynamically allocate the buffer instead. As there are other sleeping functions called from the same location, using GFP_KERNEL should be fine here, and the runtime overhead should not matter as this is rarely called. Unfortunately, I could not figure out why the message size is increased in the previous patch. Using dynamic allocation means any size is possible now, but there is still a range check that limits the total size (including the five-byte header) to 255 bytes, so whatever was intended there is now undone. Fixes: 48c13301e6ba ("Bluetooth: btusb: Fine-tune mt7663 mechanism.") Signed-off-by: Arnd Bergmann Signed-off-by: Marcel Holtmann Stable-dep-of: fd3f106677ba ("Bluetooth: btusb: mediatek: fix WMT failure during runtime suspend") Signed-off-by: Sasha Levin --- drivers/bluetooth/btusb.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index eb6e33d168d8..80a3d5019950 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -2832,7 +2832,7 @@ struct btmtk_wmt_hdr { struct btmtk_hci_wmt_cmd { struct btmtk_wmt_hdr hdr; - u8 data[1000]; + u8 data[]; } __packed; struct btmtk_hci_wmt_evt { @@ -3011,7 +3011,7 @@ static int btusb_mtk_hci_wmt_sync(struct hci_dev *hdev, struct btmtk_hci_wmt_evt_funcc *wmt_evt_funcc; u32 hlen, status = BTMTK_WMT_INVALID; struct btmtk_hci_wmt_evt *wmt_evt; - struct btmtk_hci_wmt_cmd wc; + struct btmtk_hci_wmt_cmd *wc; struct btmtk_wmt_hdr *hdr; int err; @@ -3020,20 +3020,24 @@ static int btusb_mtk_hci_wmt_sync(struct hci_dev *hdev, if (hlen > 255) return -EINVAL; - hdr = (struct btmtk_wmt_hdr *)&wc; + wc = kzalloc(hlen, GFP_KERNEL); + if (!wc) + return -ENOMEM; + + hdr = &wc->hdr; hdr->dir = 1; hdr->op = wmt_params->op; hdr->dlen = cpu_to_le16(wmt_params->dlen + 1); hdr->flag = wmt_params->flag; - memcpy(wc.data, wmt_params->data, wmt_params->dlen); + memcpy(wc->data, wmt_params->data, wmt_params->dlen); set_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags); - err = __hci_cmd_send(hdev, 0xfc6f, hlen, &wc); + err = __hci_cmd_send(hdev, 0xfc6f, hlen, wc); if (err < 0) { clear_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags); - return err; + goto err_free_wc; } /* Submit control IN URB on demand to process the WMT event */ @@ -3055,13 +3059,14 @@ static int btusb_mtk_hci_wmt_sync(struct hci_dev *hdev, if (err == -EINTR) { bt_dev_err(hdev, "Execution of wmt command interrupted"); clear_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags); - return err; + goto err_free_wc; } if (err) { bt_dev_err(hdev, "Execution of wmt command timed out"); clear_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags); - return -ETIMEDOUT; + err = -ETIMEDOUT; + goto err_free_wc; } /* Parse and handle the return WMT event */ @@ -3097,7 +3102,8 @@ static int btusb_mtk_hci_wmt_sync(struct hci_dev *hdev, err_free_skb: kfree_skb(data->evt_skb); data->evt_skb = NULL; - +err_free_wc: + kfree(wc); return err; } From patchwork Mon Oct 24 11:28:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9050 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp442698wru; Mon, 24 Oct 2022 06:07:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM53AkTx2tyIuU3flwrNKddIdt64pB6/zp9TcA8DEcqDDyDQ4TSaesNBbNfHoqnFnr5F6NKi X-Received: by 2002:a17:90a:520c:b0:212:d135:4471 with SMTP id v12-20020a17090a520c00b00212d1354471mr19888611pjh.71.1666616878483; Mon, 24 Oct 2022 06:07:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616878; cv=none; d=google.com; s=arc-20160816; b=P8KjmPjXPtfPDTET67pYlBFETiaSV8lC3ft7quMm26F0xV0fQsWNRKfjKPv97WoH5Q V7hwiMef5YxHoEUflPlTtzLuu4ePeRncgfafeCBS9CmTlgpGKRcHkp3q9lwvCAX/hdPM add8o7xVXVSo1DWqsyi/n+pJUF13Rd9tDX7djmqFfwG4dQ7w6HxdLd7JE7kFp3uKFC0x /8c/gmviX0bKv0Y/Uhpqolmp01SPkF1d7dJcf0iFtpgzraxk7qnGTh6OoBt636tnmZZa lEL332A+UD4V7Ug7pNfqw7gFkphWCfeuMeDlAETxJZjdiVzTXGHB3+cocu45j41/Hizb QktQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SceBGJr8NSwb80aF3r8bzIX8KWUVX9g+VgdVCDFkalM=; b=c2pCY/UCvjSb0ymFK9DxwehGEQKJwhxfcmX8lfs3huwW3bh8EQdk6OzFw3T0tSDJwc HGa8F75o7Ijwzz3w4D7u8n4THuB80sgiy4Au9hfHEqQcMRaaECnIXlU226jRI8/sLU0A ZhzKvlMCPh0qaJ8XHxlFaOs98DeI7+P/nFauy7hPOr1d+LdsoDJxbE+lOmtwL6dB2c4a 9eR5f4US46woCBW+VJz7I6gHlsWKhe+Jmsv2pCoAgmr8ZtS1v398Eh7I/SaJuE1MdD+z fm4jjCiWUCFBz0lKqaRk7P/S+sHVW4AZk9Cdo6OqM0nAgRVQmqDMH0fGQSO82L5Alu/1 rFig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hsuIQNO5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k8-20020aa788c8000000b005251a2f06bbsi2263816pff.59.2022.10.24.06.07.37; Mon, 24 Oct 2022 06:07:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hsuIQNO5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235438AbiJXNGf (ORCPT + 99 others); Mon, 24 Oct 2022 09:06:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235422AbiJXNEp (ORCPT ); Mon, 24 Oct 2022 09:04: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 409DC82D32; 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 dfw.source.kernel.org (Postfix) with ESMTPS id 0338061017; Mon, 24 Oct 2022 12:20:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10CD1C433C1; Mon, 24 Oct 2022 12:20:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614037; bh=OV4m7KUP2Ogn00c80OLzn4F/OXzDpQCCIO99uKCA0Fs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hsuIQNO5X6/j0c4sZeLI3TWMumJixrB1g6MGEFu3vRkr3XQvNSMbswFSvYiAG4P2N TJSxzLmzActcnNaUhS+M5hwe5Wd7UxEJ8cwczmGUnO3repqXYDkFXq0mkfqsp1DQdx g/RxUha8uTVk5w+/ZWeXtKDXq+LOXgJe7zUKyESM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jing Cai , Sean Wang , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 5.10 108/390] Bluetooth: btusb: mediatek: fix WMT failure during runtime suspend Date: Mon, 24 Oct 2022 13:28:25 +0200 Message-Id: <20221024113027.300885336@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574459967688327?= X-GMAIL-MSGID: =?utf-8?q?1747574459967688327?= From: Sean Wang [ Upstream commit fd3f106677bac70437dc12e76c827294ed495a44 ] WMT cmd/event doesn't follow up the generic HCI cmd/event handling, it needs constantly polling control pipe until the host received the WMT event, thus, we should require to specifically acquire PM counter on the USB to prevent the interface from entering auto suspended while WMT cmd/event in progress. Fixes: a1c49c434e15 ("Bluetooth: btusb: Add protocol support for MediaTek MT7668U USB devices") Co-developed-by: Jing Cai Signed-off-by: Jing Cai Signed-off-by: Sean Wang Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- drivers/bluetooth/btusb.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 80a3d5019950..6efd981979bd 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -3033,15 +3033,29 @@ static int btusb_mtk_hci_wmt_sync(struct hci_dev *hdev, set_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags); + /* WMT cmd/event doesn't follow up the generic HCI cmd/event handling, + * it needs constantly polling control pipe until the host received the + * WMT event, thus, we should require to specifically acquire PM counter + * on the USB to prevent the interface from entering auto suspended + * while WMT cmd/event in progress. + */ + err = usb_autopm_get_interface(data->intf); + if (err < 0) + goto err_free_wc; + err = __hci_cmd_send(hdev, 0xfc6f, hlen, wc); if (err < 0) { clear_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags); + usb_autopm_put_interface(data->intf); goto err_free_wc; } /* Submit control IN URB on demand to process the WMT event */ err = btusb_mtk_submit_wmt_recv_urb(hdev); + + usb_autopm_put_interface(data->intf); + if (err < 0) return err; From patchwork Mon Oct 24 11:28:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9245 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp461262wru; Mon, 24 Oct 2022 06:43:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5s7K8U0qUdOV838jdc9GDzbPE0PvPmJR9QwEO2Bc6mKHYoABnJVE1H6vBfjhxtFAHrlx0j X-Received: by 2002:a17:907:2cca:b0:78d:ec48:ac29 with SMTP id hg10-20020a1709072cca00b0078dec48ac29mr27499546ejc.114.1666619011030; Mon, 24 Oct 2022 06:43:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619011; cv=none; d=google.com; s=arc-20160816; b=mRLEWBr8T0ZmPI1Qozn4C01jyASFxsQThNrEyzxRBLoLhigzsFtooGNknjDgeTOhu8 OcZR9hehv+B4FdFJ+D5/1TUAwj7BIgK8SdH6ENW4Sm3Hf+0TK61nsGTg/hD6Ed/23CKY AfJuYHa4mPRWMjY7OUkEa4IAK6PZfAqJAUkFFgwCYtp+/k1KAPlQFTtciqCYatZ2qvzr LT8K9EBi8ynRHfQMgcFoUj3hE+qmgG4+5g9FMKzAyXbiioO6z+R5XZdHOSKI++mkdVMd Bg1R8bpaIL23FLnzr5J3OqVWPL7C5wGpcDS1qjHbQIbOKvgaZNcTMH2gP4hliKEZ1GxY ZbyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DKbjlp9COskE0iXo4+lPNi6hAr1Vn7NJ/R34TcZbf3Y=; b=E1cZN2ujv/xrw+1BEmjSI7IbhFHRjYOf26vU+btIB0jeo4nlwa38JvfqZcwTWxVwgH 6G1+JlXsWVCJRaR4Cc3p29R7PXqbBF+CHCnGZOGAw4cONwspJT3fVuP+eOJ6Vf9UT3sS +95/odBcR2/1oWBJqgXCBG1B4MRTPnVpDUvJaJjd0y6u8wUFRKNdw4CUbwZli1ifyG/e qwUD4Op6AVydcm0LNEXScUqaHamf5QWO8cJa6WOSSKnTloTgoMGq6v787hPn8MNiXbgT a8ozFZmL36d20NKzYFfmm3xJvUpAP4ExT8TXylLcEhvdEWSViql6UDLyouM0VukNLKhk fNhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AZVR7fqt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp1-20020a1709073e0100b0077b2e822b8fsi25988232ejc.76.2022.10.24.06.43.05; Mon, 24 Oct 2022 06:43:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AZVR7fqt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236140AbiJXNih (ORCPT + 99 others); Mon, 24 Oct 2022 09:38:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236244AbiJXNfH (ORCPT ); Mon, 24 Oct 2022 09:35: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 AC123A59B4; Mon, 24 Oct 2022 05:35:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A41C761015; Mon, 24 Oct 2022 12:20:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0E3FC433D6; Mon, 24 Oct 2022 12:20:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614040; bh=th6X64vBFDGBJVQqdl89pcBqJfv9RIx2T1+TgYlgu4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AZVR7fqtMCc+W4HI30xcLJlCLtXWerU0chXR78Bn2r2q5Xj2Wt9davuYtPukONyoB iAxbPZyRhfj47N7MOTM0tm019+DMQaevHIqjOQRsfTbtdBqJZrOx/v2ShekhnzbQ5A 0mUpFB1A3b48T76tLae1ZBmsuZPfn2IRGyhIjOFg= 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.10 109/390] wifi: rtl8xxxu: tighten bounds checking in rtl8xxxu_read_efuse() Date: Mon, 24 Oct 2022 13:28:26 +0200 Message-Id: <20221024113027.352649546@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576695618274374?= X-GMAIL-MSGID: =?utf-8?q?1747576695618274374?= 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 0d374a294840..9f646964055d 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -1874,13 +1874,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)) { @@ -1891,6 +1884,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:28:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9249 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp461289wru; Mon, 24 Oct 2022 06:43:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM42spOCaWIr/nQaBbo7rFq2Ou102l70nCy8bOg3OQKrOIVwOfDp6OaOrs1bCOym/gnlDoHS X-Received: by 2002:a17:907:3e01:b0:730:a690:a211 with SMTP id hp1-20020a1709073e0100b00730a690a211mr27397254ejc.596.1666619014121; 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=m1zo8gcF3tVBQZX5dkwOK1pRybQlIhOJnwMb4VT66IaTI+1FfDjbz8jzC93pzHLIJ5 CPedWJHKWj6PFiw4rt23XTqjFdKJO47p8HW8b5eDktoXZDWkceOH+W23+nVTwoucgflb kkDZrcxbCortN9E0rFNCftyim/st9kznXFmLre6tDcD9dfValFmw9KNHyGaljNwl+q3C NnL0OwyxKJanVD2KA8tJ3xB0MNIAg2nAbc1xu19/hwO/m5FunP1tI4DUSLgDZJ3PAp3T JZULEpXuw0/NpO+mhSk6fz2JnpD5SFHqqCmualvDud5GNqWSeWAsn9E7jlZdfgYGIV1u 7yMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/Bz1/2F8wcDIMOGJnYsXmMMs1Gg+eAMd2gGJB5nl6T4=; b=md15KpOoHHG1pOEa62xEa2nf62m4v5/m0+4mUooD/AgT3jKL0A24EotkDFnysiKO0z fanbVJUdhsG2hXuLkb+ye7RkxgH6VLm1C5VXMIaT23MF+BeVefgCjbJh35ceo8NpgHy7 771WoMXqyvoG7jXFyKe8oy21QDglbmsujNf6uWDllzOmuSw5Tq7eTJ0WdH+5uCXcdDyk ASXkv9mNNtLQF3yXC0Hn8gHjt3QDZrHNa0AIVTu6cgBps0BDXZMYgXf4kAYgFlfpqq+B HFfO7dkeDYHuUZAFVqPhN99fF6dLHBTxnr6gDYZXj1AXh8JEMLVwcB48Sg6YX20TGPPp jpZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Q0Kd1Ele; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v4-20020aa7d9c4000000b00458bb34ee93si10024490eds.149.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=Q0Kd1Ele; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235360AbiJXNeA (ORCPT + 99 others); Mon, 24 Oct 2022 09:34:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236175AbiJXN34 (ORCPT ); Mon, 24 Oct 2022 09:29: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 76297AC397; Mon, 24 Oct 2022 05:32: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 D4C2661254; Mon, 24 Oct 2022 12:20:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E90FDC433D6; Mon, 24 Oct 2022 12:20:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614045; bh=/1ZCy2yMOfLvr4rzRd2jKrGbKf9H84wkmcfWzYf04SQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q0Kd1Elebq1+0oUxbZe3SGGI87FgXa4XtRWQ4JMn01j5wsWTHQMMA26Z8PnP7DZ9d I7ShUikRKo/wAyaVo1CvJvGxyIMmnU4+AsqHtOvwOWeOqbaWq5JH5jYVaispZNBcD0 3EHkN3/tqyz0+yNgDC7QAYEtR6PxF5AvhmQwYzJM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ian Rogers , Daniel Borkmann , Magnus Karlsson , Sasha Levin Subject: [PATCH 5.10 110/390] selftests/xsk: Avoid use-after-free on ctx Date: Mon, 24 Oct 2022 13:28:27 +0200 Message-Id: <20221024113027.405755567@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576699147216315?= X-GMAIL-MSGID: =?utf-8?q?1747576699147216315?= From: Ian Rogers [ Upstream commit af515a5587b8f45f19e11657746e0c89411b0380 ] The put lowers the reference count to 0 and frees ctx, reading it afterwards is invalid. Move the put after the uses and determine the last use by the reference count being 1. Fixes: 39e940d4abfa ("selftests/xsk: Destroy BPF resources only when ctx refcount drops to 0") Signed-off-by: Ian Rogers Signed-off-by: Daniel Borkmann Acked-by: Magnus Karlsson Link: https://lore.kernel.org/bpf/20220901202645.1463552-1-irogers@google.com Signed-off-by: Sasha Levin --- tools/lib/bpf/xsk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c index e8745f646371..fa1f8faf7dfe 100644 --- a/tools/lib/bpf/xsk.c +++ b/tools/lib/bpf/xsk.c @@ -930,13 +930,13 @@ void xsk_socket__delete(struct xsk_socket *xsk) ctx = xsk->ctx; umem = ctx->umem; - xsk_put_ctx(ctx, true); - - if (!ctx->refcount) { + if (ctx->refcount == 1) { xsk_delete_bpf_maps(xsk); close(ctx->prog_fd); } + xsk_put_ctx(ctx, true); + err = xsk_get_mmap_offsets(xsk->fd, &off); if (!err) { if (xsk->rx) { From patchwork Mon Oct 24 11:28:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9687 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp541407wru; Mon, 24 Oct 2022 09:25:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4TpCu1+myToSAF92Fhx5pxkrh85Y7NNjTu4Kgw9rXr+Fp4ltA8p+UML30xcmbzmU4lCg+M X-Received: by 2002:a17:907:1c9e:b0:79e:6d97:5e0 with SMTP id nb30-20020a1709071c9e00b0079e6d9705e0mr13164600ejc.534.1666628745094; Mon, 24 Oct 2022 09:25:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666628745; cv=none; d=google.com; s=arc-20160816; b=O/0i3LjvQ8qA9Mrw6rVtlrvDBBm+gklIsD6IRzSo41hAmYfKwwfSKXjudC/S/4Ye7W Lx7XCq6MSirjJBd4mTD6WWqWow7yuk4BVMA3o8w5Hg8g3E6lZnqijGjJGm1t6hv6kgF/ 7M5lSCfHuVSG50ZaQuQOJznlQKlir+nx0gtqpV/+VhuxgaK9b3BOFhA72vtpCP9rM4W+ u93s779hWMGXvLVQUe/9ha8RLOYvOxuHlqnu4pnYw/Ugmi1HPs5VfXIsreaNDfjBWPY/ Ft2hH7X9DHciRKaftsPsKYm/CkE9G6eKp5rfvo8O5jbBFXCqBV79TV7bvgOFs7u1WgSn SzGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ExmJEnt0/fd/OJN5YmrVJ1KvA5EFNRhXmOCQdhPUPQI=; b=gQZADIANgqt+66/slJlIwUFDecUtV/oW0+drru7+MUJ6X8XQUrm6OHo0QdnMFCkOoF v9BkCsbRerXMXZQBRodinadsLhXzlwfuN9Wmz2l7i+yvLZmiuLd+l1ovUzrov9QNJVv9 5hEt8kbZjHECoQMYlOOkoQSws7VHMEhVu6h61CuKOgXBENJZ8yR84DugvxjycpkR1BuY JY0LOzWFSHrnLgQpdcYRxK2XGkmn8S+Npxtm0sgvtGOrWLtHE1nb3HE8kU6OALInwozD O9Dv7wEaHWqRdgRBaM6+xd/YQfCQDS1fK4lAHhN7gIkcjrXt4SBKxGHOtzw9xVaoLYhj TaEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ml1JvWYa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b10-20020aa7c6ca000000b004614e263f51si203669eds.118.2022.10.24.09.25.16; Mon, 24 Oct 2022 09:25:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ml1JvWYa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233671AbiJXQNS (ORCPT + 99 others); Mon, 24 Oct 2022 12:13:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234491AbiJXQJ6 (ORCPT ); Mon, 24 Oct 2022 12:09: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 B405312D1F; Mon, 24 Oct 2022 08:00: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 2D3B7B8161D; Mon, 24 Oct 2022 12:20:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8258BC433B5; Mon, 24 Oct 2022 12:20:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614047; bh=3p0ypaTB4ah/NxQ3Z63w0/JXH4OE6rh9UQQyxKabtwA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ml1JvWYaV+jZqghmbPPrZB07LIIQjiAxWquizO8fRtyr6ejto66CqfwKR7dE8Jdw6 iSg08/oy4ZD0gtX4ddTpHXvss8Q3ckgjn8PccB2tvI7LhoywxmlLZZW5wUHb8+khIL PtbldGR6T/Q4Wtl8qKWq9/6FJzERIEghKWaLQVDo= 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.10 111/390] spi: qup: add missing clk_disable_unprepare on error in spi_qup_resume() Date: Mon, 24 Oct 2022 13:28:28 +0200 Message-Id: <20221024113027.444773833@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747586903070554501?= X-GMAIL-MSGID: =?utf-8?q?1747586903070554501?= 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 d39dec6d1c91..668d79922fac 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:28:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9195 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458902wru; Mon, 24 Oct 2022 06:38:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4fczfrn7BytQND+dRe5EdZPMFGTPRQmAXFLTgfY3jAj+bxZ8FNM7kSY6fOpqEXq3m1iudT X-Received: by 2002:a17:907:2da6:b0:78d:3cf1:9132 with SMTP id gt38-20020a1709072da600b0078d3cf19132mr27684803ejc.299.1666618709826; Mon, 24 Oct 2022 06:38:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618709; cv=none; d=google.com; s=arc-20160816; b=DEvxsJKU3x8NX90jQZv/2zm3YAVsCApBs7swFKgKuzrwtl22Ma232MH8b1J0X/7QHD r1ASR2PzJInIay8f5M5ZLZ1TQxfu6pRN2Gg6/SRqE0yiFPXNRZETFpyHfQkOqCt/B3Fl /DLvnGAdWJ2Mw+qHV9iUQz364K20F6M8/jB5bznPuI6moFUd4y9c7KZ3gYv/0tp2Ms3n UXlpgH43nLUSmdM6dUOg0ONBDGXHTTHot16NlhXB62tl48cAgUgGna351ksS1kQK4MM4 E0mqtAfbTGVxIyG3LqYfVUkRCgml5/GHBqkyYNiUbxT4dOc+mqQ7SrD8rnXjn2V1M64m +aaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OR4x1iBJUv8mZQbl6ozuz6UiQFoFpJM2NQKfI6Ax1PQ=; b=WKixoT+HoH2qffVdYQR0swNVouFFZWDSVH2xhQpK3jPIToAY4sdpPsKH/iVKjtGKHi QbokeQdmxqn/OhFPU+VgUp1f0uRiq6mxST0Omw0eMN+J5q27qpW4LWrdxTMxuVXAWll7 JvZowWIvWPgFetlsTjXfMqRqhEZzhTdRKUnfNvOjySGymeSqSwEP4PjH5Ly/Z7fmxIGH 6CT1KnNAIOuvgZlhfwYRkLRdiS2gDgtXyknrVY5tEq7QqRVf3DTKzx1x3ZF/sHV65WWT 5ZlwpjVFc/H7a0UmwjiAk5XuATH8zlH+j7QTXqBwLMy9gHmGKiUTq0UBSkhbnCrvPx7I Evsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=glmoucV+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o10-20020a170906974a00b0078dcdb1c9dfsi30515159ejy.553.2022.10.24.06.37.45; Mon, 24 Oct 2022 06:38: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=glmoucV+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233313AbiJXNXV (ORCPT + 99 others); Mon, 24 Oct 2022 09:23:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232290AbiJXNW3 (ORCPT ); Mon, 24 Oct 2022 09:22:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1328A27B20; Mon, 24 Oct 2022 05:29:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1DE086121A; Mon, 24 Oct 2022 12:20:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 348B5C433C1; Mon, 24 Oct 2022 12:20:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614050; bh=gbWOcWJVIeCSTWsZe9h9k7u01aFXM886CSuh3qHNISM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=glmoucV+4/XZq3d1LfhwLRzpbWjgUN0drDcXO2Q/BDg3Y7ZUI7YFh+c5Oy7qFFpC8 u23qHwZclpj++pW2CW9lVa3xwtpPEfEjncQWqVgFaplJXsJuDKO7V/iGwqWWTGfhN0 Nfd+k/7XWZ67j9m5wLrafiStTSy73cH5YgiqZN2Q= 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.10 112/390] spi: qup: add missing clk_disable_unprepare on error in spi_qup_pm_resume_runtime() Date: Mon, 24 Oct 2022 13:28:29 +0200 Message-Id: <20221024113027.475723989@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576380121756874?= X-GMAIL-MSGID: =?utf-8?q?1747576380121756874?= 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 668d79922fac..f3877eeb3da6 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:28:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9686 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp537532wru; Mon, 24 Oct 2022 09:17:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4T/zHnc3hbqdWd5gwUgdtcdvClhevkcQpjyAg4FXC6ZLR/0qS2SXqXfllNB9m0dGlGbV/1 X-Received: by 2002:a05:6402:5510:b0:459:5ea:9bc0 with SMTP id fi16-20020a056402551000b0045905ea9bc0mr30932185edb.152.1666628220090; Mon, 24 Oct 2022 09:17:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666628220; cv=none; d=google.com; s=arc-20160816; b=Ov6yOzR3yMKZjXCmuNKckWQlU3TN2cB+IAoyfA9y40nJbh1HVaaKxrlnfSOC1Tbaqf Q86ofJkXUWShCgeVWIUiWBZD5zTztMB14uwJb/FEj7ufj91O+55g/XRZG2T9rLZ2waN5 pNTZeG34hMxMNVyuedyGMMOf8b6ujmuVSehZSE521VaFRHBWYpdLhpr1AGeKcyYNeq9g Rz8lWg0YS/zX2/POceAkBLPawaVo96kEXplpsyUPVchAk+niYIUrk4gF8JlXDPYK82Mz tjIi9Kho72xm3Kh6BKHtIHAsXcRL5BBDb6mGI5UJ7oU6R2Yn3aaoJtPdvAyntax/yt9O nc5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IfVhXNuKdzImEfPGJY2KehPMcTY7kHTa0LvhLZK0rCA=; b=Kx2ZKVpkK1nTh+ThsiEEeipfAjNpJrfkZlAZwiNxr6fgo+OzTpv3rVkCFGL2V+Ls9I Mq0oIP6311RqJPYGzHtYn0EiAgg4G+SxP4VaHv8s5WcyPQieizqzUCUrEebKJQsE7zEH wz3k9gASGOHv8XZAlA+gz5JM6j8Z5KFllxjvrRxnPo3W5T9Dl04aVCJ+rNsSXwCvkT5B 7dI48YNqtRmtkc/cUh6zidOu8uGlyAaSKN3L8Mw/YVCWmg1M2H0k2Lxa56gn9VaN8Aia Oey+4FPda89aM2ds4JcGUuXIHrsxLlC/Ii192dPWBU7Wp/ACJnF0bnP77eHMT42vkLmJ 1DxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CDcR1cIY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qo14-20020a170907874e00b0078dc5c888f1si237574ejc.135.2022.10.24.09.16.36; Mon, 24 Oct 2022 09:17: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=CDcR1cIY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233689AbiJXQNZ (ORCPT + 99 others); Mon, 24 Oct 2022 12:13:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234803AbiJXQKZ (ORCPT ); Mon, 24 Oct 2022 12:10:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 044C416F40B; Mon, 24 Oct 2022 08:01:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2F73AB81637; Mon, 24 Oct 2022 12:22:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83C97C433C1; Mon, 24 Oct 2022 12:22:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614155; bh=pUGT69ifJ5OVidgnRzAuPxhCCoewVWUlq0pJhRaVMMQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CDcR1cIYnboUtXB9Mbar58OXagDf3Cl8O8hFg+errX8vIa5bJB4YpmS7AeQOoqzWU WP1Z6h/hPvdQk+pLwkjSlipiYzpRL7TFeIl/z0P1+0+0nyXSBP7733vOhRVZonE6Ql 6lm94L5lHc/7efOuADPkJIrWoKSM2OuOIYW1XuQM= 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.10 113/390] wifi: rtl8xxxu: Fix skb misuse in TX queue selection Date: Mon, 24 Oct 2022 13:28:30 +0200 Message-Id: <20221024113027.513208767@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747586352475745812?= X-GMAIL-MSGID: =?utf-8?q?1747586352475745812?= 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 9f646964055d..e8b4544b5b15 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -4984,6 +4984,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); @@ -4996,7 +4998,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:28:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9681 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp535579wru; Mon, 24 Oct 2022 09:13:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4jW9ICVwOOEGvcPHDwBtSkIgMrtvh0Q6z6Zc42AeOWa4GhusZYBvKyiLpt9cmHS1mXshaN X-Received: by 2002:a05:6a00:a8f:b0:563:3a3f:9d5c with SMTP id b15-20020a056a000a8f00b005633a3f9d5cmr34427525pfl.50.1666627992083; Mon, 24 Oct 2022 09:13:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627992; cv=none; d=google.com; s=arc-20160816; b=l1CxWWLq4qtc1PqIR48Z5f6/cdyuHZZy38+lX4Nr2EfHnA7I86gmGjTkKWY/mFdCZ3 1v9aWOK+I8GoZzIJExM99Ci6Y94Ju7Z5P0GDDsROezkSFpTGLFC/B7zdPw26gfrh5uTI dJXMvmChSmj+zuXwo6i9PgaSMJvGJlOO9F4co6YmYfel93tuiQryZj+JdWigXAhhJcgF xH6TtwsiVPcjqKkRZpq+rjvEFWJ1fFGkix2mp5u9vpvZTxXc18EZSl0T2UCOgphDbNDk /HUGubbrj176G5ZaaXWI+fN/fcXbSPuDlQIMpRkAjK+H8Mrev94N1JUPA8vBpWaiQ376 u4jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bJmKRR/q+kBCiK96k8O/LhdQvMvn+L/FTaOJGRjEInI=; b=H8LSk7HYUwv5cuNJoXDI7mak0mkPcdx+mYm9F/7RnREj4kQJhGItXp4hAuc9+CVTbH AJNpct6cQc1iV/gxydHI/dMymor1eqpUOc1WnQIcutDTZVnzRgkIQLM+y4ogKvj6wQ51 GLtop6yRqGuvphyFix2pfLdOXhaLBI8zj44NhJ1Eq8WKcUOscy9LmugLC8a6yKStnkO+ bSbmPyrSyl11tAk7ecV44no7JscIXBI7YuMnHMq2IYkKkKcCSN21tNiwa7OD1o5nu7Ld jhaKdJkeevEsEvNOsHRZpVoAA5kECMgWFueg7xVRzqCUBxlnVfyI6OoBXFEE/VvCzkZR EoJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jekqU6ZD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u128-20020a637986000000b0045a8b142a48si1932815pgc.657.2022.10.24.09.12.58; Mon, 24 Oct 2022 09:13: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=jekqU6ZD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233982AbiJXQMc (ORCPT + 99 others); Mon, 24 Oct 2022 12:12:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232949AbiJXQFh (ORCPT ); Mon, 24 Oct 2022 12:05:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 759FBA3F60; Mon, 24 Oct 2022 07:58: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 006F4B81664; Mon, 24 Oct 2022 12:21:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C722C433D6; Mon, 24 Oct 2022 12:21:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614071; bh=t3dMiH4XJXVQqT24zBIQwudtQaBoBJjPnA3eH7aaObo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jekqU6ZDNYENkNp8xIw5ls/ARKPbAlMOpGAGlxBjplkMqxhg6UZQd37+11HF1KsLO H+BhRPY74zgIm/wwjGOg8CVchWyRcr8t8uYEYFAHsLrGiDAgpu5F/CAMYa89bIdxMh l5vNJs14GlLSIieMAU/HVKxPPpOXcOMZBnO2rrcw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Markus Schneider-Pargmann , Neil Armstrong , Mark Brown , Sasha Levin Subject: [PATCH 5.10 114/390] spi: meson-spicc: do not rely on busy flag in pow2 clk ops Date: Mon, 24 Oct 2022 13:28:31 +0200 Message-Id: <20221024113027.553271176@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747586113849630004?= X-GMAIL-MSGID: =?utf-8?q?1747586113849630004?= From: Neil Armstrong [ Upstream commit 36acf80fc0c4b5ebe6fa010b524d442ee7f08fd3 ] Since [1], controller's busy flag isn't set anymore when the __spi_transfer_message_noqueue() is used instead of the __spi_pump_transfer_message() logic for spi_sync transfers. Since the pow2 clock ops were limited to only be available when a transfer is ongoing (between prepare_transfer_hardware and unprepare_transfer_hardware callbacks), the only way to track this down is to check for the controller cur_msg. [1] ae7d2346dc89 ("spi: Don't use the message queue if possible in spi_sync") Fixes: 09992025dacd ("spi: meson-spicc: add local pow2 clock ops to preserve rate between messages") Fixes: ae7d2346dc89 ("spi: Don't use the message queue if possible in spi_sync") Reported-by: Markus Schneider-Pargmann Signed-off-by: Neil Armstrong Tested-by: Markus Schneider-Pargmann Link: https://lore.kernel.org/r/20220908121803.919943-1-narmstrong@baylibre.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-meson-spicc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c index e4cb52e1fe26..6974a1c947aa 100644 --- a/drivers/spi/spi-meson-spicc.c +++ b/drivers/spi/spi-meson-spicc.c @@ -537,7 +537,7 @@ static unsigned long meson_spicc_pow2_recalc_rate(struct clk_hw *hw, struct clk_divider *divider = to_clk_divider(hw); struct meson_spicc_device *spicc = pow2_clk_to_spicc(divider); - if (!spicc->master->cur_msg || !spicc->master->busy) + if (!spicc->master->cur_msg) return 0; return clk_divider_ops.recalc_rate(hw, parent_rate); @@ -549,7 +549,7 @@ static int meson_spicc_pow2_determine_rate(struct clk_hw *hw, struct clk_divider *divider = to_clk_divider(hw); struct meson_spicc_device *spicc = pow2_clk_to_spicc(divider); - if (!spicc->master->cur_msg || !spicc->master->busy) + if (!spicc->master->cur_msg) return -EINVAL; return clk_divider_ops.determine_rate(hw, req); @@ -561,7 +561,7 @@ static int meson_spicc_pow2_set_rate(struct clk_hw *hw, unsigned long rate, struct clk_divider *divider = to_clk_divider(hw); struct meson_spicc_device *spicc = pow2_clk_to_spicc(divider); - if (!spicc->master->cur_msg || !spicc->master->busy) + if (!spicc->master->cur_msg) return -EINVAL; return clk_divider_ops.set_rate(hw, rate, parent_rate); From patchwork 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: 10171 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp640777wru; Mon, 24 Oct 2022 13:33:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5H3/gWl7UTT3iwqlYQLeynCt54NyAKimf0HUa+n15YuURmOcnMXgPQKzxm8/ZOlvxgO1wE X-Received: by 2002:a17:906:9be9:b0:78d:2f63:10dd with SMTP id de41-20020a1709069be900b0078d2f6310ddmr29058589ejc.479.1666643611011; Mon, 24 Oct 2022 13:33:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643611; cv=none; d=google.com; s=arc-20160816; b=Nz1Jkb2CkypRrkQG4yRAMAtbueW58Ia0cmHyqCob3N8QGnVeyMNAl2AjcztSecc/RX Kfu337/TqU3+OCtTCevvZvzRO1vBNxIof1l237fXIe5MNIrMDylCtwzyCcWfyLqCCVUH QMvbTEcVuM8V4d9xVtc2AI6TM327u2K3xjqgoBIxBegGUaE103yOmZmP5hqdKzow6r2Y UUiUbnlX9gTzb+gDS9W55q2HnZUZrSHKhVrpLwkToZDESMeiB6sWT+OkfM1ylv9LGGbu 062sTewr4ebBH90QYFHydaJgTtmH06GsyixRM/Xs7hStbNU86II8CrjYJP0x0A7KNJv+ wO1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZGKXmZx6c7GGQMG0dThiu/iRwzJvoZ+8a2VxQTEloZA=; b=ZRk/gYLe5X19FV/kGBLwt8SBZSQNKe3A4CXfc66wlAIvrM1DTYwKaNi4a/NetFr/XO tNB/JI9hjcCdCNNuuE8ZKIcdI1AZ+VfylYvqIAeDYDvnhSP1gH8SU1P2uAmY3aLlWLbz nub2UfQaXBmYTLGkoTHBZNS7IM4yGUlqQWXLEt4HF77f1+J/Rt92UZvYqf11rQmIdTae o4nZYX3yAuvK5oqZ6TsSUtbxGHt0swmq9kbbjPbvrVQUQua+YggoujJFsV/zb2uv9Nwf Ki9oeu68yCO0LinTgTTgywe/yLqj7uRQJnFOVAQEn/FO3Wl/rpweo+aSJV++XLzINVeo 10Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OEty9wcv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa23-20020a1709076d1700b0078d9c0e8971si698527ejc.752.2022.10.24.13.33.06; Mon, 24 Oct 2022 13:33: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=OEty9wcv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232565AbiJXUXE (ORCPT + 99 others); Mon, 24 Oct 2022 16:23:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234255AbiJXUWD (ORCPT ); Mon, 24 Oct 2022 16:22:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23968303D9; Mon, 24 Oct 2022 11:38: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 197BCB815C9; Mon, 24 Oct 2022 12:21:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D81EC433C1; Mon, 24 Oct 2022 12:21:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614100; bh=uZJSkICK2C34aTV38fU/k4A7DgK2gMN2TrjVjEJdnXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OEty9wcvIMqtqD52HKr0ri2n7VhGi50iRwwgwVo8jAT5Eh83d5Xf89o1JAjVUGerR 4vhXn0ufdVBmtCPnb1OX0wdCeVH8ssr+4e9eJrenEy7V8Mok3GhGve2QYXN29nixpx H3nCuh3xOJekjsR1VucvV7iW907zW+By27Qk5cq4= 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.10 115/390] bpf: btf: fix truncated last_member_type_id in btf_struct_resolve Date: Mon, 24 Oct 2022 13:28:32 +0200 Message-Id: <20221024113027.593674651@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602490984889774?= X-GMAIL-MSGID: =?utf-8?q?1747602490984889774?= 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 dc497eaf2266..9232938e3f96 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -2913,7 +2913,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: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: 9072 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp445149wru; Mon, 24 Oct 2022 06:12:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6QViwlIuGtJEu/PqrzXuUdAYjRb4bKty7XvbyZyy54T7EV0OEI1pBI1fvVMTepfmH46IgW X-Received: by 2002:a17:902:c952:b0:184:ba4f:af39 with SMTP id i18-20020a170902c95200b00184ba4faf39mr33463453pla.58.1666617130606; 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=avDwvn21oinmbP1Xu/ixzQx8FEZLLf3uD2YDbPpFc6iC6AZ5kw45HS5d185dm628Hm 1uq1RHahtVk3od80IUGZAxO+pW2AkezA5qTX+hwRXy93lgK+T+nUKPu7LfAZLk6PFk/N zY+a5r/fHVu3cSLFRyFPQ/SkypkRT8AW8jBXwiKQF2V+SJleQrn24ytnNIjUkSLijSOJ aaI6dCUZWIPTmbDtj9O5dCIsO97bQQv2EtcJEK8FjfOb/25rAD1mr4rwd+oRYoMPAxwH z6VWzv7M9armqICbQqIFo/TFl9xof4qBZzXGOdUaek59jwSB0vEZAy1GcB8cF7ufnxFk ISKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0ei/d/+sXN+4gF2wFzHQ+fXdxDl5esUiKnox/P27NkA=; b=cyxTpEQe2929t86TClsnpKD6p9e0+duEHuEYwE/uk7sBABCEfZUKVaSp9kQcXrYBJ2 o17XO6w8hNP8OTFzjBAzBz8Fv64vnefb+UfNrZoEnsZyLb1s1WrNCprbRRQrn1TIixhk 5Lh/L6Fq9BksLOvhWytpcs9i1NMsx172bjpgwTow/O5uIyNATFkUtNgzoKS1O2WNGm3A A+ecCEpZvjUyNcc8RarrTfHrnTt2eM1celB9pvbgW4zdz0lbvKS+w+PoWGDoyaHg8VGO WHrx7XpPm8rvHa174TWwjVsP/AwrTGCGFLT+Lcxkx67aInYlZXkC21oQSpnZ5IV0DXN6 7NMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZeYJA6B2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x14-20020a63170e000000b0044bf9d57c38si37950169pgl.240.2022.10.24.06.11.57; 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=ZeYJA6B2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235589AbiJXNLh (ORCPT + 99 others); Mon, 24 Oct 2022 09:11:37 -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 S235587AbiJXNJF (ORCPT ); Mon, 24 Oct 2022 09:09:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 715589F37D; Mon, 24 Oct 2022 05:22: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 34927612CA; Mon, 24 Oct 2022 12:22:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 439B0C433D6; Mon, 24 Oct 2022 12:22:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614129; bh=Ky/iogaQ9PRQQKPitP+pBUN4AJW3nr4mLiuxVnMARWw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZeYJA6B2+Pr0WykQNocQ7+UqC54tfxY08XWJAw2jvsOWuzAdEGKYuSEoVcPDlWUtI OaBLyf7SXy8ZOGFj+3I2xPvuJhbOFLuHr/+HDJ1TT8QbEolu0mvcUsBtwibtxhDNiw exQ4zp0/0Cit0kFMLiQzFF5JD4kuMhDpXuaYjwn8= 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.10 116/390] wifi: rtl8xxxu: gen2: Fix mistake in path B IQ calibration Date: Mon, 24 Oct 2022 13:28:33 +0200 Message-Id: <20221024113027.632131162@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574724280860664?= X-GMAIL-MSGID: =?utf-8?q?1747574724280860664?= 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 e8b4544b5b15..8668b03bd8c7 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -2925,12 +2925,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: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: 9656 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp534394wru; Mon, 24 Oct 2022 09:11:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7sXdpv63CfWRPXyXGJ9PJ8A5MVvYzlN+DPBWGZtLp5u+pkBQyccOkgBKHZak4mw5S+AaLh X-Received: by 2002:a05:6402:2791:b0:461:c5b4:d114 with SMTP id b17-20020a056402279100b00461c5b4d114mr5413010ede.357.1666627862701; Mon, 24 Oct 2022 09:11:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627862; cv=none; d=google.com; s=arc-20160816; b=S2PXkEm4yZo3MOxobT/2bAj2ExOJeU+KViL8jJh/4zlALOmrXwoubHol5oKQxlRBRT 6ORGh1IiYloU8cNJqrJ5ksU9srC8avRQOuLK0x5mLtRgMBvyyPGv7f3U6MojHGSHrQKO nnamzQ4raiURG5GRgGHRSeyborIzshgeNIKrtwE/PfvkZyOgd3ADoczrBfwiW/+63ARy 5/Z0O3Qr3ZngH3tFHLOp9PpfEXL/G2X5yLKmIFfxxsl84uCf+xJfmxsiIL9vAT1bC86I 0/8PJ/tgZrYC8ZJJL9zUezaswG3X3wRjLFFZzXcvW+icWPtPauHGCK9e0zwMbLvEp7v2 K9bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ret1zIftOr+MzL6xN8H/XPNX9xYF5RdhDJbKOgDPKoo=; b=M/t4gtVGf9ngneJ6ojpPmrdeo6zfgtNq88XDe3s+67CtTQir/ggD/7E2g+WoHz4aH1 GJYb0hguWvA+CU19e+kIK9DolClslkh/XqQ3RdGhBHeDBkDq5pcfBD11sf2soOVY4/km 0I2ykO88paiy/8MBvs5X6FNfEBm5zDM/PGcKwUNTx2XHl29s+GlIgPHFisddrdPeChMF 6T6cf88iZEfwdF35uelBZp7pWNdqxYwDfrHxcW0mgKjD+5Xx5xyuFOlq8h/v/MUGOFti svmKnNutVcHEdaOnWjxEbn1BLgedmd3pVMdQIUf8ZNjqr6aGqauVW/dVYgDc29Q9grd9 ggIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZUijnd0b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id se12-20020a170906ce4c00b007417c6edb0asi121734ejb.402.2022.10.24.09.10.36; Mon, 24 Oct 2022 09:11: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=ZUijnd0b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233520AbiJXQIu (ORCPT + 99 others); Mon, 24 Oct 2022 12:08:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233518AbiJXQEp (ORCPT ); Mon, 24 Oct 2022 12:04: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 0965111DA8C; Mon, 24 Oct 2022 07:56:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 55FFFB81622; Mon, 24 Oct 2022 12:22:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABEFDC433D6; Mon, 24 Oct 2022 12:22:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614140; bh=PukQNIuMJtIKCf6FKddboRSeZ1xofppsG4CGvTuHsD4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZUijnd0bo37TbxBA74zSG9f19ExOG1h/ynE41acGubzlJjQXMS4k3oSZcoA++xk9V sRDPaiPz4sC2etjAXxxoQZmwOWF/aARWPNaNRHKRuSV7N5UVLJmRLwgfsgwvUS2yne GKjZA8NwCyJcIZQroOz+jEZmu7OJzwq9FpsDL87U= 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.10 117/390] wifi: rtl8xxxu: Remove copy-paste leftover in gen2_update_rate_mask Date: Mon, 24 Oct 2022 13:28:34 +0200 Message-Id: <20221024113027.672349589@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585978071991572?= X-GMAIL-MSGID: =?utf-8?q?1747585978071991572?= From: Bitterblue Smith [ Upstream commit d5350756c03cdf18696295c6b11d7acc4dbf825c ] It looks like a leftover from copying rtl8xxxu_update_rate_mask, which is used with the gen1 chips. It wasn't causing any problems for my RTL8188FU test device, but it's clearly a mistake, so remove it. Fixes: f653e69009c6 ("rtl8xxxu: Implement basic 8723b specific update_rate_mask() function") Signed-off-by: Bitterblue Smith Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/d5544fe8-9798-28f1-54bd-6839a1974b10@gmail.com Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index 8668b03bd8c7..7818a7ea0498 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -4338,15 +4338,14 @@ void rtl8xxxu_gen2_update_rate_mask(struct rtl8xxxu_priv *priv, h2c.b_macid_cfg.ramask2 = (ramask >> 16) & 0xff; h2c.b_macid_cfg.ramask3 = (ramask >> 24) & 0xff; - h2c.ramask.arg = 0x80; h2c.b_macid_cfg.data1 = rateid; if (sgi) h2c.b_macid_cfg.data1 |= BIT(7); h2c.b_macid_cfg.data2 = bw; - dev_dbg(&priv->udev->dev, "%s: rate mask %08x, arg %02x, size %zi\n", - __func__, ramask, h2c.ramask.arg, sizeof(h2c.b_macid_cfg)); + dev_dbg(&priv->udev->dev, "%s: rate mask %08x, rateid %02x, sgi %d, size %zi\n", + __func__, ramask, rateid, sgi, sizeof(h2c.b_macid_cfg)); rtl8xxxu_gen2_h2c_cmd(priv, &h2c, sizeof(h2c.b_macid_cfg)); } From patchwork 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: 10220 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp642790wru; Mon, 24 Oct 2022 13:39:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6n1j7go0qprX9RlLzmEH8107B/QeF1YxP11jDD4RTOZMl0B0J1XIcqyhnhBUd3cSztHHL5 X-Received: by 2002:a17:902:e54a:b0:186:a3ba:232a with SMTP id n10-20020a170902e54a00b00186a3ba232amr7865041plf.77.1666643975045; Mon, 24 Oct 2022 13:39:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643975; cv=none; d=google.com; s=arc-20160816; b=loHGwE7P9qmQVAEminJtidp942pK8juN60e6+qFY7iRtJGowFeUb1XTYp37+/BWPDX pgzlZtHIuUb0R31rOq6wulAmJBJGYBjMWUipr+2j+Fm+7NUywdEt8t085eVJEdLEGxfP l6Kepw7mDqdPpS7JjCeqV81eRw0xURrixEIKAR19FVlPdMImJulGos9NDQEBwZoe8g/q vv88UPr2bLWIs01rSjkABISpcANaFNDTAxdzNtpx/COwnw+qFN4mIiojq6d+GKXVzkGA kfV9jYFkzGj2MmzTlDhrMskvaeu177fj+cA+VbwlyEYY9e+wkDSJFX4F4LtZHpSfUWnK 7/5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=zYGSQVv5SXfZF6HMIkeaUTvpgXPYoFKeC+XxZ801lYKp+EHtyKai/3UJSyvUxqcegU hTes9lkOe7Vt0KLXusFjJ/I2LYjGXW3+1edROQMgvKBM9/NEEEDV1CGskYzbq6f9FFOG fF4E1eXXPJqXLDVptPSdb8Obu8HyBf9/aTerhXDZlCG6D6q9BzuEFqRQtW1nI519pCWh LysT+w+leB3zrz4ERc0XvXY39WdFmkOy4x/v+YkVu84CS0QSxqG3FeEXNSdiSnD6/TRb +DXbWXgurvnHsF0gbmWjAtAiK/NU5C2MYyZkR2Jxjbs/Dx0zSSD29DXFet8w8pgR7KGQ Egkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FStUWkWW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o3-20020a17090ab88300b00202c850b5a8si9689148pjr.11.2022.10.24.13.39.21; Mon, 24 Oct 2022 13:39: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=FStUWkWW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234589AbiJXUiE (ORCPT + 99 others); Mon, 24 Oct 2022 16:38:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234539AbiJXUhY (ORCPT ); Mon, 24 Oct 2022 16:37: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 C05282B26A; Mon, 24 Oct 2022 11:49: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 F12E5B81661; Mon, 24 Oct 2022 12:22:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B6C0C433C1; Mon, 24 Oct 2022 12:22:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614142; bh=deb/+f+bTm4Ytyvf8OL7N3yZQGGpLOBi7QxH7ZECr8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FStUWkWWxuZDXLZ2swrvTnoUueVT4ccCVoPAFTvDTkfcJLpMKyeE3VWyseSCi/uyk tYts5V/Pf8iI/rxYOcahZ5DtiBzvAUwMHfbJTSAC5j9XgwmMz+mRxJZgoZNWznDiSR wZhSYg/1hY/1LtJJdZF9xh+fhVhTaWEo6BGsks2U= 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.10 118/390] net: fs_enet: Fix wrong check in do_pd_setup Date: Mon, 24 Oct 2022 13:28:35 +0200 Message-Id: <20221024113027.705335291@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602872699164325?= X-GMAIL-MSGID: =?utf-8?q?1747602872699164325?= 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: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: 9674 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp535117wru; Mon, 24 Oct 2022 09:12:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4hQKZ+fJ4F3BIuCFegaXqJTkhyD3mpkxZRoWtwm8nBYJNgvYmeCcmWllU/VQD09Qw7aQb5 X-Received: by 2002:a05:6a00:24d0:b0:563:6d36:eae8 with SMTP id d16-20020a056a0024d000b005636d36eae8mr34273524pfv.66.1666627944795; Mon, 24 Oct 2022 09:12:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627944; cv=none; d=google.com; s=arc-20160816; b=BHOxJLgXLhJ1O9pIPJ5gMI5PIvb28kz1i+wkXuYK7gto6wnaRCcGdsCEW2xwCESmO+ 6QAkiNekAQYAAW8Xrg9ROiJK0NZZSPUVILgscqfjq6vMq5jxFqouHSyHLIO+LoB1yRhj 7a1t/0wUV39cIQ+NCnz+aCcTuzMLD7MX9vFdCrN0KGGJMsUWS0eFfBGuoZ/a1w3+2u3G aSo1/gk/6qLjjqDr9gH/kkVyratQRaTDOKKJ8HvwF5uG14liHcJvEazmIzw+X/NV1NcB FzDQUWuIVLioaGhizMzKHJ4o3+C0jCSazpxaEMCXQx/JaXrIfvht97k1ldQUtKgXPxns hDSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eSbpPGL3ojDNCDYvWP0bknzBDDVe0KhKpsTR4MFXtJc=; b=buvm5B85wODXk8wfZfd5InOlYR9pvb3E7NtwQLEEv9lR6/Iu51rFBqXe4ieUSVyfKI DLDDeVzHFRD6e68mygVKIE/AncvtnZnp0hUdGjFbdZ+oy8gJ+yQ2u3EF0lApBb5mmz3+ oA04pnVoHJrUc1BRKm8VL4TjuTs5VhafszGGs3YCvDwujEyHQWSXwGtDW5r9SrSZ3QFf ECHq5swMalo1+tOZuzewk+MHogpGSi5kkwsVseLUTYBUrtfVPEEZUPezoL4zqA1iKgxO FD5TsaSkP2fK+gPgDOKQ0J2moZyjr4ko3r9+xtJ11JeiU6AMe7wpsHlHnkEY4+Rc8ocL MrMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xO6vO4ka; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c10-20020aa78e0a000000b0056bc9b188c6si27210pfr.245.2022.10.24.09.12.10; Mon, 24 Oct 2022 09:12: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=xO6vO4ka; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233748AbiJXQLp (ORCPT + 99 others); Mon, 24 Oct 2022 12:11:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233794AbiJXQFA (ORCPT ); Mon, 24 Oct 2022 12:05: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 E8D8B22510; Mon, 24 Oct 2022 07:57:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 942A9B8162B; Mon, 24 Oct 2022 12:22:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA29EC433D6; Mon, 24 Oct 2022 12:22:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614145; bh=dcsN3cYuMFF+AYHBJhPzQlBwMzkk1P7+S/W9/R6kMy0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xO6vO4kavbJyacTK9+bE3XtZ0PZT06ha5V2WGrhmFTVnoOlqoSkye7jMwaiB/WDBF 06f9xz9WoANGMH8KVSiNMTitN8OswJ0uSjnhioIZDVW2c/maL9Yihnes7mGNJFl7Bj GPrZlTmAV/LNYjXL61WAMrWk1kbVyQQV1hSazMf8= 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.10 119/390] bpf: Ensure correct locking around vulnerable function find_vpid() Date: Mon, 24 Oct 2022 13:28:36 +0200 Message-Id: <20221024113027.745111211@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747586063700043547?= X-GMAIL-MSGID: =?utf-8?q?1747586063700043547?= 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 419dbc3d060e..aaad2dce2be6 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -3915,7 +3915,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: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: 9900 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp573407wru; Mon, 24 Oct 2022 10:38:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4bSWYk+MPuT8CUjoWyLnwjAUr7eJ0ZVhy+W16cO5dlt6RHZLKrNATqs8FzHFv2VY0e7L4D X-Received: by 2002:a17:90b:1d08:b0:212:de5d:e9e5 with SMTP id on8-20020a17090b1d0800b00212de5de9e5mr16357822pjb.239.1666633085237; Mon, 24 Oct 2022 10:38:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666633085; cv=none; d=google.com; s=arc-20160816; b=RVVUJsCtoUPHEBoJ0HH1C0HsoR7fnhkQzNNY/xS3+7dS1/b/tBYIYpWaWvbzGQGNsh hm2va1WGMqLSF8+IRjXr4dOP0jOVGulZnnlEOL5KVRmqALxRotDYCEKTjEsxm3Se0Haf newSXKK0ATCJvqqc9PxFJyU2XuHeBtnBdeUsW6OSWNBft+DHCHOnM9N4xKWeFTs2tMKe 1HufAI4RLeqlQTczrYNgS8SWR0nYgCGAjQSMu/iViuN2FJgIBb9oLyn+rIQHF7pLl2UM Ui4XAOX8jptkRfWfoj5cAOPtoM1itVIOfiWV/SSzb5KfYRzv23CznsYVx3k1BIAbLQg4 lvDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LvvUj1Z2VYDxAGteDWLuP0YDnboLOSQLWpMUwhSovxs=; b=aargCCKZNlcObt0ilsH9j/RLpnH8E5diodxpdG5rLOb+Qaxn01TsSo+JtE8g3+gEsI hYIXl6mwAOlOM7HRN9eb8haOCklxD7U4nMtafEhuarDsDNk6U74ofVD+PfFlw9W+6hmN cJbV7YE4C7XMs9dDthBTVAlxslH3gdIDS1BCaPQLRBDh26V10byzhrG54+t+n+kheK5t JtRS5Pa6169f2Vu7QziaH+fKCRE1NPYCAWsBt4xoX3zFuxOJneCBLM8fYvNvFe7oo+MV 9hPeYaAKJIqTNxTHNqh3uUvF7vbrfYd5mVhxb69qGvDlEUnaHTtuMuFuPOUG4ekd16FC IOtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PD7lIgem; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v7-20020a632f07000000b004632ef90079si19520pgv.858.2022.10.24.10.37.52; Mon, 24 Oct 2022 10:38: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=PD7lIgem; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233560AbiJXRhW (ORCPT + 99 others); Mon, 24 Oct 2022 13:37:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231316AbiJXRg7 (ORCPT ); Mon, 24 Oct 2022 13:36:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB3DA239221; Mon, 24 Oct 2022 09:11: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 3C843B815B3; Mon, 24 Oct 2022 12:22:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94929C433D7; Mon, 24 Oct 2022 12:22:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614147; bh=9hOHvcfAshufIN+WX2pbK6ZReYAb5opHs46B1aHl8Gc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PD7lIgemDhF58nMNAENCpybOizSWMd0vYIOImf3Yr5zjyZSCM9o6U8OthQFZOSidR pUGDx+ixORbh5NvYKAuuWsCGqEjFzT297SQiXPmscc+n6wDZhZyfubXDLrwbwIy+Qf YiDFxjJcGYpV4JoiUMfhKCaWu81VJKMbYwj5EFfw= 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.10 120/390] Bluetooth: hci_{ldisc,serdev}: check percpu_init_rwsem() failure Date: Mon, 24 Oct 2022 13:28:37 +0200 Message-Id: <20221024113027.777519807@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747591453677927078?= X-GMAIL-MSGID: =?utf-8?q?1747591453677927078?= From: Tetsuo Handa [ Upstream commit 3124d320c22f3f4388d9ac5c8f37eaad0cefd6b1 ] syzbot is reporting NULL pointer dereference at hci_uart_tty_close() [1], for rcu_sync_enter() is called without rcu_sync_init() due to hci_uart_tty_open() ignoring percpu_init_rwsem() failure. While we are at it, fix that hci_uart_register_device() ignores percpu_init_rwsem() failure and hci_uart_unregister_device() does not call percpu_free_rwsem(). Link: https://syzkaller.appspot.com/bug?extid=576dfca25381fb6fbc5f [1] Reported-by: syzbot Signed-off-by: Tetsuo Handa Fixes: 67d2f8781b9f00d1 ("Bluetooth: hci_ldisc: Allow sleeping while proto locks are held.") Fixes: d73e172816652772 ("Bluetooth: hci_serdev: Init hci_uart proto_lock to avoid oops") Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- drivers/bluetooth/hci_ldisc.c | 7 +++++-- drivers/bluetooth/hci_serdev.c | 10 +++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index 637c5b8c2aa1..726d5c83c550 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c @@ -490,6 +490,11 @@ static int hci_uart_tty_open(struct tty_struct *tty) BT_ERR("Can't allocate control structure"); return -ENFILE; } + if (percpu_init_rwsem(&hu->proto_lock)) { + BT_ERR("Can't allocate semaphore structure"); + kfree(hu); + return -ENOMEM; + } tty->disc_data = hu; hu->tty = tty; @@ -502,8 +507,6 @@ static int hci_uart_tty_open(struct tty_struct *tty) INIT_WORK(&hu->init_ready, hci_uart_init_work); INIT_WORK(&hu->write_work, hci_uart_write_work); - percpu_init_rwsem(&hu->proto_lock); - /* Flush any pending characters in the driver */ tty_driver_flush_buffer(tty); diff --git a/drivers/bluetooth/hci_serdev.c b/drivers/bluetooth/hci_serdev.c index e9a44ab3812d..f2e2e553d4de 100644 --- a/drivers/bluetooth/hci_serdev.c +++ b/drivers/bluetooth/hci_serdev.c @@ -301,11 +301,12 @@ int hci_uart_register_device(struct hci_uart *hu, serdev_device_set_client_ops(hu->serdev, &hci_serdev_client_ops); + if (percpu_init_rwsem(&hu->proto_lock)) + return -ENOMEM; + err = serdev_device_open(hu->serdev); if (err) - return err; - - percpu_init_rwsem(&hu->proto_lock); + goto err_rwsem; err = p->open(hu); if (err) @@ -375,6 +376,8 @@ int hci_uart_register_device(struct hci_uart *hu, p->close(hu); err_open: serdev_device_close(hu->serdev); +err_rwsem: + percpu_free_rwsem(&hu->proto_lock); return err; } EXPORT_SYMBOL_GPL(hci_uart_register_device); @@ -396,5 +399,6 @@ void hci_uart_unregister_device(struct hci_uart *hu) clear_bit(HCI_UART_PROTO_READY, &hu->flags); serdev_device_close(hu->serdev); } + percpu_free_rwsem(&hu->proto_lock); } EXPORT_SYMBOL_GPL(hci_uart_unregister_device); From patchwork 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: 9074 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp445201wru; Mon, 24 Oct 2022 06:12:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5+TCTG9jVX+HSDPA96X7RJrrUmYbm6zc3p2WaBhoDxdo78UeQbXR06Nj6Kg5M0R2ujHAF8 X-Received: by 2002:a05:6a00:a04:b0:534:d8a6:40ce with SMTP id p4-20020a056a000a0400b00534d8a640cemr34206156pfh.15.1666617134201; Mon, 24 Oct 2022 06:12:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617134; cv=none; d=google.com; s=arc-20160816; b=rby0yTeBS31iBwjp+F2SpPzTHMoBUFoMxjjJmaAnB7jm4I6oTyjU0qjAxXMKJWRcpC iIbtlVGXOHhFQ77fdNVwm+Ry/jTN16LQcXgyPR7VTdThKcOXRo6Vuv6or8nJ53+XKMWE XR33XUy/afOpZ0Za3rx+22ZKo5JidHMo+ZvhEerkwzY+dFWe5YrMwBKm/u6dB3dNeD14 +joSbtlcbfQkpDaGVWE7/VZLYinPjiTa5798cfpzwQY1x9OQVqIRENkiLxMDIGKNIeNx mFy3jTvUSfkbMw65Ue1V2Mc6gGeC6L0fiiehf7fngBRyZR7YIWiC7c2hODLwLn7JxQLR G0Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/2KjnGnNPfAZvCC6b1ZXCmgqbb14ZpIgeUfRnnhBc6c=; b=qsD8Z3miXn+1kg0bSwLYvKr2hRv1TCT5wdlJtNUL+ekFnknzyF1L/PHPvCUiE6v8Ef y3nvJmsEO8z8g5rbbWPGffu0Wy+XDUAZxyxM51FOHLKHqLeVc2cPkJBElcVKBtSaSLA2 vQv7AREpbhrlxPsC2+XS4+/0Efoa/mCG+WALHUpZV4XiyRKlb9HWFrKVUiAuke0lAQz7 +6+4KevC/TNhwaYn23J1Mfow4VuPQB29vhSo/1EC0UNASSXVIl54PjqGZCKXZZN1bq4o ONTKLd4baXoxwZmFDW3Sfcf9JUWaVJWyFdr/XPiLDzDrTUcHSLJXOpACUpRKFjfXlWEv 8mAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DKyUj5Oc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g1-20020a056a000b8100b0052dd9f10a47si37422806pfj.363.2022.10.24.06.12.00; Mon, 24 Oct 2022 06:12: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=DKyUj5Oc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235612AbiJXNLm (ORCPT + 99 others); Mon, 24 Oct 2022 09:11:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235606AbiJXNJH (ORCPT ); Mon, 24 Oct 2022 09:09:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD380A0245; Mon, 24 Oct 2022 05:22: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 1BD1C61218; Mon, 24 Oct 2022 12:22:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32219C433D6; Mon, 24 Oct 2022 12:22:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614150; bh=4mDMvFXGpgDf50KKWVQFhIoxYos5GNWsfBZoo4/SHNY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DKyUj5OcL+gSYzMO3aLHASRiJUP4+GlDOBptup2I9a1rPLUXcDgYsXhyZsAtbSlv4 qbqhLPRJmETl6qjrEqXJqKv2QISWefoiBRneRxqPlq5oRfchBop4MmGYtp9dic3MlU xJZAQOFiRiQ2DBtOjzMcwwTAahIkpb/pVjzqAkgM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jesus Fernandez Manzano , Kalle Valo , Sasha Levin Subject: [PATCH 5.10 121/390] wifi: ath11k: fix number of VHT beamformee spatial streams Date: Mon, 24 Oct 2022 13:28:38 +0200 Message-Id: <20221024113027.816036777@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574728164839013?= X-GMAIL-MSGID: =?utf-8?q?1747574728164839013?= From: Jesus Fernandez Manzano [ Upstream commit 55b5ee3357d7bb98ee578cf9b84a652e7a1bc199 ] The number of spatial streams used when acting as a beamformee in VHT mode are reported by the firmware as 7 (8 sts - 1) both in IPQ6018 and IPQ8074 which respectively have 2 and 4 sts each. So the firmware should report 1 (2 - 1) and 3 (4 - 1). Fix this by checking that the number of VHT beamformee sts reported by the firmware is not greater than the number of receiving antennas - 1. The fix is based on the same approach used in this same function for sanitizing the number of sounding dimensions reported by the firmware. Without this change, acting as a beamformee in VHT mode is not working properly. Tested-on: IPQ6018 hw1.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1 Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1 Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") Signed-off-by: Jesus Fernandez Manzano Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220616173947.21901-1-jesus.manzano@galgus.net Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath11k/mac.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index 44282aec069d..67faf62999de 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -3419,6 +3419,8 @@ static int ath11k_mac_set_txbf_conf(struct ath11k_vif *arvif) if (vht_cap & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE)) { nsts = vht_cap & IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK; nsts >>= IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT; + if (nsts > (ar->num_rx_chains - 1)) + nsts = ar->num_rx_chains - 1; value |= SM(nsts, WMI_TXBF_STS_CAP_OFFSET); } @@ -3459,7 +3461,7 @@ static int ath11k_mac_set_txbf_conf(struct ath11k_vif *arvif) static void ath11k_set_vht_txbf_cap(struct ath11k *ar, u32 *vht_cap) { bool subfer, subfee; - int sound_dim = 0; + int sound_dim = 0, nsts = 0; subfer = !!(*vht_cap & (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE)); subfee = !!(*vht_cap & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE)); @@ -3469,6 +3471,11 @@ static void ath11k_set_vht_txbf_cap(struct ath11k *ar, u32 *vht_cap) subfer = false; } + if (ar->num_rx_chains < 2) { + *vht_cap &= ~(IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE); + subfee = false; + } + /* If SU Beaformer is not set, then disable MU Beamformer Capability */ if (!subfer) *vht_cap &= ~(IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE); @@ -3481,7 +3488,9 @@ static void ath11k_set_vht_txbf_cap(struct ath11k *ar, u32 *vht_cap) sound_dim >>= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT; *vht_cap &= ~IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK; - /* TODO: Need to check invalid STS and Sound_dim values set by FW? */ + nsts = (*vht_cap & IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK); + nsts >>= IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT; + *vht_cap &= ~IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK; /* Enable Sounding Dimension Field only if SU BF is enabled */ if (subfer) { @@ -3493,9 +3502,15 @@ static void ath11k_set_vht_txbf_cap(struct ath11k *ar, u32 *vht_cap) *vht_cap |= sound_dim; } - /* Use the STS advertised by FW unless SU Beamformee is not supported*/ - if (!subfee) - *vht_cap &= ~(IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK); + /* Enable Beamformee STS Field only if SU BF is enabled */ + if (subfee) { + if (nsts > (ar->num_rx_chains - 1)) + nsts = ar->num_rx_chains - 1; + + nsts <<= IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT; + nsts &= IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK; + *vht_cap |= nsts; + } } static struct ieee80211_sta_vht_cap From patchwork 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: 9659 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp534437wru; Mon, 24 Oct 2022 09:11:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM51qKZkM4O9wafcoYsf9Omib/uIoxsQZKqtTN8/XSYoRfYxy9i+Bf4WzIT8pt0xyPXONG7N X-Received: by 2002:a17:906:30c5:b0:782:707:9e2d with SMTP id b5-20020a17090630c500b0078207079e2dmr27598873ejb.286.1666627866549; Mon, 24 Oct 2022 09:11:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627866; cv=none; d=google.com; s=arc-20160816; b=X59wycO+SjraYROJyPtOy1FY4wS2dUGS3fOZxHnQqCogkYX7IKUxlV28c14uSDUZQ2 PnZAN8HOaMjsKysVLHPS3FBT6V9Dq8yhlisbvkjpi+TVm4NQHHhcgrmR901Ng2QCMTl3 XKj24pbCpOff42mYHp6NBxVr/qwsTlWmEMejk5btHzlmbuNsZHBM3na0w+R69lIhuxNI EYQ3wD40VcCEiXnFT2UCQkczXodu3L8Vwho1ILFXPyElxOSClWq3mrq58GQ4hE95bLXF NKrZkwwvAnRUF1SyQKplX9nPWVZNVv+C1Nazxpu9krH8tOyh9/PwXgk0vHL5k8Foo9C9 yt+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=LSIm+40aYsZUulT/6hzXEsQ5x8LY4F4PDCUhIjjilnw=; b=hrvZYn53og8GDvbxe+vt4f82bw0y1hUSOSUWl3vnec77x7piJQrd0lqCank9zN2CjP zvSrNIgqNhsjKj+uouoPiHasypRbxoAKDSdiMyEq6imKYO4My+epHJZfdF3KOyhNUpRt MPpIA5AlIw+mc7qbjiZw9W2FgB/2luqfCUxJfYbT0qW7EjF/pV0R1kiCAFgI8hLDY2gY iZ5yNF8HagS00XCGOUFux24foyWudzQXTwYiSrbk7N4CYol3r8pfXAZjOqYjQx0JxU4D LaAvDoL0RlCQjBgUEHDX8+Jdvw2/2J3D5PB+E0BvlY7D/WJPAqi9P0oS7AOg2Il/xD8G 8OuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ia73eklo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne10-20020a1709077b8a00b007418a1e877dsi139670ejc.580.2022.10.24.09.10.42; Mon, 24 Oct 2022 09:11: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=Ia73eklo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233543AbiJXQI7 (ORCPT + 99 others); Mon, 24 Oct 2022 12:08:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233614AbiJXQEu (ORCPT ); Mon, 24 Oct 2022 12:04: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 6C2A311878C; Mon, 24 Oct 2022 07:57:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7B16EB81668; Mon, 24 Oct 2022 12:22:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1618C433C1; Mon, 24 Oct 2022 12:22:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614153; bh=1hCw6cxNbX3YN2yD9VtMsbWe/TAy/Ij432ySJrqy94M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ia73eklo2J+eqZNCED9xxoEEWC6kvd6jIRYZpWLp8miraenbr2vie7+Xnc0T0UwwA meV8gzrI0i40Vvw/XBsZcnx4hV3UWih//I4PygnazYacFwi2khOnBUDxcxs5cmkwsl eOM9wI3ZUY479gAIV7yUhXXcpfLOsEh2ZgpVE3N0= 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.10 122/390] x86/microcode/AMD: Track patch allocation size explicitly Date: Mon, 24 Oct 2022 13:28:39 +0200 Message-Id: <20221024113027.862630256@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585981748097281?= X-GMAIL-MSGID: =?utf-8?q?1747585981748097281?= 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 3f6b137ef4e6..c87936441339 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:28:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9223 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp460777wru; Mon, 24 Oct 2022 06:42:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5g/Skiu9Cfcs7eb7zFwv9ZPZYyEJ1lQOOO3/jhdBXhPKqL2lfa3OOLk10iCdsiMqwuYRAA X-Received: by 2002:a17:90b:38cf:b0:212:d06c:9489 with SMTP id nn15-20020a17090b38cf00b00212d06c9489mr18997451pjb.220.1666618946424; Mon, 24 Oct 2022 06:42:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618946; cv=none; d=google.com; s=arc-20160816; b=sHSLyKVuLClQ4B0u5g7H2FNd21Z53W8Qt69X4txIe4oOzgPBupQXswbR1rBp1yIqx6 O0uz3pK4tmm1Tklxv/34tiNAN4M1D2Q/HPkEbDtxEXxMTeiv1vj8ib6W99DR2/p0/PDR p1Jh0izVnKyZXqTu31ardKqx8cZT+VvsEetruzy0SYqVjC8exU8k4FitsnAfGF/+1t4L tTxDReYjeFrQRxmYudOSn5g8w+WfJ2lmnI2HrNpYsM4no+/OtamI92HJmDQEGZMH7uxH n5QYzK39UVI/F5y94xsEmH3E6FPS52X855JrMNqNT090GM8N3VuqJaIPjDopRBBHcmwP rpMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rZJCw1BUaXAkPEVfPWVe0AY9et0Q0UzHfPhEg+LoXcU=; b=iZ410ZzVU7C8YaYFYaSMHbY508vdFAcugt60hSdzGbd+IGvTVRbJBIXVSHS+6LIqIV aDoTO8o0ME3lHXo53KDUrwzC90VC7K461K1hnrSnCSgneoxwCI1Xji8jup6iHTLebCeL esUlM70yBZXT8aTlXZ6UtAl/ibDJ35C0UFzqcguxmNI0WVbNFWjZEScWIl37RxbmLCQQ DIgYCWSaWNC/2ZsL0uXmtHieO/czNyL38HMDx2vhaKFMSm1YaToCku2H9yM3E+pd8tai zFTl5CcJRJeRnizaUViKIRkXvQZ1mzA/Vkd6wxLv/zqDPdnn2MYOS3Mds3A/Wrb7i3yn Vgsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fbByqQbY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n1-20020a170902e54100b001786a4a4c98si37301199plf.371.2022.10.24.06.41.58; Mon, 24 Oct 2022 06:42:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fbByqQbY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233678AbiJXNdp (ORCPT + 99 others); Mon, 24 Oct 2022 09:33:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236178AbiJXN34 (ORCPT ); Mon, 24 Oct 2022 09:29: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 9B136AC388; Mon, 24 Oct 2022 05:32: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 D108861257; Mon, 24 Oct 2022 12:21:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E35F8C433D6; Mon, 24 Oct 2022 12:21:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614074; bh=803LJiRW3lS0AHVQO2Hu2d5pYjBHKDxXq8Tbanxyns8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fbByqQbY8EQiFnfoj5eVw5LygYVFitGISxSsNNsW1zXTfVn+dI9sbw1zIbu59KvaM +CHfSfBzK3+Pm/+ANHlOewPokfcz6KAngnw5gFJz6mhrnKMS9LiZHiBf4XFoMvB+H7 LmWXuFjL+5ALmcJNc7c3rpJCl2Tr4fGSvfYOzjxg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Luciano_Le=C3=A3o?= , Borislav Petkov , " =?utf-8?q?N=C3=ADcolas_F_=2E__R_=2E__A_=2E_?= =?utf-8?q?_Prado?= " , Sasha Levin Subject: [PATCH 5.10 123/390] x86/cpu: Include the header of init_ia32_feat_ctl()s prototype Date: Mon, 24 Oct 2022 13:28:40 +0200 Message-Id: <20221024113027.909301165@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576628031261477?= X-GMAIL-MSGID: =?utf-8?q?1747576628031261477?= From: Luciano Leão [ Upstream commit 30ea703a38ef76ca119673cd8bdd05c6e068e2ac ] Include the header containing the prototype of init_ia32_feat_ctl(), solving the following warning: $ make W=1 arch/x86/kernel/cpu/feat_ctl.o arch/x86/kernel/cpu/feat_ctl.c:112:6: warning: no previous prototype for ‘init_ia32_feat_ctl’ [-Wmissing-prototypes] 112 | void init_ia32_feat_ctl(struct cpuinfo_x86 *c) This warning appeared after commit 5d5103595e9e5 ("x86/cpu: Reinitialize IA32_FEAT_CTL MSR on BSP during wakeup") had moved the function init_ia32_feat_ctl()'s prototype from arch/x86/kernel/cpu/cpu.h to arch/x86/include/asm/cpu.h. Note that, before the commit mentioned above, the header include "cpu.h" (arch/x86/kernel/cpu/cpu.h) was added by commit 0e79ad863df43 ("x86/cpu: Fix a -Wmissing-prototypes warning for init_ia32_feat_ctl()") solely to fix init_ia32_feat_ctl()'s missing prototype. So, the header include "cpu.h" is no longer necessary. [ bp: Massage commit message. ] Fixes: 5d5103595e9e5 ("x86/cpu: Reinitialize IA32_FEAT_CTL MSR on BSP during wakeup") Signed-off-by: Luciano Leão Signed-off-by: Borislav Petkov Reviewed-by: Nícolas F. R. A. Prado Link: https://lore.kernel.org/r/20220922200053.1357470-1-lucianorsleao@gmail.com Signed-off-by: Sasha Levin --- arch/x86/kernel/cpu/feat_ctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/feat_ctl.c b/arch/x86/kernel/cpu/feat_ctl.c index 29a3bedabd06..d7541851288e 100644 --- a/arch/x86/kernel/cpu/feat_ctl.c +++ b/arch/x86/kernel/cpu/feat_ctl.c @@ -1,11 +1,11 @@ // SPDX-License-Identifier: GPL-2.0 #include +#include #include #include #include #include -#include "cpu.h" #undef pr_fmt #define pr_fmt(fmt) "x86/cpu: " fmt From patchwork 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: 9673 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp535091wru; Mon, 24 Oct 2022 09:12:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7vA5A7KEoHuVtOO65uxihUEkk/Mzw2c0tsqeuz/gk43qBhFvTP15kgxa5Yf0L/5QQDDj6T X-Received: by 2002:a63:581e:0:b0:43c:29a0:6390 with SMTP id m30-20020a63581e000000b0043c29a06390mr29186746pgb.552.1666627941833; Mon, 24 Oct 2022 09:12:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627941; cv=none; d=google.com; s=arc-20160816; b=uzcETKKyFcswbuTZ6wD+bF57mk23qEsWez6PO06kY7jEcXllesJE7piGLYuu/LGx+A qQqBUhiV32vZPplZNhnb2BGQTmeE3E02lG7fQHd9VeW3QM5mFZyEfbURy6+9OaqV1mvI uSUAPvAufuJJKgnO+YZQ12lpJM8Ux+FDw66B7DQ4CCpyYqVSu2/eJV5ejW5gLTWlDnMm VKoHz43Zp1Y92KP+e286XJJpgNG4XPuqVL5bO7Gc/HkLM+c+7X20pFzUumB11xfEWOGU wPgligK9jZu6wlXlCpxo2sj5/CO6N2IGUzvvO0L4vb715oA93HCmXmXLiwGrj3ipng9t mRAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=p0P2r8M64Sn3W+rNpQyMNito1HA8eJMajxtfvvkN6n4=; b=oN4edXQLtfo63YLD5xRE1689uFZMgtEZaAurrpmvGqpeE3QumEr0yXCZ/Z79VZh5km pcp3NxTo+T0bYgEM4FsF7TMRgo/eySibm8iJYP2xbte9RUg4G5YDfopnN49gsXNWWJE/ Xu9bW7tCoy7yEEgIpIQylek5YzrwLOOopYND15UTSVSpF6XFghRPyFv+gywP/oBoob27 7bFMgqFhpTfj/tehRD6UZuD7RkSLmydNK2LKEXj4mhGzZ9juQgUqTd+9hdaSkmYcU8Y8 PfHLXipAFPsVn8un/xw+OAn+6ZGr95kYA3qcOYKxBKudp3ufaOUKpKfYOrU5l0eYo/9/ 1yIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XSKSwWm1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a632d02000000b004615836deeasi38229540pgt.860.2022.10.24.09.12.07; Mon, 24 Oct 2022 09:12: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=XSKSwWm1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233739AbiJXQLj (ORCPT + 99 others); Mon, 24 Oct 2022 12:11:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233807AbiJXQFB (ORCPT ); Mon, 24 Oct 2022 12:05:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C110D40E15; Mon, 24 Oct 2022 07:58: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 33811B815CF; Mon, 24 Oct 2022 12:21:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88F39C433D7; Mon, 24 Oct 2022 12:21:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614076; bh=GIvAGbIaLoY3RKv9O2KL5Wh80NNvK9JX717gmMHsZ3Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XSKSwWm1Z0LmsdNJz7K6qcIB8gFbm9aW+QUtq9wAPzaC4o3mvmYcwGeKfsB5zGk2S HcbOuASmfEKIDCjmrK1D+YoD6Yml1Jc8m5N/HJfOAs0oe6SewugnlCBOqz8qpAUyWN kagvM8CkYSuV+pT7jOKeh2eOqAnLLaidR8ehZa+g= 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.10 124/390] spi: dw: Fix PM disable depth imbalance in dw_spi_bt1_probe Date: Mon, 24 Oct 2022 13:28:41 +0200 Message-Id: <20221024113027.940789467@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747586060576424863?= X-GMAIL-MSGID: =?utf-8?q?1747586060576424863?= From: Zhang Qilong [ Upstream commit 618d815fc93477b1675878f3c04ff32657cc18b4 ] The pm_runtime_enable will increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced according to context. Fixes:abf00907538e2 ("spi: dw: Add Baikal-T1 SPI Controller glue driver") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20220924121310.78331-3-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-dw-bt1.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-dw-bt1.c b/drivers/spi/spi-dw-bt1.c index bc9d5eab3c58..8f6a1af14456 100644 --- a/drivers/spi/spi-dw-bt1.c +++ b/drivers/spi/spi-dw-bt1.c @@ -293,8 +293,10 @@ static int dw_spi_bt1_probe(struct platform_device *pdev) pm_runtime_enable(&pdev->dev); ret = dw_spi_add_host(&pdev->dev, dws); - if (ret) + if (ret) { + pm_runtime_disable(&pdev->dev); goto err_disable_clk; + } platform_set_drvdata(pdev, dwsbt1); From patchwork Mon Oct 24 11:28:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9059 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp444221wru; Mon, 24 Oct 2022 06:10:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7cYtXuXtsVBn0y9SNLUNfo0nErEkinlWLbx+gXZfW+T5kz5FBn0Faa4gCHcEplEpS6LM/6 X-Received: by 2002:a17:902:d54e:b0:178:2da7:1bea with SMTP id z14-20020a170902d54e00b001782da71beamr32996222plf.161.1666617052268; Mon, 24 Oct 2022 06:10:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617052; cv=none; d=google.com; s=arc-20160816; b=b4ByK9Rvsk32mZYpGRkDZd5T+PihOSV7UftIDuQOLYuUDxF/dx/pn7a+AjjlzIvXIz f+OGSwz30IlJb1KiPVQPQ2Oc0BR7QZzIVfOoeGyPl9Ci5CwccLcoCdUMoq0N9jfUiMfL k/fdxFVzO/xCegDkfaG6I3VYn/3EJ+BMz7w4DAQVv6/J2Gq5697+9q+YQtIjQ8ujg6NV 6sPJcgIiS9M5F0snLAMtRE0aABKVUwZBhsj5qZyM70Q4ZqDt+7PrtssPwBwFapbAEZwi 1S6nKAw+I2rm+DJzC4uhR9vBsUc/lynt04tkO6nxsiWhsIUwYmKHUPS4EDJfaolvOp38 uQ6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WuDSsDT8WHAbNOlWOGiDfSnm+0l7wrim12FJBLAkaTw=; b=RWVn/Xcjug9U6G2/+4nV4Ds03lKs++jh9ARqOuAkYrjqGs05Q7IKRfjAFjY0Mxz30M vcooWe8sdmPLcOIocTRbzhPLxtyfmqUSikU83gBQFcKr/D1iXPrIQJvmiQuY5ACTfbbG j+r5WOs1Rm6iH+mD8RihWLQixRB718vtVyrcqyba72P2JoSaZPh5yHHDYxAKViq0/O5z YZokawEHFSMFzMdxIIYLq2U/rpP8afPGQjkwiiJ/sfzcco91v6008HPJ4W/cITrvEJVA MRzLS9nrXBC2az+1nNxA8/7BdYdOZ4PMRNGu+kf1UlB+D30k0S1SUjOE5su0Q+cgkCUT 9vKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="SE0/xL9p"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z17-20020a1709028f9100b00186bb2e85c4si266765plo.429.2022.10.24.06.10.38; Mon, 24 Oct 2022 06: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="SE0/xL9p"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235530AbiJXNIs (ORCPT + 99 others); Mon, 24 Oct 2022 09:08:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235498AbiJXNIV (ORCPT ); Mon, 24 Oct 2022 09:08:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AC099DFAF; Mon, 24 Oct 2022 05:21:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1DAA1611B0; Mon, 24 Oct 2022 12:21:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E40DC433D6; Mon, 24 Oct 2022 12:21:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614079; bh=GVYsaKKXtS7tkqz2R3xxZid3DEplSAk80n6tHg3gJLg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SE0/xL9po31m3Umx+VZ11KzqfkhE8tPC9vSAJJRxoneHnn2SgLvPNGzUORH1nm9cl ZJF6POsix5iuxtFBH++0l7DEDC/1R6/xFUAdPgq3Gbwum/OULNCDRJdnnYNJjQ9C2m CknbOPex2oUGrs+FfOKqyuoZSlJLtTu+q/S6rxy8= 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.10 125/390] spi/omap100k:Fix PM disable depth imbalance in omap1_spi100k_probe Date: Mon, 24 Oct 2022 13:28:42 +0200 Message-Id: <20221024113027.989164463@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574642141696769?= X-GMAIL-MSGID: =?utf-8?q?1747574642141696769?= 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 0d0cd061d356..7c992d1f4abd 100644 --- a/drivers/spi/spi-omap-100k.c +++ b/drivers/spi/spi-omap-100k.c @@ -414,6 +414,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: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: 9658 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp534430wru; Mon, 24 Oct 2022 09:11:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4U+tH41m/yt++cNF08PyGa+b2R0R/a1XSKr7zp3LYWOq7WlI7MiBi+EDjYiFZJDXjNkwI5 X-Received: by 2002:a17:906:eec9:b0:73d:c369:690f with SMTP id wu9-20020a170906eec900b0073dc369690fmr28397857ejb.767.1666627855016; Mon, 24 Oct 2022 09:10:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627855; cv=none; d=google.com; s=arc-20160816; b=oasmLudAbuXzYuUCqA/26WLxy38X0rcTH5+35q8RLG6u65scAWLEMT6hvtpUREaXYt gxy0LWJEyzOig1NM45H1BnrpjUS5jPCNTnBFPJbfAoUjaKgW0k56VQLRvDwgt0SITLJh eKBICG/vb/twnRT5+jtPbuIxMfyX2Gz7iWArDBHCNB1usTgQjASLheDdjHf3Lr3B4mNk J7zsoS+Kf2LTG4P76I9FikWiS7D+yEGcvpGxzJmBcV8i9fcQJkBW/QFq5OBDdmWHCEQO S3bwAQMmtLyiAHO7rja6pr2OqSbEUbU8bck3zm9yUIcK1VjMxzSy4Su+dO07EzTZ6+lJ tRLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cGQA4ImMPEGgVI2jDJxc7Taf/yeL20Ha6qYZoT3IMQU=; b=TNQ/ffFAca2iqKgQfmds3Kn+qLmI0qLfqwYH6whxsQ5vI7oiPAYBEY0oNWWxEm9tW+ 3NPCsx3KNiYO6377dkTeJYVB2E0fGjMRbAaeO0hM1BuNHE8h/mFa2svl5iYqF6KuKC7X eRpZRXTEP+sl7HJh7/vDTP1dnddX7o3+0hSA37lsjh0x1OJBZVtx1iuSUAmHPDa4ASR4 UEUCVSLlAqvDyVQJxoCb/P7JFEWzQvBnrGbT8yf8R50e/KMfgyt06sQcVrK8KuynOc2l HfXYi2FFhsu4l1/jcyAw3owJHfYnFPLMKMiwFiC7x4aDKww8gevijYNPd4eRPWCxo21q n6fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F51Tx4Fw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e19-20020a17090658d300b0078da3cd3073si137924ejs.628.2022.10.24.09.10.30; Mon, 24 Oct 2022 09: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=F51Tx4Fw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233470AbiJXQIh (ORCPT + 99 others); Mon, 24 Oct 2022 12:08:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233493AbiJXQEp (ORCPT ); Mon, 24 Oct 2022 12:04: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 1BA0811D9BD; Mon, 24 Oct 2022 07:57:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 789B1B81610; Mon, 24 Oct 2022 12:21:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CAE02C433D6; Mon, 24 Oct 2022 12:21:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614082; bh=0jfWPenfL/oG5oJ9Lg9hxmiwRpgO6UV80eJbmRUMs0E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F51Tx4FwxmC1bZC8kYCgJ6+3d0k3epjCpi68QZg8edTpzjk7jdyx4IRDMr1/RnGvy 2FSsg/o7svXnFZFeNSbH+caRE3rBlfEwuzHvlYt1yuo6aktGfJQNTJVbCigoaVkrUk Yc/SVK/xrC890j+u5virtrcLJL4ImE7fNHkc4xU8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Khalil Blaiech , Asmaa Mnebhi , Wolfram Sang , Sasha Levin Subject: [PATCH 5.10 126/390] i2c: mlxbf: support lock mechanism Date: Mon, 24 Oct 2022 13:28:43 +0200 Message-Id: <20221024113028.030483212@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585969887212973?= X-GMAIL-MSGID: =?utf-8?q?1747585969887212973?= From: Asmaa Mnebhi [ Upstream commit 86067ccfa1424a26491542d6f6d7546d40b61a10 ] Linux is not the only entity using the BlueField I2C busses so support a lock mechanism provided by hardware to avoid issues when multiple entities are trying to access the same bus. The lock is acquired whenever written explicitely or the lock register is read. So make sure it is always released at the end of a successful or failed transaction. Fixes: b5b5b32081cd206b (i2c: mlxbf: I2C SMBus driver for Mellanox BlueField SoC) Reviewed-by: Khalil Blaiech Signed-off-by: Asmaa Mnebhi Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-mlxbf.c | 44 ++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/busses/i2c-mlxbf.c b/drivers/i2c/busses/i2c-mlxbf.c index bea82a787b4f..90c488a60693 100644 --- a/drivers/i2c/busses/i2c-mlxbf.c +++ b/drivers/i2c/busses/i2c-mlxbf.c @@ -312,6 +312,7 @@ static u64 mlxbf_i2c_corepll_frequency; * exact. */ #define MLXBF_I2C_SMBUS_TIMEOUT (300 * 1000) /* 300ms */ +#define MLXBF_I2C_SMBUS_LOCK_POLL_TIMEOUT (300 * 1000) /* 300ms */ /* Encapsulates timing parameters. */ struct mlxbf_i2c_timings { @@ -520,6 +521,25 @@ static bool mlxbf_smbus_master_wait_for_idle(struct mlxbf_i2c_priv *priv) return false; } +/* + * wait for the lock to be released before acquiring it. + */ +static bool mlxbf_i2c_smbus_master_lock(struct mlxbf_i2c_priv *priv) +{ + if (mlxbf_smbus_poll(priv->smbus->io, MLXBF_I2C_SMBUS_MASTER_GW, + MLXBF_I2C_MASTER_LOCK_BIT, true, + MLXBF_I2C_SMBUS_LOCK_POLL_TIMEOUT)) + return true; + + return false; +} + +static void mlxbf_i2c_smbus_master_unlock(struct mlxbf_i2c_priv *priv) +{ + /* Clear the gw to clear the lock */ + writel(0, priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_GW); +} + static bool mlxbf_i2c_smbus_transaction_success(u32 master_status, u32 cause_status) { @@ -711,10 +731,19 @@ mlxbf_i2c_smbus_start_transaction(struct mlxbf_i2c_priv *priv, slave = request->slave & GENMASK(6, 0); addr = slave << 1; - /* First of all, check whether the HW is idle. */ - if (WARN_ON(!mlxbf_smbus_master_wait_for_idle(priv))) + /* + * Try to acquire the smbus gw lock before any reads of the GW register since + * a read sets the lock. + */ + if (WARN_ON(!mlxbf_i2c_smbus_master_lock(priv))) return -EBUSY; + /* Check whether the HW is idle */ + if (WARN_ON(!mlxbf_smbus_master_wait_for_idle(priv))) { + ret = -EBUSY; + goto out_unlock; + } + /* Set first byte. */ data_desc[data_idx++] = addr; @@ -738,8 +767,10 @@ mlxbf_i2c_smbus_start_transaction(struct mlxbf_i2c_priv *priv, write_en = 1; write_len += operation->length; if (data_idx + operation->length > - MLXBF_I2C_MASTER_DATA_DESC_SIZE) - return -ENOBUFS; + MLXBF_I2C_MASTER_DATA_DESC_SIZE) { + ret = -ENOBUFS; + goto out_unlock; + } memcpy(data_desc + data_idx, operation->buffer, operation->length); data_idx += operation->length; @@ -771,7 +802,7 @@ mlxbf_i2c_smbus_start_transaction(struct mlxbf_i2c_priv *priv, ret = mlxbf_i2c_smbus_enable(priv, slave, write_len, block_en, pec_en, 0); if (ret) - return ret; + goto out_unlock; } if (read_en) { @@ -798,6 +829,9 @@ mlxbf_i2c_smbus_start_transaction(struct mlxbf_i2c_priv *priv, priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_FSM); } +out_unlock: + mlxbf_i2c_smbus_master_unlock(priv); + return ret; } From patchwork 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: 10201 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp642130wru; Mon, 24 Oct 2022 13:37:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7XD3ahTLG8bTzbGv8KigmZKvZ5x7eSX5HDioT7n6RkjGxFmTtK+sA9E60169j/GPis6lcj X-Received: by 2002:a62:1a97:0:b0:562:5587:12d6 with SMTP id a145-20020a621a97000000b00562558712d6mr34711263pfa.37.1666643849858; Mon, 24 Oct 2022 13:37:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643849; cv=none; d=google.com; s=arc-20160816; b=EIGl15SUYstKPOZSO+lEgwFfHDYbjypVlYoGLSrisBLYsMNssGbWBHyoeR1DhwhTrr 0UKO0NqLWMmO8Eg3f4EnOtfaLNQTX5ZDUKZM+ILYUAntqWKDLDQ6NkguRZ75Fh9Igtzz LW6Hc0dw8De9J6sLvxMj/ge4XlYDcSDV8/z/OpDL7OMyb5gsDS8SgfBMWugU6U3ksxa+ ekcseXleUjwOByC+SgOrGd1PwSWg33Xp2pyIdTFUdMpxKpl2azvy47wYCL9MRm9DyJ2P yYOAdTyTuzWffjTnDYjBzIBj9vPaJ29rNI/dd8S2RnP1A5ZlTIfs7KA67zeKDYns4vL5 92Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lwUNfuga4vpGf5pXuSJcw6bGV6PJakQ4bqn2f4AtjMA=; b=yJl5F/1JF8T6ZX/jos7DgwjEyeJ+cuZO26VQLpZ/NcADRLQ5JTE1v0Z6eZuqs+CF3b fHpsw7hMdn18JUsUPSo9EtOq80QUbRnxKyhUZ8wr8/ecea4JXlZNYILuApFvTM+jIEAV WPyfQFPzYw/8NhaVcnPvdionAuLhsnlBfdjON7611RMWk9Ikbs6VlIDBOiHwrkryq2vH a6dbILA0TBgMLYibPSXh/RunmLkh3lephXsqR9yH5BKVVa+0L9QnydfUTnTh7cgx6W49 osyaKNEcXpz/U8nhgiJdDTGdJVrpgeC+cgtjDztXp/woO/fhCq6CRHVF+kN4gbz9ZDcA oiBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=trSaFnye; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090b33c300b00212e70e2c25si11131784pjb.165.2022.10.24.13.37.17; Mon, 24 Oct 2022 13:37:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=trSaFnye; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231852AbiJXUbP (ORCPT + 99 others); Mon, 24 Oct 2022 16:31:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230397AbiJXUal (ORCPT ); Mon, 24 Oct 2022 16:30:41 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A2862E9EF; Mon, 24 Oct 2022 11:42:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 9611BCE13C2; Mon, 24 Oct 2022 12:21:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73335C433C1; Mon, 24 Oct 2022 12:21:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614084; bh=0DyZJeX3T0yjziilvQrjXReFQ/OlX5VV9uJGfDLijM0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=trSaFnyeLGiykql2/xuBtlAJ/zYL1B+GYv1DD6ay0nFjegGhohqrMkWV7kCk3oHlT WgJnL4BMGmGUyliZps88FZE9qiPnkD1CzX3pwMtdcUr5iU8cr3v9XoUV7LWxzp7Dv0 bWkFZIoH5IZz21guT2Xqjb9rWLlmtujs8dffsneg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luiz Augusto von Dentz , David Beinder , Sasha Levin Subject: [PATCH 5.10 127/390] Bluetooth: hci_core: Fix not handling link timeouts propertly Date: Mon, 24 Oct 2022 13:28:44 +0200 Message-Id: <20221024113028.068869433@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602741697449421?= X-GMAIL-MSGID: =?utf-8?q?1747602741697449421?= From: Luiz Augusto von Dentz [ Upstream commit 116523c8fac05d1d26f748fee7919a4ec5df67ea ] Change that introduced the use of __check_timeout did not account for link types properly, it always assumes ACL_LINK is used thus causing hdev->acl_last_tx to be used even in case of LE_LINK and then again uses ACL_LINK with hci_link_tx_to. To fix this __check_timeout now takes the link type as parameter and then procedure to use the right last_tx based on the link type and pass it to hci_link_tx_to. Fixes: 1b1d29e51499 ("Bluetooth: Make use of __check_timeout on hci_sched_le") Signed-off-by: Luiz Augusto von Dentz Tested-by: David Beinder Signed-off-by: Sasha Levin --- net/bluetooth/hci_core.c | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 2cb0cf035476..866eb22432de 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -4482,15 +4482,27 @@ static inline int __get_blocks(struct hci_dev *hdev, struct sk_buff *skb) return DIV_ROUND_UP(skb->len - HCI_ACL_HDR_SIZE, hdev->block_len); } -static void __check_timeout(struct hci_dev *hdev, unsigned int cnt) +static void __check_timeout(struct hci_dev *hdev, unsigned int cnt, u8 type) { - if (!hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) { - /* ACL tx timeout must be longer than maximum - * link supervision timeout (40.9 seconds) */ - if (!cnt && time_after(jiffies, hdev->acl_last_tx + - HCI_ACL_TX_TIMEOUT)) - hci_link_tx_to(hdev, ACL_LINK); + unsigned long last_tx; + + if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) + return; + + switch (type) { + case LE_LINK: + last_tx = hdev->le_last_tx; + break; + default: + last_tx = hdev->acl_last_tx; + break; } + + /* tx timeout must be longer than maximum link supervision timeout + * (40.9 seconds) + */ + if (!cnt && time_after(jiffies, last_tx + HCI_ACL_TX_TIMEOUT)) + hci_link_tx_to(hdev, type); } /* Schedule SCO */ @@ -4548,7 +4560,7 @@ static void hci_sched_acl_pkt(struct hci_dev *hdev) struct sk_buff *skb; int quote; - __check_timeout(hdev, cnt); + __check_timeout(hdev, cnt, ACL_LINK); while (hdev->acl_cnt && (chan = hci_chan_sent(hdev, ACL_LINK, "e))) { @@ -4591,8 +4603,6 @@ static void hci_sched_acl_blk(struct hci_dev *hdev) int quote; u8 type; - __check_timeout(hdev, cnt); - BT_DBG("%s", hdev->name); if (hdev->dev_type == HCI_AMP) @@ -4600,6 +4610,8 @@ static void hci_sched_acl_blk(struct hci_dev *hdev) else type = ACL_LINK; + __check_timeout(hdev, cnt, type); + while (hdev->block_cnt > 0 && (chan = hci_chan_sent(hdev, type, "e))) { u32 priority = (skb_peek(&chan->data_q))->priority; @@ -4673,7 +4685,7 @@ static void hci_sched_le(struct hci_dev *hdev) cnt = hdev->le_pkts ? hdev->le_cnt : hdev->acl_cnt; - __check_timeout(hdev, cnt); + __check_timeout(hdev, cnt, LE_LINK); tmp = cnt; while (cnt && (chan = hci_chan_sent(hdev, LE_LINK, "e))) { From patchwork 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: 9065 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp444538wru; Mon, 24 Oct 2022 06:11:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4eqGKUIdkWNBKgj3IymrkmxzBiPrX5W2+fMm8PCAk3l0Y054b+WbxYCRbydCnEJ4hBXAN0 X-Received: by 2002:a05:6a02:11a:b0:441:9db5:e8cc with SMTP id bg26-20020a056a02011a00b004419db5e8ccmr27551773pgb.345.1666617080974; Mon, 24 Oct 2022 06:11:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617080; cv=none; d=google.com; s=arc-20160816; b=V3DdoS5RfSCSsZ4zj/on2hKr6cnYhRTZdZASMdGKdNKGE38qYBVULtZo9B8VG+pJXk D30eApBQaD40cOaZ+cCikYBm4LOomzCvTQyoatVlJ1kM2Lu7tRDuwRNK8AgPtThMdSMV mKBrNmY7GkMW3aiIV9WDhuYM0uP9/mOnKCesXlrvSGp7AvA8kJXQB6wdtYAqddJiuLLs l5tKTwF2dvyP3xqW4WfOgzdJNXuNw12ZlverSBOwjFCgexUB2NT6RX2ecD8BRK4qKjoy pJ4WsbMJb0HgyFs6UU1p5yugr5pgVxpEVyd6d8trg9vSVZPiNTvaVTiTDHZR3cbkkRbj DxMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Zkz/SdCdnhjlRm9svCfP+19FxgAhL5I8C23kRcK8J/8=; b=oTwHh3+KuAAaUHkJRd+6MV9DlDvSjC0bwpdpOffkeuRs8mqq5J7hTE/bZLgrdkBR6y PbCKEZWKdzaLrFf5gHvEQ3Hpoq9b3qDRZ3MhAWbW5zquhgYvplI9cnnkFhzpJ8gRxrdu FHGRvQB/zmWpTOqGF1rb6FVN5NUOumG34Z+wBEgEZ6rpA/p8KFJKmv4PHzFxbBapbf8M u5UXxZK8T6PXxnHkpwLd+JLDr1Su4ldvZgXAGXkshBhkwCzPgo8ffK+cnQGTVFNOd8Ez Bp6hHLIIufMeXEJ0zR1RRTKZETyulTEl4tf6MGQJCZ77EGlGHrTPJAQ02GiLjQwvEOjR yIFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VEousFjg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l9-20020a170903120900b00176b8c373ddsi38433919plh.257.2022.10.24.06.11.04; Mon, 24 Oct 2022 06:11: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=VEousFjg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235492AbiJXNKu (ORCPT + 99 others); Mon, 24 Oct 2022 09:10:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235388AbiJXNIh (ORCPT ); Mon, 24 Oct 2022 09:08:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DC249E2DA; Mon, 24 Oct 2022 05:21: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 091F961218; Mon, 24 Oct 2022 12:21:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F2BEC433C1; Mon, 24 Oct 2022 12:21:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614087; bh=786S+Dn2aWcaP69zrtbMp2Xt408gllhiKlEpepX6aYo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VEousFjgmwBjYYKiF6l4uWZVylvZUrpBbIvZwLxK4ZlFkXVRbiRPUWRtjv4CUE/K+ snqqLtlV9WjPnEzIqr4Zz6qSGG4HuqtXAbEGv4U4eHkGSMrhAJIB8neyy/hfwBsdHo Z59FOkMUBpq3DHydjtAAbiIeBYhrKK/l+Ulf4W9w= 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.10 128/390] netfilter: nft_fib: Fix for rpath check with VRF devices Date: Mon, 24 Oct 2022 13:28:45 +0200 Message-Id: <20221024113028.115912249@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574672270721103?= X-GMAIL-MSGID: =?utf-8?q?1747574672270721103?= 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 03df986217b7..9e6f0f1275e2 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 92f3235fa287..602743f6dcee 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) @@ -193,7 +196,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: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: 9075 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp445251wru; Mon, 24 Oct 2022 06:12:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4xXGQbEgzZl5LfXZSP8/KLlgPsfvkn91oNW+W7QOKGDcSsGyzH54vBCnDbQ7HaX5efbSCt X-Received: by 2002:a17:90a:ab06:b0:20d:8764:b97a with SMTP id m6-20020a17090aab0600b0020d8764b97amr39103783pjq.7.1666617126602; Mon, 24 Oct 2022 06:12:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617126; cv=none; d=google.com; s=arc-20160816; b=CZgQ0H1oiBjdDWd7tj8EHf4VxLXnbIZdcIrugjyVvOCd+rpqX+utITxJjoIV7CRF2a //+5+IQzDpawEv75nwWPbZdvL8LznEC/TqQgsIRMRhnd19wSpPpj7jXJd52G24bXkEmx GwKMAZLBJPaJRWCo9MWPuRLvBmEjsYLHBhtnBkn1J3hguLaA7LquvUB1aYQ1l62+xFL/ YDlE5/hF1cWhkmI0dMqBgMBbKkw8MFr5ZBSsaKvG1Nt9lspSfYY8AeZoW92OIfXzEO2Z 8lRWDcXuu11ytX0YShWkjKDwIhxyg3K2hOERT0wQPHBeknKP8KDmvoAp5g8a4kOqgK3v El9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=T3hwwqcey7SW+4POXniOZedwYCUWUXItxFjaArhQHQE=; b=SvuPk6YzIm/4WHBwocBUDnzDG2KyXvzwrrdH0lsOrv6XJ6T8izUzA2fY8oQOSoGCqj xs0au/mYtVQmJwtM/WgN8XoIJJxG/2d2CrLQJYPOK7XF7I7ze7mW+mJA+S0lcPLeH6JG A79xmxJ2R3tNiZ+8ycrA0SdZipniqO7k9aO5+Q6flDVK+RzNqqL6VLdpzeOzUu1JT0t0 Vt5vY/QHXzY2y+JewBEqd8IIWE0pAOu8Sh7GV3rsohvMGxYSkiq+FkYG7X36n6BH/+DB 1F/Xuag5ecosCBmI2zZKjAki/Twe1dM9mQdV0kL4EFycEFsUzoIYUqzTQXk9Oy0kEFxB RvpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=d6YdRVTO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q13-20020a63cc4d000000b0043895127033si34932545pgi.335.2022.10.24.06.11.52; Mon, 24 Oct 2022 06:12:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=d6YdRVTO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235515AbiJXNLG (ORCPT + 99 others); Mon, 24 Oct 2022 09:11:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235221AbiJXNIr (ORCPT ); Mon, 24 Oct 2022 09:08:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0A4E9E698; Mon, 24 Oct 2022 05:21: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 D984061014; Mon, 24 Oct 2022 12:21:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA88FC433C1; Mon, 24 Oct 2022 12:21:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614090; bh=wBMz9c/+kTAzdDXShkoI5xBtRWobbz8zGVNHMA/nQ+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d6YdRVTOj8yNYBWql+xB26zipgJwFf3UvR5LK8atC+X46CQSi4gMf8I1/G1yslTca P3IoykQ8Y06xOXP9oMg1fUr3+9r4i4Hvhd7UNjq5i6GCR9EVCjOqDpYvjALkc1ae+L piJIVAWceMOW4skWxet4BEv/Fex6QYQUtEO8kKA8= 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.10 129/390] spi: s3c64xx: Fix large transfers with DMA Date: Mon, 24 Oct 2022 13:28:46 +0200 Message-Id: <20221024113028.166532087@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574720105396939?= X-GMAIL-MSGID: =?utf-8?q?1747574720105396939?= 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 dfa7c91e13aa..d435df1b715b 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) @@ -660,6 +661,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) @@ -1135,6 +1143,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: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: 9086 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp445779wru; Mon, 24 Oct 2022 06:13:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM74awZ6bGCR+ZRjj6G6/HTSmWVlIA17Dpj6QidImzoA8LF2JKCnaWtIJwg0tf95jl0RQs+i X-Received: by 2002:a17:902:70c4:b0:178:54cf:d397 with SMTP id l4-20020a17090270c400b0017854cfd397mr32480422plt.24.1666617189385; Mon, 24 Oct 2022 06:13:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617189; cv=none; d=google.com; s=arc-20160816; b=VttzUP2cPr0zItMcpgGiTbd9ik4YpQQa6gO/ibQLCTmtyJz+9d6BvZuJAbKTHq+Qax ogzSG9jJ12dKXTkVypJYWpDLJHBRFgAwbquXTbu4rgNDFo7EqHcMDNJ0KZU94qOiD/3t blYcMhKhxZd5bA/C2kQd2BoD4HNc1B3SEsIz5vSibEZsTBa1fpsupkktVu70LeZiIAgp bPZGXMvWwPRAGv4S7c6R42VGiIhMvd9BEFjaz01D9EffeFAeCy4D4cz9P0CFoeG4yejb ffhHKqH4x2XuRP/HSLzqndE/VMYTLlKxyejSgNx899dKedtMphlD7nV13P7RBPdSkbHz /dBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gzFUDS5IfEZ2Fv8S4vhD1fx7F0HqG+23CP50S6IZPn8=; b=dtZA0LsnrnVZrsCpzqmwuiWyz2pZmKbdK2nvO5K7B5cNr7dTtU0Vj0J3pHsbdaYj6W KXTpYVVThWFQ7j+8cIYmViy68c/6ZoXTbNwsbudD756Jwynuua210IKiFsvI7p9j9Rum LX6bvyK8t/Mm+EYblgASR5pMhP3sstSRhI2xWhEJgJyB6T3WJrV/G2XL2zgu51sYK79Y uU1OeJqM0IGspQX4R01WWkP9OSSDEmOTAPZbnZIh5lswFHD9MvWy+bdN7Rd2aYUqWT+O usHvIQl5yyzUPFDK68nKxBi7oqMtYahE9Hcri6EuAkL3h0bnXk4tGaoW3HvS935lH5Gl fTFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YoebTVL3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z4-20020a6552c4000000b0046439853c62si34819507pgp.127.2022.10.24.06.12.54; Mon, 24 Oct 2022 06:13: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=YoebTVL3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235420AbiJXNMh (ORCPT + 99 others); Mon, 24 Oct 2022 09:12:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235609AbiJXNJH (ORCPT ); Mon, 24 Oct 2022 09:09:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 661269E6A4; Mon, 24 Oct 2022 05:22:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 78DEB612A8; Mon, 24 Oct 2022 12:21:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86202C433C1; Mon, 24 Oct 2022 12:21:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614092; bh=mmJf2WmHjYvNc14I4worNIpdJc0e+5xAMFPez2Swz+o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YoebTVL3mwfN/JVgxnzwG2dNVKyb7WL0gfxjxVWcHNvehJMzWyqrMHdxekbterUYT EvEa7dExeS3LDM3LkRqJ+7kJsqmxR6xHrBqzppI0R8kfwqc2UVuxvFglrl4hs7yWAV GxQI0qP3EME1X+Ql8aw6SZh2scNo1StVtx+CupAs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bitterblue Smith , Jes Sorensen , Kalle Valo , Sasha Levin Subject: [PATCH 5.10 130/390] wifi: rtl8xxxu: Fix AIFS written to REG_EDCA_*_PARAM Date: Mon, 24 Oct 2022 13:28:47 +0200 Message-Id: <20221024113028.213257065@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574785842429132?= X-GMAIL-MSGID: =?utf-8?q?1747574785842429132?= From: Bitterblue Smith [ Upstream commit 5574d3290449916397f3092dcd2bac92415498e1 ] ieee80211_tx_queue_params.aifs is not supposed to be written directly to the REG_EDCA_*_PARAM registers. Instead process it like the vendor drivers do. It's kinda hacky but it works. This change boosts the download speed and makes it more stable. Tested with RTL8188FU but all the other supported chips should also benefit. Fixes: 26f1fad29ad9 ("New driver: rtl8xxxu (mac80211)") Signed-off-by: Bitterblue Smith Acked-by: Jes Sorensen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/038cc03f-3567-77ba-a7bd-c4930e3b2fad@gmail.com Signed-off-by: Sasha Levin --- .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index 7818a7ea0498..e34cd6fed7e8 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -4507,6 +4507,53 @@ rtl8xxxu_wireless_mode(struct ieee80211_hw *hw, struct ieee80211_sta *sta) return network_type; } +static void rtl8xxxu_set_aifs(struct rtl8xxxu_priv *priv, u8 slot_time) +{ + u32 reg_edca_param[IEEE80211_NUM_ACS] = { + [IEEE80211_AC_VO] = REG_EDCA_VO_PARAM, + [IEEE80211_AC_VI] = REG_EDCA_VI_PARAM, + [IEEE80211_AC_BE] = REG_EDCA_BE_PARAM, + [IEEE80211_AC_BK] = REG_EDCA_BK_PARAM, + }; + u32 val32; + u16 wireless_mode = 0; + u8 aifs, aifsn, sifs; + int i; + + if (priv->vif) { + struct ieee80211_sta *sta; + + rcu_read_lock(); + sta = ieee80211_find_sta(priv->vif, priv->vif->bss_conf.bssid); + if (sta) + wireless_mode = rtl8xxxu_wireless_mode(priv->hw, sta); + rcu_read_unlock(); + } + + if (priv->hw->conf.chandef.chan->band == NL80211_BAND_5GHZ || + (wireless_mode & WIRELESS_MODE_N_24G)) + sifs = 16; + else + sifs = 10; + + for (i = 0; i < IEEE80211_NUM_ACS; i++) { + val32 = rtl8xxxu_read32(priv, reg_edca_param[i]); + + /* It was set in conf_tx. */ + aifsn = val32 & 0xff; + + /* aifsn not set yet or already fixed */ + if (aifsn < 2 || aifsn > 15) + continue; + + aifs = aifsn * slot_time + sifs; + + val32 &= ~0xff; + val32 |= aifs; + rtl8xxxu_write32(priv, reg_edca_param[i], val32); + } +} + static void rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_bss_conf *bss_conf, u32 changed) @@ -4592,6 +4639,8 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, else val8 = 20; rtl8xxxu_write8(priv, REG_SLOT, val8); + + rtl8xxxu_set_aifs(priv, val8); } if (changed & BSS_CHANGED_BSSID) { From patchwork 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: 9675 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp535173wru; Mon, 24 Oct 2022 09:12:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5AFmfpnyPGQpV74uwfCaFhhJT0GcJfrzkghadQf1VlkWuhCTNWx/KI+sk8BWmO5LMAFLZp X-Received: by 2002:a63:1e5a:0:b0:43c:b966:e2d6 with SMTP id p26-20020a631e5a000000b0043cb966e2d6mr28359592pgm.569.1666627948509; Mon, 24 Oct 2022 09:12:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627948; cv=none; d=google.com; s=arc-20160816; b=m5G9LLzybUbxLqK1UwlGjAyqDUIc8X0Orwx0SZVd7jvgY8mVjgv5+JgePcIqv4iqGg jtIKaRzMKzAZrkX7Ti+VRqOfilnILBaobSTSQZjN6TjfMAyepB2vbnBKmuAzRAeQ0S/X QOwLkQRRcVE2sS85/iEn6QhJTcmJR/qeaV+t7g9UN/76XWsiILoKTrOxiw4Wq5UgyWCk yJzQpyC9yHTECqCNZDaNrAEjB5UCQP+90u4Y3FAQy1wSwXDtmI0ZSJcExjXt1dZbZA1u 2ALYfu2C/g7qWYngCa/qc36IQuSU31k/SlKRNjUj53Q4Mmqlyh0/KQryTsLWq8IxDYvJ iNGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ePxCFBdP2F0q/hDCv+afoewfkOGA/V2Pvw5Bf+PtF64=; b=Nrz9AXhbeECRXRdECa1qfd90hBsGEXTC81sz5m5ZKWUNJl6Dh11I8M+RqRFVX1YIZ/ 1YT/zJ1PPidMPG4doQ17pdizQ1+S7qejzt3m2TUb6KnuWp1wb4fkqMGLb6tqRoGDpxWN erFvYvLAl5Re+se+7R7iuj/QbrHtVnSs16vPDHn86dgcxp18rYG3My6qOJ8f6/PL/xk4 rDsb4t+MddjHqyEaDNUiMCbi+e/kMfYb1BuG0T72iiAspxn5vT0VCnRy5mRX0IsIXt75 Y7gNp6ZjyfXRFhbuMPeeSqr/Z1flpTNoZFtwLYZP5+wkhmLK4BvJunOiSDNK1KGVz84b x4qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=enXaguFt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nn15-20020a17090b38cf00b002100c234c6dsi10585879pjb.35.2022.10.24.09.12.14; Mon, 24 Oct 2022 09:12: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=enXaguFt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233771AbiJXQLt (ORCPT + 99 others); Mon, 24 Oct 2022 12:11:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233955AbiJXQFM (ORCPT ); Mon, 24 Oct 2022 12:05: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 7ED1F3FD46; Mon, 24 Oct 2022 07:58: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 C89B1B81604; Mon, 24 Oct 2022 12:21:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D3E0C433C1; Mon, 24 Oct 2022 12:21:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614095; bh=AybWWjy5oG4YPj4VEwcpauYIDdXd/B6+9qt+qJHjKpk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=enXaguFtE4putR+euSPwN1y84BNv5dCOZR1J40021fkniXQ0kxZ2t+pg1t2QwjRpF 30uDEnBn0qJyTKhL9KvQJoxgvdyfUrJojhilET7NPmH9hNcNbpSaj12BcQ8HQEV93Q LZRaEqMFdn9b88mCPaS+0zsqhBWeiY4Cu3/OiBaI= 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.10 131/390] vhost/vsock: Use kvmalloc/kvfree for larger packets. Date: Mon, 24 Oct 2022 13:28:48 +0200 Message-Id: <20221024113028.257081646@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747586067283179237?= X-GMAIL-MSGID: =?utf-8?q?1747586067283179237?= 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 5d2d6ce7ff41..b0153617fe0e 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -359,7 +359,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 d6d3a05c008a..c9ee9259af48 100644 --- a/net/vmw_vsock/virtio_transport_common.c +++ b/net/vmw_vsock/virtio_transport_common.c @@ -1196,7 +1196,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: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: 9901 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp573546wru; Mon, 24 Oct 2022 10:38:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7gRYjtkaPGlSXaPaC+qPHknvlDIt1LtsK5itWyr5cSbfCtiEgXheWenQm1qqHQcZkicV9W X-Received: by 2002:a17:90b:2752:b0:20d:6790:19fb with SMTP id qi18-20020a17090b275200b0020d679019fbmr76553039pjb.117.1666633104885; Mon, 24 Oct 2022 10:38:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666633104; cv=none; d=google.com; s=arc-20160816; b=RQ4ywyuSPa/y3fvyvozSYiXg0C+PlUqfCWo74mhNnryGmQ+xWjwSeU/mYMKVVVqFVv ON3IZngedq7TLx3xjYXg2L7mwUa+NML802OmIfaldIpdLIZeEh3Ep+77UlA0EMw48lFQ iJGzweo98Uf6rsT2liXUi6sUR2+yoqnfLPR20iF7XeqW9GBjCvKYaIhUQ6FJ/F5dro7b yvozdEtAk5tMzxmU0wlg2q6oKbdhk8m0fRKOvpltCTckYh5EI1KG0ryvq5W+Tw/nSmg5 ZXDi6nJB4rSOEiFAbQZ5dX8AAct47mKh+aA1n6a9A/GCxkMgRXKODifxeIjDkKM/kflC FVUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=tI0D5/aKEdLQZ5OA+F4ILtoMfx7N1u/6L8iAkMTqqNvdS93+KK6U9ZDDQ+ZVX2qlCE WIuQptfCAMi1USF6/YxI+nKVGtMwHvxo4yyI2hwaBbxKSt3Uv2zTtYfvSIbedmvU8tyF kKc3xSeh++/CFnsqQ17iFJsb1SbfnswXfGmqls35pAe+GhzDRp8VC5Y7mpYsH17hWN/a i5VZIG86JNCTU8OVDjlFYQ27VhbKddwULibQUlFqYDBxZq3/ZTPEPBcK4g3pj4MkuAuq e+JS+MGcJZ1UBCIEf2aTbz36EEVV/Rk3eFHbad9w48+4eJIiwPPBHQ7103/l6yWxVA2x hIzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AATgctv+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id me5-20020a17090b17c500b0020aeaa98ed4si11413976pjb.93.2022.10.24.10.38.10; Mon, 24 Oct 2022 10:38: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=AATgctv+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231849AbiJXRhh (ORCPT + 99 others); Mon, 24 Oct 2022 13:37:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233821AbiJXRhG (ORCPT ); Mon, 24 Oct 2022 13:37:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9E1B1799A7; Mon, 24 Oct 2022 09:12: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 6B63BB81333; Mon, 24 Oct 2022 12:21:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9428C433D6; Mon, 24 Oct 2022 12:21:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614098; bh=J07xhHpiz53nfpmBnVPX+Nux9GuiPCo4H7qkooMzdPM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AATgctv+n3kMLxMmOVoCy8FTHZDlJ6VzyMLYiOoZVt0cTpal0gIPBU6ZNnzh10n63 1OfCnDuZ0PJdrCErPAuhGZDMHmra3hPtk/5DndV2lCQevuyww+vWphRE4V8mMVkuPz LeEZQVeE3WfBFoiHRdORus90L8ZyWU22wwMEsNL0= 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.10 132/390] mISDN: fix use-after-free bugs in l1oip timer handlers Date: Mon, 24 Oct 2022 13:28:49 +0200 Message-Id: <20221024113028.297953418@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747591474507101273?= X-GMAIL-MSGID: =?utf-8?q?1747591474507101273?= 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: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: 9066 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp444596wru; Mon, 24 Oct 2022 06:11:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM70La/w/kOwhtMi9voEgpFZFiKBvfGsviYfKyXqygde2Z9k3UDKLXXANTPrVuYS+34Ja7KB X-Received: by 2002:a17:90a:540e:b0:210:1e26:9422 with SMTP id z14-20020a17090a540e00b002101e269422mr29540496pjh.100.1666617085483; Mon, 24 Oct 2022 06:11:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617085; cv=none; d=google.com; s=arc-20160816; b=sPjPcQ65MpZJ/w8fqnCLsMIh5eQ+fFdEdOx6bxv6ohXKch1K8euVX/iWnOniHaz2BO 5p/KeqIEUR2sgnpCn0Yym0sohwqPbtRq+UrBAESIBXCkigxWR0YiF0+CDJpZBcNXnQWh wAkKALAnEW3/KcT3EADzE7g8ctDRVBhKFMGmssCUtRGu4Yq4JvlqDRRCE1Z635G6fnEE EBf2JoL1V6RJXvdfUgjxz38r1Meu45DvePOYPjBrBpXvzrA5dDd1BznEPSizX5riCoAA vtXPGWwKY/mzmRJ03ARi+Qg+TODo7nVKCCS89sd5u2OAOG7rc/2QCF4cfvTHFrdKtxCh /eVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=g9z8YdGt90JpK2hCM+zsBv3a81ZKd8cUT021uMxF+YI=; b=w8Vd6DRUhUe3u3WrHDTa0cu3smXCGkrn6LmMiFKSq74s1Br3WGbD0m5Ep73T5JjISn jT1dtGOcYdtXu80bYWTC5plpyvFYzCv0iIvYvYOgbM4Q/c+cxw/7e8i7fLxdgXfWz0sG eYEMjkh6Uhn60VIOo1e8FoYNSuVd89FndH/qfQiM5Sce7QtfKQZgpp68umrcLP4hdBbL 2TxBl+8kGAdJd+21VCSIwib+JVJ0LaSOAFe9/g8mzFlA9tsTlqRvLTJhC34lOp4YKYnl CzVwR7SettHjA/w85dPXORDa7Bttk19L6CG5b2HJ1DQz/xs8Tr6lehIgP2ONONasp7Mf 0zjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qbIqi1b7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l69-20020a638848000000b004622c80f523si32375703pgd.679.2022.10.24.06.11.08; Mon, 24 Oct 2022 06:11: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=qbIqi1b7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235504AbiJXNKx (ORCPT + 99 others); Mon, 24 Oct 2022 09:10:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235406AbiJXNIi (ORCPT ); Mon, 24 Oct 2022 09:08: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 3FD1E9E683; Mon, 24 Oct 2022 05:22:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F2530612B3; Mon, 24 Oct 2022 12:21:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EDC6C433D6; Mon, 24 Oct 2022 12:21:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614103; bh=jOc7LW7IWzijjP0DhfLG0KzytqA6AuX/PkOEIoEOpsI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qbIqi1b7a62pfNEb3USTFnlA0YIk3s4IM8WVIkZiJ3Bam3UEOfadLoikrWEn9JIo5 wslyItDgcVkEf7/x+tr+Nzd2pPHpDnUncxMfa2rQRtk90WouYnLngdlbW6/IGB0QLK NHZSl7Lim30Pg7IICjbPYX58Z9dFFbZsEaO/7n4w= 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.10 133/390] sctp: handle the error returned from sctp_auth_asoc_init_active_key Date: Mon, 24 Oct 2022 13:28:50 +0200 Message-Id: <20221024113028.343180837@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574677213545766?= X-GMAIL-MSGID: =?utf-8?q?1747574677213545766?= From: Xin Long [ Upstream commit 022152aaebe116a25c39818a07e175a8cd3c1e11 ] When it returns an error from sctp_auth_asoc_init_active_key(), the active_key is actually not updated. The old sh_key will be freeed while it's still used as active key in asoc. Then an use-after-free will be triggered when sending patckets, as found by syzbot: sctp_auth_shkey_hold+0x22/0xa0 net/sctp/auth.c:112 sctp_set_owner_w net/sctp/socket.c:132 [inline] sctp_sendmsg_to_asoc+0xbd5/0x1a20 net/sctp/socket.c:1863 sctp_sendmsg+0x1053/0x1d50 net/sctp/socket.c:2025 inet_sendmsg+0x99/0xe0 net/ipv4/af_inet.c:819 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:734 This patch is to fix it by not replacing the sh_key when it returns errors from sctp_auth_asoc_init_active_key() in sctp_auth_set_key(). For sctp_auth_set_active_key(), old active_key_id will be set back to asoc->active_key_id when the same thing happens. Fixes: 58acd1009226 ("sctp: update active_key for asoc when old key is being replaced") Reported-by: syzbot+a236dd8e9622ed8954a3@syzkaller.appspotmail.com Signed-off-by: Xin Long Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/sctp/auth.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/net/sctp/auth.c b/net/sctp/auth.c index db6b7373d16c..34964145514e 100644 --- a/net/sctp/auth.c +++ b/net/sctp/auth.c @@ -863,12 +863,17 @@ int sctp_auth_set_key(struct sctp_endpoint *ep, } list_del_init(&shkey->key_list); - sctp_auth_shkey_release(shkey); list_add(&cur_key->key_list, sh_keys); - if (asoc && asoc->active_key_id == auth_key->sca_keynumber) - sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL); + if (asoc && asoc->active_key_id == auth_key->sca_keynumber && + sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL)) { + list_del_init(&cur_key->key_list); + sctp_auth_shkey_release(cur_key); + list_add(&shkey->key_list, sh_keys); + return -ENOMEM; + } + sctp_auth_shkey_release(shkey); return 0; } @@ -902,8 +907,13 @@ int sctp_auth_set_active_key(struct sctp_endpoint *ep, return -EINVAL; if (asoc) { + __u16 active_key_id = asoc->active_key_id; + asoc->active_key_id = key_id; - sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL); + if (sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL)) { + asoc->active_key_id = active_key_id; + return -ENOMEM; + } } else ep->active_key_id = key_id; From patchwork 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: 9671 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp534999wru; Mon, 24 Oct 2022 09:12:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6QLaiSlDJxF7lNXIEBjFX/MZ9ZQbrT51sNl17HEP0tzC2RvK1QuzwLSQJvbYa4Vkt08zMi X-Received: by 2002:a17:903:2284:b0:185:3948:be7c with SMTP id b4-20020a170903228400b001853948be7cmr34901513plh.51.1666627931765; Mon, 24 Oct 2022 09:12:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627931; cv=none; d=google.com; s=arc-20160816; b=D28jgk+m5tlJBNSeP4X0tK12+f9wYPwrIHdjmrCm+A+pdEmAiE1YCXzRIFEDYV/XqA tNZ5CUgzUbng1h74pde7DKWyXLi1kQQhYOwH1fwORB89ouo0kXoByIVAYEqoM6puL3SD fvP/eGu6Yr8XXqI4c17Fu2WJqMUOLARMegmcu2TICuczasDyOOJX0MfQBwYnYIZ/cdX7 xCTsBbRWqgXstFVoExg1+WHj0E8ShXUATa2HIfhuNAAisvIfR8K0U3k2DHHItfipx5zq on17R5zZrjG8E+PNhQt1+liSgK2txwBOPtMVnrgtCBcV8/6gRRDIeSB8mFSh0Tolvos4 wlww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=doSeXkskfeATQsYD2fpMBaLP3sJ1LrIYK70tpBR6qFg=; b=S9lIY5GyqGvtHBz1dkh3ndtfEJoBWYvtYyysh9AFuPRh4Ug4H6VBX0+AmzRohr/fwV uLKCMXvRZuxKIC/+xZQ0rDV6T9Npsj0j4nhxNHDV7prnsFVtOFJKE9svgluSVJWF+xi1 qUoU8Rmq/95JSAEmZfSJ/R2lGswlG6l6oQdFpD6Ke3Hq4s8CGFPHiYeWLIi5uhDCsay+ xwCHv6cxjFMgYaO9oHnK+egydDrtnzRN5IQgmqu9/j++vt4H5D9JUgiHZVt0Vrk81A5c 0XsR3K+/rK/xQhgBFFB7ej3hFcR5eUjTlO8sskEtBip52LTssxp1zknB2fao1oizjW7G OOqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1c1xW0Dq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k11-20020aa788cb000000b005251a2f06bbsi96908pff.59.2022.10.24.09.11.57; Mon, 24 Oct 2022 09:12:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1c1xW0Dq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233609AbiJXQLY (ORCPT + 99 others); Mon, 24 Oct 2022 12:11:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233869AbiJXQFI (ORCPT ); Mon, 24 Oct 2022 12:05:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A2811571D; Mon, 24 Oct 2022 07:57: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 3E8D2B815DF; Mon, 24 Oct 2022 12:21:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 997C2C433C1; Mon, 24 Oct 2022 12:21:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614106; bh=ykeIKIPtHFaP/0AQT6hharRi14M80E4/16PfUS9wv24=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1c1xW0DqW3E0u8WmMQT0qlNiKg6+Ez+x5absYFr3279WwCs7WQI4QALuq4/ReP4PQ HGjHs7SYTAqprGGpfBfA85FR9q4GwmcliVKmJbAbrEx6zJFWm0sHmxuapA0f0Id9Be gzH48YZPudzJxE6sz0oaeVzvUMefVA6rxZwebQKw= 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.10 134/390] tcp: fix tcp_cwnd_validate() to not forget is_cwnd_limited Date: Mon, 24 Oct 2022 13:28:51 +0200 Message-Id: <20221024113028.383305715@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747586050204172043?= X-GMAIL-MSGID: =?utf-8?q?1747586050204172043?= 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 2f87377e9af7..6e3340379d85 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h @@ -265,7 +265,7 @@ struct tcp_sock { u32 packets_out; /* Packets which are "in flight" */ u32 retrans_out; /* Retransmitted packets out */ u32 max_packets_out; /* max packets_out in last window */ - u32 max_packets_seq; /* right edge of max_packets_out flight */ + u32 cwnd_usage_seq; /* right edge of cwnd usage tracking flight */ u16 urg_data; /* Saved octet of OOB data and control flags */ u8 ecn_flags; /* ECN status bits. */ diff --git a/include/net/tcp.h b/include/net/tcp.h index 8129ce9a0771..bf4af27f5620 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1271,11 +1271,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 bfeb05f62b94..24328ad00278 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -2796,6 +2796,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 48fce999dc61..eefd032bc6db 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -1876,15 +1876,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: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: 9093 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp446087wru; Mon, 24 Oct 2022 06:13:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6QHsTLtBxHsSbOl/ew+EZXqrTaqAFADFOwCiT3nBOQZuwr8aMJt3MfY/A8zpFxU8EQgS8l X-Received: by 2002:a17:90b:4a92:b0:213:2421:5f38 with SMTP id lp18-20020a17090b4a9200b0021324215f38mr2541662pjb.10.1666617222017; Mon, 24 Oct 2022 06:13:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617222; cv=none; d=google.com; s=arc-20160816; b=w+UBatv/2uS+AyJHbRlNSZJg0/5t5lh2V53J1Tz6b9pZF+asir9UC9reSwHbZmK+JJ qpX6so8DeqzAutY2YO0v7cdWVHeiQD/KtlILiw1vUbMM4uysOZ8F/fy+127TBdJMQ7tp l1wBVfBixuPPornP9RfYO7LrjOQ5z8N8vIVI4LXmP91uq3DZV2A39PNigKTBRnl+dHhS TeEADjnn3+DuYk7SUESimlpL9b4s5RyrMQ7hZ0QU8TFsw1O3lSpzY1TWc9+7TpTiMyzE mo/Scv4GzOyP3fLxQ9hRuHOLk5r8IfWsOtCnY1PH+rNgqo2ukQcv2lB/3LzHWE0ovx9r bYPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FybOF60lRV1R6y6nkroF8kgdzc+dQB8RZVbrLWhWj9M=; b=LLHZ0hNh6JqiE8ZMkUdpPzxMCFjrCLAARBVtXLdMHNbA89RDm6qfwcNh81nLWtPt0u 5tatJ82Lrd+BNdCq0HnLkEOLJ0qBWOJl32W8TpcMvT3DjH16t+0s/KaoOgavts4Ifekq Ev69JhnbVxttIbwY4xRF+th3yCfOVcwYzWuJXjxgSd17XyqnMKvSIMeflTLlQsbmyET7 spiOZ+tzWOX8KfgWQ+u7ROQuRPqNsFnQXToQ3VnukSquyGP2AbM/UiOmxAsrEB7WJ0nr zlcIvCGtGU4dVqXa80s1PSuShzWhNIPXr18dXowIHifCMrE/XbLrbeZcq8fwvMJ3xD6I a6vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wYZhaXHK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a63190d000000b0043c3f90f7c8si9459413pgl.655.2022.10.24.06.13.28; Mon, 24 Oct 2022 06:13: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=wYZhaXHK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235790AbiJXNNJ (ORCPT + 99 others); Mon, 24 Oct 2022 09:13:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236026AbiJXNK3 (ORCPT ); Mon, 24 Oct 2022 09:10: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 A60C55F7C; Mon, 24 Oct 2022 05:24: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 324FF61291; Mon, 24 Oct 2022 12:21:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41F61C433D6; Mon, 24 Oct 2022 12:21:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614108; bh=6O4z8Vt1okk5kqyVrnSRDcWXI5nJOhSa6Y7hw/EFT0E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wYZhaXHKcdC5dc7sPAw/4bYuQuiJzcFHxz0AcR1VVUSd24o/vtsSsWKwxMS9S7ZQc /ga8wFUC8vi3dyEILUbX1lny6WV2PVHnaAhnFVulJexOvJdjBX1B8akf6Oe/1SbeOD EEjmwsAeAw6mhrvXAt1Yo5f68JMM7J1lvu4kqrxM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Szyprowski , Mark Brown , Sasha Levin Subject: [PATCH 5.10 135/390] spi: Ensure that sg_table wont be used after being freed Date: Mon, 24 Oct 2022 13:28:52 +0200 Message-Id: <20221024113028.425937864@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574819977873043?= X-GMAIL-MSGID: =?utf-8?q?1747574819977873043?= From: Marek Szyprowski [ Upstream commit 8e9204cddcc3fea9affcfa411715ba4f66e97587 ] SPI code checks for non-zero sgt->orig_nents to determine if the buffer has been DMA-mapped. Ensure that sg_table is really zeroed after free to avoid potential NULL pointer dereference if the given SPI xfer object is reused again without being DMA-mapped. Fixes: 0c17ba73c08f ("spi: Fix cache corruption due to DMA/PIO overlap") Signed-off-by: Marek Szyprowski Link: https://lore.kernel.org/r/20220930113408.19720-1-m.szyprowski@samsung.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 6ea7b286c80c..857a1399850c 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -946,6 +946,8 @@ void spi_unmap_buf(struct spi_controller *ctlr, struct device *dev, if (sgt->orig_nents) { dma_unmap_sg(dev, sgt->sgl, sgt->orig_nents, dir); sg_free_table(sgt); + sgt->orig_nents = 0; + sgt->nents = 0; } } From patchwork 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: 9936 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp599469wru; Mon, 24 Oct 2022 11:45:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5SqVpdWqGQ5mjUSOdVHxZzzFZk4eRmFfkQ1y4TclqlzzYVh9KC7TTe0sx+zB3nbbbnyCu8 X-Received: by 2002:a17:90b:264e:b0:212:d06f:35ad with SMTP id pa14-20020a17090b264e00b00212d06f35admr21203592pjb.2.1666637154955; Mon, 24 Oct 2022 11:45:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666637154; cv=none; d=google.com; s=arc-20160816; b=EpxagShEOSbDvPWaw30Sen2iXaU9js1gAg4eU1UVPcJdO0AbT2yhGP2np5Sh+wOxcr 6RemJJpvltnMttRKhYeOEXIRiaRGYwMuH+ZINjqGkO5SBPj1TSUmlyRrw1VJzW9uE1qR XEglFa0FHIdVBrJKGY88F4BDgN2juC0jsfwXcdFKgFFxnyv57IabIIdD7EDyXkGbf7vr hqA7BiTAHpdVZQ5Ct6Ldmdbu7nZsMAmQXRza6mxHhP930vnw1rwVe1MOt4WaDItVuDjv JrAwGbKbSTpdKYeREbpnleplscJiRkatS8gdUXBOoHOURSb4t/r7Sjbldxsz0ErVW66B FlPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xgW/e4p+OXSBThFjvJkn33vQ0QGDMIfcyIz0b2IGvdw=; b=W6toBA07rn3Rfs7ahrpKJzHXwNWJJRJAZu8cuUqouLBn2d8Yl0u48eggFIzzsqByGp Bszmb8bUZhvPieXQZQJD7otD5L8R1QepPIgbhIo0ZjddlCV3i1FTXcXzWP5SxCW+lwje EtlC4eMYQqQO3vD5bDfCxXtDWUpkwx4xOKOKV34WBiXqwqGh7rpxYkO67r1sEGU7KC6G s6QQqyafkQWFDfmx9lJbNt4SjFuAdw3bxNhU78YPMnw10QQPto4wDItuqrSWvuy9iYzX cD89C74SJIcw8y6O+AfHt2U4lThU9T7+tjLVBw91M776IV6KxOTq81yvSDuPfXWkibJI TFJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OkAc5M48; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r36-20020a635d24000000b00455074c7901si340443pgb.36.2022.10.24.11.45.41; Mon, 24 Oct 2022 11: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=OkAc5M48; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232392AbiJXSo5 (ORCPT + 99 others); Mon, 24 Oct 2022 14:44:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232628AbiJXSoL (ORCPT ); Mon, 24 Oct 2022 14:44:11 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D32612773; Mon, 24 Oct 2022 10:26:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 09C8ECE13BE; Mon, 24 Oct 2022 12:21:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD360C433D6; Mon, 24 Oct 2022 12:21:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614111; bh=kv2aafQZWXxG9dFeHNnit7opfoXDwVGlj6UlCq69Ok8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OkAc5M48gTehdplOwUwLdXoprtGi/OalDqHDyZd1+zXQ8pTIkDHnRiNUh+M0+9o+Z gzDii+N8hlz0X685ofSBBtXHOuIV1pmbrYrpNW9eX7UDtJaeLZ1/iHL5YQu36gnxTi uoQW+fMxKQEPE1rVtFGQIgUrhSKfkP6MOJOte5gs= 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.10 136/390] net: rds: dont hold sock lock when cancelling work from rds_tcp_reset_callbacks() Date: Mon, 24 Oct 2022 13:28:53 +0200 Message-Id: <20221024113028.462605528@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747595721535872664?= X-GMAIL-MSGID: =?utf-8?q?1747595721535872664?= 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 5327d130c4b5..b560d06e6d96 100644 --- a/net/rds/tcp.c +++ b/net/rds/tcp.c @@ -166,10 +166,10 @@ void rds_tcp_reset_callbacks(struct socket *sock, */ atomic_set(&cp->cp_state, RDS_CONN_RESETTING); wait_event(cp->cp_waitq, !test_bit(RDS_IN_XMIT, &cp->cp_flags)); - lock_sock(osock->sk); /* reset receive side state for rds_tcp_data_recv() for osock */ cancel_delayed_work_sync(&cp->cp_send_w); cancel_delayed_work_sync(&cp->cp_recv_w); + lock_sock(osock->sk); if (tc->t_tinc) { rds_inc_put(&tc->t_tinc->ti_inc); tc->t_tinc = NULL; From patchwork 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: 9068 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp444901wru; Mon, 24 Oct 2022 06:11:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7B58zNZDtnyBYpEeaiCFSiIsNv7Lv6xXAzTvE0Xzmw39Hhf+g4f2wFAG8sFZ2RvZMHzXPy X-Received: by 2002:a63:1521:0:b0:43c:9566:7a6a with SMTP id v33-20020a631521000000b0043c95667a6amr28230148pgl.339.1666617111798; Mon, 24 Oct 2022 06:11:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617111; cv=none; d=google.com; s=arc-20160816; b=oeAzTBn0LiPhWV9kRnDb/TFY1LvklyxNHZd4vWMwACDSZM1vcRRl+Qg4xaR0AVhBZF NDu4OsZM465BDUyTKVABvSIyFr+FDlMX141EHMQYvQ2wAJJSQ2AUzF2HEpBI/Rmu+DDC UV2we86HvHe8/BljJ9IjGwnE0MBiGQ5xM83ukDy/IQEaocRbkwTTO4AtogtSQhQd4i8F 2yhQLwYqGYfjtxQ3HMTc2e/jklxOxB2j239aRsC72AunNi2j58JsWyRq+4u9n9f7jUoS c3fintF5Wonkes2LbZL6fOzJ35eX/sGYPayE71CF/fA0L93NCiAaW0MYUB0/3ZayupSO wrXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fw8iFZPatKPxg2sFnKktRfdQpQkSO8PILpvSCERDDM0=; b=e3XVkE1S4PeAKsIV4zq3P8Y7W9U8p5F3dQ111jBxPbl0/W7lXIJxfmaUYsy/4MHGGU TXKAbtuEMq7SgDL11VEf2hGLzRWc+/GuqZErmWvMFE7oJ3eE2ITrvpUo69fkLXA/F4Eu SK9FaqILAAAaVb1zqzx/e7l8O7h+8Th07fxbGvnJliaaYZKbqQhoH+4BelkG6xMe6pKw LvXu4HseUOvRLwNmdriIJ/0LJloyTkx5bGtD5/0RUDIZDB2RP9j9CS+KBYZEv9/J9Ens FBoYbC9AAO97QCitugwClrM6gHnnWDPbx0VweWZXdgAM7Ry5iXD4sVbaeC3x45Pa/Y6e E7Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D1XK1Axq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b10-20020a63d30a000000b00446ec91cdd8si38878363pgg.604.2022.10.24.06.11.38; Mon, 24 Oct 2022 06:11: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=D1XK1Axq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235579AbiJXNLO (ORCPT + 99 others); Mon, 24 Oct 2022 09:11:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235545AbiJXNI6 (ORCPT ); Mon, 24 Oct 2022 09:08: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 E0A169E6AD; Mon, 24 Oct 2022 05:22: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 77F1D612A1; Mon, 24 Oct 2022 12:21:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86A7AC433C1; Mon, 24 Oct 2022 12:21:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614113; bh=FDJj57zct8g34Bx1kgQb5O2g5HvH0eUpe2PeLXP760g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D1XK1AxqWAL/74Y6kh44AOcAJMUHx0BT5WXJnC6fMASzkWEuqRIXTpK+Y/CTcDHuF 8WOBmhMME7pnstJIvBsWSKlPhP6eebjtV8g6BALZXiQY1iwcGkKKb4tL8Z7Y3A2yLS B7k28MyY7YceLpwkYc3GIAe68K11mZKI9rmxDfV8= 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.10 137/390] bnx2x: fix potential memory leak in bnx2x_tpa_stop() Date: Mon, 24 Oct 2022 13:28:54 +0200 Message-Id: <20221024113028.509395386@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574704682647239?= X-GMAIL-MSGID: =?utf-8?q?1747574704682647239?= 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 198e041d8410..4f669e7c7558 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c @@ -788,6 +788,7 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp, BNX2X_ERR("skb_put is about to fail... pad %d len %d rx_buf_size %d\n", pad, len, fp->rx_buf_size); bnx2x_panic(); + bnx2x_frag_free(fp, new_data); return; } #endif From patchwork Mon Oct 24 11: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: 10161 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp640141wru; Mon, 24 Oct 2022 13:31:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6LvdYunIdRxR5LAinxXTITnqct4anZyVeyU6D9r8p8Ta2ZAn1DD9kkNah2EIBmPdQ4OUXY X-Received: by 2002:a17:902:820a:b0:178:456e:138 with SMTP id x10-20020a170902820a00b00178456e0138mr35279594pln.145.1666643510298; Mon, 24 Oct 2022 13:31:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643510; cv=none; d=google.com; s=arc-20160816; b=whY7mUx586M6xekUX2SgGoMINC2yTMyMiCQ8nPtaq/DVL++mc/QjBmEYCVXaDmiLL2 EmvmteacnAh7dq1gQwhYfc+VkzpTAgU5CTYxhHTZRmKC9yA2N9neAObOym+xaHfJxom3 B1qInNKavCYqlFgjWknc4gj9gBrVftH7bXPV1vLrcus8qWlLtEmiAMZwP4kL4oGbQZ5A Nw2WEgTmtji4s37T9nRbjUO2XM9Bq9mJd8KOiWNt5hYX6tYEXvZqwXKp656IGn0kLPC7 pHqwSg6PFs/U5pkwQBVKSalqUPvJPcB0t7v8Ahscr/3zXZ4EStGF5IdSo3ZYUMRjwlfh s1wA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8yQ2d0e0v7TVAFcTm7DMifNlb1Bp2LDgPtKJ12A1QpA=; b=uINOMHGypSpih4ce9DEEi6jl9i4pi4L3CiZX8yRu+vNY8DwaN2miTvoFMkp36Ami0Y rFrfkVDD1CueapBGCgXWoPEJrGJyjU7QFpzRu0yXeJ/vqW26XmaHfPbUXsCEMPbBxed8 cyfhmX8C+UanLesqabGF8n9trJc1GIN5s8Mduqd59PNI9CCXTG8xecQD6bfppwQa8qAd uq6PFGQGUXnAlBNLg8TgvBFIU90mZx7WDU8ma3mMZBiN4IpgRfC3YoURPXFYEMnJGFyb GSue53DkShF+O4xyIgWeG3QtYZ9ZXN7qk9ADfJlWBTjj/2iwonTFvTmsB1lUS1zu3avw 2rFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qaJcT9bk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l1-20020a170902f68100b0017f92d54633si656803plg.243.2022.10.24.13.31.35; Mon, 24 Oct 2022 13:31: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=qaJcT9bk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233887AbiJXUVB (ORCPT + 99 others); Mon, 24 Oct 2022 16:21:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232593AbiJXUUd (ORCPT ); Mon, 24 Oct 2022 16:20:33 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D51D52D750; Mon, 24 Oct 2022 11:37:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 337B6CE13C6; Mon, 24 Oct 2022 12:21:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F0D5C433C1; Mon, 24 Oct 2022 12:21:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614116; bh=hgLAecfST81JQUjnVK80uoGvvVWrskI4THhMVg9VXsg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qaJcT9bkhjZT3Hy4/BbXTi0kE+de8OSWV077u4xT6dWMxrLkQm+u9MzzJZjHyJ4uV 1AGgUB9qlLUUI2IE99cnfyMw1UbiPWdksD8ramhcWjAyapz+F4lH6NrSOe/e8qVdpZ eSna75qYCXLqXf3DxXh0uOfTVLrq90sG97oxDkvw= 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.10 138/390] net/ieee802154: reject zero-sized raw_sendmsg() Date: Mon, 24 Oct 2022 13:28:55 +0200 Message-Id: <20221024113028.548075544@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602385639002426?= X-GMAIL-MSGID: =?utf-8?q?1747602385639002426?= 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 7edec210780a..d4c162d63634 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: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: 9286 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp463266wru; Mon, 24 Oct 2022 06:47:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6tVvEIJfwmew1jsiFMJhWPpEpqRv84bVEFIj09x+I0MYk3me44quRE/uxnVbk90ExhCkGr X-Received: by 2002:a05:6402:5c9:b0:446:fb0:56bb with SMTP id n9-20020a05640205c900b004460fb056bbmr31543809edx.173.1666619241716; Mon, 24 Oct 2022 06:47:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619241; cv=none; d=google.com; s=arc-20160816; b=LA0AvlK/kD12Efd6FDmQOf0bzVBY20BawE3ljNDt/xqSvgfKksQpVsxlme+5R4RV53 cv3SCYFjlwXlYZCppEXLQ+IS//SlMbkdSvVBJiWH1VqACgJQyg3HXzgRgOtmdeu7bQ8P Os64rw0ZCo1GBqRXU/6w4sTbbzbw/roYmPTGmeVRFbBkEtsuazVU6ys/6/zI7qWSllSI Wf5EnMREtd5kp46IBQsoSZyYItp371mWNnFbBwtV9Y3ZHvB/hw5+kXkBLEFtoUPKA1Oq rKxmGmBjSA3QZ5NuQ2qLZ36cDIqaXXw/ek+/UkyV8dju4iMTJz2tNee1nyHZ70dxq5gS khuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=diDHK7uz9FPl5LEcTNuIXR1GXpphOT9AyKw6P4MdMmk=; b=EJmYiR8Z+CUI3SfTiweM50p9ALslA4E20+pAj/nzb0yAT9KeyXOI/UTvZ79FNoHjwT o/q5kHJ3+iVTxDXSrssVBOzkJDjmNPF5ogwoCkDn4eUYRr1ktnJZlmxHzBFpKRFWeB8u 4n5eZGWDIKhASNlsOjwNZAQxx3ci82Gd1Z75gjQ+4/LpPrtALTxaiI899Wd1FptmGaZ4 0KFrAMPF5ygdEgH5RZvAS75EfyYdbEu7CcHpBEcVH9PaHZsaZuR+MuZo5lhEz8h4Qq3C WtLh0+AAY6HMUjDJLQl/peyT8fQ9GdrXy0eSkBzYxzVCjlhxPOKaLUT5ozdN4kFJ9rP0 tIHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="l7qKr0/q"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y1-20020a50eb01000000b004615bea1d62si5291814edp.472.2022.10.24.06.46.54; Mon, 24 Oct 2022 06:47: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="l7qKr0/q"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236574AbiJXNo2 (ORCPT + 99 others); Mon, 24 Oct 2022 09:44:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236946AbiJXNlo (ORCPT ); Mon, 24 Oct 2022 09:41:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD12589CD9; Mon, 24 Oct 2022 05:39: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 A8793612B9; Mon, 24 Oct 2022 12:21:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC426C433C1; Mon, 24 Oct 2022 12:21:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614119; bh=5oeE4Nip2MNHWH6639bIy7GZaUUjFD33jk19AaLahBA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l7qKr0/q2nn5g7DICBBi1iW+p3vJ60XUy/XRlteQlErv1SCSPgGGTAPduCBxaH1+9 b+Xtu5zW9wqYFLTghpMvSnMNHt5Ytg/EpR8VgoU7810nvQTGdCHuRut0xa+R46nlPj ywI3h9IejvZdd8D+PWIv1k2IohjMgYQ5QWqZQ5go= 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.10 139/390] once: add DO_ONCE_SLOW() for sleepable contexts Date: Mon, 24 Oct 2022 13:28:56 +0200 Message-Id: <20221024113028.591867745@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576937748910140?= X-GMAIL-MSGID: =?utf-8?q?1747576937748910140?= 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 feb7f072f2b2..c0de655fffd7 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c @@ -771,8 +771,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: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: 9070 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp444994wru; Mon, 24 Oct 2022 06:11:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5RnRlxy8uYDUh7Ey4ZI4xbncz2YuThHYGo2gce6rbNF+n/haD8KXPeXMEUCcLquy9+fcA+ X-Received: by 2002:a63:4757:0:b0:46f:2780:dc53 with SMTP id w23-20020a634757000000b0046f2780dc53mr465714pgk.40.1666617118285; Mon, 24 Oct 2022 06:11:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617118; cv=none; d=google.com; s=arc-20160816; b=DenetK3uiXo4LOVartqCk2aFG16k6rd8sPdSWdtrVBuyoca3Q8RTSdqgBcRWM3QUmE ebjx96U5x/HMOhg5LRgdCYdWQjUM1R/rnq7++OgkTht6CzLL9go+3l9rK7pjb1UqUOqY a6zWRUE+ngdSkBW122hobs6tahHFdzc9HBwF2HCAungtjXlXqZQ+ezl/gCxUyD2Xot2L a33NA5mRV66pJKi4uItO6sKMkSNopB8wqkN75k0kKuMBxDllJjnT0WiMo2dtn+YPNQM2 jaIQDx11S6dPRbnPpPR94d5pKVIOCSMJ2yYTAJozn3Fz8z/RFdWgB+uDyNuMQ4Y+ZQMr gCPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LgsMgQ7nPDBX9uPlUFc6xJhUnMVCziolkwMhjtKWA70=; b=orvWTm5rILBYwH/7YEVm6j0wRT6Pq5ihaMvFVPD6gJmt1QDD4pjER63FunuTqPA4lh fFQ/FBLnuJVTNEHD0GjwFx6e6CLXS9Ql5joXwjKeQofOfuxxNfv3XFQXt14Xc3IsfRgj Ci9Uz5lcQG3MVidtExQyCrp+VRhS1tm+POA97AjOoCSUkI/d79HDf9OZ7mum5dkShC+m P8pbljl/O8lPYphC8tPrnSIVonDU+bAkIJ6Yry+TV1LEiU+KDQbwDIPp9CBSz20bLhuc tSNds+VXyLJOLNUH7z0JeSTvs8iADJNMr7HE3mUtxM8VjtLJTjL8iapl7Wn+w7YKoLUO 1XXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LRd8Dypq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o7-20020a625a07000000b0056bba31b399si5075950pfb.220.2022.10.24.06.11.43; Mon, 24 Oct 2022 06:11: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=LRd8Dypq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235598AbiJXNLU (ORCPT + 99 others); Mon, 24 Oct 2022 09:11:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235543AbiJXNI5 (ORCPT ); Mon, 24 Oct 2022 09:08:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E6A59C2C8; Mon, 24 Oct 2022 05:22: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 5501E612DA; Mon, 24 Oct 2022 12:22:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B531C433D6; Mon, 24 Oct 2022 12:22:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614121; bh=XI3reBzmSXhzDFcdk4Qld6RMRqmDgTm82u4lh23kt8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LRd8DypqmPg9+yrP8Nj8Co/N4NfAcB80x0s1E+uKhjosUjylu2ANIu91YoKl0/ARf 5L4yZJ1cZHHSAUIH9a90UKau8nQO5pL2eRsDU5II564FN8uIuFui6V72e4A9d7Mjuj TopnrNOqCaHIjmxfQ0sftmBe1pCYWOMn+/cogh7U= 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.10 140/390] net: mvpp2: fix mvpp2 debugfs leak Date: Mon, 24 Oct 2022 13:28:57 +0200 Message-Id: <20221024113028.631068399@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574711795105378?= X-GMAIL-MSGID: =?utf-8?q?1747574711795105378?= 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 d825eb021b22..e999ac2de34e 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h @@ -1434,6 +1434,7 @@ u32 mvpp2_read(struct mvpp2 *priv, u32 offset); void mvpp2_dbgfs_init(struct mvpp2 *priv, const char *name); void mvpp2_dbgfs_cleanup(struct mvpp2 *priv); +void mvpp2_dbgfs_exit(void); #ifdef CONFIG_MVPP2_PTP int mvpp22_tai_probe(struct device *dev, struct mvpp2 *priv); 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 542cd6f2c9bd..68c5ed8716c8 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -7155,7 +7155,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:28: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: 9273 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp462536wru; Mon, 24 Oct 2022 06:46:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Yx0ct6Frtm3/WaqZ2LYsVpPkX4zycKT5qqqE7WYnDR2JCxdcdl0b0OvNOQJYdCXHIG6b5 X-Received: by 2002:a05:6402:344:b0:461:7d4:9c9 with SMTP id r4-20020a056402034400b0046107d409c9mr20584825edw.141.1666619167950; Mon, 24 Oct 2022 06:46:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619167; cv=none; d=google.com; s=arc-20160816; b=0SQoe3raUj/kqkw1asKgBGGj9DmnMYc1OkgDQRCFxSIBin4Jh/zjD/yy146anl7jGy TMiNn2UPjVfczQpxUMLUOrvw6Z6eul5N3elclYa9qhjHcuouTZVAYkyQvkfUZp52As2Y y6MOFZPnjXb9b5IN/pbzsTSCjJiZbMMjAFGcf0ARorETr/0T7Or8C/o8xcGASOUdGkrT /TQRdZQQVIZiZE5xn4ycuaNEefSgnSOy3V01ttybZ7Y5wULu3t7uWp9U15agqFEw4/GU YWIK0Qv0rwZGui94lvvmt8ferVCtAp7mU21SvR7wX0z+BxQaCAY9jKhCvyV9IqnTUymK N9yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iE95Up2nP20MVDS/JFZExFHm1dsk+ymjMwrsMBnSeNs=; b=OQKQHR2JzQwfMubQVVj3iangR38HNxTM9CNq0x+YeExni7KgmsYRTGumiB5FHcFKpI t+29hDrP2cMjkCLAkb4NZNwfSIBkClM+4gLWZMvRkX1hz21mV//ZZ68Qbnpl9JSke97Y 4bWfHXkSyxrhoUXcuSkiQ/i/gHnKdp65JqlaqTHbtaGDPmVhe5Ofg/H6qR7ScBKSJoxn RYbWaLM1E5pbG3gvguwL0pPxlsmvbij7LiatQbXQ+JOCkhdVOgbfr4X6JVs1f/GTp4IZ sMvg1kMJk7FIW7Eg2p+I20CDbRBhc3RkPk9am5O6qbHy95o3oAM5SSfPisc5xJ+VRCwq Epdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QKCDr4DX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i13-20020a1709064fcd00b00780def41dc4si29846650ejw.527.2022.10.24.06.45.39; Mon, 24 Oct 2022 06:46:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QKCDr4DX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236368AbiJXNoG (ORCPT + 99 others); Mon, 24 Oct 2022 09:44:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236896AbiJXNld (ORCPT ); Mon, 24 Oct 2022 09:41: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 071EDB48BC; Mon, 24 Oct 2022 05:39: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 EB2FF61252; Mon, 24 Oct 2022 12:22:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A674C433C1; Mon, 24 Oct 2022 12:22:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614124; bh=2KuOyOV61eUspe7lepKwhElGOBYuoUrGDz3e1x9QyYA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QKCDr4DXXs9ssfYxwbCRgPMqwtfUYXJA57lLOuEJj8GE3NFKBErjuoM37XnWsxKPY 27lyGR5EBMFQRx19aBe8hE64Ijs51zrpX2M9INyibFkFnO4rf9uhVsKM9NuaA86ghG oBDGpt/BHmvVtLv7NzypgRZjRO5xKPGmKVkuOuFU= 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.10 141/390] drm: bridge: adv7511: fix CEC power down control register offset Date: Mon, 24 Oct 2022 13:28:58 +0200 Message-Id: <20221024113028.672236319@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576860618689954?= X-GMAIL-MSGID: =?utf-8?q?1747576860618689954?= 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 a0f6ee15c248..711061bf3eb7 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511.h +++ b/drivers/gpu/drm/bridge/adv7511/adv7511.h @@ -386,10 +386,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: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: 9664 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp534608wru; Mon, 24 Oct 2022 09:11:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Zu1jIiXOYB7mnX5sf01Mi1yxYXx/uF5Lu+CeFW1Q79BGK7S/1PMXMgjlEwi4qKb+aegIu X-Received: by 2002:a05:6a02:18f:b0:44a:3972:898d with SMTP id bj15-20020a056a02018f00b0044a3972898dmr28427757pgb.525.1666627883663; Mon, 24 Oct 2022 09:11:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627883; cv=none; d=google.com; s=arc-20160816; b=0B4TN3Z0VPFftyABYv744zWaXSqhG3Y6MlUWJDK511mGAkNmRTpDwfUofecTTYriBx KzRNWHN73OOwjEVbA0jdfJZWksyi4z6L8KliqRITK3RVPkoVFxiHkAQLIrEvULuERytO +QG5296t+kCVC7C6Rl+J44msOWRsBpCjlv/faVzxC9r/+3TiAjWAcNiSil8IyJpqdfAd OKci/Z2qvB+8IrL66K4qe6PBbuo5qdjj8wqSFy1FnW5dBrA/dMJXMOVbV90mjTwngIjo 9bAk+B1ct4I5Go5YRMRsZjNXxt9SfjqTWUU2OA652DJRgL6guuFraZGvaZrZauoBqIRc 01Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7eEqY6k1uVv12BMnpyTNdmCMALjaybJV/AuP/23o6Y8=; b=J21pxuqh1A671XDd8ItO86VPM/S+S72HnWPRZCBF49sw7SqCzHyxfojOSch7P5aQDH u0rJqLyaKEhF9RtUv5mxIe/TDu+0UGF7d48eiASvrCE7XfXtamlXMY9Z2XEaWpIRUG8V yAYLEuXpP9lJJng+HHML6kTxkQbQETt95Hu+yrdNC9eoPAnsfMdk/RHjEzy3IZqnvH6W BqG7jWaYUTQA1k3ODvgXKlwc5n+lG/NABamtfI2y0Kzaju+HJDy7mVHdWZrx4pMEPyNf 13Ytbfo1PCQvnX1eBJpfW6pCXxaUSeQu5EHw/MvFetwUv0d8j8dDR+uiSX/YdWp0jSzb 6rbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XfHj0BdO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cp8-20020a056a00348800b0056aff71af29si30197pfb.209.2022.10.24.09.11.10; Mon, 24 Oct 2022 09:11:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XfHj0BdO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234032AbiJXQJX (ORCPT + 99 others); Mon, 24 Oct 2022 12:09:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233732AbiJXQE7 (ORCPT ); Mon, 24 Oct 2022 12:04:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2812B11D99A; Mon, 24 Oct 2022 07:57: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 479B9B81619; Mon, 24 Oct 2022 12:22:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9CB53C433C1; Mon, 24 Oct 2022 12:22:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614127; bh=Aq5KipdhSVuTofrbZe5rRzgyLMr2ZNid2GkaJRMPKIk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XfHj0BdOThBnjp9wVqThYXnVFgRSUq5B+kVXSahQubQp9opGR3H0x7P6CoXScjrUS SJd8UnOXqGuoPoaif+3Ednx3jQH66py+YRPI3fJxEYLq0xcOu84qeZ37BG1F5nGYJQ /Ing1vlQQEhA20pMNcDgy0QXkVxjVKXfR9sUZBBM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Maxime Ripard , Sasha Levin Subject: [PATCH 5.10 142/390] drm/bridge: Avoid uninitialized variable warning Date: Mon, 24 Oct 2022 13:28:59 +0200 Message-Id: <20221024113028.721980804@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747586000026258009?= X-GMAIL-MSGID: =?utf-8?q?1747586000026258009?= From: Dan Carpenter [ Upstream commit 7d1202738efda60155d98b370b3c70d336be0eea ] This code works, but technically it uses "num_in_bus_fmts" before it has been initialized so it leads to static checker warnings and probably KMEMsan warnings at run time. Initialize the variable to zero to silence the warning. Fixes: f32df58acc68 ("drm/bridge: Add the necessary bits to support bus format negotiation") Signed-off-by: Dan Carpenter Signed-off-by: Maxime Ripard Link: https://patchwork.freedesktop.org/patch/msgid/YrrIs3hoGcPVmXc5@kili Signed-off-by: Sasha Levin --- drivers/gpu/drm/drm_bridge.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 044acd07c153..d799ec14fd7f 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -753,8 +753,8 @@ static int select_bus_fmt_recursive(struct drm_bridge *first_bridge, struct drm_connector_state *conn_state, u32 out_bus_fmt) { + unsigned int i, num_in_bus_fmts = 0; struct drm_bridge_state *cur_state; - unsigned int num_in_bus_fmts, i; struct drm_bridge *prev_bridge; u32 *in_bus_fmts; int ret; @@ -875,7 +875,7 @@ drm_atomic_bridge_chain_select_bus_fmts(struct drm_bridge *bridge, struct drm_connector *conn = conn_state->connector; struct drm_encoder *encoder = bridge->encoder; struct drm_bridge_state *last_bridge_state; - unsigned int i, num_out_bus_fmts; + unsigned int i, num_out_bus_fmts = 0; struct drm_bridge *last_bridge; u32 *out_bus_fmts; int ret = 0; From patchwork 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: 9652 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp534296wru; Mon, 24 Oct 2022 09:10:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6+LKf89isA5YURYn/BdQ9OVRgD3AP5Plhvw+haxubup6F2i/fNT2r938FTqd4gdOwt6mEv X-Received: by 2002:a05:6402:35cc:b0:45d:442:1765 with SMTP id z12-20020a05640235cc00b0045d04421765mr31678457edc.51.1666627854933; Mon, 24 Oct 2022 09:10:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627854; cv=none; d=google.com; s=arc-20160816; b=YWALcsFOspNU5SJjqto3YZWGI+0yIpNVpdfrgFlm4fG6uOLx5BpeLPpRcJqGuJX+0v L3VoUhTlPdufjeS4xVlK7VjhZnmlZE8jovmzPNg/HzXhPsa5FVdBeAzogq6qJxIUEtj4 ePDLlBhek394BEUoWmkO/MHLTLoCRhba59TxUOdJEeYnnF4XW6kpXddLyUZytHMfffO5 /rxr5c7aZs7rGqaGvMQiad8znZJf2YmwQqjZR9+QLZWAr3SmPodekUETtaVYLtbaX98D fXVQII3dLBlqBdZjStpfkMIcJJa6BOWWONpb2XQJur4p0RtGV4gATy5W/MjhPFme25Es ZHDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RAx6rLVJjn5BmqZ9cIXNrbm3R9fkMghF1ej2DK+Wt2U=; b=zUhXcfi+TXRWuMprYUoGjaECpW2kSlKUfiaqWaSCfG/jtv8LKVYe0/eGKsTDYnDCHA HHjbLvFr1dpOEEhU8M4jCNojYagKmIVAqYOukEALPa2/Fx9DyE6z4GXUFkDOqyNQsuby ZXpGDqDrij1rDpj36lPiOs507h/VDwrbHA7YpI+aa5qAF/4Bxvmkt4nNyJ0XbWZjyEUt 78Hv/s1+xAx1qe3ARFlDax8VuqcbrvuUmx6mH2x7wwnfcuii4gSFVA3KXQrHM22apIaU bl0uERMd9R+ehTg67v5wMuxlgXdFXf5v1OoC1PIsMkgfBaTbaKUV/klt/PB5LHmP9QgA 6PlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=S5FeFbQn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw5-20020a1709066a0500b0078d9f02b452si102655ejc.861.2022.10.24.09.10.29; Mon, 24 Oct 2022 09:10: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=S5FeFbQn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233430AbiJXQIP (ORCPT + 99 others); Mon, 24 Oct 2022 12:08:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233338AbiJXQE2 (ORCPT ); Mon, 24 Oct 2022 12:04: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 83F032655E; Mon, 24 Oct 2022 07:57: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 7808BB81620; Mon, 24 Oct 2022 12:22:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6358C433C1; Mon, 24 Oct 2022 12:22:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614132; bh=w37r33LIb9FKUf6H97lfeWvSi5XF2Tniw+6hjdytPr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S5FeFbQnw6KlFxsoRm9FHtII+Lsc418GE6m02vPVlDn8uNd1gJUR8XQsAdT44R8sS 0BMuYMNnF0IO0DXTxKuFQ6symKJqFaXFgk39GDCrm726KMRrxfIdvXsdI9CitGfSJO 7ygeLMr00PZwUU5DnY+Tx8rbJr+92Rd04kVngHas= 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.10 143/390] drm/mipi-dsi: Detach devices when removing the host Date: Mon, 24 Oct 2022 13:29:00 +0200 Message-Id: <20221024113028.765547276@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585969558811378?= X-GMAIL-MSGID: =?utf-8?q?1747585969558811378?= 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 5dd475e82995..2c43d54766f3 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: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: 9902 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp574101wru; Mon, 24 Oct 2022 10:39:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7PNYrE2BQ4yqUP+1ZNUwi+G3vfzeTZJ1+obXJf3ow6vB3s2AuhDqLoGI5WBMvHLS/g5hrq X-Received: by 2002:a17:902:e54b:b0:186:5fba:13a5 with SMTP id n11-20020a170902e54b00b001865fba13a5mr25713901plf.173.1666633189348; Mon, 24 Oct 2022 10:39:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666633189; cv=none; d=google.com; s=arc-20160816; b=z2bTep8FqZdR6/uAl307aTIEnnvCW3Bj3q3m/MzmjKtl8VkzYxLD28IHze3A6cE/br anunHU/tcU0Fmy0PtZO/J6w7GuQbNsaAG3kqsKjp7RS6p6CbTkX4ULTSFndlyN/2LZrz OgrV+XKalTWDYOKE9IxHkybGsqt1QX/ov3LH14mOOBuhCc/K3C0JK8TssejqyH1RIY09 KJ2zt6UXfHCLl79iC9PrX23JgRrfqbuzdiOnHUoRsn+sw9U8EN/5IsK5O/cnbvYRMmrX XRcr8Kmqeaqifd32Fk2s+vjngQt2Su0yO6gvuOP5OEKkwlPJp3KKWlaO5Uu0IkaW8PoP K1gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IfanPIEHlfsFv4PvjukZbZejIKTi7mcEjDnKAJVa++E=; b=AT+clLKXEK6Ekami5nZOY6i83NkQZXvsV1NgudcqyjgwoS4zou7NBER2wd7LJdI+9i 3l3NLPSD1CvprDAn7c1IIDGnfH0JDPFgU+zL9e+2P6C9443R8kXKbXyUyPC8Wy4ytBTM VTFHW23ocwOI1atf31nEyJPb7eLGjP9GmjFEWGgd8jb+ciAd04i28N6BSXIeCkN367LR 7U36F6LRfdrXhHOq4zdJ8ZRPBPKRG0VMsMOIILhwAqTZGE/au6XkIVpPsvpTreigD9S6 YUClmB5pgzcea9JDmHazBlyV6Umxd73F91Tj+wVuh2jJRFoM7O+8ClLutxzZDN01vFE5 zE0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=r7LgSN7F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u62-20020a638541000000b0046b30704f88si133974pgd.5.2022.10.24.10.39.34; Mon, 24 Oct 2022 10:39:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=r7LgSN7F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233343AbiJXRiK (ORCPT + 99 others); Mon, 24 Oct 2022 13:38:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233286AbiJXRhj (ORCPT ); Mon, 24 Oct 2022 13:37: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 9922F7F25B; Mon, 24 Oct 2022 09:12:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2276DB81646; Mon, 24 Oct 2022 12:22:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 801C6C433C1; Mon, 24 Oct 2022 12:22:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614134; bh=x6mznkUKS4RGGDEjJL95F1nepkI4ncjozWX6b+ZXK9Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r7LgSN7F1LaFlz+UZWtWz39WTA/F0Cx2e5VSYTaAVeZDAHSEeVIWTe/rw97wGV6rV uyVZSrgPF57b0NeZ4RYDZ5/8EOfGSUZ7P4gv56Xxb4trrfy4kKgWRkKRM7tnsPVwQn 5mQR8eXNCUO6+qP/hYkoawjWzSELC43xoya6glic= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen-Yu Tsai , Neil Armstrong , Robert Foss , Sasha Levin Subject: [PATCH 5.10 144/390] drm/bridge: parade-ps8640: Fix regulator supply order Date: Mon, 24 Oct 2022 13:29:01 +0200 Message-Id: <20221024113028.819215442@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747591563016945753?= X-GMAIL-MSGID: =?utf-8?q?1747591563016945753?= From: Chen-Yu Tsai [ Upstream commit fc94224c2e0ae8d83ac511a3ef4962178505469d ] The datasheet says that VDD12 must be enabled and at full voltage before VDD33 is enabled. Reorder the bulk regulator supply names so that VDD12 is enabled before VDD33. Any enable ramp delays should be handled by setting proper constraints on the regulators. Fixes: bc1aee7fc8f0 ("drm/bridge: Add I2C based driver for ps8640 bridge") Signed-off-by: Chen-Yu Tsai Reviewed-by: Neil Armstrong Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220721092258.3397461-1-wenst@chromium.org Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/bridge/parade-ps8640.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/bridge/parade-ps8640.c +++ b/drivers/gpu/drm/bridge/parade-ps8640.c @@ -333,8 +333,8 @@ static int ps8640_probe(struct i2c_clien if (IS_ERR(ps_bridge->panel_bridge)) return PTR_ERR(ps_bridge->panel_bridge); - ps_bridge->supplies[0].supply = "vdd33"; - ps_bridge->supplies[1].supply = "vdd12"; + ps_bridge->supplies[0].supply = "vdd12"; + ps_bridge->supplies[1].supply = "vdd33"; ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ps_bridge->supplies), ps_bridge->supplies); if (ret) From patchwork 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: 9078 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp445468wru; Mon, 24 Oct 2022 06:12:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5XC8uOd4hQABssuTT1DWVPg4qVIYJoHeo2sAGg7C1yuR1QRZJjvuIWjVdqa3jcLfA6xTlv X-Received: by 2002:a17:90b:1c8d:b0:203:cc25:4eb5 with SMTP id oo13-20020a17090b1c8d00b00203cc254eb5mr38426795pjb.132.1666617148183; Mon, 24 Oct 2022 06:12:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617148; cv=none; d=google.com; s=arc-20160816; b=Ej55pDyhHadqAyDu2gJCe83olYDfiMZP8yNyj1fm0TNeKauYJUfBIHqI67R5fowJOk Wx8aBrMLF0tDvH0clQdsUCwAUoR+y1VPQlpkjaeAjIm+IjVjDEDId00BZyZZUtqNB5is VZTjN4x/Qa8llB1JJHUD/QItQeVEpK25QnPru3uNlfXekyL9q7N8RSyVI7jQs0I+0E/G bWhIFUt9JSzTqVGx+fnzjuggVRUi4nQUV3hmkTq5KZhP5hIxlbqlLGXzbAoYN//3vpN+ ibsi75j3QE1ucng2f5Co0Zgl20ldL1wl82WN3NP8YOuMAsJ0S8KhVurmOZ5yoC5q5yMU 9c/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=VXWdft55rwFsbQ36It/JlBXH/tOjtqSD/Fx8d7+lvFo=; b=HsG8co4G17KCamHVMEnn2BGg+NkecaYOFhD0ZcP+dRkHaBTBhomEZNTJe2dyS3IDW4 Loj/scLGESDq7NSzXCwOuJu3enOc9txNiAvYqxOT/5hZLaxF0r1pU4qQCD1QsyEyZJub TE4u9gJ8hXx1VNERyKTwuLN5hFVnIDFk2BT4By7+lMMkiHK6R8fl0axfmJiGNwLoHR94 RbIjc4HdGMe5gQTvCYmlJRGr4IjVzGwupaNXQNLjIF9DwPwDP4GNINTQawSb56f0a7+p nkbaJ3Rtko7uDLQn0cdzr0H8I1Vc8eDJ9ibFYGC5MkkCtRH4xE5T1r+g2fxH5yPhzXM0 tVsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rNNbYes0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q17-20020a170902f35100b001868a61d507si6533556ple.180.2022.10.24.06.12.14; Mon, 24 Oct 2022 06:12: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=rNNbYes0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235632AbiJXNLx (ORCPT + 99 others); Mon, 24 Oct 2022 09:11:53 -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 S235640AbiJXNJM (ORCPT ); Mon, 24 Oct 2022 09:09: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 746539F749; Mon, 24 Oct 2022 05:22: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 07850612E7; Mon, 24 Oct 2022 12:22:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AD4EC433D6; Mon, 24 Oct 2022 12:22:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614137; bh=NDhl75XBw/Cv2H9f1biVIkMHuvFLt/dll9cekvRZ4cs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rNNbYes0EXswXmS5zp6xT7jKI8/VrBc73LHtlQh0xbSd+Xqng3L1Hlhfr/L2l0ma4 npkSbUsNyTZTaSk4z2vVEk36Chgr+D8g0S9ewkVdq/6rmW5VWdZRFqQ3MrruOursci i1URHsWo3P1X0ADZmDItOVxE4RVtgdqmgQde2zpk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Simon Ser , Lyude Paul , Benjamin Gaignard , Jani Nikula , Sasha Levin Subject: [PATCH 5.10 145/390] drm/dp_mst: fix drm_dp_dpcd_read return value checks Date: Mon, 24 Oct 2022 13:29:02 +0200 Message-Id: <20221024113028.858350468@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574742896585284?= X-GMAIL-MSGID: =?utf-8?q?1747574742896585284?= From: Simon Ser [ Upstream commit 2ac6cdd581f48c8f68747156fde5868486a44985 ] drm_dp_dpcd_read returns the number of bytes read. The previous code would print garbage on DPCD error, and would exit with on error on success. Signed-off-by: Simon Ser Fixes: cb897542c6d2 ("drm/dp_mst: Fix W=1 warnings") Cc: Lyude Paul Cc: Benjamin Gaignard Reviewed-by: Jani Nikula Link: https://patchwork.freedesktop.org/patch/473500/ Signed-off-by: Sasha Levin --- drivers/gpu/drm/drm_dp_mst_topology.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index ab423b0413ee..4272cd3622f8 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -4856,14 +4856,14 @@ void drm_dp_mst_dump_topology(struct seq_file *m, seq_printf(m, "dpcd: %*ph\n", DP_RECEIVER_CAP_SIZE, buf); ret = drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2); - if (ret) { + if (ret != 2) { seq_printf(m, "faux/mst read failed\n"); goto out; } seq_printf(m, "faux/mst: %*ph\n", 2, buf); ret = drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf, 1); - if (ret) { + if (ret != 1) { seq_printf(m, "mst ctrl read failed\n"); goto out; } @@ -4871,7 +4871,7 @@ void drm_dp_mst_dump_topology(struct seq_file *m, /* dump the standard OUI branch header */ ret = drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf, DP_BRANCH_OUI_HEADER_SIZE); - if (ret) { + if (ret != DP_BRANCH_OUI_HEADER_SIZE) { seq_printf(m, "branch oui read failed\n"); goto out; } From patchwork Mon Oct 24 11:29:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9938 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp599671wru; Mon, 24 Oct 2022 11:46:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5PgfE3BATCEUkvUVjSZVbMe//N2q7QeeGZVy1qAexHa/JV27GTXV8sUt8VutRnQv1m3dl2 X-Received: by 2002:a63:4c23:0:b0:45f:eab4:4f47 with SMTP id z35-20020a634c23000000b0045feab44f47mr29313673pga.532.1666637184211; Mon, 24 Oct 2022 11:46:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666637184; cv=none; d=google.com; s=arc-20160816; b=YaVNUosKRwxYb6y7GETiYS6i64QNnnUI4fgy5y8PIdN+9fBUzO0SXwRetlet6nclF9 0E6sPwEUGsNxtAGfLJhEb7lsJqKpqXJLDxUfYi9uq8c77PvHQ8QsUEejbIxl/P3A46s+ rLFixGnTJz0OOzTOOrqpfpClO02aF2Xdv5X//TVJgvUJ2SjuESwU/LzaGEHpEgYALJb3 QdOcmlmElhhy7eyU5eaXJhjzbKBPM5Fq1jTlnsYSWQejaykkPY1n26FDfUv0IH0ZIj4A EqzdDOWYCG6BM2K9ALrs2YZ8fRkYyG5IJhqkuKDvA77vWnw6gsjor00yB9JWnOh8Y2XL bvTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sAWuKxm5KE5yho2DHO6WVJq2sT80b5mYbiICUduid8U=; b=euE1Ni74agFJiHGDP0VOTFXNWErQzpmVTKWQRToRNaRsAhFzm2s9LTvE6zkMQpCMiz oK+wbxRLVem9yxmAdhm/SCQHhwErD+Z5AYRnQKw+m5mC2c6PQ1rpNo7cEQW0RQCthsbh NatQmnhUA4+pIqjLmXpnFR+kFFVu45YSCxI39dC1Ud0eLnds+bozsGrxV4q6h9MYw3s0 cC0n1XFd4C05WP+DyZrgKAmhBGeidDxSok0h96uk4aKI+ykE34i8rpcSLMyq8JqSBDVT iO44bnnjVeSyVBmtQjQd/NZKLLO4Fh8OEoqhw5aalixrgGBetKg8CiGHNfub4rnG1SMu RwYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sothYbKg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a6-20020a170902ecc600b0017893539e50si273794plh.522.2022.10.24.11.46.11; Mon, 24 Oct 2022 11:46: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=sothYbKg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232572AbiJXSpl (ORCPT + 99 others); Mon, 24 Oct 2022 14:45:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232523AbiJXSpQ (ORCPT ); Mon, 24 Oct 2022 14:45:16 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5CA4C512A; Mon, 24 Oct 2022 10:27: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 sin.source.kernel.org (Postfix) with ESMTPS id EAA43CE13C8; Mon, 24 Oct 2022 12:24:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9E17C433C1; Mon, 24 Oct 2022 12:24:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614250; bh=+6nKuQUQQhp/DPGhaTRSC6cZh6rw96mQOZjAlDCFnuo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sothYbKga48qqB6HaYjr2IHB/Smfnr/V9K9tE7zKSRcfNuVa3ftanL2zUL1ORf7a6 HvBtsTl1vKgzNeunvEix7CC+DNeLixken5fUzUcy86Gb4fzBEASzXIVBVdoMJ5vNvh pTmWKI1RjMD8eWWqfD2rXA90Bw2XKUJDR2rz8UjU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Rob Herring , Daniel Vetter , Sasha Levin Subject: [PATCH 5.10 146/390] drm:pl111: Add of_node_put() when breaking out of for_each_available_child_of_node() Date: Mon, 24 Oct 2022 13:29:03 +0200 Message-Id: <20221024113028.907439438@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747595751994181923?= X-GMAIL-MSGID: =?utf-8?q?1747595751994181923?= From: Liang He [ Upstream commit e0686dc6f2252e009c455fe99e2ce9d62a60eb47 ] The reference 'child' in the iteration of for_each_available_child_of_node() is only escaped out into a local variable which is only used to check its value. So we still need to the of_node_put() when breaking of the for_each_available_child_of_node() which will automatically increase and decrease the refcount. Fixes: ca454bd42dc2 ("drm/pl111: Support the Versatile Express") Signed-off-by: Liang He Reviewed-by: Rob Herring Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20220711131550.361350-1-windhl@126.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/pl111/pl111_versatile.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/pl111/pl111_versatile.c b/drivers/gpu/drm/pl111/pl111_versatile.c index bdd883f4f0da..963a5d5e6987 100644 --- a/drivers/gpu/drm/pl111/pl111_versatile.c +++ b/drivers/gpu/drm/pl111/pl111_versatile.c @@ -402,6 +402,7 @@ static int pl111_vexpress_clcd_init(struct device *dev, struct device_node *np, if (of_device_is_compatible(child, "arm,pl111")) { has_coretile_clcd = true; ct_clcd = child; + of_node_put(child); break; } if (of_device_is_compatible(child, "arm,hdlcd")) { From patchwork 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: 9676 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp535349wru; Mon, 24 Oct 2022 09:12:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4LM5CWvRIBSE9VmKYJknE5lu1B15TA/UWqwgNFv3FdPUvrxWR+dyagmUAFvELd38X/1kIt X-Received: by 2002:a17:902:f641:b0:17f:3633:5439 with SMTP id m1-20020a170902f64100b0017f36335439mr34450470plg.94.1666627965416; Mon, 24 Oct 2022 09:12:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627965; cv=none; d=google.com; s=arc-20160816; b=pBTM+7n27NLIJZ8XdrzM/nIkWKAHawYDB8DnzE00JYjazNmJKBSZqL6Dui3qTTaPzT A1zSn0lcNPuM+nSgRzdz7IOo0Tb0tKB5L1pdt7uiJhd5jOOLz4+ddBhlgHN6IscYhuHH c1wYoSagn49ptjhFCX9zx7aAJcpoPsbgjEKJy/zFdUInMDkiZnsgjbcILSu9Gdm0jqxS iBrFtMPJnnDPjoyYGEE7YJn+D5Me230/O8pFm5/Sp/Jn+fctp9rFAXVYf5AmecjKSgtB 7Hqzd0MOUYvNbvTzOjQt2gdZKPvL46PlJwxYxHVqxcbXtthFOgryqbqMQlEIkmPqASm7 q2Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dk5jQqtk42/C5itRBtmtSqDLPQwDM2hZ6xYvUfrq/bc=; b=X1csvuENX28JMusgjh8xrTHPWP+4A1/FmRixz/6YyQ3hbq/WZzo2VprZbFXRXU+hx9 g/nJMclQ1Kzs+o7cSp6fwepVumq6CYwziVv0uBpVnfR8p1D/Vkof3cD0WmEwjDhHs93p utws+IACN8vUjaaS8EzqRW6Z8UTbVYTrg+ft3aKjlR9dJFV1pIcXncpPuFuYvbG/8q7Y nur/e13SOITi9kwsRjebvvfZYA3KqRsRDaB2Uy0rLGdieyXhHl2EU2B0I/Q0HhPYRlce r1VVHp4oBB2jOopTcDsZisthTxnoHQG6QcBFdE6yb3uwf55ffRSmQUWtFaIT8UJZG9IV mmrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=M6Tn6CcT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n9-20020a1709026a8900b001869cf73143si5697707plk.314.2022.10.24.09.12.31; Mon, 24 Oct 2022 09:12: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=M6Tn6CcT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233807AbiJXQLv (ORCPT + 99 others); Mon, 24 Oct 2022 12:11:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234003AbiJXQFQ (ORCPT ); Mon, 24 Oct 2022 12:05: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 432194AD7F; Mon, 24 Oct 2022 07:58:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C1D10B81624; Mon, 24 Oct 2022 12:22:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21091C433D7; Mon, 24 Oct 2022 12:22:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614158; bh=Pi/zFYzeScmvLHTWHB3Cs3gpauAj1fhVi7HrqIamsfo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M6Tn6CcTpnCH03vx21JUG50fMwpOO4q2ksf92diHmD8FKrnv8ZiuPWZLHq3nhrC28 8mf2EWoMUjpSaRt9lEJmh9K6/V/x5e7rawHwKYBMprx4LMlIFKDlFY6/Q8I67j9EYo /4X9pyLkTpQfi74hIF8fP1nY9hPoSof7q3iD3R0w= 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.10 147/390] platform/chrome: fix double-free in chromeos_laptop_prepare() Date: Mon, 24 Oct 2022 13:29:04 +0200 Message-Id: <20221024113028.948809916@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747586085406768815?= X-GMAIL-MSGID: =?utf-8?q?1747586085406768815?= 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 472a03daa869..109c191d35cf 100644 --- a/drivers/platform/chrome/chromeos_laptop.c +++ b/drivers/platform/chrome/chromeos_laptop.c @@ -718,6 +718,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; @@ -726,17 +727,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); @@ -754,16 +753,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: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: 9125 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456350wru; Mon, 24 Oct 2022 06:34:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6zWZ0dzOdBTiIezWbGA4zTKb+eyY+n1ABt6MSZAILtUrsDQ4bg20LC03FM4PJaRC+tqb7k X-Received: by 2002:a05:6a00:2382:b0:56b:a25d:76a3 with SMTP id f2-20020a056a00238200b0056ba25d76a3mr9760021pfc.8.1666618443295; Mon, 24 Oct 2022 06:34:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618443; cv=none; d=google.com; s=arc-20160816; b=DFyRpKRk8pJjm06zsUsocvpEppKi7TOBPbXFUfVlCpwVZYkVfPSrVvhZGkJwocpSTj kr62KdYbaqv8qtyuqcjFvpHWQFmErqsiGUj8yBm2mkBwoXvyiBJUJMjZjTxX1nA/s7Ub yG2vzdJnknQB8urHN0mido2NFABom8sja7d7FKId1hIIU9orsr/xKAPzRjUzMap5Yh8A LSa/S2ZD7tbcLE8txbd/ZrHmrBbw511XK3S1hFbMM5KXmOCK6dZFqIGSdDbmk/xUyzRV Z1R4bnZyHrrSYeYqwD+l+X04wsrh8KvuUuWxUZEcbZGHmV4/LQGD9jm1BRQXZxfZmBe+ Hzug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vvI3+VWA+2mcXN4KXlGusSzPv4NyoHHcIk3s6pIfUvg=; b=Fc9exZXT750WKQjZu64CgejmE6Xww9Eyn1Fy6s4PrLjBv2IBkQSiogATonEi8Sa7gZ 1vJmzINgzBfLByhbIZb2g/Fq9r1dHLYsVd9/mODIIzV63nFwfaHaeMXscZtG4OQVRSLl iG4UcucTTQS8rNu2N925HcWVXGkdhiHS8CfW7/wcD213ITH+mN8UUZWTHrucqv1j+Zt6 ZXWW+cKhlz5zlxITYooOSyjdfpSo83HrZq09iv6CJ4hZQDKZMOwSJ44W6CrD0qbMYP/U EguQNhpD9PbhO/I0toyJwTLJpAHyIpj1VjCr2fpztYXzyJUpQkBbvcV/MgwOnAiB/ehQ 8f2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MMQESAQP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902da9200b00179f8a3f838si39434796plx.593.2022.10.24.06.33.40; Mon, 24 Oct 2022 06: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=MMQESAQP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232196AbiJXNUt (ORCPT + 99 others); Mon, 24 Oct 2022 09:20:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235987AbiJXNS4 (ORCPT ); Mon, 24 Oct 2022 09:18: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 C653CA52EF; Mon, 24 Oct 2022 05:27: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 E7069612CA; Mon, 24 Oct 2022 12:23:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02E70C433D6; Mon, 24 Oct 2022 12:23:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614187; bh=FGLUiA+nI5EoWurmpv9dwxt2Cwd9+rHSJ5m5kYCZDGs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MMQESAQPUb6KUjoQkKO64OFIbjeZMEMtSdC1A2Ehfh/NfXEsAAmLpEBWN/ZZk3iSJ NL8fQiUszwPjBPAOGmS4+/Hc88LJoBGC/LrzEhuJp/C4axjHSw7Y/aFhKg1r5DEkvL CIiSjg+X9NWz76G3U56G+vjS/2xWXUVrXsQ6eurM= 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.10 148/390] platform/chrome: fix memory corruption in ioctl Date: Mon, 24 Oct 2022 13:29:05 +0200 Message-Id: <20221024113028.991208637@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576101029253157?= X-GMAIL-MSGID: =?utf-8?q?1747576101029253157?= From: Dan Carpenter [ Upstream commit 8a07b45fd3c2dda24fad43639be5335a4595196a ] If "s_mem.bytes" is larger than the buffer size it leads to memory corruption. Fixes: eda2e30c6684 ("mfd / platform: cros_ec: Miscellaneous character device to talk with the EC") Signed-off-by: Dan Carpenter Reviewed-by: Guenter Roeck Signed-off-by: Tzung-Bi Shih Link: https://lore.kernel.org/r/Yv8dpCFZJdbUT5ye@kili Signed-off-by: Sasha Levin --- drivers/platform/chrome/cros_ec_chardev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/platform/chrome/cros_ec_chardev.c b/drivers/platform/chrome/cros_ec_chardev.c index fd33de546aee..0de7c255254e 100644 --- a/drivers/platform/chrome/cros_ec_chardev.c +++ b/drivers/platform/chrome/cros_ec_chardev.c @@ -327,6 +327,9 @@ static long cros_ec_chardev_ioctl_readmem(struct cros_ec_dev *ec, if (copy_from_user(&s_mem, arg, sizeof(s_mem))) return -EFAULT; + if (s_mem.bytes > sizeof(s_mem.buffer)) + return -EINVAL; + num = ec_dev->cmd_readmem(ec_dev, s_mem.offset, s_mem.bytes, s_mem.buffer); if (num <= 0) From patchwork Mon Oct 24 11:29:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9102 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456060wru; Mon, 24 Oct 2022 06:33:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7mnNcqhgyRlPhocTh8krMrb40oCMoY0khmLCJOnlSLcTKpC+/DxncHV7NaeAAo4sNdAF+V X-Received: by 2002:a17:90b:1648:b0:20b:f0ae:2169 with SMTP id il8-20020a17090b164800b0020bf0ae2169mr72395934pjb.173.1666618410782; Mon, 24 Oct 2022 06:33:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618410; cv=none; d=google.com; s=arc-20160816; b=n5OuNzW3UPpOw5/wF70Bf4wXdMX7BfYPZ7JGFxy1y82nDEKvq2XcDzmOTrGCF9/LNW XDChUYnVpcLXpHuZg+j/7A2mByHfxHpQx2gEaoC8MInKkBWrOzgTyrE2MN/C//iqm0TD NP0ZkHVXGc5uTjciZRISrNagIyWXWacbt7BmX8s6vjkDIdGUKctaButZJFoNbHk1Xgib OjWb+f8j113DSTSXsHBvCVyX/R3dAlqxCIenvb2NrrB1A1fdLEKh+r8XPZg4G6z7/8p+ DRuSLyyXkXwTRDktn4vAqMr1BlBBhojrg4TWI/jPw1hhf8xgQ5EoP5zcyQr15py7zvAH lx3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=w5GZXiJHYioq0tbQJXQLouzrEGmMzngoAiqEeU5AIBQ=; b=vUNedoaLUKOoBuXe2Nhgys9sO+j/RaFcgxKX45r1rbhvDBtJ02dMgRUx2FTkTp1Jll kvAtBkplF8wVqkkF20KI2U4dhw1oQYqR5bYKvHPsLZ9GrYRk/uoypLt1ufeOALhSJ08+ YBpXnFXV5toKNpnmQOh8jbuv69N83t07y63vmg0oh1rRd05RmyK8kvTWPy8Pb1GA1IQJ waDm/r8SZk0GdX83olnahsrdLwWD1qoPSshLPldv+JD+NSS2A+q8QMAmzrwTUuokjBp/ mcV7IyG3AGZDx1m9X8zPyWYXeTc3mb/iQN+BuTegfJ/h7P0OXMgjd1Uy4RId/O3E50BX 0zyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ziq3zqkK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k14-20020a633d0e000000b0043a20d557a9si39337136pga.229.2022.10.24.06.33.14; Mon, 24 Oct 2022 06:33: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=ziq3zqkK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235353AbiJXNOz (ORCPT + 99 others); Mon, 24 Oct 2022 09:14:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235724AbiJXNMb (ORCPT ); Mon, 24 Oct 2022 09:12:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7760FF5A7; Mon, 24 Oct 2022 05:24: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 ADA24612D2; Mon, 24 Oct 2022 12:23:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE309C43141; Mon, 24 Oct 2022 12:23:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614216; bh=vW1MAh2Y8DexQ8ahN7RV2MAtzHxoN1y560yOxQM4TVo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ziq3zqkK4h3O8xywWySk3YuRz3A3iYn+PR5wYiEndiwxXJV2Hd4G2DGd97tjjH5UV TZgJmtDF31SMw6jxfjgJFSkoFF93cgPx1StQcOp+R8XnC0wUBlwME04obT7NzeoP0S M4vP921LzH46POsVu3Yns83TriZi8HVge66iV5VE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Martin_Povi=C5=A1er?= , Mark Brown , Sasha Levin Subject: [PATCH 5.10 149/390] ASoC: tas2764: Allow mono streams Date: Mon, 24 Oct 2022 13:29:06 +0200 Message-Id: <20221024113029.033986134@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576066707557218?= X-GMAIL-MSGID: =?utf-8?q?1747576066707557218?= From: Martin Povišer [ Upstream commit 23204d928a27146d13e11c9383632775345ecca8 ] The part is a mono speaker amp, but it can do downmix and switch between left and right channel, so the right channel range is 1 to 2. (This mirrors commit bf54d97a835d ("ASoC: tas2770: Allow mono streams") which was a fix to the tas2770 driver.) Fixes: 827ed8a0fa50 ("ASoC: tas2764: Add the driver for the TAS2764") Signed-off-by: Martin Povišer Link: https://lore.kernel.org/r/20220825140241.53963-2-povik+lin@cutebit.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/tas2764.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index 37588804a6b5..bde92f080459 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -485,7 +485,7 @@ static struct snd_soc_dai_driver tas2764_dai_driver[] = { .id = 0, .playback = { .stream_name = "ASI1 Playback", - .channels_min = 2, + .channels_min = 1, .channels_max = 2, .rates = TAS2764_RATES, .formats = TAS2764_FORMATS, From patchwork Mon Oct 24 11:29:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9116 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456116wru; Mon, 24 Oct 2022 06:33:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4yCmG5wB+JO34K20qSySSxjEUaQdObTQ8704K9Gw5BDv7LivTtr4DXHXSH2VtwD2NT0+Sf X-Received: by 2002:a17:906:dac8:b0:741:545b:796a with SMTP id xi8-20020a170906dac800b00741545b796amr26935588ejb.240.1666618415627; Mon, 24 Oct 2022 06:33:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618415; cv=none; d=google.com; s=arc-20160816; b=OF6g9O+CHDCB4/7BnRE0wSKuvnb0+JCKVE2DNsQE5DCaspHLhS0vU+eFeTnhuzdsG6 X//vISiUohxPxFW6cUJSTZa0iJ/rv7KorN0Jh8iGvgt2ZvLO1XQCwH+cfIjYBHuMdTqg IhZYnJmilnNoe/7NfNy5vuyKP4JIVxiqMleNg3jCvMz7BENyXWSMmbUDELx0HKrFJ8s3 TX+PcoLPMfY5z+hrBT2NZOyiF+mR6DJ/LMoMRtfC2j89ATHElUTt2LuW9vYKsb4JxjEB UPJYeOxypLs5mbgajmoJOlfTnI2fKtjyC1vDN2kf/6RXCQXACbJZmmnRqZc9smKZIy5g +6lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6ylUBjnFSRLnbMRGmOIgJ/VEikBjbqvO8kX+naGtEdU=; b=KFcNsadABl4h+FGCYq7Ymp0Zqu6Nxuuxs/RoGvE6xt/s30yn1SuyP53SyYo8UErNuy 9WH/pomTPZ1Z97iW1EPd8O7Ymi/7uifxfkh9xLYmIjFWfUiXxKbPXF5mEu78k2dnAP70 SY7cdA9X0qZKHttdSukVYoAxbVTMLaEqPZOTnbri0yF+VlvzeRj+L7j7m1OOUPlBoEwJ kPH1JzEz4UBhBBTP4ElEJuOSyE5+lWq5IXwPqPN1STPs9lZbaxc95gcd/WGyvhatDyBl eLECtCz6KbEhB1gVIFsNp79CrN1tXqH9O3D2Urmd57A1eD+qRL5OSocYG0V759bgDExv ZMnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sKxQeD4c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k5-20020a1709062a4500b0079195ddab1bsi15337803eje.221.2022.10.24.06.33.10; Mon, 24 Oct 2022 06:33:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sKxQeD4c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235740AbiJXNPU (ORCPT + 99 others); Mon, 24 Oct 2022 09:15:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233079AbiJXNNv (ORCPT ); Mon, 24 Oct 2022 09:13:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1BF732D9C; Mon, 24 Oct 2022 05:24: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 213B6612D1; Mon, 24 Oct 2022 12:23:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DFC3C433D7; Mon, 24 Oct 2022 12:23:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614234; bh=VMdw8bJy5Kr6jBkW3N+JdCV3TTZit0h7aUXL1hDm2/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sKxQeD4chB1co2Ul/xr5YiVAJDe/TXVg2LnXcd+6/8aZN4fVQdF3wZBMogWTqkxON SlL20+nYnRIS8yMeKLOV3iXNXlR0veL1jYYX5/vQBxQOdsZBzqt6zm3upWiwGR0FdZ 8veD8Np14M3exHN1++BlQSHV4xqwusm23oEGbiOo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Martin_Povi=C5=A1er?= , Mark Brown , Sasha Levin Subject: [PATCH 5.10 150/390] ASoC: tas2764: Drop conflicting set_bias_level power setting Date: Mon, 24 Oct 2022 13:29:07 +0200 Message-Id: <20221024113029.074859597@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576071976762734?= X-GMAIL-MSGID: =?utf-8?q?1747576071976762734?= From: Martin Povišer [ Upstream commit 09273f38832406db19a8907a934687cc10660a6b ] The driver is setting the PWR_CTRL field in both the set_bias_level callback and on DAPM events of the DAC widget (and also in the mute_stream method). Drop the set_bias_level callback altogether as the power setting it does is in conflict with the other code paths. (This mirrors commit c8a6ae3fe1c8 ("ASoC: tas2770: Drop conflicting set_bias_level power setting") which was a fix to the tas2770 driver.) Fixes: 827ed8a0fa50 ("ASoC: tas2764: Add the driver for the TAS2764") Signed-off-by: Martin Povišer Link: https://lore.kernel.org/r/20220825140241.53963-3-povik+lin@cutebit.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/tas2764.c | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index bde92f080459..6b6e30b072f2 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -50,38 +50,6 @@ static void tas2764_reset(struct tas2764_priv *tas2764) usleep_range(1000, 2000); } -static int tas2764_set_bias_level(struct snd_soc_component *component, - enum snd_soc_bias_level level) -{ - struct tas2764_priv *tas2764 = snd_soc_component_get_drvdata(component); - - switch (level) { - case SND_SOC_BIAS_ON: - snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_ACTIVE); - break; - case SND_SOC_BIAS_STANDBY: - case SND_SOC_BIAS_PREPARE: - snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_MUTE); - break; - case SND_SOC_BIAS_OFF: - snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_SHUTDOWN); - break; - - default: - dev_err(tas2764->dev, - "wrong power level setting %d\n", level); - return -EINVAL; - } - - return 0; -} - #ifdef CONFIG_PM static int tas2764_codec_suspend(struct snd_soc_component *component) { @@ -549,7 +517,6 @@ static const struct snd_soc_component_driver soc_component_driver_tas2764 = { .probe = tas2764_codec_probe, .suspend = tas2764_codec_suspend, .resume = tas2764_codec_resume, - .set_bias_level = tas2764_set_bias_level, .controls = tas2764_snd_controls, .num_controls = ARRAY_SIZE(tas2764_snd_controls), .dapm_widgets = tas2764_dapm_widgets, From patchwork Mon Oct 24 11:29:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9617 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp531245wru; Mon, 24 Oct 2022 09:06:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4tzj0zU/g19N3pwT/sveZLlYzww3DJhNUOVu3GdZS47VKw4wHRV75QNmY65C0cdqDCjdeh X-Received: by 2002:a05:6402:2409:b0:456:f97b:3794 with SMTP id t9-20020a056402240900b00456f97b3794mr31468379eda.145.1666627573502; Mon, 24 Oct 2022 09:06:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627573; cv=none; d=google.com; s=arc-20160816; b=hOn1gudq5xmas5x6e3Zt7eOs75B2fVHcXtBjf1aLm/st29Eg5/zgT43l62xm3t2wYB w5hmgMU1L3Vla/f0gqiYGfKE9GGEAeUHTOcm4BYvIffJkpy1fHCBjgrYD1USK5FaWtfU yCr1BH8leXai9er9cj8fPpwum7NqHPTN7Ve4LqGykCs01PmnrqRgYv1IMvDu725uLASH p8uPDV3vnHjtZpKT0iw4lJuLot6uHhwk2B8mD6I8+PSMJmf0SSkZIlleVb3FdinSbYFv ByveXlMQ4GME1mkrDFIYlpwVyu9FEcukkgXnatmuS6Y3TAQq2Ys7kKFYulttElNykfke PAEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3Mdk3urt2FPWlpW6WnPW6AUbmPQSiSaKVh+H/W3dWPc=; b=KvRSkjLL8G1ueNjXSYHJCOb47X51NR9hp2/JsQKFzwWYPLDCLuWoYdgZ9uG5LcswLS HS0RxliJpoHeo2mpmBrZte3bbxYt4uj2n39Hb5Pqi0rHv0t6OzhkrgwALV3KFEkq82pc JmV34CpzoluJlo2bop3qI4xwkExGQ+BOR4i/MytcX0s3ESYyeoRBC/crGFpVIqjhT8Uu ouZh9o2d/4CyryYAxAwZPi+xg1Mx2DTuIM2jfv7neiAYJossPNwfkqkKGJaFpQ4RKCa3 g5SXOEWUQGeB4fLnAzRbMUs+mCwVL02MZULBF52abe2SLTF4TVFSPePXHJ4GPTafwMgG k+2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JJBLJQYh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z7-20020a1709063ac700b00780a240cfd7si38485ejd.493.2022.10.24.09.05.48; Mon, 24 Oct 2022 09:06: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=JJBLJQYh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232173AbiJXQCt (ORCPT + 99 others); Mon, 24 Oct 2022 12:02:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232478AbiJXQBW (ORCPT ); Mon, 24 Oct 2022 12:01: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 9D68CA3AA4; Mon, 24 Oct 2022 07:55:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 78CD4B8125F; Mon, 24 Oct 2022 12:23:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C78E5C433C1; Mon, 24 Oct 2022 12:23:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614237; bh=vcw+YLlXa2iZArTHHxfDK4FeCWbErJRMzc+eA4PfH9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JJBLJQYh9vGyXkSYVb/c/u8H1edTnNL6Ekr9LZYqqJXTTrYkR5AEqi94CMO3k9mTj BjZjNdPuSLel7beXqLug05MHchbLbMxl2yAGzJIhzcvHp82BHkNjaJUB+2diLlg6bK pJm3LJ4y5iQuQBp9LwVP9WzEfm3vbHcBuasa7Qz8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Martin_Povi=C5=A1er?= , Mark Brown , Sasha Levin Subject: [PATCH 5.10 151/390] ASoC: tas2764: Fix mute/unmute Date: Mon, 24 Oct 2022 13:29:08 +0200 Message-Id: <20221024113029.114894525@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585674668047790?= X-GMAIL-MSGID: =?utf-8?q?1747585674668047790?= From: Martin Povišer [ Upstream commit f5ad67f13623548e5aff847f89700c178aaf2a98 ] Because the PWR_CTRL field is modeled as the power state of the DAC widget, and at the same time it is used to implement mute/unmute, we need some additional book-keeping to have the right end result no matter the sequence of calls. Without this fix, one permanently mutes an ongoing stream by toggling the associated speaker pin control. (This mirrors commit 1e5907bcb3a3 ("ASoC: tas2770: Fix handling of mute/unmute") which was a fix to the tas2770 driver.) Fixes: 827ed8a0fa50 ("ASoC: tas2764: Add the driver for the TAS2764") Signed-off-by: Martin Povišer Link: https://lore.kernel.org/r/20220825140241.53963-4-povik+lin@cutebit.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/tas2764.c | 57 +++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index 6b6e30b072f2..8b262e7f5275 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -34,6 +34,9 @@ struct tas2764_priv { int v_sense_slot; int i_sense_slot; + + bool dac_powered; + bool unmuted; }; static void tas2764_reset(struct tas2764_priv *tas2764) @@ -50,6 +53,26 @@ static void tas2764_reset(struct tas2764_priv *tas2764) usleep_range(1000, 2000); } +static int tas2764_update_pwr_ctrl(struct tas2764_priv *tas2764) +{ + struct snd_soc_component *component = tas2764->component; + unsigned int val; + int ret; + + if (tas2764->dac_powered) + val = tas2764->unmuted ? + TAS2764_PWR_CTRL_ACTIVE : TAS2764_PWR_CTRL_MUTE; + else + val = TAS2764_PWR_CTRL_SHUTDOWN; + + ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, + TAS2764_PWR_CTRL_MASK, val); + if (ret < 0) + return ret; + + return 0; +} + #ifdef CONFIG_PM static int tas2764_codec_suspend(struct snd_soc_component *component) { @@ -82,9 +105,7 @@ static int tas2764_codec_resume(struct snd_soc_component *component) usleep_range(1000, 2000); } - ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_ACTIVE); + ret = tas2764_update_pwr_ctrl(tas2764); if (ret < 0) return ret; @@ -118,14 +139,12 @@ static int tas2764_dac_event(struct snd_soc_dapm_widget *w, switch (event) { case SND_SOC_DAPM_POST_PMU: - ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_MUTE); + tas2764->dac_powered = true; + ret = tas2764_update_pwr_ctrl(tas2764); break; case SND_SOC_DAPM_PRE_PMD: - ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_SHUTDOWN); + tas2764->dac_powered = false; + ret = tas2764_update_pwr_ctrl(tas2764); break; default: dev_err(tas2764->dev, "Unsupported event\n"); @@ -170,17 +189,11 @@ static const struct snd_soc_dapm_route tas2764_audio_map[] = { static int tas2764_mute(struct snd_soc_dai *dai, int mute, int direction) { - struct snd_soc_component *component = dai->component; - int ret; - - ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - mute ? TAS2764_PWR_CTRL_MUTE : 0); + struct tas2764_priv *tas2764 = + snd_soc_component_get_drvdata(dai->component); - if (ret < 0) - return ret; - - return 0; + tas2764->unmuted = !mute; + return tas2764_update_pwr_ctrl(tas2764); } static int tas2764_set_bitwidth(struct tas2764_priv *tas2764, int bitwidth) @@ -494,12 +507,6 @@ static int tas2764_codec_probe(struct snd_soc_component *component) if (ret < 0) return ret; - ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_MUTE); - if (ret < 0) - return ret; - return 0; } From patchwork 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: 9110 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456115wru; Mon, 24 Oct 2022 06:33:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4BmDAVD5Y/btN4TW6kdfibUWeoz+4sgg1UKvphwycg8H70yEBrspj27NI6lyayGugJoft/ X-Received: by 2002:a05:6402:501a:b0:457:f093:cadb with SMTP id p26-20020a056402501a00b00457f093cadbmr30217934eda.143.1666618415620; Mon, 24 Oct 2022 06:33:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618415; cv=none; d=google.com; s=arc-20160816; b=Yq6I+zzmgez4BCdZKvPMsXZZZ5CQcPtd3Dtev4RHbTpL4/B7O2BkzVii2wAXzksNmQ /tEZmLfOOgXFjWrcyGuasULONU1WJhoqRc2NVXG7/z3MQXjWmTt8FGOShnbsgnFA+kZ4 6/pQF+sQEBQ2XkfZMZxP5mlePx2X71jW1oX8KFZ9oV+/8kK15sET79G6Pca+Oqx9PwAk EdulA5fh9peX+IVSM91zU9Tu4MsCbx3Rsj+1d7N+gNpEjOIkpvAOZ0pVFG3dMaxg4M1m qYrf6+K7hnkJP80VB1zOISz/G1N2hXOpCWuuAMPMVTAwyFM9Bw6Jc/Cj+/mF0nrmF2gn qZog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=Rs92tkDqwePAdXFnh87/FNYz3OrHjEo3WYHPg/nQC+nbk9J3a8trRftWpLuq5JHBuS ZrX9x4reo5luGKLHPOdO044ktZIQ+YInB0krfEcLkk2Kjgz9/5YiQXjwTzWO0xsSZAs2 OZs63jFScCGLnb9uD/0+vwhIX9Ei293BbGmk+H3YfEGE3lOOhhSi5yGVSSnX9y9P1N2/ XocEa3QneCEGHTdghV5Ql7UjkB3ztjhtaqImsNxdJ7kgYuUzBwS9jUjFejESc8Ur5A97 MbH/oRuMZ3/XyvKi5/QK+sRjZh/TwVtifN7VZVIgjqRbiC+a3jH1PO7uIrARIZNh1gH5 kVAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D58szVF4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s8-20020a170906500800b0078d3b940ec5si24550262ejj.373.2022.10.24.06.33.10; Mon, 24 Oct 2022 06:33:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D58szVF4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235809AbiJXNPd (ORCPT + 99 others); Mon, 24 Oct 2022 09:15:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235872AbiJXNOB (ORCPT ); Mon, 24 Oct 2022 09:14:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F31333BC6A; Mon, 24 Oct 2022 05:25: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 6AB826128E; Mon, 24 Oct 2022 12:24:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70E9EC433C1; Mon, 24 Oct 2022 12:23:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614239; bh=zT6MDUv1/e0ceaKhgr+62ulahZ4sloOaOytnAgt472Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D58szVF4dQdH+LncKC1IOPB3MqSD46wlnsyH+5kAFyeRlcnxV/t5XtNWXEfwEB3JX X1zazr/OHud48EZW0QhN2HFriYYE2IEimnbMbj5099FD4o0sP6yWERWKfK0OmrXY3z ZOXYOTLqv8O02OZGvs0VpOmuKEMpson7o7Qtm/pw= 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.10 152/390] platform/x86: msi-laptop: Fix old-ec check for backlight registering Date: Mon, 24 Oct 2022 13:29:09 +0200 Message-Id: <20221024113029.154824734@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576071546340467?= X-GMAIL-MSGID: =?utf-8?q?1747576071546340467?= 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: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: 9173 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457990wru; Mon, 24 Oct 2022 06:36:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6wVbIeBtKWkyr5B3WTHj0ZnQNPaQrbG90V5aw2CEwbkosJLXS4HLXySOXTT+p+1TvV8PVI X-Received: by 2002:a17:902:d4c5:b0:183:6e51:503 with SMTP id o5-20020a170902d4c500b001836e510503mr33305936plg.84.1666618611929; Mon, 24 Oct 2022 06:36:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618611; cv=none; d=google.com; s=arc-20160816; b=zPjz0d04mXFGxbr0PInmOjuNcrWXj5+uq+sOh8tl23Wf7po7cimvwfNJcQxh+J1Ki5 mEzGNPnC3zT2yHffKepjldWLtgklZJamAw7W2hSvMZ1hjfZ+ml4ckEtGZTJHJ/H8IABb KE7fbb9QnltWy/jyTg6lGiA8k8XpeLuKtkyx6LnvEjX1MsTdolS5xm8VKd9A0n/5kiMU uMX0S0Qg9XA9A2B/t1NjK8whlBdWKjIprqGYasDjGr8tGsN0TkbZclEv9y+NlCbNN1IA i4Ik9u0Q2EocwwdbZf4F3+2y+3vd95oR14cbLl05Yo5AjGYa3m3rQMUEgO072CUBjdHa wOfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=IM6vXPKpRXIDbDYQ42plyJv6tpN1g355eT/9loN3iofmHb2jf4zEAFDGALoCMjfPNQ 1L9EIEzPnYkSmB0taSzfUUHnN1f42GiN9PCOthmrlCE8VetUmeQePZPncdGVZCKK0Ei/ 4uzjFCMJEUJAk05n1m5ga/zIMa2jJPFn+4MGBrcs+Wru3Sjm+0Aqp5G15Q8NFn6tD2zi 7GyZ2zB7h9VBAyfXL4OdrrApQL4KWR7vm4HAhU7MbpA7VIxEIsZd8/7coosnKLdP3l4J hiHyFeh6lJuV6ccB6rLfJI3pWdcQyKEJpqMzAsl4Lr1z2hvRwct9lTb3SkvrZfIwSm/L meOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Y8pTGWGR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k38-20020a634b66000000b00439befcd2b7si34994685pgl.725.2022.10.24.06.36.15; Mon, 24 Oct 2022 06:36: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=Y8pTGWGR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230164AbiJXNPp (ORCPT + 99 others); Mon, 24 Oct 2022 09:15:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235899AbiJXNOG (ORCPT ); Mon, 24 Oct 2022 09:14: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 74D4F3FA2C; Mon, 24 Oct 2022 05:25:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 02379612BF; Mon, 24 Oct 2022 12:24:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14C8DC433C1; Mon, 24 Oct 2022 12:24:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614242; bh=LMiQSmINL+WpJ+Efxa9vMNxwvWoH4bT4QVIx9zBBdls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y8pTGWGRtzIYLpeBzsxfYjVe5/GDGyj8HjomMECYcgbwlWszYKxImav5XioEwNER2 UgYpNq+ZccGLIJ8bN9zsbMqf2FzT4+w63QBlpF7vohAca2v5sm8yhAA3x2mT0bazQl PIOm2AowlniCnQX61gtC0Mzz1JWWqBcIlSwIFDDA= 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.10 153/390] platform/x86: msi-laptop: Fix resource cleanup Date: Mon, 24 Oct 2022 13:29:10 +0200 Message-Id: <20221024113029.193870351@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576277590884918?= X-GMAIL-MSGID: =?utf-8?q?1747576277590884918?= 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:29:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10158 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp640062wru; Mon, 24 Oct 2022 13:31:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5bphjMkpOrLzm1yCqmMlbWIuTOoc182NXjPCam/cwxy2QVCAfyI+pKugxeHFAf1LmAoyGL X-Received: by 2002:a17:906:1e08:b0:73d:c724:4876 with SMTP id g8-20020a1709061e0800b0073dc7244876mr28482900ejj.62.1666643501334; Mon, 24 Oct 2022 13:31:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643501; cv=none; d=google.com; s=arc-20160816; b=drf1Wk9oonDyGZ1GShjUtyg5tg/YphZ/C7dG+fq/TdbkvgjWAkZLXM64OVR2gltZpJ gjiSL6russdjOPzf/NU3zifFs/gN8K0LpShGt5QTA85HjNGj/rAirsRCeg+X4KVr1B5C qT+3RzXpCUNbyYFec3irgdKd83Gz6VssV4TqxPL/UBRgEWsa4mnJyJe6HkjtEJ1g4gz5 10FRgz/jtgOCKJFImudUpO/GGV+hXF+GjjG6NFoKl1U3Xmb0m2i1htym/3Fn2QTeu4cI 2rVvT2atazIrFBaMoBoPmH4fuJUNWsEGZxJjYPZ6vGHnZAeqkOPcsAE7o5jSvGPhslkM xGKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AXQF/29tGZXV3NxG0kzQeLjycOJUR4w44cQdbqgRCP8=; b=RysDETLJyw6CSXAL02LOuXxpLz+agCgi81G1anDRVZrwShO2klC0lbKX6+4H5UQVnk YnMIs5tht34dd0qo9dBy/11ZpTOOFfrFmi+4IxU9vHuqyTYYZhqNcF1/qxidBaXVtWla QqcEgf9btHJV99DDtWN8VX6Hvsdln4apQjY1jslktY8GuJGwIsrjpTIC2jLm8oY3TE0I UXMJ63oEZALguUkc20lAZcbAQOC5WDAB21ouj8YHskzJjtqBv4jZG1JE0nYfaY3VHVzU x6e95ZV3yY8J4dsI+cpz2vayhgr8PzrVhuQpT1eFl3n5C2U+bmy8sz8vgTuxiGumeNdD ExQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FpXD+ofY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ho6-20020a1709070e8600b0078d9f1f72bcsi871072ejc.726.2022.10.24.13.31.17; Mon, 24 Oct 2022 13:31: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=FpXD+ofY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234146AbiJXUU6 (ORCPT + 99 others); Mon, 24 Oct 2022 16:20:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232493AbiJXUU2 (ORCPT ); Mon, 24 Oct 2022 16:20:28 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F49A9D50A; Mon, 24 Oct 2022 11:37:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id C9908CE13C4; Mon, 24 Oct 2022 12:24:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EE03C433C1; Mon, 24 Oct 2022 12:24:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614245; bh=baId3y2PnKov3b1F4NURKQxj97Z3GYNXAxDixrtp190=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FpXD+ofYTey4GSaqnI9/wEILYSeDS8A1GQTvRnR25ozcY+bIP744jEUNEL12UC7bT BwMyRbAbRp3qxwWF0z08okMJvGqy7StUCTg9jsfqywVjm5tY8/bDJfBtFj4PdMG1Zo uSmB8m7pHMsrJiQnUT26B3NamdqypvVjUn8I+eA0= 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.10 154/390] drm: fix drm_mipi_dbi build errors Date: Mon, 24 Oct 2022 13:29:11 +0200 Message-Id: <20221024113029.232783928@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602376282330583?= X-GMAIL-MSGID: =?utf-8?q?1747602376282330583?= 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 ca868271f4c4..4e9b3a95fa7c 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -30,6 +30,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: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: 9645 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp533047wru; Mon, 24 Oct 2022 09:08:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4NRICWL1oSj1HY61H3bMpk8zDCSZxjkh9ViY4APoV/uSPkSikkkEQqn/3m3JLI4fCXEuDH X-Received: by 2002:a17:907:94c6:b0:796:f9ed:ceb3 with SMTP id dn6-20020a17090794c600b00796f9edceb3mr21217896ejc.197.1666627737244; Mon, 24 Oct 2022 09:08:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627737; cv=none; d=google.com; s=arc-20160816; b=jLrJJetco3P9M/TFBfNprZBMk7+85QJm269SPNeOw+hHRCQgnsR4fD1DxB9x/A5NNm h72s5FSVxlGTQZrkfBa6KVKuUr8NWuGmcbe7+B4lZvWvG+VA4VRcVNoLyy6iO7GA/fHk oomNG5mdPNMdcIy1WV5Fz/i7bwiGAut8B06MAUg9AtkKZKlKMctqIIlVtWV0M5ckukyk D0sEkFa0GE9JkEAbvCb7Z6GqPgN97UX/9av/gPy3ekg2rS7n2I7Q6UkaNLbg93+nguYL gHbNIUSRm+SSQGbPMe+qgp41L+kbQAKGYP2bZXiR/WJr3EcSGhfodRUDBoqpdWfpQGgW cUyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+MXc/a5oFlvsgTc572ro7Oq3bWVBVE0/rriL/owB27s=; b=b4YeWKmuzfdoAS35H7ous3phEoBNy2cxGa1TOpzaX5nSUmbUaXHeHCImGC2nvxPINW +AhsHlML5zYd6bPDfAnWO9otOiB9dxj8HBnMbypOi7kyq6zmzd8YmsQEXdrdv7TdSU/b wcDGEY8bQKVZEHs/n2wJlwLHpE/vxKCRDbF5LNBjP/sNM4uWA8l1HqeEDYEg2MjtTgop eQza4NnAnLMgiOV+23kL7Xi/FQrtihn19BQ5Ng4nW4Eu2++8JKGDVWeeX9IaYQvntSRd VbffCz/heUHjgOmPvKAi5Ocq7ErKtHd9Gso08ssFWvaH4/z0N/gHXb77LRMYkJBR4IXT AMCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ny4ihl4R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lo16-20020a170906fa1000b007aa3373e7fesi114540ejb.520.2022.10.24.09.08.30; Mon, 24 Oct 2022 09:08:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ny4ihl4R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233313AbiJXQHc (ORCPT + 99 others); Mon, 24 Oct 2022 12:07:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233172AbiJXQES (ORCPT ); Mon, 24 Oct 2022 12:04: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 A916311178; Mon, 24 Oct 2022 07:56: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 0CE0CB81625; Mon, 24 Oct 2022 12:24:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59614C433C1; Mon, 24 Oct 2022 12:24:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614247; bh=OzLtw84/qExOO0VigNtqfN9GRq/sTIKWBf6EPPnoyMA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ny4ihl4RL4slOIkVn/pXB4cjm/cBWg8puVpN5R80y7KK5QPuqzwlc0Mhw22lSLS5w C0LMw9JuiyViBHsmD+hDtxHDQpEHjBJIKktjWR47fD7hB42tYYVYLIBTFSOFT67c13 rJfFWJvRPfp9ZprjlYnyIohK5oikj23op6pNIUFM= 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.10 155/390] drm/bridge: megachips: Fix a null pointer dereference bug Date: Mon, 24 Oct 2022 13:29:12 +0200 Message-Id: <20221024113029.287018268@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585846333945761?= X-GMAIL-MSGID: =?utf-8?q?1747585846333945761?= From: Zheyu Ma [ Upstream commit 1ff673333d46d2c1b053ebd0c1c7c7c79e36943e ] When removing the module we will get the following warning: [ 31.911505] i2c-core: driver [stdp2690-ge-b850v3-fw] unregistered [ 31.912484] general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] PREEMPT SMP KASAN PTI [ 31.913338] KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f] [ 31.915280] RIP: 0010:drm_bridge_remove+0x97/0x130 [ 31.921825] Call Trace: [ 31.922533] stdp4028_ge_b850v3_fw_remove+0x34/0x60 [megachips_stdpxxxx_ge_b850v3_fw] [ 31.923139] i2c_device_remove+0x181/0x1f0 The two bridges (stdp2690, stdp4028) do not probe at the same time, so the driver does not call ge_b850v3_resgiter() when probing, causing the driver to try to remove the object that has not been initialized. Fix this by checking whether both the bridges are probed. Fixes: 11632d4aa2b3 ("drm/bridge: megachips: Ensure both bridges are probed before registration") Signed-off-by: Zheyu Ma Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220830073450.1897020-1-zheyuma97@gmail.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c index cce98bf2a4e7..72248a565579 100644 --- a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c +++ b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c @@ -296,7 +296,9 @@ static void ge_b850v3_lvds_remove(void) * This check is to avoid both the drivers * removing the bridge in their remove() function */ - if (!ge_b850v3_lvds_ptr) + if (!ge_b850v3_lvds_ptr || + !ge_b850v3_lvds_ptr->stdp2690_i2c || + !ge_b850v3_lvds_ptr->stdp4028_i2c) goto out; drm_bridge_remove(&ge_b850v3_lvds_ptr->bridge); From patchwork 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: 9203 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458990wru; Mon, 24 Oct 2022 06:38:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4TiiDHQpJMgzn7S5NuaDjcZlEzaSw1VSKOx3A9++z0ADZ2eEYmA0RwP1AXZBSAQLHJxJQ6 X-Received: by 2002:a17:906:db0e:b0:77b:82cf:54a6 with SMTP id xj14-20020a170906db0e00b0077b82cf54a6mr27108419ejb.691.1666618709481; Mon, 24 Oct 2022 06:38:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618709; cv=none; d=google.com; s=arc-20160816; b=k5GlDC3R8cWv+MIiGDihB9Llfn9XN5A1hd81LNmg7005kH6r+5VnJ72EfOA2o9mHKb Z7x+ZhStA2ohz7p1ere74zSdjavN2yOA7vYY+tJaYywg0diPpppALZNAiUxbkeDNPmoE HbxDMuCTqncAAlbjX6t5Jk3DvtUUUXgtRvCZCqvBQjQBYRrQHNNIwIMfcs/nv55q1+HI lY/XmLayH4shui8evaJZj6qSWteG1vUq48wZ/Q71GpOh7KQsMnCT4jlIHIGJNBUWYWRp 6O1v6oznDi5zFn9dGxg4/8fZivbXwhwZm4oJds61LxkVb296zyu+kW7sghMmiYazcEQ3 ua8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vpjlNrMc//uQNY2JUx0gdxNPRUS5WfU+Zy9ctR2MBrQ=; b=sFWmbVVV5G1m1K4zKQ7U2V2Ai2bY/XG6FRn8ynToUGP0EsLxGDLLLC983RcW3OZJ2S cHTITPXm5UYJGixEId2LcaXkvlF8vZPJziS12mwL/Emq3MwE9VoJcJU1IlrO3qw1+YUC /M4wOX2DdE9IDCOiPJd3nY4w00V1pauWXhyECPQtDR3yCTDr2cH/g4OkkoLmjC427tTU +Ovcb/ewlAmRFT8FyPd0MgfoaN6lQq+rw3OHLYDnvQw5gVUwKt6M45uzH8eogZ33EC7l EGcakgsLdvCFi8sw0qrWmFQIVKvl/d4tkI/4Zi2mn3THZKK99EBWzzYEDVUXHZ05FE5k Nq5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="lN/s2xdU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i13-20020a1709064fcd00b00780def41dc4si29846650ejw.527.2022.10.24.06.37.43; Mon, 24 Oct 2022 06:38: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="lN/s2xdU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236088AbiJXNep (ORCPT + 99 others); Mon, 24 Oct 2022 09:34:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236223AbiJXNaB (ORCPT ); Mon, 24 Oct 2022 09:30:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46B01AC499; Mon, 24 Oct 2022 05:33: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 A7871612A8; Mon, 24 Oct 2022 12:22:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7500C433D6; Mon, 24 Oct 2022 12:22:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614161; bh=L56yfIyCXPpMNDYD538abftjPp7bHPmQP8DEim/UyWM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lN/s2xdUTqYvZdHZCy85j6XUuEyRJzAECS5l93bd8eggy3rshlgsjKGYM/rPar3Mk 3j29i3BVtJjh03+us1HhE5x5X8tXZXd9drx5i7AM2CfgjThQcu8Bbjkx+rsL0Ebesj qMtQREeVgG6PaQQeoXk1uVR3hqtd4tcuqgptgt9s= 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.10 156/390] ASoC: rsnd: Add check for rsnd_mod_power_on Date: Mon, 24 Oct 2022 13:29:13 +0200 Message-Id: <20221024113029.337552738@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576379727589725?= X-GMAIL-MSGID: =?utf-8?q?1747576379727589725?= 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 042207c11651..2ead44779d46 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: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: 9375 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp476580wru; Mon, 24 Oct 2022 07:14:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6yRtcmxtEeQVM3wuChp2C1E371nKjBppZ6v1s778N32tciR5l0L2gdNEfbC7bFiR7hVNu+ X-Received: by 2002:a05:6402:40c7:b0:461:ecdb:1c41 with SMTP id z7-20020a05640240c700b00461ecdb1c41mr1977189edb.288.1666620855672; Mon, 24 Oct 2022 07:14:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666620855; cv=none; d=google.com; s=arc-20160816; b=errsGQRGuVAbcQPO/TlD4Cqfl01BFfmPXWY5TvwyXJJBRiBcK2GpQqfQk68nIL7Ru6 QeTAFXN12ceAe+w+m45pwIXtpngYXJW3UmInPSpVdNhcLOSyY+XvCf9o3d7MHzTJYynz J1RxG1l+9dXTJqSfoC1E6loLaop8Nkx8VrkLIXVkbmDMteDp9hVXL20essNJy4OdO+pM eAnUL4NZyjgLCZiBZ6aFChI2S5s/oLpkWJ8i3XdZiK8DqGkUaQUCjXrzigpO/NOQZPI9 iMtIS2XQVzD/HETZDeqHsdG+yCVHkRM0sDSIp4ZZpGigfOJpIv5T0uTU98K72WjRTLD/ Qwlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bJsWojfTY3CL3PkChJswlJgTS0bpaxOq9PAgCTVXmeA=; b=0Nfn7sb3Mchg8G/yCjdR+Qrq/Dd6F3/4nUKK6DfYxJUlcrrieexb1Vqd+QMp8FmzUV xwGm47shjT6E7mVcHNXP/2eWdXmYO0tLqFtAh+IWJP8GJrL9b+RBFjMwgPP205I20Olb MF4DbaSCLTZ1UAGpsY/jAHI5wXNAK/gijpupU1UrHT5KUj5f5o7yBWY8CsywEPdlermm kffkstOKH3s3+BuBPrcsjlhamkKfpIWWUgUgKgna1qD97Z3A7XJVThY72GF8sx9jq/oy xxFMWnOt6SPhQyeq22hjI2ofpzaoq8qhA7Efmczfmw+linRgFs+OoYTH2F47Z4GzKorF lHlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AbsyGM0N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr4-20020a170907720400b00782393c36cfsi3674703ejc.336.2022.10.24.07.13.51; Mon, 24 Oct 2022 07:14: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=AbsyGM0N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235125AbiJXOCs (ORCPT + 99 others); Mon, 24 Oct 2022 10:02:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232674AbiJXOB6 (ORCPT ); Mon, 24 Oct 2022 10:01: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 562A8BEF9A; Mon, 24 Oct 2022 05:48:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 47236612B4; Mon, 24 Oct 2022 12:22:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5966EC433D6; Mon, 24 Oct 2022 12:22:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614163; bh=5yFsfPZJZplO917Wk+HzULR3XGJoz9A34qqJ6E5hEzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AbsyGM0NSLrIFRkFcsQbL4LgEhcYKlYd6nP479T/PyGH7bmNyTcTQ6OVZDCi1pwhx hpeOCkKsae4DlGDDb3Hzfgp/7AQUZlRbtkQhDrEAq8Y0AP7X0ORO2/Q+KJIQ8ZquqK CxpZJYV2f3X+GNq03YBASb0weZtkjGF7QGHhBU3w= 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.10 157/390] ALSA: hda: beep: Simplify keep-power-at-enable behavior Date: Mon, 24 Oct 2022 13:29:14 +0200 Message-Id: <20221024113029.379520832@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747578630299461212?= X-GMAIL-MSGID: =?utf-8?q?1747578630299461212?= From: Takashi Iwai [ Upstream commit 4c8d695cb9bc5f6fd298a586602947b2fc099a64 ] The recent fix for IDT codecs to keep the power up while the beep is enabled can be better integrated into the beep helper code. This patch cleans up the code with refactoring. Fixes: 414d38ba8710 ("ALSA: hda/sigmatel: Keep power up while beep is enabled") Link: https://lore.kernel.org/r/20220906092306.26183-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/pci/hda/hda_beep.c | 15 +++++++++++++-- sound/pci/hda/hda_beep.h | 1 + sound/pci/hda/patch_sigmatel.c | 25 ++----------------------- 3 files changed, 16 insertions(+), 25 deletions(-) diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c index 53a2b89f8983..e63621bcb214 100644 --- a/sound/pci/hda/hda_beep.c +++ b/sound/pci/hda/hda_beep.c @@ -118,6 +118,12 @@ static int snd_hda_beep_event(struct input_dev *dev, unsigned int type, return 0; } +static void turn_on_beep(struct hda_beep *beep) +{ + if (beep->keep_power_at_enable) + snd_hda_power_up_pm(beep->codec); +} + static void turn_off_beep(struct hda_beep *beep) { cancel_work_sync(&beep->beep_work); @@ -125,6 +131,8 @@ static void turn_off_beep(struct hda_beep *beep) /* turn off beep */ generate_tone(beep, 0); } + if (beep->keep_power_at_enable) + snd_hda_power_down_pm(beep->codec); } /** @@ -140,7 +148,9 @@ int snd_hda_enable_beep_device(struct hda_codec *codec, int enable) enable = !!enable; if (beep->enabled != enable) { beep->enabled = enable; - if (!enable) + if (enable) + turn_on_beep(beep); + else turn_off_beep(beep); return 1; } @@ -167,7 +177,8 @@ static int beep_dev_disconnect(struct snd_device *device) input_unregister_device(beep->dev); else input_free_device(beep->dev); - turn_off_beep(beep); + if (beep->enabled) + turn_off_beep(beep); return 0; } diff --git a/sound/pci/hda/hda_beep.h b/sound/pci/hda/hda_beep.h index a25358a4807a..db76e3ddba65 100644 --- a/sound/pci/hda/hda_beep.h +++ b/sound/pci/hda/hda_beep.h @@ -25,6 +25,7 @@ struct hda_beep { unsigned int enabled:1; unsigned int linear_tone:1; /* linear tone for IDT/STAC codec */ unsigned int playing:1; + unsigned int keep_power_at_enable:1; /* set by driver */ struct work_struct beep_work; /* scheduled task for beep event */ struct mutex mutex; void (*power_hook)(struct hda_beep *beep, bool on); diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index b848e435b93f..6fc0c4e77cd1 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -4308,6 +4308,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)) { @@ -4448,28 +4450,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 */ @@ -4482,7 +4462,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: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: 9690 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp543152wru; Mon, 24 Oct 2022 09:29:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4zzx+mV5kdC7+5jCLOU7jDFCZOlDrtw9cHzCxW+lWUJD1gDBCHo5JmhYgorJ+CX/A5goqL X-Received: by 2002:a17:907:96a0:b0:78d:dd45:a6d4 with SMTP id hd32-20020a17090796a000b0078ddd45a6d4mr28696823ejc.643.1666628953955; Mon, 24 Oct 2022 09:29:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666628953; cv=none; d=google.com; s=arc-20160816; b=vBiu5OOb+T7beZ8HxRt+6LJbYFDDbebROzm4u4jprusmdGm7vENXhws08Safeh0XX8 fVsQFlgLLawFru+EIggGVVHbsOym4iXyMvW27miTJgLL/b+lTCSM1LQB0G2Q38Fe1MAY NwWimqg392MFa1CEsxGk0UB5N+IMrgnAx/C5UFUldWqprF23PgnQCZFR5w6BpZkMwfCV wu2hI3x3Zu05IO+OdxGQTYmIyqhXqCQwN7FukYlKV240INcJR8IDnCFwaui6J5VpZWbF 1e8Y5wVYQSoN6qEbsERtWhE/puwhWlXj9XCQGlLcXwc0B1myJSyGvd5hMFpSsUGD1Bgh VVnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=f6tRsyMXmPCINA/3Uhp0Lf9S0Ve0cL/bxYCf1gdfMI4=; b=RZk43MiDFRvcjidWbYF9GkEXl81tNao/s7Z+D7+fN8QNLfI6iFnCkyULmcRyqpzs7S HEct/QYQiUgKhDruQUqYHt5MeWIPmvoWy8jNNb0A4j23zD0Gflqe0JAF57mgcHPsLFLd rjgXRmGQnQJvdjnQ9s7nVUmxlPh0PztKUQt+mKYoaNFRpM+yEMdKgom7TzlHOT+kqM7Y RpcKtZPf2uWTfnGzBbTzgEONjfCguI1ZTZmvAloYnj06H0dMXWBICIRu4gI78UHlt5VT ohMz4R1CQAU6iHE1+SmwYvK/u3x9fB63XsN/tVECH0/mVO9ZEpYtwRw7DUNYUYv8Xu1w kG6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2A06cN83; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 13-20020a508e4d000000b0045d8bff7b1asi168315edx.403.2022.10.24.09.28.49; Mon, 24 Oct 2022 09:29: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=2A06cN83; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234058AbiJXQNH (ORCPT + 99 others); Mon, 24 Oct 2022 12:13:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233908AbiJXQJR (ORCPT ); Mon, 24 Oct 2022 12:09:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CA31386B0; Mon, 24 Oct 2022 07:59: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 9D623B8166A; Mon, 24 Oct 2022 12:22:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F04AFC433C1; Mon, 24 Oct 2022 12:22:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614166; bh=xAGYtDTCGYJp30doSFA5cS5oq9dkqvAuxKbbKOD7lIg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2A06cN83U7pA7EdLnWX0KePhYtl1mimOKZFMyor6PZgrZbs/Dc/eQYWSCPduDHemn tWS1Pyh6m6WxHB/w5iqpSDJYXSVz55hafugaheVjM/pQwUEQcJhen3XfZMzs+phEA9 BheOLClp8sYLuW00ydl1vfnttvIY5tY9fhDlYaqA= 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.10 158/390] drm/omap: dss: Fix refcount leak bugs Date: Mon, 24 Oct 2022 13:29:15 +0200 Message-Id: <20221024113029.428485183@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587122121248944?= X-GMAIL-MSGID: =?utf-8?q?1747587122121248944?= 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 6ccbc29c4ce4..d5b3123ed081 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: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: 9112 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456124wru; Mon, 24 Oct 2022 06:33:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4zkcyCYnRSBJreE1YOnYSaSmjGxITjQpilRhV573TGfhZHy+HviXbcjEqTVbh4V9ucexvu X-Received: by 2002:a63:d1b:0:b0:42b:828b:f14a with SMTP id c27-20020a630d1b000000b0042b828bf14amr28728243pgl.235.1666618417228; Mon, 24 Oct 2022 06:33:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618417; cv=none; d=google.com; s=arc-20160816; b=MFTDrm3ZW/GwgpvLvrw6MSvVmyv/B4lr3F4VMnpxvMSAyb3UQjJQ6OqWzhvjdUY9/D /TOIbdfEl/vw6Qc7NpacgmP2NJoSlQ/ElbUGqw7+3rf+G37QInWhbcWLpZc4fm4/KLMm AsL2yQEZjRiAvqVXNuB9dSVnVM5N+xrj8TBVuxlCJ8tXVZMUpRp5dnGYJcPViamgqQEP A64YNrkY9TiZ6GCBenVGjmCvrQBMTq74ySWjOrm+Mpfa9awl4JTqGF2ANIMnT4xYQd/R gq3wcH/wQXfJMy2MFAaGdfH8ereYIhAHwWoaDgPbpFH2BSrYx1A+QQGX6Eb3nXCAbHlN piyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8ehNS1ptLL05Y6Yg4fznQ0A3GNUxY6c/ZUu7V+Jv+wY=; b=SaVn2xCO+zT+OOW98MZi4lhyk1dhyevj6UbH3j1Cyw7mjOT3VyTJTgOXQ1Uan0rZ/t xTHAAa5rSq1eLt2kPKiPqLdoI9OJ0zDDozbsQiGVe/ARgSHHConWezGMkm8OaTJ9swxB m0FcHFgvobrCT5mnbR5yoM/BolwlGY0ZGfHbv3N1ydTuxLA5HVEFUZH68TlFeArZ2Fqo hqSRrReVcd39yVNsfKnTsU3lR0L9hzUv7D689XhdtrRuF8tLpdjF0tJPgWp4h1ynim6p IyT1FF8+ZE+hyCkEC2sF+qyQAq/tjXuoeOvp75OhQ5drnpZ/LjggGdI4BAujkSHC2Lm0 gKyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IwtxEb9s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r22-20020a6560d6000000b00462fbd5b46bsi31870871pgv.35.2022.10.24.06.33.23; Mon, 24 Oct 2022 06:33:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IwtxEb9s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231655AbiJXNRl (ORCPT + 99 others); Mon, 24 Oct 2022 09:17:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235914AbiJXNRE (ORCPT ); Mon, 24 Oct 2022 09:17:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91CD8A3465; Mon, 24 Oct 2022 05:26: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 8299F612E1; Mon, 24 Oct 2022 12:22:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 951EFC433C1; Mon, 24 Oct 2022 12:22:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614169; bh=lF6ikwfS09Vqb7bDreozm3jZplO8R39vXqkubMiPaoI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IwtxEb9sUYxYIZILn9H769LBB0k6FQKTG5cCu91Zp1S6TPWZk5veUydp+VrHx1OL1 irvUrJxf5pENvpOaAdfxM/GGGHPSVPxFa9kL3ymAOguwduIZfO5+xQ74VpZeK7PQeb 0xbC5tLgpTkAB+h9DAkvInphbQCeaPaEtYpTNwtk= 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.10 159/390] mmc: au1xmmc: Fix an error handling path in au1xmmc_probe() Date: Mon, 24 Oct 2022 13:29:16 +0200 Message-Id: <20221024113029.469146107@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576073887137273?= X-GMAIL-MSGID: =?utf-8?q?1747576073887137273?= 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 bd00515fbaba..56a3bf51d446 100644 --- a/drivers/mmc/host/au1xmmc.c +++ b/drivers/mmc/host/au1xmmc.c @@ -1097,8 +1097,9 @@ static int au1xmmc_probe(struct platform_device *pdev) if (host->platdata && host->platdata->cd_setup && !(mmc->caps & MMC_CAP_NEEDS_POLL)) host->platdata->cd_setup(mmc, 0); -out_clk: + clk_disable_unprepare(host->clk); +out_clk: clk_put(host->clk); out_irq: free_irq(host->irq, host); From patchwork 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: 9094 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp446146wru; Mon, 24 Oct 2022 06:13:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7X2bUdmO3dz/u1TXZ3pdZOKgZbigyHt7+M0BVcFGQrbzrUptsZd5LkI6PS9vLe2utRyOz0 X-Received: by 2002:a63:8149:0:b0:461:f9f7:f64a with SMTP id t70-20020a638149000000b00461f9f7f64amr28045152pgd.338.1666617228694; Mon, 24 Oct 2022 06:13:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617228; cv=none; d=google.com; s=arc-20160816; b=ZuBsnJpI7rAYamwERf+iX9MWRfxtQ5r8v7CPZdXrg6IyYJaQhyoW4ff7ftmdHq0/fm NuPXJ8hfO16Et751L30377hLZMeUwPInFuwZ6qGBBrAipiHGFNJC1BlLxRbkp4A1xHgk wWaTsYdteK/Bad11cdgohf5MwF9t65LleZW8cxDy6wgDKjCBUQWWxSi1Irp65pDbTciX M9SC6HlUfA59MgApZ24JGZhJ9L0F7XzdPrRkuDwbvLt7Il5LlqGg8uAfiEjXqe3nQtvu ba0VbBSz0UppcOUNqbWXyqHIWlofvdCVx2LSzxttutE4Ps3doajayrt53u1s3xKiFvJZ NfEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nPtnebfupJEiV7A6AnvSDr5/arHiLBTzquU+jwnLlnY=; b=kjPCRw9ztzrLnVSM7+TYQLkK66UD+tyCjq1kCFjlVknALB388TEs1WQj2djtbcaySe 5t5MP4h3dmaIystY/+5z1q16pYLELEjdpR/aLkZLUju4601ge67RFl7oPaMpe63gPrJn W+XESH8ZXdX3DT7tIsfeKGSsd495ioMrSbDYjbK24huShXOo/G515uePfh88+d2tPQND 55JhDkaflUZ5Bpns+IDVDhcmDmmLmy8QLotjSsnQ4dWj3JPiXMy5gOopt1d4zPpXpUO3 ja2r7gITPPNRYBBkj/Aqd2GFulcwYlawOz6xf1DhjLATFZflRcsZySwdAUL5h+VmfdXW S5tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LQLd8fVl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a634a1a000000b004493c7cfb5csi33680905pga.447.2022.10.24.06.13.35; Mon, 24 Oct 2022 06:13: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=LQLd8fVl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235779AbiJXNNB (ORCPT + 99 others); Mon, 24 Oct 2022 09:13:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235995AbiJXNKW (ORCPT ); Mon, 24 Oct 2022 09:10:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DB39237ED; 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 27EB66126B; Mon, 24 Oct 2022 12:22:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3490CC433C1; Mon, 24 Oct 2022 12:22:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614171; bh=MP1yxVGBMzqN7/KGr058ycVVbIuCkd0O/DCmCEKeALM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LQLd8fVlNVxtEpwQBGP8dDJu4lurxDhvvehZdTol0AvnTAFasb7m6PnadaZmEQZ0Q YxvqrZGp6TpxQpkqkMAm1i4ZB+5Iy3Dpyop097rwlYRDJfT+DWUMr/4f0SRTbLuYsR VMusNC1NIWXUMjOzvWZcvhcQbldIINWsc+yw3tOo= 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.10 160/390] ASoC: eureka-tlv320: Hold reference returned from of_find_xxx API Date: Mon, 24 Oct 2022 13:29:17 +0200 Message-Id: <20221024113029.513716431@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574826852742749?= X-GMAIL-MSGID: =?utf-8?q?1747574826852742749?= 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 e13271ea84de..29cf9234984d 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: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: 10207 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp642379wru; Mon, 24 Oct 2022 13:38:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4zm7s/g7+w/4ii2ZzckMSqcYPfwClWbhRXBDH8cIBGsrfikD7tF5zqXvRva1yIiQ9nD0IA X-Received: by 2002:a63:1b0f:0:b0:46b:910:6cd9 with SMTP id b15-20020a631b0f000000b0046b09106cd9mr29760314pgb.5.1666643897511; Mon, 24 Oct 2022 13:38:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643897; cv=none; d=google.com; s=arc-20160816; b=MNDROo+3bvDPyuE2kygkvbN/iVYy6BhP16xo2iiwvMJ8znh1pXvadnmJWpN3S89iOc Zoqll8eTSrpUIsIroUCn4srgShx1BpKEVBA9Iyer9B+ZI3KDZ/ylV7ZvfMUrHz71OAg9 /mi4Dj9DzlctbR7ShUBbkWPnv/1nRKqgzmOS3ZKxjfp8Dnc6K7S9NZf6Id0DlhhFrFkC qu7FVm+gSTzV3z1BP1rlRa/5zFJWvR0vhB2wTANccS2P/D5z8XU3XdjLjTOf5JfE0ckY 5IMyIFm7tjM4c7l3vr7wqZfqxk9n6mwZ0pNOHfn94QaKOk9eiogRIHTnd34aZF58aORQ anvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=N8gAXY6CQjNLf4Qw5jty/p6xbuaLqIBGnizSdlN85dA=; b=GjBzeAYHl+FK079+z7n/ho1N0Li00GdyS0iC3QeQNbEtnGMsVBxa/GBnJ6OV5K4Zy6 D1C4rY+mvjQK/nQiKZnvri5IYG6GL8ue6QhUqXZW3N7aFHN8mkJcKTMQ7lKP1oAxy8yU PrYQQw54JDk2a2sl5QI5op32Gm05aL29Km1ZOvJZta5G9sYBGUaR4UIB9e7zYl+vypQY lwprWbaO/iFa218VU8h1rmNHRroYjUPm/V4mc7sykPLFBFaPIaQ7sIY9gnYfbUtRNRgu L88vH5lism5y1nqVb59ENlMzhwlcY6MwjXeo2JFzi5Y7tkOSFe/ZvXONeISo7zLmMyVM jOEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GRtQ3SNF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c2-20020a63ea02000000b00438806c7b2bsi504052pgi.154.2022.10.24.13.38.04; Mon, 24 Oct 2022 13:38: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=GRtQ3SNF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233258AbiJXUgk (ORCPT + 99 others); Mon, 24 Oct 2022 16:36:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234398AbiJXUgN (ORCPT ); Mon, 24 Oct 2022 16:36: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 BACF611A970; Mon, 24 Oct 2022 11:47:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 85C70B8166B; Mon, 24 Oct 2022 12:22:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D28F6C433C1; Mon, 24 Oct 2022 12:22:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614174; bh=7NXYJoYVZF0oqrYBzvMTdd/6sOC09nKfM09j/WB4rgA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GRtQ3SNFH8boxMfGPAhm4msvVmndLTMra6xduzg3DYhdBtiwvaVamIzO/iagQNl20 QS4NdkqeBT7s9cF+v7LrN5kwEwDngIaU3FMOg4TOuVLSnBIaJ3YLjoDSLsMmDGyd8t apv0W+2l070fyWbAOv8YD1GNeTaQGWrpQ6pj0yD4= 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.10 161/390] drm/msm/dpu: index dpu_kms->hw_vbif using vbif_idx Date: Mon, 24 Oct 2022 13:29:18 +0200 Message-Id: <20221024113029.561277803@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602791660396016?= X-GMAIL-MSGID: =?utf-8?q?1747602791660396016?= 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 7503f093f3b6..b7841f7fc10a 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -675,12 +675,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; } } } @@ -987,7 +985,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 5e8c3f3e6625..fc86d34aec80 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c @@ -11,6 +11,14 @@ #include "dpu_hw_vbif.h" #include "dpu_trace.h" +static struct dpu_hw_vbif *dpu_get_vbif(struct dpu_kms *dpu_kms, enum dpu_vbif vbif_idx) +{ + if (vbif_idx < ARRAY_SIZE(dpu_kms->hw_vbif)) + return dpu_kms->hw_vbif[vbif_idx]; + + return NULL; +} + /** * _dpu_vbif_wait_for_xin_halt - wait for the xin to halt * @vbif: Pointer to hardware vbif driver @@ -148,20 +156,15 @@ static u32 _dpu_vbif_get_ot_limit(struct dpu_hw_vbif *vbif, void dpu_vbif_set_ot_limit(struct dpu_kms *dpu_kms, struct dpu_vbif_set_ot_params *params) { - struct dpu_hw_vbif *vbif = NULL; + struct dpu_hw_vbif *vbif; struct dpu_hw_mdp *mdp; bool forced_on = false; u32 ot_lim; - int ret, i; + int ret; mdp = dpu_kms->hw_mdp; - for (i = 0; i < ARRAY_SIZE(dpu_kms->hw_vbif); i++) { - if (dpu_kms->hw_vbif[i] && - dpu_kms->hw_vbif[i]->idx == params->vbif_idx) - vbif = dpu_kms->hw_vbif[i]; - } - + vbif = dpu_get_vbif(dpu_kms, params->vbif_idx); if (!vbif || !mdp) { DPU_DEBUG("invalid arguments vbif %d mdp %d\n", vbif != NULL, mdp != NULL); @@ -204,7 +207,7 @@ void dpu_vbif_set_ot_limit(struct dpu_kms *dpu_kms, void dpu_vbif_set_qos_remap(struct dpu_kms *dpu_kms, struct dpu_vbif_set_qos_params *params) { - struct dpu_hw_vbif *vbif = NULL; + struct dpu_hw_vbif *vbif; struct dpu_hw_mdp *mdp; bool forced_on = false; const struct dpu_vbif_qos_tbl *qos_tbl; @@ -216,13 +219,7 @@ void dpu_vbif_set_qos_remap(struct dpu_kms *dpu_kms, } mdp = dpu_kms->hw_mdp; - for (i = 0; i < ARRAY_SIZE(dpu_kms->hw_vbif); i++) { - if (dpu_kms->hw_vbif[i] && - dpu_kms->hw_vbif[i]->idx == params->vbif_idx) { - vbif = dpu_kms->hw_vbif[i]; - break; - } - } + vbif = dpu_get_vbif(dpu_kms, params->vbif_idx); if (!vbif || !vbif->cap) { DPU_ERROR("invalid vbif %d\n", params->vbif_idx); From patchwork 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: 9132 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456582wru; Mon, 24 Oct 2022 06:34:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5s+AfSqqSFsOychZ1qvqljUZqA/r27sN87BHUPSdLX0UZ2AxAiGfzMVAx7CyNAVnNg9Gdd X-Received: by 2002:a05:6402:f18:b0:460:cf08:2b41 with SMTP id i24-20020a0564020f1800b00460cf082b41mr20120222eda.400.1666618466886; Mon, 24 Oct 2022 06:34:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618466; cv=none; d=google.com; s=arc-20160816; b=GEDOho5ZMPsu/nOpYir1n+r6H/KIHqL3BjlghdsJsMy5IdBxfKypvOwXCnw696PLlr aYtZ9P5EVE+Qs2HXPwq+3UShu5ry/6usPVIUmU2OkFAWve13IBPqhlpEhmuAJdx8DncK ZznF2CN2PFaj7BeW4JUEPnGLVgHpm6EFhbVRhhcpzVz/478/XzUdjlmIpFvZ8bdY0Ez4 gk1zEtK4czxyXUuF4VY7mnN3zaqJPue4RXQPLKyFz8FbOhTvxvuwIAOFC3auWL4i6kOF qwdCWYeOXPlQ4jpno2i/Uu7aMH9w/zLKcYNyl4XdPG+D+ESf848T4a+QPHp0hDbPvvQy qPpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Z1mLXnvpmRKPzGwcHflP9UVOomIZ9iKHwziXqTOMtH8=; b=YcZh98zRWOnQ1WSlUtU0/c8/bOFhAYi6qDiz8nEKbnIO944SpmqB/imQ3CAKWWm8ml NzuZHxy0W7WoMcCWlwtufaOZOvLGFYkheRKq+gXrEK/vECGomhaWIGs5KZYpEyUk4klQ bxesn2Sjunw7IFzxtm7QREp58EC69ErFf7wrhbHPomBuVCutke5IGKaGllwbZq5WmlHx rIsnmfzBaH8u2E4kNg0U+xf0iW8NnE2ojBwTX/qiO7gTif4H3Ab5o82DqZIWnue1tHoa AE5p2DZiNTGMZ67Mb9+eXspqpm3I0VlwG7xW5JTB8Uw7jsUPECWzmzJMOJWTMwLtGtiO J2qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=P0eKcMRt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf24-20020a1709077f1800b0078a4aad3141si29200946ejc.211.2022.10.24.06.33.59; Mon, 24 Oct 2022 06:34: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=P0eKcMRt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231751AbiJXNSn (ORCPT + 99 others); Mon, 24 Oct 2022 09:18:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234325AbiJXNRb (ORCPT ); Mon, 24 Oct 2022 09:17:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8166050F8B; Mon, 24 Oct 2022 05:26: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 60E9A61281; Mon, 24 Oct 2022 12:22:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77A0FC433D7; Mon, 24 Oct 2022 12:22:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614176; bh=Ro8YsoiH1vaVl94vaZKoWoomP6ZZtJl0riym3dzXH/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P0eKcMRtlc2ZgU+YGFcFyQbau6gIASEl6Ka6d2OzWrMw0RmjxVvJcBU8kcTRuLOiL qm0yPXt9O8GVl7OSh0zuNZpggOuuNTJ0G+TI3CWUcqW06s9Sx2/VFE8aGQ76L6Gu/Z uhRdO0GgxbO6qd2qTx4ySR4HYirgc+iQjbLmZgOM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuogee Hsieh , Stephen Boyd , Abhinav Kumar , Dmitry Baryshkov , Rob Clark , Sasha Levin Subject: [PATCH 5.10 162/390] drm/msm/dp: correct 1.62G link rate at dp_catalog_ctrl_config_msa() Date: Mon, 24 Oct 2022 13:29:19 +0200 Message-Id: <20221024113029.610820560@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576125944976658?= X-GMAIL-MSGID: =?utf-8?q?1747576125944976658?= From: Kuogee Hsieh [ Upstream commit aa0bff10af1c4b92e6b56e3e1b7f81c660d3ba78 ] At current implementation there is an extra 0 at 1.62G link rate which cause no correct pixel_div selected for 1.62G link rate to calculate mvid and nvid. This patch delete the extra 0 to have mvid and nvid be calculated correctly. Changes in v2: -- fix Fixes tag's text Changes in v3: -- fix misspelling of "Reviewed-by" Fixes: 937f941ca06f ("drm/msm/dp: Use qmp phy for DP PLL and PHY") Signed-off-by: Kuogee Hsieh Reviewed-by: Stephen Boyd Reviewed-by: Abhinav Kumar Patchwork: https://patchwork.freedesktop.org/patch/499328/ Link: https://lore.kernel.org/r/1661372150-3764-1-git-send-email-quic_khsieh@quicinc.com [DB: rewrapped commit message] Signed-off-by: Dmitry Baryshkov Signed-off-by: Rob Clark Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/dp/dp_catalog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.c b/drivers/gpu/drm/msm/dp/dp_catalog.c index 2da6982efdbf..613348b022fe 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.c +++ b/drivers/gpu/drm/msm/dp/dp_catalog.c @@ -416,7 +416,7 @@ void dp_catalog_ctrl_config_msa(struct dp_catalog *dp_catalog, if (rate == link_rate_hbr3) pixel_div = 6; - else if (rate == 1620000 || rate == 270000) + else if (rate == 162000 || rate == 270000) pixel_div = 2; else if (rate == link_rate_hbr2) pixel_div = 4; From patchwork 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: 9098 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp453868wru; Mon, 24 Oct 2022 06:28:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Lp8DGjAIswpsxypIhW80hp9aekJMCORfhb+mjaFYzCbvVcDcH7yp2kiDdCNMp2do50n4u X-Received: by 2002:aa7:d30a:0:b0:460:362e:af11 with SMTP id p10-20020aa7d30a000000b00460362eaf11mr22132989edq.256.1666618134496; Mon, 24 Oct 2022 06:28:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618134; cv=none; d=google.com; s=arc-20160816; b=0aeWhbS/mkhqeysExgTMHIoMI310uAsPMevpcwunNyK0iph8QbcdfnND+duUYoldiC 73xO+YTArqgMsj0YYPtY4bJmmHaYbLm2uHQVSyeaCax7oK3VtXZkzws1hmkrLHjWtyC1 UHtGuDyBxsuOUFAM/8BLr8JsjcfrtmdQrqk+YJTu0z1s/I6ZEQkqxuqXoVKz5fEjrGFE pjuI9kKqm1wYVyeb5TiyLSG+vDW+q4Hrg0Pz8pZru7e+ADgidWrXBQnfSnJZabGKKtbp tGOp1YpAlAhHKpHxv8Hhpkc5AJU9ZZz/P4SUKSPmP+4QnNOCqGkElbxpGsNOOVSbcGgx L03A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MToBfOeK0tWDwedqcFVk3wR7Th8ndGbW6UGN7+0cuz8=; b=z0ob3q+aI38v/OpUpyUR50tf9HbcmPMGOJTFvzXV25+ywj0REwVs4mnYqZ7vlbNrTb 19qzjKbyN+ouqONBjS4hcpjCnSGe/qWYhRwU7MDom6qauFETLsRQPopGa9uphngoS+S+ ka0rgiFH/+wBaKCqAaRVIDQY2LqHxYHFx1RbICC3FcJwVKIQuhjH/6pcGwayZlq9t0P7 NXFKzTQtgojay1lfYT+e/mRoyctZ93thignNEarMPimM7ZoeSR2m5OReLgwU6Lil2hcM jzQOmas4VF3TgR8l6olKIZkI15d3ERkG3RSllYuNtBMnUVqZ3HKWlpsFhM/ZUQPkHeZL 9cHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YJUY4djY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ec33-20020a0564020d6100b004615a57e292si7715742edb.426.2022.10.24.06.28.29; Mon, 24 Oct 2022 06:28: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=YJUY4djY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235802AbiJXNNP (ORCPT + 99 others); Mon, 24 Oct 2022 09:13:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236041AbiJXNKb (ORCPT ); Mon, 24 Oct 2022 09:10:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0AD4275DB; Mon, 24 Oct 2022 05:24: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 0692D61218; Mon, 24 Oct 2022 12:23:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19686C433C1; Mon, 24 Oct 2022 12:22:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614179; bh=biVTL9eoN7LxL7wN3GMR5ldMXPiMF4nfAD7JmXl/RMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YJUY4djYtOohT9bj3plWQ/YEu9qsfTfkag0Mkjj3lIQexYX1ANe68I9cWF+NZYn+b zSZm0V+IWT3p3MPX+6A8oFMbFV4iBB45sjwxDEuhThVyqVREcJzsLjq5kuGkRDYcyd 8DDh6XPjW3cDm4561pH7GUO0ID5Ut0LEEF/MERH0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Christophe JAILLET , Mark Brown , Sasha Levin Subject: [PATCH 5.10 163/390] ASoC: da7219: Fix an error handling path in da7219_register_dai_clks() Date: Mon, 24 Oct 2022 13:29:20 +0200 Message-Id: <20221024113029.651050987@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747575776748859448?= X-GMAIL-MSGID: =?utf-8?q?1747575776748859448?= From: Christophe JAILLET [ Upstream commit abb4e4349afe7eecdb0499582f1c777031e3a7c8 ] If clk_hw_register() fails, the corresponding clk should not be unregistered. To handle errors from loops, clean up partial iterations before doing the goto. So add a clk_hw_unregister(). Then use a while (--i >= 0) loop in the unwind section. Fixes: 78013a1cf297 ("ASoC: da7219: Fix clock handling around codec level probe") Reported-by: Dan Carpenter Signed-off-by: Christophe JAILLET Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/e4acceab57a0d9e477a8d5890a45c5309e553e7c.1663875789.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/da7219.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/da7219.c b/sound/soc/codecs/da7219.c index 5f8c96dea094..f9e58d6509a8 100644 --- a/sound/soc/codecs/da7219.c +++ b/sound/soc/codecs/da7219.c @@ -2194,6 +2194,7 @@ static int da7219_register_dai_clks(struct snd_soc_component *component) dai_clk_lookup = clkdev_hw_create(dai_clk_hw, init.name, "%s", dev_name(dev)); if (!dai_clk_lookup) { + clk_hw_unregister(dai_clk_hw); ret = -ENOMEM; goto err; } else { @@ -2215,12 +2216,12 @@ static int da7219_register_dai_clks(struct snd_soc_component *component) return 0; err: - do { + while (--i >= 0) { if (da7219->dai_clks_lookup[i]) clkdev_drop(da7219->dai_clks_lookup[i]); clk_hw_unregister(&da7219->dai_clks_hw[i]); - } while (i-- > 0); + } if (np) kfree(da7219->clk_hw_data); From patchwork 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: 9262 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp462223wru; Mon, 24 Oct 2022 06:45:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5XX6pDU6CXCTsz8xYAuGRKX7v2gaSJnYv1dobUcUUm5ZPKpCbhb5wgFDJwAVkTnLmhmaZO X-Received: by 2002:a17:906:9b8b:b0:78d:8276:ff47 with SMTP id dd11-20020a1709069b8b00b0078d8276ff47mr27989252ejc.430.1666619134330; Mon, 24 Oct 2022 06:45:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619134; cv=none; d=google.com; s=arc-20160816; b=aV51O7l0GidfYtsBLW1nbnuxS9iCwk28XGP1N/SJ40s0M5AgXJrZlR3LtwDyjiULg/ U8A+R7xYdJqFbOUcePuYU9wPShNjN9aMVmApJtt4XPXWdjB/rNn27YezxcebUjU6Zbvj lm5xlPVKhbJqd7pfImcHsRyvvdvJh2lRmdkhUUZTHyZUsRnSfT1VXHatZ+zdFSVKfDro iPOuKybgDtvkoTtRwvqU/BX5hfGlejpqZ8ieHGzW4GI0y+zrZCDTp7ZsfGtkk/FrnP3g TAMtIpl197hw4juHsin7i+oZ8gwOSqkNKSr116vq0g1zpsgV1R5GFA8ZRX8qvy6H77DV t23A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UqAIdn87Ujh8usUPNpV4HRvmKA8nMXeLBTNSykKk0Bw=; b=rlQM2FwHKIw35sPXkTMf7oqxehCeoqZZzMFLdLn+7FnEMwXmfzt3pS4D4IE1VRHHm5 Dw4ObDPIlE2YXoIV3uU/SFvovoRYSbuel9YK96/gYxD4AlkUhVYnp7wscksdA4MiIXhB sqWxkhHdcyc8GG3vuqFVLtKfGh40nybeqFM1ZmW/Ps+3f5DSLCAL41p/ucRGjEFoamMA FWaTEr7YZA9+0s/g0PQ4Sqs8v3UFihS0t2ML1ZpDAc4KRBUqO24ShlWOTqu7UbEsE9yL 6si4lULcv1W7QYD1QrhSp1nGfwGspt0m/MymGHM55XZ0F/oMNS3PqqxDt9OglMPBYmfe yd4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2YFp3Mi0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170906794f00b0078333d9f17bsi30556239ejo.819.2022.10.24.06.45.10; Mon, 24 Oct 2022 06:45:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2YFp3Mi0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236080AbiJXNhz (ORCPT + 99 others); Mon, 24 Oct 2022 09:37:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233541AbiJXNdi (ORCPT ); Mon, 24 Oct 2022 09:33: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 4EEC1209A6; Mon, 24 Oct 2022 05:34: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 B51BD612BB; Mon, 24 Oct 2022 12:23:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0B8AC433C1; Mon, 24 Oct 2022 12:23:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614182; bh=oei25bppX7opojlLxFImrhg7rgEMZXfr7N6+E7cS4gc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2YFp3Mi064UJA5WDeV7Jv224y+a5llOy7Mf2heA991TD8i6ZEiDx8F1gTO+dTnqVS YcxTP4jjugZd2q4g2N6/3AcKnURfb4jlJgz40FcON8Vmz3wyMv9r8IP2hwTly4m9p+ WpLuMz7ykoz9NXm6UI9wOmPfB8JK7xTCw/rUP8tM= 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.10 164/390] ALSA: dmaengine: increment buffer pointer atomically Date: Mon, 24 Oct 2022 13:29:21 +0200 Message-Id: <20221024113029.693302618@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576825148411357?= X-GMAIL-MSGID: =?utf-8?q?1747576825148411357?= 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 4d0e8fe535a1..be58505889a3 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: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: 9691 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp543838wru; Mon, 24 Oct 2022 09:30:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7yC+z3ohqDIaFc5VgOMrs7EhL8l2LIXyyS4ijbxPpaAHaw0zTdz2NTQbH3AJVo6HFqbIvP X-Received: by 2002:a05:6402:3890:b0:45c:2b5:b622 with SMTP id fd16-20020a056402389000b0045c02b5b622mr32063909edb.69.1666629047520; Mon, 24 Oct 2022 09:30:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629047; cv=none; d=google.com; s=arc-20160816; b=wXBLH3cglhGe9BNtq8Enr5VAFpagIk9RJQZCijvVeHpO9KBWI/qjtB2UuM1jneVAHb nNgO+MYRRTyot+Xa8wvcFL7491+0/8/wHt6ps4cDaEZo/ejN+wt3aGFF457m0qA5RYUz 2gEDviDJ0FXE4hVcaTgog3JwaSHf0r/yz5Ox+Bn4HrF4nPQ2CidukgF5RjdenrlxbrBo kNL2HETI5EA03nTrYMr4gbt+BV1uKj3x2mghLbbka53Y8SBOY2Q6XgOf9XlweBV5mjIJ 8ydSMd08hN+6XHUb2zQFp/9dt/qTykZ4lB/Js9fwiq5tujEgoC0weq8F6OrGfYltOwKL mypw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6xN/jyiUsQdnbPfyAYHVHe1KHGv5xsBfcQBKJcwyWuw=; b=tcACJRF9tEPbPcFjerKA06wvP+EA0Tt25YaBhecW8dktoEW5adoCn2057NCUeB6KMW /K79d8bphor6Vurzcw8izPbkN3N+1tz3IThwmAKlifQyRhYk1zuad5r3xWeWTWSxVH/Y L2pRuHtzdzmpW9qYNuk+rrtvLxYwm8R0F3PFilsrgqKlAA3JDsvWZLBc5s8My3gJj9Tf aL08s8NScLdT6MC8pwMqJIC1htOuzT3hoAn7lYCRev4jX6NqbsVncQL3Yv2jWQf/2uow vlF0R9fHsoilQ6iMKR8plXc5PvZ8z+6VD0e5at6VnFyCLp3sGdWKCUZk0lIhwMptcPf7 /Ktg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PQOxZWZw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h41-20020a0564020ea900b00447dfae6181si189110eda.235.2022.10.24.09.30.23; Mon, 24 Oct 2022 09:30: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=PQOxZWZw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233678AbiJXQP5 (ORCPT + 99 others); Mon, 24 Oct 2022 12:15:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231566AbiJXQMc (ORCPT ); Mon, 24 Oct 2022 12:12: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 8F872303EC; Mon, 24 Oct 2022 08:01:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 079A3B81662; Mon, 24 Oct 2022 12:23:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EE29C433D7; Mon, 24 Oct 2022 12:23:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614184; bh=kJzoIagnr6iTBQpAuXXRmG5H3xo8e2I+NFwdsmxml8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PQOxZWZw09+XoZ11vr11iwEW+JV3hBcDOXFp11MzbGzVgZSQK5xWphcZ/zGynTkBA wbB8781SeZPLRUhkfN39WaQkdQKqKjxia/KHob5a3q/WhDL3WnvcxkuKz+J5uY8RTw vVxMV+J7LoRrfW+sFQwlBj8kpZEE3kXahXqFhrbE= 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.10 165/390] mmc: wmt-sdmmc: Fix an error handling path in wmt_mci_probe() Date: Mon, 24 Oct 2022 13:29:22 +0200 Message-Id: <20221024113029.736175615@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587219950975594?= X-GMAIL-MSGID: =?utf-8?q?1747587219950975594?= 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 cf10949fb0ac..8df722ec57ed 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: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: 10203 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp642188wru; Mon, 24 Oct 2022 13:37:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4F8kg1HrqiBqsHqlVLhCQtezfQjTLUHX0aEffDPWYx1i5GYGBnDgGbPzTxkadIsh8emDXA X-Received: by 2002:a17:902:7c14:b0:17f:6303:f40 with SMTP id x20-20020a1709027c1400b0017f63030f40mr34832511pll.1.1666643861680; Mon, 24 Oct 2022 13:37:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643861; cv=none; d=google.com; s=arc-20160816; b=ZGx9dQy2Xs7ac191Ib+05u2fq1k4MQsGJKtYtV3wFSFv/3iaZ002sbclj2Z396Su5b PTF9cDXfG2z4p72vTFYYS5rCAORRowtqelUYjSH0kcPHEgSoy600g8uxhLKyqMSvtBg6 Dl9KJiN6ik0y4eI5rDMIYiIS2iHRrdzpto2N8vVAE11xuelP2igDBFQfrl0rwRND6eC6 8AC0IHJ3m161wClZsEjcRtLWC9VWxOoPA2mmjiaI6vZlC34DtAPwpwgwoiWy2gWquJbV dxJoOieUXLoKePbnAJgyTDJZlnj0K9SKA83tyAuaC1SHZ5BnBfQATipR6lp3Ci4D+hN7 sChg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=oKlbps9KqJ07oZ0PaPyVq2HOXOBHWELY28CFjy7stqi6pUmc36blr/pRwLFjRryhYw XOCMrw30fI8fYd4prF/uyF5vQMj9n+ru8BeI0pqD+JF8i5+8rmbAso380hIc7Drwmx1d O8g4G8c3l+LK48AX0ef2zU0GWysnaz1cFnNkZbamwooPXWeBsB+iVO/WLHXyKG/EFv5d BwNNnoQr3GK4EVNqh7xfgUKW02MsNZYNyGYIR9JaaVcpXe6MntxoG+V8m2XTnFDm8GjL zP7+mvYZIZQJBlcnvF8dW7ryQs52cZ1Z5N3dRGRg6MU7owK9U6Km/aC7bhACsZDzghDA 1g1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XXFOCyCA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u8-20020a17090341c800b001865d29164esi660961ple.212.2022.10.24.13.37.28; Mon, 24 Oct 2022 13:37: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=XXFOCyCA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233127AbiJXUcn (ORCPT + 99 others); Mon, 24 Oct 2022 16:32:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234342AbiJXUb1 (ORCPT ); Mon, 24 Oct 2022 16:31:27 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD5FA38697; Mon, 24 Oct 2022 11:43: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 sin.source.kernel.org (Postfix) with ESMTPS id 85CB5CE13C0; Mon, 24 Oct 2022 12:23:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BC44C433D6; Mon, 24 Oct 2022 12:23:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614190; bh=wF6UUJRkHf9QYtND6AvtkHRvV5GkEmtaCAcf59ra3aQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XXFOCyCAcIBXJGF+B4fWgoZQ87ACFp+uxZtIXSWRA72gEG8Iab+lBYYAoTpATcZ9/ TEXxybCG9FdQpc8c8rmBsiPoudjBM91/fG5ni3OI3AVzRv7ogiAR/94T2M6K7jq5GZ eVz52v/nqO+OY5Pt5g4q6SaovOUM51Sa3Hl9MzkU= 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.10 166/390] ASoC: wm8997: Fix PM disable depth imbalance in wm8997_probe Date: Mon, 24 Oct 2022 13:29:23 +0200 Message-Id: <20221024113029.785635873@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602754234612264?= X-GMAIL-MSGID: =?utf-8?q?1747602754234612264?= 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: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: 9097 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp453704wru; Mon, 24 Oct 2022 06:28:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM75LznJP6+8dafyxoN8/3zIUchMyRDBLGILupDGzPAZqiJX5O2qxil+yI07y13mUujDCq+9 X-Received: by 2002:aa7:c956:0:b0:43b:206d:c283 with SMTP id h22-20020aa7c956000000b0043b206dc283mr30961573edt.381.1666618112626; Mon, 24 Oct 2022 06:28:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618112; cv=none; d=google.com; s=arc-20160816; b=ExRnTlNUZhMSAdWeynq1BCZzjBw4woDKBXG8P1wA+nc5BknGF8hj12zxtrcboNJ2hq Lo4Zo5Ouu+Mnow4CyoePJdtQKKV5kh7oR3lZ+IPT8AEfUxgDjChK66S0spu9ZFiTDZaP ZnRoVjprhlZOUXX1z2rN+gwEZDrBzmPzOzsUDCX1SDlH8AMvNGF99gqHnevEyi9ZRCOk Jg0ELPYSbWYPcCmepPBZhJ+4c2UY4gXnvXT6EItez2IGtRHW7dHke6JGRw24NB018wbu iB8vYIW69xMgSLGdjecxV1uUVWWvFD0yJRMbhGBjDXB3iAtuWM/aoqVq/FGTcdFOls28 SYCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XJmxgd99L0IPVqEh4i4NM+KZSwQtVCeB1194mju9aRc=; b=VALsoADE1upbOGsaWVOA6eYbeFFxuW6hAecan+GVlCli2Vhab1DXIGg0NCVw32aui4 BGYpFbVFRgf55lPSjKQ7PADYLQ1oiPW3YrJIJxY7IpacNUPk1TpseD/hGZapYQV+Dl8w ak0b1DljVQUlmEavcG8xZbU8u0IKPjNSWDThLzKyIZqh3FShH7YR2LpGT2y66TC3Wygx 3wWjyWCVYuR7w4eVnThdQVRdxFcbPKQ42SqjHt57qZ8Hdv+gg8yN74Qxr0tgA9fQxAy7 H/Dnt96t6cNezFZ6yMiYIOxd2GYT/U/4R8RBYM5srCiNRuhkKjv6e+8koPRf+H07TU+i Hr+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zvpuxbPl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs29-20020a1709073e9d00b0078262e3839esi22182566ejc.27.2022.10.24.06.28.06; Mon, 24 Oct 2022 06:28: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=zvpuxbPl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235818AbiJXNN2 (ORCPT + 99 others); Mon, 24 Oct 2022 09:13:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235448AbiJXNKl (ORCPT ); Mon, 24 Oct 2022 09:10:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7F8B2528F; Mon, 24 Oct 2022 05:24: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 2F00B612CF; Mon, 24 Oct 2022 12:23:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AB7BC433D6; Mon, 24 Oct 2022 12:23:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614192; bh=U0blMcKFnjiZUPbpOFKpialXxKENKP4nNGEyBSB7tUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zvpuxbPlWnajIMrQrpVUHtSqhV+RM6S+Asy0nyjj9YqpzKxzCQJJLSyZ2Hvu72rP+ OeAKCAwQ/9sKKuhKZIhKCNGKuqg+3sv+tkLE/rtD+YiB/bBu/IWC680ACdY+gCtWV0 6s8VFlB3zG+3akfH+Q+TkDsfS25mGUHTLmhtp/Ok= 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.10 167/390] ASoC: wm5110: Fix PM disable depth imbalance in wm5110_probe Date: Mon, 24 Oct 2022 13:29:24 +0200 Message-Id: <20221024113029.822627514@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747575753961451835?= X-GMAIL-MSGID: =?utf-8?q?1747575753961451835?= 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 d0cef982215d..c158f8b1e8e4 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: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: 9657 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp534405wru; Mon, 24 Oct 2022 09:11:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5lMjvYZz7D1SdJv+OVKpDJtrcruPS9Tdy5Vtp4H6CBBc1706JH+M2jq8WhMnzUamgNBxl6 X-Received: by 2002:a17:906:6a04:b0:78d:ee09:d956 with SMTP id qw4-20020a1709066a0400b0078dee09d956mr27473862ejc.698.1666627864098; Mon, 24 Oct 2022 09:11:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627864; cv=none; d=google.com; s=arc-20160816; b=OVQJ7LKPix0Vlj10vDpgxOuy0KqQ+wWvOwB97dGRYa+OjrtYlv92P0L1FFtb7i13pO 7jlp5cy6KI38s2HoYh06Id0TLBfaeVvFFOB9+nMJIsJwvVFmgMvHBJxHRfd3Ot34GvMd Bt7QZvasYV7MqxtK23flVZF/xZ2V54YixhJWxZYZsMbFA9yoOcHscd0fwxYZfr8OZrGt LTp+7rZwA9JFFfqWna01BKl1LMUNcbPQHWgFOdXytDAEOPM8fld4it92ye+hJ1nYCZGp X7QTrgdgVlGFWwgwjGBT2Z3QtS87GWJ/ORMme6isuHKgpr5uBQwnNdpoBwDLm28jBmZs a0QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PzavDlO4tANlfJrR5jdbIHfHj4I/VXAjaZiUOuuVSM8=; b=rgV+UhPUx6zYdFKuqn2/B1TVr+fv0aN1mbg1MTlrke9BbAIY4+HXol0wcQRnPKW1dE swQxBbmGo4ht3u14nCVo2jzCSByonX3qiAx1XiTDJvsdldCIIuwZomGvAFIuOwS1l0DG LQAzMWB+X4380q2p5ahbrQFL2mIflnyRgayDxHTlvZmJLhA75ZsOFSOTJWH2VaWQ8qGe Vbr6ZJlVqIk7CrGwVLMSUesLkbdrbmqwdQTZ5e6+yf5UJgh6zEssV2XFSunSaiIqeKOK v5KaKj9bFZVOsig4YA6wa5g6PC36yfzTzKs+j78bQqs45nwIIffRFwy3csk1vwBQghql Qwew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cMMFPa6u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sb8-20020a1709076d8800b0078d2a84f2f8si142532ejc.645.2022.10.24.09.10.40; Mon, 24 Oct 2022 09: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=cMMFPa6u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233534AbiJXQI4 (ORCPT + 99 others); Mon, 24 Oct 2022 12:08:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233544AbiJXQEs (ORCPT ); Mon, 24 Oct 2022 12:04: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 9508DDFB9; Mon, 24 Oct 2022 07:57: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 7A830B8166E; Mon, 24 Oct 2022 12:23:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE165C43470; Mon, 24 Oct 2022 12:23:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614195; bh=wXDesccS09BJtqEdamCmB4BpWfVCFtjY6A2myTfxo5s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cMMFPa6u831/GmErN4cpxqGBNDPZnY98VXo5X6DvXST6lPr9PV1nLylQ4HYYYh52R oQ3dghqcpU/HKiQnuIS+M3rM/BQ4sYLHNq3CMevtg24A3OVEoGAiGjNacu+tZGl2ax SMS0j8uqzsA4wTJSBOcssS6aJY/vTFoQrR95tzSk= 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.10 168/390] ASoC: wm5102: Fix PM disable depth imbalance in wm5102_probe Date: Mon, 24 Oct 2022 13:29:25 +0200 Message-Id: <20221024113029.863602136@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585979414525598?= X-GMAIL-MSGID: =?utf-8?q?1747585979414525598?= 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 2ed3fa67027d..b7f5e5391fdb 100644 --- a/sound/soc/codecs/wm5102.c +++ b/sound/soc/codecs/wm5102.c @@ -2083,9 +2083,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); @@ -2118,6 +2115,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: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: 9095 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp447771wru; Mon, 24 Oct 2022 06:16:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7aBywu6Q92sH0HVBuHUsG6JPMTc1BWh+mo2FpDVSk/ffAc+LUaqyoL0ZEbn8mtOnJ/EfVd X-Received: by 2002:aa7:d694:0:b0:461:7638:bde5 with SMTP id d20-20020aa7d694000000b004617638bde5mr11737900edr.105.1666617399922; Mon, 24 Oct 2022 06:16:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617399; cv=none; d=google.com; s=arc-20160816; b=Y4iG2xkSZ34VPCW5vVcVcMHqIbF4r6vDeouQv26ZpGM6ZzBNlIPr6idhkfVJO2EA/I mN5m7SKV6sN3acr7sLe/aWHR/NGi6mtsp0ftuJLrCwEdoVkUsaXCrNcCdL3jEGofAakr heqde4EYsJWg46kWe2rFEPPb/gAx9XT66z6DWQairrn0ZtLoe640rKyTH+yDpqQ1FMY1 p3EAS9hwxKxf6930bHOUb4hAe5CB+iQd1uE4p0qZCn7aqWnzL0DDizjz/OxmBtgu3uAa cMOe31eYUQgiS0K+tLDRmudxqQdZI7OIZye36cSFpZxaXSIyPhwXXiya+nKoh45RQDKQ qiyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jovH2cplQjJK8QwMgXDY9Qx5eVy7RkQ6rlIuBVRRFvY=; b=VOLE44ispCS2lwTLQqPbDWLZKBVQvxHkV6CsU6IYnsWnejr/NqHk/Diyh96SUj2wRa ALg1tFXHu2mZEy45PkZZS3+uSVqM+luRLOv2jFlsgjDwKbuokw4t5U/FuffMeGrNZeWv uQmJFh7DHhcHOp399Gin3enKkNS/Y77DFfAhRW7CUPZ4Ow3aINpAQ4fC8GtxeH+3TGwx PFlivu+wVtNlpNN18NjzY+6UaLoE23OleBSohVI3+tQ09e5Or9RjFi8eiU4Qs2bOMznV Wmo5Xf92AKp+R182iZ8e099BJubB2LA8w1Tf7J7xJ8AbjMz24iaoSPjecL2utKYlTYuN jSMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JT3boooO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sd41-20020a1709076e2900b0078d4962a32asi28230074ejc.961.2022.10.24.06.16.14; Mon, 24 Oct 2022 06:16: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=JT3boooO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235813AbiJXNNS (ORCPT + 99 others); Mon, 24 Oct 2022 09:13:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235353AbiJXNKh (ORCPT ); Mon, 24 Oct 2022 09:10:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91680DA4; Mon, 24 Oct 2022 05:24: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 5B0B06127C; Mon, 24 Oct 2022 12:23:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BDD4C433D6; Mon, 24 Oct 2022 12:23:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614197; bh=kVYnYhh9JRzFzLRUaA0/sGnwR/dH2+qLzEM1yWuH8Sc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JT3boooOwkwb1wXCk6CsD57FTwdzSOBtCuO30bQ73+E6IAhv+S9C/gTB5ievD6Ql1 YjNsH8PSeaM+yQ3c7v3IkrSnKoHHK2hn/wmbwf3msjAe5UKkVNuXS1Zj4+S1UVnTZB woLhcNWNrj11VhZECsEezV+YRnqmnHik4vcAQelI= 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.10 169/390] ASoC: mt6660: Fix PM disable depth imbalance in mt6660_i2c_probe Date: Mon, 24 Oct 2022 13:29:26 +0200 Message-Id: <20221024113029.905120363@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747575006712427598?= X-GMAIL-MSGID: =?utf-8?q?1747575006712427598?= From: Zhang Qilong [ Upstream commit b73f11e895e140537e7f8c7251211ccd3ce0782b ] The pm_runtime_enable will increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced according to context. We fix it by moving pm_runtime_enable to the endding of mt6660_i2c_probe. Fixes:f289e55c6eeb4 ("ASoC: Add MediaTek MT6660 Speaker Amp Driver") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20220928160116.125020-5-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/mt6660.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/mt6660.c b/sound/soc/codecs/mt6660.c index d1797003c83d..e18a58868273 100644 --- a/sound/soc/codecs/mt6660.c +++ b/sound/soc/codecs/mt6660.c @@ -504,13 +504,17 @@ static int mt6660_i2c_probe(struct i2c_client *client, dev_err(chip->dev, "read chip revision fail\n"); goto probe_fail; } - pm_runtime_set_active(chip->dev); - pm_runtime_enable(chip->dev); ret = devm_snd_soc_register_component(chip->dev, &mt6660_component_driver, &mt6660_codec_dai, 1); + if (!ret) { + pm_runtime_set_active(chip->dev); + pm_runtime_enable(chip->dev); + } + return ret; + probe_fail: _mt6660_chip_power_on(chip, 0); mutex_destroy(&chip->io_lock); From patchwork 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: 9233 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp460904wru; Mon, 24 Oct 2022 06:42:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM72P0pWOdvkvDhoIQsR6LK54aePmG4l51r4EEq6xwQl3UUoVcnZexTyz9n+GQRU+a4Opkbq X-Received: by 2002:a17:902:e545:b0:184:2f27:b34 with SMTP id n5-20020a170902e54500b001842f270b34mr33121416plf.15.1666618962484; Mon, 24 Oct 2022 06:42:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618962; cv=none; d=google.com; s=arc-20160816; b=ooUs172uEkTR6akxhQ6cUGO4vIkwEQL6GBx4WWZnNfOOAF2mtzXSziB4q6bdzHb7sB 3Y7kDOubU3YODkDARZ2CYJGnpVt43i25kvs+ep05fVFlrSy7/COefiXiSIAmdabLq5cf xJRl7U1B4h5xgVbbLiLxmAb1+/YoRPxYHoPngoM0l5XvJhzDkCwzo2GTM5/gBadBR+un R9sJ3RpANn6M6yb+W4zTYwO1mHtLPWhe8PqviZJdKWJzgzvbpIBec1ZkUW+cdgx00YPN KnAPptGr4xYjZHOvdwqSTpeEsGQuaUVUF+IEjFeUpUvCHSiWzSonXeoVRRAp4YzRdPD1 2ASg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NQsu8n9v3oqeIq85Fzm368L1Bcb27xCz9gvyPy5rNJ8=; b=tMAb3Dg3LIZYZmq9ZmnZCVD0twdwU7VeSTG3xo6PDgM5cflL8W1icx6JL2IZgY3rgm xFBR84JbWOBDexOgvkt9AXtlxUzXSr7Qg2HFykCdZD/bI4jr2xxjFO2liKfAa/2xr+81 SbEws+qLQmtHMDsFY8C0FHJzg2GB21LbmKLKyOndjys47wJeY1pl/9Gl7Bk4zBwKg4CC ib4nfcxo/VNJtTJhplF/hgQUP+MQ20te3y7UkPTZxs9V79E/5LK1q4Xd6uxfTitf1n0X wCOoMDyc6bGrp0A8MUxwZFFWcZawhKG5n2sQToluPwUmcpA01U7BBcCqDqP77MYbgqQ6 15ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t33qF3mG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oj17-20020a17090b4d9100b002132abf9ad6si1030814pjb.148.2022.10.24.06.42.22; Mon, 24 Oct 2022 06: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=t33qF3mG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236174AbiJXNe6 (ORCPT + 99 others); Mon, 24 Oct 2022 09:34:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236270AbiJXNaS (ORCPT ); Mon, 24 Oct 2022 09:30: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 D7D17ACA1C; Mon, 24 Oct 2022 05:33: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 F008D612B7; Mon, 24 Oct 2022 12:23:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A404C433C1; Mon, 24 Oct 2022 12:23:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614200; bh=bcTlmWggIuPQ8HO7zwA8/78P0DFAZJDywhOf4ZdCjKU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t33qF3mGwEviFK6jDzmKW+lnq1xgL99vYkTYNQo4S1WffoqEchwhJxSN3a9gj5L5q JcO76opZx/t8SFR4ioJWxtQQxXhpnsWGpTtCfcKsdscUJM87eC6625XZTUgeu+cVzo rMwbEq9tDiSD8wwE4vCOg6hZq6YlhSCYcyYt9Fj0= 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.10 170/390] ALSA: hda/hdmi: Dont skip notification handling during PM operation Date: Mon, 24 Oct 2022 13:29:27 +0200 Message-Id: <20221024113029.943996740@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576645264582213?= X-GMAIL-MSGID: =?utf-8?q?1747576645264582213?= 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 c3fcf478037f..b1c57c65f6cd 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -2684,9 +2684,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); } @@ -2870,9 +2867,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: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: 9100 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456038wru; Mon, 24 Oct 2022 06:33:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM762v6ja8CRDXdZlxakzmrJbG1XWePmekhqb1u35ESITvDqX3CdUzkte1wHk5d0jJbC57m0 X-Received: by 2002:a05:6402:35cc:b0:45d:4a39:2a43 with SMTP id z12-20020a05640235cc00b0045d4a392a43mr31039159edc.304.1666618406310; Mon, 24 Oct 2022 06:33:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618406; cv=none; d=google.com; s=arc-20160816; b=r339jZlynl0bnubnoZMM61JrwLqkwu5D8JygwqfGAkGVZnIln6MD5oWp9SR04b8CiG fPFSrMFuzXXJw5sFTIdOnNJ7cMskRJY83d6aozOIhvswkOJLuNTbpLTlnPQ7cd2AoJO3 JLzFHUtBJ4Hyr3oC8sclvIWs0YA6LyumMrocSqst2+9c2dyYWOI/NKZyqvZ9pKo9hRQY +5n4zs7jkQU78tDenzTpqr171NfrgBJfmhDYxClvcNXr4+PEHqFaUSRDEOb0g57ENFp5 f1gS0BMjNFnXLo1kwSydQ3vI6/WfiSHzTY+e3QJtJa1g07fLrkd7hcmRgmi15kyax+QV 4awg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9wnvCFcEnXfxS/Ww8opicu5NtSeKcQpHL12SMGgvldg=; b=E77AzJbxdFClQPa7AGHVF/3flpgr0Vnvab6ihRcRLixttZdTl6pkRA97lQdN3Tckhf egZqZdShDUhHAnu9USDu6K6QGjELIajGSJQs9IpkPp9NZA++zDNi30DyHJ3tupUyjpNB ymA9Dc4fVQdZMCk18WZyNVpo6aU6Al0BEqQZyuGNg9cV70HmTHzwZlAAVHZ+H5pn7VGA rzDYYQIYeexBh7gXYVm64VUnvmgicENy8WTKb1fiP7g1pavB1GmmTrJD5JzcR1Ij0yGQ k+0nZyyNhaTAHzG3+3E6MwsvIuKII2lsxqA5MBOJsro9nb1+e5NNcS2Uul2JhtZ2X/lf hOPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XXu7WwR6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw5-20020a1709066a0500b00787aba35b7asi26344942ejc.102.2022.10.24.06.32.59; Mon, 24 Oct 2022 06:33:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XXu7WwR6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235834AbiJXNNw (ORCPT + 99 others); Mon, 24 Oct 2022 09:13:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235720AbiJXNM3 (ORCPT ); Mon, 24 Oct 2022 09:12: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 7E94C11C26; Mon, 24 Oct 2022 05:24: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 94942612A1; Mon, 24 Oct 2022 12:23:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A07AAC433C1; Mon, 24 Oct 2022 12:23:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614203; bh=/trz6K8V8Y183basi795y1i/HvhwO6Kujiip5x0dDp4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XXu7WwR63TmnFiuBmoiq+aMGU3TdHio9w4mBP7Cu67BHpakZfTjPDodhNtGtS1NLS a7nlG16JAqz4Bl1MjrunbmD8XOBi/0LIwoHrLyLLaKb+ujRvs4HFUzgTixiUvhCv4u RS9XPpXoABwgvb9hqXSS4AMIXhkuxHwH5V3dCCSY= 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.10 171/390] memory: pl353-smc: Fix refcount leak bug in pl353_smc_probe() Date: Mon, 24 Oct 2022 13:29:28 +0200 Message-Id: <20221024113029.994815067@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576062093755878?= X-GMAIL-MSGID: =?utf-8?q?1747576062093755878?= 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 b0b251bb207f..1a6964f1ba6a 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: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: 9144 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457526wru; Mon, 24 Oct 2022 06:36:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5QRPXPvqizziZS+iuRy3Diq4TrQq3lWj6abWx5ZnxjhQEwjQrmC/f1ndVZlmc/Pc83PXEL X-Received: by 2002:a17:90b:3e83:b0:212:de17:952c with SMTP id rj3-20020a17090b3e8300b00212de17952cmr15184567pjb.102.1666618568698; Mon, 24 Oct 2022 06:36:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618568; cv=none; d=google.com; s=arc-20160816; b=JSdF9cHkUOal9/C3A7/BqR1EovS+5GYgz19Pwf5ezXfqwwjfu7lnMDVd76x9Ii3mFT TuLuxONHBJJiFVl8ZKgnnJ1xRXv91WE1qnvtycySUYGlXC7ewB50ZXwSQfAIL3ENHCot di4uf5XSHc2JD9ya+g4Up3OVr6TMbmSVlzDzJeB3zi/h6kRAE/IIwko086MedK5xAIL+ u7NUuP+oSA4KCPtNxV4tC6xqrCizeXAEzAHN0PqxtX26LN4Ng8uPyreYlyDHxmJRatWb xiUUQxKsTPAgW/i/8MMcgCBJUKg5E3DObH7eXnPi6GbEvNi4HlRoa0/3vJVo1ogCfA/R WkIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=41Y6EdhkH8V7rf9AfmNpUAgoyZcnGmOch8y50OHZNes=; b=KPuE8mlxbDRkMDGnW4N4Il69zJKqIQTqSAvB8/d7h9MYzgksC1bdzIjaqz2KEqitCP TK+/WuTocJAluyuWZGVhJTGGFaYItoTF1KM+NSEs2N/lnBYoRPCGfpEtuxRWiE99EXCt 8GnFNJZQcVZJFY64YBXfCEGPLpJpJEUcSLw009opYtiTCMV6xXMV1u3wcreKOIvpTPVj QKmupK/pppyZ24sBNqQ+d60hwd2+R8JqwfZtD1E1rCE4e7/yggU3F5patD5BjWnLnw9b dz8+E1qJTemKplcU0rf+RcTocHcygXJdYzc1XlXHmQ0oxVduKxGhid2D79YgAcuECdy1 5loA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Kvnnf8PN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v20-20020a170902f0d400b00186a98b58d8si2945212pla.134.2022.10.24.06.35.41; Mon, 24 Oct 2022 06:36: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=Kvnnf8PN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235706AbiJXNNt (ORCPT + 99 others); Mon, 24 Oct 2022 09:13:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235697AbiJXNMX (ORCPT ); Mon, 24 Oct 2022 09:12:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EA2F11C2A; Mon, 24 Oct 2022 05:24: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 2DD79611B0; Mon, 24 Oct 2022 12:23:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FA54C433D6; Mon, 24 Oct 2022 12:23:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614205; bh=nggt5QNHZ4QL3rbqvTQdzEH1qGPeqU7CytS2iNQBeXI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kvnnf8PN2Cu8GKJTWUiy3eKrlipIXBXHU/olsbl56go+CFP6An5hOnPFAD40Q+cpS LsOwfTffoqJgQxsiCSquEZjNk6MrwF09P3gLlxMSJAM0yTXfeLPqY1KKjITSbO0PKT BkmusSrkIZ6BSX4HLt3pGqeOzw86ziF5lSx/IVcA= 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.10 172/390] memory: of: Fix refcount leak bug in of_get_ddr_timings() Date: Mon, 24 Oct 2022 13:29:29 +0200 Message-Id: <20221024113030.034732557@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576232083022905?= X-GMAIL-MSGID: =?utf-8?q?1747576232083022905?= 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 d9f5437d3bce..d0a80aefdea8 100644 --- a/drivers/memory/of_memory.c +++ b/drivers/memory/of_memory.c @@ -134,6 +134,7 @@ const struct lpddr2_timings *of_get_ddr_timings(struct device_node *np_ddr, for_each_child_of_node(np_ddr, np_tim) { if (of_device_is_compatible(np_tim, tim_compat)) { if (of_do_get_timings(np_tim, &timings[i])) { + of_node_put(np_tim); devm_kfree(dev, timings); goto default_timings; } From patchwork 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: 9285 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp463259wru; Mon, 24 Oct 2022 06:47:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6xkJ3xEZmN1TsqE2D8FEDUVNWeEvGRWsxVYJhoHq/FemV87B2XbvIqzSeU3LI4wgvjdUC3 X-Received: by 2002:a05:6402:d06:b0:45a:3ac6:ad26 with SMTP id eb6-20020a0564020d0600b0045a3ac6ad26mr31108126edb.195.1666619249707; Mon, 24 Oct 2022 06:47:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619249; cv=none; d=google.com; s=arc-20160816; b=qR+JPriWrnZ1lgTE8cD6CtQDRoSj1yZg7Kn0BTcZuYWku3HlmYIM9lBWZgvxi8aEhL p/I6DP/d6/yK2U+TIW+LUVXGOWl3J1Iv6u5I1gG8B0QvjSJZ77FKN3IBv+Xs3f5rP3Oc a0RMiMBWpghwN744lURBUXwERXSqAbAP2gDYlu2MX5YD7fAKr0APZB3n34Q2Fr8l+vmo x3SKbNSEC79XZlgiTYGCTj2mPtpzDwciQjLxrUY131SeokNKovmixmq3jos3a+tLX1eV MfJ/qBwhTRlUCkYf31D1bcldO6qxutCKHwUfNYs5d/Dmu+KvZk8g8aGGcMzFImPQwPb9 RNow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/4n7HZjbFgZDgQTf2QXX5TYweo94YCwGyMrBy/uDx0s=; b=rGs8KlOMsEKUJGUnf9Fc0xhmOTG5XUnXo8j2aCkqUcyqq1ElQqoWSpqqzPi0n1sbG2 +Tytqm5TcMwmA5pzfU9xZ7amRe4FCvwN/byev2tDz10xSSm7ZAwVmxF9s/34+9HuUaJ7 /htSTNovJd38iDASiHaWGnmGaONHmliPXzgJKL4BbxJ/dHUkVaPwwoDuowY8J9+aZwdN UHnMtHTfNBZ4vBKWZQ84+a7Hd8zukPgd+EybXJ5VCk4pAdaM6qQHk+SuSXpnDUaatn9a TDmugVv7St5QEqmNIuEQHLie960/k2hUwSdJkZ5MDJpOKmNy+1CCYndALlLo99B7xGXy FXuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ONAPVpSh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qk10-20020a1709077f8a00b0078d112eaf80si29649511ejc.86.2022.10.24.06.47.04; Mon, 24 Oct 2022 06:47: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=ONAPVpSh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236175AbiJXNpY (ORCPT + 99 others); Mon, 24 Oct 2022 09:45:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237016AbiJXNlz (ORCPT ); Mon, 24 Oct 2022 09:41:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9ACAC6167; Mon, 24 Oct 2022 05:39: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 C3AA0612CD; Mon, 24 Oct 2022 12:23:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4B6DC433C1; Mon, 24 Oct 2022 12:23:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614208; bh=ImaiAK7jHhbV8YcUYAVGJfAjkWTkK3o5h2uJ0SiwaWk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ONAPVpSh+izPYllsZdvE3G74Et3juO36OQ9jvROj8dcZwYVDUGoRjob124gByEKBs dp23OVfdyrZeMWHP5FfGOGO1e7hDqXsEnxHIiv2J8edXvhJiIRwOPJDknLFFVel4ms qEvWfvv4DV9OMFEu+3osv59zbjoNiEo0DBdf1xGA= 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.10 173/390] memory: of: Fix refcount leak bug in of_lpddr3_get_ddr_timings() Date: Mon, 24 Oct 2022 13:29:30 +0200 Message-Id: <20221024113030.073561904@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576946554115240?= X-GMAIL-MSGID: =?utf-8?q?1747576946554115240?= From: Liang He [ Upstream commit 48af14fb0eaa63d9aa68f59fb0b205ec55a95636 ] We should add the of_node_put() when breaking out of for_each_child_of_node() as it will automatically increase and decrease the refcount. Fixes: 976897dd96db ("memory: Extend of_memory with LPDDR3 support") Signed-off-by: Liang He Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220719085640.1210583-2-windhl@126.com Signed-off-by: Sasha Levin --- drivers/memory/of_memory.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/memory/of_memory.c b/drivers/memory/of_memory.c index d0a80aefdea8..1791614f324b 100644 --- a/drivers/memory/of_memory.c +++ b/drivers/memory/of_memory.c @@ -283,6 +283,7 @@ const struct lpddr3_timings if (of_device_is_compatible(np_tim, tim_compat)) { if (of_lpddr3_do_get_timings(np_tim, &timings[i])) { devm_kfree(dev, timings); + of_node_put(np_tim); goto default_timings; } i++; From patchwork 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: 9122 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456298wru; Mon, 24 Oct 2022 06:33:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM76TH4fkV5ve2KDCh7/hKRAwWHkrJxaI9mZkbJLQ53r7UxAc2segczd0FCQcypg67zQv5MG X-Received: by 2002:a17:902:cccc:b0:178:a9b3:43e6 with SMTP id z12-20020a170902cccc00b00178a9b343e6mr32957216ple.92.1666618437594; Mon, 24 Oct 2022 06:33:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618437; cv=none; d=google.com; s=arc-20160816; b=nJCckrinDy56zy0QU5A9KQtQViG+Cd0TNckdqPeKo19V+IGmXIRAdSsFTcBbo/ZuGp 7mZW4H1yGNZWqjBlPsUdoetGs+6MakgZ/lTdVe2B6EfVBELiLMiGDYkIGJOG7Z1M/gWA 0ktNrmTvQ21tKSdx1Lo2FaGJnF68yqYm6uJEiiI17oIISOFTh2DRlLSE5h02W9WojUwD lsofv5V6JXM2sb1bKJwj9jhIbKDmNmK772AtkPDTFsySZ/bqT1gF6lsCQnH38SAFJrL6 TLWWHLbixRrCMaBKg/A8bwUZbMziwHfLFO0JwwEt/wZCoLC0fdmAftx6qjRaHhT+qdQg /Mwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=LX4ai8HVBdiroKXwkKLqjGLfYATfjFqjMHsDT1aMvcmQ7mCTpX4FQEN+xekmQlnaJA 78S8oB4Stqafa04R+xPv7NrbpNWKHqUzqueuNAri1G5vkwGLsI+NXUYyXCZWkmI0u1lg Ri1J29X3+HuOYhPFdUAR3cxJMiJaPIztCg1Qvej7Z1jN2367yohK2fxePik18zizOFux bqI7cPH+cS65D808qdcnaP835OteJfJicrRU6YNxoJ/nqvtUbz8197HKF5WIXO2RWyPG +PExftY+inzyNDlCiarQzzwe4f+RjwQPPANQAoFZ8kNxKoVho1vVBTp6Ce2RQ9seih79 OvVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0pmMUtfw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h15-20020a056a00218f00b005698856bb2bsi15909988pfi.330.2022.10.24.06.33.39; Mon, 24 Oct 2022 06:33: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=0pmMUtfw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231665AbiJXNUq (ORCPT + 99 others); Mon, 24 Oct 2022 09:20:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231362AbiJXNSR (ORCPT ); Mon, 24 Oct 2022 09:18:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D295F2FFFE; Mon, 24 Oct 2022 05:26:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5F25061268; Mon, 24 Oct 2022 12:23:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73D68C433C1; Mon, 24 Oct 2022 12:23:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614210; bh=Uhl66iM0KuPXimYo3oJQbWlMZPTK9qOjxrbDCHLHOMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0pmMUtfwt8v8Riu+/xzP00baZEyhAxcCRBYVdJk3I5zQqGc1Zu7ay0zV9fyu/ikxY sz9FtMctD5Jv6yyj7xgGJZlxx9e4enPFlmi08H7iu9hFwhNXHBPs1qtXfcouQBIokx wacVbHq9SNqiK8NDLz6hyhr/7LCeMaLbhWXkLUzE= 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.10 174/390] soc: qcom: smsm: Fix refcount leak bugs in qcom_smsm_probe() Date: Mon, 24 Oct 2022 13:29:31 +0200 Message-Id: <20221024113030.123651577@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576094504052528?= X-GMAIL-MSGID: =?utf-8?q?1747576094504052528?= 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: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: 10204 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp642197wru; Mon, 24 Oct 2022 13:37:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Qh1tnlSiOd8ExbZgpL9mLa4+n6BGuLxYx9+pz9Q51dtlgJ4JjzdSi7d02BAmKncQ7LC5M X-Received: by 2002:a63:e04:0:b0:46b:2bef:338c with SMTP id d4-20020a630e04000000b0046b2bef338cmr29311314pgl.206.1666643863429; Mon, 24 Oct 2022 13:37:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643863; cv=none; d=google.com; s=arc-20160816; b=Ubw7uaubog+t+KrkunBknFarAOpp76SK7zBvpwrjygEMyZHR1IjRbqJ1QAwD56Fm7X hafOrF4VD5Dy+9uS/ZYhZCR/2TD8gumc7zKuTewZDQZe6V7j3bHhxaX0znxW59ttz5nZ KmGw9roN2BssdyoYpoK/uM6kOhP8Z3qpdvhs6Hjq5AhfYS9GKH1mnVsfPskuN3F89zB3 2oj4Ne07h6/f+Ho+vCFT5MtcU8PiurGPvnuj+VxDF2rRYPj6j4YuseX07NOKXpLD0jP5 N2QRrlVjLTrw6KzXnrDYd8IMVsbDurINBHpOW8urTOCEZG9LV8JagkvMPKhSv0TN5ic2 u/vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=GXaT4OwMubHdNzk16rgPBQyir4ixkegUWBtSosF9GJmuHfGqJRaOpE0bEvAauDSJ7A 9Kli9K9hyWL1BfF46+SoovkYRG9GCAf3GO92YP3jgxm5yO01y9vIY6XQXNur0qPSK9mh b7dlwFEA0zYyHG2f1af9XydUA/7kzjgQnBMW0ECojEBbi9agKB6uX8TWcqH9y+7nE4kK ZnE0IT1krfbkByCxAUri3hX71yHeajJckmkyOlu0TlN1WhdYXJZYp6m2OJ928ivBmJV9 ug5slYLWfkuspwnyQwn4/qhBwgdfKzG0zGNqfILiWGLpk92eaMRBYa3tmXlMoAkYcI8E iYyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Fqm8KOBt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w18-20020a170902e89200b001769e71398csi623345plg.340.2022.10.24.13.37.29; Mon, 24 Oct 2022 13:37: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=Fqm8KOBt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230329AbiJXUcv (ORCPT + 99 others); Mon, 24 Oct 2022 16:32:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234244AbiJXUbx (ORCPT ); Mon, 24 Oct 2022 16:31:53 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF5E4237C9; Mon, 24 Oct 2022 11:43:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 36385CE13C5; Mon, 24 Oct 2022 12:23:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21C67C433C1; Mon, 24 Oct 2022 12:23:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614213; bh=kQWJbAtvZifP1shAjObse3DkaoIE1hj0tuT6mBsGAMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fqm8KOBtx2LXS4+xuT+gXkSFLPPanEkLw1HZjEVhjMa+452fmxSJtmcwXImpqHbkY 7jRY0lD/3A1vR3vocCpdsX7ThVYvbWABivFbQxY3YVRpJQb4Wmyfuc+AexqlBr3y8w GDccWbn8J+JV2xkwjjYx64sksiOLiZjlN66Kp+ZI= 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.10 175/390] soc: qcom: smem_state: Add refcounting for the state->of_node Date: Mon, 24 Oct 2022 13:29:32 +0200 Message-Id: <20221024113030.171421867@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602755657125077?= X-GMAIL-MSGID: =?utf-8?q?1747602755657125077?= 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:29:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9904 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp574332wru; Mon, 24 Oct 2022 10:40:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4stRWN+Zp0Y6KryzjG1hseZmFNI828CwUrteO8UsVwZJ7eckgUABvLoGzGPzhxOhaIdPLX X-Received: by 2002:a17:902:b942:b0:178:be25:203f with SMTP id h2-20020a170902b94200b00178be25203fmr35092082pls.101.1666633221060; Mon, 24 Oct 2022 10:40:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666633221; cv=none; d=google.com; s=arc-20160816; b=bEg9PR3oktlyBqrtE2f8nLDJEJsILsfV1hMB2G63SYrAKZSb2UNwNB3lc/5JIJS1sC KnjhMDYuHzlNIUaECBHFS/vw6NlI8VeTbZEJPtBresPDwxe0B/TtNxEZE62zAUaEn3pi IcBH0rnIgOPWY0EME2qql+Q/XzK/e0avk1lNEeEU6zskDIVC/s1wOYv/Xu7vM6T1/jMF xtFVayWjCZaUOG1vqGpUPygf2VtiwIDjnOYMfAVH5QE53CQWf5TjdSnhLRpUNZOmt3V1 oTjApImlxm5HaMO14VW0AU/PMuxH8fTY+I2er0M3nqUWx49p05blgOSf+Wy/XQNCBu/G qGZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=woqpVQH29QxyNCAUSaLIMQlEIrzHUdMzi1IuDXY5GgeLhAnHMXH/QyxuVh3kgRsoDi FtSpN6GjSpkGze6XsQ4JGjF5kRX7EACxhdmaE8c0bXI5gynY+fP50kcEmmvulxfxp9jK 2I6dZg5K0eVqmPxLelUdYm70uF3NgULSP0ZT8Yr7AeMTIg81AmomaKICdQYG4EC+1hSG i+8SoEYf5wWJimm9vtHDfsUJYRLaolUHwHdyuVXdvvn06Geeevu1y+kb9J5jfzf4/jSm PvmKybV4Cz8FGs3XQygcLtXEaBX24S6bi/JudyAH+T1Th+S7l6mmrDYicYuOI74PsUP4 qSWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ax9WYOH5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cj17-20020a056a00299100b00563960fdb21si273223pfb.260.2022.10.24.10.40.08; Mon, 24 Oct 2022 10:40: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=Ax9WYOH5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231605AbiJXRhu (ORCPT + 99 others); Mon, 24 Oct 2022 13:37:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233764AbiJXRhd (ORCPT ); Mon, 24 Oct 2022 13:37: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 F0A3512636; Mon, 24 Oct 2022 09:12: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 03165B815E8; Mon, 24 Oct 2022 12:23:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D6F1C433D6; Mon, 24 Oct 2022 12:23:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614218; bh=cHT/tctzQJbGiXiQn4s+uUUWvv1Z72ev5clpduBCXxw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ax9WYOH5Pb1Bm2oyEO9cWUhNXrSJra8srf1BITPHvr509X9XTV6hQDI2XZ+IqToB/ iCPHVcvwe4ppnoe3Isz1IH0hbuHVtLe63RjoVJ0sxIN1rVbQOwDVU5j+Kgm4h2Ua1M 6uJZM9IsM/sp0g3tYneIQMvdA2gC7SkEVPG5Pw0E= 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.10 176/390] ARM: dts: turris-omnia: Fix mpp26 pin name and comment Date: Mon, 24 Oct 2022 13:29:33 +0200 Message-Id: <20221024113030.221691548@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747591596366476669?= X-GMAIL-MSGID: =?utf-8?q?1747591596366476669?= 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: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: 9105 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456087wru; Mon, 24 Oct 2022 06:33:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Rfh1BBdVi/exSlrTUOUwn0QbAxcUgNYQ7gm9fA+8Q9Qp1LB3BYGEszq0nk+QNieXYhT8o X-Received: by 2002:a05:6402:2947:b0:451:32a:2222 with SMTP id ed7-20020a056402294700b00451032a2222mr30421788edb.376.1666618413244; 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=ZqfJT70QwuBzZ4Mg09LBwT3TyLyy+npplGsw8iMlqB8YZkd+5bcLV5lESGb9j3vmVR MgdY3m2Nk4W6Y1MZnDubIs8DJrPZYy5S58udPqqR3xrZ/iJ7m0N+Z5lGUv3JGDC7MvEe DKPV35DxSgMZZoPBuDaMcOdjR2VX6iYoAwKssqsojhDxlk98mngLy5N2ikiEJdrJTvaj HbJo5RXdLgOypzE3jbA2t02Av8V8tDEn/iOCBEntLbnx3kmKfOHnDprJQCdTxL8NAER5 1w6FmuT1Lnc6EIJl6DEMsPm4b9CZFnshPoX5549QdPu5kSDajr9cyHvGviRG0xJa1lGQ gpFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=GQ/aWVCl0pKhfB+WyUtn4mFDfUdYmPXWjJ1tcLUX2VxEH4NDaC1qAralKznN9ph+D1 nmrSg/Ea1WY8NmvJScO3RR7+MSFTmNV5j2fyTHn9OkspwW93pxHxuSLmwrINC3/JDzC2 uOTlzlU5jfHOLNDa3CFr584MkMxBLS6GQCf+fphXIZ09P9k95ZCiV123tPGect6ZfINN wYTA8gd9ott4zr0G+zSVMm9mlwL4OMXvmDgtScKyJ46iZVQGZ0bNUpwgW4UJ04wpOaQr /mUOdZZYRVRy9hDjyAV020LjwkQ+Ie7VAXsJrEvu+r8hHtfFEEgz5hgSXuIdjkci7hA7 b2BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=G1RMljIe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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.33.08; 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=G1RMljIe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235703AbiJXNPJ (ORCPT + 99 others); Mon, 24 Oct 2022 09:15:09 -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 S235595AbiJXNNV (ORCPT ); Mon, 24 Oct 2022 09:13:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32AFD2B257; Mon, 24 Oct 2022 05:24: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 F0091612F0; Mon, 24 Oct 2022 12:23:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09208C433C1; Mon, 24 Oct 2022 12:23:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614221; bh=BBEZSL/kEaLKT0nn3CDJDaoaCe8MaFX+1kU7JZ+z9Ck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G1RMljIeVAiHdhKr+ZvhANY/WKCXvl884UtyaltgRZxbnFx5Rh2DOl1jYGmw2CXqL q+Vx/gU+s0NeF2RVLm9V3J8zj13HFjUfokJjPs1oIKTFbdvCLItmZdfS/sZTwYAiwp VgRjsk9B9spsfo1I5rkM8w5Tn/lVDjJcQUrJ6zhw= 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.10 177/390] ARM: dts: kirkwood: lsxl: fix serial line Date: Mon, 24 Oct 2022 13:29:34 +0200 Message-Id: <20221024113030.271848890@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576069623706072?= X-GMAIL-MSGID: =?utf-8?q?1747576069623706072?= 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: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: 9099 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456026wru; Mon, 24 Oct 2022 06:33:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5QfCAjytMVs7WCOFTjDr1ky9JZHE2NhAKxllAlgMtn0+6KSbIHjQAh2eBx2gO3uxx8ca8A X-Received: by 2002:a17:902:e750:b0:17f:71fa:d695 with SMTP id p16-20020a170902e75000b0017f71fad695mr33666057plf.105.1666618405461; Mon, 24 Oct 2022 06:33:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618405; cv=none; d=google.com; s=arc-20160816; b=UbPMXz+tQTv6ty2lTpi8IrGs+1POvZEgJ9FKzHP5uVYEosU0+UBlRJIUKt3md4Nmes mqCYzn+1KlM1AUolHU8TzYzOLjqYceYY+ay3+z79lUlC+fQNmDhBHgfK2JTdP8NM51GQ 3k2ei3qpHBwdmcM4UMo5EBnc9elX2o1YIucSwzX/D/lRq0py4BWnuy5sWS6Yda9DdiGz D0ZlmcR3Noj8cezydxrTH4gl6avN4qrTsDTkKF2ehFvSZkKGq2odZ3dhcRGBENGHpd6Z nwuM+7PUhIOa61TOTyfApeWLxQaSoqPMGIDmXL9pAMUFCcZJG3DCzb8wAwEK07953jgM qjkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=JHXwiRmiLVTCZUyPexWYP/k0DhYRHn+yIh1DiP9axkbBUaqDWsDjPSJ2/nNAT43EP3 xbHp0QVOX7MzwQ3jitldjRl9CSkP9EiVLsqrET1mFzGwNAja7qb9OZxDQPg4oP6nSOKF K8uQLIlB1eNlj0LYSnkp/jR+FnwQOPvaaLdhEbYUPKn4+8aFawUXAMGqsz9nn0UNRTrr cPXOhP0hhwgDU+fRg/HR7yik1rQ8iE90I1M+Rkd4ea+lCt2sXeHpbun1FSRCcrkoXASQ f+jA4HDzCRnnZGeL4XoZ3aa7GdpAhvMHUVR+Oy5H9w4IzUhDTv3C2ZfEIN3QlYn8kldZ fC7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=u11dmuJr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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.33.08; Mon, 24 Oct 2022 06:33: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=u11dmuJr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232392AbiJXNPR (ORCPT + 99 others); Mon, 24 Oct 2022 09:15:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235448AbiJXNNd (ORCPT ); Mon, 24 Oct 2022 09:13: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 519662CC87; Mon, 24 Oct 2022 05:24: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 8AA4961017; Mon, 24 Oct 2022 12:23:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1FD7C433D6; Mon, 24 Oct 2022 12:23:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614224; bh=RLkQdPDMRCOU/IECOAC2hHaLhoeqjEyfi9vzRWGTaUE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u11dmuJrTqz5oNAZ6Q/kdRRx8573hF8+qe+JfZ/jv1OlcmihNgYoaNI3GC7iUkEjV PJ639SGNmzDjrHn+tkGHdlGIq7Ve3ROprJMvcTkddaZzFRDLvs/hKzFrDkdOqoAN50 /P/kHU+u9/5AKnfWSy7B18OUFvrbkboPeW2WoOcQ= 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.10 178/390] ARM: dts: kirkwood: lsxl: remove first ethernet port Date: Mon, 24 Oct 2022 13:29:35 +0200 Message-Id: <20221024113030.320621123@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576061349777827?= X-GMAIL-MSGID: =?utf-8?q?1747576061349777827?= 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: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: 10156 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp640048wru; Mon, 24 Oct 2022 13:31:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7pr8Lf4wgqzEww67M98hjczAqLsOtov7kk2bTg9awyvXt20Zgb4pCXuZ5gaihODFFj0Y4v X-Received: by 2002:a17:907:6296:b0:787:d066:9fcf with SMTP id nd22-20020a170907629600b00787d0669fcfmr27832738ejc.692.1666643499604; Mon, 24 Oct 2022 13:31:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643499; cv=none; d=google.com; s=arc-20160816; b=NbLSsiKYUt9qvLV0doxL1SWjfoyc+rCPtfNkGFGceQ3WNE02kKEuO1wtY6MMfF1pLn 8YhADp/9Q3FOCpba0vlfE8z3KzKtTYbyHQPm8ddLpjYMmjvWnmjacfUb8DcgLBR7QXNh /997CVIFvgWjHESEjpXOgFrCJylpbGknIKigCFLZOO8yJ8lEzq4mRZAvTRJmnDBOFqzT szREmLCtQByi+qJ5ZBTP7ctbDJPsgGC/JfjESaCI/Jsg4vdLvL6rNXMQXNIczzEjRhTk yMqm9XqLl7bD6fKhAe3zK7L8FPJP7s+gm+6m8zG1CnTc/7YreGr4nz+7r7W9/ilrhYI4 VN+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=ALoRngO0P7/4OlUL/JfOq1jjV7vP318HGQW58XB48jY=; b=eLI5vueR77nvH66dMJcrl9dwuaJis5pz7yUzDXZO14NQ+qGRvZC5GOcEHqn1ax8KhJ 0GpX3WVt/naRTBzWjtQa+kRJ441YJlbDQDdJAHkrkvugV37niCEAPwQLv0E5jwaHeKMQ Ctb1OQiMtprLhZKtMdyuylMnqOD6ITnHuAnbMPSkdMWi3bKYN6MSjAuykYG1023WJMA7 qXQjDcVZa+h3MGz1BTmr4nna7iRcTV9caYhOCtT0PbICeP7Z1ANMWFqR681mM/jR5Wl0 7hsTohyJ9AKcZZwS/Uh8ybj3E1IRPKaeYiy0SOpCGLdUxTkKgaAxjKl6AkefPlwtYlJa 1SLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="IR/CyQ4r"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne27-20020a1709077b9b00b0078341b2e269si826055ejc.886.2022.10.24.13.31.15; Mon, 24 Oct 2022 13:31: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="IR/CyQ4r"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234191AbiJXUUn (ORCPT + 99 others); Mon, 24 Oct 2022 16:20:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234123AbiJXUUP (ORCPT ); Mon, 24 Oct 2022 16:20:15 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F8C88FD40; Mon, 24 Oct 2022 11:36:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 729E6CE13CA; Mon, 24 Oct 2022 12:23:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1DC8BC433D6; Mon, 24 Oct 2022 12:23:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614226; bh=3HHEogK/GgH7Bj0ZbubU+2O46uGu6KFNZBsMl3GyFTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IR/CyQ4r+46rOrS1Sn533A2RdmRo1LZoVFIULmGp/j3WcBV/6RrIOu/I1fl8FqQPY KsGjnTPruX1ZjQVFQOIBQhpdtkOA90UfK+mtT3u4H6OA6p1wf13zL2/XegP2IBWkNo 3anELfSSKydfjdOzNQbWM+knKWloPwxdzECeVSH0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Randy Dunlap , Dan Williams , Ben Widawsky , Jonathan Cameron , linux-ia64@vger.kernel.org, Arnd Bergmann , Keith Mannthey , Andrew Morton , Sasha Levin Subject: [PATCH 5.10 179/390] ia64: export memory_add_physaddr_to_nid to fix cxl build error Date: Mon, 24 Oct 2022 13:29:36 +0200 Message-Id: <20221024113030.363399091@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602374530232195?= X-GMAIL-MSGID: =?utf-8?q?1747602374530232195?= From: Randy Dunlap [ Upstream commit 97c318bfbe84efded246e80428054f300042f110 ] cxl_pmem.ko uses memory_add_physaddr_to_nid() but ia64 does not export it, so this causes a build error: ERROR: modpost: "memory_add_physaddr_to_nid" [drivers/cxl/cxl_pmem.ko] undefined! Fix this by exporting that function. Fixes: 8c2676a5870a ("hot-add-mem x86_64: memory_add_physaddr_to_nid node fixup") Reported-by: kernel test robot Signed-off-by: Randy Dunlap Cc: Dan Williams Cc: Ben Widawsky Cc: Jonathan Cameron Cc: linux-ia64@vger.kernel.org Cc: Arnd Bergmann Cc: Keith Mannthey Cc: Andrew Morton Signed-off-by: Arnd Bergmann Signed-off-by: Sasha Levin --- arch/ia64/mm/numa.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/ia64/mm/numa.c b/arch/ia64/mm/numa.c index f34964271101..6cd002e8163d 100644 --- a/arch/ia64/mm/numa.c +++ b/arch/ia64/mm/numa.c @@ -106,5 +106,6 @@ int memory_add_physaddr_to_nid(u64 addr) return 0; return nid; } +EXPORT_SYMBOL(memory_add_physaddr_to_nid); #endif #endif 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: 9103 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456064wru; Mon, 24 Oct 2022 06:33:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM78nv2rTuJnGbgGkVeW7ZHa67U78MtU3mPKpbKe58beSWFFllecrLwlccLg9fMJb3382Sdo X-Received: by 2002:a17:902:8542:b0:186:75ee:baac with SMTP id d2-20020a170902854200b0018675eebaacmr18485177plo.35.1666618410924; Mon, 24 Oct 2022 06:33:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618410; cv=none; d=google.com; s=arc-20160816; b=noekIvHc9IgK1UqVL4CfJlTLdSFjmlQRfKWzrW5VZfHdVPs/QysO9fJ3L+QQB477YN DMgBonuc+L6lYrHdGH2qBTvi494H6/0hWhv4e9u7rHBUMVIflAKeJ+659NfT1RwFkNsV kdzwIugC6k7M8sIbjOOqi9ZiWuIKlYoPpmcepVomYg/5h+3xWknWaM1mdGhUy0QVLk7m ye6WJ14QfuBxzgsViZH1VOxYkt4sYanbB58isb29fGPXA0Env/BOB9l8Zg+L52JXy3kj Xm+BRwjS5I73jloLe9wzV3hi7n9uL66gv13kjniwkx+F3l0Vl8H6Vr2tYPvyBtX8AgWv MvUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=h6mcr7WyzJ7D+Vdq/X1BWz2DpcG9UrxERsWKBuU4TnE=; b=R0XV70I7f0uyB0uZUnhHpB0es4A/MdLaoXkQc/ufEi4FjRX2CI2kXxG3TFm7GiB/OV egJ/NqPyW977qdLmEdPS3o488l9ZaMmrU6wLiyakdIiFUmbE/DwZMYfLS6JXoMXds23h dV0OIkYc0NN/7J5QLkEPRnY0+2w9/M5KjkLkEqBmGe828EmRg83+P1g2FC9+MGASYI1E pfySAFTJW7aubzs1o/s9h1pFIHNNght0GTR9sWsKU4HZhq8KOBDf8LKCphChJOJsSe8M OZ5UN3gjBLOFmk+LKqwL/NDFm8pARks/GCGxtUWYgGfvJck5g4nrxo8cX1Rk7yRMQPf+ e66Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xHCTHEeY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n9-20020a654889000000b0043c7b0510c1si36548275pgs.841.2022.10.24.06.33.15; Mon, 24 Oct 2022 06:33: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=xHCTHEeY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235665AbiJXNPA (ORCPT + 99 others); Mon, 24 Oct 2022 09:15:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235776AbiJXNM5 (ORCPT ); Mon, 24 Oct 2022 09:12:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80AA82E9CF; Mon, 24 Oct 2022 05:24: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 CD1B0612FD; Mon, 24 Oct 2022 12:23:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF5F3C433D6; Mon, 24 Oct 2022 12:23:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614229; bh=HQosdGr41cp0NFgCCjWe9LaRMBUwVhJBGCi8A5OeLws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xHCTHEeYCYSdQWKdsp/ZyRs00pGwC69xOxe237sOvVyMAXhKyuohLLRGcvk+uJo1d r8VHcTIOd24vrlQ9kOe77oBBtEUCL3f+i3xSU9awekAz1zRPMyZbllUtb6rPXD4Ozi 7gRv0oubuSvk5Dp6oz5QgGTdmLK9UhLXeukMSbjs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Necip Fazil Yildiran , Dmitry Osipenko , Sasha Levin Subject: [PATCH 5.10 180/390] soc/tegra: fuse: Drop Kconfig dependency on TEGRA20_APB_DMA Date: Mon, 24 Oct 2022 13:29:37 +0200 Message-Id: <20221024113030.413695152@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576066744313021?= X-GMAIL-MSGID: =?utf-8?q?1747576066744313021?= From: Dmitry Osipenko [ Upstream commit 2254182807fc09ba9dec9a42ef239e373796f1b2 ] The DMA subsystem could be entirely disabled in Kconfig and then the TEGRA20_APB_DMA option isn't available too. Hence kernel configuration fails if DMADEVICES Kconfig option is disabled due to the unsatisfiable dependency. The FUSE driver isn't a critical driver and currently it only provides NVMEM interface to userspace which isn't known to be widely used, and thus, it's fine if FUSE driver fails to load. Let's remove the erroneous Kconfig dependency and let the FUSE driver to fail the probing if DMA is unavailable. Fixes: 19d41e5e9c68 ("soc/tegra: fuse: Add APB DMA dependency for Tegra20") Reported-by: Necip Fazil Yildiran Link: https://bugzilla.kernel.org/show_bug.cgi?id=209301 Signed-off-by: Dmitry Osipenko Signed-off-by: Sasha Levin --- drivers/soc/tegra/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/soc/tegra/Kconfig b/drivers/soc/tegra/Kconfig index 976dee036470..676807c5a215 100644 --- a/drivers/soc/tegra/Kconfig +++ b/drivers/soc/tegra/Kconfig @@ -136,7 +136,6 @@ config SOC_TEGRA_FUSE def_bool y depends on ARCH_TEGRA select SOC_BUS - select TEGRA20_APB_DMA if ARCH_TEGRA_2x_SOC config SOC_TEGRA_FLOWCTRL bool From patchwork Mon Oct 24 11:29:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9622 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp531537wru; Mon, 24 Oct 2022 09:06:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7umz7mdmHKXZo8AHRa0he0aUiNil6mpAEr1XJcllVOsILlF/dWggx53RKSOQgt1RNZm4IA X-Received: by 2002:a17:907:6e1b:b0:78e:15a3:5be6 with SMTP id sd27-20020a1709076e1b00b0078e15a35be6mr28689248ejc.750.1666627599235; Mon, 24 Oct 2022 09:06:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627599; cv=none; d=google.com; s=arc-20160816; b=NiqLvkhJNHq2n0UqBE1rUS4gix21Mh/U0hMA7y9l1k+NnTBwBDOWv5MtT+2VIsLOpg ChqS2sOOyvCImb8Notnfqxesn4NsEsKW6F2dG5nacePnozha1QuKjydIjpBlvTrYU4pR 8mAfphxGqK2nbbn+rCG3dU7sAms0eTB7cZc9tgKS4/OyZzmPcdWp1xVOMSWeuLLY3Ngc 7oLB5jpZ2vVxoXnZvZ8/CIkYdD3uE1hM5obYEGpah/wYan5aTPbyuE+jtQTI19ij+2C8 AEqXmzq/ZASXC1qZcAlEBZnX1DwuK9y8UGQNAbeefZ1Deu/0tyZSWbGiZyOpmac5dmyF f6PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lq28OX0e96BdQ//goIXTlXXjKWjmx8FiWp6Zpyy4rtY=; b=P1nvwM9seTA2Ltn5R12EkwWEh/TuhXCUvO9bo7g5yKjJQJUY2ZPZc0Pks489rC7NR7 4U/M2L2dSxf1zuQu3aLclns5A6G+IQQwxm8wUhMAiBIzO5ZT+kIzTsqJvvAXmVjQSMBK evNiAm0LVrfGEzrYmRybv9eiHv8I78f5ggfushF9zTBEcGNYr6sVDwSn1LUUVXfxLwJP 3/Mto89rjxnEWPkvxih6S1mgHLp156OyyITnFMQckfO9bwjRhF8jj7qFyyZIM5U0HlkI uBYO7FpRJI8WY/OogXlEtfnDhZ5BmC+jeptvvzpOt6NGcXdPyTdL21Xtou2gyZbPXV0a mJgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vHeLuIFd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qb35-20020a1709077ea300b00732fa13e848si128804ejc.597.2022.10.24.09.06.11; Mon, 24 Oct 2022 09:06: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=vHeLuIFd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232799AbiJXQFb (ORCPT + 99 others); Mon, 24 Oct 2022 12:05:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232478AbiJXQCw (ORCPT ); Mon, 24 Oct 2022 12:02: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 22BD01AE28A; Mon, 24 Oct 2022 07:55: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 43FA5B8165F; Mon, 24 Oct 2022 12:23:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F82EC433D6; Mon, 24 Oct 2022 12:23:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614231; bh=DQNgp2+TWzVV7InN9eXbABN/iKDUNI2vlfGwXizv0BY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vHeLuIFdCODZOJ/6FI9ui5KX20fnvxGkksytuyTCeqHJYcXeJf+SPlQLPHRY/Q6ze SuPBoUCCLFI6cbcGi8cfuxxeSGqaVCO4ibY4WkoeqW4MIZJev3hJK8edi87gFOURLz K8kYTk1hkNjTpOYETa6rWSEVfXpdDdkY80U4sUgM= 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.10 181/390] ARM: dts: exynos: correct s5k6a3 reset polarity on Midas family Date: Mon, 24 Oct 2022 13:29:38 +0200 Message-Id: <20221024113030.462921312@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585701280351779?= X-GMAIL-MSGID: =?utf-8?q?1747585701280351779?= 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 06450066b178..255a13666edc 100644 --- a/arch/arm/boot/dts/exynos4412-midas.dtsi +++ b/arch/arm/boot/dts/exynos4412-midas.dtsi @@ -588,7 +588,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:29:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9111 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456121wru; Mon, 24 Oct 2022 06:33:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6QatZIf0pRNvFKqhvWS0PpOJvLZ9D5QZt0pYTHVUnA8X5EzDF6YjgZ3ZtCThEsZnvCVLy9 X-Received: by 2002:a17:90a:8048:b0:212:c605:522c with SMTP id e8-20020a17090a804800b00212c605522cmr22992772pjw.230.1666618416184; Mon, 24 Oct 2022 06:33:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618416; cv=none; d=google.com; s=arc-20160816; b=CIcS6MMX4cr665dPypsaot5RRmESGTNRVpN7n8CdkqJG3PrzYX0qfzljZZ4rwrIzkH c0tK26XPWyXbi34OVKCv8L8RhcJysanH6olyHFV6xRuKcLh2BkKKDmnCEdjYq3X5qeft PFtBlAxxulSoUx1+S/3BHWPXSPHHwMqRqY5sgAK70e7VGmijfmmd0hQwQ2tKJAoD+wiL jXGDwdR93JX2J6xhjPC0M4VMVfWWYC2WaZotVvNg8DJfljnrjUudEZIORwSAl1vvwtq1 scRsQb0BVG2YhvOsYQxsB1pU6PK/FiHtwoPcLlw5Fb7fIL4AepTbxhOMifwWqWxsxRld F7WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Byb42gpZlVX8Yga3BmLonMILyQwayyZsT+VelqRmwDk=; b=gnc1IN19JodNp0++HCpDIsEuGc6h/yEmnh2tHw8C1NVmLJBOHOdy2bQ93dU3WSxTdK 119uD065s7Zr0sMdjabtifMBa4fkrYrasRmR6zq0bEUsk3sf+pHZkZfKV9OjYWUcnVyN 5fKwSpxZC5LG3w3qzI4ADQdTDTT1+PBTxLG1mMbEUDVlarGuPrgTzKWwIwSvioqHlwi8 AeaU8pAjnrzhwMS9I8bE7++C8h9lwyqmOWibXe1cVqZdYil8ELy0UEV/s+b3/Y77cHZ2 ogld/SUSfosaMpxn0nitFG7CkIfU/utAb3+0oFz98vvL7MPpfBt0U+K35L8/M0WKkxhK X2hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Hr78uM0c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lx5-20020a17090b4b0500b00212e4f65e71si9432196pjb.31.2022.10.24.06.33.23; Mon, 24 Oct 2022 06:33: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=Hr78uM0c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235896AbiJXNRh (ORCPT + 99 others); Mon, 24 Oct 2022 09:17:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233069AbiJXNRC (ORCPT ); Mon, 24 Oct 2022 09:17: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 68F4C11A3D; Mon, 24 Oct 2022 05:26: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 D79C361291; Mon, 24 Oct 2022 12:25:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEB7AC433D6; Mon, 24 Oct 2022 12:25:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614342; bh=qRVzc51V29E4b48Cb3aNElsbDhochs3vnq6JxPF0XQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hr78uM0clRFBmSFRlOL3YUBblI8GusnscDvJwJ1TP3cSoZgPNipyk55dcRVDnTmGH 3XrgM+a8kuI2M2X2w77qI8jaRgWffYD3rdikJqIowzSrD1urwwTh3xX5doIqv0kuhE CoI00LpH9dbvsFLNtJb2zlofWthEhUyIDrJ93ISI= 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.10 182/390] ARM: Drop CMDLINE_* dependency on ATAGS Date: Mon, 24 Oct 2022 13:29:39 +0200 Message-Id: <20221024113030.502841120@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576072688854850?= X-GMAIL-MSGID: =?utf-8?q?1747576072688854850?= 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 b587ecc6f949..985ab0b091a6 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1791,7 +1791,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: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: 9113 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456142wru; Mon, 24 Oct 2022 06:33:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5xea+9/dkaRgbi1bX6axz6Utsnu5cqhgrksgRr9VZsPser1S14KvcrTAFsdiV+95nXZjOQ X-Received: by 2002:a05:6402:f24:b0:461:7c77:98c4 with SMTP id i36-20020a0564020f2400b004617c7798c4mr10864846eda.80.1666618418840; Mon, 24 Oct 2022 06:33:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618418; cv=none; d=google.com; s=arc-20160816; b=hb/ZTJqNHobAsOTSPW2ij/MuR+ilN+JXrzpuAG/yM9OX7JVtwPDoaoEC2XnEiZuPig t8+YvfNmLS/Hy20FcITKglflWNRgiuwDE4XLUeMbC6kkSWDnaoTNz/P0KHLptz7dCHMl OXv4oNMcNtuVnhGsp5Cca6dosLcz8p1ODwKdVSzQB+vkxE9zo5XvuBTZ8bd0tPlOY2fy 83ti33h8x+TVw8DKP5WOophcl1JKJOgAaXeBG2twJoinFo5+LQQrSOxLIUT2KlTKtMQ6 qfy2gu5VQZF9zXU8yJyGP8jyHhy1PhlkIx2sLZg5zfe9KaMrPNCKAgMEcwEDj5uaiszt Eycw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ov4byk565RKHHzDUqcR3+RoXxAv44YalmQenJGaa7VI=; b=B5//PI/QJsFmNcVbLUWVUkvpMIu/8tS3c8Li9rMTQvLT4w/8SgblkBv9is1AYjWx09 AfjVF0d0G+XG/Wj5Rlkeu8C5BWd/9t5kH/pHqRWTncK3gDHkify5UXi5E+mFkDnPC0UW lkSPI95V421/JskGnsUm9AeTeXZ8w4pLjaog+ebzT0r8vLVXepUd0tqeflfwvurezE3u PWvtVEmXp2IaP9pKNMZGB2t/TA/2zkEoSsMV5pdM+t0Pn27zXpvJnuc8XpSt9FBn/wLH 5yga0Xu9X8BAI6mt2rhWDxQm2CGZKkNApNRcio/5VMqr2iKMFq5pmrb6VmXcTxTpf0aN H1jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZEQqz4eC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o16-20020a170906975000b007aaacf9c0a1si844929ejy.129.2022.10.24.06.33.11; Mon, 24 Oct 2022 06:33: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=ZEQqz4eC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232047AbiJXNPj (ORCPT + 99 others); Mon, 24 Oct 2022 09:15:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235884AbiJXNOD (ORCPT ); Mon, 24 Oct 2022 09:14:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F5CF4448D; Mon, 24 Oct 2022 05:25: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 7EFA9612DD; Mon, 24 Oct 2022 12:24:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F962C433C1; Mon, 24 Oct 2022 12:24:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614252; bh=Xi6KdJyGWZb6aNSPWuOk0b0IESr26/01nsDyve/UsXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZEQqz4eCUlJ7gvQYrBAOOpRo+3ib0vNY0fzTY34weXO049x4BVn6vtsfcB5XZSPwA nQ1AkCB3R0iSgc/S7DVyfWDMfeK2v6X25HzQG5qeIqUcItJutv3fcJs+WXHjRTGpQ3 zP9j49oK56Wm68tcBgRBE/EIWMHdp11bCRMkvjSQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Rutland , Li Huafei , Ard Biesheuvel , Will Deacon , Catalin Marinas , Sasha Levin Subject: [PATCH 5.10 183/390] arm64: ftrace: fix module PLTs with mcount Date: Mon, 24 Oct 2022 13:29:40 +0200 Message-Id: <20221024113030.553043052@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576075044507705?= X-GMAIL-MSGID: =?utf-8?q?1747576075044507705?= From: Mark Rutland [ Upstream commit 8cfb08575c6d4585f1ce0deeb189e5c824776b04 ] Li Huafei reports that mcount-based ftrace with module PLTs was broken by commit: a6253579977e4c6f ("arm64: ftrace: consistently handle PLTs.") When a module PLTs are used and a module is loaded sufficiently far away from the kernel, we'll create PLTs for any branches which are out-of-range. These are separate from the special ftrace trampoline PLTs, which the module PLT code doesn't directly manipulate. When mcount is in use this is a problem, as each mcount callsite in a module will be initialized to point to a module PLT, but since commit a6253579977e4c6f ftrace_make_nop() will assume that the callsite has been initialized to point to the special ftrace trampoline PLT, and ftrace_find_callable_addr() rejects other cases. This means that when ftrace tries to initialize a callsite via ftrace_make_nop(), the call to ftrace_find_callable_addr() will find that the `_mcount` stub is out-of-range and is not handled by the ftrace PLT, resulting in a splat: | ftrace_test: loading out-of-tree module taints kernel. | ftrace: no module PLT for _mcount | ------------[ ftrace bug ]------------ | ftrace failed to modify | [] 0xffff800029180014 | actual: 44:00:00:94 | Initializing ftrace call sites | ftrace record flags: 2000000 | (0) | expected tramp: ffff80000802eb3c | ------------[ cut here ]------------ | WARNING: CPU: 3 PID: 157 at kernel/trace/ftrace.c:2120 ftrace_bug+0x94/0x270 | Modules linked in: | CPU: 3 PID: 157 Comm: insmod Tainted: G O 6.0.0-rc6-00151-gcd722513a189-dirty #22 | Hardware name: linux,dummy-virt (DT) | pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) | pc : ftrace_bug+0x94/0x270 | lr : ftrace_bug+0x21c/0x270 | sp : ffff80000b2bbaf0 | x29: ffff80000b2bbaf0 x28: 0000000000000000 x27: ffff0000c4d38000 | x26: 0000000000000001 x25: ffff800009d7e000 x24: ffff0000c4d86e00 | x23: 0000000002000000 x22: ffff80000a62b000 x21: ffff8000098ebea8 | x20: ffff0000c4d38000 x19: ffff80000aa24158 x18: ffffffffffffffff | x17: 0000000000000000 x16: 0a0d2d2d2d2d2d2d x15: ffff800009aa9118 | x14: 0000000000000000 x13: 6333626532303830 x12: 3030303866666666 | x11: 203a706d61727420 x10: 6465746365707865 x9 : 3362653230383030 | x8 : c0000000ffffefff x7 : 0000000000017fe8 x6 : 000000000000bff4 | x5 : 0000000000057fa8 x4 : 0000000000000000 x3 : 0000000000000001 | x2 : ad2cb14bb5438900 x1 : 0000000000000000 x0 : 0000000000000022 | Call trace: | ftrace_bug+0x94/0x270 | ftrace_process_locs+0x308/0x430 | ftrace_module_init+0x44/0x60 | load_module+0x15b4/0x1ce8 | __do_sys_init_module+0x1ec/0x238 | __arm64_sys_init_module+0x24/0x30 | invoke_syscall+0x54/0x118 | el0_svc_common.constprop.4+0x84/0x100 | do_el0_svc+0x3c/0xd0 | el0_svc+0x1c/0x50 | el0t_64_sync_handler+0x90/0xb8 | el0t_64_sync+0x15c/0x160 | ---[ end trace 0000000000000000 ]--- | ---------test_init----------- Fix this by reverting to the old behaviour of ignoring the old instruction when initialising an mcount callsite in a module, which was the behaviour prior to commit a6253579977e4c6f. Signed-off-by: Mark Rutland Fixes: a6253579977e ("arm64: ftrace: consistently handle PLTs.") Reported-by: Li Huafei Link: https://lore.kernel.org/linux-arm-kernel/20220929094134.99512-1-lihuafei1@huawei.com Cc: Ard Biesheuvel Cc: Will Deacon Link: https://lore.kernel.org/r/20220929134525.798593-1-mark.rutland@arm.com Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin --- arch/arm64/kernel/ftrace.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c index 3724bab278b2..402a24f845b9 100644 --- a/arch/arm64/kernel/ftrace.c +++ b/arch/arm64/kernel/ftrace.c @@ -216,11 +216,26 @@ int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec, unsigned long pc = rec->ip; u32 old = 0, new; + new = aarch64_insn_gen_nop(); + + /* + * When using mcount, callsites in modules may have been initalized to + * call an arbitrary module PLT (which redirects to the _mcount stub) + * rather than the ftrace PLT we'll use at runtime (which redirects to + * the ftrace trampoline). We can ignore the old PLT when initializing + * the callsite. + * + * Note: 'mod' is only set at module load time. + */ + if (!IS_ENABLED(CONFIG_DYNAMIC_FTRACE_WITH_REGS) && + IS_ENABLED(CONFIG_ARM64_MODULE_PLTS) && mod) { + return aarch64_insn_patch_text_nosync((void *)pc, new); + } + if (!ftrace_find_callable_addr(rec, mod, &addr)) return -EINVAL; old = aarch64_insn_gen_branch_imm(pc, addr, AARCH64_INSN_BRANCH_LINK); - new = aarch64_insn_gen_nop(); return ftrace_modify_code(pc, old, new, true); } From patchwork 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: 9177 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458140wru; Mon, 24 Oct 2022 06:37:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Fq8UCLxYnJ5wJgnp8Cruco/++SGKGAFmINHgLKQ6Ng6Bn5km66VtG9VNYbuo5NR3Z5fCs X-Received: by 2002:a17:907:a071:b0:7a7:dc5e:eb32 with SMTP id ia17-20020a170907a07100b007a7dc5eeb32mr4556567ejc.519.1666618626627; Mon, 24 Oct 2022 06:37:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618626; cv=none; d=google.com; s=arc-20160816; b=qLgVM11llgeW66Rubtf0yxdFhCnH6vNqZwM217YtJcUDTvFi4QhfVkFChZAyJKhuv5 cr6yYVnBkK/718OgdkvZpGcP37azQoWH669tBZzxr8j4/L/ud1nNANMAaMF55pYQBvTv PLZgz1rioJ0mIGibbqyxSWNA3kM5dnEQ3VN0S6nZysT4dqZS/cfgjkTOrlv4GRdJcJeS QPy+akk6XliRcLpsDuFjyJPXKE0lHTsyulhII2+EH5oKFlUlvjD57oM8wfmDEx8+bQb5 RwK1CHTOSEofwlcsWVD55QJzfm/e79ShUDN0wpUkKwlbqyrF/lXIuqbBUAExofMc3UzW T9gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GPL/BbDa3nWOUi2yzL8ikqB/YniEZ8xbi4lkaHeaBYk=; b=T7nwHSbAs0p5hheyPe8PF74qWf4uuFt8/o6dUI1NXV8knihX2XIxEuXggGlj3JOxmD Xxu1GSXCTlB1HV6Rfwk4M1SqJ4yZc1K6Dg5AO0cZseD7Ssz7Lqwz15GmTz45+ban3G5H Jhm+4Yf57kiYBDUHNoiLyx54PEq9naBkNzlTQZxCkyKjMGvG9Gcnfpc8eB8IbAbgCYID 5WT1d2TrDufB+Cyq/9sGSiWPCAS0lqSjDQGlJuY6btiCLzllEtbgniM7uWmSD9FQmzN7 NNdRwUiHF55WPjDNR/tYMuG8rAgPpZ3LZFLEeSmBw8iIcH2lWeM2m4br+Lggy009O0Ca 1rkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MH4Pzop2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f6-20020a1709062c4600b00781b277d931si22409345ejh.390.2022.10.24.06.36.33; Mon, 24 Oct 2022 06:37:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MH4Pzop2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235843AbiJXNPy (ORCPT + 99 others); Mon, 24 Oct 2022 09:15:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235975AbiJXNOR (ORCPT ); Mon, 24 Oct 2022 09:14:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B4D97AB1B; Mon, 24 Oct 2022 05:25: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 5F318612BC; Mon, 24 Oct 2022 12:24:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 709C9C433C1; Mon, 24 Oct 2022 12:24:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614281; bh=MXrEhhsTFOLm8+h3IlgHPhePRebQau9ZYKXn4VVTL/Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MH4Pzop2o+POvk801Vbm/qKk+NUcTAhL1oyndEFOzcgN23aK4iehSVJvSJNcU056e y405mYYR5KNZf7NLNSBMYxVNZsyXD6wzty80vUsfrWpoEaIDNC57wzExT3cwDhi25S VV8cNshKW/Frlsa/a75yhZc0u4ekPZ1yseQbwI5M= 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.10 184/390] ARM: dts: exynos: fix polarity of VBUS GPIO of Origen Date: Mon, 24 Oct 2022 13:29:41 +0200 Message-Id: <20221024113030.606259701@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576293483192696?= X-GMAIL-MSGID: =?utf-8?q?1747576293483192696?= 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 c2e793b69e7d..e2d76ea4404e 100644 --- a/arch/arm/boot/dts/exynos4412-origen.dts +++ b/arch/arm/boot/dts/exynos4412-origen.dts @@ -95,7 +95,7 @@ }; &ehci { - samsung,vbus-gpio = <&gpx3 5 1>; + samsung,vbus-gpio = <&gpx3 5 GPIO_ACTIVE_HIGH>; status = "okay"; phys = <&exynos_usbphy 2>, <&exynos_usbphy 3>; phy-names = "hsic0", "hsic1"; From patchwork 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: 9620 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp531407wru; Mon, 24 Oct 2022 09:06:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6RSCD4IhSGcUthfT9o3Ricl1ysTAQJb4rvvFyLkagheDEdr/PeJsvBi1tGuSwOJSmx8zhE X-Received: by 2002:a05:6402:440f:b0:435:2e63:aca9 with SMTP id y15-20020a056402440f00b004352e63aca9mr30624709eda.162.1666627576946; Mon, 24 Oct 2022 09:06:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627576; cv=none; d=google.com; s=arc-20160816; b=n0AMgUQtYjwUf4t8wHS48MEeWASSIVLW3pb/Ydk9XIrwGW6jUacj+mNk/AIAoLcqe7 cInZBg6EEO4+NYBJS321czMtENw1ynuTY7O6RIOs8Hvw+KhHDizZoqHv+ofIdBSXR+xj 3SBxvd7EinCulEAefCOQUhnduuGw/Mh/mkxM21IVksi9xwfHuTUIRkguMatv7juDO4BQ TiKvo1RIyY4qz/a6Zrc1YoZSwy7m8zy5woW4yM+dm/sLLnT+9ipOQ5B4c5SSF52XZnUh LueH/BSMV8GfyzyRKouCxvC90C3rdU1XBr8RBlk+/7uG/9JccIC41YnAaPf9oS/92oNS gSUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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/FEDlttDaI338ZuSfKwxOQlT9r6QN/++vYW1A2k54E=; b=s+SAt67X4Z6rruFkmzFysDBCLP7LidrY2+OsLHcldsewArbUHI1z5S8iINYWzyv+K4 EKjfkBZVUi2q1J2PaohZZaH+wOqraGDy/6zdxQvsIkf5GUWWNmlz0pl7TwrGc+4cdFYg mcis1LjMJn3dhmReSYZG8j4jtOmrijljpbk55n/GWlzg6BnDB8kS6t9bDXjSF4VpVs3r 860kJt/fp/8fOCmMhK3gynnYFXqbGGQ4NyKzsrrsjhKyjHgq7gV3+HbojX4CcClML5b9 Mu1Vzx//2zelhnNQCDuP0hIFSXQcDt+MQsxs7iH1v/dW64wwajDnzLbFbmMXuB8YXE7Q EFKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qM476K2w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y13-20020a50bb0d000000b00461c7ad026csi166692ede.61.2022.10.24.09.05.50; Mon, 24 Oct 2022 09:06: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=qM476K2w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232757AbiJXQDC (ORCPT + 99 others); Mon, 24 Oct 2022 12:03:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232565AbiJXQBy (ORCPT ); Mon, 24 Oct 2022 12:01: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 EA1E512D82E; Mon, 24 Oct 2022 07:55: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 F10DAB8167D; Mon, 24 Oct 2022 12:25:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57533C433D6; Mon, 24 Oct 2022 12:25:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614310; bh=IKWwx4pVDL9aZj3m+Qe5ON/YvL1n1BSFmOAm1sUTF10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qM476K2wx2W1A2VHzEzKChpEG2li9FNso+YelJJYO7MQLxhcUSmkM0diR1pJ2S2qX e9njqQOds1PkNCoT2tvhg4dPu9UniFwXnQw4WhmCs6r945YtJfyt1Pypk9CxcypoLj XBw/Ong8riR7S01IQLJD7mdCfOdQbMUEV23rGobg= 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.10 185/390] iio: adc: at91-sama5d2_adc: fix AT91_SAMA5D2_MR_TRACKTIM_MAX Date: Mon, 24 Oct 2022 13:29:42 +0200 Message-Id: <20221024113030.644537784@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585678313463360?= X-GMAIL-MSGID: =?utf-8?q?1747585678313463360?= 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 4ede7e766765..230e4111517e 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -74,7 +74,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: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: 9119 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456243wru; Mon, 24 Oct 2022 06:33:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6kftEr8eaZG2tF0Oz5QUWFi4At6FfY1nrUB6ooWOMQ+5M992Hc4g5dWbJ/6EcEz/6gNqqS X-Received: by 2002:a17:906:d550:b0:78d:a6d4:c18f with SMTP id cr16-20020a170906d55000b0078da6d4c18fmr28140774ejc.113.1666618430624; Mon, 24 Oct 2022 06:33:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618430; cv=none; d=google.com; s=arc-20160816; b=G7aDMlG6tVbXxAEsvoUJ0jj3SsenV5QJixF4aDJQeyL3qs2p+Ygy/K4BSn4IsOH7GZ mTE8usHsedZ03LDL9tQhf5DlFpwfUd8GGsc6IWMS1ZNBJFXFbtuTq9txIy0+5rRK6Xa0 HzVWKw3XtsTjSt+1cELx5Gsyjkgatr5MSsKujiBzIoXdQBTYVv8iMQ1R7heQZ0ek/Boe +H48RYBMwC4ZU8D3hGI12hVxuRu+Xb5LXBlGWNMm+Be5Q2JFnBPdp9zt/msRVi5TtZKf 2p8pAD1juN8t6hzHTaKk0lCxn8Y//Ew9RE1mCYH2d/8ucgXKaDnGpZrx5yg7+FBTk0FE BuMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6wNWkSIY18wXdm8lh+rORcbf2hPBf/u4bKiGxbHwYS8=; b=sYZOmZGVsRm1LGd5HbF41gkf6mhA9fQGzpHVrmulruuXwB7ncc4AK/+R5iZJmcmr7V 6ABIzcP/hyTJlo6vm9T3IM3s32SyoP9V2E3euxNaSnL432IUZIJRyDvptLMGLJcwdkKI 4t1Uzv50UhEdGdOmUuIs3efNFpAL/vxQQmMs4gUd7Lvz76KoPRtkhcdnoDs2s1cWGVAH YLGrSzaZM97xxhAJyaaObzXisf1VB8C1bnStvJkJB+wQiZAS90q2BSCIyOVxeulrBKhU UgAtqntlCN26ANLVO1nsU0+SppkDvCL8yFp+1PiZ65e5D9H+Amci16HEJQ7c+DhjsgF7 MMaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KXsGGbew; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg36-20020a170907972400b007a00aaf659csi7290711ejc.198.2022.10.24.06.33.22; Mon, 24 Oct 2022 06:33: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=KXsGGbew; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233651AbiJXNRS (ORCPT + 99 others); Mon, 24 Oct 2022 09:17:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235880AbiJXNQ3 (ORCPT ); Mon, 24 Oct 2022 09:16:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C0683136F; Mon, 24 Oct 2022 05:26:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3A99E612BF; Mon, 24 Oct 2022 12:25:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F0FDC433C1; Mon, 24 Oct 2022 12:25:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614326; bh=nF7UiDWwEbfZz17cexrmnfVr+/EPs45zvkqcJM7ZsSk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KXsGGbewz9fboYu6L1vTZ7zLl9ZvflAbMVMv83QDwe+kf4/7A7rTSEJKgyx/K7o1m SMzvRIX9pTGX03cCk6/kzCvaQbcg1iHrAzSmXr7KMmWg8LiY0AXgk6DvheDLSAwwRG pcoowAXQgfDHT87TtQguVuG6ifvJQKO2Ji2iVcLk= 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.10 186/390] iio: adc: at91-sama5d2_adc: check return status for pressure and touch Date: Mon, 24 Oct 2022 13:29:43 +0200 Message-Id: <20221024113030.684509472@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576087802194775?= X-GMAIL-MSGID: =?utf-8?q?1747576087802194775?= 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 230e4111517e..fe41689c5da6 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -1355,8 +1355,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); @@ -1369,8 +1371,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: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: 9606 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp529735wru; Mon, 24 Oct 2022 09:04:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5sil0yGJgyyF0ijPVFZ0NjGb0NcuGJ1nOh+zdZ06NDcUbeB/pDyFM12Y16uiBaMo7uvhKa X-Received: by 2002:a17:90a:890b:b0:20d:981a:a5b5 with SMTP id u11-20020a17090a890b00b0020d981aa5b5mr70259545pjn.186.1666627444058; Mon, 24 Oct 2022 09:04:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627444; cv=none; d=google.com; s=arc-20160816; b=Wd98qAy04tAEx/nAi/AEjYI8Go8ONYtSAzPEVYSxOUSx4xG67Zb82pHyxIeznJYAnA oydpyo2rZixbsDvPvD+AprgD2lsv1txToFroD7EhfcD4pDrq+acFKj2j3bfowKaG1bwj JPFGKC3ZrQH9HvvOsO8RabCT+gI3YytkBzwrtrDEdNfNS117HyGMy9qozSgYHR763DVE i6aCaVj9x01lNHsB1bXRgRk5Lbw2XaX+1e4hIh02to81BRfXpuiWuoiPVsdS1UCOufzV c5tUoXn3/qwuzvbXwHu7UqT/e0gkFRt6usFJ9LOqRjHXo+7lfE6breegS2dJ0x/AhNaK gcGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zFiZV36VD6KllYtNvrOeJen03WOYpPxcaCLkpM/Zk8Y=; b=lPoKOnGeYYb947ndBwjOGQGxJg/gXRzKML59LSQo1yZ9/VeM5RDZExgCroFV053E7s /n+yLKR4/7Zp6Onpt0tDTT1DmfZl4STvTac5y/c+JMV+G1OqGMUUK1duWqHDUK01JI3F GyjBM9OslLg1vzOgTQKCG1INqBd7nwRWHa0Q0H+CtVuLxPvq0NPvKiqYoLstG4liOh1G RUsNKFZzBxgrU+JIUxSSao6b0Qn/IBY+LcZh7YyTeuobje01sOrshU4B74jbtkCtIf60 Cgnqv4oj1x6jrqMBrZ3LmEUzWy5yVJhyYFLk5vGk/GWo9NSmzyYY9TpG5BDRFKoTz/0c hCMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0Dng3LnK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oa10-20020a17090b1bca00b00205e1caca43si396762pjb.34.2022.10.24.09.03.27; Mon, 24 Oct 2022 09:04: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=0Dng3LnK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232625AbiJXQCK (ORCPT + 99 others); Mon, 24 Oct 2022 12:02:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231921AbiJXP7p (ORCPT ); Mon, 24 Oct 2022 11:59: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 C6047870AD; Mon, 24 Oct 2022 07:55: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 85788B81683; Mon, 24 Oct 2022 12:25:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2B96C433C1; Mon, 24 Oct 2022 12:25:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614329; bh=sYmnCnwfT8kM670N+dtsZiSMhPUdkCBCpcQmijME+Sg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0Dng3LnKIe96k1JcAgiv+NSvgRVB474sFsixTcB1mtMiQRAVm8Lb5v2mt6ZwpfPAg YVovbDDzlZZ+clk4YSPWsx3cYKHYCWHkK6j+DOnPhiCkS2PwMC/+bkxNztl5zr+7Xd 0aH569jk8g9RxFqYm6lButkTnktjZ7AcZ5zkre58= 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.10 187/390] iio: adc: at91-sama5d2_adc: lock around oversampling and sample freq Date: Mon, 24 Oct 2022 13:29:44 +0200 Message-Id: <20221024113030.726389146@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585538420141810?= X-GMAIL-MSGID: =?utf-8?q?1747585538420141810?= 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 fe41689c5da6..ef6dc85024c1 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -1353,10 +1353,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; } @@ -1369,10 +1369,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; } @@ -1465,16 +1465,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: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: 9117 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456192wru; Mon, 24 Oct 2022 06:33:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6RIcsjytPwYw4tPDxDHQXpfmQ9s3S36s98SPF/HxVbr5V9lRNL7AH+QB0V/j2MINk9LPgu X-Received: by 2002:a17:90b:3901:b0:20b:210d:d5d9 with SMTP id ob1-20020a17090b390100b0020b210dd5d9mr37083908pjb.83.1666618413656; 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=G2JXvsSp7dyAFIn2d9YeLVSZb2247dCK6G/6lkqxsn8TMJETin1os21SIU9g1EnIJd 8ybZUk3+9qqmBS6hwjPIQaKV56srBhBosJcHrPSZRiQLVlFSoYycHpvBkopUb+UH1Vez VEcQQSW/DRhPJyivkcGqu76BaMWjxYzLVMJFugDI6bi73VuBeX1U7+Jj3QYnnI+Y+boI F/oz/6YbmW1AHSaF97ur1kungMKLuDFJpNS6kNLg4Rx1/EYhVfId/7+tg98ZHXB46gBl Hh8QoNuJ6QTN/jfXUqjkF/9RFfdl4TK74Gys0ub5wbA71zt0usFD8mq+rbfsZY/JpQT7 kTfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hA5NASstklLUTD+b+NZQz0HPEGaw7HYzpyYFD6qwKrA=; b=xgULkzUJ9iAFvZRYt7EI72hHId5+L3FAa7zkCod0zqLS87mXTWxql1nq52cMubwwER Tf73XDgadwhQV656VT08cy2P8QzJot1dX2EKzGrTb1eTO++fh2FeFlfpBkK1O33OtgxF 6nrkyN8AnnyDHvEESR4n1yRpjLH7K6lks8IVmCnW6VO/lBzRbzSJjlMcH1HXRnJ4bhsT 5RYO6MlXw4zcxWgyVTXM2iAicwPIaJr4+yn7zX5yxI9310xvOisQgZWhBfaDNPeZPEEC pj26Q3RCmvvLEIhW9D2W7VO67RK3VS4ss+Z8cLwdFJpKu/I9IkZ40kq1hwsNdNCWaArO SuWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jkfDjagW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e8-20020a62ee08000000b00557e3e7c420si22044880pfi.213.2022.10.24.06.33.19; 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=jkfDjagW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235862AbiJXNRI (ORCPT + 99 others); Mon, 24 Oct 2022 09:17:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235825AbiJXNPo (ORCPT ); Mon, 24 Oct 2022 09:15:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFA395B13E; Mon, 24 Oct 2022 05:26: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 7127E612A0; Mon, 24 Oct 2022 12:25:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86A7CC433C1; Mon, 24 Oct 2022 12:25:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614331; bh=c1UlfST0IreGSVgy1VtrSqlHFdH8zsS8igVObdDVohA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jkfDjagW7skjLdP6F11f+6sGGAQ+6BWoAVyusBvs9zN8x3Uh03i019giuTkrTlBBs u55xvOvPF+c3NgS5w0ZmtuRO1PcVLjqZpxMxe84BGVw8puoT9EQUTbMfYiwC/Q8GAK R0gHAJJpWLD2KuDffW2n/zGYZZgc+SZv9WasVw3o= 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.10 188/390] iio: adc: at91-sama5d2_adc: disable/prepare buffer on suspend/resume Date: Mon, 24 Oct 2022 13:29:45 +0200 Message-Id: <20221024113030.767076920@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576069803646415?= X-GMAIL-MSGID: =?utf-8?q?1747576069803646415?= From: Claudiu Beznea [ Upstream commit 808175e21d9b7f866eda742e8970f27b78afe5db ] In case triggered buffers are enabled while system is suspended they will not work anymore after resume. For this call at91_adc_buffer_postdisable() on suspend and at91_adc_buffer_prepare() on resume. On tests it has been seen that at91_adc_buffer_postdisable() call is not necessary but it has been kept because it also does the book keeping for DMA. On resume path there is no need to call at91_adc_configure_touch() as it is embedded in at91_adc_buffer_prepare(). Fixes: 073c662017f2f ("iio: adc: at91-sama5d2_adc: add support for DMA") Signed-off-by: Claudiu Beznea Link: https://lore.kernel.org/r/20220803102855.2191070-5-claudiu.beznea@microchip.com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/adc/at91-sama5d2_adc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index ef6dc85024c1..250b78ee1625 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -1907,6 +1907,9 @@ static __maybe_unused int at91_adc_suspend(struct device *dev) struct iio_dev *indio_dev = dev_get_drvdata(dev); struct at91_adc_state *st = iio_priv(indio_dev); + if (iio_buffer_enabled(indio_dev)) + at91_adc_buffer_postdisable(indio_dev); + /* * Do a sofware reset of the ADC before we go to suspend. * this will ensure that all pins are free from being muxed by the ADC @@ -1950,14 +1953,11 @@ static __maybe_unused int at91_adc_resume(struct device *dev) if (!iio_buffer_enabled(indio_dev)) return 0; - /* check if we are enabling triggered buffer or the touchscreen */ - if (at91_adc_current_chan_is_touch(indio_dev)) - return at91_adc_configure_touch(st, true); - else - return at91_adc_configure_trigger(st->trig, true); + ret = at91_adc_buffer_prepare(indio_dev); + if (ret) + goto vref_disable_resume; - /* not needed but more explicit */ - return 0; + return at91_adc_configure_trigger(st->trig, true); vref_disable_resume: regulator_disable(st->vref); From patchwork Mon Oct 24 11:29: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: 9627 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp531968wru; Mon, 24 Oct 2022 09:07:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7irXZb884nFIZbL4slozYppKG6diNYNk5HF/9uy5k1UTJQRE9BDg0uZPRvkO9bst2J+G2L X-Received: by 2002:a17:907:72d3:b0:791:a4fa:c4ac with SMTP id du19-20020a17090772d300b00791a4fac4acmr25588635ejc.391.1666627638164; Mon, 24 Oct 2022 09:07:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627638; cv=none; d=google.com; s=arc-20160816; b=CghujomBVaVUh5LigQgCLuURjy1bfvfCuNR93r1NaOjtbscjORT7m6xk6COWUmQohR o6U3IzzGvVUiMGq7IIzFJWrlNDPfMNLpWJH3O/hoDsYmfNnPvLpEEqdlMNlMYAyrv7YS 9QGMxcIgqS0coQDhJF6qWi/3brJdb3oeLiOPPDSikmOpkeUWFlpR/KPctHaQjcHmlpBF wsbEp5iwrFT4XNZkYDLFIiDwUW8MB+11iXFormb8t4X+a0/jZ6i1HuTh000B1yO0lAJg 5WgK/pRaPnmyuFUJqOLU8fCQh+lGzpN3/mR7a0sm1SG5adT82rSLpAgs72Z09JBz/lTL ihWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=U3iXXD6PjRe5+Efs/Oot0v4IH403pEMcdl0gUYAMUB0=; b=gCZ2+8gNggbpfA71FUvUsXhkTdQT0ruqj5BmUvRM06+btrl8iz4Q0P4XvDdYX9JInI uDxdlr4tRY+hCGVFh/rtzmrdLa5sBGRgDw0FDWlKrfe05mx64FFgQ7VeSQOMiJe6phIH MgZaRPoIma7Y3LOUQbY6ABy0Kiua/+TVxDez8PvD+531UBh63eWPmG/GSnd/Ws0ij6K3 H+essCRM93JB696Mpw/jczWhkBWJm8Q9RXcBEc7eDiwqBKEAkxui67R2gGSY4mwLdgsX 0KMrEoU0hb3n6jqzLsLecIruCLTib9QaIC/TfXK2BZEcWgOi6DE/acvEJ5009EF+UY03 gt6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=T7QlpgP7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn16-20020a17090794d000b0077b2e822b5dsi136190ejc.674.2022.10.24.09.06.52; Mon, 24 Oct 2022 09:07: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=T7QlpgP7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233061AbiJXQGK (ORCPT + 99 others); Mon, 24 Oct 2022 12:06:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232682AbiJXQD1 (ORCPT ); Mon, 24 Oct 2022 12:03:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C4E31E393E; Mon, 24 Oct 2022 07:56: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 C25E5B8166D; Mon, 24 Oct 2022 12:25:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26764C433C1; Mon, 24 Oct 2022 12:25:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614334; bh=uoeFd3MyW7Ujm+9BgZ79uuyLasaqd+zLWJbzadSXaxI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T7QlpgP7uDZhmG2a2xRnbtAxGc/MRd4lFW/FhqpsSFxhNo1KVe0bn4pAkMNTuRpFF gmpmhoAQhgVO6NclLOEH5OSv9rG55tVSPEhQK02p1k/N0RB+gQVtUHW9bUCpIFo04q CqD064w5j+UrT9/HnHq1g60aXaZk5kHaYb3Cl+BA= 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.10 189/390] iio: inkern: only release the device node when done with it Date: Mon, 24 Oct 2022 13:29:46 +0200 Message-Id: <20221024113030.806122436@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585742020205885?= X-GMAIL-MSGID: =?utf-8?q?1747585742020205885?= 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 8c3faa797284..c32b2577dd99 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: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: 9637 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp532558wru; Mon, 24 Oct 2022 09:08:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4N8nyugFMYSeSD69j/l5yebYlG/ZU73FHw2C3QdaEjYJa7a0eRxuupeDbO8Fsy2v0hqQKb X-Received: by 2002:a50:fe85:0:b0:458:5562:bf1e with SMTP id d5-20020a50fe85000000b004585562bf1emr30923110edt.167.1666627693288; Mon, 24 Oct 2022 09:08:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627693; cv=none; d=google.com; s=arc-20160816; b=JnpJO02pp24kJ54xWJWqCKOejmUd1YArgM88YKJdCA7loLrVEtxWrIr2FH/rSLk38V xwvKRWvTRjbb5l3xrXX7V1LdcRqrPivBHKupuMR45BjNXNkFs6WE3OEzBW9OkbrAUi2F bLQROZA6nbJPxB8nuB37V676aKpEYUPunpBXtJDxtDEv95Tcwc3ivlYWdlRs8tJx4PTW rBBEZ5AXzdRqjPErLCkTTUrKypOLosFA71lJ+q49fMFl3IdM0YuyA6qou605YiG4/cO2 CPeC7NUFFV0sFPSnHU8EPO8x+1nTahgNEdDMStOkV8dh8CfP9RZcjUp2HrTspQbnrmtQ JMvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pn95Wqsn8LGgaYhpZwnZmrNxNTnxC5AF5hZMU1hbv5Q=; b=vSDCEotKLGL7UJJpSjGcNGaEJBZXZD9vvG97Exnl553H1f/yxFDr0DYLOEVOs7vszN bInMjqXHpmi7RsIQdb/CgElqAQMNI5goZtIxpnNp2iJX2FjphDdJsw8zk7n5ewS+KARV +BOHOmMO742tqMftaveyhCk572QAzois8+g0bggA9aqUg9ByPB7nNvC2r5cJZozh8t9x 6mibCSOPOpAuHlzcEWRq2gP5EZQmtWZ0Dpgt8raUg3ikiq7jajupAnNQcAU0X2nkslzD Kjf5TtVleRU+FDVv1fZe6Nmw2f+CCXOadpb98wPk/2gc11WCyrBmGtB9HuaCuo46uMo3 ig4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ySjTDaAs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056402351400b004619acbc70fsi150791edd.505.2022.10.24.09.07.46; Mon, 24 Oct 2022 09:08:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ySjTDaAs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233228AbiJXQHI (ORCPT + 99 others); Mon, 24 Oct 2022 12:07:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233008AbiJXQEJ (ORCPT ); Mon, 24 Oct 2022 12:04: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 09C50937B2; Mon, 24 Oct 2022 07:56: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 63441B81673; Mon, 24 Oct 2022 12:25:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B877AC433D6; Mon, 24 Oct 2022 12:25:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614337; bh=bALNRABvlhgzd60APy0WYdB6i+5E0MSGrsOz6JFb/UU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ySjTDaAsQznVhqrOllCw3P46ArGZ8KYk3jsquQKyMVLjy1jYL9dpbB0061jG/Xbo3 3OTB1BUUs+l0ZjE1F0nYdLZnAxeixvHrliykX6WuvSfWpYRDr/W1kdpHJj9ADL+utc w0oIg3uRTSDjyzwCX6igmXeJbqN6CrUaazc+zDuk= 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.10 190/390] iio: ABI: Fix wrong format of differential capacitance channel ABI. Date: Mon, 24 Oct 2022 13:29:47 +0200 Message-Id: <20221024113030.852781144@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585800278706389?= X-GMAIL-MSGID: =?utf-8?q?1747585800278706389?= 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 df42bed09f25..53f07fc41b96 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio +++ b/Documentation/ABI/testing/sysfs-bus-iio @@ -142,7 +142,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: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: 9940 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp600356wru; Mon, 24 Oct 2022 11:48:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM76TsMF5aqkw4E7E8tbVRJPolwGYZxPGCOG1up0Z2IVvgFpcL360/VoT/vaFb2XnS5+3smD X-Received: by 2002:a17:90b:1e11:b0:20d:90b3:45a0 with SMTP id pg17-20020a17090b1e1100b0020d90b345a0mr72355853pjb.29.1666637304180; Mon, 24 Oct 2022 11:48:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666637304; cv=none; d=google.com; s=arc-20160816; b=nWT7NJJ3XXnLfdgy/M+3x0S1sO1SfKslSy6Sf5NnDNmPAN2+AGhy0c8rrn8dOyeTOz 74V980+iFqIYMGFpNKzw6PBOW3ZU7IwOsIZx8pRu4R1pCr1nkulvCHlLSUPOmhbnWdlj kdF/O2c/EH9bOJEdvadaOPjQIeKotcVUnjH2bTtzNcaNahtws08/VZlWq3NwKdjl8ec+ swQ2S8q79aIeS1Fze2mIV5XwkdGSUxP8a+BlKP1ocsG73jV8g31qlYriNNV9ZXkgSzXl Kw0nXMH7lzufXhuy4O+kBGKq8cq9lgbcb/yk3dM81PGbKrxXtHduAdLbowxUi6w2mb5u koBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=U/kVfgIjMeaY0muEemF3PlZaohPnXv4yP1l4nmWDlDc=; b=EL8BCwOYmx5X6zfshmH9gAWuRkLsF6xLYVCP4EP4ejUOQEzVxh7hTsGS4Ub3zxU7B2 ChA7QX61f2eULNSvCkbxfyaMnDOWHFS39rvB4R0UDOSIaOXL6bY6NrVKaaTP0BjJhFAm K3BxIlMZpl2Ppnu4MiWaafc3yrjbt3ZUl63RwAl4vEWEhEHRbIKbCSptUALg3/9ZSRX6 CGcvJMc5eKjXBokp6E6ajuclZq4PZehmxiMfCNBmYi3tSMYErBxUTSgVmcXQnk8zQ2t4 DwnuPXaZebPK3YncSYOrSktSDsBZv1iXDTZ16XjtbNkLV8e9Ms2MMNEemHU9QvKd+d75 O3ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CaHHPtxM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mq10-20020a17090b380a00b0020daab63f66si951433pjb.31.2022.10.24.11.48.11; Mon, 24 Oct 2022 11:48: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=CaHHPtxM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231479AbiJXSrr (ORCPT + 99 others); Mon, 24 Oct 2022 14:47:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232406AbiJXSrY (ORCPT ); Mon, 24 Oct 2022 14:47:24 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB6051DC4DD; Mon, 24 Oct 2022 10: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 sin.source.kernel.org (Postfix) with ESMTPS id 68BCBCE1323; Mon, 24 Oct 2022 12:25:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56E56C433C1; Mon, 24 Oct 2022 12:25:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614339; bh=rkOgUST3oSkHxg+7+g1K8kfa2X5eSH4vqsowIX0lsq0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CaHHPtxMkow0plNrDOa9kbQdNYnqhHU5gNWLbacFZUk6ukPNtMpcHyfKqlBo7tjUM Hbbp/rkD2Yw5nLSTf98ixAprQBeOsL5d5Btg+MR7h0khMEl4C3aEJT2QoR7QImBbpR phTKQz0RfruawhUQ1A9h6m15Oi2idPeWiSFTt9s8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thinh Nguyen , Sasha Levin Subject: [PATCH 5.10 191/390] usb: ch9: Add USB 3.2 SSP attributes Date: Mon, 24 Oct 2022 13:29:48 +0200 Message-Id: <20221024113030.893275259@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747595877606739969?= X-GMAIL-MSGID: =?utf-8?q?1747595877606739969?= From: Thinh Nguyen [ Upstream commit f2fc9ff28d1c9bef7760516feadd38164044caae ] In preparation for USB 3.2 dual-lane support, add sublink speed attribute macros and enum usb_ssp_rate. A USB device that operates in SuperSpeed Plus may operate at different speed and lane count. These additional macros and enum values help specifying that. Signed-off-by: Thinh Nguyen Link: https://lore.kernel.org/r/ae9293ebd63a29f2a2035054753534d9eb123d74.1610592135.git.Thinh.Nguyen@synopsys.com Signed-off-by: Greg Kroah-Hartman Stable-dep-of: b6155eaf6b05 ("usb: common: debug: Check non-standard control requests") Signed-off-by: Sasha Levin --- include/linux/usb/ch9.h | 9 +++++++++ include/uapi/linux/usb/ch9.h | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index 604c6c514a50..86c50907634e 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h @@ -36,6 +36,15 @@ #include #include +/* USB 3.2 SuperSpeed Plus phy signaling rate generation and lane count */ + +enum usb_ssp_rate { + USB_SSP_GEN_UNKNOWN = 0, + USB_SSP_GEN_2x1, + USB_SSP_GEN_1x2, + USB_SSP_GEN_2x2, +}; + /** * usb_ep_type_string() - Returns human readable-name of the endpoint type. * @ep_type: The endpoint type to return human-readable name for. If it's not diff --git a/include/uapi/linux/usb/ch9.h b/include/uapi/linux/usb/ch9.h index 0f865ae4ba89..17ce56198c9a 100644 --- a/include/uapi/linux/usb/ch9.h +++ b/include/uapi/linux/usb/ch9.h @@ -968,9 +968,22 @@ struct usb_ssp_cap_descriptor { __le32 bmSublinkSpeedAttr[1]; /* list of sublink speed attrib entries */ #define USB_SSP_SUBLINK_SPEED_SSID (0xf) /* sublink speed ID */ #define USB_SSP_SUBLINK_SPEED_LSE (0x3 << 4) /* Lanespeed exponent */ +#define USB_SSP_SUBLINK_SPEED_LSE_BPS 0 +#define USB_SSP_SUBLINK_SPEED_LSE_KBPS 1 +#define USB_SSP_SUBLINK_SPEED_LSE_MBPS 2 +#define USB_SSP_SUBLINK_SPEED_LSE_GBPS 3 + #define USB_SSP_SUBLINK_SPEED_ST (0x3 << 6) /* Sublink type */ +#define USB_SSP_SUBLINK_SPEED_ST_SYM_RX 0 +#define USB_SSP_SUBLINK_SPEED_ST_ASYM_RX 1 +#define USB_SSP_SUBLINK_SPEED_ST_SYM_TX 2 +#define USB_SSP_SUBLINK_SPEED_ST_ASYM_TX 3 + #define USB_SSP_SUBLINK_SPEED_RSVD (0x3f << 8) /* Reserved */ #define USB_SSP_SUBLINK_SPEED_LP (0x3 << 14) /* Link protocol */ +#define USB_SSP_SUBLINK_SPEED_LP_SS 0 +#define USB_SSP_SUBLINK_SPEED_LP_SSP 1 + #define USB_SSP_SUBLINK_SPEED_LSM (0xff << 16) /* Lanespeed mantissa */ } __attribute__((packed)); 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: 9209 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp459193wru; Mon, 24 Oct 2022 06:39:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5c4+LXWME2NBTk9OqMiNNNd7bhDVWCMEHH74VbZTNUBr78bZ90eRrA+T+GVrMl9C6ucv1h X-Received: by 2002:a17:907:2d1f:b0:78e:174d:2ce0 with SMTP id gs31-20020a1709072d1f00b0078e174d2ce0mr27821246ejc.638.1666618732905; Mon, 24 Oct 2022 06:38:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618732; cv=none; d=google.com; s=arc-20160816; b=Suzgb7YbSar3+xxiWm8YVWnTZjtQfFgtf8x5j7buBJN+Nu9OdZj255qOCp9nm4+iAG zVivbeqEbsDpp7gatGqlyixmcx8oc84vXugIweHPMAO4JYQPbqN5FNe0cIT76oV+ItID W/q5cL3orF4KVoFhxRHPH+fWz7fWjC8w1JOUITVcihbkfKQbQ5KXhw4pVuEn7tZHBCqT jAn+t4bhcuplwaRKyCcVmbpat6Wsgsf7HOzqBWfspBBxAa8LxZFlaQN++5GFK3U2HVtv UruMd+zBaIvQMOR3jipEccvRQFanNsvryneMnj6mkU9uYmqUbgaElJCs87VSyBU2/LZ6 K/1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=U1iqRrLHdm2hHeTLynp2HFbIOzOFRwjx8eo9cjPXxP4=; b=jgkPbUYv0LSvX5QZ7w2Xm0SMtuo1iSZ3B30qoeRxFVuBdstJejSdsHQJ5aL37jYfcS C/OAQeNd/CuLbIByJMkovJvTRoFxKV3i1Inz/NN90JstF0potaboEtUIE/p9L8ba66kZ 0VT0ax54Oa6YYUAbqEJ8HU8t9TuHsO0P29vcPKzcUyCsyA4aPNe6oCfuXQviGV9t8Lie JyrOdwA4za1h6kxM/3wEE67UUGLLgt3+ud4O/eODOuT9yKyHqaehZFSTOcmxKaeAr/f2 Ay3tPCBQViP9Ffh/xjL6OGZmfcHn7KHMekUGD1htbQTvZ/4JOOaOqw1pYTmxpv166CYM KjFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pkMgd1Xu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a50d585000000b0045bcf2bdcf2si28251214edi.464.2022.10.24.06.38.22; Mon, 24 Oct 2022 06:38:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pkMgd1Xu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236286AbiJXNfO (ORCPT + 99 others); Mon, 24 Oct 2022 09:35:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236279AbiJXNaV (ORCPT ); Mon, 24 Oct 2022 09:30:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B9C6AC480; Mon, 24 Oct 2022 05:33: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 1844F61297; Mon, 24 Oct 2022 12:24:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B7FBC433C1; Mon, 24 Oct 2022 12:24:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614255; bh=Gxa3rXUFxkd8SLn9Ts36YPdcxnaQL3Du9o3r46StfhE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pkMgd1XuOIlzzeMyZW3/NwIwI9sOAGuyxPP+adhfOJnSbY2ugkMScHyC/auVOi7kt JwL6vaqlqEIryJWBWjeLHZvUhUu85tyheWmwDo3rH+IZS+ovjslhkIdxv9w1bbjz5A BrSvqR17k49M97E8ul9t9XzJTPl6rHsZBV2j61O8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thinh Nguyen , Sasha Levin Subject: [PATCH 5.10 192/390] usb: common: Parse for USB SSP genXxY Date: Mon, 24 Oct 2022 13:29:49 +0200 Message-Id: <20221024113030.942254530@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576404268522049?= X-GMAIL-MSGID: =?utf-8?q?1747576404268522049?= From: Thinh Nguyen [ Upstream commit 52c2d15703c3a900d5f78cd599b823db40d5100b ] The USB "maximum-speed" property can now take the SSP signaling rate generation and lane count with these new strings: "super-speed-plus-gen2x2" "super-speed-plus-gen2x1" "super-speed-plus-gen1x2" Introduce usb_get_maximum_ssp_rate() to parse for the corresponding usb_ssp_rate enum. The original usb_get_maximum_speed() will return USB_SPEED_SUPER_PLUS if it matches one of these new strings. Signed-off-by: Thinh Nguyen Link: https://lore.kernel.org/r/f8ed896313d8cd8e2d2b540fc82db92b3ddf8a47.1611106162.git.Thinh.Nguyen@synopsys.com Signed-off-by: Greg Kroah-Hartman Stable-dep-of: b6155eaf6b05 ("usb: common: debug: Check non-standard control requests") Signed-off-by: Sasha Levin --- drivers/usb/common/common.c | 26 +++++++++++++++++++++++++- include/linux/usb/ch9.h | 11 +++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c index 1433260d99b4..fc21cf2d36f6 100644 --- a/drivers/usb/common/common.c +++ b/drivers/usb/common/common.c @@ -69,6 +69,13 @@ static const char *const speed_names[] = { [USB_SPEED_SUPER_PLUS] = "super-speed-plus", }; +static const char *const ssp_rate[] = { + [USB_SSP_GEN_UNKNOWN] = "UNKNOWN", + [USB_SSP_GEN_2x1] = "super-speed-plus-gen2x1", + [USB_SSP_GEN_1x2] = "super-speed-plus-gen1x2", + [USB_SSP_GEN_2x2] = "super-speed-plus-gen2x2", +}; + const char *usb_speed_string(enum usb_device_speed speed) { if (speed < 0 || speed >= ARRAY_SIZE(speed_names)) @@ -86,12 +93,29 @@ enum usb_device_speed usb_get_maximum_speed(struct device *dev) if (ret < 0) return USB_SPEED_UNKNOWN; - ret = match_string(speed_names, ARRAY_SIZE(speed_names), maximum_speed); + ret = match_string(ssp_rate, ARRAY_SIZE(ssp_rate), maximum_speed); + if (ret > 0) + return USB_SPEED_SUPER_PLUS; + ret = match_string(speed_names, ARRAY_SIZE(speed_names), maximum_speed); return (ret < 0) ? USB_SPEED_UNKNOWN : ret; } EXPORT_SYMBOL_GPL(usb_get_maximum_speed); +enum usb_ssp_rate usb_get_maximum_ssp_rate(struct device *dev) +{ + const char *maximum_speed; + int ret; + + ret = device_property_read_string(dev, "maximum-speed", &maximum_speed); + if (ret < 0) + return USB_SSP_GEN_UNKNOWN; + + ret = match_string(ssp_rate, ARRAY_SIZE(ssp_rate), maximum_speed); + return (ret < 0) ? USB_SSP_GEN_UNKNOWN : ret; +} +EXPORT_SYMBOL_GPL(usb_get_maximum_ssp_rate); + const char *usb_state_string(enum usb_device_state state) { static const char *const names[] = { diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index 86c50907634e..abdd310c77f0 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h @@ -71,6 +71,17 @@ extern const char *usb_speed_string(enum usb_device_speed speed); */ extern enum usb_device_speed usb_get_maximum_speed(struct device *dev); +/** + * usb_get_maximum_ssp_rate - Get the signaling rate generation and lane count + * of a SuperSpeed Plus capable device. + * @dev: Pointer to the given USB controller device + * + * If the string from "maximum-speed" property is super-speed-plus-genXxY where + * 'X' is the generation number and 'Y' is the number of lanes, then this + * function returns the corresponding enum usb_ssp_rate. + */ +extern enum usb_ssp_rate usb_get_maximum_ssp_rate(struct device *dev); + /** * usb_state_string - Returns human readable name for the state. * @state: The state to return a human-readable name for. If it's not 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: 9641 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp532787wru; Mon, 24 Oct 2022 09:08:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM517YXGHc0d04hTmOWgLgjE+I6XCMjaVlsfHQiHsT8GxXgqvAy/BEv7im4aqRew4l09diLs X-Received: by 2002:a17:907:3ea9:b0:78d:fdf0:88fe with SMTP id hs41-20020a1709073ea900b0078dfdf088femr29391996ejc.667.1666627716288; Mon, 24 Oct 2022 09:08:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627716; cv=none; d=google.com; s=arc-20160816; b=q2Snqff+kHqYJvLoBukKVJrRHSpb5JRB6bq7Z/OpwWSaz3tr8AvoxIaeF5mKTlG3yx h8Y7yZB0+wNZmbeLnZTSAiJwKhFbD/WbOHJmoqOTQKaR5R1Ws7TnuR281y/8GwZ7YGwO qVbux4k9WUQNynR8y6iFih/W7JJqFRTkW/PtRSOodMCHYXpAcUhkzjmorOfcJkS3cAQe aLw5ef/Xw3LpyzNPauDqiWLKWGZnv4AtPvbebF2cvwiv3hftR3fEv90e1BMcBF9omtlO FReG+rx+kwlXcU+H9oIO/zOZdb2NF8Q2JfBhnlrgcQPB1mVBnFiaW8iEAN1evnHNBmT2 h8aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lxBcLi7CCDHLtyanZOy5bvClP43P0Oqw27j2rEvb2ZA=; b=or+iG4HnuNkp1Yd2TNud8+QbMYGME/6GQRUTyGbNM7g18oNV0I3ccB7x5e16h/KSD1 Wa7r6RSS8nKX05GmvhAOh3IyilxTUsW/KwdCFjIgXWL9yZ+cuoFQMbfuTpbzf+mwVNkx PG+Luk6p7YVJVrN5kd95jqElYmhjhwN78CWY2wcbf0kf8Tbg9BTvU43wyc/B2Zbp1d37 0CLYEBwAYy7+tePwb0XKzLD3AhyXk6plwiPJhdIBHCfAB9TXFnkZRiy4Awd4wXND1MeZ 1r7Lrufc0VpCQACBSj/bSYawXMQIfHLGdId2D/iGjmqP+lVE8zaMOXz6I5x5C8dkmbvO OVFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FMTi2A0p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s19-20020a170906501300b0078ded36fa42si127439ejj.292.2022.10.24.09.08.12; Mon, 24 Oct 2022 09:08:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FMTi2A0p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232936AbiJXQHi (ORCPT + 99 others); Mon, 24 Oct 2022 12:07:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233171AbiJXQES (ORCPT ); Mon, 24 Oct 2022 12:04: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 156D31C93C; Mon, 24 Oct 2022 07:56: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 64A2AB81202; Mon, 24 Oct 2022 12:24:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B82B1C433B5; Mon, 24 Oct 2022 12:24:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614258; bh=NRSfbYdbXRVMYB9NY6/edprAupDWT9LhGIIB9kC9TEk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FMTi2A0pNtDg8N7GHr5SgVOvPv7zk9jA9kCh3mTMs5vbihZOUtQLkuzz9lISXQ0lV mWIYk7fzUcOrncfGo1U0evmaAJzAVFep440cY6+Shh6CmTgDnlM7MpBnt7DJ2u2jX6 XIhAUvMmCRmBQcyl+dxkYgdemQIpKst87BK0FMZI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chunfeng Yun , Sasha Levin Subject: [PATCH 5.10 193/390] usb: common: add function to get interval expressed in us unit Date: Mon, 24 Oct 2022 13:29:50 +0200 Message-Id: <20221024113030.992402303@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585824298877352?= X-GMAIL-MSGID: =?utf-8?q?1747585824298877352?= From: Chunfeng Yun [ Upstream commit fb95c7cf5600b7b74412f27dfb39a1e13fd8a90d ] Add a new function to convert bInterval into the time expressed in 1us unit. Signed-off-by: Chunfeng Yun Link: https://lore.kernel.org/r/25c8a09b055f716c1e5bf11fea72c3418f844482.1615170625.git.chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman Stable-dep-of: b6155eaf6b05 ("usb: common: debug: Check non-standard control requests") Signed-off-by: Sasha Levin --- drivers/usb/common/common.c | 41 +++++++++++++++++++++++++++++++++++++ drivers/usb/core/devices.c | 21 ++++--------------- drivers/usb/core/endpoint.c | 35 ++++--------------------------- include/linux/usb/ch9.h | 3 +++ 4 files changed, 52 insertions(+), 48 deletions(-) diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c index fc21cf2d36f6..675e8a4e683a 100644 --- a/drivers/usb/common/common.c +++ b/drivers/usb/common/common.c @@ -165,6 +165,47 @@ enum usb_dr_mode usb_get_dr_mode(struct device *dev) } EXPORT_SYMBOL_GPL(usb_get_dr_mode); +/** + * usb_decode_interval - Decode bInterval into the time expressed in 1us unit + * @epd: The descriptor of the endpoint + * @speed: The speed that the endpoint works as + * + * Function returns the interval expressed in 1us unit for servicing + * endpoint for data transfers. + */ +unsigned int usb_decode_interval(const struct usb_endpoint_descriptor *epd, + enum usb_device_speed speed) +{ + unsigned int interval = 0; + + switch (usb_endpoint_type(epd)) { + case USB_ENDPOINT_XFER_CONTROL: + /* uframes per NAK */ + if (speed == USB_SPEED_HIGH) + interval = epd->bInterval; + break; + case USB_ENDPOINT_XFER_ISOC: + interval = 1 << (epd->bInterval - 1); + break; + case USB_ENDPOINT_XFER_BULK: + /* uframes per NAK */ + if (speed == USB_SPEED_HIGH && usb_endpoint_dir_out(epd)) + interval = epd->bInterval; + break; + case USB_ENDPOINT_XFER_INT: + if (speed >= USB_SPEED_HIGH) + interval = 1 << (epd->bInterval - 1); + else + interval = epd->bInterval; + break; + } + + interval *= (speed >= USB_SPEED_HIGH) ? 125 : 1000; + + return interval; +} +EXPORT_SYMBOL_GPL(usb_decode_interval); + #ifdef CONFIG_OF /** * of_usb_get_dr_mode_by_phy - Get dual role mode for the controller device diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c index 1ef2de6e375a..d8b0041de612 100644 --- a/drivers/usb/core/devices.c +++ b/drivers/usb/core/devices.c @@ -157,38 +157,25 @@ static char *usb_dump_endpoint_descriptor(int speed, char *start, char *end, switch (usb_endpoint_type(desc)) { case USB_ENDPOINT_XFER_CONTROL: type = "Ctrl"; - if (speed == USB_SPEED_HIGH) /* uframes per NAK */ - interval = desc->bInterval; - else - interval = 0; dir = 'B'; /* ctrl is bidirectional */ break; case USB_ENDPOINT_XFER_ISOC: type = "Isoc"; - interval = 1 << (desc->bInterval - 1); break; case USB_ENDPOINT_XFER_BULK: type = "Bulk"; - if (speed == USB_SPEED_HIGH && dir == 'O') /* uframes per NAK */ - interval = desc->bInterval; - else - interval = 0; break; case USB_ENDPOINT_XFER_INT: type = "Int."; - if (speed == USB_SPEED_HIGH || speed >= USB_SPEED_SUPER) - interval = 1 << (desc->bInterval - 1); - else - interval = desc->bInterval; break; default: /* "can't happen" */ return start; } - interval *= (speed == USB_SPEED_HIGH || - speed >= USB_SPEED_SUPER) ? 125 : 1000; - if (interval % 1000) + + interval = usb_decode_interval(desc, speed); + if (interval % 1000) { unit = 'u'; - else { + } else { unit = 'm'; interval /= 1000; } diff --git a/drivers/usb/core/endpoint.c b/drivers/usb/core/endpoint.c index 1c2c04079676..fc3341f2bb61 100644 --- a/drivers/usb/core/endpoint.c +++ b/drivers/usb/core/endpoint.c @@ -84,40 +84,13 @@ static ssize_t interval_show(struct device *dev, struct device_attribute *attr, char *buf) { struct ep_device *ep = to_ep_device(dev); + unsigned int interval; char unit; - unsigned interval = 0; - unsigned in; - in = (ep->desc->bEndpointAddress & USB_DIR_IN); - - switch (usb_endpoint_type(ep->desc)) { - case USB_ENDPOINT_XFER_CONTROL: - if (ep->udev->speed == USB_SPEED_HIGH) - /* uframes per NAK */ - interval = ep->desc->bInterval; - break; - - case USB_ENDPOINT_XFER_ISOC: - interval = 1 << (ep->desc->bInterval - 1); - break; - - case USB_ENDPOINT_XFER_BULK: - if (ep->udev->speed == USB_SPEED_HIGH && !in) - /* uframes per NAK */ - interval = ep->desc->bInterval; - break; - - case USB_ENDPOINT_XFER_INT: - if (ep->udev->speed == USB_SPEED_HIGH) - interval = 1 << (ep->desc->bInterval - 1); - else - interval = ep->desc->bInterval; - break; - } - interval *= (ep->udev->speed == USB_SPEED_HIGH) ? 125 : 1000; - if (interval % 1000) + interval = usb_decode_interval(ep->desc, ep->udev->speed); + if (interval % 1000) { unit = 'u'; - else { + } else { unit = 'm'; interval /= 1000; } diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index abdd310c77f0..74debc824645 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h @@ -90,6 +90,9 @@ extern enum usb_ssp_rate usb_get_maximum_ssp_rate(struct device *dev); */ extern const char *usb_state_string(enum usb_device_state state); +unsigned int usb_decode_interval(const struct usb_endpoint_descriptor *epd, + enum usb_device_speed speed); + #ifdef CONFIG_TRACING /** * usb_decode_ctrl - Returns human readable representation of control request. 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: 9179 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458154wru; Mon, 24 Oct 2022 06:37:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7DU5WIwyf60PfZBgnUyim2QeQkqJbPKHRJzHTzUQy+BJxo2Q0wDhEqz1+R6Q0IGrSxYPqt X-Received: by 2002:a17:907:1c01:b0:78d:eb6e:3807 with SMTP id nc1-20020a1709071c0100b0078deb6e3807mr27715525ejc.481.1666618627414; Mon, 24 Oct 2022 06:37:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618627; cv=none; d=google.com; s=arc-20160816; b=QdIXmeedyoLEVJ5R0Efdx03VvNLKpwfqHKV1ce43D6ZA3LvYxfGluPVkGaHYkiR8Vk AGeAUlt1WpwHzcYHncC0yB1RT/Rr7llLfAK7cpliehmEbnOZlUsUm/rXmzfZO5hQ3iqp Bdi7nSlmEj4zN3XGTp61OQ8XO2GAsxZdUTO56XhWQ+OEK9V3glTAo2Xal95saenUvrD5 CT/t85yZgPqlEqNxzFf/g5UNucmTKbcRymjAiiajQTcV8vCL+05zTkae2ozK3DD3e+CV HCBdlCo7mUXD9pkx47+8l15pQSUaz1G2oz59wiR2mmJ5vuClZfKdjGJ5BfBAzCVRveDK jqqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OYCtBgg1MZPt3TMlCLzrXEdCS/x2GShFdw1vrsKGzR0=; b=F6qAJMC3JloYVESwG2A2e9SkBsVNMRvnHwxngh8bF8SN2yIie7yAqMo1W9Bc73QCQ1 60Wol6l1IzX5HVaobXQoYe/Ut7Js10ZCsj8myFt1ivhGZg3RrBYfwtFhcqN0QhE/Cr8z JoqhYcu7jXWb1PfKE4Bhtr7LdQZudf+N19HdTqm3+ITCt3oK9a7vt6sAISmQ2+oAN0X+ 7uMG0no/Z0iQVm3vR/gpOZCwG4w5ipZcAonSB6sBACDjkw3mteGGasuOaPKGFTeEUQO0 t0JK1HBum06D9kT2VbiGKXkB3MQQwM7OHUQRWd6e8WmptwLcRFTgPWqFZFYqntSw/nR2 kMPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=C6iPPK0x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm14-20020a170907948e00b007a641e472f0si4049287ejc.139.2022.10.24.06.36.33; Mon, 24 Oct 2022 06:37:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=C6iPPK0x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232165AbiJXNPt (ORCPT + 99 others); Mon, 24 Oct 2022 09:15:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235956AbiJXNOO (ORCPT ); Mon, 24 Oct 2022 09:14:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28ED44D25C; Mon, 24 Oct 2022 05:25: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 52ED161014; Mon, 24 Oct 2022 12:24:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63928C433D6; Mon, 24 Oct 2022 12:24:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614260; bh=G7yQmlG15qLGRBXl5CbjEbT4FRrYyB5hzuKiF+8nL4g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C6iPPK0x5pYjn6MoYJhrXmQGRxYPHeZmQNtRJ5yB4c66Gy/lAcpE9fZ4YXQCA2+V5 Zy+6ZI6rHkzrGOzW3g3xHnchdk4WxHUzcNv8Ep/UKIi+tass9IXn+RNBclvKJQZoZH 7UoPt8KbD1Q3L0lsBlEN/je9Rt6YS0BuEBKyji1c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , Chunfeng Yun , Sasha Levin Subject: [PATCH 5.10 194/390] usb: common: move functions kerneldoc next to its definition Date: Mon, 24 Oct 2022 13:29:51 +0200 Message-Id: <20221024113031.042222617@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576293626042216?= X-GMAIL-MSGID: =?utf-8?q?1747576293626042216?= From: Chunfeng Yun [ Upstream commit 365038f24b3e9d2b7c9e499f03f432040e28a35c ] Following a general rule, add the kerneldoc for a function next to it's definition, but not next to its declaration in a header file. Suggested-by: Alan Stern Suggested-by: Greg Kroah-Hartman Signed-off-by: Chunfeng Yun Link: https://lore.kernel.org/r/c4d2e010ae2bf67cdfa0b55e6d1deb9339d9d3dc.1615170625.git.chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman Stable-dep-of: b6155eaf6b05 ("usb: common: debug: Check non-standard control requests") Signed-off-by: Sasha Levin --- drivers/usb/common/common.c | 35 +++++++++++++++++++++ drivers/usb/common/debug.c | 22 +++++++++++-- include/linux/usb/ch9.h | 61 ------------------------------------- 3 files changed, 55 insertions(+), 63 deletions(-) diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c index 675e8a4e683a..347fb3d3894a 100644 --- a/drivers/usb/common/common.c +++ b/drivers/usb/common/common.c @@ -25,6 +25,12 @@ static const char *const ep_type_names[] = { [USB_ENDPOINT_XFER_INT] = "intr", }; +/** + * usb_ep_type_string() - Returns human readable-name of the endpoint type. + * @ep_type: The endpoint type to return human-readable name for. If it's not + * any of the types: USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT}, + * usually got by usb_endpoint_type(), the string 'unknown' will be returned. + */ const char *usb_ep_type_string(int ep_type) { if (ep_type < 0 || ep_type >= ARRAY_SIZE(ep_type_names)) @@ -76,6 +82,12 @@ static const char *const ssp_rate[] = { [USB_SSP_GEN_2x2] = "super-speed-plus-gen2x2", }; +/** + * usb_speed_string() - Returns human readable-name of the speed. + * @speed: The speed to return human-readable name for. If it's not + * any of the speeds defined in usb_device_speed enum, string for + * USB_SPEED_UNKNOWN will be returned. + */ const char *usb_speed_string(enum usb_device_speed speed) { if (speed < 0 || speed >= ARRAY_SIZE(speed_names)) @@ -84,6 +96,14 @@ const char *usb_speed_string(enum usb_device_speed speed) } EXPORT_SYMBOL_GPL(usb_speed_string); +/** + * usb_get_maximum_speed - Get maximum requested speed for a given USB + * controller. + * @dev: Pointer to the given USB controller device + * + * The function gets the maximum speed string from property "maximum-speed", + * and returns the corresponding enum usb_device_speed. + */ enum usb_device_speed usb_get_maximum_speed(struct device *dev) { const char *maximum_speed; @@ -102,6 +122,15 @@ enum usb_device_speed usb_get_maximum_speed(struct device *dev) } EXPORT_SYMBOL_GPL(usb_get_maximum_speed); +/** + * usb_get_maximum_ssp_rate - Get the signaling rate generation and lane count + * of a SuperSpeed Plus capable device. + * @dev: Pointer to the given USB controller device + * + * If the string from "maximum-speed" property is super-speed-plus-genXxY where + * 'X' is the generation number and 'Y' is the number of lanes, then this + * function returns the corresponding enum usb_ssp_rate. + */ enum usb_ssp_rate usb_get_maximum_ssp_rate(struct device *dev) { const char *maximum_speed; @@ -116,6 +145,12 @@ enum usb_ssp_rate usb_get_maximum_ssp_rate(struct device *dev) } EXPORT_SYMBOL_GPL(usb_get_maximum_ssp_rate); +/** + * usb_state_string - Returns human readable name for the state. + * @state: The state to return a human-readable name for. If it's not + * any of the states devices in usb_device_state_string enum, + * the string UNKNOWN will be returned. + */ const char *usb_state_string(enum usb_device_state state) { static const char *const names[] = { diff --git a/drivers/usb/common/debug.c b/drivers/usb/common/debug.c index ba849c7bc5c7..a76a086b9c54 100644 --- a/drivers/usb/common/debug.c +++ b/drivers/usb/common/debug.c @@ -207,8 +207,26 @@ static void usb_decode_set_isoch_delay(__u8 wValue, char *str, size_t size) snprintf(str, size, "Set Isochronous Delay(Delay = %d ns)", wValue); } -/* - * usb_decode_ctrl - returns a string representation of ctrl request +/** + * usb_decode_ctrl - Returns human readable representation of control request. + * @str: buffer to return a human-readable representation of control request. + * This buffer should have about 200 bytes. + * @size: size of str buffer. + * @bRequestType: matches the USB bmRequestType field + * @bRequest: matches the USB bRequest field + * @wValue: matches the USB wValue field (CPU byte order) + * @wIndex: matches the USB wIndex field (CPU byte order) + * @wLength: matches the USB wLength field (CPU byte order) + * + * Function returns decoded, formatted and human-readable description of + * control request packet. + * + * The usage scenario for this is for tracepoints, so function as a return + * use the same value as in parameters. This approach allows to use this + * function in TP_printk + * + * Important: wValue, wIndex, wLength parameters before invoking this function + * should be processed by le16_to_cpu macro. */ const char *usb_decode_ctrl(char *str, size_t size, __u8 bRequestType, __u8 bRequest, __u16 wValue, __u16 wIndex, diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index 74debc824645..1cffa34740b0 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h @@ -45,76 +45,15 @@ enum usb_ssp_rate { USB_SSP_GEN_2x2, }; -/** - * usb_ep_type_string() - Returns human readable-name of the endpoint type. - * @ep_type: The endpoint type to return human-readable name for. If it's not - * any of the types: USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT}, - * usually got by usb_endpoint_type(), the string 'unknown' will be returned. - */ extern const char *usb_ep_type_string(int ep_type); - -/** - * usb_speed_string() - Returns human readable-name of the speed. - * @speed: The speed to return human-readable name for. If it's not - * any of the speeds defined in usb_device_speed enum, string for - * USB_SPEED_UNKNOWN will be returned. - */ extern const char *usb_speed_string(enum usb_device_speed speed); - -/** - * usb_get_maximum_speed - Get maximum requested speed for a given USB - * controller. - * @dev: Pointer to the given USB controller device - * - * The function gets the maximum speed string from property "maximum-speed", - * and returns the corresponding enum usb_device_speed. - */ extern enum usb_device_speed usb_get_maximum_speed(struct device *dev); - -/** - * usb_get_maximum_ssp_rate - Get the signaling rate generation and lane count - * of a SuperSpeed Plus capable device. - * @dev: Pointer to the given USB controller device - * - * If the string from "maximum-speed" property is super-speed-plus-genXxY where - * 'X' is the generation number and 'Y' is the number of lanes, then this - * function returns the corresponding enum usb_ssp_rate. - */ extern enum usb_ssp_rate usb_get_maximum_ssp_rate(struct device *dev); - -/** - * usb_state_string - Returns human readable name for the state. - * @state: The state to return a human-readable name for. If it's not - * any of the states devices in usb_device_state_string enum, - * the string UNKNOWN will be returned. - */ extern const char *usb_state_string(enum usb_device_state state); - unsigned int usb_decode_interval(const struct usb_endpoint_descriptor *epd, enum usb_device_speed speed); #ifdef CONFIG_TRACING -/** - * usb_decode_ctrl - Returns human readable representation of control request. - * @str: buffer to return a human-readable representation of control request. - * This buffer should have about 200 bytes. - * @size: size of str buffer. - * @bRequestType: matches the USB bmRequestType field - * @bRequest: matches the USB bRequest field - * @wValue: matches the USB wValue field (CPU byte order) - * @wIndex: matches the USB wIndex field (CPU byte order) - * @wLength: matches the USB wLength field (CPU byte order) - * - * Function returns decoded, formatted and human-readable description of - * control request packet. - * - * The usage scenario for this is for tracepoints, so function as a return - * use the same value as in parameters. This approach allows to use this - * function in TP_printk - * - * Important: wValue, wIndex, wLength parameters before invoking this function - * should be processed by le16_to_cpu macro. - */ extern const char *usb_decode_ctrl(char *str, size_t size, __u8 bRequestType, __u8 bRequest, __u16 wValue, __u16 wIndex, __u16 wLength); 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: 9128 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456447wru; Mon, 24 Oct 2022 06:34:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM48krlCS/nRb4cpr0tCRQ3VKqTHCnGSP0BKdjF9PY/c4ABGCaGo0H0hNrVhtdrSwb7bm/AQ X-Received: by 2002:a17:902:e752:b0:186:9efb:71f3 with SMTP id p18-20020a170902e75200b001869efb71f3mr7516135plf.153.1666618452543; 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=F6WNhN7WXwsbTMMjNooZPAp3T9z5qWz0tLRkRct0Ori7klWREHyZwe0HCZV+fzhPVZ 7sBXjeT7JUHVF1l42iQmzlHNE+nfAKBw+cfPAWQp68vBRckVC2ChMD4bUD9ORg+AJ6Ks 7PL8hA7QcpXBiskXLW5DBhpYP4pxYznO5QMDaH4XpdhE76iPVChbN7IRxE1lQvecGM/5 SBANxIkLaaXNF6GAWI2mrX7uKcVPa2DKuwIUSegUP7+pzDNiJaw4hSaebsEg+tqmAXUx 4GzRjpa6AsgKD/uhTiTN/RsJpeRK50ujqakhZaN3ERRKDrr0mF1fn4CJ810W4Rn2l4wX LUSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Xa5TSfiOnx1XUzItiLLkFdylmV85lijPVC90xq1eFwg=; b=0LB1Is5YIfSlxrnvf0CUNlUFxOMY/Wa3VTaAfmPZCAJvsLA6iJrX6m2ROjTBvzgs1d MUsMgNDmYD4VqEpXsXk0Y+1EaBhTdBxljMPNS5/ZOnhGPE8DZNMLLPunxEfeIQHQyRaV RmXaYW32Z02WtgoIuaaxW+7Q2cxpclIXF0nUscz1AMT8Fv0qVvVTFTBN+GwsNGvRMjHw Bq6XZv7owjlQaI/9qigYeIl7U8qmkm3i3f6SlJowF7ERJsx+QRleoo/V6pMTDL8LMaZf 144SEiDmAqjUVr0c9g+It2/Qibo37i4erLfP2UtM0Jw8/cgVmB37a6WeqZ3G7eYs3qM8 lMCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yYqNnsrc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a6551c3000000b0046b2ea05986si31654346pgq.63.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=yYqNnsrc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230388AbiJXNVU (ORCPT + 99 others); Mon, 24 Oct 2022 09:21:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236306AbiJXNTw (ORCPT ); Mon, 24 Oct 2022 09:19: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 081C22BE04; Mon, 24 Oct 2022 05: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 dfw.source.kernel.org (Postfix) with ESMTPS id DE7D76126B; Mon, 24 Oct 2022 12:24:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2747C433D6; Mon, 24 Oct 2022 12:24:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614263; bh=7AuFi6EBGKuPcwP8T4Kg4oFE8Bg46RXanDC8ZkVyVKw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yYqNnsrcwKyMKrvDOKOhTuJn8ky485f6OBV4Ys71Nz3m2mIIyYUqKZYNVESh/bR5S tV5pYwKV5fZ15+XSvRjRGiGGQbHYC3N64ZOgtdGeGtjQPYFWgN3F5ODtD/QGFv7vBq nPeDeEGzAQuGS/oEwBxewwMQ9EZfKwwPQKzLrRxY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thinh Nguyen , Sasha Levin Subject: [PATCH 5.10 195/390] usb: common: debug: Check non-standard control requests Date: Mon, 24 Oct 2022 13:29:52 +0200 Message-Id: <20221024113031.092416629@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576110461603255?= X-GMAIL-MSGID: =?utf-8?q?1747576110461603255?= From: Thinh Nguyen [ Upstream commit b6155eaf6b05e558218b44b88a6cad03f15a586c ] Previously usb_decode_ctrl() only decodes standard control requests, but it was used for non-standard requests also. If it's non-standard or unknown standard bRequest, print the Setup data values. Fixes: af32423a2d86 ("usb: dwc3: trace: decode ctrl request") Signed-off-by: Thinh Nguyen Link: https://lore.kernel.org/r/8d6a30f2f2f953eff833a5bc5aac640a4cc2fc9f.1658971571.git.Thinh.Nguyen@synopsys.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/common/debug.c | 96 +++++++++++++++++++++++++------------- 1 file changed, 64 insertions(+), 32 deletions(-) diff --git a/drivers/usb/common/debug.c b/drivers/usb/common/debug.c index a76a086b9c54..f0c0e8db7038 100644 --- a/drivers/usb/common/debug.c +++ b/drivers/usb/common/debug.c @@ -207,30 +207,28 @@ static void usb_decode_set_isoch_delay(__u8 wValue, char *str, size_t size) snprintf(str, size, "Set Isochronous Delay(Delay = %d ns)", wValue); } -/** - * usb_decode_ctrl - Returns human readable representation of control request. - * @str: buffer to return a human-readable representation of control request. - * This buffer should have about 200 bytes. - * @size: size of str buffer. - * @bRequestType: matches the USB bmRequestType field - * @bRequest: matches the USB bRequest field - * @wValue: matches the USB wValue field (CPU byte order) - * @wIndex: matches the USB wIndex field (CPU byte order) - * @wLength: matches the USB wLength field (CPU byte order) - * - * Function returns decoded, formatted and human-readable description of - * control request packet. - * - * The usage scenario for this is for tracepoints, so function as a return - * use the same value as in parameters. This approach allows to use this - * function in TP_printk - * - * Important: wValue, wIndex, wLength parameters before invoking this function - * should be processed by le16_to_cpu macro. - */ -const char *usb_decode_ctrl(char *str, size_t size, __u8 bRequestType, - __u8 bRequest, __u16 wValue, __u16 wIndex, - __u16 wLength) +static void usb_decode_ctrl_generic(char *str, size_t size, __u8 bRequestType, + __u8 bRequest, __u16 wValue, __u16 wIndex, + __u16 wLength) +{ + u8 recip = bRequestType & USB_RECIP_MASK; + u8 type = bRequestType & USB_TYPE_MASK; + + snprintf(str, size, + "Type=%s Recipient=%s Dir=%s bRequest=%u wValue=%u wIndex=%u wLength=%u", + (type == USB_TYPE_STANDARD) ? "Standard" : + (type == USB_TYPE_VENDOR) ? "Vendor" : + (type == USB_TYPE_CLASS) ? "Class" : "Unknown", + (recip == USB_RECIP_DEVICE) ? "Device" : + (recip == USB_RECIP_INTERFACE) ? "Interface" : + (recip == USB_RECIP_ENDPOINT) ? "Endpoint" : "Unknown", + (bRequestType & USB_DIR_IN) ? "IN" : "OUT", + bRequest, wValue, wIndex, wLength); +} + +static void usb_decode_ctrl_standard(char *str, size_t size, __u8 bRequestType, + __u8 bRequest, __u16 wValue, __u16 wIndex, + __u16 wLength) { switch (bRequest) { case USB_REQ_GET_STATUS: @@ -271,14 +269,48 @@ const char *usb_decode_ctrl(char *str, size_t size, __u8 bRequestType, usb_decode_set_isoch_delay(wValue, str, size); break; default: - snprintf(str, size, "%02x %02x %02x %02x %02x %02x %02x %02x", - bRequestType, bRequest, - (u8)(cpu_to_le16(wValue) & 0xff), - (u8)(cpu_to_le16(wValue) >> 8), - (u8)(cpu_to_le16(wIndex) & 0xff), - (u8)(cpu_to_le16(wIndex) >> 8), - (u8)(cpu_to_le16(wLength) & 0xff), - (u8)(cpu_to_le16(wLength) >> 8)); + usb_decode_ctrl_generic(str, size, bRequestType, bRequest, + wValue, wIndex, wLength); + break; + } +} + +/** + * usb_decode_ctrl - Returns human readable representation of control request. + * @str: buffer to return a human-readable representation of control request. + * This buffer should have about 200 bytes. + * @size: size of str buffer. + * @bRequestType: matches the USB bmRequestType field + * @bRequest: matches the USB bRequest field + * @wValue: matches the USB wValue field (CPU byte order) + * @wIndex: matches the USB wIndex field (CPU byte order) + * @wLength: matches the USB wLength field (CPU byte order) + * + * Function returns decoded, formatted and human-readable description of + * control request packet. + * + * The usage scenario for this is for tracepoints, so function as a return + * use the same value as in parameters. This approach allows to use this + * function in TP_printk + * + * Important: wValue, wIndex, wLength parameters before invoking this function + * should be processed by le16_to_cpu macro. + */ +const char *usb_decode_ctrl(char *str, size_t size, __u8 bRequestType, + __u8 bRequest, __u16 wValue, __u16 wIndex, + __u16 wLength) +{ + switch (bRequestType & USB_TYPE_MASK) { + case USB_TYPE_STANDARD: + usb_decode_ctrl_standard(str, size, bRequestType, bRequest, + wValue, wIndex, wLength); + break; + case USB_TYPE_VENDOR: + case USB_TYPE_CLASS: + default: + usb_decode_ctrl_generic(str, size, bRequestType, bRequest, + wValue, wIndex, wLength); + break; } return str; From patchwork 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: 9898 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp573322wru; Mon, 24 Oct 2022 10:37:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7fgDRxlrZO1Ukqzay4m69PvAGzi4sL9ZnDrJ9ZTN++H+wLZA2jviSPfT1NDc977b3Tzq66 X-Received: by 2002:a63:4307:0:b0:464:a24d:8201 with SMTP id q7-20020a634307000000b00464a24d8201mr29484802pga.116.1666633073137; Mon, 24 Oct 2022 10:37:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666633073; cv=none; d=google.com; s=arc-20160816; b=NrTwXGVsmS1S1NMLaWwFFHEHX9U0YbNVB5ZCzVl2x5vF2mGZvoQPDvhJmz3X+C4b7r eJOAUYRd/7KIk08h/Jcyh1D5Yjuw1rPpFCK6MRonezdyXVSLYofCRdtDG7ul3pn9u1PU 24KbiXFKssHTIZiu70ASuRTgfI66V5GSfZgvNHX9IL3qYT1V/W/rwt31Q9HjhUT+Cfeg xBS0yD5uHvh5xmHSMrUqiYhOs4uuFVnBTKGNPOaq6UbeKtKfmL/6RebnyTZDAfwIyooD Uh6tN4ylLXfgPow2H4iotwX/uiveYAhU96mr6jcFLP87L7bNTEAlN4NL+f/1wLT0vToG VxvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2BlO5xQw41sr32b5hHQGkkyeUyT1l3KYFYQsFEdeIqA=; b=IA0Z7v+30FlurFnLNcfJjHzBpJhvdY21nUhhkYcrRlqsgCF16FLQZG5deiDVbt+2nh uHqU5jQvoDRqvxqq/De2SGMdtpKUIkyFgGqUudtxQm9p3e1kqmQgUM92/YQa6t0Iloip KmqQ6mZg/ci5S0BBjXUmik62SrkCFi70k8VQSpifxi5WxESyDmCL8qN43tHwfaoW6Rt8 hd74HAS6UvctE0ckUtwh7kUWSH9KCLluGE/dynxh86h54gKZF6gLW3YNrVSP3RP7O7BH +4+bTPKBxiYIoOPLdczH+QBJnj32rABaYztjAOhtqiT8MpUJjsKVizyjAieiZ3s7FHFl DN9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=amSUHUND; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j190-20020a6380c7000000b0046b2ebb0a4esi100714pgd.212.2022.10.24.10.37.39; Mon, 24 Oct 2022 10: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=amSUHUND; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233082AbiJXRhJ (ORCPT + 99 others); Mon, 24 Oct 2022 13:37:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233614AbiJXRgl (ORCPT ); Mon, 24 Oct 2022 13:36: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 9FF46237967; Mon, 24 Oct 2022 09:11:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4E0E9B81675; Mon, 24 Oct 2022 12:24:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A0E8C433C1; Mon, 24 Oct 2022 12:24:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614266; bh=eSPGLgJoJM+kPIS2tJYcph+18AVY0zIp3pvdV3W6xAw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=amSUHUNDcDxuAWJRy9rXcvezA0fSXCJ7Y/iUdjd/dvPzQcm9y4DwYAxhRnYWtFkeQ QBzTqsmurr15XmVCQnBXFxgDFNHszIDxsFEzUpINt2oLn0tJDGZ/Ae6503ct07K/01 +1IFKqxGCXPTvix4OsVCDjHyXbpZjrqSDi7oEvgU= 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.10 196/390] clk: meson: Hold reference returned by of_get_parent() Date: Mon, 24 Oct 2022 13:29:53 +0200 Message-Id: <20221024113031.133178832@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747591440782345651?= X-GMAIL-MSGID: =?utf-8?q?1747591440782345651?= 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 3a6d84cd6601..67d8a0d30221 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 862f0756b50f..1da9d212f8b7 100644 --- a/drivers/clk/meson/meson8b.c +++ b/drivers/clk/meson/meson8b.c @@ -3735,13 +3735,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: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: 9159 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457773wru; Mon, 24 Oct 2022 06:36:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5M0ILxoE+XvXARnKJ94pbgOPtIOEezbTp41zcouYRH124HLJ2s01HAbnRMIPzbJHBx+ofz X-Received: by 2002:a17:90b:4f46:b0:20d:1fe8:dcd2 with SMTP id pj6-20020a17090b4f4600b0020d1fe8dcd2mr73953731pjb.235.1666618589919; 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=InGMiDc9BK+JwO0bABeVs3uqbkPfasUpENYZGvVzKC0Je+fgrci8VEwEKBu+CGmiVu 3O+kj1fLJxL69tmpcr4nE+4G+Kw4VkxBLaOscLLrwwa7/re1BLm4IFl4A9yoiY80D9qp e6BlGd6KdoMyZ0UhdO8Q72Jj0MjST8tU0gtZKmF5E3IlVVTsoG1JAv/oT5o48idQznpo x73KyO99NLd6wVukaLdlX23vod/ZbQUQOO61+pc/3LYNU1FW0WRZjUVaJnJY26j36sVj 8O4UD9QTZ13bG1yRfSkp1F23ixVq1M6JKpIMzzyQpWALFfuF+BMDDRjqIaWo/6ohBU2I LZag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=wDaz6IqlcKGtPc9ACfv3Ro4PG5fC+d2E1e0ny4Snpbng06wg8Vlrceo/FacfMSofcM jmCe7zsXOYQygTBXDe+/zMiUbmlD62jrs6bLOAXWGQKwuQOzuBsLA5SX1DDcboGISyTB 60/v43/8NgFsGAT/Rg0UPUsbPX+qZI+LDfHTiVbGSou7q12JNb1FcV2uDmloJdI1Jnvr pAsjDgvdBq5/pcCiWCDtof4FbkFGquufcza8p8QwHs8IA2RRZg2h+bJ/zzsJC+sK6TmO NTs0wWK/HIwI+mr+O2LyhTB9koUvw5PdLflIj5WEHmqAOPuf9zl2Aioqzz17XpI++7sN 3lQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Dk/yO7XN"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n1-20020a170902e54100b001786a4a4c98si37301199plf.371.2022.10.24.06.36.15; Mon, 24 Oct 2022 06:36:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Dk/yO7XN"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235847AbiJXNP7 (ORCPT + 99 others); Mon, 24 Oct 2022 09:15:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235971AbiJXNOP (ORCPT ); Mon, 24 Oct 2022 09:14:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1C474DF0C; Mon, 24 Oct 2022 05:25: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 3507A612A3; Mon, 24 Oct 2022 12:24:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 485A4C433B5; Mon, 24 Oct 2022 12:24:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614268; bh=X38VWH2et6l8j7ErF92H2f0hZx1DchmzPhdw98JHFCs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dk/yO7XNLdXdk3Q6+gn0IYdQcVtPKKocsAgjD+ZbiIVapUztDSsDEFhSrkzj92dBD u2A12sHrZw9zNURwb19ht1BEYkrerspdOm9UU6ImPvt0hKxd5eEcAs5ZPOwKhpRsnv sN00X6kGOhGnsEUPTv8Fk50ckrxDGDs+lU+vO73Q= 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.10 197/390] clk: oxnas: Hold reference returned by of_get_parent() Date: Mon, 24 Oct 2022 13:29:54 +0200 Message-Id: <20221024113031.181032661@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576254710136770?= X-GMAIL-MSGID: =?utf-8?q?1747576254710136770?= 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: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: 9604 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp529626wru; Mon, 24 Oct 2022 09:03:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7x8W07dFFPbs9TapWahIp3Qvw8gbYYFUHOQXbJ5bY4+E/SAXgwNr20G6yfIjcRxbN/4J69 X-Received: by 2002:a17:907:3f96:b0:7ab:34aa:9094 with SMTP id hr22-20020a1709073f9600b007ab34aa9094mr1071527ejc.85.1666627434939; Mon, 24 Oct 2022 09:03:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627434; cv=none; d=google.com; s=arc-20160816; b=ypmHEYsAa8MUqaAH+CqZ8z9shzajSdDi+kEoWXVPpMOwMIvFSsJH7ErTRj6NNmalWm XIpCwU7Kf6Ru9Z1+KeaGSXdlb7SLnNcRCkO7jrOkugU3wwqDE0vlenu4v4Sf4XWwqleU xDgI48AHwZaFhaSv5DpNv1pjwEQ51IodmZGEzeAXlzV2HyZQYdcP57j6MguFXyd677r9 AIDZ5Yg6i+4sG4uetG9JrH2WG6Lsue7zC8vAkzJnF7anYyMQqk9oQ0VhExBXZFb+gDgq 9XVNyWbcPSqELzubfZ6eYyYsfoyvD9wXZNH9+++7HiwbJfpMl9VUeEDtoRKYUMr+OzV8 nJSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mLavZNKqVDoEjEFgmDk0e91XaGgO8/49pC07pdDteAc=; b=WAaxQ2iXezdqJJAWRY59HL+v2xA5mIAcYCSRzu7dlLuv8vxddKvYBEHGCY3J/zpupe K/aX0toS4xphQdzxrbWIoQSIp+8x/G6TaH3LBdTYdrCgFMCJmUxQNeuqWaDyJNVFIfmw 2Z7aU+dbVyG9qvCPNWGcS6o7uytncDsNTLAkICwY8uvL+K2EoquZDUDwUthAIv6Icnuj fuIBKepCinQBWcM349YCz/5oVCv/VPg3esYGjlOFSdNvaAkGEQHwyIpqDYAfCkHfFqbW iJYKI8TBxNCdmYruZNgZpJawQT6ISEJPQM7j7RxqmbT/Tqfhy45sy69l6UDkeQJt5KT4 hvkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jbFLjQxN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a1709067c8300b007a9fc5516f6si101145ejo.307.2022.10.24.09.03.23; Mon, 24 Oct 2022 09:03:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jbFLjQxN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232618AbiJXQCD (ORCPT + 99 others); Mon, 24 Oct 2022 12:02:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231224AbiJXP72 (ORCPT ); Mon, 24 Oct 2022 11:59: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 0446F7C746; Mon, 24 Oct 2022 07:55: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 85716B8161F; Mon, 24 Oct 2022 12:24:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0153C43470; Mon, 24 Oct 2022 12:24:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614271; bh=2UfDFvTBsGwHOUUmiH/Y0L6Lg35b+1hInQVnRyomgCY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jbFLjQxN8vTj7kkrJiT9YOF2iA0ZM9ei7AMrouUhiIpWFaB1RO+M1q01o+G6+ItCf 4x5r+2TqhK8Su+3NR/3MDRLDFaeCAHqGXoIFhO7+RDjfj6+7U+epWXnRJqlWUMwGwx kXyL5+GrDyNAbGpxS6GFz00n5DEzhrG42O2yk0RM= 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.10 198/390] clk: qoriq: Hold reference returned by of_get_parent() Date: Mon, 24 Oct 2022 13:29:55 +0200 Message-Id: <20221024113031.213438217@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585528952913596?= X-GMAIL-MSGID: =?utf-8?q?1747585528952913596?= From: Liang He [ Upstream commit a8ea4273bc26256ce3cce83164f0f51c5bf6e127 ] In legacy_init_clockgen(), we need to hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance. Beside, in create_sysclk(), we need to call of_node_put() on 'sysclk' also for refcount balance. Fixes: 0dfc86b3173f ("clk: qoriq: Move chip-specific knowledge into driver") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220628143851.171299-1-windhl@126.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/clk-qoriq.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c index 46101c6a20f2..585b9ac11881 100644 --- a/drivers/clk/clk-qoriq.c +++ b/drivers/clk/clk-qoriq.c @@ -1038,8 +1038,13 @@ static void __init _clockgen_init(struct device_node *np, bool legacy); */ static void __init legacy_init_clockgen(struct device_node *np) { - if (!clockgen.node) - _clockgen_init(of_get_parent(np), true); + if (!clockgen.node) { + struct device_node *parent_np; + + parent_np = of_get_parent(np); + _clockgen_init(parent_np, true); + of_node_put(parent_np); + } } /* Legacy node */ @@ -1134,6 +1139,7 @@ static struct clk * __init create_sysclk(const char *name) sysclk = of_get_child_by_name(clockgen.node, "sysclk"); if (sysclk) { clk = sysclk_from_fixed(sysclk, name); + of_node_put(sysclk); if (!IS_ERR(clk)) return clk; } From patchwork 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: 9174 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458083wru; Mon, 24 Oct 2022 06:37:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5vAnVQaQip76POsHLj6OYmWdWQ2O/lMUs9NleP6xj0sLTIDw8qx8Q8moeDNrjmh5kK8yGM X-Received: by 2002:a17:902:c942:b0:180:3f94:2975 with SMTP id i2-20020a170902c94200b001803f942975mr33406834pla.50.1666618611633; Mon, 24 Oct 2022 06:36:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618611; cv=none; d=google.com; s=arc-20160816; b=bkZidGgEw4j4y4OKDLrN5IhxaPNfS6PXAXqfFLh4O2E+DvnPDONZdjDtfvZZmj0vQn lzCn8C6jSUw2bGtt/HicS92k+vQ3vh2tcoeN1OAaCbJsAqVv7s/yCyvX8Idz0hYyb9Md 4VFfLuccb6GmwS0hapmqEuPbHf6oWgRxVf+bZANbKS2GVZh2jclIqPbBHllyG+Z28TSl e1/TAHTUQfwdADGtKEud8smcPoXX0BereJHD/fX7dmJCu/QJbu6WibGEKnK/vP53HA0d 3//HVFlf0TN52J2vCFummKtAj5/w/Nds0s92Go/3oBrNoPHLYemmeScrPNSJgUewSmtt lC7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=ayA+Ql1Zd5EIiwOQxbF3o5iTzcXqRDsy3eGerQznFXDwscg59DLo3vv5CBzu7MCZT4 ZtODrebe6hnBTzvtWmkOy1W0UqejLUY6ifYZ2lZEABZBr9y6okxvt25UGWQ/PeNTgXH8 1rKMKwZdRLTh/WjeRxFMohCethtaKjkNP2P176rm6ahsf2Odt38dK1rrTpBD5jLxZeM2 l6KzqscIa1U/Sjl3wcdu0SZB1nfnfU+wPx2sjA7Md3f5bXpDngkz7KTim73E+AbmVut+ zgYnmSkNDgXgZr6eIWHJEr1S4rZvU26cpkcCCeW8KjAYY3vbZPF9B1mMjeakkbU/csye wYUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Xuuz4J9S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oj17-20020a17090b4d9100b002132abf9ad6si1030814pjb.148.2022.10.24.06.36.15; Mon, 24 Oct 2022 06:36: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=Xuuz4J9S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235851AbiJXNQE (ORCPT + 99 others); Mon, 24 Oct 2022 09:16:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236010AbiJXNO3 (ORCPT ); Mon, 24 Oct 2022 09:14: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 BF992558F6; Mon, 24 Oct 2022 05:25: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 79983612DF; Mon, 24 Oct 2022 12:24:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BA06C433C1; Mon, 24 Oct 2022 12:24:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614273; bh=aMhgMqMGgRl1+zscEHQn3kdfGb1OaQRYRmBXmXDblFE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xuuz4J9SvyE18GpjJQZPFfjQreME7g+kOXum7ZuXKC7pem0EzXzV23yPb1IR7xh9v T7SW0c02HMSf4BteNd1mx5SRXLCvU4Q0q2AqBTBzSK6851FSokij74/2LTznNs2zDn RWIGbbEUIWgWojp11jcDXnbMF6SV9J9mhKwn6uE4= 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.10 199/390] clk: berlin: Add of_node_put() for of_get_parent() Date: Mon, 24 Oct 2022 13:29:56 +0200 Message-Id: <20221024113031.260034287@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576277350375333?= X-GMAIL-MSGID: =?utf-8?q?1747576277350375333?= 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: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: 9667 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp534897wru; Mon, 24 Oct 2022 09:12:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5VGmr2uKBDQu6jOHQykoE7Zx+qunjan+WqoZh+x8YVinw2ZhFMMMdoM8VyUbOO8L69PJ5V X-Received: by 2002:a17:902:bcc4:b0:181:899a:ac9c with SMTP id o4-20020a170902bcc400b00181899aac9cmr34173063pls.124.1666627920871; Mon, 24 Oct 2022 09:12:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627920; cv=none; d=google.com; s=arc-20160816; b=fZr2ZxKsBln7zOS0xa88f/kagr+F7tW/cR7R79qQ9FL7jWqaOhK38ggatZo/R5MaGV JA2tuWbMKomdgm9Nwe+YYI8fWxnqUiw8qcxmonwAiDy1774M1FWHqeNnMvYHQ8Og8p8C ilsGU1fiqDqhx/ELzs+X/ZxsIiURI0/7MSalGZXEJoDnUfX3+q361ppG4+8XmmfPxmZI 7zuiFu9mjQysI5JRA5lgvQNu5BSaa91m8PRYcgADc16UuYe0yeeANHyZ8nqDb51sTxZU iLj104XCRwaMTGssHQtGKDCuplFfgyULIGE2ficER96MfAE9AnaTASSeZG1K8FD1wdUP c1wQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4BIP7yCJkEfhe91Lk7KXrUGr2g1NopchynjnoQZ5RxI=; b=bb4QaJzihIOQQqmmGG3BL1ylBuK57+ZDXYSqYHZQp6WahS06pr2G0oUEdFR4od+8/s v0/zWtowThGmhU43Pb/6g5DQQEBY/Q1Jr1/P2pkmWKcguTXPtRt5+E6y/VCN+JLH+NuD HfCmKB7gUbi8NOjGg1WjMsJGyox8K+hJ0W/IqJhk7XzPHN48xIFmO8QLlak+S/RvquRa mZUMquSnO88OPVwaiZQPG9kY2OR128YNXdOsbvE4p4vRb2nl/ZqLZ1QJvQ2P2swiuHae NvOkXyZ3RkADlr+b316C64t6DJJey3ex98UxsYxWk68dmeWpVtnWzj904zIN9bWPKSM1 zFDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=19aNddWx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n6-20020a654506000000b0044b817adee1si34651677pgq.78.2022.10.24.09.11.46; Mon, 24 Oct 2022 09:12: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=19aNddWx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233260AbiJXQKl (ORCPT + 99 others); Mon, 24 Oct 2022 12:10:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232803AbiJXQDZ (ORCPT ); Mon, 24 Oct 2022 12:03: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 7775814030; Mon, 24 Oct 2022 07:56: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 CB5C3B81670; Mon, 24 Oct 2022 12:24:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CC1AC433D6; Mon, 24 Oct 2022 12:24:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614276; bh=I0US6l38rqGsDxa7m8QNmS8D7lDmiOG+/urZP2mhyxI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=19aNddWxjDTkK+DCtGgp+KPgsSZdyRn+LiQfUlFg6XVgfslTj/MkGd14omW/xjTAw LHuSWeX6WXi/3utR+Sw5IdKmU0vr9Li7of4X0HBvgJ7wzO1516IWVWW8uyLIWfFOFo nsVXS5Jhqab5KEa8wmrJelNsltDA///M0WRLoeoQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Orson Zhai , Stephen Boyd , Sasha Levin Subject: [PATCH 5.10 200/390] clk: sprd: Hold reference returned by of_get_parent() Date: Mon, 24 Oct 2022 13:29:57 +0200 Message-Id: <20221024113031.292062805@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747586038412780992?= X-GMAIL-MSGID: =?utf-8?q?1747586038412780992?= From: Liang He [ Upstream commit 91e6455bf715fb1558a0bf8f645ec1c131254a3c ] We should hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance. Fixes: f95e8c7923d1 ("clk: sprd: support to get regmap from parent node") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220704004729.272481-1-windhl@126.com Reviewed-by: Orson Zhai Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/sprd/common.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/clk/sprd/common.c b/drivers/clk/sprd/common.c index d620bbbcdfc8..ce81e4087a8f 100644 --- a/drivers/clk/sprd/common.c +++ b/drivers/clk/sprd/common.c @@ -41,7 +41,7 @@ int sprd_clk_regmap_init(struct platform_device *pdev, { void __iomem *base; struct device *dev = &pdev->dev; - struct device_node *node = dev->of_node; + struct device_node *node = dev->of_node, *np; struct regmap *regmap; if (of_find_property(node, "sprd,syscon", NULL)) { @@ -50,9 +50,10 @@ int sprd_clk_regmap_init(struct platform_device *pdev, pr_err("%s: failed to get syscon regmap\n", __func__); return PTR_ERR(regmap); } - } else if (of_device_is_compatible(of_get_parent(dev->of_node), - "syscon")) { - regmap = device_node_to_regmap(of_get_parent(dev->of_node)); + } else if (of_device_is_compatible(np = of_get_parent(node), "syscon") || + (of_node_put(np), 0)) { + regmap = device_node_to_regmap(np); + of_node_put(np); if (IS_ERR(regmap)) { dev_err(dev, "failed to get regmap from its parent.\n"); return PTR_ERR(regmap); From patchwork Mon Oct 24 11:29:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9937 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp599506wru; Mon, 24 Oct 2022 11:46:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7U099YWRddCN3sQjSujkVyF/ih3oh4j+KiQuLMIz07v0Cs7mESOeozLCImaUjlhHLLnsiE X-Received: by 2002:a05:6a00:21ca:b0:569:92dc:2949 with SMTP id t10-20020a056a0021ca00b0056992dc2949mr22817707pfj.63.1666637160872; Mon, 24 Oct 2022 11:46:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666637160; cv=none; d=google.com; s=arc-20160816; b=z9JQcMxRIXZoJnLXU97MsXSez3MsMUExl3hRogqr7mpoOu2YJRk3DKk7RaXpc3n39E Tao1yFc864hHMH60DTDULZzegcDUx1Lsl45POMZ+9WhVpGTXk9H2+vw/CfWocbc0elta 6u+Uzu/3WjTdGu1OekDuByLKsBevE8kktk4SYDrRtetA1sygCvLWgNtAnnB2rqi8FfAw En7LYO0SU5HCEN79yDxx6HKHXjXAZBnJUvrfeHjuTupSTlv7JMa/borWgYsTuuTUQKgE uxWdb9Q9V4QcID7Mnw08gW475zK1jAB+umog7nSXqDQMLJfvetvHUn/xzUbVcu9pASVD a6aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TZ5TppctqoxW4EspE/FSm5Md3eq5I44hNRg0H+gxelw=; b=v3OoWMh3eJRcwA07c7IbtFv6W+/sbwWwtARyBNTm/MTucee9CEXO/1IufJkaD3MEcv K7acMSndd8raNmdPOV4Z8msAda5ErItbuCeeX1Rqs0US4oJAzJG04aJTR7Y1Yis66Uec s9G9zLIivNLmwsx4PdsMxwtW737WFai4ggN1S4w+xB7x4aeQJiZIK0wPF3hBGAO6FDfW uVIpzAFAYoU7BQwdlV+7fHZPuzqKqmEjH+MXDde85xPaNbzMhtLld4cL59jRuySzHTkq 3Kx0j4+JruyRAZUVG20VUN6I8huevurLkdJJ+VKBrkV7yt4zFsUcTrWrD3G2q+U55bxx PS5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kgoATkMN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y187-20020a638ac4000000b00461f10556b9si267183pgd.319.2022.10.24.11.45.46; Mon, 24 Oct 2022 11:46: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=kgoATkMN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231266AbiJXSpS (ORCPT + 99 others); Mon, 24 Oct 2022 14:45:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232739AbiJXSoP (ORCPT ); Mon, 24 Oct 2022 14:44:15 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B900E1D6A53; Mon, 24 Oct 2022 10:26:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id EBC47CE13C9; Mon, 24 Oct 2022 12:24:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C35E8C433D6; Mon, 24 Oct 2022 12:24:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614279; bh=Rma330vcrlPVgoryXY524v5pSS75fKfndTwK6rcbUcQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kgoATkMN1gE6O7w+exk0YoT0awam6IXnlwm0fefgTHkWDcmHKwf7Rh1/17Qgi+Gig Ihn68rIaROdB4r5/vs8xIwSi17aTkuQ/nAqclPoj/ZpL+yrmnFwGAsgrWgGQ3oN5xr vTC5PqyuA/b3S8FmS/2d3aalhs7gIvH+Oc4KAqV0= 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.10 201/390] clk: tegra: Fix refcount leak in tegra210_clock_init Date: Mon, 24 Oct 2022 13:29:58 +0200 Message-Id: <20221024113031.324305472@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747595727288047224?= X-GMAIL-MSGID: =?utf-8?q?1747595727288047224?= 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 68cbb98af567..1a0016d07f88 100644 --- a/drivers/clk/tegra/clk-tegra210.c +++ b/drivers/clk/tegra/clk-tegra210.c @@ -3697,6 +3697,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: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: 9114 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456150wru; Mon, 24 Oct 2022 06:33:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4rYigoz0cVLtYxQwuruaZPiSkIfHB6IPe1TKaB7cVpRFoCA8TaGhfksts/3PZou8nkvvUP X-Received: by 2002:a17:907:72c5:b0:798:1c8f:5bc7 with SMTP id du5-20020a17090772c500b007981c8f5bc7mr19461296ejc.119.1666618419912; Mon, 24 Oct 2022 06:33:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618419; cv=none; d=google.com; s=arc-20160816; b=gcA4mYPUdLlzUaz3YvKFVrv0GvMLluljXyNuJbUKh2DxvIevdT2O1cr/1Hikzcbn90 CSh2C736Mqw0WXwIndhmpwrYeFqE/nh4dRocun3wFGkTjdvn4VcqExTodcMGP0HLrKF1 BigE6l6cYJ+eJvO5onnSdQf2A9grrf4L9PwKd5PgSBP/RyQXQFF2D39VNnMnUuc+/OAx ZRLnTzoXNH4LIRbVwR0Da+iNtjxZVjJ5umvg0+sW07Xhu103jiNl+8o82rTxOZVEhA4g stztOlUIwQx3HitPyvZqcXBe/n2f13Ih6USezx7Wvr7kuhtKDjtc9OsyiPpbRLSArm/t v2WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=osn3Sd73uGpMJqv8P4LvWhZI9l3c41gqPT3e1Sbrpx8=; b=yoJYrZOq/nuWhuuJPfiZzM3XS0USUwTxWaIL9Mu5RBCzjVGoaYOJSNmnis6P8jQPL1 1qyyboneU0CfvJXEGXtoLkxZi6yVO2v3XfW1GlDb6Id+acXXix3rXeYD2oa+kcISTQ2d AcQ2ygOy3ViwDUC0McEgmZCj1or/HuEStC594ObjWkBwR7titUr4zPP/QZSe5jaOJ7Sp m4O1jehlmWEpl5DaSVA2FkCLhOtA/0cgtyxQ6nEZeMQ1gjcBsGVmcLlJt3eQ0chXkwD4 GvUh81FJQc0e64H2Gmxpj6iKEXLlUFmxio1C5FVu1MWpS+KFaa5Rnw0BrqiI+kLbL38W cnXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ycmx8ge0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w19-20020a056402269300b00461eb5cdcdcsi1271149edd.23.2022.10.24.06.33.14; Mon, 24 Oct 2022 06: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=Ycmx8ge0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235872AbiJXNQV (ORCPT + 99 others); Mon, 24 Oct 2022 09:16:21 -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 S236067AbiJXNOj (ORCPT ); Mon, 24 Oct 2022 09:14:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90A8395AE4; Mon, 24 Oct 2022 05:25: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 0278061313; Mon, 24 Oct 2022 12:24:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 129B4C43142; Mon, 24 Oct 2022 12:24:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614284; bh=MYOwrjZCrWWsWxaSojRO2Wg1Ovu0P0g0HHH/slM/tnw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ycmx8ge0P7Ev8oCpg0b1RYVW3PzJkAMC+hdIICzl8umvQ2r/PatTEn44Tmg0xIuCL LWfmZRA6DIMxr3DgLRfjNe21NYYVVPFerdb1gctQpalXW/xvLbTsTmEtmlSzDY2+Ov xHgXjfZD4PAyxm3ecaWDTP/RfULhXnCckTKVCnRY= 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.10 202/390] clk: tegra: Fix refcount leak in tegra114_clock_init Date: Mon, 24 Oct 2022 13:29:59 +0200 Message-Id: <20221024113031.365776719@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576076449360136?= X-GMAIL-MSGID: =?utf-8?q?1747576076449360136?= 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 bc9e47a4cb60..4e2b26e3e573 100644 --- a/drivers/clk/tegra/clk-tegra114.c +++ b/drivers/clk/tegra/clk-tegra114.c @@ -1317,6 +1317,7 @@ static void __init tegra114_clock_init(struct device_node *np) } pmc_base = of_iomap(node, 0); + of_node_put(node); if (!pmc_base) { pr_err("Can't map pmc registers\n"); WARN_ON(1); From patchwork 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: 9230 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp460889wru; Mon, 24 Oct 2022 06:42:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5w1HQFMRRVPljYZJ0jeFXQJaAf12w6o4gJcHyV2qdMVut5bkiXn3Cl7Yzirre1iSpKw6j7 X-Received: by 2002:a17:907:1629:b0:79d:aa05:3783 with SMTP id hb41-20020a170907162900b0079daa053783mr13412351ejc.637.1666618959995; 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=R8NTWOCh3f1ouom38vogIDFmEr7IEjP8n7aQGrU3arnSGhtHTbyFa3tLzCDLzrgOSs BTQqlKkJoPUlvkZyXEiLHJgo78SdyEfCQbcv6H9EvIR6+EN7tNg2VTCnncF81Ehj5h6O ebujWsVHGAGBLN87qtRtDc75lMXWvkKLzZjp1Ke2fCncgGSijgw11ohGR/QyEct0scS3 5Rg7VwgIGeU6RsgwwUYwNYOO0gobwuQyo4+LEzvFEnIL31f3e8+P+w7bb64KNyed2pAK HYVRYKWjAJWeROzhtSJXsRz4lLYwoONMzk+APWuqa0iXqWW7zbDlm5gQbiCwfzoRkokZ uXBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wDjoUycN1XHXyhfm01KXyzEWfOOFWww7WItoA4pWywM=; b=on1Xdp5TkYX56sAoZmyZ7lRsBduf00HgSiEL28loCpNP7wR53J7xKoiS82ZNz7djKv rR9V1/8+uzFBbVLon8EB1v3vvAPBpCdV6QIjrS9yi9De8rnwFm1MFxsT1PkIkdwyXI6z kBSJ+lSKjJHiFB/oJUQ3azcNg3xEZMHOk9g5eMxkBjWRrB79rAfvOS3p4nnLX5pVD2UF TgxFVfjPicoJNMBphHQy9qL9ZPpf9Cp/XRYyqbipRHOnwB7B7suc0OAoh/3kjefTFLzK TiS+rCBqi67yLVQAFDy+CE8Diejvn09IO7E95BXcqbnRvpQ/LNKs59vItkgLrRTW57S7 51Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DmjPDoLo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv12-20020a17090760cc00b0078c4a772ea7si31643885ejc.11.2022.10.24.06.42.08; 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=DmjPDoLo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236309AbiJXNfS (ORCPT + 99 others); Mon, 24 Oct 2022 09:35:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236278AbiJXNaV (ORCPT ); Mon, 24 Oct 2022 09:30:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 661BBAC2B3; Mon, 24 Oct 2022 05:32: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 BE88A612CC; Mon, 24 Oct 2022 12:24:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A95F5C433D6; Mon, 24 Oct 2022 12:24:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614287; bh=PIqKj/TL1AZgCYVzWnfq/gi2T+cDG3qbmjoKC5z60WE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DmjPDoLortLSUO4Yg6gR59MjLVN+F8SaBQr9uZXK/i2w9bp2caExAT8VIZUhjIPXP ccYl4O7Bwg39G15szD7/jkxEV1sb4qB24OxNbZG5218H23Qh0F2/FEPyOFV1G532Tz ryDeaEzLhdMLjKpzjQAkvOY9fDYfxLrxX/1RaOKQ= 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.10 203/390] clk: tegra20: Fix refcount leak in tegra20_clock_init Date: Mon, 24 Oct 2022 13:30:00 +0200 Message-Id: <20221024113031.399780773@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576642583189296?= X-GMAIL-MSGID: =?utf-8?q?1747576642583189296?= 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 3efc651b42e3..d60ee6e318a5 100644 --- a/drivers/clk/tegra/clk-tegra20.c +++ b/drivers/clk/tegra/clk-tegra20.c @@ -1128,6 +1128,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: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: 9101 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456054wru; Mon, 24 Oct 2022 06:33:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4W75uWWrgZDUbhO0P3X0uSRXSa9QuGB5EYXrdrxSru3fatVGXhqWPzxRZKMjxjn5KucDBu X-Received: by 2002:a63:4a41:0:b0:452:bab5:156a with SMTP id j1-20020a634a41000000b00452bab5156amr28315241pgl.486.1666618409975; Mon, 24 Oct 2022 06:33:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618409; cv=none; d=google.com; s=arc-20160816; b=lowSh4hpIFadbreOt1S5exHYG55fFLHxUK7RhMoWKgH+x8p4nyjP+2n6G0E2iF327g BPZyMDjEnGCgg9Jk+kYIRqKYOI95dkqed6eizItEqORQRLqzRmI15lw4rLYGkZyWXpMa ep5cJFKl5kmq1YqcpDjUjqDJl4McDypuNhKbXxFGg+fdZQCfdMLWo9qyG1sMqU8ElO/R CT2ywSB67TunkLqsaq0E2rtIe//1BG30bl2Ndk94PadRkbeJD08lSZTp5s13Z9PPm9bj 4lhXGXYSZTditlPa+Kl5EuXgkGFfb3TdZpAOP7IqvxUSHnohE/ldi8zUVABgvnpWmb9h h5UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lmx/nv93+kUb6SouQSoeHr3oc8jzJ7zazO2KrXqcVXI=; b=VGRPIeeIqsZGJ09oHuM2Tro7INBQkONxe9XWD9Iq/6ZT8H30XIac63A5bdpGowy8D4 U6aDL54N5Hej+z0uQUsTDs33Hi0dwAkF2djSGLt0CkgWysmSUoZ54FUZ6gsnVf/R/BFx hOI8NMlFMQ6Rvl8WOxMjdU8RAuyL+yxaPXpl7MkVUH12itIydbRD2NTAn+CqxGoySDY8 CFj3XVPiDnL3FYQjRDBvFJIgVyMuH//PsIo1Gw3BmymxWF8nAFIad1mqlCLJuHolIOeS lBtreBpWXZ08mrS6jOJcMqMQsrcaHyaatOY6iEtc0qckxr82J2Lwf4eS9SIXbA2dPyqi EX5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ghy5+okF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056a000ccd00b00536fa6bbb11si36605136pfv.344.2022.10.24.06.33.14; Mon, 24 Oct 2022 06: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=Ghy5+okF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235864AbiJXNQQ (ORCPT + 99 others); Mon, 24 Oct 2022 09:16:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236073AbiJXNOj (ORCPT ); Mon, 24 Oct 2022 09:14:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 936239AFCC; Mon, 24 Oct 2022 05:25: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 63681612A1; Mon, 24 Oct 2022 12:24:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76875C433C1; Mon, 24 Oct 2022 12:24:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614289; bh=9+NtXeXBvF4Ebv92J6wPhWRQ5nQ9JXpxZQzq7UfEEhk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ghy5+okFY+dduo6exq/tztphZ0q11IeYjVtoYArDW4jq1JfP2+sU5n7hq1BtAF+7S DFgQS1ChGrQeDRxUm6poIAh12l+aw5pnuM/ntzeFSFFEZyK4+osVF31C7qgzUBp69f +Hu/dcGp/8PivLTPpoEfWLOOtOaZxZ+bbtZl33F8= 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.10 204/390] HSI: omap_ssi: Fix refcount leak in ssi_probe Date: Mon, 24 Oct 2022 13:30:01 +0200 Message-Id: <20221024113031.440807604@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576065342065486?= X-GMAIL-MSGID: =?utf-8?q?1747576065342065486?= From: Miaoqian Lin [ Upstream commit 9a2ea132df860177b33c9fd421b26c4e9a0a9396 ] When returning or breaking early from a for_each_available_child_of_node() loop, we need to explicitly call of_node_put() on the child node to possibly release the node. Fixes: b209e047bc74 ("HSI: Introduce OMAP SSI driver") Signed-off-by: Miaoqian Lin Signed-off-by: Sebastian Reichel Signed-off-by: Sasha Levin --- drivers/hsi/controllers/omap_ssi_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hsi/controllers/omap_ssi_core.c b/drivers/hsi/controllers/omap_ssi_core.c index 44a3f5660c10..eb9820158318 100644 --- a/drivers/hsi/controllers/omap_ssi_core.c +++ b/drivers/hsi/controllers/omap_ssi_core.c @@ -524,6 +524,7 @@ static int ssi_probe(struct platform_device *pd) if (!childpdev) { err = -ENODEV; dev_err(&pd->dev, "failed to create ssi controller port\n"); + of_node_put(child); goto out3; } } From patchwork 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: 9608 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp529777wru; Mon, 24 Oct 2022 09:04:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4vsqmion9Pd2fJZEXvkEqB3n0MJVKA5oSaWeMl61i0EO516ln5x38ztXQZHVx/FC/USRd0 X-Received: by 2002:a17:90a:7e14:b0:210:dcec:ffe9 with SMTP id i20-20020a17090a7e1400b00210dcecffe9mr30364226pjl.157.1666627447634; Mon, 24 Oct 2022 09:04:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627447; cv=none; d=google.com; s=arc-20160816; b=qB8WwPALW2wUUS0s+dlWgdjB21QrtLiaezieOgIZ78Kqb8QUDzKf4F4ckXbUgIVaG2 sj/NOBrdoAnnvrFdT6zEIXiOWfkZt6fMxHIBrwxn9gTGaeitCw0m62vRienf0E/BrLhP 7fg8EJnrwL79uS+Ojp+uQMbty8o2KqYYi5p/C+5Ewpa+sf3gW8mhv7gCspSyeToH4yxL uxCbhA442TLvQf2EbkzpnH3GFJOugMELceEhQnWaBH/WnrxjnYEFT8eI6OL72I2/3B3j LXAQwnqF3T8isdmArE/TPDJjf8jhnxekXh70B6JSUViLyLIpWDTBmtAKE8kcXCv48dEY csTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=R0JKPQC43hQ2nxGCqGnA4IQzj33YDKw+jfXyx+l5gevV0OW7DUxkvO5zaCS6GQycbr RFR+gedZRIuO10DHXiuA7zaiOLJLWrUpPYEGOdEYxb8VtOpyvxI4lLWUkwaYlwrXvgzy /znGW1QCRq9scOh766IkdbrjqAdyyzKUOAiOz9XsI2CWSra/ejp6dycAoWXE0o0POTYn PIs8qXIoefY+GWC/OZWvGH0iSztJhcloQvhxVGC7uN+QP7lD/DI0YbyEdg4IsucAe9hs bzG/DjvsDQSMGvGBG6E1yBHt0RJktei7Rdi7N7oWWfU1esPpMx1mv4g/Sx5Kiuc+9O8b wS9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cToAPegr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m24-20020a635818000000b0041cd5c0295esi31571525pgb.852.2022.10.24.09.03.54; Mon, 24 Oct 2022 09:04: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=cToAPegr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231545AbiJXQCo (ORCPT + 99 others); Mon, 24 Oct 2022 12:02:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232473AbiJXQBW (ORCPT ); Mon, 24 Oct 2022 12:01:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE57D5A825; Mon, 24 Oct 2022 07:55:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B128BB8167B; Mon, 24 Oct 2022 12:24:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17CB7C433C1; Mon, 24 Oct 2022 12:24:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614292; bh=K4roTK2fnCmQiAynGRZx39W2zSKfyzroDBihQQeCMlI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cToAPegrfsR0k+zkHi2E+ZLte5uBq3z+ypo9m6b0v/JRzgIOtMxSpfNibHs6w4ITx /ALoRo4SHGWoXdmMvXvylWuPw1sdJEq3ytXmPT6Kubl70lhpk8I9Ougd/aWu0Oxqhj fKZNnwCK3nGDemOd63GBkd43a9JznnmNbZxPdw4U= 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.10 205/390] HSI: omap_ssi_port: Fix dma_map_sg error check Date: Mon, 24 Oct 2022 13:30:02 +0200 Message-Id: <20221024113031.491119305@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585542349656972?= X-GMAIL-MSGID: =?utf-8?q?1747585542349656972?= 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: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: 9126 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456438wru; Mon, 24 Oct 2022 06:34:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5gmieq6L5CfwYtogfUsyh5KjsxwFYc3ZFNEV/ujSW1cVf4NOWO/bzVF2FKGl5gpvj5VFeJ X-Received: by 2002:a05:6a00:1a44:b0:52a:ecd5:bbef with SMTP id h4-20020a056a001a4400b0052aecd5bbefmr33105974pfv.28.1666618451631; Mon, 24 Oct 2022 06:34:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618451; cv=none; d=google.com; s=arc-20160816; b=QEFpIN0ndfGS9QgZanESY6r6ZW/LbgfBBbOgMauwicOdfvWBkN1Oy3J+nyFGHEqp9V 7TmhH4JvUwotgVFXjr0N7OSP4O7MJb1s81om4ueV21DFriPhiCGw3xiqUeG3WD5OccPH bo56WnygfEnbT/nqRY3tgiuMP4Ge8QgcAbw5bPTbP6DPkxW7+Fd51T/UQoM9Q0N7ovgA HZUdcUcivNLf+rr3QQO9rfIqPphkWvHhQJD5jsz2DlPV4Xpkoi0OG7YQaVenvKSxHjmf ajrKj+nohWCZ1L9kD+u+U6Qdp92Egc1KP/l4srMUVG9GKwEktDgrn4EcWpZYKOr4higt hABA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=i0k2Vmb6o83as9jEQxadMrmqK6a10rNAgKxQbBK9tp4=; b=FHJnaqGWtJL+xWjtdPUzGqNgsKncuISu0pFOrcYCV6jBg/Ary6QwPe16X6SKL31H+U J8zcaJXDFagIdvuYb4rPAk3RpIG6lQ70ARt8WsqisdOVpMvwvoSA1oTr2i0gvTbj3Q92 DVF/hssWHfD7bcDCEHDds7Cmtlm2GXw1De5GAHjjTpPcVGhpRdUY1YwgCuee3w3Ao5HV Lb2GvAeLHdB4aUhzw+SzlHnZLv3tZ+DaeUIQPL3NZ/hhE8Xdrrdo5E61VX2r2JjkwnlA iKVwufFyHGZNegD087gbM5+vd9q8L96PST760cF5/7PDdQ+3+QlqlpLfK9CRRNqtkPNp rLcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XclhKWIj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l7-20020a170903120700b00178a33f89f1si38130980plh.267.2022.10.24.06.33.52; Mon, 24 Oct 2022 06:34:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XclhKWIj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235924AbiJXNVQ (ORCPT + 99 others); Mon, 24 Oct 2022 09:21:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236272AbiJXNTp (ORCPT ); Mon, 24 Oct 2022 09:19:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D5E484E6E; 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 dfw.source.kernel.org (Postfix) with ESMTPS id A8798612E7; Mon, 24 Oct 2022 12:24:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B18C4C433C1; Mon, 24 Oct 2022 12:24:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614295; bh=xnezvrP/hKkBp2MwA9j44y/EoiumJaeOfO3sR5XKtVY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XclhKWIjRKZHnMWNr9aBKqgtaRtmqiwD1ygh7gUYZj/hnjoasGg5XH9JFwWaEkhyO H7v7HPP/ZTjqEO80D/EIb+/MCyaE+IYmUI29IoIy9duasbNaF04Vdhxr0vwH0tUPYQ Zcs+cpv9dx5LQ02AjIONKoVI5arK2eav87cvS8Dk= 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.10 206/390] media: exynos4-is: fimc-is: Add of_node_put() when breaking out of loop Date: Mon, 24 Oct 2022 13:30:03 +0200 Message-Id: <20221024113031.541577286@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576109467722182?= X-GMAIL-MSGID: =?utf-8?q?1747576109467722182?= 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 dc2a144cd29b..b52d2203eac5 100644 --- a/drivers/media/platform/exynos4-is/fimc-is.c +++ b/drivers/media/platform/exynos4-is/fimc-is.c @@ -213,6 +213,7 @@ static int fimc_is_register_subdevs(struct fimc_is *is) if (ret < 0 || index >= FIMC_IS_SENSORS_NUM) { of_node_put(child); + of_node_put(i2c_bus); return ret; } index++; From patchwork Mon Oct 24 11:30:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9108 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456095wru; Mon, 24 Oct 2022 06:33:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM42lADJiTg/UC+RaCwjcnY6nLmv94U39IOz62as/pGhixp7/Jm+XBr8yaARIlI/BVqqpM7y X-Received: by 2002:a17:90b:4a09:b0:20c:316d:e58b with SMTP id kk9-20020a17090b4a0900b0020c316de58bmr74606530pjb.217.1666618413695; 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=end7YLZXoCJXJYqBbhqDWNxG4nQIbg9U17UvSttSL+EOfPDeKEAgQTXnScoQI5qqjb SAyWxMNkf9orgdI3l03l3LBRfnD65lJSlda+gjpF4uTkAy1iem+ALxd5S9wSdR6nh8os teXcA+oQrV4CpVAojutrQrJ35ibR9mSCjKP+oHOC0Ff7HyuLC7BBPFRnxJHV7enwRaO0 VIXw3vSQkgVPIbNlZqmznqvOTM4PqqBIid9dMUPkOIweDFzgFiRKjTmH0QA4kkbZPopu /u5i7oRhxrxRrG6Dyo7EeSaH4nyf3SH6kW1HeKfgTq6sgNoURlm/wAm1wNFB/ZAk913+ imoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EkOuZeephq1I5logVvo+1WsEQR7um+UBGCaZVCPrzdQ=; b=RwNkPlztAz1LM3Vx22M7qWJ5Pt8ZtZnI6ZWkaSAqYWzriTcsqpdhespTsjsiXI+vMM k7o/wWCbACLopCGN1yept/2/xaoGd2Eq+Fp/oFSNCsYxYXGGyBYhy1gpRzyoiWmSpSdz 3Xnop/dQWIzElcagDn79g8s3x+Ib3zlhon795Rirz6iB1Ln42bBgDO2jAiCUOwJ/4yTv 10TlOQYqW2lCUMyfMf/Zm/Iv3Mqtq2cbfl9YjqsRYahdLYQUF6TMM4o+B/w7YDSQMz66 Okcc4rvZy/MuNbCvRY0AWEPRafLiIRAurhMppUAAsZKeQsXJFM5gbB+a7mEl+K0cYAQp DB0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fbCS+pPX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bu3-20020a056a00410300b0056c0a9e09f0si357954pfb.292.2022.10.24.06.33.19; 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=fbCS+pPX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230414AbiJXNRE (ORCPT + 99 others); Mon, 24 Oct 2022 09:17:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235817AbiJXNPj (ORCPT ); Mon, 24 Oct 2022 09:15: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 0AFC3A23DE; Mon, 24 Oct 2022 05:25: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 3D9E7612CF; Mon, 24 Oct 2022 12:24:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D698C433C1; Mon, 24 Oct 2022 12:24:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614297; bh=oTg7CPOJxYAvFd77/5cg9hTGZkS8zJbP5ZCy7OrxxK0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fbCS+pPX8872H4U0SM8UT/O+kDGDKEyIpd/mPngzp4dtZyHhh75GBo0tIJsUJOGkS s76bp7BVCs8ITVLt60sCz5th/UKcMLiu9Va1dw3zweN0O7s9NOhrrmaIwErwC8Z34D QEbNNsUgVczmkgSrWyHog/ExF1EzXy7YL4Defg+8= 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.10 207/390] tty: xilinx_uartps: Fix the ignore_status Date: Mon, 24 Oct 2022 13:30:04 +0200 Message-Id: <20221024113031.592085925@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576069951734109?= X-GMAIL-MSGID: =?utf-8?q?1747576069951734109?= 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 b5a8afbc452b..f7dfa123907a 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -375,6 +375,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:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9599 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp529577wru; Mon, 24 Oct 2022 09:03:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4pZTjnsV+KEVf8CzBEEI9+78pqm+n5f/XNz5g3bbniCaA/M1rt5oyq9VRRJCLGCm0YWgTJ X-Received: by 2002:a17:903:40cd:b0:186:8869:739c with SMTP id t13-20020a17090340cd00b001868869739cmr14055059pld.97.1666627429502; Mon, 24 Oct 2022 09:03:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627429; cv=none; d=google.com; s=arc-20160816; b=NLUG5bLv2BxXourTlbH/dJoHXJlqP+cAmVbXCx2/mbCmbTJgtJ4bWiKPx8HKebHjU3 nU4SPu7QePV5sqR8H0pblvcmYia3/eOPW7XAwh2bluEG7e8ckbbqowBx1Nv9XANZSA7m neVx8+CgOtXOQ0DPnDrpbg2nU9r57KWkk1sf3Eodq8WOZdrd9RI4Z4jwIUJN5wFtEBqC 1OM+F86tY4uwVj8iFzxJWimk9y/XM9AD6/cu6v+gz6aKmmwUnB7IHh0A5B8FkhO+jnPq abnZV5ERfkXykJbn28borqBmpcVJnn4PCKjkPnwnIKDSbaRZIE9AKy68ur6pt9Hrvpkt RPvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XhWVOrWp1pGGSeEQALigQ8X9+kgy5G8IEinUpuJjHGU=; b=Mr7YI7b6a/gTG3EXAbCkf4WMxEEhxJRj15RqhxJfXB9zTMBadIdTBLAxVp4xCsD5X7 5hAgjV19m+9XtDD0fYNo+nI4euHrRB1ZHWepVKiFqzQkR1K/ut7Jxlo+Lpx5BK9pxF36 1ZSR60B2A+aQsd1kFk15i3NHdFz5FmafYAaDQWK8lhaDQiUOTkPJWaW3fXG9t2roYYzq lf6XDSYgbc7ZvY4I3jlpeL1L3bsCvOEDeHbRtDwmns+c7OcWv3oiwbfdu3aSbnRDJW+K F+GNuZozikuaxXD+T+FaRDA8hm7OZzJSgNKLyG7oY1lGc5gl4ECVvKPttqP4nPyBLOmt Jz9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Y+bqk5G5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a639306000000b00461f10556b9si34376551pge.319.2022.10.24.09.03.29; Mon, 24 Oct 2022 09:03: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=Y+bqk5G5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232640AbiJXQCM (ORCPT + 99 others); Mon, 24 Oct 2022 12:02:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232292AbiJXQAS (ORCPT ); Mon, 24 Oct 2022 12:00: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 E5F5F89953; Mon, 24 Oct 2022 07:55: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 84DD2B81676; Mon, 24 Oct 2022 12:25:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC469C433D6; Mon, 24 Oct 2022 12:24:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614300; bh=lU1rMge4AvOB32EqEc1cYUnGuxCTzQQf26R06XK4qiY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y+bqk5G5Ad70nrU8SlzPsI7bwJKaRTQjAemU3+k8Dhqpv9izFDa2XHY+l/0WtMWxO sZAqtQX3UvKbC3tUjvtr0HzU9ddanZfxj2sFch/wYRJ1M5tDgkIBZqxUTPxyx/cjb5 /H80JbvZXuhGZsEOwl6bNW3lADHkojc4M+r88Vt4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xu Qiang , Neil Armstrong , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.10 208/390] media: meson: vdec: add missing clk_disable_unprepare on error in vdec_hevc_start() Date: Mon, 24 Oct 2022 13:30:05 +0200 Message-Id: <20221024113031.637131515@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585523478171681?= X-GMAIL-MSGID: =?utf-8?q?1747585523478171681?= From: Xu Qiang [ Upstream commit 4029372233e13e281f8c387f279f9f064ced3810 ] Add the missing clk_disable_unprepare() before return from vdec_hevc_start() in the error handling case. Fixes: 823a7300340e (“media: meson: vdec: add common HEVC decoder support”) Signed-off-by: Xu Qiang Reviewed-by: Neil Armstrong Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/staging/media/meson/vdec/vdec_hevc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/meson/vdec/vdec_hevc.c b/drivers/staging/media/meson/vdec/vdec_hevc.c index 9530e580e57a..afced435c907 100644 --- a/drivers/staging/media/meson/vdec/vdec_hevc.c +++ b/drivers/staging/media/meson/vdec/vdec_hevc.c @@ -167,8 +167,12 @@ static int vdec_hevc_start(struct amvdec_session *sess) clk_set_rate(core->vdec_hevc_clk, 666666666); ret = clk_prepare_enable(core->vdec_hevc_clk); - if (ret) + if (ret) { + if (core->platform->revision == VDEC_REVISION_G12A || + core->platform->revision == VDEC_REVISION_SM1) + clk_disable_unprepare(core->vdec_hevcf_clk); return ret; + } if (core->platform->revision == VDEC_REVISION_SM1) regmap_update_bits(core->regmap_ao, AO_RTI_GEN_PWR_SLEEP0, From patchwork 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: 9648 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp533185wru; Mon, 24 Oct 2022 09:09:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7yTXmwPy/cXkFlynR2XsR2AnXSgHHhFTAGjn12cWbm6kSz1BrDQZvUZGLyB3eQnCenmcL4 X-Received: by 2002:aa7:c58e:0:b0:461:77b:7bd with SMTP id g14-20020aa7c58e000000b00461077b07bdmr20637358edq.387.1666627749211; Mon, 24 Oct 2022 09:09:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627749; cv=none; d=google.com; s=arc-20160816; b=AnSqPmnaY4TVJ65tW+ehde954zwITwvXV/su3VTo7myN32xP7XESHMm1dPcRRJPJPz BWl7XxNsI0PQKSLNlhwui3xMGJKNcva4A5tGSYVxLKSuuxMB9jQkgxMy0vfSkSTbCxRS MPM1D+nxd9xlp2jDi+tPViPU+qvbhFqZ1gkLVxUpQKpV3ct/6Yay5GPmD1oaC54cezc3 nSjYIFXOGHVa705DmFXI5E73aH4/orlR+UEd9/nAl57hy4S19TQt6j5EmaxOrpu5JmuK VpWKYLGsF8OJmuYLwH3+lLm7/m0/PzX4n8i/VQrVfFOYWeGRmRhTuEVgXVCKG87jVnXB AEKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=jN0fIezkjt6p8dd0t4NoAnmwaNZQp64lzCDC5oBUZFVVUlVpUZ/8MegYW7UKS8CV+x QGZbsF77GW+xOQ4YuE+aSi25Ui1/8+pDwRaSNbBCgoajgM9iagaVn92bFX0M7MVpKD2E D4jRCWpzJaY5wWU/+d9tLXYVU1RUbNhY+mAmMdSb3PPAAE7rEVXqzTzO693vcEFMx2tI sTP57KxwPtBv3eC7E6lZMN17EjAX2EQEDfwPdLS1k4iIb+3TF+//CCyzhUrf5faTZ59o /UdPLiZ43ZlOUE13IEiQzaprQ6c5x73FLW/UJsw/Rz4ma8OdW227sDbo/JNMecj+wnmw dCLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KZmOpVJt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u1-20020a170906950100b007830f14fffesi113438ejx.375.2022.10.24.09.08.43; Mon, 24 Oct 2022 09:09: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=KZmOpVJt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233391AbiJXQH6 (ORCPT + 99 others); Mon, 24 Oct 2022 12:07:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233240AbiJXQEY (ORCPT ); Mon, 24 Oct 2022 12:04: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 B56ED11A977; Mon, 24 Oct 2022 07:56:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 21BF2B8128A; Mon, 24 Oct 2022 12:25:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79094C433C1; Mon, 24 Oct 2022 12:25:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614302; bh=oYRhmtQE/klOFsQCHCsRhaWDY77M6fjbrOG794N8IJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KZmOpVJtc8qUDt2fUJg1AFqlA4QF0cZOaWZL5YhmsSj2qGgaoMyMagmfpdK7EX0Tw SAUThNLDF8g43AfOm3vKpf/lKKfVjf5D5zdVCcC65KbhT0VP51mCKRNZ4vNf1W601u LGC7wgqn3qrNxpIZMaCvbHW9Gc85ZE3JrD9mAnFI= 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.10 209/390] media: xilinx: vipp: Fix refcount leak in xvip_graph_dma_init Date: Mon, 24 Oct 2022 13:30:06 +0200 Message-Id: <20221024113031.677951768@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585858594518407?= X-GMAIL-MSGID: =?utf-8?q?1747585858594518407?= 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: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: 9104 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456078wru; Mon, 24 Oct 2022 06:33:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4KHoq3qgI4Ym3S4cb088SEwJUmK+Kpu5naTCJTGLzFsqlVU5kOdbtCXBsdFyRIZt1PWwIp X-Received: by 2002:aa7:838a:0:b0:550:5e4a:ab55 with SMTP id u10-20020aa7838a000000b005505e4aab55mr34061246pfm.10.1666618412554; Mon, 24 Oct 2022 06:33:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618412; cv=none; d=google.com; s=arc-20160816; b=JT7u+PRQRLQ1S4UKxmDl5BkRM+P9lHcSAsNA8chUxnzM3kYdOHzMRw9GaEWCh8clM2 pKLJS8RCZduJ0KcAvBR+OyDQNQZ0n4G2yINCEQcLXZYtZMqj2sHVSDifR46sgzOtSQah PjN7BFfP6vrTn2C098iA724dhS4XCmqdypObPyTmsl22nvShHq9BV//SF3wXYE0yKLrU kUvLzUb4QyB4fWpnrJ93o/J00T+B1SbCeF58wbzyaFfJIPr1HgBzQt2u+nRvGhlTX62L mX9M7UcLqcz3JzSsw5XLbzrlnvATydj89ws9Xoe96+8bxfYv510Ot8EduOTc3Sd/nnSJ X1iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pW79O/rV6V2nWCZprfSLoNGq57d6B98SVhz5FPutbkM=; b=T5j5YIuoujVvreDJSnUf4tVNHfqCMDLMe2avhmkHJNZ+hRr8mJobcEEaNRW/5rFYjt XAKkuf7p9dImjdeP0AMDBakSZ/6aiPEqN+2RZQelA7okaatJ3+YL0IL9yYts35dIiXeJ HQmLP0YCOcy2bjg3+IuZXRkDkuzIFoMDlNYxSCJtShnpPnuhpyxCQEkD3snuVX0cx9Vq BloENX9YMG8wdF4yVgibZiyL22O3j60DWY02F4CNxIWQBLWXd8c/GrFdjk2nmKfY0eu9 19qqgr8s9mcmI2zzWeOMqWqPNwvmSwJZ0OXfp7+b2iB35CXCFQkmUKAM6dOvD8iOmTDY HhZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gMCLksyB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p5-20020a63e645000000b0046aeabd6548si35277752pgj.104.2022.10.24.06.33.19; Mon, 24 Oct 2022 06:33:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gMCLksyB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230040AbiJXNQr (ORCPT + 99 others); Mon, 24 Oct 2022 09:16:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235571AbiJXNOz (ORCPT ); Mon, 24 Oct 2022 09:14:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02119A2A84; Mon, 24 Oct 2022 05:25: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 0E742612DA; Mon, 24 Oct 2022 12:25:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C86AC433C1; Mon, 24 Oct 2022 12:25:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614305; bh=A2cmLKhgaLuOHRm03hf+NAzBffCw+SrwMhodahhuDxc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gMCLksyBBQkQzXMMcDQ930DM7S37KLQyGEcH4rimJUHe0jG5wgJTIHlCIF8qFjR7A Pj64KKlAcd1kUhtJtfXS7eDt2GS237uOaej4kjFP+5nOsoASnVMELJ0mfJG2HhaSOH 3nE15zeeirh/A9cL1oDFPrGsIoVSmcOBTRA3RILM= 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.10 210/390] RDMA/rxe: Fix "kernel NULL pointer dereference" error Date: Mon, 24 Oct 2022 13:30:07 +0200 Message-Id: <20221024113031.725302420@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576068374410442?= X-GMAIL-MSGID: =?utf-8?q?1747576068374410442?= 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 2847ab4d9a5f..6acef6e923de 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -775,7 +775,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: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: 9893 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp572307wru; Mon, 24 Oct 2022 10:34:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6/sQv9ZCdEdB4sbdV1FfUFB99OGZzmZcj0NTdyXwQ8MIwwK9O3KiUEwfpB/xCuF9/GE1gq X-Received: by 2002:a17:903:50e:b0:182:631b:df6f with SMTP id jn14-20020a170903050e00b00182631bdf6fmr34721774plb.66.1666632897581; Mon, 24 Oct 2022 10:34:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666632897; cv=none; d=google.com; s=arc-20160816; b=SS5FfTY7ARr1GhesJoOqdpBeMGl9vr3e2Zx5e2RnlVw/T0Bvo00VWQ6Zn5t42x7Ouo n6PHBS2YhO9RD5tltcvQU3TPhAJBmytkTig5V6bzzbxORluyr3eRny1E3wr/+oi6pnp9 lkiOU5tPPp/Z9i0BhAb/SelA8eDP6qyhk3Oe+PhBHYFyo80U0MiIOyJT9a55d7zuEyIU 7lAPTYP6moj6p9vhqMlcRUWuDtEraHbQbRrd6QYKIHPEDFMd8X0vkLOA1A8UYb/WoG2P EH3Y2Ki/Zdduk6c/yCg9ECyzSfOK2ctq+IyCGMHlxZ8Mf0AjlapjzW7aHLX5RTUBUPRb 3A8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cfbodcUTSWMm6zooZnZTaga8NjUyDTIDvp3efjPx5EI=; b=krq6E86PNbs9qYfnwOQ4z89RMbxIfq+iycaCPy6RWhFZZd+JsAysb/dqOmpDC19CcC 6lfTl6eE029GnrXdrmv3448MqpZ1u31EC1e3PHZvXdeYbuUNfDjf7vwVqtGhsLZFFTTo IrUSV/RJSg6KyUf1zrgRYSKSp9ci79Fr1hbgYz+1PbFher2nD5nrh2JKs+8kFGLYGAbR ePxTXthIQBRllW4O1xgBeJkytsOL2G4/v75iaFu1OvVTLQo+2zB90KCr36D5yOj+Jm4f FUPTlAyCgKbRVwbrfvQJlvjXIyAlS0wMck/x9/BYmT3L/LY/UHPNlXkH5aebmsRLH2Z/ XazQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kuaTJCt2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h6-20020a17090a604600b00213120e0c85si3529244pjm.156.2022.10.24.10.34.44; Mon, 24 Oct 2022 10:34: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=kuaTJCt2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232875AbiJXRcc (ORCPT + 99 others); Mon, 24 Oct 2022 13:32:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232458AbiJXRbx (ORCPT ); Mon, 24 Oct 2022 13:31:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 208AE11F4BA; Mon, 24 Oct 2022 09:07: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 63948B81665; Mon, 24 Oct 2022 12:25:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B515FC433C1; Mon, 24 Oct 2022 12:25:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614308; bh=bOzId59+foMHXeXiHrSonKvaR0UFFwp8Mwmij77g26Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kuaTJCt2TMe3lGGcoW7I+uKa62U7+m45tPNZEWZTVrsmScC4q8eHsnMpOKEkhg5F7 2nTQFfjoPfpYm3QzlYZPE+io7bRInDlbaXvn58wdFPnzQX1x55jhD277PSdAnn0QAz MXpQItqNqhjbyDrzKkmbJW4dDlxqAqGLXDk5uf60= 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.10 211/390] RDMA/rxe: Fix the error caused by qp->sk Date: Mon, 24 Oct 2022 13:30:08 +0200 Message-Id: <20221024113031.773007271@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747591257189566132?= X-GMAIL-MSGID: =?utf-8?q?1747591257189566132?= 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 6acef6e923de..2e4b008f0387 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -817,8 +817,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: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: 9612 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp530943wru; Mon, 24 Oct 2022 09:05:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5BYxS/EIaIAP+deK8vvgAkr+QoDMJzF3bCFCty6J70SWG3HqtdDGhEsvFczuPDICjmoRBp X-Received: by 2002:a17:903:2450:b0:185:4165:be54 with SMTP id l16-20020a170903245000b001854165be54mr34308074pls.104.1666627545464; Mon, 24 Oct 2022 09:05:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627545; cv=none; d=google.com; s=arc-20160816; b=wbDP/f9fNwnjZPqvXrAgDQCcwhLDb9ULD0IIjznGLfSJb4GqBm5x3T8HdthW/8JlBO baCuNqmnla5OTyFKWFByC8lSRIOlsBCQgVPU7zvnuJUz7w1siSjSDGdU78SsrnY4Rv3L Qfpul8EgN7rTuPI8jXTcDqa8TEFGjhNlRVNtuoEyBuD82LY8DHh5FeBL2tsJOPDayLMO ooHRpoytLYeHxXwRC51+E3mDlh3VnCJ8bORJJSU/VjEKpcrFhXPUdT9dVvgweidtW/56 Quf9dNCW2xEwfOzETW8ZKQuPoVjub5Z4WH3IpZD39LhEx+uqHvLLhxWyS6j9pB07nzgi 8EGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=ce9M+lMFk8Ub4wTrcnLny+r5I5vY3ezBz9CYiu5mQWsfF/Qr7QXZsFaArzXPofKu6R m7uI0VHVFjcSRhvJKRxiZCcNmSUsOgNehBrpKWW9IXH6MQJwO/ZFB8AM5CzrybB+hMRY DC/d779ZPfbZVuDXrm2vqMu1Nkp7BGbfdoCH/qgQHyuQr79lxTwuRMIxKevCf4vPDj77 9smBq22R4kaTag1pQpmN6MN3iI0FMnvXg2Xzvz4JoUQaEFvtptEr+Wt9UptBhsHO+FjY 19zOBdzhq5n52e68GHlPbu6CyMkv42KkmPBt+gSNGcUpx/uxq/UmgwDTSs4C5FZFsRjQ cViA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mkMnfY2w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n18-20020a170902e55200b0016d9c8479b5si39691926plf.344.2022.10.24.09.05.31; Mon, 24 Oct 2022 09:05: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=mkMnfY2w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230461AbiJXQDe (ORCPT + 99 others); Mon, 24 Oct 2022 12:03:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232373AbiJXQC2 (ORCPT ); Mon, 24 Oct 2022 12:02: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 B67E315F933; Mon, 24 Oct 2022 07:55:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 96387B8167C; Mon, 24 Oct 2022 12:25:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED1E4C433D6; Mon, 24 Oct 2022 12:25:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614313; bh=F9QdaByYRJJaL62QU8goMier2SlNAtihGwndftq3eS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mkMnfY2wEGj4nk8/WwD1l20F56HH+OWioR7LB1H2ksFiza8axrthcX6ls6tGVeLzA nOCuXB/aklNf7rIcepKavoNdiVaW0XaS75xdqGukmy1dMFEx401NEIp+MwQKjeQv6Q 2XevV8OOvuZ5k7+Jrkeev90rF438eF6BJzNI742U= 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.10 212/390] misc: ocxl: fix possible refcount leak in afu_ioctl() Date: Mon, 24 Oct 2022 13:30:09 +0200 Message-Id: <20221024113031.820902760@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585644924345648?= X-GMAIL-MSGID: =?utf-8?q?1747585644924345648?= 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: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: 9124 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456339wru; Mon, 24 Oct 2022 06:34:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6g86oYb/PKZDUDDxbIgFwgh7tNV01vhHZ6nu9PTejczADWVQQsFcwts66V+2x+NjT9dPkX X-Received: by 2002:a17:902:b089:b0:178:54cf:d692 with SMTP id p9-20020a170902b08900b0017854cfd692mr33165475plr.1.1666618442984; Mon, 24 Oct 2022 06:34:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618442; cv=none; d=google.com; s=arc-20160816; b=I2v1qYhXsOngodzKkxVD4MgBEFPBq+jy73kiW0MYYDY2oq3H95mxwfhlE03ffKV1GX M715UE5v/3fhSZDyAirSCripjEYmrLFrZeGZf7bUbmJ4jmqMOgpe3R8o3m7xmyVi2WlD cXW22s2gJJipcLG7fIV1w01AN8m1Mb/co5er18NIY2BDuYJ8GWipt+mkswana0m99zNm ZpBoQjReJ3VhBr7EDhhMDyfuwp2TBHfQoq79W4YnOGCJD9FeE3FP1bL1u2353tNzY9V9 QIq6gtWwhPRfuDnu2O8I16gc9lW0eKBSjxq086nlLS3dxsti3GG0M1Gb/oEHOqT5uJus mLSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fwgSJ1TIQV62+eBJg92Oex5SOJMI7JMnkv6lNLcXRSw=; b=O914K3WU7pete1wyRfGjmNKKRrL+TDvGU3jh8IvmiMwFtIXL5BOaXVdnpbp3cHkawo N4Ti+qa0ULVC4+J0uqsgQXU72QdRtV5K+3msA+/vsm59zpw2E+EPRoTO4rpshscQB0hc gPyQa9ks1m2DNuZWnUuxgHzh9hwtAynu0+EeqoWySmHBSYXoW8BOdpmyx0R+LvlrXlZK 2gNNfXYpvFtWNu2kAOtYnySIU6e5+bBtxJaZzrngvNAz4e6DD59Hmg4IK/gUEN1uSfmq QnE0miYzGfkmCly/bWAW2GHQkEult5IhnwkirKsuTxMOfwxZ7FoHWG+JSdhbVyj5c9Tp F/hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b00ZQz3h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v135-20020a63618d000000b0046ec7beb578si9974174pgb.94.2022.10.24.06.33.41; Mon, 24 Oct 2022 06:34: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=b00ZQz3h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235876AbiJXNQZ (ORCPT + 99 others); Mon, 24 Oct 2022 09:16:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236097AbiJXNOr (ORCPT ); Mon, 24 Oct 2022 09:14:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06D68A2A8D; Mon, 24 Oct 2022 05:25: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 7FFE1612D2; Mon, 24 Oct 2022 12:25:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BFC2C433D6; Mon, 24 Oct 2022 12:25:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614315; bh=zmCdnqZhVJQJyc3EsuY4FxJn+vF7xfP1KOgUoH30fl8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b00ZQz3hdyF0TjtPu60oGS8NZIXBkxI8YlMcQp0Y+ahE7B2OsYekEUQmPtHUC87Gg RRob5q5cdfyNEq3oJNQ1lHmZIwl/I5VwbFr6DVukerNPB2KtnUZXj3RL83QUWgdwD5 sShIrSnrDWRAJi5U9rRKi83TUwHp6srA57H4CQ5s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Xu Yilun , Sasha Levin Subject: [PATCH 5.10 213/390] fpga: prevent integer overflow in dfl_feature_ioctl_set_irq() Date: Mon, 24 Oct 2022 13:30:10 +0200 Message-Id: <20221024113031.867017383@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576100432919417?= X-GMAIL-MSGID: =?utf-8?q?1747576100432919417?= From: Dan Carpenter [ Upstream commit 939bc5453b8cbdde9f1e5110ce8309aedb1b501a ] The "hdr.count * sizeof(s32)" multiplication can overflow on 32 bit systems leading to memory corruption. Use array_size() to fix that. Fixes: 322b598be4d9 ("fpga: dfl: introduce interrupt trigger setting API") Signed-off-by: Dan Carpenter Acked-by: Xu Yilun Link: https://lore.kernel.org/r/YxBAtYCM38dM7yzI@kili Signed-off-by: Xu Yilun Signed-off-by: Sasha Levin --- drivers/fpga/dfl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c index b450870b75ed..eb8a6e329af9 100644 --- a/drivers/fpga/dfl.c +++ b/drivers/fpga/dfl.c @@ -1857,7 +1857,7 @@ long dfl_feature_ioctl_set_irq(struct platform_device *pdev, return -EINVAL; fds = memdup_user((void __user *)(arg + sizeof(hdr)), - hdr.count * sizeof(s32)); + array_size(hdr.count, sizeof(s32))); if (IS_ERR(fds)) return PTR_ERR(fds); From patchwork 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: 9631 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp532171wru; Mon, 24 Oct 2022 09:07:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6OZ2WmPwoh893PXCpbBXBCbALSdFs+1usFNqRKxCCqRUCdaShQURdGupDTHMIhclBbjKo0 X-Received: by 2002:a05:6402:5419:b0:457:c955:a40f with SMTP id ev25-20020a056402541900b00457c955a40fmr30595152edb.391.1666627655152; Mon, 24 Oct 2022 09:07:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627655; cv=none; d=google.com; s=arc-20160816; b=ctuNK7ESovCJaPTQvvSBLmElVwc54L4F+h79rdsFE3gyC2OcvztCrtQ5TZNY58lXpJ YsvbgYq+8Ilvw5qCWD/I4H+6Mgh56676perrym3o+1PdQoxFvIGD9DhKMOzP9nuaaQAZ xxrvQs08g8lT+vvQwmidrF+xeE9AIMEqCxuPZ974FjCFaOPxibEJCgCvtdTmIccO8gjH aq8XZZRiE+CANKCEVFNVsBPW1MD7LuIkKJfb1YTeuoQVztjqqNfcoSWVB+ex3vXnFidz WBiXAw9ENxMCCE628WZjX/cySmbfAkAecyY5rjHWiKHl6s4I2b7lo/cKeJVYNaBH70E8 KB2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XCnTZVCL/tRlUarKbEA4PHValgDaMEEXLyV6WyQWB1o=; b=oyMMne57PREECY1mp6KrNF7myV9ngW5ugYoDuF+X4yw1TrxoDkPvjCFMLOxKY/9MI0 hKAwAzKvWh+JIMXWDdR/O+Yesk/TLz+nP9JCX6bZ/Zm7YXX6wQtoQpQ8u9AlwvqxFohQ 9sac09YBVM/uDM7SOnIhGcwQfqjdFVvLZ9lEok4B841eSMtZfDwewS/ybAnQLbqImp9a 6vp2jyNc2yT9FN2w9K+NG8FJtGXsWKlmyd06M1jhTmiizmhlxIQ1rxDY8yelDdb7VD/A pfm5Zs4MxTLRblDMoIUnlDfgIVOePvNntwBLskRypFaReB/h6p406T47F0D5G0TolyO+ zZ/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AvGFaQPk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a05640227c600b0045154775089si129411ede.625.2022.10.24.09.07.09; Mon, 24 Oct 2022 09:07: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=AvGFaQPk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233116AbiJXQGZ (ORCPT + 99 others); Mon, 24 Oct 2022 12:06:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232908AbiJXQEB (ORCPT ); Mon, 24 Oct 2022 12:04:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7CFE1E099D; Mon, 24 Oct 2022 07:56: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 C0A60B81677; Mon, 24 Oct 2022 12:25:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2459BC433D7; Mon, 24 Oct 2022 12:25:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614318; bh=nO8K0tDmjNV/cilGMHR/bS4w7jvNmk5chRqtJRkf+B0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AvGFaQPkLEduBHKU/my3pZJktaUqCPJvbS2Jck8EiSaY46+oCV9zQeq2hZEBTJK1K OMHYoWXjtVB4OM3DE8whwP9IWSXDjA/3ulsdrdGw8hmz+sRNNrPykD2XyFesfWNKsP azoUFbOa/dHNQWxKCBnkjORGBNN6CKuP7MDubDDk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jie Hai , Zhou Wang , Vinod Koul , Sasha Levin Subject: [PATCH 5.10 214/390] dmaengine: hisilicon: Disable channels when unregister hisi_dma Date: Mon, 24 Oct 2022 13:30:11 +0200 Message-Id: <20221024113031.897937220@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585759960309348?= X-GMAIL-MSGID: =?utf-8?q?1747585759960309348?= From: Jie Hai [ Upstream commit e3bdaa04ada31f46d0586df83a2789b8913053c5 ] When hisi_dma is unloaded or unbinded, all of channels should be disabled. This patch disables DMA channels when driver is unloaded or unbinded. Fixes: e9f08b65250d ("dmaengine: hisilicon: Add Kunpeng DMA engine support") Signed-off-by: Jie Hai Acked-by: Zhou Wang Link: https://lore.kernel.org/r/20220830062251.52993-2-haijie1@huawei.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/hisi_dma.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/dma/hisi_dma.c b/drivers/dma/hisi_dma.c index 3e83769615d1..7cedf91e86a9 100644 --- a/drivers/dma/hisi_dma.c +++ b/drivers/dma/hisi_dma.c @@ -185,7 +185,8 @@ static void hisi_dma_reset_qp_point(struct hisi_dma_dev *hdma_dev, u32 index) hisi_dma_chan_write(hdma_dev->base, HISI_DMA_CQ_HEAD_PTR, index, 0); } -static void hisi_dma_reset_hw_chan(struct hisi_dma_chan *chan) +static void hisi_dma_reset_or_disable_hw_chan(struct hisi_dma_chan *chan, + bool disable) { struct hisi_dma_dev *hdma_dev = chan->hdma_dev; u32 index = chan->qp_num, tmp; @@ -206,8 +207,11 @@ static void hisi_dma_reset_hw_chan(struct hisi_dma_chan *chan) hisi_dma_do_reset(hdma_dev, index); hisi_dma_reset_qp_point(hdma_dev, index); hisi_dma_pause_dma(hdma_dev, index, false); - hisi_dma_enable_dma(hdma_dev, index, true); - hisi_dma_unmask_irq(hdma_dev, index); + + if (!disable) { + hisi_dma_enable_dma(hdma_dev, index, true); + hisi_dma_unmask_irq(hdma_dev, index); + } ret = readl_relaxed_poll_timeout(hdma_dev->base + HISI_DMA_Q_FSM_STS + index * HISI_DMA_OFFSET, tmp, @@ -223,7 +227,7 @@ static void hisi_dma_free_chan_resources(struct dma_chan *c) struct hisi_dma_chan *chan = to_hisi_dma_chan(c); struct hisi_dma_dev *hdma_dev = chan->hdma_dev; - hisi_dma_reset_hw_chan(chan); + hisi_dma_reset_or_disable_hw_chan(chan, false); vchan_free_chan_resources(&chan->vc); memset(chan->sq, 0, sizeof(struct hisi_dma_sqe) * hdma_dev->chan_depth); @@ -399,7 +403,7 @@ static void hisi_dma_enable_qp(struct hisi_dma_dev *hdma_dev, u32 qp_index) static void hisi_dma_disable_qp(struct hisi_dma_dev *hdma_dev, u32 qp_index) { - hisi_dma_reset_hw_chan(&hdma_dev->chan[qp_index]); + hisi_dma_reset_or_disable_hw_chan(&hdma_dev->chan[qp_index], true); } static void hisi_dma_enable_qps(struct hisi_dma_dev *hdma_dev) From patchwork 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: 9106 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456084wru; Mon, 24 Oct 2022 06:33:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4wdxQ2/k8jk8eTnx6W8D3tduZDZMrFAAINrMf/fuq1QihNj3/Sd6wCckpZHnyw7kLHJePh X-Received: by 2002:a17:903:22d2:b0:17f:7dea:985f with SMTP id y18-20020a17090322d200b0017f7dea985fmr34041798plg.68.1666618412988; Mon, 24 Oct 2022 06:33:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618412; cv=none; d=google.com; s=arc-20160816; b=IfDf0P5XK5jNxjzmc0Sh0kWkkKFOd4hc4nBH8DOb84cjTqyQbTJItAFSSZib8h6Vjt NbApHEdv9M4ILTOL7vKaMyJFAXTaVlJ9aeL3yyW35aFNIGF7xJKfwGdu0jnxvfgyvY29 6bVDcCXjLrXtK4SORiYjQRyX0VaIn/J77fdL5ViO5GqWxkf0HLi4JJ53W/S++Lp+9OJI Dpwkd2alNG+w48m98BL6I6tFQG5VCQvkCT6rK2Cna7DeeBEE6ijXKRjWXKcpcCw2TB/w bvzsCC6RPX+cTasPESTHSPmfm+r/8FNd4xRNHa4fn0DTag2vuo7LdbC1UMx6T2Czz+r/ xSDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gveL5q9IlirADLFWkjcu3iT+6EVxSAAZ64tnHl/BpbI=; b=te+e5tiEX+tZ4BFMW6Tj53KFdoQfcq5J5jccR2IFlasuZ/i8snQ5bYJ8cTlSwGRvuh i7y1WkX+dzqp3yYB1C6RH0PTjXgT6ECG5xpdUCZP5oWtD7PkWJ3KIaHTI0LdUmhSJf/I 0/zbbyQYmTCbUS69sG8xWo52UaUGfsCZrOjzxNGgTpuUZaZubAeejk/R47GyaEESxsnP Wqef1WAzzlMkW5ISb3vHdpKMlXqVHeiicmBCcfUiFYd8+AhxuTjzGY00LCLy6m3S1oe3 svL6RWvlPi3fSqCzGCiAyt3Rz4rW3ptXqLfbw9eLoXHAVd7HyNEyCiq+vzZpNlRIF3pY 5sUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hiwHv4pU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i5-20020aa78d85000000b0056be3109462si2607871pfr.163.2022.10.24.06.33.19; Mon, 24 Oct 2022 06:33:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hiwHv4pU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233366AbiJXNQy (ORCPT + 99 others); Mon, 24 Oct 2022 09:16:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235682AbiJXNPH (ORCPT ); Mon, 24 Oct 2022 09:15:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75836A3AA1; Mon, 24 Oct 2022 05:25: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 CE8B9612E9; Mon, 24 Oct 2022 12:25:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2EE1C433D6; Mon, 24 Oct 2022 12:25:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614321; bh=WCxNMtFl2Q+Rc1wx6uCV54UdQ6DKM+t655IJa/Q5eO8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hiwHv4pUKmh8KbjVRtB+Y8wyY5RE1bChvIyLvGfxbjP9BPxJONN7aclNVjrcNYT5Y TQ5aseKPhXy40h2aAz1/U9k3sSSElJ1xBvwReUmQVC24AcXf7aWtdJJ5fpBUDR7uFc zGcJv0dygOcU2dEdNVfSSMvWcdK5UPfi42LwE0T8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jie Hai , Zhou Wang , Vinod Koul , Sasha Levin Subject: [PATCH 5.10 215/390] dmaengine: hisilicon: Fix CQ head update Date: Mon, 24 Oct 2022 13:30:12 +0200 Message-Id: <20221024113031.946374675@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576068609541970?= X-GMAIL-MSGID: =?utf-8?q?1747576068609541970?= From: Jie Hai [ Upstream commit 94477a79cf80e8ab55b68f14bc579a12ddea1e0b ] After completion of data transfer of one or multiple descriptors, the completion status and the current head pointer to submission queue are written into the CQ and interrupt can be generated to inform the software. In interrupt process CQ is read and cq_head is updated. hisi_dma_irq updates cq_head only when the completion status is success. When an abnormal interrupt reports, cq_head will not update which will cause subsequent interrupt processes read the error CQ and never report the correct status. This patch updates cq_head whenever CQ is accessed. Fixes: e9f08b65250d ("dmaengine: hisilicon: Add Kunpeng DMA engine support") Signed-off-by: Jie Hai Acked-by: Zhou Wang Link: https://lore.kernel.org/r/20220830062251.52993-3-haijie1@huawei.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/hisi_dma.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/dma/hisi_dma.c b/drivers/dma/hisi_dma.c index 7cedf91e86a9..08ec90dd4c46 100644 --- a/drivers/dma/hisi_dma.c +++ b/drivers/dma/hisi_dma.c @@ -442,12 +442,10 @@ static irqreturn_t hisi_dma_irq(int irq, void *data) desc = chan->desc; cqe = chan->cq + chan->cq_head; if (desc) { + chan->cq_head = (chan->cq_head + 1) % hdma_dev->chan_depth; + hisi_dma_chan_write(hdma_dev->base, HISI_DMA_CQ_HEAD_PTR, + chan->qp_num, chan->cq_head); if (FIELD_GET(STATUS_MASK, cqe->w0) == STATUS_SUCC) { - chan->cq_head = (chan->cq_head + 1) % - hdma_dev->chan_depth; - hisi_dma_chan_write(hdma_dev->base, - HISI_DMA_CQ_HEAD_PTR, chan->qp_num, - chan->cq_head); vchan_cookie_complete(&desc->vd); } else { dev_err(&hdma_dev->pdev->dev, "task error!\n"); From patchwork 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: 9609 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp529816wru; Mon, 24 Oct 2022 09:04:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4udKyEhT0MFJHRNc+VTMXwPhAKg6x0lwe6wshjxEnHhk11siYzUQsIwXRTeaVOQLfTVSQF X-Received: by 2002:a05:6a00:c83:b0:56b:9df2:381f with SMTP id a3-20020a056a000c8300b0056b9df2381fmr10790582pfv.50.1666627451135; Mon, 24 Oct 2022 09:04:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627451; cv=none; d=google.com; s=arc-20160816; b=0gN5FNFrI1bSz6b42lMOl67NjHLUheLLERUvTwSXTQxWypcptjCbc/8BCIVj4uwek5 usp0CmXoC8qyOxiBRlCF2RsQYLOjaZZrbHSIqKaZlDGS0PHt+0ptO1ilKoAfyccLrWen vgXITg3Q9S3DgJEWHWTZ/7CnNsAAAvW65iTSfP0/ETLALswfBCNdKZieA5LCi/wzW5Fa 9W4EPvxKZNMjfDV4pXiHcqGFDjDiIHA+NiwaVjHIDOUjz7Hr1riudRTSvasOsxV1aSLz TfeKBaT/RghdrCzFRi7D9QW96USFaiF6zom8wz6imibti+DWEYvwdyyb/LsLmuKt6/RF mnYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Utvg6HBziOqsQqY8lskBdy+N+2XFCpLWpMB4Hh2CjL4=; b=F6uubqJC1RpH2zoBJznmM3fu4kOitVhx3Pg4bJWkbCy1juOYqxF6pwzDk9as10cvdk 7r145pMz0PSXGe3KbIg8G9Jr0fyVESlI/Km1TQtReBDYXE93/4WNZDGicGc8eu4h68Lo Fo2KtbvS8NVxLtwqGznr+pZF8dtL48hYp4fLRvJqeDOjB03ZY7yuwax85/roodS5j9ru ekUGupjFZX5ldS5KNKdV0QkedeLpfh82wEk/VAYGYuOFxIYu3cIcbVjC6xzz7vAzRrDd +4TT6QPpT9cGwK1nLJ+iaDn87LS4RSEY//AnqBqRPITrlx9/bKPUkvY4y03O52RJVsPg 6RUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2vQDBwmx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q6-20020a654946000000b0046ec7bec2b2si11827962pgs.159.2022.10.24.09.03.56; Mon, 24 Oct 2022 09:04:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2vQDBwmx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232679AbiJXQCb (ORCPT + 99 others); Mon, 24 Oct 2022 12:02:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232452AbiJXQBV (ORCPT ); Mon, 24 Oct 2022 12:01: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 168879C2D3; Mon, 24 Oct 2022 07:55:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 595A1B811CF; Mon, 24 Oct 2022 12:25:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB031C433C1; Mon, 24 Oct 2022 12:25:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614324; bh=vUlw16hYju9MK+wWt/NqUTk3qu5CjvEwj9o7bmckfn0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2vQDBwmxVYacyif4lnp4EkN+8LoXj0TSrssdnsD2vFAK6ZdT2DuNJBxN8qSZEmXxQ Nlu9FXKCoTnH30mqMRkTCikG1X06RGC1079pckN9kh3JJ7psApy5SdPEDK3BRPWMAO 6wGwpshy0LIUSD40MRyh34YmqfSP6WSQrwjTjuJk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jie Hai , Zhou Wang , Vinod Koul , Sasha Levin Subject: [PATCH 5.10 216/390] dmaengine: hisilicon: Add multi-thread support for a DMA channel Date: Mon, 24 Oct 2022 13:30:13 +0200 Message-Id: <20221024113031.978049057@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585546268863006?= X-GMAIL-MSGID: =?utf-8?q?1747585546268863006?= From: Jie Hai [ Upstream commit 2cbb95883c990d0002a77e13d3278913ab26ad79 ] When we get a DMA channel and try to use it in multiple threads it will cause oops and hanging the system. % echo 100 > /sys/module/dmatest/parameters/threads_per_chan % echo 100 > /sys/module/dmatest/parameters/iterations % echo 1 > /sys/module/dmatest/parameters/run [383493.327077] Unable to handle kernel paging request at virtual address dead000000000108 [383493.335103] Mem abort info: [383493.335103] ESR = 0x96000044 [383493.335105] EC = 0x25: DABT (current EL), IL = 32 bits [383493.335107] SET = 0, FnV = 0 [383493.335108] EA = 0, S1PTW = 0 [383493.335109] FSC = 0x04: level 0 translation fault [383493.335110] Data abort info: [383493.335111] ISV = 0, ISS = 0x00000044 [383493.364739] CM = 0, WnR = 1 [383493.367793] [dead000000000108] address between user and kernel address ranges [383493.375021] Internal error: Oops: 96000044 [#1] PREEMPT SMP [383493.437574] CPU: 63 PID: 27895 Comm: dma0chan0-copy2 Kdump: loaded Tainted: GO 5.17.0-rc4+ #2 [383493.457851] pstate: 204000c9 (nzCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [383493.465331] pc : vchan_tx_submit+0x64/0xa0 [383493.469957] lr : vchan_tx_submit+0x34/0xa0 This occurs because the transmission timed out, and that's due to data race. Each thread rewrite channels's descriptor as soon as device_issue_pending is called. It leads to the situation that the driver thinks that it uses the right descriptor in interrupt handler while channels's descriptor has been changed by other thread. The descriptor which in fact reported interrupt will not be handled any more, as well as its tx->callback. That's why timeout reports. With current fixes channels' descriptor changes it's value only when it has been used. A new descriptor is acquired from vc->desc_issued queue that is already filled with descriptors that are ready to be sent. Threads have no direct access to DMA channel descriptor. In case of channel's descriptor is busy, try to submit to HW again when a descriptor is completed. In this case, vc->desc_issued may be empty when hisi_dma_start_transfer is called, so delete error reporting on this. Now it is just possible to queue a descriptor for further processing. Fixes: e9f08b65250d ("dmaengine: hisilicon: Add Kunpeng DMA engine support") Signed-off-by: Jie Hai Acked-by: Zhou Wang Link: https://lore.kernel.org/r/20220830062251.52993-4-haijie1@huawei.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/hisi_dma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/hisi_dma.c b/drivers/dma/hisi_dma.c index 08ec90dd4c46..8f1651367310 100644 --- a/drivers/dma/hisi_dma.c +++ b/drivers/dma/hisi_dma.c @@ -276,7 +276,6 @@ static void hisi_dma_start_transfer(struct hisi_dma_chan *chan) vd = vchan_next_desc(&chan->vc); if (!vd) { - dev_err(&hdma_dev->pdev->dev, "no issued task!\n"); chan->desc = NULL; return; } @@ -308,7 +307,7 @@ static void hisi_dma_issue_pending(struct dma_chan *c) spin_lock_irqsave(&chan->vc.lock, flags); - if (vchan_issue_pending(&chan->vc)) + if (vchan_issue_pending(&chan->vc) && !chan->desc) hisi_dma_start_transfer(chan); spin_unlock_irqrestore(&chan->vc.lock, flags); @@ -447,11 +446,10 @@ static irqreturn_t hisi_dma_irq(int irq, void *data) chan->qp_num, chan->cq_head); if (FIELD_GET(STATUS_MASK, cqe->w0) == STATUS_SUCC) { vchan_cookie_complete(&desc->vd); + hisi_dma_start_transfer(chan); } else { dev_err(&hdma_dev->pdev->dev, "task error!\n"); } - - chan->desc = NULL; } spin_unlock_irqrestore(&chan->vc.lock, flags); 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: 9437 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp479267wru; Mon, 24 Oct 2022 07:18:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5X76bZWrd36UTrF4fEnRiSj5Hq3le2CvjxHkq72bB+zFEBHEKDW9gfIiokAxGp9ea/QnKY X-Received: by 2002:a05:6402:1f84:b0:455:27b8:27aa with SMTP id c4-20020a0564021f8400b0045527b827aamr30388354edc.243.1666621128367; Mon, 24 Oct 2022 07:18:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621128; cv=none; d=google.com; s=arc-20160816; b=aSDUoSi6v+dBs5NkWuEIn7hxIcjmNP3zXVhELTCqAPRzSSsdrxe7plv3Cwk8L7tXq9 3goby8bynxdL4ID6UtBJckMPBDyZ3+QK2/+KFH5FWkto1fI7RCkID8zihNjcreK1Q3/C iEJHlpHWZOxnBbVDWthSGCnrk++U34Fq/UG5PzsUK4bxEpQ4I3XqUoFK41P/GcVNK5LV PL3itIkiHSZb0r/AQy1ISr5YAa7S6vyUrioYRFBfRFxUFR42Lta43XNScsgrUJyFvUVC XJ6HbZNdvJRKFPDd1EeKnlBK2NhNZpYFW+mDOjQqRWatBrDyZLo/u7+EMZQqBfMVTO6y Dmqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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/vTwQ7AgEm8wvEijENBDCOS3WmNOc29YxtdEo6gD4=; b=apqLN09pdEmlnd612TWaUJYn69C+tk3xLhpe1ezWE8bMW9Jn4eeDuqlRG3hOstbl9C fmzqNfF+Mzx4hW92k20eNMg4R9zQur7g/jY91DcotN2+Hj+WwZJCO2lLZxkZBxJf+U39 DIwnlVigdHyzelptMSs9wVv/pZZluHkJGizcPEMGjTIf/B+wRxrzk0qkG/XRWHUhHfKZ NtRYebh9scEJnOFIfgYxU5oeg3gXn6MS+8O59Z+uvDA0rdf/3FBtv6/SmDXxcc6vPGq6 R0gnECpWLHMazmENuzh8U4Hen4oaa8q0rl+W/kvy+kFWUEUhZLsQWf4viCxC+28xqVod NLvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rVlLu6IJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y10-20020a50eb0a000000b00458ab54baa5si23828330edp.503.2022.10.24.07.18.14; Mon, 24 Oct 2022 07:18: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=rVlLu6IJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231173AbiJXOM3 (ORCPT + 99 others); Mon, 24 Oct 2022 10:12:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235824AbiJXOJS (ORCPT ); Mon, 24 Oct 2022 10:09: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 CC5E0C50A7; Mon, 24 Oct 2022 05:51: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 59BBAB81681; Mon, 24 Oct 2022 12:27:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA499C433D6; Mon, 24 Oct 2022 12:27:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614429; bh=B9QoODx8b47mSMAPwbmYToxEmBWDtndlvsP7641B40o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rVlLu6IJjAle0joVccipiZ/gUsWx83K6apbQsFaWo9QznHmlBd1dFNvKRnf5oHA+2 mQ7KPiOoh/zdKl1YRUzPznuWQi5CVs/Plt0578gFWvSP5owlhXuXAenYO1kpsdf4Ra YTa4I5ntkCXbI4+2yHRZNLOjHcrZFgbZsgKW4Ics= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, vincent.whitchurch@axis.com, Jason Baron , Daniel Vetter , Jim Cromie , Sasha Levin Subject: [PATCH 5.10 217/390] dyndbg: fix static_branch manipulation Date: Mon, 24 Oct 2022 13:30:14 +0200 Message-Id: <20221024113032.016723195@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747578916136411927?= X-GMAIL-MSGID: =?utf-8?q?1747578916136411927?= From: Jim Cromie [ Upstream commit ee879be38bc87f8cedc79ae2742958db6533ca59 ] In https://lore.kernel.org/lkml/20211209150910.GA23668@axis.com/ Vincent's patch commented on, and worked around, a bug toggling static_branch's, when a 2nd PRINTK-ish flag was added. The bug results in a premature static_branch_disable when the 1st of 2 flags was disabled. The cited commit computed newflags, but then in the JUMP_LABEL block, failed to use that result, instead using just one of the terms in it. Using newflags instead made the code work properly. This is Vincents test-case, reduced. It needs the 2nd flag to demonstrate the bug, but it's explanatory here. pt_test() { echo 5 > /sys/module/dynamic_debug/verbose site="module tcp" # just one callsite echo " $site =_ " > /proc/dynamic_debug/control # clear it # A B ~A ~B for flg in +T +p "-T #broke here" -p; do echo " $site $flg " > /proc/dynamic_debug/control done; # A B ~B ~A for flg in +T +p "-p #broke here" -T; do echo " $site $flg " > /proc/dynamic_debug/control done } pt_test Fixes: 84da83a6ffc0 dyndbg: combine flags & mask into a struct, simplify with it CC: vincent.whitchurch@axis.com Acked-by: Jason Baron Acked-by: Daniel Vetter Signed-off-by: Jim Cromie Link: https://lore.kernel.org/r/20220904214134.408619-2-jim.cromie@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- lib/dynamic_debug.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 921d0a654243..e67655d7b7cb 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -207,10 +207,11 @@ static int ddebug_change(const struct ddebug_query *query, continue; #ifdef CONFIG_JUMP_LABEL if (dp->flags & _DPRINTK_FLAGS_PRINT) { - if (!(modifiers->flags & _DPRINTK_FLAGS_PRINT)) + if (!(newflags & _DPRINTK_FLAGS_PRINT)) static_branch_disable(&dp->key.dd_key_true); - } else if (modifiers->flags & _DPRINTK_FLAGS_PRINT) + } else if (newflags & _DPRINTK_FLAGS_PRINT) { static_branch_enable(&dp->key.dd_key_true); + } #endif dp->flags = newflags; v2pr_info("changed %s:%d [%s]%s =%s\n", 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: 9624 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp531662wru; Mon, 24 Oct 2022 09:06:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5MMyAb3KZ09ur48+kT1Lm4FnVUbKkJcWm2ZcBlGkN6U+1od899zIiuLRN4++gc5FKtTLUP X-Received: by 2002:a17:907:a428:b0:78d:9fab:84fb with SMTP id sg40-20020a170907a42800b0078d9fab84fbmr27309202ejc.694.1666627609927; Mon, 24 Oct 2022 09:06:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627609; cv=none; d=google.com; s=arc-20160816; b=stIqmV7VzwqcBxMjseS5bjPrIXWvnvd70RZU16BDdVjfWmR5dy3gjiWt4wimSLCT+F UG61ugv/Kffz1N18eGK0vizAyOHe+rxQBbA1MkXbOLMPUlUJxuAqB8Dx29xUiG6xkbV4 auPPVFmNevZeNqS7nRjW5xWpAi+o2iaegZEkFNTgLyJG7yCA9Gzlp1RJOZxZd6fe/F+C MXGrJ0Olh+qM3vyWaYQoVxxu20yuzG7GwOrK/7afsF80ORjGl7opdpjBiZXtL+I+qre0 i5sWfy8MZNr5073Y0bMGJS8/P7Rpcg4sYAsES6KEy3B8RRwd8eogFahfcciLfz8/QxMj Cxlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gUVnmVMwStaZm1HK0ca9SAxPbzA6YbLaYKJMjt6j9hc=; b=YPTANE/wFYrgMjGpXahPvMqTkTKxdPociFTc3xhU+NRfpc9p3XIIT4+5Bda2tsLJGG BSsAKrUV5Ae5kTt45rLhSvIeKSJeeWfRVftgODZ04zpnRRFFc7lsUzzkBEXpaYAsy+FS oD1zSdftBALJHeA+Bl3SzEpQib9aJWVnEqyAJTUNP7BaudnNOatQ+KZdnPnvegSot6i+ hhjFO8Dl3g/2N94PYI98lBKWs8Qdl3rtfd5NbpkDGhOsgr8pMY9qz7C51wuALTzD0esP FsARl63I/MPeLgTmvjzRR8xJ/V9WbvbG04w4PsjyA0EvzYnX70rcFD2yQ+VO5JFMPsZA sDeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Fr4I7BIS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056402279400b00460e691561esi134815ede.630.2022.10.24.09.06.25; Mon, 24 Oct 2022 09: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=Fr4I7BIS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232887AbiJXQFp (ORCPT + 99 others); Mon, 24 Oct 2022 12:05:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232281AbiJXQDT (ORCPT ); Mon, 24 Oct 2022 12:03: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 32A11303E5; Mon, 24 Oct 2022 07:55: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 409BFB81205; Mon, 24 Oct 2022 12:25:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D427C433C1; Mon, 24 Oct 2022 12:25:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614344; bh=j48GD4wqmvfik3nas3KYqwYEPabup8cKXd1O2oBA5/8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fr4I7BISfdTdcRMhLeMSx1REJ+L5CtbNrvMvfWkGCuNNHWEht79OBoahdvu+ngMLJ vkzVYVYlEjxG+vNIczjCcd9aRxdHubwB900URiGMTKm9WN3AbY90xZrel3+4WXhiI+ rwFgZSJUIZsqvIq8sej7/3MRCBTePnNhgfUQ1IGc= 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.10 218/390] dyndbg: fix module.dyndbg handling Date: Mon, 24 Oct 2022 13:30:15 +0200 Message-Id: <20221024113032.065724366@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585712704977160?= X-GMAIL-MSGID: =?utf-8?q?1747585712704977160?= 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 a57ee75342cf..b0b23679b2c2 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -196,7 +196,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: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: 9138 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457485wru; Mon, 24 Oct 2022 06:36:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4V+5KDDTGZgz7Q65FR0epJ1p1Nq576iko/hJ+JJjS0y21c1NSbUXQOYF9LCF9wwog9HN6c X-Received: by 2002:a05:6402:1a48:b0:461:900a:7f0d with SMTP id bf8-20020a0564021a4800b00461900a7f0dmr9269351edb.125.1666618566326; Mon, 24 Oct 2022 06:36:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618566; cv=none; d=google.com; s=arc-20160816; b=VL332ZGPA44Lm3sf0refJdQSUXrM/dCY03q7q2tKktU+oyrBLhgXN4JelHd63XV4at 5yru3Okv/WOAR9MohImgrk5xfkLZyLSqe200YFfEiuC/L2L9Es4VfM4uhhckMQlp7PPe RfUs+geqBRp6ISfHSZKXixAakSHzdMXAgBBvCAWlvkg8l52Icc6vWeEAZkCMYU430Jm1 1DpmeJz3akwGQnBm/c7Pz1j9mmOhpO/UUfS8p0Ykir24s9tq89kdoLBOHNqOe8/jgw9w EyurUdLlreb/O3iYVUy+uz/VxjHOYKJkkjOnyvjfK/QlECAgd4j0qgjiy/x6Hw9Irzm9 mnYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KyMnF07SAQvb08ZMW9IOT2S5TwkX1MmtFVteVr0xOD8=; b=nWvRANdpikp6JOnpFsm/E3CFAvZMLvybSgSo56BR0Z6KPQ0jhNoC1jf9ZSiB1JChId s45eXynG/iGJb/U6dbVYxPXfjKf0kjzcqEedJ9Iid49mXX6R04MZEnX8D+Pr4EpsN91B Addn/vjj2p/cPpUMYehp/2a18wXu/MwQf8qU5f1IDVLDHIrcjn0kl9EwgASEauj1sSUY A8Sx7asBi8R7XVYILi1W7/83gAMw5MeALkoWXJBUaC2HT48xFHgrASnBfOZWB4gAH2Ya 9yRpfJBVPbu4aqxYOU7o3szXU9MwHrJjgEaS7Hynu22CJbyAMz4GhNF8p5ShINnx9KcP f19g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YmXWKwWI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw5-20020a1709066a0500b00780a240cfd7si27883466ejc.493.2022.10.24.06.35.27; Mon, 24 Oct 2022 06:36:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YmXWKwWI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231283AbiJXNSM (ORCPT + 99 others); Mon, 24 Oct 2022 09:18:12 -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 S235880AbiJXNR3 (ORCPT ); Mon, 24 Oct 2022 09:17: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 7E5CDA4B99; Mon, 24 Oct 2022 05:26: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 8C2AA612A3; Mon, 24 Oct 2022 12:26:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99C18C433D7; Mon, 24 Oct 2022 12:26:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614374; bh=NY2FTV8MYPyVidj22LBkEtsyCtWrOC2P1Y4dk3MvanQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YmXWKwWIxqK0NzQbemsuaCmYPFmtG5gQMBMPwdLmRqTj6aE5ujnkaYYTY2gcdMs/f 3HZxphW0VO5NBVdwRdRRUx9t59oSNN/pvq+pJtl1t6+eZysYmfmVrNRiFDjIGQDpOr YQJwTcNIFfNIFpn4W/ZtM3vsQsF9kiVZ7hWt3ZD0= 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.10 219/390] dyndbg: let query-modname override actual module name Date: Mon, 24 Oct 2022 13:30:16 +0200 Message-Id: <20221024113032.106109731@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576230059426223?= X-GMAIL-MSGID: =?utf-8?q?1747576230059426223?= 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 e67655d7b7cb..02a1a6496375 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -380,10 +380,6 @@ static int ddebug_parse_query(char *words[], int nwords, return -EINVAL; } - if (modname) - /* support $modname.dyndbg= */ - query->module = modname; - for (i = 0; i < nwords; i += 2) { char *keyword = words[i]; char *arg = words[i+1]; @@ -424,6 +420,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: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: 9644 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp532912wru; Mon, 24 Oct 2022 09:08:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4D9iR+c6+C6/FeZR6KRQeCaW6KK3OGSfLN7U0Da15hw7mgOt51K9TD2qgtdbBM42fLPn02 X-Received: by 2002:a17:907:162a:b0:7a9:9875:3147 with SMTP id hb42-20020a170907162a00b007a998753147mr3594628ejc.546.1666627726541; Mon, 24 Oct 2022 09:08:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627726; cv=none; d=google.com; s=arc-20160816; b=NmEUt3/Vjw+wm+fNDs354dX4IqJ4rPMRoasRwAV76vpk797dtPrFtaEGIXqIDzzw2c W7mnkTEDsjTHnmQww+kZt7EO6+J/+/yZehU/SK5FP9CTUV+EROfR5IDj/PKiQszAbuaj GCNb27UAJoNVwTI/McHEu6M+oisymyP2r7q4EyOHvue8yLQ5kzpzF8iGs/AqDYnvO4po add7adYaHXyrnQgXf5s7oyItTw7iZqoadqksFGlax8jWKcc2Ji5dwLg+IW/rAtGMmWyB zFjENkMIx67pCJJobgdoO7yyMKoRcu26UcqxSE/9OR1+VB40lF94SNw3KPOa1VCWlCKa FT3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UQ3C8ZlrrS6s9rIkZwxen66/UAm8iRME9/T3AfS4yBU=; b=iKV19OYcM0t04JLtDmicTiowwvmysKkeSnxs3YFhdSzlF2i6gS8M3CB9aHP6UyxyYF HJ6niLeUaLEZkXN6GPm10P53gguuvfaFT73MhzSSQwxCwptpGWBDr4+Uv8U9nNnfYgBj sL+r/E6he1QGSjb5rFbPi0b2L9LHaRPEmuSuikCX6nAErdgv2z6S7OKuHGgRZS+nltNi 7RnCFq/2TxGsriIEOLEbS7L1VglvOm66sWOLMWI+YIc4lV/vrst4fHRVmgzmEL0Xl8bD 94k0DFEL+lHdNKU1km5MEx5mqK3+ubJSSqM7vuZzpg7c6s/YUOvgZosX0O6HUv92dimx 3KAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DuAMR19p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gn21-20020a1709070d1500b007832270e88fsi140662ejc.681.2022.10.24.09.08.21; Mon, 24 Oct 2022 09:08: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=DuAMR19p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233371AbiJXQHq (ORCPT + 99 others); Mon, 24 Oct 2022 12:07:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233181AbiJXQET (ORCPT ); Mon, 24 Oct 2022 12:04:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F373E4AD60; Mon, 24 Oct 2022 07:56:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0D889B8119C; Mon, 24 Oct 2022 12:26:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62E53C433C1; Mon, 24 Oct 2022 12:26:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614402; bh=LzSGZoNYlpfxvUABGLLZKCeoT9yYlmeRuLWFvqfT5BY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DuAMR19pCkD4N27+b9Tr0mzqNTc9bGgEFTIm0vrKCyVnjxbkCqQxzW3LeTvhkbQo+ gP+hRHJ/FQoUixvzqfQoeSWnNmUcCi8kR88fv1TegNiKoRdorenas496f9B0+xz8Hb UYhNDSw0ts19vE4HsQ3cshAov2Qb0pMGbqC/ae2s= 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.10 220/390] dyndbg: drop EXPORTed dynamic_debug_exec_queries Date: Mon, 24 Oct 2022 13:30:17 +0200 Message-Id: <20221024113032.144014646@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585834956161525?= X-GMAIL-MSGID: =?utf-8?q?1747585834956161525?= From: Jim Cromie [ Upstream commit e26ef3af964acfea311403126acee8c56c89e26b ] This exported fn is unused, and will not be needed. Lets dump it. The export was added to let drm control pr_debugs, as part of using them to avoid drm_debug_enabled overheads. But its better to just implement the drm.debug bitmap interface, then its available for everyone. Fixes: a2d375eda771 ("dyndbg: refine export, rename to dynamic_debug_exec_queries()") Fixes: 4c0d77828d4f ("dyndbg: export ddebug_exec_queries") Acked-by: Jason Baron Acked-by: Daniel Vetter Signed-off-by: Jim Cromie Link: https://lore.kernel.org/r/20220904214134.408619-10-jim.cromie@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- include/linux/dynamic_debug.h | 9 --------- lib/dynamic_debug.c | 29 ----------------------------- 2 files changed, 38 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index b0b23679b2c2..c0c6ea9ea7e3 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -50,9 +50,6 @@ struct _ddebug { #if defined(CONFIG_DYNAMIC_DEBUG_CORE) -/* exported for module authors to exercise >control */ -int dynamic_debug_exec_queries(const char *query, const char *modname); - int ddebug_add_module(struct _ddebug *tab, unsigned int n, const char *modname); extern int ddebug_remove_module(const char *mod_name); @@ -216,12 +213,6 @@ static inline int ddebug_dyndbg_module_param_cb(char *param, char *val, rowsize, groupsize, buf, len, ascii); \ } while (0) -static inline int dynamic_debug_exec_queries(const char *query, const char *modname) -{ - pr_warn("kernel not built with CONFIG_DYNAMIC_DEBUG_CORE\n"); - return 0; -} - #endif /* !CONFIG_DYNAMIC_DEBUG_CORE */ #endif diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 02a1a6496375..10a50c03074e 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -552,35 +552,6 @@ static int ddebug_exec_queries(char *query, const char *modname) return nfound; } -/** - * dynamic_debug_exec_queries - select and change dynamic-debug prints - * @query: query-string described in admin-guide/dynamic-debug-howto - * @modname: string containing module name, usually &module.mod_name - * - * This uses the >/proc/dynamic_debug/control reader, allowing module - * authors to modify their dynamic-debug callsites. The modname is - * canonically struct module.mod_name, but can also be null or a - * module-wildcard, for example: "drm*". - */ -int dynamic_debug_exec_queries(const char *query, const char *modname) -{ - int rc; - char *qry; /* writable copy of query */ - - if (!query) { - pr_err("non-null query/command string expected\n"); - return -EINVAL; - } - qry = kstrndup(query, PAGE_SIZE, GFP_KERNEL); - if (!qry) - return -ENOMEM; - - rc = ddebug_exec_queries(qry, modname); - kfree(qry); - return rc; -} -EXPORT_SYMBOL_GPL(dynamic_debug_exec_queries); - #define PREFIX_SIZE 64 static int remaining(int wrote) From patchwork 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: 9630 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp532147wru; Mon, 24 Oct 2022 09:07:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6QYe3873e5woJ5rjFaKNkFWKQoNpijyf6qkwj3bPVbUTl6+irmcqfHtEHRORk7eOvfwOwj X-Received: by 2002:a17:907:2bf6:b0:7a3:6230:dc53 with SMTP id gv54-20020a1709072bf600b007a36230dc53mr8819808ejc.82.1666627653379; Mon, 24 Oct 2022 09:07:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627653; cv=none; d=google.com; s=arc-20160816; b=eh/sbjkybv7mZprGML2kkIUXSEYUTEfPN+FkxkCUwOxS4QNB3VZkjkFbO16U6sr7Ex yvp7RCaOOyhZ39WAkQtPD31PcFJi7/EU5M1VvqblbN8zclsHw8ASZPPgZtbM9kTA0uF0 eHHQoWcVx4Wckb1iHN3gYsAyWMXV2CSJKzdBrs7U8waf5g1jELAujL8f2CqngGSrRfIk kE3TEGn7sKUWOMppOMeQJQYfnRE6CdbzyClkCHdDzWbfcrHYroxqQ7R09THB5oeDYLMZ 3sQXYTOWss+r2sucYtMWXmc4rfPIQJtiLkdqArKlzS0RNIcCgsvTu8QGgnA1RO9A4CfY H0jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yJTDbUocVtm54R96eiJ/S+MiApcIEEjtkAnY5OaZ28E=; b=Vgey7mobYHZd/wFDlZz/iH/jwqITa6tNxjTSsoR+4LQaozWViPpJwQeNReeowEOJRr sFaEq9gAG7RzCUcboPyjz5hwMYPSfsE072aUCd56jietDK21aUqaq0bsCPJzVr9iBHnB 2qBp99I2hOqAwUa6cKbA7ShCFiiSRPy8LXhKLxsUtAMDWelPKhqWJje2xXtlh8ZAdVcO lo2e/xnI6X1J6YYNObOtyPhx1ANoR3Z38uPCFpiRkMZMCodOexdHjW++FJm4lyHl8kOL 08dc24DCMda7Y24eEYaN0ThGjN8l5FDPt8g4j1az/7z+MjyuvJ/+PqaDH2ZwXph5T2bF IgAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Hl9GUfh6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j10-20020a170906410a00b0073d710fec77si123314ejk.251.2022.10.24.09.07.08; Mon, 24 Oct 2022 09:07:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Hl9GUfh6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232740AbiJXQC5 (ORCPT + 99 others); Mon, 24 Oct 2022 12:02:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231805AbiJXQBl (ORCPT ); Mon, 24 Oct 2022 12:01: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 40A3415A30D; Mon, 24 Oct 2022 07:55:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 95709B81370; Mon, 24 Oct 2022 12:26:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB0DFC433C1; Mon, 24 Oct 2022 12:26:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614413; bh=rJH3zizFjqKudqIvJyk0lbrW/rBqP46moprTTgXiqOE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hl9GUfh6HF6I4ZAFO2NmOIDVGsIowtwvV6bEc85D0/Vk7d34LboH0HwG00v9BwXCq A0UoIAmNHX2n0C5y21+pA57OvjQH6tWuV7xrfLVOvhsqkjaPIXUuFjs74fEVbE/6wt 6qCncW4DruDE1EWLFV8SIQjD8sEg6I08TvTNVKzQ= 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.10 221/390] mtd: devices: docg3: check the return value of devm_ioremap() in the probe Date: Mon, 24 Oct 2022 13:30:18 +0200 Message-Id: <20221024113032.188949508@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585758523574510?= X-GMAIL-MSGID: =?utf-8?q?1747585758523574510?= 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 a030792115bc..fa42473d04c1 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:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9621 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp531442wru; Mon, 24 Oct 2022 09:06:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM59Oz7GL2ggiu1zWtsEONSsgKCtmfp860JCmjRwCynMxF4ZxP/rhIpKFh/dgQo7PDuVbpTK X-Received: by 2002:a17:906:2681:b0:783:6a92:4c38 with SMTP id t1-20020a170906268100b007836a924c38mr28735259ejc.75.1666627590121; Mon, 24 Oct 2022 09:06:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627590; cv=none; d=google.com; s=arc-20160816; b=IPtRZM3Su9qpNsZZvGWx7umHnZFcLzY8rAe5wquNOCq4iBAMRvV071KybDz1ytmaK6 dqzf93q22QegxjTP5mnZ/VzbfJxsmAM6eMIfx2ilclNl+d0pIB+XaU8LIHmek1Sb/Fle VjIf0BMcL8n8Yg+JZ+BJbhjw+DVhlh2YJICyl93Gqf2/2XxJDSDyqpLMmf4L5zOS5+gR MhOXLsyAUEfBcz+Y/Hd1wWFIm5w8yD11BRdrw5ndBfZewKiUmGAaLLkADuEqQTEgxBfW tQhxXWOdje5wA3/sZXVG4jtnZk+eXKpm0KJ6WfquXUfRXQjHrO3U0JC1ASpyfEwoUSfU fmdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mglh/NUed9myl8jdwUehfJ6DkTvRvl5AvZOUPV4XBok=; b=Nd+16Cac/J2KX1McSeOuHY8d3NGM2n++bpEGqRr20Sc7JQbemuvZ3ruA50W038UlXm Jlcaekb1iyv/CipVysSdhLn71xyojH68o6lZF429d+YI7MLskJK05XLCVJA38nGr5oZV GD9bf/EOUluH8ZmA9vn8jEf1+HIvOAw5YEUyBICS680weqkUf+lfc6FFZWS16nxM/5Uf tkAKuqqYuaT1TPJGGzzS74szVmjSDO88PIaeLpAwPOSB3iMTuU3osW4Riso0/8XTKDVX czcya+QZa3bE99uv3ZGTsy2dqailc3s2zwsrotLYzgrbjmiq0Q0OllnZX2Xldu1FjK2n GrCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=T0pAjQzO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id he6-20020a1709073d8600b007820e1a4302si142271ejc.675.2022.10.24.09.06.01; Mon, 24 Oct 2022 09: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=T0pAjQzO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232458AbiJXQFZ (ORCPT + 99 others); Mon, 24 Oct 2022 12:05:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232473AbiJXQCs (ORCPT ); Mon, 24 Oct 2022 12:02: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 9375E18BE1A; Mon, 24 Oct 2022 07:55:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 41BBCB8167E; Mon, 24 Oct 2022 12:26:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FA35C433D7; Mon, 24 Oct 2022 12:26:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614415; bh=NKs2j46xrycp+rC2BkWY1EBoIVk7nyn2lYjtSNXnOnU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T0pAjQzO++oqmjacpOqrZsXD/p1I3RxPN/OVAkMMdFCugOXoIQYMS68NNiWiTpTHY w56M8UU20zzJ9ChUUBUsm///NlXL71KrZ5rWpQmqKYZckgwpKCpNe6Q7+mnpoKR17R 3ewcFGhTw/lmtB2VuspkGTrSKWddBg559WXcCgwA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Pali_Roh=C3=A1r?= , =?utf-8?q?Marek_Beh=C3=BAn?= , Miquel Raynal , Sasha Levin Subject: [PATCH 5.10 222/390] mtd: rawnand: fsl_elbc: Fix none ECC mode Date: Mon, 24 Oct 2022 13:30:19 +0200 Message-Id: <20221024113032.224298131@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585691878791703?= X-GMAIL-MSGID: =?utf-8?q?1747585691878791703?= From: Pali Rohár [ Upstream commit 049e43b9fd8fd2966940485da163d67e96ee3fea ] Commit f6424c22aa36 ("mtd: rawnand: fsl_elbc: Make SW ECC work") added support for specifying ECC mode via DTS and skipping autodetection. But it broke explicit specification of HW ECC mode in DTS as correct settings for HW ECC mode are applied only when NONE mode or nothing was specified in DTS file. Also it started aliasing NONE mode to be same as when ECC mode was not specified and disallowed usage of ON_DIE mode. Fix all these issues. Use autodetection of ECC mode only in case when mode was really not specified in DTS file by checking that ecc value is invalid. Set HW ECC settings either when HW ECC was specified in DTS or it was autodetected. And do not fail when ON_DIE mode is set. Fixes: f6424c22aa36 ("mtd: rawnand: fsl_elbc: Make SW ECC work") Signed-off-by: Pali Rohár Reviewed-by: Marek Behún Reviewed-by: Marek Behún Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220707184328.3845-1-pali@kernel.org Signed-off-by: Sasha Levin --- drivers/mtd/nand/raw/fsl_elbc_nand.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/drivers/mtd/nand/raw/fsl_elbc_nand.c b/drivers/mtd/nand/raw/fsl_elbc_nand.c index b2af7f81fdf8..c174b6dc3c6b 100644 --- a/drivers/mtd/nand/raw/fsl_elbc_nand.c +++ b/drivers/mtd/nand/raw/fsl_elbc_nand.c @@ -727,36 +727,40 @@ static int fsl_elbc_attach_chip(struct nand_chip *chip) struct fsl_lbc_regs __iomem *lbc = ctrl->regs; unsigned int al; - switch (chip->ecc.engine_type) { /* * if ECC was not chosen in DT, decide whether to use HW or SW ECC from * CS Base Register */ - case NAND_ECC_ENGINE_TYPE_NONE: + if (chip->ecc.engine_type == NAND_ECC_ENGINE_TYPE_INVALID) { /* If CS Base Register selects full hardware ECC then use it */ if ((in_be32(&lbc->bank[priv->bank].br) & BR_DECC) == BR_DECC_CHK_GEN) { - chip->ecc.read_page = fsl_elbc_read_page; - chip->ecc.write_page = fsl_elbc_write_page; - chip->ecc.write_subpage = fsl_elbc_write_subpage; - chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST; - mtd_set_ooblayout(mtd, &fsl_elbc_ooblayout_ops); - chip->ecc.size = 512; - chip->ecc.bytes = 3; - chip->ecc.strength = 1; } else { /* otherwise fall back to default software ECC */ chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT; chip->ecc.algo = NAND_ECC_ALGO_HAMMING; } + } + + switch (chip->ecc.engine_type) { + /* if HW ECC was chosen, setup ecc and oob layout */ + case NAND_ECC_ENGINE_TYPE_ON_HOST: + chip->ecc.read_page = fsl_elbc_read_page; + chip->ecc.write_page = fsl_elbc_write_page; + chip->ecc.write_subpage = fsl_elbc_write_subpage; + mtd_set_ooblayout(mtd, &fsl_elbc_ooblayout_ops); + chip->ecc.size = 512; + chip->ecc.bytes = 3; + chip->ecc.strength = 1; break; - /* if SW ECC was chosen in DT, we do not need to set anything here */ + /* if none or SW ECC was chosen, we do not need to set anything here */ + case NAND_ECC_ENGINE_TYPE_NONE: case NAND_ECC_ENGINE_TYPE_SOFT: + case NAND_ECC_ENGINE_TYPE_ON_DIE: break; - /* should we also implement *_ECC_ENGINE_CONTROLLER to do as above? */ default: return -EINVAL; } From patchwork 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: 9445 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp479451wru; Mon, 24 Oct 2022 07:19:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4/NO24q1htQ5iPpnEZK1e/BwhosgkJZ+AStpgdT4rwZ2YBxoEg8PvdrKR811Qyxfm1T2JN X-Received: by 2002:a05:6402:b56:b0:461:91aa:11b7 with SMTP id bx22-20020a0564020b5600b0046191aa11b7mr9835117edb.220.1666621149564; Mon, 24 Oct 2022 07:19:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621149; cv=none; d=google.com; s=arc-20160816; b=O3coLHZ9zVDocEBmT6Y2xXWagsM7ZbDyGPeLNujinBLjceiry3XnosQgcTPcCeZyBy H5gB5fZSMbOtoUiIoA2PfSCekos9+aOJKCs2cfGRYjxc7S57+inzrSUxSHkvBljdevhp rhKPwWhlzbLUK4CO4MSGqx49Evcu3Y9yF3evQ1FGTk0wJXIrEKaRffZlPLgw2+FvPJxc /rNWHHWnB+s8Zqm3iET+8W85Wtcs5CMsm1xx7NmffCP086L5rYXxWColskqy3stPSS5w 1dmBR6UsRcPrDjVVyVz3Beenv0Yt8/OsGF7XLhTRNc21i1jnyi/sTQ0jNJRUMMVmjAIY fvlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yDzZDLBfeQwxQKhsiXI9kjlEHRYagcfeA4ctb4wIQxo=; b=k26lH0ogbNJu6Tp9VYV2Evt5G4bKC8zlO1zfR8cshKt8T0Ur9pfEiDLubHwfN/KnUp BQSkoU6tWL6qkmh/Pzwym70eoldsBaq4/SeswNBTJIgNCz9cOQwacRe2KjkoYnl4oaZ4 eGzzBnNVRUWOsGgTp4MfVvlzclsal6MntjaOpiIgprL7LUCTZwOcOHGEF/M8qK4PEIUq tbFZr1WGpuZlcdqYf24y7/bI273fZsQClO8Wvpp7zNO/1ppm1Tm0XwECJ6guragMq/G6 D04fvgPDwiTt6dJbByqf+hcrnNm88MULQFnOjA+wu5yQqrXmGb/hD0jKXpXs02wPhqox 13iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="iJfWKO/6"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qk10-20020a1709077f8a00b0078d112eaf80si29690100ejc.86.2022.10.24.07.18.45; Mon, 24 Oct 2022 07:19: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="iJfWKO/6"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233723AbiJXOQf (ORCPT + 99 others); Mon, 24 Oct 2022 10:16:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234320AbiJXON4 (ORCPT ); Mon, 24 Oct 2022 10:13:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC14724965; Mon, 24 Oct 2022 05:53: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 2453261281; Mon, 24 Oct 2022 12:26:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37355C433B5; Mon, 24 Oct 2022 12:26:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614418; bh=obz5FPNMsHHx1sO6B0yQTmd5pxFcPPFY4b0ZdeXu71Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iJfWKO/6Jg+5mnCLx8hRCOl8GzDp27snQ9cO0p14bH106Tsihb+hK/M88tBslPItJ rNfIUlWLOdxJEr8c44/1VREl7N+Gfz+c0G485HlQt7Jg4lQK7i5zwQ+zz82LfPIbTA DqF64nLeEwpBAowEfrKX0ql9OCZkCu0igElMWdq8= 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.10 223/390] RDMA/siw: Always consume all skbuf data in sk_data_ready() upcall. Date: Mon, 24 Oct 2022 13:30:20 +0200 Message-Id: <20221024113032.269524990@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747578938233496337?= X-GMAIL-MSGID: =?utf-8?q?1747578938233496337?= From: Bernard Metzler [ Upstream commit 754209850df8367c954ac1de7671c7430b1f342c ] For header and trailer/padding processing, siw did not consume new skb data until minimum amount present to fill current header or trailer structure, including potential payload padding. Not consuming any data during upcall may cause a receive stall, since tcp_read_sock() is not upcalling again if no new data arrive. A NFSoRDMA client got stuck at RDMA Write reception of unaligned payload, if the current skb did contain only the expected 3 padding bytes, but not the 4 bytes CRC trailer. Expecting 4 more bytes already arrived in another skb, and not consuming those 3 bytes in the current upcall left the Write incomplete, waiting for the CRC forever. Fixes: 8b6a361b8c48 ("rdma/siw: receive path") Reported-by: Olga Kornievskaia Tested-by: Olga Kornievskaia Signed-off-by: Bernard Metzler Link: https://lore.kernel.org/r/20220920081202.223629-1-bmt@zurich.ibm.com Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/sw/siw/siw_qp_rx.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/infiniband/sw/siw/siw_qp_rx.c b/drivers/infiniband/sw/siw/siw_qp_rx.c index 875ea6f1b04a..fd721cc19682 100644 --- a/drivers/infiniband/sw/siw/siw_qp_rx.c +++ b/drivers/infiniband/sw/siw/siw_qp_rx.c @@ -961,27 +961,28 @@ int siw_proc_terminate(struct siw_qp *qp) static int siw_get_trailer(struct siw_qp *qp, struct siw_rx_stream *srx) { struct sk_buff *skb = srx->skb; + int avail = min(srx->skb_new, srx->fpdu_part_rem); u8 *tbuf = (u8 *)&srx->trailer.crc - srx->pad; __wsum crc_in, crc_own = 0; siw_dbg_qp(qp, "expected %d, available %d, pad %u\n", srx->fpdu_part_rem, srx->skb_new, srx->pad); - if (srx->skb_new < srx->fpdu_part_rem) - return -EAGAIN; - - skb_copy_bits(skb, srx->skb_offset, tbuf, srx->fpdu_part_rem); + skb_copy_bits(skb, srx->skb_offset, tbuf, avail); - if (srx->mpa_crc_hd && srx->pad) - crypto_shash_update(srx->mpa_crc_hd, tbuf, srx->pad); + srx->skb_new -= avail; + srx->skb_offset += avail; + srx->skb_copied += avail; + srx->fpdu_part_rem -= avail; - srx->skb_new -= srx->fpdu_part_rem; - srx->skb_offset += srx->fpdu_part_rem; - srx->skb_copied += srx->fpdu_part_rem; + if (srx->fpdu_part_rem) + return -EAGAIN; if (!srx->mpa_crc_hd) return 0; + if (srx->pad) + crypto_shash_update(srx->mpa_crc_hd, tbuf, srx->pad); /* * CRC32 is computed, transmitted and received directly in NBO, * so there's never a reason to convert byte order. @@ -1083,10 +1084,9 @@ static int siw_get_hdr(struct siw_rx_stream *srx) * completely received. */ if (iwarp_pktinfo[opcode].hdr_len > sizeof(struct iwarp_ctrl_tagged)) { - bytes = iwarp_pktinfo[opcode].hdr_len - MIN_DDP_HDR; + int hdrlen = iwarp_pktinfo[opcode].hdr_len; - if (srx->skb_new < bytes) - return -EAGAIN; + bytes = min_t(int, hdrlen - MIN_DDP_HDR, srx->skb_new); skb_copy_bits(skb, srx->skb_offset, (char *)c_hdr + srx->fpdu_part_rcvd, bytes); @@ -1096,6 +1096,9 @@ static int siw_get_hdr(struct siw_rx_stream *srx) srx->skb_new -= bytes; srx->skb_offset += bytes; srx->skb_copied += bytes; + + if (srx->fpdu_part_rcvd < hdrlen) + return -EAGAIN; } /* From patchwork 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: 9601 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp529583wru; Mon, 24 Oct 2022 09:03:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5IUJpTA08SzpTX1JgE298mCeFxcCNGn3jJPR9JMxz2tS7EW2UdiQ403Hw/hWhV3sdbIKJt X-Received: by 2002:a63:5656:0:b0:446:8eb5:a2c5 with SMTP id g22-20020a635656000000b004468eb5a2c5mr29441080pgm.336.1666627430152; Mon, 24 Oct 2022 09:03:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627430; cv=none; d=google.com; s=arc-20160816; b=cgZ4vPZakj14vS1FoUpxMti4UIy9RvawH4nYF/mO/K31fUFrBdT97ldB2Gx3Q8xtbz x0mQmsfc9dZB++S3DrX65jPvo2EWeh+gIfQq//2aMv/NsRjljpFVgb3qFgJHVqmeJbIk RfWhB4/7WC4X0WaE1fs7WhupQfYIhEx9AwbKaBiNgdMKL1xjap/1iJlDIBrlQ7XwgRMu Yfi8EUq7Ebm3PoSu+6Fv8TXOEhv2NYbEVYld8D59KNkQ7k/RUIET7kwpPz4cyWvnhVQu jHCPTuqHUkebupz3nXJLm/U9KhQtt3yZNAe++uOPmYUgld1E6TEBpRkLmCT810M6J5pK +iPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=qeQP5M9/fpgF3GOWgTkK26xWL6RJWYXij6hjuJupJhaVI6DFUFo2ZUJejvZJdy7ttR zLsHvVPWxBnoQERzAR/DEMU19oEZ/Go0obyc496dZ3q2m7Bk33dIR5RSeLour665Nzm9 7OBLnUupYDDVauR6gPk8IcyqpLHqdPWIbb4papqRxdXikWi2eN6k2vgCB38Qy4hfW9ws V5h9lmeJmcvVTglpC8lZkol+mP5IbpLMYXo5aUfUVykRr41CTfCMOQ9Bfx4LL5OzQUQk BZQEJERkUvSALDy1swN+vTicOqO5sr29WhKCu5rug/ypAP6rP3dAFyhwslRaporHwYAJ JZnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="G/saWFEv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m5-20020a63fd45000000b004561c1f132csi36671417pgj.346.2022.10.24.09.03.36; Mon, 24 Oct 2022 09:03: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="G/saWFEv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232660AbiJXQCV (ORCPT + 99 others); Mon, 24 Oct 2022 12:02:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232342AbiJXQAo (ORCPT ); Mon, 24 Oct 2022 12:00:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5D3D8991E; Mon, 24 Oct 2022 07:55: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 80CF7B81181; Mon, 24 Oct 2022 12:27:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3145C433C1; Mon, 24 Oct 2022 12:27:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614421; bh=xGYjKcOLlvZoNqj94TrqhJyt9N8mS9hRdIcXcQIs8x4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G/saWFEvaDSyI+0kFJPwq3KCw5yFe7T9YEXkmljxyWoccvFvTMAQXi5xgB1beWeNh V0XamzQigfC4lAodl/TZIpGMSkmCBEbm8j0+FkY0h4PEhxpau6iEO5kRUSpm4eXMhm Nc+th26rJra1TD4aDJhXe7kLkV9ozjfrtx4U8WU4= 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.10 224/390] ata: fix ata_id_sense_reporting_enabled() and ata_id_has_sense_reporting() Date: Mon, 24 Oct 2022 13:30:21 +0200 Message-Id: <20221024113032.311407255@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585524205833430?= X-GMAIL-MSGID: =?utf-8?q?1747585524205833430?= 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: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: 9289 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp463404wru; Mon, 24 Oct 2022 06:47:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5vOTeXSjeQFkvkPvG4NrB34icqybaa0e1UD18jXIkScLUr0QhRqqVBOylUz3/MS+usAYFv X-Received: by 2002:a17:907:9605:b0:6f5:c66:7c13 with SMTP id gb5-20020a170907960500b006f50c667c13mr28630980ejc.66.1666619272219; Mon, 24 Oct 2022 06:47:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619272; cv=none; d=google.com; s=arc-20160816; b=vbKvf2kUtuyqDJS2aTM5hhYY1rbY/Vy1omssjyAkdfJH6GODETWdQK1aPy7jCnDLOB a3HfAbwyoH2QPac7KrfAMyyxxT/olJ3HPpSI8yiRKzs3L7qDB8tBKs6Mu3MRmm6ncJBT Cj/4jcRmbAvcP2zppvMsX1gIOeOHxhfnc/Tss/GJyiOeFGWVN4QE8h9Vk32X22vI1UD9 dEAMsa/91X+51gv8cg2ljqTgSpATsmnp6uxZTeqr3qzcslY7/kFflJiSwPgf6d8yFScw 0N63ooDopPkHx/Bjg+8GKsNh2sUZnqmqxqJCThUPJXHtvaPPo/VNwjcZ+L6BKaojp3bC tZ4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=07EnSskCzxNyCsQgAdRlS6dJRpp/5QxlQyOFGPxPTCtsVixMT69FEO1uMFIuRiWcbh 178UudSvkaZ8897pFgKMxXSSoKasrfnVuVQ7+1uWREKe+IWAobAdKQojaz3CoWdVo6FD oLQ+UOSLzcSB9Yn/ciwzrGZT5cYqTQROZBad2ENDk22NI9wwp+5Em14jrAWWKhXywZVs dHnipOj4coX/38rh2sd2zo1Wnbnz7m11DE4tKOEZ+ssGVo+ACSKjbxp4sBBnOpJBY9xP 0fRRPKnL4jC1MKhCjaULnovAafTYBwHZ323O9pPF/Hq7IVoGdC6NLXULmYeWrAH4j5TF 1qUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="e/oCg/2k"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fk4-20020a056402398400b00459b51c2b25si26737918edb.438.2022.10.24.06.47.27; Mon, 24 Oct 2022 06:47:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="e/oCg/2k"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236203AbiJXNns (ORCPT + 99 others); Mon, 24 Oct 2022 09:43:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236812AbiJXNlT (ORCPT ); Mon, 24 Oct 2022 09:41:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12DD78993B; Mon, 24 Oct 2022 05:38:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6B03A611B0; Mon, 24 Oct 2022 12:27:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79A5DC433D6; Mon, 24 Oct 2022 12:27:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614423; bh=MAndz8nMfGWumzgeumXtIyvQC0YhR+/u+DyUw+CVihY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e/oCg/2kcUpRUG4+TwFTAsel+PG1ON5mrSxp82dqNh7p4g1vVkTbS0vgrxgRVKOmL IqHnqtD1dyIyASM4muJQaFGKuFS6dI0VWtZIb7KPLbskEBCIZedAph4giWCv3RpYNz SyvM6/fg8we/EhRea0fj36YyOj1mDZ0EbsSxgyog= 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.10 225/390] ata: fix ata_id_has_devslp() Date: Mon, 24 Oct 2022 13:30:22 +0200 Message-Id: <20221024113032.360887382@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576970044110781?= X-GMAIL-MSGID: =?utf-8?q?1747576970044110781?= 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: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: 9610 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp530875wru; Mon, 24 Oct 2022 09:05:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM54q4QWCC7/92Ssp1YwoEjtwX44INpiL3HdWUKk2zV7/z6WhSKhtddC2BoZJgUkjUPGzyHf X-Received: by 2002:a17:90a:5e03:b0:210:d4b3:4c98 with SMTP id w3-20020a17090a5e0300b00210d4b34c98mr30542758pjf.63.1666627539117; Mon, 24 Oct 2022 09:05:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627539; cv=none; d=google.com; s=arc-20160816; b=0G04rjOSk6iZGAkVk+2gZ7QSauwUFWsjH6Rqzp1QsoCaWMoNIhUkykrgXiwbybShoI VVAsCO0s6zkvqryx4PdqH89BC4qTuQEaPm9R4zFPglpmkVJiNNsrSFkdx+Aus7X/4uEn HrE+6FKYsNAte1rO/0Ab+2oxqbVDHxEEcp3SNoLFeQWz10G6CNd+B6UfIkY7mpWYedF4 +6nXzmfuVXQpN1m6dHtTR+RhESevsVwl3WDW+pQZ3kmh3faHl0nkiKb9NjtjwyrmDX++ dhUzh4Qnto1rFomI1cSwlhiFjwODk/YOR5zFDuICbaFxGcqV/g663QzTHxjrEG56CkiC 6Ptg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=OE3QJY0WQCWVnsOKoYsREc1mU3pBsk+0m7KnvOY+JZ7RyO0BA8nQVOEvEz7AsaLoqK SIwdVaYttxii3Q6oMuDwAO4P56UOwvkei7c3rr01H/VZNFEhRFzM0f4Sjyz9V8+gCWaf w/w7m2sy3jYvKL3sNUKTmfNSuWm3L0kp5wX0l9/5WLJb7Vnl0sso4KE6WWDwe1wf7Qpl WI8A1mcclUB5WVHu5OLo/ewkuaRsLXLxhCTHMpiwuX/ZWBDfERmT3gn5Lw/f3nIOUAyN oMDCsdZqtZxMAsERW3wZNJwupCNQ8+QuuCI+ybmSKV5Ku5KfXRNaea7zVx41BCLp7e4/ Dfog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HRWCaJA8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q18-20020a631f52000000b0043447486c84si35025949pgm.875.2022.10.24.09.05.23; Mon, 24 Oct 2022 09:05:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HRWCaJA8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232779AbiJXQDX (ORCPT + 99 others); Mon, 24 Oct 2022 12:03:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232342AbiJXQC2 (ORCPT ); Mon, 24 Oct 2022 12:02: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 A7658115408; Mon, 24 Oct 2022 07:55:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AD99AB815F3; Mon, 24 Oct 2022 12:27:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 156C9C433D6; Mon, 24 Oct 2022 12:27:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614426; bh=xPThxkg/kWjmznk8UoQBVXx8Q5wQiDakS3AeMMjacOk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HRWCaJA8ZsE4QvSrvJrnUd9gC7Qsmo0AerJXG6lwoswVCA61mhAZwuFOdyQe1Hk4I MHhDoSvQeukc87qUUZuW1RNsQPT3JOg1MNL+Zfw+/mZ+QJw4DFfExAhAQb+sVGgu3K xtB/61dEBsAH66SshydNEKkSk0gLgTr2fFspIFv0= 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.10 226/390] ata: fix ata_id_has_ncq_autosense() Date: Mon, 24 Oct 2022 13:30:23 +0200 Message-Id: <20221024113032.408434574@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585638787969361?= X-GMAIL-MSGID: =?utf-8?q?1747585638787969361?= 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: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: 9133 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457269wru; Mon, 24 Oct 2022 06:35:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4t2buRVj3U+g2A0sRM4KfwDqAxKvv+TrtEzuAPvOGs9T890tw7+a4m0RRP475DpFzPwKRb X-Received: by 2002:a17:902:f78c:b0:17a:ef1:e902 with SMTP id q12-20020a170902f78c00b0017a0ef1e902mr33174692pln.5.1666618543068; Mon, 24 Oct 2022 06:35:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618543; cv=none; d=google.com; s=arc-20160816; b=cePA1JKoubVnRXnWWeP8/4ZVGk0iF782ILKIPmmXwpoldqnQzfHBqDeKXkNPN8hJ60 enTooE2jfP1TcV1rZdvbN/UwtAE6hQA6e701d1zZcf9et+SmgYStVv4L/iTQAIF9URPs VZgcm4Eave11xn0pg7Rfo8SfjoPjAETivhEP2vrZmjtAeIDGHrtlFT/lb4IbkqBGKKnh rw1HoLJz+m8VcbbCtsmrrA09WE2AYrVY7hp3j8zFDD41gq8i080DWj2oCNKfbcUO898s 4t5xoC8uPdHxCIhrecD3lm+cqonB5ngP9M5ZN1TDMl2i5SIocjdZjRyOd/Qg/cfBpAcM jhYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=cXivj58t6JnzUCOpnrl/aIr7eAT7faRkfLOZ2QH5ksedmzE1WpI9Gv3gpgvBVBFcjg C5MhIEotSUUSwBVaGyiPu3dfGvu7ZogPQV6ByeTMc4v+FQoQaXM+ukCS/DtTUYvGmoUt J0oS0+5um8vf4odX5czB/TIEmaSLKn4TWm4eXW9C6TDEtKuU22LYOLAyuvf0XyXsoU1i OteSEf+ssqfNgwaRbeoWW7KPoCeo1sq2EdkS9IJPxrj+js+ezcSllj70u8HhL5fnqJEd riscQ+tETdfE68JzE3ZidLe/rYN/2CEAXPKTrR8oH54cXZTdhqnKNfWfgKnZjHmn3OBY 6Yug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jAYoqm9r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j12-20020a65428c000000b00460358671dfsi33788253pgp.513.2022.10.24.06.35.27; Mon, 24 Oct 2022 06:35:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jAYoqm9r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235886AbiJXNSt (ORCPT + 99 others); Mon, 24 Oct 2022 09:18:49 -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 S232806AbiJXNRd (ORCPT ); Mon, 24 Oct 2022 09:17:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CB99814EA; Mon, 24 Oct 2022 05:26: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 21061612D1; Mon, 24 Oct 2022 12:25:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3025BC433D6; Mon, 24 Oct 2022 12:25:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614347; bh=2vgZYrGdBLmeat8hb0agASqFn5UrbCmTTg2/geDVt9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jAYoqm9rPe9vq3bpPNWMw5IKp3B/WaSX0iJkadZ+E0wBytEsv6jgPkChaBhr+L0Pr nfn408zRDVMB5IWYJ00qKmaGLnlMgpTFCNFZ11sMeTYsvDVcFYDkD+F7hu+1CcIe4e 5fW89e/x88sM1Q6P8HXEALJOP+sYp890/Yj/3oWI= 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.10 227/390] ata: fix ata_id_has_dipm() Date: Mon, 24 Oct 2022 13:30:24 +0200 Message-Id: <20221024113032.448471522@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576204956091122?= X-GMAIL-MSGID: =?utf-8?q?1747576204956091122?= 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: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: 9619 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp531395wru; Mon, 24 Oct 2022 09:06:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM54pPzelX+8olXwI38ibZaEgSNc4/jpi9yHw14vLvLnWcPucBGVBCXkm+dF9uxUxweCagpw X-Received: by 2002:a17:907:728b:b0:7a1:b545:b39b with SMTP id dt11-20020a170907728b00b007a1b545b39bmr9802397ejc.661.1666627586806; Mon, 24 Oct 2022 09:06:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627586; cv=none; d=google.com; s=arc-20160816; b=Rn2EymysBOxK5vBVdLFcEo4dINh34ahVV8l+cumTO9SeneURymPrtuUE2+9k2RlwBE 0KhKYSKM0kio3jAK4Klo7VWo/Txf/0CtGbIYxmR9ZbafoeB4/FC3tr4bGqDlR+CaANsn FFvQZWaGpj8Im2Y9iGd0sy0lsekF+8wvVY/yivefNcGOYZkQPEGghlLKWc82+MUK8mtC iA+Hhvph0uebB/ePdc6iQvpq4yEdzHreR1T1sdxhXZZ8PzPlysscMn4xNA69rW4l61yU IZsexDyMN2Q60Ij0rN/TXQwmRuLAMTVpps7BoZFvIZYD73qMfGUWuBWhB1uLfHOk1voi uCcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Yz2N62sTA62P3dx0CMzimrj/t8Lx0IH5AHro4fNAaZ0=; b=x9LxqJowlgdkcXKsLdJkbnIuinxcCZlNsgSsijMieutdS5GzoRQYaC2u7XJ71G5et4 fWBg49WIB1m0+JuFMo9GsdCS4v+OR0pLiWUdSrnC4YTZjkpkMz81ROGQSr5GUeqfwnPd /dEE1lPVbyoS1/6GV72JuK4BODjzzuENu8N6eyz6BQ6pqLJKudCKVSSNus3pBh7RPNKL 617X6ImUpFKnv5c+M4KUEV+DgDlqzXzylBuZNe1po1Hxq/io2uw7D/lyNyk4VNbsB8O6 z6GAfiitknOMypjSwvj3VPEu3Pe3t7Lc/A3iple3QyIKMSyeGFXqkih2Fq4cHitvEn97 snyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vm+mzXeE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170906195100b0079857369ed4si122604eje.223.2022.10.24.09.05.48; Mon, 24 Oct 2022 09:06: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=vm+mzXeE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232598AbiJXQCy (ORCPT + 99 others); Mon, 24 Oct 2022 12:02:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232517AbiJXQB1 (ORCPT ); Mon, 24 Oct 2022 12:01:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6686EE8A8E; Mon, 24 Oct 2022 07:55: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 77659B81201; Mon, 24 Oct 2022 12:25:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC7B2C433C1; Mon, 24 Oct 2022 12:25:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614350; bh=nE7ypUANDIJpipcxO0dxAb6r1ge/slva74N+RfEwMgI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vm+mzXeE4OwSWmiwsN+MQ/EaJc0dzMVmq2mE6GTp1fs+ShUK+c1pd1ODjYE2UdY3p MdUhPVlJqEPo3Cflk4fyNYkt8l3R3ZZAF+6gdJoHxH7kiQVlivyodzVKAM74jgqcPY cBiNTzTHeFJjrBrRvhKpVkByEEduPaeEEKgEItQ4= 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.10 228/390] mtd: rawnand: meson: fix bit map use in meson_nfc_ecc_correct() Date: Mon, 24 Oct 2022 13:30:25 +0200 Message-Id: <20221024113032.487816756@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585688687805402?= X-GMAIL-MSGID: =?utf-8?q?1747585688687805402?= 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 327a2257ec26..38f490088d76 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: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: 9633 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp532398wru; Mon, 24 Oct 2022 09:07:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4rWsyybxH+l9QC8KfFiO/SfQZwnBF6XMls75XkyyjWVBqxyq2G9QnIW+dzClVJD3ctw0wR X-Received: by 2002:a17:907:96a0:b0:78d:dd45:a6d4 with SMTP id hd32-20020a17090796a000b0078ddd45a6d4mr28602012ejc.643.1666627677580; Mon, 24 Oct 2022 09:07:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627677; cv=none; d=google.com; s=arc-20160816; b=BPDegKSBF1KGzs8Rud4XursvEL/JMf3+Qe4aNdVqIFL1T/0GTQPbG1AJ3DUs/F4I8X rSjKZL4VMJnVdFljVXcV8Fu+a5rCpzDkTCzQHvAK0cowlAdCiGEie6LCgcb7t+A686Ct aA/3N32IbZgBqk/RgrNCE0NxVO5JohISlzlZwRWfeuJglPQDoiZrktww0vuVYngaaQG6 IwKNDUiz8V0L1dA7PMuV0YQHPAH6AKP2Y6Fdnhk7d4kB4FxRDhbXdNOfgv8idU1tJYgM naknA4m+MAKWAghs6oTk2LRqToBf3/NJJ6wKD3fOKu7tO/IrBzTVE15ObdLQ8WAago6m VNFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lIufeqATEhtdcEH+uVyvdR/iXs36IpS+qTXkAXvRT0o=; b=NjOtmHdcNzqO6BKcQG2E2TKCc2+unmap97mqtNQQ2II0xZY0/pASnTFaVRcV/7H2IH nNa9Dl+OIrp/nhDmENrNCiiypo/BmMhMtioG7bIWRgTeegRzhW6pv9Lu1AND19VjfMMM deH/CnYIPqqm43EA4dEGlfLNFoIGhf8GATB6gbUJB8SF2cMF/BpLnGaa0piIT4gn4CXF XT6WsJKeGKBGPGq7RP1tkzRkjleHlHeLRxgNd+YMtadmJRKm5rJ9lbNCWTSVPzDdmgo5 4+LLFvNLH1IwnKnSsC/1m3yaoRv31kLV7iKcAE1rQNvDwXIp70M4S+xTWEAxxUKC3Urk s0Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FnV4aPex; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l19-20020a170906795300b007a65a87f839si166837ejo.114.2022.10.24.09.07.33; Mon, 24 Oct 2022 09:07: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=FnV4aPex; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232190AbiJXQGw (ORCPT + 99 others); Mon, 24 Oct 2022 12:06:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232999AbiJXQEI (ORCPT ); Mon, 24 Oct 2022 12:04:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F8EB1E5741; Mon, 24 Oct 2022 07:56: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 16E45B81689; Mon, 24 Oct 2022 12:25:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 738F6C433C1; Mon, 24 Oct 2022 12:25:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614352; bh=3P1RuKW+50OYJAFeMcmTfsusDpHOt5nIdo0NuyDhDno=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FnV4aPexrmT/4cg97X5a0nnfmxXcS5Vg4CRm3uKdzSgf7H8p4y6rNYpEQrkbCyrRd xdgk/18bx21MkbSZAZQXRL9AKPgZ1jvS+KQHk2K59a0VfgFWXNZcCgm3xJxzY2Y+G9 up9E8jM4beHns03liDRIzSq6dHEHLjwSflF8oAJM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Kelley , Guoqing Jiang , Saurabh Sengar , Song Liu , Sasha Levin Subject: [PATCH 5.10 229/390] md: Replace snprintf with scnprintf Date: Mon, 24 Oct 2022 13:30:26 +0200 Message-Id: <20221024113032.534421415@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585783393225005?= X-GMAIL-MSGID: =?utf-8?q?1747585783393225005?= From: Saurabh Sengar [ Upstream commit 1727fd5015d8f93474148f94e34cda5aa6ad4a43 ] Current code produces a warning as shown below when total characters in the constituent block device names plus the slashes exceeds 200. snprintf() returns the number of characters generated from the given input, which could cause the expression “200 – len” to wrap around to a large positive number. Fix this by using scnprintf() instead, which returns the actual number of characters written into the buffer. [ 1513.267938] ------------[ cut here ]------------ [ 1513.267943] WARNING: CPU: 15 PID: 37247 at /lib/vsprintf.c:2509 vsnprintf+0x2c8/0x510 [ 1513.267944] Modules linked in: [ 1513.267969] CPU: 15 PID: 37247 Comm: mdadm Not tainted 5.4.0-1085-azure #90~18.04.1-Ubuntu [ 1513.267969] Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS Hyper-V UEFI Release v4.1 05/09/2022 [ 1513.267971] RIP: 0010:vsnprintf+0x2c8/0x510 <-snip-> [ 1513.267982] Call Trace: [ 1513.267986] snprintf+0x45/0x70 [ 1513.267990] ? disk_name+0x71/0xa0 [ 1513.267993] dump_zones+0x114/0x240 [raid0] [ 1513.267996] ? _cond_resched+0x19/0x40 [ 1513.267998] raid0_run+0x19e/0x270 [raid0] [ 1513.268000] md_run+0x5e0/0xc50 [ 1513.268003] ? security_capable+0x3f/0x60 [ 1513.268005] do_md_run+0x19/0x110 [ 1513.268006] md_ioctl+0x195e/0x1f90 [ 1513.268007] blkdev_ioctl+0x91f/0x9f0 [ 1513.268010] block_ioctl+0x3d/0x50 [ 1513.268012] do_vfs_ioctl+0xa9/0x640 [ 1513.268014] ? __fput+0x162/0x260 [ 1513.268016] ksys_ioctl+0x75/0x80 [ 1513.268017] __x64_sys_ioctl+0x1a/0x20 [ 1513.268019] do_syscall_64+0x5e/0x200 [ 1513.268021] entry_SYSCALL_64_after_hwframe+0x44/0xa9 Fixes: 766038846e875 ("md/raid0: replace printk() with pr_*()") Reviewed-by: Michael Kelley Acked-by: Guoqing Jiang Signed-off-by: Saurabh Sengar Signed-off-by: Song Liu Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/md/raid0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c @@ -48,7 +48,7 @@ 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?"/":"", + 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: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: 9629 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp531997wru; Mon, 24 Oct 2022 09:07:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7yj7jW/fbHuNns7kHUJ8oDEkRzFwuWDHCBxjmFtOm2vvUPv6QpiLg3zQr9pHmvkdAUAwWW X-Received: by 2002:a17:906:fe46:b0:73d:939a:ec99 with SMTP id wz6-20020a170906fe4600b0073d939aec99mr28635150ejb.169.1666627629910; Mon, 24 Oct 2022 09:07:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627629; cv=none; d=google.com; s=arc-20160816; b=oL1Wr+fwjwQ8g2gR1Lrp6EgafDTVKUEAZRDgLiye5jYK1mvVN00rFHJqz56ZH0X3Jq KtFKwbZbBm3DAKE1h/kwHSi7U38f95oKwQb/bRDn+6Rl+ETAcvHXefKIc2HXDKbeEqG5 oIS/nrCQoZmr8k14VJxyvP3lJJPN5dXu9H+ICIA5JEhXJDqJHpojU16fXE8grhJV3NWN ep2TjofCgSccqmUzqK/t7CyfPSn0mwI52vu30kPHZ5+JTgnRkwWg9W3h7BvQEf6yfuby CutAP8ynNbdRZ6ZQwEcHwnYMTNhM14WWJXXHD76049ao3fOyCZp5McG4UE6EF6CzbGHD Z25Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DVACNHFwX/rylEGwwfgPPGe6G1/OTsSVMWnxW6DQo1Y=; b=bzunlwYFKGN54RiPMQ3dkvxff1kfzJqSu8pqoC03KyUvuHm/ObYvDLAD6gxFb+Xjgt 1N9hmMxtGXWeHxFgwJFGLcx4wmFSv+TrH3UoogkJs7I7D/P73/4pksjXqDRauYWdqO0T RpbbEfFxDYbOFpy2T1LtVpsvkRihnuh0+lyFYvkR5J36GfzQ86b2O899h6GddeF0JPHw Xswa47me9bFbjOhEwsTDrorZeJDrQImq2dFHcibA6JPx1IWMnS8robx2/CL79qLhANaF wKkJvNHpMNbfovmdYNUt/Ri4xd3niwmQ85FI9ImLEMsbyfHWbgVKC5umq23aByvmDJvF mJKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=td3JnOHc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v19-20020a056402349300b0045be589ca7fsi167531edc.331.2022.10.24.09.06.44; Mon, 24 Oct 2022 09:07: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=td3JnOHc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233029AbiJXQGH (ORCPT + 99 others); Mon, 24 Oct 2022 12:06:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232342AbiJXQD0 (ORCPT ); Mon, 24 Oct 2022 12:03: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 9E3EB1C2F21; Mon, 24 Oct 2022 07:56: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 C136CB81684; Mon, 24 Oct 2022 12:25:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E967C433C1; Mon, 24 Oct 2022 12:25:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614355; bh=XS0Hdfl2pYxATSwpgJxBoi+EwwhRfcxcGSPPYm0CGE8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=td3JnOHc4VPI67rZqkuksIH0Hoj3IKwlgOekGdgSASBEUgYLkLW/F/0KeIZfWF3kH mAvwP/E0f7HiHBR82o0LwF/T8HtfJEbONpSgEBllvpsRqriIs9xO7JNcaoEZH+DZEf ZdKWUu0rW4qzJq+VyNAhOxSj2hWTaRySm2og2bEs= 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.10 230/390] md/raid5: Ensure stripe_fill happens on non-read IO with journal Date: Mon, 24 Oct 2022 13:30:27 +0200 Message-Id: <20221024113032.581886966@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585733548705893?= X-GMAIL-MSGID: =?utf-8?q?1747585733548705893?= 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(-) --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -3936,7 +3936,7 @@ static void handle_stripe_fill(struct st * 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: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: 9121 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456294wru; Mon, 24 Oct 2022 06:33:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7bpaN4gdujxlbY5UGJM0Tg18PPbFTl5whDjDnYDxB9sovHjNdyadymIzLDz8rOtQgNP1CW X-Received: by 2002:a05:6402:4029:b0:45b:d50c:b9b0 with SMTP id d41-20020a056402402900b0045bd50cb9b0mr30682311eda.126.1666618436556; Mon, 24 Oct 2022 06:33:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618436; cv=none; d=google.com; s=arc-20160816; b=HoqGgzIeguV//SSKGbcM0H0FNcvKFQie/fGiB/nITlzw/s+LiUHHo2ORge6clPQOpR 4J04XhdwT4KaC87L4yyVo0ip00EWSFk9W5ImpEfSqkpGkEeyZPTOn/Z1DeN2XKM34yvX G1mc4mKyEufzn/NENESVrv72ksKnJ6rj83cq9V/1AyTrgf9UCpg8SW8I10ux7F16WPVR o1INVjyFLoy6iAr8z6TTg/VqfLppN9wgbjNiV2bCQMUiV/NLExETfOs7j0Z6xEw+4jJV U9nhVUfIuat7G/cx4kPcpC/5FHx58mUy2KlXDw69doT6FlUB7H5NIDWmpMcbLP1IIVDN 006Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VJZqEYS6mOjQ+lOS2PfAcWkaI+pPzr80W8SVByAzm0E=; b=ZZIGP1t2xrjx9RwBAdR/B4ckJjn6SF8KwIsWQIDEv+xDsL3scFBcV9NSqK04K0hjEL nxNkAGvf82jJpxBEctFKTZiMVzsNJ2oZgMFzGEmkswr2I//VU5bgPxRqpeXq4mgMDLl5 /AohkN46Y8rX+ufxZTiHd9yjIacVE8NrhqT4ZeCLwuySVIAn8G/jzfjyHw5gyXsVjJkZ qu+YwAwCprwpwuuh7Q6M33igUOzmvz2+RNk9ATvHNhae4AtlvAW7DAY+eTo/SFcbBuh9 oXpiUig/4trFt+DlvibbBWxrWFEdnqJ5k7V/OxpsVjxYfT15YZtJyKtKw1/hompf0Syd cIVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HyYwiGp6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020aa7d693000000b00461d3757951si1821163edr.607.2022.10.24.06.33.28; Mon, 24 Oct 2022 06:33:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HyYwiGp6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231425AbiJXNSH (ORCPT + 99 others); Mon, 24 Oct 2022 09:18:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235932AbiJXNRQ (ORCPT ); Mon, 24 Oct 2022 09:17:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF9E7A3F44; Mon, 24 Oct 2022 05:26: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 A6B95612BC; Mon, 24 Oct 2022 12:25:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BED1EC433D6; Mon, 24 Oct 2022 12:25:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614358; bh=kV9d18G9T/YjzHDps5KKzk5SgDYJImYmuS9j/QndjsQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HyYwiGp6QGYu6Bl3wtWd7+b6rfDJZBjsqymKpROaRWVBQELztrC4zRBAsm09+R+KD c1DSZ1G0x4ZSBi6HD5zQJARMsrUXxzwqzwhFj6uPNIzN/2mT8cGtSTIwWvFyTpyM16 3fSedvyBrHCpzUTX5bAH4wqj6MwSn2kbz3Qhq3rU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Zhang , Mark Bloch , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.10 231/390] RDMA/cm: Use SLID in the work completion as the DLID in responder side Date: Mon, 24 Oct 2022 13:30:28 +0200 Message-Id: <20221024113032.621977545@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576093560849776?= X-GMAIL-MSGID: =?utf-8?q?1747576093560849776?= From: Mark Zhang [ Upstream commit b7d95040c13f61a4a6a859c5355faf583eff9658 ] The responder should always use WC's SLID as the dlid, to follow the IB SPEC section "13.5.4.2 COMMON RESPONSE ACTIONS": A responder always takes the following actions in constructing a response packet: - The SLID of the received packet is used as the DLID in the response packet. Fixes: ac3a949fb2ff ("IB/CM: Set appropriate slid and dlid when handling CM request") Signed-off-by: Mark Zhang Reviewed-by: Mark Bloch Link: https://lore.kernel.org/r/cd17c240231e059d2fc07c17dfe555d548b917eb.1662631201.git.leonro@nvidia.com Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/core/cm.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c @@ -1643,14 +1643,13 @@ static void cm_path_set_rec_type(struct static void cm_format_path_lid_from_req(struct cm_req_msg *req_msg, struct sa_path_rec *primary_path, - struct sa_path_rec *alt_path) + struct sa_path_rec *alt_path, + struct ib_wc *wc) { u32 lid; if (primary_path->rec_type != SA_PATH_REC_TYPE_OPA) { - sa_path_set_dlid(primary_path, - IBA_GET(CM_REQ_PRIMARY_LOCAL_PORT_LID, - req_msg)); + sa_path_set_dlid(primary_path, wc->slid); sa_path_set_slid(primary_path, IBA_GET(CM_REQ_PRIMARY_REMOTE_PORT_LID, req_msg)); @@ -1687,7 +1686,8 @@ static void cm_format_path_lid_from_req( static void cm_format_paths_from_req(struct cm_req_msg *req_msg, struct sa_path_rec *primary_path, - struct sa_path_rec *alt_path) + struct sa_path_rec *alt_path, + struct ib_wc *wc) { primary_path->dgid = *IBA_GET_MEM_PTR(CM_REQ_PRIMARY_LOCAL_PORT_GID, req_msg); @@ -1745,7 +1745,7 @@ static void cm_format_paths_from_req(str if (sa_path_is_roce(alt_path)) alt_path->roce.route_resolved = false; } - cm_format_path_lid_from_req(req_msg, primary_path, alt_path); + cm_format_path_lid_from_req(req_msg, primary_path, alt_path, wc); } static u16 cm_get_bth_pkey(struct cm_work *work) @@ -2163,7 +2163,7 @@ static int cm_req_handler(struct cm_work if (cm_req_has_alt_path(req_msg)) work->path[1].rec_type = work->path[0].rec_type; cm_format_paths_from_req(req_msg, &work->path[0], - &work->path[1]); + &work->path[1], work->mad_recv_wc->wc); if (cm_id_priv->av.ah_attr.type == RDMA_AH_ATTR_TYPE_ROCE) sa_path_set_dmac(&work->path[0], cm_id_priv->av.ah_attr.roce.dmac); From patchwork 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: 9632 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp532255wru; Mon, 24 Oct 2022 09:07:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Koc4qwgTjkQ9eeO1aNpU0Lh5x5ohvlCdRk+M4KGPXnULK+HRQeG8wC4VDBZ73Mra7OHwa X-Received: by 2002:a17:907:d04:b0:76e:e208:27ba with SMTP id gn4-20020a1709070d0400b0076ee20827bamr29378204ejc.652.1666627664265; Mon, 24 Oct 2022 09:07:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627664; cv=none; d=google.com; s=arc-20160816; b=IF1QWGMzHIhRyx3GQfyZ6ptSk/KfdaApJWZxse5oubadfI1066br+JYi2mGecXkLWG ZMMLr/96W11+reQyXOldw+YO6kNVQhHOEaHy5thCOu5yUEhIdDb+K2Fiz1aiFRu2nyER fbewdYRcq2Pegm+bpk47xBc1JNQwHgWxfnFC3mItXK3qf9apRo1LwPwEGbtIMJwV9mbr XnxG4TttMs394XeD04mEW//ChVQkpHiG6fA4HsUn45+RwFqKSAEExsWga1vvMgeLWcsP aqAfxzg8az+j0/tzdb4nlZUcwf1L6FGt86NY5399G10KU+S3/FStQpiZ7z+iBav2InxW vQkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aF0HxkH4gAirmQci8kpeRT1O6dM9L7FCMCFWUdgH9UY=; b=LXaxdF+Vf6BTSrBVj8UL5po8t5kMQJhvFGZiy2DPjTDkdtAvurFz0pEAB6Ak+IHs67 jtsWWF9lYsSeIxMfrZBD1MnO2IlC9rq1Ahu5JxLaofMJjU66taSl7tmoK/uTzDhuVCWp yfXPxdAbH6s5YQjDmKrse1uBe1OlvPi11PDGe86qZI5GuzwrWKdE5mFW2zUd8f2uAz/M 5OZ+gtcyI9qTpqxnFMZIqO0rg4yILLTFFygBmtbx7sXohT/mGqshh9jc1vVFXfMCcsCj f2rNsnezE3NaiozwdahfYosUhGU5Rz+IsxjofTrrdJtdaasUYkNPyXVffT/p/pCfa6TO Ek/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EN2DvwFG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dt5-20020a170907728500b007878f030816si188046ejc.109.2022.10.24.09.07.19; Mon, 24 Oct 2022 09:07: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=EN2DvwFG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230494AbiJXQGR (ORCPT + 99 others); Mon, 24 Oct 2022 12:06:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232870AbiJXQDy (ORCPT ); Mon, 24 Oct 2022 12:03: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 6BA03A1A5; Mon, 24 Oct 2022 07:56: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 1D80DB81674; Mon, 24 Oct 2022 12:26:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7017AC433C1; Mon, 24 Oct 2022 12:26:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614360; bh=foAPenZ8SsA1CjuNhOHXs496SxCV1R2U2jrLY5lLoVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EN2DvwFGkRrSyBWtpLDDTyfkd7uOKHiQ0rBEMajM3GbTqPcPWzvMKdWUHGWSPQOUl YOyouBPi3ZNvSakrEObBUW8MpWEmtdc0RhEUBNdSN3J14OeCGLKARv02vP9fMKndtv CfHlctXRdoOdk0IccS6x39OATAey6bqaVgBOVlMM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daisuke Matsuda , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.10 232/390] IB: Set IOVA/LENGTH on IB_MR in core/uverbs layers Date: Mon, 24 Oct 2022 13:30:29 +0200 Message-Id: <20221024113032.663259593@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585769566118092?= X-GMAIL-MSGID: =?utf-8?q?1747585769566118092?= From: Daisuke Matsuda [ Upstream commit 241f9a27e0fc0eaf23e3d52c8450f10648cd11f1 ] Set 'iova' and 'length' on ib_mr in ib_uverbs and ib_core layers to let all drivers have the members filled. Also, this commit removes redundancy in the respective drivers. Previously, commit 04c0a5fcfcf65 ("IB/uverbs: Set IOVA on IB MR in uverbs layer") changed to set 'iova', but seems to have missed 'length' and the ib_core layer at that time. Fixes: 04c0a5fcfcf65 ("IB/uverbs: Set IOVA on IB MR in uverbs layer") Signed-off-by: Daisuke Matsuda Link: https://lore.kernel.org/r/20220921080844.1616883-1-matsuda-daisuke@fujitsu.com Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/core/uverbs_cmd.c | 5 ++++- drivers/infiniband/core/verbs.c | 2 ++ drivers/infiniband/hw/hns/hns_roce_mr.c | 1 - drivers/infiniband/hw/mlx4/mr.c | 1 - 4 files changed, 6 insertions(+), 3 deletions(-) --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c @@ -749,6 +749,7 @@ static int ib_uverbs_reg_mr(struct uverb mr->uobject = uobj; atomic_inc(&pd->usecnt); mr->iova = cmd.hca_va; + mr->length = cmd.length; rdma_restrack_new(&mr->res, RDMA_RESTRACK_MR); rdma_restrack_set_name(&mr->res, NULL); @@ -832,8 +833,10 @@ static int ib_uverbs_rereg_mr(struct uve atomic_dec(&old_pd->usecnt); } - if (cmd.flags & IB_MR_REREG_TRANS) + if (cmd.flags & IB_MR_REREG_TRANS) { mr->iova = cmd.hca_va; + mr->length = cmd.length; + } memset(&resp, 0, sizeof(resp)); resp.lkey = mr->lkey; --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c @@ -2082,6 +2082,8 @@ struct ib_mr *ib_reg_user_mr(struct ib_p mr->pd = pd; mr->dm = NULL; atomic_inc(&pd->usecnt); + mr->iova = virt_addr; + mr->length = length; rdma_restrack_new(&mr->res, RDMA_RESTRACK_MR); rdma_restrack_parent_name(&mr->res, &pd->res); --- a/drivers/infiniband/hw/hns/hns_roce_mr.c +++ b/drivers/infiniband/hw/hns/hns_roce_mr.c @@ -286,7 +286,6 @@ struct ib_mr *hns_roce_reg_user_mr(struc goto err_alloc_pbl; mr->ibmr.rkey = mr->ibmr.lkey = mr->key; - mr->ibmr.length = length; return &mr->ibmr; --- a/drivers/infiniband/hw/mlx4/mr.c +++ b/drivers/infiniband/hw/mlx4/mr.c @@ -439,7 +439,6 @@ struct ib_mr *mlx4_ib_reg_user_mr(struct goto err_mr; mr->ibmr.rkey = mr->ibmr.lkey = mr->mmr.key; - mr->ibmr.length = length; mr->ibmr.page_size = 1U << shift; return &mr->ibmr; From patchwork 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: 9118 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456220wru; Mon, 24 Oct 2022 06:33:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6aTbydGEPZqwIzkUux69IG1AdHdPIpDK4/pMmJgofJFkW2zOrlZfnt+xWxbRmlyvJvuAGA X-Received: by 2002:a17:903:183:b0:184:5b9a:24e7 with SMTP id z3-20020a170903018300b001845b9a24e7mr34187530plg.79.1666618427683; Mon, 24 Oct 2022 06:33:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618427; cv=none; d=google.com; s=arc-20160816; b=sMT01ONX2LHvOcrqiMyyhZWGAWInd12mTVaSsKwsqTIqBqp46WdmvBAS76buCMKWjM ZBuDcM+hgai2N1PUSiI9/j8wzR6Q6r67trotXESZ1JoZ4A9iY5eOOdmJ59pi6/MyReZ8 r4aTttojJ74kOqXqKZoO04UybI/6loG3Ua1OzHICdXRSO4I2wglC+XpQVHd0J2bajXaE QrLjYEN3rOLgUm9K9BFEEHU5dfjASoPDIQelxU4l1KsOn4bvsfHyiQApZmrYVB4baiFY 1kAFWyM17UNt/HAWlYLgNTf8Z+ePNASl/CLVeorPPMWGvHhGapJAmGA7qusu1Jn/iiN0 xldQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=e5wqwCBku8w9r1Z1sG40X3eIlMdaKeEqcXijfkZ+BXI=; b=IU69tmyEmjkuPuWVILXGwflyFCDCmZkjZo9yUpyf9AwwxpbVCrB3EQhYvsKT1fYzdh ZgzRxKe5c0BZpGe0Bu17lWMtIhA9uCt/CCFafuxzLNfygu+dSlIsBI3Uff9aaxVvYqkW wsVBwm22KzHIbhxd94KNhJCe5JC9JGNYBTGE8TgO/MR3e/KXqnJW5nE/ZQgr6945cq4a a0j5RLkfTdFai+8raxLGIrdbYAnQtagyQhJ+Pjl3kOU5hNWdSpwDX9xQhuKVGcrTf7af qwqUlggiioxDHdsSWJXLsa4xru/cN010QJwUXKrkiG6hDxAmb+y49VLopRkWgrx0Mcu3 hY/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=l24Eg5oI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l11-20020a170902f68b00b0017f75654a51si18143457plg.245.2022.10.24.06.33.31; Mon, 24 Oct 2022 06:33: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=l24Eg5oI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235957AbiJXNSw (ORCPT + 99 others); Mon, 24 Oct 2022 09:18:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235898AbiJXNRi (ORCPT ); Mon, 24 Oct 2022 09:17:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09A88A4B89; Mon, 24 Oct 2022 05:26: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 03705611B0; Mon, 24 Oct 2022 12:26:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A136C433D6; Mon, 24 Oct 2022 12:26:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614363; bh=TfrcbV3cdle516hYDyZttZDzKbIWhSzetpvS4GzUd0g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l24Eg5oIVBhwOgZgaqi7SPlBxsflkxn2Mu7DAg9JierRWl5gB/sT19crAGI9b0yCS vXPZikKydH9sChGI5H8hellFR3jOF+dqyg4vxHr2uPZib7IH6Bb7rDFm+FVXA5W7cM 28Tsgj3QlU/xcCnpZjuZI+XzFG2rfiu5KaXZgiHI= 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.10 233/390] xhci: Dont show warning for reinit on known broken suspend Date: Mon, 24 Oct 2022 13:30:30 +0200 Message-Id: <20221024113032.712141035@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576084502689481?= X-GMAIL-MSGID: =?utf-8?q?1747576084502689481?= 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 7b16b6b45af7..8918e6ae5c4b 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: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: 9647 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp533124wru; Mon, 24 Oct 2022 09:09:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5l9VxBPsuSIZEHdO8+DEx4zBJbqqI3idY0UJG3DsEAka/FUbjjZdnRs0pwucI+HfKrbGS0 X-Received: by 2002:aa7:c6c1:0:b0:460:f684:901a with SMTP id b1-20020aa7c6c1000000b00460f684901amr20724675eds.6.1666627743936; Mon, 24 Oct 2022 09:09:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627743; cv=none; d=google.com; s=arc-20160816; b=fYoc6jvpBs4E9cS9M+8RTr/3QouxCUx4MFDO51brt4KGMIynmv3LFGkx5siHFiscOT qQtO2CF5Z0gMctYcTdfu68k4WPLch1LpREQxz8Cjzc3PyZdq4lXv4h0zyqVAN7qRGSo0 UeKT1nsXBZtorqtrbCTCZpelqbnukzZM/Q9Mzdaun+RdjftUNA0vBRujW21DGrM47mnw h5StO/Q8aZTNYDTdS1OUArVrtBL0mHbRHiLZAxVxX8o9ALi3iG/435dgEe5E/PBZDV1g GFbChChhkob+x+dhtddhK3Jv+zYCA3168yzDeJl0tCRK7tc6BWPLnVilZyvWVvECq+UG JNBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6CEQwMpb+Q9/lFxWSrOCFLzPjDJ1QRDQ1Isfbkev+dE=; b=KF15bjzor4tYlz+rDipYEpxlMbAVDkuLXApBSvGXA/hZtQXKrf+pInyJBtgXVSK/Yn 9mnTClvnPOlWHH6jkIvpCONrG8vyPDRtle2b7PR5FFNlHvjKaKMmKR8Y9a0S7xrn3TaA CNerW2pBsUT+/6ww6AVqC7FEq0BdEt/ybCNdzDdWklVSGAonBTktTt+rFNifYM8piRKM zU3FjnTRMugVPXiT6GrZ1E31qIXwiMa+cxnQXO4dzX2Rd5YFxMiFyEmY7FJemzMMCsBz 8geBk/DbrgxwuHE1s82fD8wFvjYxyY38VePPBBExbVmlZ/taLl76+26ZirNNi3z/k/y1 39SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xJVWRb9H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cn11-20020a0564020cab00b00458ee128628si107471edb.470.2022.10.24.09.08.38; Mon, 24 Oct 2022 09:09:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xJVWRb9H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233209AbiJXQHy (ORCPT + 99 others); Mon, 24 Oct 2022 12:07:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233227AbiJXQEW (ORCPT ); Mon, 24 Oct 2022 12:04:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21EDFA6C1E; Mon, 24 Oct 2022 07:56:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 601D4B815BB; Mon, 24 Oct 2022 12:26:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B64B5C433C1; Mon, 24 Oct 2022 12:26:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614366; bh=C9siqbLD2F5XDOB1ZhiQzMJY91MtUGHqYucspe1q/+I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xJVWRb9HkEiN9GTnFli6xl19LX4GXmbdwV8IYTBYYowPwWiVKZLR37Z7+ib5+0T0o rp/Ye1PC2I1oz+eC2ombIoi5qQAQNE3E330cIyQHrfPHDfuInZed65ws1Ibajt6L5U cUGCgKfZ+VtgMdrY+5EUhqEujF9Hy0RMz++MapOA= 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.10 234/390] usb: gadget: function: fix dangling pnp_string in f_printer.c Date: Mon, 24 Oct 2022 13:30:31 +0200 Message-Id: <20221024113032.754593015@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585853377050921?= X-GMAIL-MSGID: =?utf-8?q?1747585853377050921?= 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 236ecc968998..c13bb29a160e 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; }; @@ -999,16 +999,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 */ @@ -1471,7 +1471,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: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: 10197 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp642006wru; Mon, 24 Oct 2022 13:37:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7SQvADOWHp00uH6vBeL0YVcf0lqW1PQAkMJXLVWDtwBwU5XmRaeIV/vhiTqf2qTBvLHUgh X-Received: by 2002:a63:689:0:b0:46e:be81:566c with SMTP id 131-20020a630689000000b0046ebe81566cmr15729003pgg.403.1666643827359; Mon, 24 Oct 2022 13:37:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643827; cv=none; d=google.com; s=arc-20160816; b=k7RVIGV+aEHZLQ2O74vCLmzAPwAIoKnON0niSSi2ywxcoWUUzCKNOP4LTGlWt0/n3G c3vCPCEfe/d+QzDFkc6vGVjK7ChrFhCn9PqFPvapaEnfkw++B8WYMHU8HyN7/KpF05BN WWOcktraz7V77xqoTUT6bdm5n028DP3jJnj0HGIAFvd4lOc//9Nx9N4NmbSvnZWrA/Pw QzTYKgcvP2L6fbnWTxkYLUcONk3XAcyAqHiTfa85kFKbXO60RV4EGUBBGVF+VYEI6AlO 94j7NXdMfBzCdTTm0DEeElJJ/k6DGa29fE1wChQZ3ENouefcebAoE3OsIntG/yMM/Sox TFGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JRx4ih6ORBF6np8Jgqif91Kj6bPnjkgtWgOtv00/wjU=; b=VWGuQHwq5ikpPh6yHHb0eAD2peOWIfDEaHAP6BCZ453Xft273lGsHYppLjVNpQ9QJZ eTmSg2l66k361jaXsjXJl7sh1azKB8n4ZN6Qj0tpLHNnyccfIqS9ob8EcygpmyfexZaM H4xzrTUopv7RwAUrFjGefgMFUzCLKLSHrmU+hLYscw9PFmpsZe+WTJMkeabVhnQ8rYE8 jrJTpAHf9TzQscIKwTsSb+rSYn2rQM7MyAKghGbmbWAKQA42NWaUTUli5DxzCk9mQvTJ 1k7rAxn/h4dT53HJm2fSRfBBKxLlx/xNGAJT7cSR8RNrhQEUznnt69vtoRgqlcNtCPVR jBkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="V2/Qa++l"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d11-20020a170902cecb00b00186658dbbcesi600610plg.339.2022.10.24.13.36.53; Mon, 24 Oct 2022 13:37:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="V2/Qa++l"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232830AbiJXU37 (ORCPT + 99 others); Mon, 24 Oct 2022 16:29:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234538AbiJXU3T (ORCPT ); Mon, 24 Oct 2022 16:29:19 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 517AC2A79CA; Mon, 24 Oct 2022 11:42:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 47B03CE13CE; Mon, 24 Oct 2022 12:26:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5918BC433D7; Mon, 24 Oct 2022 12:26:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614368; bh=WIvTqs1acMoSVbKnDuXeGSuPERelrKyoyWSq23nnmSY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V2/Qa++lOc0sgEaW022WbeHO9eKvAKuQ4zoCM5bTuIj1Jr0y1HdBE3VNN6L3MLFK/ EN201RR6E75gRfiLzAkPeClZJ0AiJHQ7NUEAMsidK+056GAfBHkcTDGYn2d8aW/FeA U0WSbW4OYaz3ctM5jsT8pMpOoo/Hj0HuAFiQuoJE= 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.10 235/390] drivers: serial: jsm: fix some leaks in probe Date: Mon, 24 Oct 2022 13:30:32 +0200 Message-Id: <20221024113032.791120600@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602718179146764?= X-GMAIL-MSGID: =?utf-8?q?1747602718179146764?= 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 cd30da0ef083..b5b61e598b53 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: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: 9611 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp530905wru; Mon, 24 Oct 2022 09:05:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6geyq0zWaly0l29y7/ykjqkHYh+hIPYSWn3MBcYbo413vuo7k9F5pFQcUKeHgPsccAbH8R X-Received: by 2002:a63:2c4c:0:b0:434:e001:89fd with SMTP id s73-20020a632c4c000000b00434e00189fdmr28701405pgs.444.1666627542114; Mon, 24 Oct 2022 09:05:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627542; cv=none; d=google.com; s=arc-20160816; b=eGggdLgZpLvg26le1Tejs3egjAY3lS6LsCgOKLxmMVrTdiZ9TxjHs+oV1GNCyycRmJ A3ZJG9mtD0OFKQoUbZsBuXZON/eTvqKt0UVrkehb4dZZymQ0xTT5mCvQVYaGTb5g1jkX F77Nb8/JBzd1swLKQBswxhmmNuRF4/clkeakD9D6rcKZ7OadlK45eEa9zS07nR6jEt/S g2me8HenWl20C5dMwB9iV4ieZJ8/oKHVMRepEMR8whdWisSDBG2lSvKIX6E6OwNgFzk8 vNIbBx5eXoQwFwekj3ueJksujx4VRKlv/RFm1MbUmIkgG+X+MTFGUC10JgcpyHnQo+F5 sVEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bDiXtC1cHNFvA8WY733Eb4phnf9fm3E37nhlfeVdPuw=; b=CJp7ctw1uvqu2LEj1dMFyNzf/lRS4Jrs4tzw62LJxxHzp4qnZavJdlOEIpf+ehkS2x j9lh2eltq8/VER2oSx37Xz4SYsXTzkfgOtRektxjxrqmXDlQwR2MSnROGlKKMv3koi3/ rbW1l0bqplsS+hNOg44/VSbkrvMr7x+EqLzpJpFQd1ODWAQqebiu3qF0TfZUn9t0lDnz OlmSKr9cXMjqUBF7QoF3Q6aLv4hPLJh1U05ihK7L6/E4bapMuduPSEzPWOEGIIygr3lC ShISN29mS4eYiGqbVZIo7MOzCz47BoouSHvBUystxf+voPtIETh34MKw7jzyG2XMpGmL RZDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uINb36pS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mq10-20020a17090b380a00b0020daab63f66si432315pjb.31.2022.10.24.09.05.28; Mon, 24 Oct 2022 09:05:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uINb36pS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230378AbiJXQD2 (ORCPT + 99 others); Mon, 24 Oct 2022 12:03:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232370AbiJXQC2 (ORCPT ); Mon, 24 Oct 2022 12:02:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27151112A86; Mon, 24 Oct 2022 07:55: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 9559AB81680; Mon, 24 Oct 2022 12:26:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F354FC433D6; Mon, 24 Oct 2022 12:26:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614371; bh=fVjz5Ks1uqp8ZxMRnCA4ldqH2dXUZmbtXtJd8+Cg3r0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uINb36pSX2qsT1/FwFZEO6fOlTeoDyPqpCfT31zrZk0ZiT8jocBts1ZWNwg4d9dg1 tTrCnLR6ZnX6y7PdbJBNdxPMRrpbXjtDkI5xvEzeyQTWDQPIvSIDwk6TriRkqom5rP KG2LldHZUppDmGV45UhtePY3fg63nFUXXNm4QS0s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Christophe JAILLET , Sasha Levin Subject: [PATCH 5.10 236/390] serial: 8250: Add an empty line and remove some useless {} Date: Mon, 24 Oct 2022 13:30:33 +0200 Message-Id: <20221024113032.840433308@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585642016511414?= X-GMAIL-MSGID: =?utf-8?q?1747585642016511414?= From: Christophe JAILLET [ Upstream commit 26f7591632d74f637f346f5d642d8ebe6b433fc9 ] This fixes the following checkpatch.pl warnings: WARNING: Missing a blank line after declarations WARNING: braces {} are not necessary for any arm of this statement Reviewed-by: Andy Shevchenko Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/257ffd691b4a062ad017333c9430d69da6dbd29a.1619594713.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman Stable-dep-of: 039d4926379b ("serial: 8250: Toggle IER bits on only after irq has been set up") Signed-off-by: Sasha Levin --- drivers/tty/serial/8250/8250_core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index 98ce484f1089..aae9d26ce4f4 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -332,9 +332,9 @@ static int univ8250_setup_irq(struct uart_8250_port *up) * hardware interrupt, we use a timer-based system. The original * driver used to do this with IRQ0. */ - if (!port->irq) { + if (!port->irq) mod_timer(&up->timer, jiffies + uart_poll_timeout(port)); - } else + else retval = serial_link_irq_chain(up); return retval; @@ -766,6 +766,7 @@ void serial8250_suspend_port(int line) if (!console_suspend_enabled && uart_console(port) && port->type != PORT_8250) { unsigned char canary = 0xa5; + serial_out(up, UART_SCR, canary); if (serial_in(up, UART_SCR) == canary) up->canary = canary; From patchwork Mon Oct 24 11:30:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9180 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458273wru; Mon, 24 Oct 2022 06:37:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7cCuqG4JClRtXtqh1Bn0BZEFYomH1E2zjtPVKkwv54Z32AvG8ledRnxnz9sRCT87nZw+m7 X-Received: by 2002:a17:907:80a:b0:783:2585:5d73 with SMTP id wv10-20020a170907080a00b0078325855d73mr27795059ejb.642.1666618637092; Mon, 24 Oct 2022 06:37:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618637; cv=none; d=google.com; s=arc-20160816; b=jZ/12NjH3aS2aaPvs5f2YWSIDCwqCCsw/X0CNqcVrn16659Rbg7WSZ29NClJP2bsMX VGB2D5MuKYazZV+7JafjCsuJ9lMRY4Gkg0Xe2c1Z1CyBaHcq/y5+7H3cmyeDL3RLQjdF 2AcqIMWuTVtHzb2X0pYzdFvzyDuUhTMqwbjIPmGnmti+1IalNX0P25zm/++60zW9fr7R T+uhDmTrFBzJA/avYk9YmzyzX2HecaSKyBoi42YfE45uwm+XpcU40pV0D17Frk9Ps1ry MeGxSydzBykITYlp6HxIFh9VIjrNsH/zA+Zuo4Teb5nHhMKOgwi7z6r0jzZPtIgT8OS3 NzUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=w3M+Ui12EY2QxvRQMt+F0hx2uzVxyYtfVX3cqerli+s=; b=oqPJ6ILQ3jJuIJ7P9sCEVaEwE+GdPIx8tRNc23UiUPVGsgoxSgcm9gmiMzbNwXURys syI5H0m2GciDIeNrGA3Ly9893xJ/TpjCg0r/OeaFMXHuCUwvsNEc6D4hb8X0a6cuFsYC KlTlu+SJSYSjzwtaemDh4p3Dc9OcugjD4a64bWr/lGE6XM07JwpVBTqePeGpHgHKusdj R222KA6tSu6nAuxTseZT36sKCrCjedZyDpgQGV9AT64bvNZb2sEqdkyVw3x5tvt7pzgh 72RSXZssSxFz6DgAcil1HqPy3nOLaL6wHvA0UN7A/xRb+CHHiWknNIj9J0FSXaox7QVZ KC4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TDvvODlY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c11-20020a0564021f8b00b00458ab55ccc9si28877618edc.168.2022.10.24.06.36.43; Mon, 24 Oct 2022 06:37: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=TDvvODlY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233288AbiJXNXo (ORCPT + 99 others); Mon, 24 Oct 2022 09:23:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233006AbiJXNWx (ORCPT ); Mon, 24 Oct 2022 09:22:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E5D53B460; Mon, 24 Oct 2022 05:30: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 1F392612CF; Mon, 24 Oct 2022 12:26:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 320F2C433D6; Mon, 24 Oct 2022 12:26:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614376; bh=9SE63E0V05/nB5l+e4Iv+eiMc19/AbJJynH7bXQ/Obs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TDvvODlYgMjwrhgl9Gk9YNDnpCsHEH63DfuG9VcuSvqbKgbvSVZa5WNQ0AL/wM+77 Alp9Wz42BtTIDUd7VSODh9BmaxBEs8ard/meXglY6Rk5BDX8nH3B2+HTKO+v3vzPwU 5fi5pTZAkv3AsxNIQ/xv2xUsE8J0myLOzxqSkhp8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lennert Buytenhek , Andy Shevchenko , =?utf-8?q?Ilpo_J=C3=A4?= =?utf-8?q?rvinen?= , Sasha Levin Subject: [PATCH 5.10 237/390] serial: 8250: Toggle IER bits on only after irq has been set up Date: Mon, 24 Oct 2022 13:30:34 +0200 Message-Id: <20221024113032.886503141@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576303722967112?= X-GMAIL-MSGID: =?utf-8?q?1747576303722967112?= From: Ilpo Järvinen [ Upstream commit 039d4926379b1d1c17b51cf21c500a5eed86899e ] Invoking TIOCVHANGUP on 8250_mid port on Ice Lake-D and then reopening the port triggers these faults during serial8250_do_startup(): DMAR: DRHD: handling fault status reg 3 DMAR: [DMA Write NO_PASID] Request device [00:1a.0] fault addr 0x0 [fault reason 0x05] PTE Write access is not set If the IRQ hasn't been set up yet, the UART will have zeroes in its MSI address/data registers. Disabling the IRQ at the interrupt controller won't stop the UART from performing a DMA write to the address programmed in its MSI address register (zero) when it wants to signal an interrupt. The UARTs (in Ice Lake-D) implement PCI 2.1 style MSI without masking capability, so there is no way to mask the interrupt at the source PCI function level, except disabling the MSI capability entirely, but that would cause it to fall back to INTx# assertion, and the PCI specification prohibits disabling the MSI capability as a way to mask a function's interrupt service request. The MSI address register is zeroed by the hangup as the irq is freed. The interrupt is signalled during serial8250_do_startup() performing a THRE test that temporarily toggles THRI in IER. The THRE test currently occurs before UART's irq (and MSI address) is properly set up. Refactor serial8250_do_startup() such that irq is set up before the THRE test. The current irq setup code is intermixed with the timer setup code. As THRE test must be performed prior to the timer setup, extract it into own function and call it only after the THRE test. The ->setup_timer() needs to be part of the struct uart_8250_ops in order to not create circular dependency between 8250 and 8250_base modules. Fixes: 40b36daad0ac ("[PATCH] 8250 UART backup timer") Reported-by: Lennert Buytenhek Tested-by: Lennert Buytenhek Reviewed-by: Andy Shevchenko Signed-off-by: Ilpo Järvinen Link: https://lore.kernel.org/r/20220922070005.2965-1-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/8250/8250_core.c | 16 +++++++++++----- drivers/tty/serial/8250/8250_port.c | 8 +++++--- include/linux/serial_8250.h | 1 + 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index aae9d26ce4f4..0a7e9491b4d1 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -310,10 +310,9 @@ static void serial8250_backup_timeout(struct timer_list *t) jiffies + uart_poll_timeout(&up->port) + HZ / 5); } -static int univ8250_setup_irq(struct uart_8250_port *up) +static void univ8250_setup_timer(struct uart_8250_port *up) { struct uart_port *port = &up->port; - int retval = 0; /* * The above check will only give an accurate result the first time @@ -334,10 +333,16 @@ static int univ8250_setup_irq(struct uart_8250_port *up) */ if (!port->irq) mod_timer(&up->timer, jiffies + uart_poll_timeout(port)); - else - retval = serial_link_irq_chain(up); +} - return retval; +static int univ8250_setup_irq(struct uart_8250_port *up) +{ + struct uart_port *port = &up->port; + + if (port->irq) + return serial_link_irq_chain(up); + + return 0; } static void univ8250_release_irq(struct uart_8250_port *up) @@ -393,6 +398,7 @@ static struct uart_ops univ8250_port_ops; static const struct uart_8250_ops univ8250_driver_ops = { .setup_irq = univ8250_setup_irq, .release_irq = univ8250_release_irq, + .setup_timer = univ8250_setup_timer, }; static struct uart_8250_port serial8250_ports[UART_NR]; diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index 6de188b121d7..4a0793e1ba61 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -2277,6 +2277,10 @@ int serial8250_do_startup(struct uart_port *port) if (port->irq && (up->port.flags & UPF_SHARE_IRQ)) up->port.irqflags |= IRQF_SHARED; + retval = up->ops->setup_irq(up); + if (retval) + goto out; + if (port->irq && !(up->port.flags & UPF_NO_THRE_TEST)) { unsigned char iir1; @@ -2319,9 +2323,7 @@ int serial8250_do_startup(struct uart_port *port) } } - retval = up->ops->setup_irq(up); - if (retval) - goto out; + up->ops->setup_timer(up); /* * Now, initialize the UART diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h index 2b70f736b091..92f3b778d8c2 100644 --- a/include/linux/serial_8250.h +++ b/include/linux/serial_8250.h @@ -74,6 +74,7 @@ struct uart_8250_port; struct uart_8250_ops { int (*setup_irq)(struct uart_8250_port *); void (*release_irq)(struct uart_8250_port *); + void (*setup_timer)(struct uart_8250_port *); }; struct uart_8250_em485 { From patchwork Mon Oct 24 11:30: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: 9191 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458652wru; Mon, 24 Oct 2022 06:37:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5eWDYCFZG2nH1IJ1iyrnb4c7a3ZsJTXWZRW35x0d8a87cHS+5VZLVuGlBG8s7ysuHWseFe X-Received: by 2002:a17:906:4fcd:b0:78d:8059:17c with SMTP id i13-20020a1709064fcd00b0078d8059017cmr28402974ejw.423.1666618678201; Mon, 24 Oct 2022 06:37:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618678; cv=none; d=google.com; s=arc-20160816; b=qtVqNv364AsCaYEbn12DKd8dCHXQjgjFwQLeZaP4i6H2h6FIr/zc33yJgEUu7wA1ER qQo9muqLLNu6UMhscgYLNKhjgVdMTUMbjOeSLj3Tc1XwVvdenUCTVMmd1qorCoIjvJ1v H/Z6VjQNdC62JWndY2ftlJROyf/VFNVkdmwmvNkDrJgcmn7emqRKr4Ry/Zkl11WWXTnM DRHTK/lOibM99BhGCVv0ioMCqRJYPObIw5c9fh/BMgUIgYi61uGLuOUFJ3LYRSRu4h5H rnqeaZZfxzfiKo9SlpEGZLBO1J1L5eklJSnHVCRSUtSxIY3u1Xq1QiOuPeScvUeT8Lkj p0sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=X4+LNilVR4GFrVGyi4ru7ELtv4OHVLmxKyJ390fZkaQ=; b=nC17cKl2vPUDYbkxphZRnq+vZeT+wjJm6+OAW8qYtc2jtIfLpC66/C5zhJk0PTwOE5 zVXLSNwuEoUb/sKzaqNDXQqe7I54yB4mkyBrBqsLAvLiCtpQeTlr82eJnWI/Ja8owVDE 0gk7M0MJp9ZBYaD2hU9877FFVvHnxdlgiAxJXHX2/FHBx4J/GjixjxtHtNbwM8JBlnnr By/GNLSOslcmk0EZUaHvXlkhDCf3EH+3/Lp4kDiOynhyqw6ofJlXTTSvq/0BJuhbvVIn XOE/yMlu3h6O46y0j3o0YxLikhmVYU4BQj6qx9h1j2nDTfHenEKt5gECGBvCdsrBDNio iwNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YgKD7Ddt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xc9-20020a170907074900b0078c24962d30si27746889ejb.963.2022.10.24.06.37.16; Mon, 24 Oct 2022 06:37: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=YgKD7Ddt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233326AbiJXNdg (ORCPT + 99 others); Mon, 24 Oct 2022 09:33:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236114AbiJXN3k (ORCPT ); Mon, 24 Oct 2022 09:29:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86798AB80F; Mon, 24 Oct 2022 05:32: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 B4C076128E; Mon, 24 Oct 2022 12:26:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3719C4347C; Mon, 24 Oct 2022 12:26:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614379; bh=/ADuqSbrPhq/DIYL6JjVOOh+yAXtSJSCtWMkYRSaMVo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YgKD7Ddt2euyKHt+vAOpVuHtl+moFLQvFg2oAarSrxyzvu2S8vr/JaS+wHiqK5pXh 8HV+LC2BAcVix41OTU9JFECk2iPTm83FGl0neyWFhAdc+yqAUID9u7ULWr/oBDOGl0 BDtwzZbZfooNrdhDz89SPK6Nyykph9DA54Ley5yM= 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.10 238/390] tty: serial: fsl_lpuart: disable dma rx/tx use flags in lpuart_dma_shutdown Date: Mon, 24 Oct 2022 13:30:35 +0200 Message-Id: <20221024113032.930479160@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576347023903164?= X-GMAIL-MSGID: =?utf-8?q?1747576347023903164?= 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 a2c4eab0b470..269d1e3a025d 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -1725,6 +1725,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) { @@ -1733,6 +1734,7 @@ static void lpuart_dma_shutdown(struct lpuart_port *sport) sport->dma_tx_in_progress = false; dmaengine_terminate_all(sport->dma_tx_chan); } + sport->lpuart_dma_tx_use = false; } if (sport->dma_tx_chan) From patchwork 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: 9636 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp532471wru; Mon, 24 Oct 2022 09:08:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6SxGBQyZ2YVrLAa9GKFa94Z1bymPiARPiDCKmC31mbWCyanDi85IsWJC9Y26GrVtFIxGjF X-Received: by 2002:a05:6402:1f06:b0:457:149d:beaa with SMTP id b6-20020a0564021f0600b00457149dbeaamr31103888edb.238.1666627686837; Mon, 24 Oct 2022 09:08:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627686; cv=none; d=google.com; s=arc-20160816; b=S1rI1qKPcXEQd9XgRNHX1Tu93QAX4jLrYoGX1nf3tD6v0gb/yBqXN608Ird5EDJ9Xm yxcorv33hAUAMZlKHhBltFUFrcFbhlwlkLBOSdDvm3T5XGSNRyv66NAWYVqy9UnTtQQ3 m2UeoJ4ovxv4L+WoHtneejN1axRBsDVb6cN5c5UGW56pkxMmlXxcCCljC/SndUeYe8T+ TeY8MMSHWXudJ8tKP77WlkwCshAxYHRgJm13FerHRYpJTKqx4B+RDbqgR9vw8C0YhZD0 K9skRj2tghYX0lvVzi0CxZs3K/6fDtSdvfUBSSzHntBqByFikvYM7IDE7I3afCBwjL3k uvJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=Ws8EqUKVMNWRdScvgiLIUQegfmMZDEs5fU+JW+ff1IaHQUFodhI0dCzNdxWLSRzdBj E4Sz02bgHoHEr1mzxPyFo57T3RR4Dg5p7mTow1qzA4pMJhellZedf6F7uaht4zqn61kB LI+0ivXEai1PbZKTLMn/0fEQ5v9zcFgxcHP20NIKfQH0xxHzJ4cijhp3hrEbYJvoRelT LxckOLRC9EuHCFRP+YqjeZfNEsJNZNH2fIPONYgzwUrTchth//ySZsDpPjRqQk8wgH4I EzOQyg5T+uX6Jr9OzJMHZpDQzLBmXln4x5Sjx+ozy7qYsjNMgpS1yWUcCSUHOo4rOnD3 AcvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AhhkDcS0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w10-20020a170906b18a00b0078a76811e33si121467ejy.408.2022.10.24.09.07.41; Mon, 24 Oct 2022 09:08: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=AhhkDcS0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233217AbiJXQHC (ORCPT + 99 others); Mon, 24 Oct 2022 12:07:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233007AbiJXQEJ (ORCPT ); Mon, 24 Oct 2022 12:04: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 8CB6E1E5764; Mon, 24 Oct 2022 07:56: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 1A163B8114A; Mon, 24 Oct 2022 12:26:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B1BDC433C1; Mon, 24 Oct 2022 12:26:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614381; bh=npCRfkXpyD3oFS/RTYI4IZ26DGEUxTCME7Uv6lz4OjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AhhkDcS0OGAsR+3db1qHYVsL9FsaGRBHe/bS3tCF82kQEuyOpqNPIlHp0hewRVcD3 amRQiO4JdiaTUXZGAo/b1tzkyJth/TfPNd8Q+ZaYWh3r8aPopkQ/XQXfAsfueMBuEW C65/bb3UhLT7x0dYbSOsSHldWCSRAmuacPVJytPQ= 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.10 239/390] phy: qualcomm: call clk_disable_unprepare in the error handling Date: Mon, 24 Oct 2022 13:30:36 +0200 Message-Id: <20221024113032.978853565@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585792908672773?= X-GMAIL-MSGID: =?utf-8?q?1747585792908672773?= 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: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: 9939 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp599836wru; Mon, 24 Oct 2022 11:46:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6dQnVeh3s1IeynnLPHzyM/aM60kpy0yJHWQO7LjwX/DImOTKZqWyzJpamtTyqQcUzW01B1 X-Received: by 2002:a17:90b:4d07:b0:1ef:521c:f051 with SMTP id mw7-20020a17090b4d0700b001ef521cf051mr77484050pjb.164.1666637216551; Mon, 24 Oct 2022 11:46:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666637216; cv=none; d=google.com; s=arc-20160816; b=VTyjCw+RL6KigJQbz100wLCxuKpHBeALiLsnlkd8PY+nNSwtQhNokIc0L4sLxRhoO5 LQVv5ii15tsH4gdUaqp9P+7s2bbLJ7p9RXLhHgJiurvQtBQmDme22+CTKpV+lKzIMyn5 kpXmNqmVU5ghmBYKjMHMLixWDbe3urm5pub6RgSjtbCpqLhOWZTIMcvvKuQ6udeBoP9h tyVRZ4mLyB1CfYTbQtWnK2skIFXqPv2a4h3ksGktPhWgtR6dsqFEsaxt1VBsBZuJwWW0 rRyAOhc4xnxU9EqPGm3W4v4+ZoBo3/rmYDkBveiwqQQIDNWtiih0g0IyIIcuknsvcrxF ZTOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GFggShj68URmr7lwhelnM6VU8++hDizMeTgrZqJ1dCs=; b=h/AItpioomIXa4RRzBHZNOD71aQTTA8my3voJI+LdBOnj25yj2TFiloU3q4peFwiAW 9q5yOY5k00TK5ztLetEr6hFForb6IEKBvytybUNrHBiRmePLacJxnbdxNcrmpyBXrWRX 6SP57y7432ZhtBT+ascTSJXiODBK8GxZLabQHkWCMRVxtEf56dqyde4KSEPrNC7eYjHv JVt549DgC2LJFwus7x2Cp9MJqJ3/9qAsca4aUulXvdBeyY159YSQHaX33ECtVuFGfToS ASCAT9Vw7avs6TXxnma17dO27Zny/SEDw9bxJ5nJsC6F8YWHL1vSb4k0fhGVpbTCQfO6 3/yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lCblZg3g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f8-20020a170902ce8800b0016ee19bc5f9si256662plg.553.2022.10.24.11.46.43; Mon, 24 Oct 2022 11:46:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lCblZg3g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232594AbiJXSpq (ORCPT + 99 others); Mon, 24 Oct 2022 14:45:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232543AbiJXSpS (ORCPT ); Mon, 24 Oct 2022 14:45:18 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A36BCAC498; Mon, 24 Oct 2022 10:27: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 sin.source.kernel.org (Postfix) with ESMTPS id 2F614CE13CF; Mon, 24 Oct 2022 12:26:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B69FC433C1; Mon, 24 Oct 2022 12:26:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614384; bh=l3lOmvb8DxNeJCwa8Zo59caxbNTlaKKRdNSZFh4rEMY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lCblZg3g/HaucYtS6HBQZ9tDgdjRqjNy+C3g27SJqrghLgghPnT14DH4Ts1NpRlcq BN1UkJtGbFuVC9RdN4KbmZiGTjgsgzcHvrRAiUdYANRlVVhfNL9sOM6ieKEJTwMTHv HAcwLfSkdoooTbnetCvzd/AoWIUbyLczT/zNWX18= 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.10 240/390] staging: vt6655: fix some erroneous memory clean-up loops Date: Mon, 24 Oct 2022 13:30:37 +0200 Message-Id: <20221024113033.029480414@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747595785918694846?= X-GMAIL-MSGID: =?utf-8?q?1747595785918694846?= 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 09ab6d6f2429..0dd70173a754 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -564,7 +564,7 @@ static int device_init_rd0_ring(struct vnt_private *priv) kfree(desc->rd_info); err_free_desc: - while (--i) { + while (i--) { desc = &priv->aRD0Ring[i]; device_free_rx_buf(priv, desc); kfree(desc->rd_info); @@ -610,7 +610,7 @@ static int device_init_rd1_ring(struct vnt_private *priv) kfree(desc->rd_info); err_free_desc: - while (--i) { + while (i--) { desc = &priv->aRD1Ring[i]; device_free_rx_buf(priv, desc); kfree(desc->rd_info); @@ -715,7 +715,7 @@ static int device_init_td1_ring(struct vnt_private *priv) return 0; err_free_desc: - while (--i) { + while (i--) { desc = &priv->apTD1Rings[i]; kfree(desc->td_info); } From patchwork 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: 9929 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp596985wru; Mon, 24 Oct 2022 11:38:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4MTaoQP74iYdqTPOHRHPpTYKu8fKMUn+oGaPYo5MDOEy3IOvcwQ4MZiIOePdv67IcLVvNo X-Received: by 2002:a17:90b:4ac1:b0:20a:de32:3650 with SMTP id mh1-20020a17090b4ac100b0020ade323650mr74181210pjb.142.1666636695287; Mon, 24 Oct 2022 11:38:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666636695; cv=none; d=google.com; s=arc-20160816; b=ruiBpgelpO8WmJ590RW3W/zDz0zTVofjLqH2Bu3BzgseKg7H9XYsoPq9qLitxFRPZS lE+BsxAFhDHj8VFkoc8jsWj357K6rA0pXZ1xVqoInI91zyzZ4nFiVMl+yCB9n2FJWtEz eS8417CDfsmDElt0LEsb2krgD1+3JrSC69pMbdszbtFfJelAP5yrkat/pXsQRk3meT0U S4zKbjgeKpqAjKLi6eoG+0pG1eKJNJ+UtERa9IqBXEVSvT/7a49tRvEpj36ozu7jihZq yL7HofEmMbOmsdLq7Xe1uVsRG4zpKcmteeyYFqnhhMP6zAFwvqEB00PAKFbpA3U79R5n cyHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oWQt/B8PqgnI0z2LrIAxTS6z0d+ql6YdF+xlLh0GoxE=; b=Y+Zq7Riv6C3FpoTWfgtzXGROPc0H/NdtOxmtyosOQ7gJZ1H3e5GWURNcHfsKiB5551 mvedaZuvKNBAJ3zkp+hbTpiZWpkIlQ9ZXE1q1IBSsyR2eGPADV9vydsNPD6NdFQlob08 +JxiqRmaFFLU3hrG9mHaLXLSImqA9ciFUlZ+0A2peZuBRMwXQvwZLUqT7eRw6ExAoECS wbg00i4GLyvFHEkS7vpt0qNMAt013L35jakGD3/4gE5MMAVLI2dn4jQ1nDFEbkrYtNNX k67/z1MY0HcDM73ARsuoIuBXNxDog9S/l1MszfqCc6rZaWpaSbEruMfyj86pIq5CwwkM CgYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="KSu/4Y4m"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l191-20020a6391c8000000b004403cd15ccesi173039pge.849.2022.10.24.11.38.02; Mon, 24 Oct 2022 11:38: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="KSu/4Y4m"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231801AbiJXScu (ORCPT + 99 others); Mon, 24 Oct 2022 14:32:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231277AbiJXScU (ORCPT ); Mon, 24 Oct 2022 14:32: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 EC380EC52E; Mon, 24 Oct 2022 10:14: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 966BD612DF; Mon, 24 Oct 2022 12:26:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4268C433D6; Mon, 24 Oct 2022 12:26:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614387; bh=n4LDqRK75QqNUoCyLhZB6FxCrwa59oxkbhRpYS1K6Ns=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KSu/4Y4mkZ0OXTF55mgKau12avLWTM3EVe5uV2caZAOzTE2itSxBfamT30PbC956g WNflNrz3LPPlnThWX6hLVzNRUDCzgzFCBRuqMgUoiaEYGCb/MDCaQZAE0Lr0VId9zT 9S3n1Cu+Ldi3z0j/917Vo7JEUYgwmM6ZcfzoWdEE= 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.10 241/390] firmware: google: Test spinlock on panic path to avoid lockups Date: Mon, 24 Oct 2022 13:30:38 +0200 Message-Id: <20221024113033.079404628@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747595239615606024?= X-GMAIL-MSGID: =?utf-8?q?1747595239615606024?= 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 7d9367b22010..c1cd5ca875ca 100644 --- a/drivers/firmware/google/gsmi.c +++ b/drivers/firmware/google/gsmi.c @@ -680,6 +680,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:30: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: 9134 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457281wru; Mon, 24 Oct 2022 06:35:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5jXTrVsv9brZySV0xiK/jYX7mXe7PcBTl3uSd5VhCquDwJ+njrN+jZBZDnx5Rufp3GyQw0 X-Received: by 2002:a05:6a00:16c4:b0:535:890:d52 with SMTP id l4-20020a056a0016c400b0053508900d52mr33839360pfc.9.1666618543554; Mon, 24 Oct 2022 06:35:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618543; cv=none; d=google.com; s=arc-20160816; b=h/CormG/4omp63guZMAl6+RuqBYuJfdtzBjWtkhnZFhi3SSO8rN89/kuVain5MKTXp 8peQfopZyrhk2NPiC2+5TuSnKX3wAPY7tMWjLYD0JQvAgaZ/FYqXbxBYa0eDyAyFzYji Ogsyzk0WYLCuGZw8mJ906dQIVq4AJ90DDAQycbpEeoNQb6DjENkkEJwRLh1ZJl+cBVvv 4Up7Z7AhLr7V5aKczdUH6NVDerZ9xhezAUW+mbt0swv/44lJNHV9f5EQgs8w5fi6Wqzz 1NtTqZBrgw+cBpQBMj91TPt7Fe11jlEGADJNFCLwZQCZ6jNIGb3ylVwzp0S0SEqOuCf8 giMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=631Vk2O11PEwIGMf53oD2xyW7ox/QRqrZZomycy6nPw=; b=KeuU700hg5r7U9IbMXm7gabjedFhpF44UtI/7RXJxJuqJMhdmlalZBWchKOi7lWY5p 5dO2ujGQTrcZoR1pNDX5N9cCUTDLxZorRGHCKD3GI1CBERh6ZneyVAa++C3Pum1nTzgn 1o6vmix0h8tEGc8zSmL/n0NdXJyb9ePeejXfFJjkxzwbYglbWDZPSttgOz9ehbDtv9TW feUr/TCAAephyk02ds1atpgLZIH7CM+slDLFuwUAtbGpUJfLGpLU8N9eS47BxgYG9kkM j5CXbMVEf1Lr578YRlJm6UlsEmraVadbjFNPNfw7T9rtDgHX9laocAt27Zn78aNSvV6q gV/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GoPVHuAE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902744300b001865d57b179si15281466plt.47.2022.10.24.06.35.27; Mon, 24 Oct 2022 06:35:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GoPVHuAE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235992AbiJXNS5 (ORCPT + 99 others); Mon, 24 Oct 2022 09:18:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235935AbiJXNRk (ORCPT ); Mon, 24 Oct 2022 09:17: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 37B833B73D; Mon, 24 Oct 2022 05:26: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 3208961218; Mon, 24 Oct 2022 12:26:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46E59C433D7; Mon, 24 Oct 2022 12:26:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614389; bh=ZxSQegdatY0a2JgwLpgyobk/Yi+Ena2okixr8pXbOdY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GoPVHuAEEjS+koNNT/nKkh9eMhbXZlxBhOBngyRXnauZqIf4dQQIdFVnb6g2mUGZp QWUVvOIaWaosjyoHlsWdAZNuG8WqdgqolGm9ekcJd50GUU3AHD+LbxaxaOnKmgKw0f 41ekdk61/bedjcuyrro4QaLu0PJuxD6mpqoy+ej0= 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.10 242/390] serial: 8250: Fix restoring termios speed after suspend Date: Mon, 24 Oct 2022 13:30:39 +0200 Message-Id: <20221024113033.128175950@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576205704473887?= X-GMAIL-MSGID: =?utf-8?q?1747576205704473887?= 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 4a0793e1ba61..ecd2b3d252ec 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -3289,8 +3289,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: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: 9725 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp547596wru; Mon, 24 Oct 2022 09:39:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4FaLBBU7tJCxnjpqYH1q5+sEHUX5JIhmD/Ykto/DGXGauvO7jHMIkMsz4DWB1GGAnvxdcr X-Received: by 2002:a17:907:7fa5:b0:791:9a5f:101a with SMTP id qk37-20020a1709077fa500b007919a5f101amr28363939ejc.453.1666629566947; Mon, 24 Oct 2022 09:39:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629566; cv=none; d=google.com; s=arc-20160816; b=JjctrQ0nY6rHbFUHedprUcBMYxZ2XiMbM01Ka50D/JopGhPpSELirbLyMyIx1SpngN +HLt/UimPmQW2vyyhNCRcngl8iCIwfTvIVMXGkVO6wULZr+fF+ij2KfWxdxYpiGg+2jb ZduvhI9xc4gZgXR6IMpwLBYWmilXclAlYekh4deev4+1Yjt0R2zgzOmYyYFACD080QpE SsydGdmREcXDBJw+7Wtmn1kToSMyrisnJT7KnuybMfl0ykKXGol0nlvjk9a/iHHjEkMA DZZKVt/1iZOxKrf5Nyi0YM4TPO446jW5Tiib+fk41Fhb9MF9QcnbrUFd2j9SeeQrhvjP Mh7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BTw78aSuMHTEk5X02qx0Iix9Q/NY70LVODq4YAUft64=; b=oJr43ojan7byYBoZLFG1oH8lKZ7KaXu5KT8+IyTHeI1DiFQtX2p2ZtLKqEkPNbifrq yalggKxyTDNoNm7GdWxJYAVcr5iujkCuUgleMSDKV5b5f8+lHH3seVX0QANHvaQNnRtd 0CoIn0Bk/hajGMUyFBGYypoQNpCjmSsYtOMgBvQau6mCr8EdMhYbUlDE594wBD2rMV9L TqKPmvByVNYNlW++bHh3BTsP0DBOJXCEFUOi8k6oQSLpHF2WMQUqEHEkNcJKzC+JNkJJ 2MJC/SLExj7pelRdg9FxJOhe84OnxK+oNGtBvxXP1+Cd7L1bJofSKzNSP9CHDar9nFwW mStA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=P4uOr85J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j26-20020a170906255a00b0078de8494d15si84238ejb.996.2022.10.24.09.39.03; Mon, 24 Oct 2022 09:39: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=P4uOr85J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233924AbiJXQ2n (ORCPT + 99 others); Mon, 24 Oct 2022 12:28:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231357AbiJXQ1m (ORCPT ); Mon, 24 Oct 2022 12:27:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B8AE474D4; Mon, 24 Oct 2022 08:14: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 CB3446127C; Mon, 24 Oct 2022 12:26:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC45DC433C1; Mon, 24 Oct 2022 12:26:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614392; bh=qGhiw56H1/lUFsIpPvRlT9JAzi56ogDfYrZcj4vISEU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P4uOr85JkjwQlZafeVdQWz+3SvClCu+1WTQ2FumKl0BOWEtMWZkU1PF2bno/8wnI5 eT9QBaHTa6nxS6R72fsYuMk8YyEy1/APntZz/eXMqNmIlSaW5eHzcihmMdQKSTAsOC dEqL17IGsgNr1uu4Kq83f+gqm/qY0es+3+yrfid8= 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.10 243/390] scsi: libsas: Fix use-after-free bug in smp_execute_task_sg() Date: Mon, 24 Oct 2022 13:30:40 +0200 Message-Id: <20221024113033.180284498@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587764295829065?= X-GMAIL-MSGID: =?utf-8?q?1747587764295829065?= 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 8d6bcc19359f..51485d0251f2 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: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: 9120 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456242wru; Mon, 24 Oct 2022 06:33:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5uNqWXvEy6k7AY9hEM/+6FX5LgIFAfg1v3Q5GPi7qYHb/5FMVK6pbE4mEAhFrdNbGlJRbc X-Received: by 2002:a17:90b:1b46:b0:212:fa5b:948a with SMTP id nv6-20020a17090b1b4600b00212fa5b948amr9634297pjb.232.1666618430559; Mon, 24 Oct 2022 06:33:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618430; cv=none; d=google.com; s=arc-20160816; b=FF8MUlGWmhhuQCXMS/euVEjMur2+iHbaJCBeC1sWp+FplnbtSMSnQa0eIYKiS4FFG8 iiICt0YxBarnsGVlH5/RCrb1kIBQN3j59/1wIN9EI8NYM81z3EExpf/wIyNFKu5B87jT hhC6Th6mjjGHdKomW5SZ2aHBxv1gEBYD+EDGT6JTaTczCrpMT7N9qqF5JQIRit70Eo4f xoobrSz35VT6ifqOC4MdonRH0VOw1AwFzrur4zPLQ/07qSqJ3acl/hjyg+Br/WkLaqQV uV4vPMYUNCw195wQld754Bwank2TIz3PQqzBwd8B6KX320fSkoJFCj0KERbuPNl966zV e1Pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0cOePlXQBuT/bWTSOOkPY64YuCG4W7DKKh9FqTW2VoU=; b=lG3elkDglIVRJVBY5st9Rh+mcTCFQtEBQr1GLgndeP2Bubl43ylsxqHZ7KMWBtiYyc sV3efD6SIZZRrRkqOBYbvGQFSshXr4PURvoNBA3fEshvqDhvoKYLYL/fC6XIM1TXEsx3 qtSnEwk4TlRbnYeID68CicfdQetGGld8eVo2LTqGxILKTskp7hEf6jupnHVUz1DLmDOA IJ6UVhKw7+uN9e+UGQcMbxh/j+7MNuFZ0CO2QDRsAVPWqkI3xx0TvGaZbA5Xx5rd8EGQ PgylyGU9tHCtq+f25TIbJ3TjlRvlcyHZXxVbJCbKh7mBSi5mVNb/90tPhCcc/j4vESpk mSKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="S5/VLANV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cn15-20020a056a00340f00b00547d55a4d3bsi31720613pfb.285.2022.10.24.06.33.33; Mon, 24 Oct 2022 06:33: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="S5/VLANV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230459AbiJXNUi (ORCPT + 99 others); Mon, 24 Oct 2022 09:20:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233150AbiJXNRs (ORCPT ); Mon, 24 Oct 2022 09:17:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39D56625C; Mon, 24 Oct 2022 05:26: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 71FBD612A1; Mon, 24 Oct 2022 12:26:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 850ACC433D6; Mon, 24 Oct 2022 12:26:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614394; bh=ZEKZ0rHKHvvFCsKbf3+2Hp2IMvYXyT0zHyqCHjppJ5g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S5/VLANVLlPEYC7AZ71NDFXmEx07V5mX+Byk1RJEOjmHj/6GbQrgbUkoDYCH9+qj1 7AnlcMqcAWTFYoulWJTVkL/wAZUbeXt/He27PrLLu9xQotXeCSdoWuEwWSJNCsnr4Q KGNhDKkqNx7KmsXgkfFgQRkOu/hJAxuBYqeuD2W4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mike Christie , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.10 244/390] scsi: iscsi: iscsi_tcp: Fix null-ptr-deref while calling getpeername() Date: Mon, 24 Oct 2022 13:30:41 +0200 Message-Id: <20221024113033.228525124@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576087790402994?= X-GMAIL-MSGID: =?utf-8?q?1747576087790402994?= From: Mike Christie [ Upstream commit 57569c37f0add1b6489e1a1563c71519daf732cf ] Fix a NULL pointer crash that occurs when we are freeing the socket at the same time we access it via sysfs. The problem is that: 1. iscsi_sw_tcp_conn_get_param() and iscsi_sw_tcp_host_get_param() take the frwd_lock and do sock_hold() then drop the frwd_lock. sock_hold() does a get on the "struct sock". 2. iscsi_sw_tcp_release_conn() does sockfd_put() which does the last put on the "struct socket" and that does __sock_release() which sets the sock->ops to NULL. 3. iscsi_sw_tcp_conn_get_param() and iscsi_sw_tcp_host_get_param() then call kernel_getpeername() which accesses the NULL sock->ops. Above we do a get on the "struct sock", but we needed a get on the "struct socket". Originally, we just held the frwd_lock the entire time but in commit bcf3a2953d36 ("scsi: iscsi: iscsi_tcp: Avoid holding spinlock while calling getpeername()") we switched to refcount based because the network layer changed and started taking a mutex in that path, so we could no longer hold the frwd_lock. Instead of trying to maintain multiple refcounts, this just has us use a mutex for accessing the socket in the interface code paths. Link: https://lore.kernel.org/r/20220907221700.10302-1-michael.christie@oracle.com Fixes: bcf3a2953d36 ("scsi: iscsi: iscsi_tcp: Avoid holding spinlock while calling getpeername()") Signed-off-by: Mike Christie Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/iscsi_tcp.c | 73 ++++++++++++++++++++++++++++------------ drivers/scsi/iscsi_tcp.h | 2 ++ 2 files changed, 54 insertions(+), 21 deletions(-) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index df47557a02a3..6485c1aa9e74 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -558,6 +558,8 @@ iscsi_sw_tcp_conn_create(struct iscsi_cls_session *cls_session, tcp_conn = conn->dd_data; tcp_sw_conn = tcp_conn->dd_data; + mutex_init(&tcp_sw_conn->sock_lock); + tfm = crypto_alloc_ahash("crc32c", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(tfm)) goto free_conn; @@ -592,11 +594,15 @@ iscsi_sw_tcp_conn_create(struct iscsi_cls_session *cls_session, static void iscsi_sw_tcp_release_conn(struct iscsi_conn *conn) { - struct iscsi_session *session = conn->session; struct iscsi_tcp_conn *tcp_conn = conn->dd_data; struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data; struct socket *sock = tcp_sw_conn->sock; + /* + * The iscsi transport class will make sure we are not called in + * parallel with start, stop, bind and destroys. However, this can be + * called twice if userspace does a stop then a destroy. + */ if (!sock) return; @@ -604,9 +610,9 @@ static void iscsi_sw_tcp_release_conn(struct iscsi_conn *conn) iscsi_sw_tcp_conn_restore_callbacks(conn); sock_put(sock->sk); - spin_lock_bh(&session->frwd_lock); + mutex_lock(&tcp_sw_conn->sock_lock); tcp_sw_conn->sock = NULL; - spin_unlock_bh(&session->frwd_lock); + mutex_unlock(&tcp_sw_conn->sock_lock); sockfd_put(sock); } @@ -658,7 +664,6 @@ iscsi_sw_tcp_conn_bind(struct iscsi_cls_session *cls_session, struct iscsi_cls_conn *cls_conn, uint64_t transport_eph, int is_leading) { - struct iscsi_session *session = cls_session->dd_data; struct iscsi_conn *conn = cls_conn->dd_data; struct iscsi_tcp_conn *tcp_conn = conn->dd_data; struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data; @@ -678,10 +683,10 @@ iscsi_sw_tcp_conn_bind(struct iscsi_cls_session *cls_session, if (err) goto free_socket; - spin_lock_bh(&session->frwd_lock); + mutex_lock(&tcp_sw_conn->sock_lock); /* bind iSCSI connection and socket */ tcp_sw_conn->sock = sock; - spin_unlock_bh(&session->frwd_lock); + mutex_unlock(&tcp_sw_conn->sock_lock); /* setup Socket parameters */ sk = sock->sk; @@ -717,8 +722,15 @@ static int iscsi_sw_tcp_conn_set_param(struct iscsi_cls_conn *cls_conn, break; case ISCSI_PARAM_DATADGST_EN: iscsi_set_param(cls_conn, param, buf, buflen); + + mutex_lock(&tcp_sw_conn->sock_lock); + if (!tcp_sw_conn->sock) { + mutex_unlock(&tcp_sw_conn->sock_lock); + return -ENOTCONN; + } tcp_sw_conn->sendpage = conn->datadgst_en ? sock_no_sendpage : tcp_sw_conn->sock->ops->sendpage; + mutex_unlock(&tcp_sw_conn->sock_lock); break; case ISCSI_PARAM_MAX_R2T: return iscsi_tcp_set_max_r2t(conn, buf); @@ -733,8 +745,8 @@ static int iscsi_sw_tcp_conn_get_param(struct iscsi_cls_conn *cls_conn, enum iscsi_param param, char *buf) { struct iscsi_conn *conn = cls_conn->dd_data; - struct iscsi_tcp_conn *tcp_conn = conn->dd_data; - struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data; + struct iscsi_sw_tcp_conn *tcp_sw_conn; + struct iscsi_tcp_conn *tcp_conn; struct sockaddr_in6 addr; struct socket *sock; int rc; @@ -744,21 +756,36 @@ static int iscsi_sw_tcp_conn_get_param(struct iscsi_cls_conn *cls_conn, case ISCSI_PARAM_CONN_ADDRESS: case ISCSI_PARAM_LOCAL_PORT: spin_lock_bh(&conn->session->frwd_lock); - if (!tcp_sw_conn || !tcp_sw_conn->sock) { + if (!conn->session->leadconn) { spin_unlock_bh(&conn->session->frwd_lock); return -ENOTCONN; } - sock = tcp_sw_conn->sock; - sock_hold(sock->sk); + /* + * The conn has been setup and bound, so just grab a ref + * incase a destroy runs while we are in the net layer. + */ + iscsi_get_conn(conn->cls_conn); spin_unlock_bh(&conn->session->frwd_lock); + tcp_conn = conn->dd_data; + tcp_sw_conn = tcp_conn->dd_data; + + mutex_lock(&tcp_sw_conn->sock_lock); + sock = tcp_sw_conn->sock; + if (!sock) { + rc = -ENOTCONN; + goto sock_unlock; + } + if (param == ISCSI_PARAM_LOCAL_PORT) rc = kernel_getsockname(sock, (struct sockaddr *)&addr); else rc = kernel_getpeername(sock, (struct sockaddr *)&addr); - sock_put(sock->sk); +sock_unlock: + mutex_unlock(&tcp_sw_conn->sock_lock); + iscsi_put_conn(conn->cls_conn); if (rc < 0) return rc; @@ -796,17 +823,21 @@ static int iscsi_sw_tcp_host_get_param(struct Scsi_Host *shost, } tcp_conn = conn->dd_data; tcp_sw_conn = tcp_conn->dd_data; - sock = tcp_sw_conn->sock; - if (!sock) { - spin_unlock_bh(&session->frwd_lock); - return -ENOTCONN; - } - sock_hold(sock->sk); + /* + * The conn has been setup and bound, so just grab a ref + * incase a destroy runs while we are in the net layer. + */ + iscsi_get_conn(conn->cls_conn); spin_unlock_bh(&session->frwd_lock); - rc = kernel_getsockname(sock, - (struct sockaddr *)&addr); - sock_put(sock->sk); + mutex_lock(&tcp_sw_conn->sock_lock); + sock = tcp_sw_conn->sock; + if (!sock) + rc = -ENOTCONN; + else + rc = kernel_getsockname(sock, (struct sockaddr *)&addr); + mutex_unlock(&tcp_sw_conn->sock_lock); + iscsi_put_conn(conn->cls_conn); if (rc < 0) return rc; diff --git a/drivers/scsi/iscsi_tcp.h b/drivers/scsi/iscsi_tcp.h index 791453195099..1731956326e2 100644 --- a/drivers/scsi/iscsi_tcp.h +++ b/drivers/scsi/iscsi_tcp.h @@ -28,6 +28,8 @@ struct iscsi_sw_tcp_send { struct iscsi_sw_tcp_conn { struct socket *sock; + /* Taken when accessing the sock from the netlink/sysfs interface */ + struct mutex sock_lock; struct iscsi_sw_tcp_send out; /* old values for socket callbacks */ 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: 9280 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp462980wru; Mon, 24 Oct 2022 06:46:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6cWSmjKsqAnO2V3a54cfL+xl5bkAZnjg6s8h3gG90QnW4Q3soqJpqp7P0ca7Ih7q4gsQnR X-Received: by 2002:a17:907:3ea9:b0:78d:fdf0:88fe with SMTP id hs41-20020a1709073ea900b0078dfdf088femr28732893ejc.667.1666619212538; Mon, 24 Oct 2022 06:46:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619212; cv=none; d=google.com; s=arc-20160816; b=N2zAlLgbi7zDDJvgdtD3riLoM9Kvqm62PSVToAVY4nprDoBf5KDrQYUGEVhtSme9/u B5iDa0W1+WsHGYHlW4eRbW2e3AcGDYTN4j8vR5PWhx0zqxZwD297hANHGwJ0EvKBzgGQ TLpX/l/16o8tIKjPv0UphFzNmhA+2EGYzjm29Nfvp9iw//zNxndixApXRgDAfr6IW/kv GnEQl3eBtzQz/DIre8EFFZ/PLnBIfeKbO4RHg5wDf04GUoEfRNUAgrX4cOPAxa8G3noa dLxg2DzlnERwMRpGuxsUNVrloFxp7D0VZKE+goArMCzu2WedAfFQqzcVdOqYgM5fYhWC rDLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vEpJhqIpwQmFdzqiv6RUZiajBMmVY/iEhd/SkqiY9NU=; b=DXREJnS9b0iA4DW6XK2JRl7Ui6nrh1ekHBa2i9LFI2UUxoQelx2w+icrbRezUJ9TpJ ZTQiIEoeuvijhPvWc38rfIYYflj5NPTmaolqjFzOcc1iREqSs2nbZ73cVRLacPVW2R53 Cz0JPlklPkb9gxdeJLW9wPHh1La6SE4EY0Zyv626EuebhpPlUPrQbsc9tbj3Te39ZKEM lQSdePQ024BpdnO+aR4ekDTLNRnJtN4puuL6oiujBgv+Cjke9jAlhH5rwfXgmpfuJNzu LPQne0RszC9GOzGrkd+mlXX+ROvY2Dsoe0+mLOVcrZnl3ymZB9mmQcWQjvKCkJuXhUjg Rctg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CRO71PL0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ht9-20020a170907608900b0077fb99b8cfcsi19454815ejc.301.2022.10.24.06.46.26; Mon, 24 Oct 2022 06:46:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CRO71PL0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236021AbiJXNpU (ORCPT + 99 others); Mon, 24 Oct 2022 09:45:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237015AbiJXNlz (ORCPT ); Mon, 24 Oct 2022 09:41:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99C1B5FA6; Mon, 24 Oct 2022 05:39: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 16B7361291; Mon, 24 Oct 2022 12:26:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 280E6C433C1; Mon, 24 Oct 2022 12:26:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614397; bh=ihLTuvpV7fDfB9cdHCvDyrLZholIYyBFIIbqcDNjvCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CRO71PL05awaHyj+pmG5pDZvybd+3gVPLEhl1c7XmmPgxf7O4r+ug2pRrLgNWv57V HGDS36hNZxY2+Q0idK82mOAZo0/ZItotwRUZCkaQ/NNzp6So1eqMrwcYIl+RYbTovV 7pSIB9AT/20YDEOUGqfZdngRFjAVH7JNCgQYE+i4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Marko , Dmitry Baryshkov , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.10 245/390] clk: qcom: apss-ipq6018: mark apcs_alias0_core_clk as critical Date: Mon, 24 Oct 2022 13:30:42 +0200 Message-Id: <20221024113033.273192147@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576907641228819?= X-GMAIL-MSGID: =?utf-8?q?1747576907641228819?= From: Robert Marko [ Upstream commit 86e78995c93ee182433f965babfccd48417d4dcf ] While fixing up the driver I noticed that my IPQ8074 board was hanging after CPUFreq switched the frequency during boot, WDT would eventually reset it. So mark apcs_alias0_core_clk as critical since its the clock feeding the CPU cluster and must never be disabled. Fixes: 5e77b4ef1b19 ("clk: qcom: Add ipq6018 apss clock controller") Signed-off-by: Robert Marko Reviewed-by: Dmitry Baryshkov Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220818220628.339366-3-robimarko@gmail.com Signed-off-by: Sasha Levin --- drivers/clk/qcom/apss-ipq6018.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/clk/qcom/apss-ipq6018.c +++ b/drivers/clk/qcom/apss-ipq6018.c @@ -57,7 +57,7 @@ static struct clk_branch apcs_alias0_cor .parent_hws = (const struct clk_hw *[]){ &apcs_alias0_clk_src.clkr.hw }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, .ops = &clk_branch2_ops, }, }, From patchwork 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: 9193 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458819wru; Mon, 24 Oct 2022 06:38:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5N8Tk+7K7khGPlXMtTx/CxLQz4Rb8bWIz094Y2njSwybvzLagCpkeGUkSO947v8RPlIANI X-Received: by 2002:a17:906:cc58:b0:7a9:6b4e:79e4 with SMTP id mm24-20020a170906cc5800b007a96b4e79e4mr2986773ejb.57.1666618702448; Mon, 24 Oct 2022 06:38:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618702; cv=none; d=google.com; s=arc-20160816; b=GsMN7zmf/+MsuJuS5eEYWmivL7GIfpOh19TdbFCBkDPuNy61RkcCuv6Mu3tC6EM839 ufoSiyQ5n1idJZh/KKOyEVeU9lF+4XOooS6+uEhJOf+ux57Khjmx4O1AxlIW/T0+TXz6 mt43a+k5pEPJ7f1TpAV/iD4nHCVsMhPUp9a4Ot94aMyIkMaYx4t5faBZSr7H3wSxpQ3/ aIawY/iB0Egb/QEzb15dkrI+2qtbzHcl7A3hQhLkY4oqS5Ce+/+0Afdsz9e9jztggbHV uXxKy++3H4BP5t1Hi2g41w7l+o3Vj6XuRkALIJQ49Yjl2Q42jnqyFsqLH8KduMEBxJwT uuJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VEVpWNuIR22s2UJmOzjS4cN8lb/+ckr6ks3ZUQMp/Cg=; b=Ol6BZuqrhnGedPTyH7Kb3y4HX2FK5ML+6iVVA5BOVh+SISPhvNa+Z6mXBHyI5TKOYD DAIL4Jz+Sac61hT8hXp2ScYNkKzk+vyupnsUTNL2ASqYTObJoT5qmLnRCJkGOYqr8yXx 1u/KkqOIX2A4Eqqp9hhhWTZ1aP4J25M8eAjitNxpIy9/OCakV9VDk+0MYwH5mRZaD4n4 8t2q5iGYFpZ1myo9QTAJT/3iySprgKJ3JNojmnepXE4Rr10ksQeDBSwuw40cUcQkStDF 3RaZKrP+/KVWo9mO6VRQ3U8YFTjcYyQYuB527lHbz3M24baaN7Dhje+KGYyG6obyoo0H aD2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UMuGKLUK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hc33-20020a17090716a100b007a11c253eaasi7211499ejc.809.2022.10.24.06.37.35; Mon, 24 Oct 2022 06:38: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=UMuGKLUK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231956AbiJXNXd (ORCPT + 99 others); Mon, 24 Oct 2022 09:23:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232553AbiJXNWn (ORCPT ); Mon, 24 Oct 2022 09:22:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B26B13F8F; Mon, 24 Oct 2022 05:29: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 AD252612BC; Mon, 24 Oct 2022 12:26:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD599C433D7; Mon, 24 Oct 2022 12:26:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614400; bh=1QUJDNqcFFRSgqgvnf6wISDMsBWhPp8lS7GZcNtc4uo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UMuGKLUKnbLZzC1Hyp84e4OHB1hSz82Ddr22JgCqKvDziyLQum27tJqWg7QJxzGcD 96tn4Rb9YrPyF3JfV4R3pRIWuQkR6YE5ol/szqzckmaMKY0T8KqOruAfAyePY0zU0y lPzsg1mWRYt3ShZo/Kg5B25g2pihtCC3Dy64XLmM= 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.10 246/390] fsi: core: Check error number after calling ida_simple_get Date: Mon, 24 Oct 2022 13:30:43 +0200 Message-Id: <20221024113033.316461841@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576372879179576?= X-GMAIL-MSGID: =?utf-8?q?1747576372879179576?= 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 59ddc9fd5bca..92e6eebd1851 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -1309,6 +1309,9 @@ int fsi_master_register(struct fsi_master *master) mutex_init(&master->scan_lock); master->idx = ida_simple_get(&master_ida, 0, INT_MAX, GFP_KERNEL); + if (master->idx < 0) + return master->idx; + dev_set_name(&master->dev, "fsi%d", master->idx); master->dev.class = &fsi_master_class; From patchwork 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: 10130 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp633944wru; Mon, 24 Oct 2022 13:15:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5FmdeIKWX7UggOrSfOHgP0uaU4SG3MUt87gqhzLSR7eLOYbJhkmGIgn369PFjZE0LMbqUy X-Received: by 2002:a17:902:f710:b0:184:7a4c:fdc1 with SMTP id h16-20020a170902f71000b001847a4cfdc1mr34949283plo.27.1666642540054; Mon, 24 Oct 2022 13:15:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666642540; cv=none; d=google.com; s=arc-20160816; b=ZECo3Cu5Gb+VE12H0aXWzBwAh2lWiZbEgSZOZoAJj3eodIVv4H3WubtvWm7OkJQDEk 3k8pNLsHb06oe//J5Q1CqAlzZ61x4/Dy0FerSPC9/LOJwxv36njQ8a9IvhqMQyZG7RXS D6LL5UYcCd6oUfrKcByqId0tjHbLvpVw/tWOycthl8RbxCrmGqggQmMQnsPQFUb5AbBq BABfLNZCPtWumkrX/RKYOShZEMxKzIrcma+MJEi/JeWjP7jQ17pS5svanlJlDvyXAjAf iPW+F9S++mJXpVLx43QjgY+NwMwSuXw+f5q2d4x1vfxOexlzR5DwZuYx8MztpsRdOEdX h49Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IqCyo+VBCEqyxWEjVp+XrkK16sVyc4d/2d2vYhlDz1U=; b=pCeveN1du1YJXVarrFEwCDEb+JU14z5GC9tC8d8CMbvWlpewSHUZiwKgjluqV8Nny8 oxjilHx/0kG2Hh4FzLlP4Tr/uWpesfjAiAtU1Hx+wNrnNZxiB5Gs4Ix9t+S1CH7hD0FH 279rSP9uB7TBibUrs7bEgztQZS9wDpJmLYX/Vfymz5HdjteI55mKyeoDTcDzGbfbtI3W oI9wduJCw2fzFO2MeHmqDQWq1Dm30JIyP+9WTt6gtm+S1AlD8Es4CcZaAav9CKYLXucT uthxZXRYmtSrC7TxFMUxE3vI9+ll/2qHO2E74Oif4PkK1RTGmwGHHZWZ2FALQgTP0gzB 7aag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=c8FsqwoZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u30-20020a056a00099e00b005397c4ad9e1si743779pfg.134.2022.10.24.13.15.26; Mon, 24 Oct 2022 13:15: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=c8FsqwoZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231347AbiJXUHh (ORCPT + 99 others); Mon, 24 Oct 2022 16:07:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233209AbiJXUGs (ORCPT ); Mon, 24 Oct 2022 16:06:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A7F3FC6; Mon, 24 Oct 2022 11:26: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 9D6DEB8125E; Mon, 24 Oct 2022 12:26:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02957C433D6; Mon, 24 Oct 2022 12:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614405; bh=vSgsDIvzzF3Mr1Kj1xaAWGv9LZXJ1IaBnh/leVDRPlw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c8FsqwoZnOp0SmlhUFeYVaJ7qyKvMUTQ/wRRTEyNSOj9dLeGEuBffXZ6x3DmZDw+A VpCjMDeLMWTYUTDGU7jPO+1mS+P5lSuDKo7L58cdilbhWEfWMCDlC0S6ivVO/pWk/p ebTGRfgy3/9tPKFgEmoNVgkgTNQjvsWr9Q42JpKA= 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.10 247/390] mfd: intel_soc_pmic: Fix an error handling path in intel_soc_pmic_i2c_probe() Date: Mon, 24 Oct 2022 13:30:44 +0200 Message-Id: <20221024113033.365656870@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747601368329436966?= X-GMAIL-MSGID: =?utf-8?q?1747601368329436966?= 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 ddd64f9e3341..926653e1f603 100644 --- a/drivers/mfd/intel_soc_pmic_core.c +++ b/drivers/mfd/intel_soc_pmic_core.c @@ -95,6 +95,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: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: 9616 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp531228wru; Mon, 24 Oct 2022 09:06:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4xu0wrxL22lHZoBAn2Yj8yLt8VL+/b6jgSQ28hvYYXe3HQBEVvGaNLDyXzs7y0Kz4Y776i X-Received: by 2002:aa7:df94:0:b0:461:aff8:d3e1 with SMTP id b20-20020aa7df94000000b00461aff8d3e1mr7399558edy.10.1666627572126; Mon, 24 Oct 2022 09:06:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627572; cv=none; d=google.com; s=arc-20160816; b=PcK+oOxe81eoIirqY9Oe1QQ8JQmB3D6Xgi7P+3SMWihbhIctHqV+2kWxlK9HRRoXB+ oSrhIkTu/Z7J/oqI/f6jdXDm1l1anzlMzsljw0O0/g5Y4AjCbx9EpN6cgTkNUS2AW3/v PUG9T0I+9TOcK5xwa2Qb5SELmKrxfTTzUoNdU9HSRoifDAQfBp1kBTxvXpK1aQOwKxYP 7AO+mEQe8+7XOLMGWwJ9e5JFFRXBmGHUTqk54NXVY6GKlz8NdskxTUFi9KefBkdMjlgu Zr0WAKSffTR2BJ1LNvwytu3nJpZ2TjE1NMK8+ufXz/6w6HTcRspAE/QCwWLov2XOFZv+ QIcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=sD0BIu8jWXK3DQdzD2VVmNPYlV/SmVlE+bFsp+4hTTiyVxfGjrduL+Tcs9jzSxW5bB F7d5ydWdx7PxwrpqcUqfaQsIv0+7wl5tiKdZIfFQoRU7i1CqLsGtnDru+PTnZoXfhXDo d4m3jX73lXb3V6a7ABtI5JQougZ653jpWvYsZjRn3qzwwrwNt+0R1+q+F4CrJ0zL9OIE EYBcB874eT+QDCT/FD8rUTpPHCn3sffQXbVwG5IxGDmLaF7hlzHRO0uNpmhC8i7UxMSn zFHt8IuwKQ1wKXnFPZCRIIhnYCsfLph9ubDETt5g3VIAQbkflyC7nmdq97OVrgFRzpNt RC3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Y26FXCt6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bd24-20020a056402207800b00447d6f244c6si127740edb.248.2022.10.24.09.05.45; Mon, 24 Oct 2022 09:06: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=Y26FXCt6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232840AbiJXQDr (ORCPT + 99 others); Mon, 24 Oct 2022 12:03:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232710AbiJXQCg (ORCPT ); Mon, 24 Oct 2022 12:02:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93138176BA9; Mon, 24 Oct 2022 07:55:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 41E36B81188; Mon, 24 Oct 2022 12:26:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B513C433D6; Mon, 24 Oct 2022 12:26:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614408; bh=72IdrIRDfHiRyzadDUK1d/TKQj32QPvspPY4OjhOf2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y26FXCt6FMfQjgA9Sg+ZhIphX+7li+fn9ty1Kg3OaGl2+p0ZUIOqK/03aMBuhYuKn fgbL33MVFsYRwCPyOmtui+hzwkfJ/hWdOS104/w9nFpyjh6WH/0VhmJfw2rRD3A7hY kDEIVFE865zCDwjQn4G1IMWourlXKAuCKbIP6AUk= 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.10 248/390] mfd: fsl-imx25: Fix an error handling path in mx25_tsadc_setup_irq() Date: Mon, 24 Oct 2022 13:30:45 +0200 Message-Id: <20221024113033.415359656@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585672736535455?= X-GMAIL-MSGID: =?utf-8?q?1747585672736535455?= 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: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: 9894 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp572532wru; Mon, 24 Oct 2022 10:35:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4uz63n1N4Qxywz9ObpID4csMgS97uBjBW1qja697Hl5zbWG8QIeEfI2qVo01tkRknAn3Zr X-Received: by 2002:a17:90b:4c45:b0:20d:4ead:6e3b with SMTP id np5-20020a17090b4c4500b0020d4ead6e3bmr40570490pjb.76.1666632932387; Mon, 24 Oct 2022 10:35:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666632932; cv=none; d=google.com; s=arc-20160816; b=H+4vMioT4pNvpZn+7OGYolmt4vTthqFEoGqu9pWhuBYt7tdOLuhKs1dtbvFuGyIcwI Tj+tyra8o6XDf+6bJtVM0AEuYhJdJYWLtbqeh9jQFY2yUIAXmOG+Sy4Thm7A83cM9Mpy ZlHv9Ni9QYpWtXRsFSUAfoZxMXRJ79N8r7EM75bPJEEtF2tAjTNAomdAcaA/zQ22mPyz MPWMrllb9ICl/Qxe5vMQxA0IQhhevvuIsLaISiCboQrJuCvoQ/fTweZMKsv9ik2NHeMN JFnn66kGWRtnxIJBrZvVf6AMODmvpS6q+SqF0VtJMuCnnnieJffLLzeGgs8BAKX9FYvX CebA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=VJkMOpvFdjVx9bQFx9SYGKH3/pr8pYA2kuR47NBO6Doz0W1Vf8dtEB9VVWjXzt+7HW rWCzHgnfa995T6p6tHFxh+nzB63VRu/tjw7/zgzJ7u9ZTXwdrWfPHLp4KW7oC/f5xcIP ukW+ZS28rzQkELtgHUaMJEUG7j6HktynwOyy8V+gwSzkTwmNFANhsDx2QobuI+BCzPIO fzNc4R5Vcu8aerMtAP5V0sfgpIVmG4Leh9CIvEQdCf9NrkePvYAVZ6FKx+ojiL/2vP0E x83kp7nsw4v6Hwgpg7PM6JGE2NI3TkdDmaAlEY8A8HSj1efNMJ3QKBu71YfjROHoUdnl D12g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=M5t6zc8N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s23-20020aa78bd7000000b005633c373dcbsi281885pfd.147.2022.10.24.10.35.18; Mon, 24 Oct 2022 10:35: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=M5t6zc8N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233239AbiJXRc7 (ORCPT + 99 others); Mon, 24 Oct 2022 13:32:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233428AbiJXRcF (ORCPT ); Mon, 24 Oct 2022 13:32: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 E763DE0FC; Mon, 24 Oct 2022 09:07:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E4E66B81289; Mon, 24 Oct 2022 12:26:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 424CAC433D6; Mon, 24 Oct 2022 12:26:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614410; bh=43hCi9kwgxotGOGQYEO+J/HJrzuryoYkehb67txsiVk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M5t6zc8NwFQZ98kRD38v5AI4bwtUc+cEQuLqIFhBWDVzTkVgE4kuMpsBXhLQkiF6L 08nQvIORix2F7mnqfwhAzqdkj76inabSyCqxlh8/Os8hmKz0OKmzgFZ02u5rcBTWXZ w719KU5aIT2G7THo1bwhDRNkH6rS44uZGkmAAkmo= 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.10 249/390] mfd: lp8788: Fix an error handling path in lp8788_probe() Date: Mon, 24 Oct 2022 13:30:46 +0200 Message-Id: <20221024113033.461031082@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747591293821133665?= X-GMAIL-MSGID: =?utf-8?q?1747591293821133665?= 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: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: 9635 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp532466wru; Mon, 24 Oct 2022 09:08:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM70GKNBjZrXcNTHUwMHPwGoBgFwWyfwoHODQOlHX9jKGOThZkpiL9qDIkEYX0aEYqmBZKct X-Received: by 2002:a17:907:75c1:b0:79b:f804:c081 with SMTP id jl1-20020a17090775c100b0079bf804c081mr14997740ejc.381.1666627686552; Mon, 24 Oct 2022 09:08:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627686; cv=none; d=google.com; s=arc-20160816; b=xVoZWsJc3IFjklqJz8jOvWGOuC88s2z2MZe52hKQg4fqrNhPy/HvADKLBOCT8JJet1 j7/xFKvPcKZ1XgaB5TLZl935UTBd+oNhVFFkyU9ykFqC33QezdKSbQD7nWC4KQ0GWDSL jSYYSTkHH8firG82um7gaKz6PDr2FlrEzU58LOpPxxBAFqy7Z1LHzZVeNMW0i8S7dSmF HX+FScPxiRvr5VCnjiVbE/vVWDSRU8ci03S7dbatzLmRX9+huByGKkk9k4EipmextQG8 dlJ7l2bfS6mS4/kbZA3DmlSHQczpip/SvlEaNfDM/EkmS8CPn1YkfE7/82qz03lxLbps YlTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=HLHWs2dA6rvzGSQ5UIqLxN/iAVAQLYg6sN9guCDGwdI3tUOz3xfNMxUQ2C46HNUDib 7WxeEcZXpfrCN81QReksWR8XNXieVAiNzDpzCvvyrAYUyPPbvQPtfVArlHN3/wTAqIUo yCW4QRW5bcXP9Ldkku8lCliY1H5DNXN/J/89eKiaf/8RJzU2sC+wWoUW08ZFMqwMYIM9 gOLSh8hzeC5JkGka75P1/XpA4x5N0V7rlMBI3tGoKPAdPdNK7FvCrQ+eB+FXA2PNe/dF uadpeurjcTcfXobTfn2cdmurmoGDqS64PwK3HzCuFGYDeTvf3sMPdJwEJ6yptU11kUpM +Esw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D9oJ8YHB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h41-20020a0564020ea900b00447dfae6181si146499eda.235.2022.10.24.09.07.42; Mon, 24 Oct 2022 09:08: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=D9oJ8YHB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233150AbiJXQGd (ORCPT + 99 others); Mon, 24 Oct 2022 12:06:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232977AbiJXQEH (ORCPT ); Mon, 24 Oct 2022 12:04: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 64DBA11A970; Mon, 24 Oct 2022 07:56:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1BF60B81694; Mon, 24 Oct 2022 12:28:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74A5CC433C1; Mon, 24 Oct 2022 12:28:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614512; bh=Ku35vuD17YGpq0QHl+DAKe80YrZ/0TpL18rzyvhTdJ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D9oJ8YHBs64xfPoPJ4ckppauB9TWXI/woO3Mam9LSoOAbTQ5d5REkV2oWXe/nVvy5 PJDZ/Qwj5hiA9z5DOLPgaX1RTPuPrKXhhfFPEQJjA8YOLUEIVOjyhC0YpMXTsM02jg ffZsY9AD5zQ4Xv2KgJ/g9warPg7KgxGKrz4jBJ48= 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.10 250/390] mfd: lp8788: Fix an error handling path in lp8788_irq_init() and lp8788_irq_init() Date: Mon, 24 Oct 2022 13:30:47 +0200 Message-Id: <20221024113033.508191887@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585793017504481?= X-GMAIL-MSGID: =?utf-8?q?1747585793017504481?= 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: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: 10141 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp638163wru; Mon, 24 Oct 2022 13:26:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7MN3o+dtIK+gx193vKBCtosJzi1EjnDlITP3bzAjm8ARjoImv5dRpSYQWYEOvg2VYcOpMC X-Received: by 2002:a05:6402:51c6:b0:45d:50ef:1142 with SMTP id r6-20020a05640251c600b0045d50ef1142mr32875428edd.259.1666643168562; Mon, 24 Oct 2022 13:26:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643168; cv=none; d=google.com; s=arc-20160816; b=MS13iOWmiiUhyHUBOvCJtgVTQwf6/1Kx3UDZfl67IhkMMN0vF8pPlSrZmvAaDia72R 7teh0tS+GZmqoS4OJVtcWm8veH8EXYYserxh00TKGRyVUquhw3CxW3MS0BaeMKEkZIpR LQeYMPOnZCVJm23zTawX1Evf50bc21BXVzy2rvvktFvDLgieWCQk2Lv3lTmhWabi+1I8 bfg4SRwVGZYaiuiT5EKPGWC59vnshzh4iTk2ReCJ3aM2vga4lQyTydhtyTTmFU6T1/24 OSj3PZGieaI+R5ht32i6B+9flhEZvsx4aWHKP7VgUiFHINU80F8AxpzZfClu0lVvEqV9 DdSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=JXNtLrKkyw5lX4wQBKrnA7QL2LIG8WgMWw+6TYXYPKvIFWb1HJpyCj+vuCRx7PBXxv A6timF6ZYy/hQDa27X0cqDlsC6z7OMEDZKIRAvO7vu5m3ARywuzag7NmCh47K/V2Ti6U TskFUFJpopZu2ONni3E7mjWpeGI3R15TqKdk3kU61asEFNBUxehIqi5tt59dn9gWyMpk c79WlCw0Z3oI6HPIuXYgyt6ESh8mY7/yewt0qncVpOGDZR112RjN3wiASn7C66Y8PAPK qyMOtwJ8+ZQANB8WChHgjMg5+/dw3Kaomxq+T6Kg+EFtR5gqDfUQF7z3fF1tR29m4ejQ sklw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rrRsqRA2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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.25.43; Mon, 24 Oct 2022 13:26: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=rrRsqRA2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231239AbiJXUOX (ORCPT + 99 others); Mon, 24 Oct 2022 16:14:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234030AbiJXUNy (ORCPT ); Mon, 24 Oct 2022 16:13:54 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 727EC96214; Mon, 24 Oct 2022 11:32: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 sin.source.kernel.org (Postfix) with ESMTPS id 51715CE13CB; Mon, 24 Oct 2022 12:27:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49E6DC433D6; Mon, 24 Oct 2022 12:27:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614431; bh=hc8c3MQUf/iJKjMeBQ8BrGrAjXnopkSr+laGHJAs9m0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rrRsqRA2f4kONVl2DAcyrtL6RioxgYHYzjHckchlO0jHD57P5Wkg3U1mj4Qrjg2Fi do3O52aOV+5kWMopnYs/Mwpx8aIPAUuWo1mg4pZPrZWOxmRqA85xw0Ww3EwGowV6p5 H8LeUI//mWEuDPfCh0vhG0IL0SMpU9qiui4Y/mC8= 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.10 251/390] mfd: fsl-imx25: Fix check for platform_get_irq() errors Date: Mon, 24 Oct 2022 13:30:48 +0200 Message-Id: <20221024113033.556644401@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602027101810633?= X-GMAIL-MSGID: =?utf-8?q?1747602027101810633?= 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: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: 9502 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp481422wru; Mon, 24 Oct 2022 07:23:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7fIHXbRFz4CRLPogofav/L7Bw0kGjtZsp6XShcw7puCkSfuPC3sTv1m4aBqJr1ATpE/m19 X-Received: by 2002:a05:6402:249f:b0:453:eb1b:1f8b with SMTP id q31-20020a056402249f00b00453eb1b1f8bmr30312348eda.235.1666621385678; Mon, 24 Oct 2022 07:23:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621385; cv=none; d=google.com; s=arc-20160816; b=WyAYe+mwr9E2K62cdhl7JHGjCC4VFOkGH80/nzikqKPs8WI6aQPHGFJTv9qMhsncaK D4hwRCgz1Fcp6tYMmqg3VC0jRHQV9ttmaTwv39iX5uBt5tCIsd6EgVAs8LQ+24rmPIsr MRpXB+6EQYqHquLOlny+Ip9s7+3OubWT7TzDsPP/kqWqwNcYYkrpW1DfY0MsGyFnVVja vGbYuLlVZadC/tXQyyzPGm/60qRrpRSHpOeGsh0qwyDjmePC+bD891fF6mdSeF9IdBzt V0VpTfADwTBkDwEsa7tP40oTW8Z9JBnGyJnR+kGL8qNzCUKL4lGx0JwL3V/XJxA1IMJM VdqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iOCeD4IXS5rlA8uzhJN9dldiydkSKe8YbRk1KZhGZ/4=; b=loZUUwEyU5yyXX92y93wYFLYIAEDdeOyHvNMoE3BW1Sjuu/BWVuUTJNgrQqZBVicuH gGv+17KD/pIsx3Mo+RfAEJclJKjzq/P7Zn2yansMfKKjCONX2qgSfAN1faA8Ef3ynv1D EnMWFkEp4OcBo+AYPElqKxMP1X/QHd9mJ6DsVU7Ih58euFVNJUuAjwtLT33DGAt01XNg bU52a1ehdQQTTObzD3VfJMbUTMH3HUS/ZgW1lNCOR7T8Ss6VUh7U9ErWWjp6/+u0i0Mg Oe7zz+bEbfuEY/ATcoY2zAyea14bOKW+dboNcBtR283sCL9IOmGMkfDRr2x2MBmyQMzx 4JnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CeASMxgY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hz6-20020a1709072ce600b00791a67e4c04si15158469ejc.31.2022.10.24.07.22.40; Mon, 24 Oct 2022 07:23: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=CeASMxgY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235462AbiJXOVM (ORCPT + 99 others); Mon, 24 Oct 2022 10:21:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237053AbiJXOPn (ORCPT ); Mon, 24 Oct 2022 10:15: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 47AF977EBC; Mon, 24 Oct 2022 05:55: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 DEE04B8168C; Mon, 24 Oct 2022 12:27:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3CC54C433D7; Mon, 24 Oct 2022 12:27:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614460; bh=LlDjGU1z6C8Y/HGgUIA6xrtbjnFjPgP22JBVHE1fZJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CeASMxgYBVxU1JGBOoCyRCDxDnPfGSFKO/JOJmw/aVy7NCwCWHAg1iWhAB8SddyV4 84nJHs1X/6aM3eG5L8N4vQjqF5f9zYsS7Ts+h/ERc55aYfyetYzZXks3BJdZ2iy3iG Xzzw5PMPkoTeiwNssJKqraW6m9mklAxVc7bhwiIw= 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.10 252/390] mfd: sm501: Add check for platform_driver_register() Date: Mon, 24 Oct 2022 13:30:49 +0200 Message-Id: <20221024113033.596128064@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747579185812740603?= X-GMAIL-MSGID: =?utf-8?q?1747579185812740603?= 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 6d2f4a0a901d..37ad72d8cde2 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c @@ -1720,7 +1720,12 @@ static struct platform_driver sm501_plat_driver = { static int __init sm501_base_init(void) { - platform_driver_register(&sm501_plat_driver); + int ret; + + ret = platform_driver_register(&sm501_plat_driver); + if (ret < 0) + return ret; + return pci_register_driver(&sm501_pci_driver); } From patchwork 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: 9141 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457512wru; Mon, 24 Oct 2022 06:36:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7BxdSFGl4livFclPzEDeugc23ZuhHdzKJKDD6485emt7btRU8CRs4SJBMjsGIPHRZVjq6e X-Received: by 2002:a17:906:730f:b0:791:9b75:2ca1 with SMTP id di15-20020a170906730f00b007919b752ca1mr26364620ejc.140.1666618568007; Mon, 24 Oct 2022 06:36:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618568; cv=none; d=google.com; s=arc-20160816; b=Ao4NkMjFoZxcVnFCC4/6VL9KGCXWwGV+iJ8AqUd2ryur7RSOd8KihYZ0LHrwXYGtrX p00XZKwbnOwLWB7M8phBChuvSA2SfRvcJ6InUGDDNodpVyirjkoD62FQppkQICP0zbtO l/IB1I/0PPeoTuUaUX1/7OD5UP2uFWmzck+0vX/lVgIXJCxV8On50DPjeJ34SXULlq5W B7XDUyJFlxCfS75eAaNRPvxHL8BDDy2Jr83EjDoLsURCarB/MOWWRq+zI/2K3QPywWNv F+byBAN3h7py4cN4fw+PuG4+vXIH/G8FwQRetYxOF1fwPaPuc6Sd5KU6kZPK4Bu40dYZ v2ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=eBaIibrTI+iax3OM+0Yns8qgwDymwq6DD6q6yH2MwWR3/aiRw20x58U5JtooZE2BO0 UrzUG9U8a3Ab3HonM/B0xRS/4Q2KZ+gPWcwVwda88PTW5x0h5Td9/eGVzUDbv2hFjs3M 1kGJMAJELJD7ux+L8xE99CxTBWvLx/9fC/g2EmgZUj/yrxFYVVRVrdfZv5U0ak5pONAv SU+qZjZ/SQtkUX/2JkqPfT1gfKaWo1K05+LYQgIB+6H0xFNqsrrS5T9ZV6gKy4VbRMsz RVgB0R0VKwJKYl2bj4X0gnP8jGxXy9ANaj2lgtU7GEVOzvJBAjJckB1yHtTIJ+busFj3 Tx1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Zqs/o7ZO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nc7-20020a1709071c0700b0078e0e850902si27642716ejc.868.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="Zqs/o7ZO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231631AbiJXNZy (ORCPT + 99 others); Mon, 24 Oct 2022 09:25:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234184AbiJXNXC (ORCPT ); Mon, 24 Oct 2022 09:23: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 E865A45F6F; Mon, 24 Oct 2022 05:30: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 D606061286; Mon, 24 Oct 2022 12:28:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC5D5C433C1; Mon, 24 Oct 2022 12:28:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614489; bh=V2dOPSF3+RqJgCZ0dAjorrygamRapc5bi17muQbPhos=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zqs/o7ZOrFDao8x/ky4Phy2DbK9LNbQ2K0m7P246xSyOSQCuZh6Dy+bDOHV7ZDX8W jjDLBxLYujXKxEEyG/9jf1FiiXjIXTtpCYUTFirpWsCUsvLkWWTujE3G50skC3NaOH zdUJfzgdZwI7f6emURC3YtilRapZMwe2QspJDqwQ= 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.10 253/390] clk: mediatek: mt8183: mfgcfg: Propagate rate changes to parent Date: Mon, 24 Oct 2022 13:30:50 +0200 Message-Id: <20221024113033.645906409@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576231741663775?= X-GMAIL-MSGID: =?utf-8?q?1747576231741663775?= 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: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: 10306 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp655224wru; Mon, 24 Oct 2022 14:14:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Cj5aLanOJ6IpM+LqqAzcsG0bOv42jqmd6ElnHcWndKAsXKLE3ts3tt6TAwTEq0RYaiJBB X-Received: by 2002:aa7:d8c4:0:b0:461:8d31:41fc with SMTP id k4-20020aa7d8c4000000b004618d3141fcmr11445887eds.202.1666646083691; Mon, 24 Oct 2022 14:14:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666646083; cv=none; d=google.com; s=arc-20160816; b=vAg+4bwu9UT02CEXDFCF3CBh9oC+V5sGmu5MZXuwKImxzL4ehVsFdxARJvdrrhnR5M OluG7HMg5A6sEqfLjlxefvDs4DY6iG/Osznfxo1vmMN4k4BumwQBIQWWYx/OwrPcbbmV 4vZH1xuE1aEOofaKvfEGguiYdmzutjsbf6fkv47FWTz0uEBTs+7mhtRZP/UYNotVBzag 4NuHCGjrfHBoH/ir2cNYr+0IVutjZ51WFitkJPz31hubsaImkRW6RDl+7GHsP+cImYvW j8QOrOltorjorMMm2oWgsCjR/gwvE9JND3lsb4Hqoc6fD/jqrGJ0hDZEbUuZLJn7exJv XLhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7asfMDE5/D7dKpT8/biKetb4XW91a489M0kGzgXzjQo=; b=JBaaPCwyyo9DoJVydxCl5uK1f6SZb2LDWlCN/UFKVrjMK3h7MUPahVTM9R6WLkLY01 LUJ2rnqKuCYh+5taOeq63z3br7LkldkvdPxl4R4Ad16wNVKJLlp0qBi1uBgriVv1Zg8x slCAtTumW2Snvu5cs/xIJjCbPYS+1y0i28WXJcs1v1KVjyflRyjnJ4Y8moRKPYzziHGD nMWO/qNDSzjcd4TtL1sGPwVfMtJVVoQs2W7UUACUrkDGue7mzR+zObbBBqV00PzQhTdT VBoshyOPWdSK4+8irLA4U4evOG1NMa4Ep+49FxVcNtOoSMXb3YxTuCceVx/ZcQR04B5p 8MAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KjlHSum2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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.14.15; Mon, 24 Oct 2022 14:14: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=KjlHSum2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233726AbiJXVMa (ORCPT + 99 others); Mon, 24 Oct 2022 17:12:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231419AbiJXVLj (ORCPT ); Mon, 24 Oct 2022 17:11: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 296D45C35C; Mon, 24 Oct 2022 12:18: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 8308EB81686; Mon, 24 Oct 2022 12:28:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4621C433C1; Mon, 24 Oct 2022 12:28:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614497; bh=V1yLvhX9zdad2+j+Fwim9g75fpNwO3eUX/S2g7mfUCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KjlHSum2GyWskfREIz5R6DIF8yYVPXsbz3P1Pv6yrf6mXgGzZgtAaQBdhfXaJZGya 5RGA+U4DdmqjvoFd+qvAu2jHcZ9nexua+lv8Nql5L0wIKiyYsGXQe2TB9cOXmWyZN4 lDRKB1PxnC/0YMnx2XFeJsCg0/LU5a2qc1PLznSo= 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.10 254/390] dmaengine: ioat: stop mod_timer from resurrecting deleted timer in __cleanup() Date: Mon, 24 Oct 2022 13:30:51 +0200 Message-Id: <20221024113033.694624772@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747605084052825160?= X-GMAIL-MSGID: =?utf-8?q?1747605084052825160?= From: Dave Jiang [ Upstream commit 898ec89dbb55b8294695ad71694a0684e62b2a73 ] User reports observing timer event report channel halted but no error observed in CHANERR register. The driver finished self-test and released channel resources. Debug shows that __cleanup() can call mod_timer() after the timer has been deleted and thus resurrect the timer. While harmless, it causes suprious error message to be emitted. Use mod_timer_pending() call to prevent deleted timer from being resurrected. Fixes: 3372de5813e4 ("dmaengine: ioatdma: removal of dma_v3.c and relevant ioat3 references") Signed-off-by: Dave Jiang Link: https://lore.kernel.org/r/166360672197.3851724.17040290563764838369.stgit@djiang5-desk3.ch.intel.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/ioat/dma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c index 37ff4ec7db76..e2070df6cad2 100644 --- a/drivers/dma/ioat/dma.c +++ b/drivers/dma/ioat/dma.c @@ -656,7 +656,7 @@ static void __cleanup(struct ioatdma_chan *ioat_chan, dma_addr_t phys_complete) if (active - i == 0) { dev_dbg(to_dev(ioat_chan), "%s: cancel completion timeout\n", __func__); - mod_timer(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); + mod_timer_pending(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); } /* microsecond delay by sysfs variable per pending descriptor */ @@ -682,7 +682,7 @@ static void ioat_cleanup(struct ioatdma_chan *ioat_chan) if (chanerr & (IOAT_CHANERR_HANDLE_MASK | IOAT_CHANERR_RECOVER_MASK)) { - mod_timer(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); + mod_timer_pending(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); ioat_eh(ioat_chan); } } @@ -879,7 +879,7 @@ static void check_active(struct ioatdma_chan *ioat_chan) } if (test_and_clear_bit(IOAT_CHAN_ACTIVE, &ioat_chan->state)) - mod_timer(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); + mod_timer_pending(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); } static void ioat_reboot_chan(struct ioatdma_chan *ioat_chan) From patchwork 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: 9634 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp532419wru; Mon, 24 Oct 2022 09:08:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM55750fK1RlUqTID4Qxi0cEyATaaKujTEfNj2c+9F20Prbwho3+uMvPT2Yyo0D9ps29wfEh X-Received: by 2002:a17:906:2681:b0:783:6a92:4c38 with SMTP id t1-20020a170906268100b007836a924c38mr28742640ejc.75.1666627681310; Mon, 24 Oct 2022 09:08:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627681; cv=none; d=google.com; s=arc-20160816; b=aoI/R1nEOYtWg3iNBEE3Ousm2DH8vjXMIAIWo59XTPszBhrLlrzH709fxTLAp+z2E3 qXPsTXQvuVtQBAfpqIATXZ4qa6FEcX0CVqYxv2bPJpOgAczYRNC+ie141TBk248YCbRE pakCMuquplzCLEcMyXFX/n8iracvRZxfKNuVRlyob4xzwPVPHnPzBK3f4AOQVhqDHUYv f/c8jFSpPXxO/c6oN4NeB4W9EiinaQMeam1OsEHR0WSGE/yDUnpSP+RujCKA6A7NXuQb 3LVbTb/0Jdu6Asa+YzvSAhjYuGxzscxdnJD7yBfxhZ7sg+U6P0BHX8yOjpxL4DbdfO2o yWvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=XjSvbItYF6BsU42kvaimRibmdZunFMWeQ1eNS4pJA2P6tzdvqEywTnBaTJ/qzyTUso zYbsEckN9MwAqsQphhnvzFSHtRDZe9OPrO+4B+pHzlOBj783icobagBBcNeL+1xE/gAd 56kJWBG9hFEbaSYMY+V/Xquan3YCGAiE0RlZAuwrOyulCPdNi36ykKWFvsZm2ODF0CuK fL1AF5QhrhBtE40r2VNNhr53YsvXVxREtR7ESzCcAcQT4QIV8NXI1+ceEX3M7tJtUUL2 /yCf9xBSDmg+ACKXUakgdiT87u38kOSkyn4lwMAGTRVFpxVucnGyzKBwvBzEYH2SawyW KVGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VWxjh2Te; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a1709065a8f00b0078e1e77f443si104689ejq.418.2022.10.24.09.07.36; Mon, 24 Oct 2022 09:08: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=VWxjh2Te; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232543AbiJXQG5 (ORCPT + 99 others); Mon, 24 Oct 2022 12:06:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233016AbiJXQEJ (ORCPT ); Mon, 24 Oct 2022 12:04: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 8D5081E576D; Mon, 24 Oct 2022 07:56: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 1BB53B81698; Mon, 24 Oct 2022 12:28:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76DFEC433C1; Mon, 24 Oct 2022 12:28:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614499; bh=xYGfpluMhE2yfUa76Sd/ZU7uGJoQMeIwNU8LXhnTMoo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VWxjh2TewuCXloznqcToK9PyR4eoJvl820FTyuSmsC9sXtgy64R7Gcg90RLbs9Svk lGSNNBCNufJAp5F+RvBxb+Qhu5PxXTrqjjDETCibqsF5sx25r0T0veblX8RYf4s94f ogo21BNsy3LmPjM1z43pxWd2mFV4zBqBjmK4XBqM= 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.10 255/390] spmi: pmic-arb: correct duplicate APID to PPID mapping logic Date: Mon, 24 Oct 2022 13:30:52 +0200 Message-Id: <20221024113033.744131759@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585787613990324?= X-GMAIL-MSGID: =?utf-8?q?1747585787613990324?= 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: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: 9157 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457766wru; Mon, 24 Oct 2022 06:36:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM75jJNyHkUTVsU2ICFBI/n6RtpfsEDSumkMRQVLQFlME2C/+t1ba50g+nEYv5TWz0R6Tl6Z X-Received: by 2002:a17:907:9729:b0:78d:9fb4:16e0 with SMTP id jg41-20020a170907972900b0078d9fb416e0mr26935444ejc.455.1666618589636; 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=t0iuzgt5ftMbzeu/iZVx8PlVzSwqZiSKJX9ZQKNZxlw0uMdlTFp+lWXUwtvMO6nkmY R21jtC/PF+6IklH3AkMhH8upoJTgqw+CX7woCsB0Iz6I9561ZMQ0QmG+Ey4/ciLNQknp 6fiBiDQQGn7o+Hu9a6cioMLgimlO5EYZIT3KKJbFz7cPuCx8735loiTUqty9D8bHDRlu 7MN3RNUdI3YuRumx4m05J44xzF1Ni4TpC7AWUVcTbc9WI6EryhsaRY1e/qSBT04IMur2 Yh6RLM9w3yguZwzP7qNLbXRWDngN6QwWnbPU5IVxxaD3Cdg8/iVSsGQV4G0LLpE9+H5y jXCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4Qr50vsOl5m6nNt4AtL3ETBoQWI3izYNgGfI9y2D6ag=; b=tAgTDbQ6kBIRpeaSThKnAN7Q75ecdXw2oMCTf0GUwI7E2oRNaC7/m/d9vP2BQeLspI 9050s3fDJD7ZOR1J7I99Y/4qZNqIgU9DuFEd9i5bDPdZ0vGNTG4Wyu/T3YZqukl9qIpr jfcKqSkyyt04RQIwHtl2BUFlonhP0uGh/Y7catBvSxUTyUzY8SaKj0pR2qqcagKr99TL qqS7k0TsKrV4k4kwNFnOe+fJs6yPc8sQaqFMsGMREvPCoVbgaQcRoQDWk/oJx5+jr4o1 6DE5RSCX7zRACpYbz6+YY46ZWcnsWoPZMxicAnwhhUzzIV+FgrfKF2CWHG7BOdysgUJH 6BCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=O3ZiNkjI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bb12-20020a1709070a0c00b00791a6455597si16927864ejc.955.2022.10.24.06.35.28; 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=O3ZiNkjI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231496AbiJXN0O (ORCPT + 99 others); Mon, 24 Oct 2022 09:26:14 -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 S229943AbiJXNXd (ORCPT ); Mon, 24 Oct 2022 09:23:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 301CA48A15; Mon, 24 Oct 2022 05:30: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 F2BA46130D; Mon, 24 Oct 2022 12:28:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CDB0C433D6; Mon, 24 Oct 2022 12:28:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614502; bh=TLmvnCPtLOgPxWcVAByO0Hko9TcXO+3EfUVjcv844dA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O3ZiNkjISBBPt0w3ZhK38EmloNykAyDdQgh+7OdsXSRX8f5uI0j9ri8FY4v0GBWYs em0Za6FUTDokHFJb+Mqf7p5CPuerIX3xjd8BR6G4ABs7nti0ULbdp1I22fwEwiEJjq 5eRuktUuPIGutVCV6fEErJbWVHcGl9AfZvlJR0ho= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Luca Ceresoli , Stephen Boyd , Sasha Levin Subject: [PATCH 5.10 256/390] clk: vc5: Fix 5P49V6901 outputs disabling when enabling FOD Date: Mon, 24 Oct 2022 13:30:53 +0200 Message-Id: <20221024113033.784470315@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576254042441017?= X-GMAIL-MSGID: =?utf-8?q?1747576254042441017?= From: Serge Semin [ Upstream commit c388cc804016cf0f65afdc2362b120aa594ff3e6 ] We have discovered random glitches during the system boot up procedure. The problem investigation led us to the weird outcomes: when none of the Renesas 5P49V6901 ports are explicitly enabled by the kernel driver, the glitches disappeared. It was a mystery since the SoC external clock domains were fed with different 5P49V6901 outputs. The driver code didn't seem like bogus either. We almost despaired to find out a root cause when the solution has been found for a more modern revision of the chip. It turned out the 5P49V6901 clock generator stopped its output for a short period of time during the VC5_OUT_DIV_CONTROL register writing. The same problem was found for the 5P49V6965 revision of the chip and was successfully fixed in commit fc336ae622df ("clk: vc5: fix output disabling when enabling a FOD") by enabling the "bypass_sync" flag hidden inside "Unused Factory Reserved Register". Even though the 5P49V6901 registers description and programming guide doesn't provide any intel regarding that flag, setting it up anyway in the officially unused register completely eliminated the denoted glitches. Thus let's activate the functionality submitted in commit fc336ae622df ("clk: vc5: fix output disabling when enabling a FOD") for the Renesas 5P49V6901 chip too in order to remove the ports implicit inter-dependency. Fixes: dbf6b16f5683 ("clk: vc5: Add support for IDT VersaClock 5P49V6901") Signed-off-by: Serge Semin Reviewed-by: Luca Ceresoli Link: https://lore.kernel.org/r/20220929225402.9696-2-Sergey.Semin@baikalelectronics.ru Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/clk-versaclock5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/clk-versaclock5.c b/drivers/clk/clk-versaclock5.c index 4e741f94baf0..eb597ea7bb87 100644 --- a/drivers/clk/clk-versaclock5.c +++ b/drivers/clk/clk-versaclock5.c @@ -1116,7 +1116,7 @@ static const struct vc5_chip_info idt_5p49v6901_info = { .model = IDT_VC6_5P49V6901, .clk_fod_cnt = 4, .clk_out_cnt = 5, - .flags = VC5_HAS_PFD_FREQ_DBL, + .flags = VC5_HAS_PFD_FREQ_DBL | VC5_HAS_BYPASS_SYNC_BIT, }; static const struct vc5_chip_info idt_5p49v6965_info = { From patchwork 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: 9217 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp459316wru; Mon, 24 Oct 2022 06:39:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5oxpzPdnucqk+IKsjA4V3QKJDk3eWJbkGXnpGZlxRLQCO+rfrObLwti/R9rRqRwYLmKLFC X-Received: by 2002:a05:6402:50cd:b0:45d:74d:93a2 with SMTP id h13-20020a05640250cd00b0045d074d93a2mr30595931edb.156.1666618759133; 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=c++h9w5I0rPRh6wU0Y13+4UmfxOoc8WlR1qXBxnHZVp+CKZlxXBQ61EMgLTmHfCjmH trP8UEuh3QwJywuIHykI/WA2fLki6/qeqQRQv3iYOEAA8jcS5tUqWyQ7XTh5PS02Yy4e FT9NKSQSzSE8sb/gzYE5vXANTp+bTYDcUI6K//iGkwTtjk4QgVo4sYqiEatnmcV7R56q UDN42TnNPAgD8HxmXNOj88SkIf0rc/SQJGpz2nI/vSG8U5/QXW6CWFOZ+RLHPoyPlicy Wu0Sn+F1D09cWyqBKfIR66tfn+AMOE28Zy7lUVY+RF84mtyt/MhtwG7dtdPk1k5sGuwM ZoZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=g1BD2pRscx3BLuLNatvPMtlqb/wTaXyZbIfEzXs7GjY=; b=NtrzM6AnSlwEHVUF4B9MR1scq5/lQYpAzFFLeMMPJXDT11pwDa+GMNa62o1hKRITt4 nMCAD6axrYdU7Dmtl/1c00lARMXRrae6EVoVnnMFqaJF8mBwhrG6ruNmPKlocgo53gh3 Wokx28ojtdxya4e+F4zD9ZbRft0JvtSAF7BvhhFXdz2h01MC3SCdXfqN43vaDA7sZw1d KJ8aS5+5Q/4Pvpav0ZLmlgYYmUHoczD1kTScqr9AlJjNdz0+JKNLlP+lQ5TDvXOnTVGa gnUk2O2Bt/2PzwyGEycHlexKFMT7bUmuSyfvchTCnuN08Hfx98QBRturEOkRWbZDgfgU MPzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PglcMG0e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fj2-20020a1709069c8200b0076f0940cb28si7385393ejc.175.2022.10.24.06.38.53; 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=PglcMG0e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231539AbiJXNdE (ORCPT + 99 others); Mon, 24 Oct 2022 09:33:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236027AbiJXN3Z (ORCPT ); Mon, 24 Oct 2022 09:29:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 082F4A46E; Mon, 24 Oct 2022 05:32: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 9403B61311; Mon, 24 Oct 2022 12:28:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3FE4C433D6; Mon, 24 Oct 2022 12:28:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614505; bh=hDIWTXnFPYaCL2NW+LTf3CWQC5jgrfHnhKhZtQhXzUs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PglcMG0eDalz41gy9UovxkjYMW2kqdzwDxQf0pI8fjfsfWQjQPXfrR2RYjukZWNJf Dv0VRSfVVDJJuSIago3V+xHUmKROjembmL3UD3QJrJs2SjgbIGwN/TZgN0RgW+qh9g AqbEs1YIUtIFT5Ml9Q9zipAjviNwYGtw5JDQzA/o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Stephen Boyd , Sasha Levin Subject: [PATCH 5.10 257/390] clk: baikal-t1: Fix invalid xGMAC PTP clock divider Date: Mon, 24 Oct 2022 13:30:54 +0200 Message-Id: <20221024113033.829094938@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576431623415079?= X-GMAIL-MSGID: =?utf-8?q?1747576431623415079?= From: Serge Semin [ Upstream commit 3c742088686ce922704aec5b11d09bcc5a396589 ] Most likely due to copy-paste mistake the divider has been set to 10 while according to the SoC reference manual it's supposed to be 8 thus having PTP clock frequency of 156.25 MHz. Fixes: 353afa3a8d2e ("clk: Add Baikal-T1 CCU Dividers driver") Signed-off-by: Serge Semin Link: https://lore.kernel.org/r/20220929225402.9696-3-Sergey.Semin@baikalelectronics.ru Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/baikal-t1/clk-ccu-div.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/baikal-t1/clk-ccu-div.c b/drivers/clk/baikal-t1/clk-ccu-div.c index f141fda12b09..ea77eec40ddd 100644 --- a/drivers/clk/baikal-t1/clk-ccu-div.c +++ b/drivers/clk/baikal-t1/clk-ccu-div.c @@ -207,7 +207,7 @@ static const struct ccu_div_info sys_info[] = { CCU_DIV_GATE_INFO(CCU_SYS_XGMAC_REF_CLK, "sys_xgmac_ref_clk", "eth_clk", CCU_SYS_XGMAC_BASE, 8), CCU_DIV_FIXED_INFO(CCU_SYS_XGMAC_PTP_CLK, "sys_xgmac_ptp_clk", - "eth_clk", 10), + "eth_clk", 8), CCU_DIV_GATE_INFO(CCU_SYS_USB_CLK, "sys_usb_clk", "eth_clk", CCU_SYS_USB_BASE, 10), CCU_DIV_VAR_INFO(CCU_SYS_PVT_CLK, "sys_pvt_clk", From patchwork 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: 9509 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp481832wru; Mon, 24 Oct 2022 07:23:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7e+/0HDg0cPunxwu60KyGg2wt12wNLQG9+Rl5f+Wy1BMuBb2ywQ3NU0+PElYWsUvNUeiUR X-Received: by 2002:a17:907:7e87:b0:791:a477:1109 with SMTP id qb7-20020a1709077e8700b00791a4771109mr25118071ejc.354.1666621430295; Mon, 24 Oct 2022 07:23:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621430; cv=none; d=google.com; s=arc-20160816; b=mhBI/xPzTbMej234mFRcGBmqd62Rvg4D5F5g/lgaAE74L77viOfTGJlTdlV0DAEEhw r9IszU7UzuJDZCV2XoxS/PKchR+3gfFByVdu3TkAe1FYRmCVlpNb7GLmuen+2AXgOtER MdGrR4ULgBw5p9YeMp07nQ3yXlZWeij+cX9OW+5tnwEYzLzNNxObQQAUEajPz8ThWa7c 22AWq/sih8zr40TGUX8Wc5inWYjeuKkZpi3aMb8noZwQs+eFM6leoh5t+6Qe0qsuUW1w Z1oWXsdva0sEkptl9hNbJ9hJJbqjxt6Kfd5OkKv7kI5ugZI32HfmeyDInM6XorApQnEF Z2qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4g0cVlHUXjv0gLOXBoPWodJKCKk8oHQXO+u+JUneURA=; b=h69Db44z5U2ICMT+D1zWXSrtFyS2FWVVU246Osy9pd8snYZ+Pr6AKVMks+/Lhcpz1I kOlg+lxejPdq9elNeKPJoDwWm8sq83k+gb1GEiWVM7ydVaVYJqpWaOcfbyB0N49iiwN2 HcHcObEKxcLVM1G75rrK8XhVKAkFz1L/OJ5/t2HSWg3LqtzbfPPwGqWQI7z2oGtbk30D FWymWv8GrGn8Rsm8Zlvy450lm3Vf/GabwA6pGW74owsjWBxgsAVZHl5CzCDSb69heMvN /8XqrUUsuYMwmRiJaR4b3xzlkgkvtKkSKdlUIxYVxiC0deuBvzef2mEJzkqFf6bbaPg4 Rm0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ydzGtqcA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d20-20020aa7ce14000000b0045d0c00ead2si4186373edv.157.2022.10.24.07.23.24; Mon, 24 Oct 2022 07:23: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=ydzGtqcA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234932AbiJXOUN (ORCPT + 99 others); Mon, 24 Oct 2022 10:20:13 -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 S235693AbiJXOO6 (ORCPT ); Mon, 24 Oct 2022 10:14: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 D3CDC2528E; Mon, 24 Oct 2022 05:54: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 DF3E4B81699; Mon, 24 Oct 2022 12:28:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39E28C433D6; Mon, 24 Oct 2022 12:28:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614507; bh=8OgA0C8IHIsrI+48hYao+3vnUM+6hvyUvzEmf2Rdq/4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ydzGtqcAib9wGnk2uBmrorii/b19OvfFvzwNis5V78Fv8X6pcblMuGbrzf60styaI pCYQXIhEWh3rT5n5+C0PLNB2zayJygiPwX/UF+2yb1jPzwHcnuP6WHIFtduA9FayG2 leT2EiIFv1ireF1WP87R0nmuU/Mv1s9EAw2VeOOM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Stephen Boyd , Sasha Levin Subject: [PATCH 5.10 258/390] clk: baikal-t1: Add shared xGMAC ref/ptp clocks internal parent Date: Mon, 24 Oct 2022 13:30:55 +0200 Message-Id: <20221024113033.875865376@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747579233099607040?= X-GMAIL-MSGID: =?utf-8?q?1747579233099607040?= From: Serge Semin [ Upstream commit e2eef312762e0b5a5a70d29fe59a245c0a3cffa0 ] Baikal-T1 CCU reference manual says that both xGMAC reference and xGMAC PTP clocks are generated by two different wrappers with the same constant divider thus each producing a 156.25 MHz signal. But for some reason both of these clock sources are gated by a single switch-flag in the CCU registers space - CCU_SYS_XGMAC_BASE.BIT(0). In order to make the clocks handled independently we need to define a shared parental gate so the base clock signal would be switched off only if both of the child-clocks are disabled. Note the ID is intentionally set to -2 since we are going to add a one more internal clock identifier in the next commit. Fixes: 353afa3a8d2e ("clk: Add Baikal-T1 CCU Dividers driver") Signed-off-by: Serge Semin Link: https://lore.kernel.org/r/20220929225402.9696-4-Sergey.Semin@baikalelectronics.ru Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/baikal-t1/ccu-div.c | 1 + drivers/clk/baikal-t1/ccu-div.h | 6 ++++++ drivers/clk/baikal-t1/clk-ccu-div.c | 8 +++++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/clk/baikal-t1/ccu-div.c b/drivers/clk/baikal-t1/ccu-div.c index 4062092d67f9..bbfa3526ee10 100644 --- a/drivers/clk/baikal-t1/ccu-div.c +++ b/drivers/clk/baikal-t1/ccu-div.c @@ -579,6 +579,7 @@ struct ccu_div *ccu_div_hw_register(const struct ccu_div_init_data *div_init) goto err_free_div; } parent_data.fw_name = div_init->parent_name; + parent_data.name = div_init->parent_name; hw_init.parent_data = &parent_data; hw_init.num_parents = 1; diff --git a/drivers/clk/baikal-t1/ccu-div.h b/drivers/clk/baikal-t1/ccu-div.h index 795665caefbd..b6a9c8e45318 100644 --- a/drivers/clk/baikal-t1/ccu-div.h +++ b/drivers/clk/baikal-t1/ccu-div.h @@ -13,6 +13,12 @@ #include #include +/* + * CCU Divider private clock IDs + * @CCU_SYS_XGMAC_CLK: CCU XGMAC internal clock + */ +#define CCU_SYS_XGMAC_CLK -2 + /* * CCU Divider private flags * @CCU_DIV_SKIP_ONE: Due to some reason divider can't be set to 1. diff --git a/drivers/clk/baikal-t1/clk-ccu-div.c b/drivers/clk/baikal-t1/clk-ccu-div.c index ea77eec40ddd..3953ae5664be 100644 --- a/drivers/clk/baikal-t1/clk-ccu-div.c +++ b/drivers/clk/baikal-t1/clk-ccu-div.c @@ -204,10 +204,12 @@ static const struct ccu_div_info sys_info[] = { "eth_clk", CCU_SYS_GMAC1_BASE, 5), CCU_DIV_FIXED_INFO(CCU_SYS_GMAC1_PTP_CLK, "sys_gmac1_ptp_clk", "eth_clk", 10), - CCU_DIV_GATE_INFO(CCU_SYS_XGMAC_REF_CLK, "sys_xgmac_ref_clk", - "eth_clk", CCU_SYS_XGMAC_BASE, 8), + CCU_DIV_GATE_INFO(CCU_SYS_XGMAC_CLK, "sys_xgmac_clk", + "eth_clk", CCU_SYS_XGMAC_BASE, 1), + CCU_DIV_FIXED_INFO(CCU_SYS_XGMAC_REF_CLK, "sys_xgmac_ref_clk", + "sys_xgmac_clk", 8), CCU_DIV_FIXED_INFO(CCU_SYS_XGMAC_PTP_CLK, "sys_xgmac_ptp_clk", - "eth_clk", 8), + "sys_xgmac_clk", 8), CCU_DIV_GATE_INFO(CCU_SYS_USB_CLK, "sys_usb_clk", "eth_clk", CCU_SYS_USB_BASE, 10), CCU_DIV_VAR_INFO(CCU_SYS_PVT_CLK, "sys_pvt_clk", From patchwork 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: 9143 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457510wru; Mon, 24 Oct 2022 06:36:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7WQuy78P9yBQ7lSCzqNaB4GhPby8iWVvkwssY6+UKASJONVTvU/bdBlbgkjqXkbzWui4xq X-Received: by 2002:a17:906:9b90:b0:78d:9704:752 with SMTP id dd16-20020a1709069b9000b0078d97040752mr26559153ejc.695.1666618567977; 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=xzGOlTE7aYzgHQ5U4M4YL3EN5TF94YGWdY/+/R7TVl0JpK6FU9Y/npoKow8+UDCYbT zO8o64gVVARIlg6WgSNDZfCv89bxbWQLHq51b4N5gMOCRHYS6WNWN/FZSZN+0qLMBofB Vc83wQ2eBUbf8my/YxssrDsjuLhT8aKAg844i5VTbrwtoFe1w4zDrqB2KtAAFou1aThv GqBLjqtOhpo/gM1zyO6MzGghBVsKYf85vKxSC8LphQxF2s61cegHGa563Abg+I8vKkrB iWnwb2HnOSyybGTRSTnzkhiVgaGhBkCP7KxJ5qY8e9dP+1okuqQxOPZBvXps52CHbd7M xZIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9tOCKbE/rQj/V7qeN54HTO3Ih/H1SCm6TeyHUFcw4U8=; b=ZUU7r9xSBZCyCI3G+BkIOltjt1sknHjCIE7vEbrlCwoeKUubghGBdM5TpAJLtgzm3m TyH9SAJqrJ/dZiMODfdCeP9ZqRUbraMCdmLnVRQfeXtDuwod1olCgqNTnKoUN4vmvKTP acBuZzlCWfBxuf782vhbBX9ui1Uw8ywv5YqIstyLAyMAL3oT3OhZ6ruQsl0QhHL5ygvw bcF6nN8iIXyAUcX94cWdwxkytjmWMJaG/S2gHLr+MLYQUOaX9M6HLfGGZd4U2syYqUo1 R7YB8mE5swZY2qU8K7YLGOx+J8t/KgdiDqU90EOo98DxYRBMdJZ1MqmZi2ERBl8cM3hW YvFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LqIdPRBr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056402399700b004608b4f28b7si11941859edb.106.2022.10.24.06.35.28; 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=LqIdPRBr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232242AbiJXNZ6 (ORCPT + 99 others); Mon, 24 Oct 2022 09:25:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232315AbiJXNXI (ORCPT ); Mon, 24 Oct 2022 09:23: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 17974237E3; Mon, 24 Oct 2022 05:30: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 C2F4D6131B; Mon, 24 Oct 2022 12:28:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D55D3C433D7; Mon, 24 Oct 2022 12:28:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614510; bh=whpjSLgFOwluMyDP5s1KRTKjvJu5FSA0Wxy6pCWsZP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LqIdPRBrSl5GDC9lRNLxFOGzXMPRtiqNfp0EFb0Jhp0I9dsBHBqk1dwG6ZS+Cm8zT Fv2FzRqrsaun9vC8CS/yOke+F96tLCrWvZMUUcL19ZhLQ7gJRm8LMMEs0DieNCiyiE kQ68wfIqVU05QAr8JEja6xFgClCsqN3Dru5gXmGs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Stephen Boyd , Sasha Levin Subject: [PATCH 5.10 259/390] clk: baikal-t1: Add SATA internal ref clock buffer Date: Mon, 24 Oct 2022 13:30:56 +0200 Message-Id: <20221024113033.914324916@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576231734848718?= X-GMAIL-MSGID: =?utf-8?q?1747576231734848718?= From: Serge Semin [ Upstream commit 081a9b7c74eae4e12b2cb1b86720f836a8f29247 ] It turns out the internal SATA reference clock signal will stay unavailable for the SATA interface consumer until the buffer on it's way is ungated. So aside with having the actual clock divider enabled we need to ungate a buffer placed on the signal way to the SATA controller (most likely some rudiment from the initial SoC release). Seeing the switch flag is placed in the same register as the SATA-ref clock divider at a non-standard ffset, let's implement it as a separate clock controller with the set-rate propagation to the parental clock divider wrapper. As such we'll be able to disable/enable and still change the original clock source rate. Fixes: 353afa3a8d2e ("clk: Add Baikal-T1 CCU Dividers driver") Signed-off-by: Serge Semin Link: https://lore.kernel.org/r/20220929225402.9696-5-Sergey.Semin@baikalelectronics.ru Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/baikal-t1/ccu-div.c | 64 +++++++++++++++++++++++++++++ drivers/clk/baikal-t1/ccu-div.h | 4 ++ drivers/clk/baikal-t1/clk-ccu-div.c | 18 +++++++- 3 files changed, 85 insertions(+), 1 deletion(-) diff --git a/drivers/clk/baikal-t1/ccu-div.c b/drivers/clk/baikal-t1/ccu-div.c index bbfa3526ee10..a6642f3d33d4 100644 --- a/drivers/clk/baikal-t1/ccu-div.c +++ b/drivers/clk/baikal-t1/ccu-div.c @@ -34,6 +34,7 @@ #define CCU_DIV_CTL_CLKDIV_MASK(_width) \ GENMASK((_width) + CCU_DIV_CTL_CLKDIV_FLD - 1, CCU_DIV_CTL_CLKDIV_FLD) #define CCU_DIV_CTL_LOCK_SHIFTED BIT(27) +#define CCU_DIV_CTL_GATE_REF_BUF BIT(28) #define CCU_DIV_CTL_LOCK_NORMAL BIT(31) #define CCU_DIV_RST_DELAY_US 1 @@ -170,6 +171,40 @@ static int ccu_div_gate_is_enabled(struct clk_hw *hw) return !!(val & CCU_DIV_CTL_EN); } +static int ccu_div_buf_enable(struct clk_hw *hw) +{ + struct ccu_div *div = to_ccu_div(hw); + unsigned long flags; + + spin_lock_irqsave(&div->lock, flags); + regmap_update_bits(div->sys_regs, div->reg_ctl, + CCU_DIV_CTL_GATE_REF_BUF, 0); + spin_unlock_irqrestore(&div->lock, flags); + + return 0; +} + +static void ccu_div_buf_disable(struct clk_hw *hw) +{ + struct ccu_div *div = to_ccu_div(hw); + unsigned long flags; + + spin_lock_irqsave(&div->lock, flags); + regmap_update_bits(div->sys_regs, div->reg_ctl, + CCU_DIV_CTL_GATE_REF_BUF, CCU_DIV_CTL_GATE_REF_BUF); + spin_unlock_irqrestore(&div->lock, flags); +} + +static int ccu_div_buf_is_enabled(struct clk_hw *hw) +{ + struct ccu_div *div = to_ccu_div(hw); + u32 val = 0; + + regmap_read(div->sys_regs, div->reg_ctl, &val); + + return !(val & CCU_DIV_CTL_GATE_REF_BUF); +} + static unsigned long ccu_div_var_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) { @@ -323,6 +358,7 @@ static const struct ccu_div_dbgfs_bit ccu_div_bits[] = { CCU_DIV_DBGFS_BIT_ATTR("div_en", CCU_DIV_CTL_EN), CCU_DIV_DBGFS_BIT_ATTR("div_rst", CCU_DIV_CTL_RST), CCU_DIV_DBGFS_BIT_ATTR("div_bypass", CCU_DIV_CTL_SET_CLKDIV), + CCU_DIV_DBGFS_BIT_ATTR("div_buf", CCU_DIV_CTL_GATE_REF_BUF), CCU_DIV_DBGFS_BIT_ATTR("div_lock", CCU_DIV_CTL_LOCK_NORMAL) }; @@ -441,6 +477,9 @@ static void ccu_div_var_debug_init(struct clk_hw *hw, struct dentry *dentry) continue; } + if (!strcmp("div_buf", name)) + continue; + bits[didx] = ccu_div_bits[bidx]; bits[didx].div = div; @@ -477,6 +516,21 @@ static void ccu_div_gate_debug_init(struct clk_hw *hw, struct dentry *dentry) &ccu_div_dbgfs_fixed_clkdiv_fops); } +static void ccu_div_buf_debug_init(struct clk_hw *hw, struct dentry *dentry) +{ + struct ccu_div *div = to_ccu_div(hw); + struct ccu_div_dbgfs_bit *bit; + + bit = kmalloc(sizeof(*bit), GFP_KERNEL); + if (!bit) + return; + + *bit = ccu_div_bits[3]; + bit->div = div; + debugfs_create_file_unsafe(bit->name, ccu_div_dbgfs_mode, dentry, bit, + &ccu_div_dbgfs_bit_fops); +} + static void ccu_div_fixed_debug_init(struct clk_hw *hw, struct dentry *dentry) { struct ccu_div *div = to_ccu_div(hw); @@ -489,6 +543,7 @@ static void ccu_div_fixed_debug_init(struct clk_hw *hw, struct dentry *dentry) #define ccu_div_var_debug_init NULL #define ccu_div_gate_debug_init NULL +#define ccu_div_buf_debug_init NULL #define ccu_div_fixed_debug_init NULL #endif /* !CONFIG_DEBUG_FS */ @@ -520,6 +575,13 @@ static const struct clk_ops ccu_div_gate_ops = { .debug_init = ccu_div_gate_debug_init }; +static const struct clk_ops ccu_div_buf_ops = { + .enable = ccu_div_buf_enable, + .disable = ccu_div_buf_disable, + .is_enabled = ccu_div_buf_is_enabled, + .debug_init = ccu_div_buf_debug_init +}; + static const struct clk_ops ccu_div_fixed_ops = { .recalc_rate = ccu_div_fixed_recalc_rate, .round_rate = ccu_div_fixed_round_rate, @@ -566,6 +628,8 @@ struct ccu_div *ccu_div_hw_register(const struct ccu_div_init_data *div_init) } else if (div_init->type == CCU_DIV_GATE) { hw_init.ops = &ccu_div_gate_ops; div->divider = div_init->divider; + } else if (div_init->type == CCU_DIV_BUF) { + hw_init.ops = &ccu_div_buf_ops; } else if (div_init->type == CCU_DIV_FIXED) { hw_init.ops = &ccu_div_fixed_ops; div->divider = div_init->divider; diff --git a/drivers/clk/baikal-t1/ccu-div.h b/drivers/clk/baikal-t1/ccu-div.h index b6a9c8e45318..4eb49ff4803c 100644 --- a/drivers/clk/baikal-t1/ccu-div.h +++ b/drivers/clk/baikal-t1/ccu-div.h @@ -15,8 +15,10 @@ /* * CCU Divider private clock IDs + * @CCU_SYS_SATA_CLK: CCU SATA internal clock * @CCU_SYS_XGMAC_CLK: CCU XGMAC internal clock */ +#define CCU_SYS_SATA_CLK -1 #define CCU_SYS_XGMAC_CLK -2 /* @@ -37,11 +39,13 @@ * enum ccu_div_type - CCU Divider types * @CCU_DIV_VAR: Clocks gate with variable divider. * @CCU_DIV_GATE: Clocks gate with fixed divider. + * @CCU_DIV_BUF: Clock gate with no divider. * @CCU_DIV_FIXED: Ungateable clock with fixed divider. */ enum ccu_div_type { CCU_DIV_VAR, CCU_DIV_GATE, + CCU_DIV_BUF, CCU_DIV_FIXED }; diff --git a/drivers/clk/baikal-t1/clk-ccu-div.c b/drivers/clk/baikal-t1/clk-ccu-div.c index 3953ae5664be..90f4fda406ee 100644 --- a/drivers/clk/baikal-t1/clk-ccu-div.c +++ b/drivers/clk/baikal-t1/clk-ccu-div.c @@ -76,6 +76,16 @@ .divider = _divider \ } +#define CCU_DIV_BUF_INFO(_id, _name, _pname, _base, _flags) \ + { \ + .id = _id, \ + .name = _name, \ + .parent_name = _pname, \ + .base = _base, \ + .type = CCU_DIV_BUF, \ + .flags = _flags \ + } + #define CCU_DIV_FIXED_INFO(_id, _name, _pname, _divider) \ { \ .id = _id, \ @@ -188,11 +198,14 @@ static const struct ccu_div_rst_map axi_rst_map[] = { * for the SoC devices registers IO-operations. */ static const struct ccu_div_info sys_info[] = { - CCU_DIV_VAR_INFO(CCU_SYS_SATA_REF_CLK, "sys_sata_ref_clk", + CCU_DIV_VAR_INFO(CCU_SYS_SATA_CLK, "sys_sata_clk", "sata_clk", CCU_SYS_SATA_REF_BASE, 4, CLK_SET_RATE_GATE, CCU_DIV_SKIP_ONE | CCU_DIV_LOCK_SHIFTED | CCU_DIV_RESET_DOMAIN), + CCU_DIV_BUF_INFO(CCU_SYS_SATA_REF_CLK, "sys_sata_ref_clk", + "sys_sata_clk", CCU_SYS_SATA_REF_BASE, + CLK_SET_RATE_PARENT), CCU_DIV_VAR_INFO(CCU_SYS_APB_CLK, "sys_apb_clk", "pcie_clk", CCU_SYS_APB_BASE, 5, CLK_IS_CRITICAL, CCU_DIV_RESET_DOMAIN), @@ -398,6 +411,9 @@ static int ccu_div_clk_register(struct ccu_div_data *data) init.base = info->base; init.sys_regs = data->sys_regs; init.divider = info->divider; + } else if (init.type == CCU_DIV_BUF) { + init.base = info->base; + init.sys_regs = data->sys_regs; } else { init.divider = info->divider; } From patchwork 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: 10309 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp656211wru; Mon, 24 Oct 2022 14:17:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Ur2YHNGHCkbkMSj2aeuVad3MurU6c0OrM3c3NUv45zYAzeVw2hV4naFYkuq2YBV7PjGHr X-Received: by 2002:a63:ed0a:0:b0:442:2514:95f5 with SMTP id d10-20020a63ed0a000000b00442251495f5mr30051720pgi.402.1666646251407; Mon, 24 Oct 2022 14:17:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666646251; cv=none; d=google.com; s=arc-20160816; b=Cg4gnkYj+BAoEloQtvwWFgYE4BJfp5On3ElSkmDNtddEM0/4Q6rhmNpIh3ldQ0NzQL XLTZE57HuAZlL9IKM9QZWUACR+2E0I85Xh9LiyLighgIPJkIZTI7Zui6V2eZVod1uSUk W/mIYgz+y+7RMCOOKUQq7J7Bky+ewDZrr78GOrz/XDxO1NQC3EZI26jPOf1OcDSa46Ce kvSzANcl3Od4pfkSaIraOuNPyC441T9Ra2qZzsRu/Kx2VpvxLntV1y+vNxI/ST5PQHlK 4SnWyHWKdgvza8W8jOn11xY2Hn6SBXCHHDMK8pqylNBj+9D5lDf/15DI44YV4umchJEU o2fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nVOJezOpSe/rim8gcehdQAd1aRSrvLptMrO8BaeGL4o=; b=oeXOzkSWpQuj1W/EAS6Junn/5dzJ6JLhBIMIuYctrlMb0wRjeVG73xnhG4YhWn58j4 Az6pj4SuuwI56TaBGUoXqjpE/Yb27PixloSj/sUkfwh0vEPQYd6flII9rxxKBkP2pQi9 VTHXSFMtoB44uHmIwKF9T6Diqt5yNohQZnOx+4SDJzw3JS5aHupYSsnZfsGjne8ZS6Fr JLcf6U3WaXrsE4+oYevN20dGmLw4kyeWft+LV/ObOgQJ7gmKvM8PoiJSXLjnNtswEoU+ jED+km1T0KUkOBuPnxQ7XDscSMAZpvUcVblGXQWn0xh9oSuBJ5ZxDhSm8o4SIh98BwjU uhVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RdmTZCgr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c7-20020a17090a558700b002009ed52bf6si1052436pji.19.2022.10.24.14.17.18; Mon, 24 Oct 2022 14:17: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=RdmTZCgr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233300AbiJXVRD (ORCPT + 99 others); Mon, 24 Oct 2022 17:17:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232995AbiJXVQc (ORCPT ); Mon, 24 Oct 2022 17:16: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 290C92D129C; Mon, 24 Oct 2022 12:22:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8431CB8168D; Mon, 24 Oct 2022 12:27:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E177AC4314C; Mon, 24 Oct 2022 12:27:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614434; bh=4+j9hpRKHD7cYXNKV6oPGY/n1f0gxGjkSS6/MMzh7YQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RdmTZCgrOR8N8dSuoL2WOxQywhmGQDleLdosuaDcu3rQIv3XnOPAQ65Ht1bUCBtNP 2cMG+DDkSj7mehh1fwW+C3DMduNuPw5HGK7kiETLnWMMAZH4MqCShopSRY1+YFkAsJ MQnvkIoo6/5LsfA5o1sLZO7U2WNlR7d191oVS9t0= 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.10 260/390] clk: bcm2835: fix bcm2835_clock_rate_from_divisor declaration Date: Mon, 24 Oct 2022 13:30:57 +0200 Message-Id: <20221024113033.953158253@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747605259650295678?= X-GMAIL-MSGID: =?utf-8?q?1747605259650295678?= 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 178886823b90..f306b959297d 100644 --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c @@ -968,9 +968,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: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: 9665 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp534726wru; Mon, 24 Oct 2022 09:11:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM79l1UE6Dnpdma4yrmnGi4avpbKvn12fS0Hbw0v/38yS74fvPD4Fa39uoHNQy3iYoy7hHP2 X-Received: by 2002:a63:d845:0:b0:44b:d074:97d with SMTP id k5-20020a63d845000000b0044bd074097dmr29315666pgj.32.1666627899375; Mon, 24 Oct 2022 09:11:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627899; cv=none; d=google.com; s=arc-20160816; b=09/4sOSGUxhA9DvHi1lxGb3x3ZCpc113dujF5uSKu+iJokQLfVcPP+Zl69KLL8ht5L Kyz1wP42U/yyyANhmPKPlJ/tbRh+BE7cY6nhThnfUB76vBBYp0YMjVoEwmPMiFlzcSM3 k60sZMRh5MpkN4TuBoCvXsnEgM8L8c5d/0s4PIvlmoh1oIBtHKLTNQNrjYt0iqvUp+Rn QLAT9BnkKfv9Ac1EtXyC4oH7UVzIy19zj8dMHbkmZYaLANkJgjwhigcAWmpiOUqbg+/E IsZkJV2y87l4MxN8fnAxkDOZAB8gcFgzOm2feOICksqqXjLiQWuq8rMWAxghW+03G+OR WfsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LWy2XAGNA5ZZNgHXXcVrR1+HaYsbKEPO+cXv9RgMG4Q=; b=JDbJoxso42UfGXRoiZVkqE3RFib76/EYEILkQhNP/IctoJEbe3OYCOpMyPp0Gr5NaG USEG51uputfiAx0yvnL1e4/LVllzkmp7DYTzOg7JIflUR2FY9yQjnt3oL2bBJABadQKU mPZN4PUKeifG7kRNvotnWDydLKpQ/9TbSYP14+0G4ioPUCpnKhjG8v3h9fNK0S9Lp2+G hMdujyv294bBuk+yxJ6bJ0FFIINc94R0L6F5C2g26O4gzioV705AYB0APJ+iacmqB40O m1JM2IQDjUJS8+M7MKZUZonow5CkKZPiNNPRTIoCzQaS5eZJmXGJdphu0E1XkUCR//YG ng2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oebdXvTF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jf2-20020a170903268200b001869ef16477si5141847plb.356.2022.10.24.09.11.24; Mon, 24 Oct 2022 09: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=oebdXvTF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232809AbiJXQKc (ORCPT + 99 others); Mon, 24 Oct 2022 12:10:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232802AbiJXQDZ (ORCPT ); Mon, 24 Oct 2022 12:03:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32D0E1162FB; Mon, 24 Oct 2022 07:56:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 37B26B81693; Mon, 24 Oct 2022 12:27:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A920C433D6; Mon, 24 Oct 2022 12:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614436; bh=bt/7eh6FfydEePQtgDsOro6ZK50zNzKZYCGlPt6CeTw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oebdXvTFmQ1I/YVTHTBrPlxI/zp9BGyVx9+ZcaSjew27c4TZ6/JZR5VixNTdJ6pod TlL0/yt1d3qDL1HSoYPJxSuTaieCUXjYERlviCrqswtzeG/ttnM1JKjsxhiH7kgZU0 LOBkiyR47OjoRgFWchEdQofU4fUcCFfWOSCcRHvw= 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.10 261/390] clk: ti: dra7-atl: Fix reference leak in of_dra7_atl_clk_probe Date: Mon, 24 Oct 2022 13:30:58 +0200 Message-Id: <20221024113034.002988427@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747586015777770175?= X-GMAIL-MSGID: =?utf-8?q?1747586015777770175?= 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 8d4c08b034bd..e2e59d78c173 100644 --- a/drivers/clk/ti/clk-dra7-atl.c +++ b/drivers/clk/ti/clk-dra7-atl.c @@ -251,14 +251,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)); @@ -291,8 +293,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: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: 9198 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458941wru; Mon, 24 Oct 2022 06:38:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7XPV2WNdXtTF35+PdGUEvLquCK+Ksfsh+T9dY00OunltEVIEtTVT02llXHJ1b7t2nEvVJl X-Received: by 2002:a17:907:97c3:b0:79b:3f8d:a354 with SMTP id js3-20020a17090797c300b0079b3f8da354mr14559477ejc.461.1666618714945; Mon, 24 Oct 2022 06:38:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618714; cv=none; d=google.com; s=arc-20160816; b=czs0reX+W3+AUgA2nDAe3BsGLpp/3NMIJyWYIx/gGxtCqahjWs4UoFew//fOysNTEr GOPzwEospHuL55Y32noNd92Qu09lL8Rt/lzr7NLE2GUbF/xP6ANH1oSon0Qsz4+CWh9j bo9p0ypjbewZ4fA+52CoiEk75qlpnv6AxQWOj6sQCrWLZDyaOcEgKRRUBqQeREYkYbg6 hFryGZaXGYbhWMhq1ys9DfetHkqoyf+Gd8evMFb1BMS2+uTO6mMQjCFGEJ+3h4RAVn03 vjLkckHKygwHZJQSlyYEZN+OirCa1t5sdDkFsmR/TsY6HV1IEHO+dbJWcqRVfQVWGB3z eKrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=K3U6h1ZFYGt/wdhpVzTBJWNxbnPLKnC9h5nOVfy2B5U=; b=YlsZPmwzZRi2L1+uaP2eHKMSszh81g65j90RqLS6OUbzl0rHztbncJrHwgZEPyR15x 6mSKf8JhfRBwYBMFJB2yv/IJmvxzUicLt/xSYGEuVW5GXqGDXs2Wr5cs3DbUTRVzfUTq FLv+8HcHdpOQb2q49JenAEHoNE9dH3VZrG9ayZd7aad0x1SgZhuXGrlpINdzfy/HqMAl he2onoQk0dHv0IK/qS1LxcNLANavwQJC7CJUr+6/3uYac/1P00gC0apHVXsT+uGgFlSH emPSZ2Jc8/Vx9WLvFDAd50fnC+3uFR6VavmEEEq3L/D/kwRZiR97tkCdfU0zr/vD+f4N LTbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rpdbnwu7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp21-20020a1709073e1500b0079ed0a585c2si7111463ejc.261.2022.10.24.06.37.54; Mon, 24 Oct 2022 06:38: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=rpdbnwu7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232484AbiJXN1M (ORCPT + 99 others); Mon, 24 Oct 2022 09:27:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236136AbiJXNY3 (ORCPT ); Mon, 24 Oct 2022 09:24: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 ECDCD9AFC2; Mon, 24 Oct 2022 05:30: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 1EAE5612DD; Mon, 24 Oct 2022 12:27:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3390DC433D6; Mon, 24 Oct 2022 12:27:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614439; bh=64gELA0nUsV9N2NViMDvTXlYD/PS9XrRDXeAPBJL2d8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rpdbnwu7YXgTy+FbHOJZLPpCAPgypD9REhfjLHeW9t9x881IVcZPkg04Mzlmw/pP6 gSExtAygP7zr5+LU39G/QgGJVK+a7oEFmKKZlo+e7IuRNneLeEHsFOWGEOe8KONy55 OV6MPGZ+LUaJKDxMl5s//yvPbWCiUOWhkM9m4zWM= 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.10 262/390] clk: ast2600: BCLK comes from EPLL Date: Mon, 24 Oct 2022 13:30:59 +0200 Message-Id: <20221024113034.040784273@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576385757198305?= X-GMAIL-MSGID: =?utf-8?q?1747576385757198305?= From: Joel Stanley [ Upstream commit b8c1dc9c00b252b3be853720a71b05ed451ddd9f ] This correction was made in the u-boot SDK recently. There are no in-tree users of this clock so the impact is minimal. Fixes: d3d04f6c330a ("clk: Add support for AST2600 SoC") Link: https://github.com/AspeedTech-BMC/u-boot/commit/8ad54a5ae15f27fea5e894cc2539a20d90019717 Signed-off-by: Joel Stanley Link: https://lore.kernel.org/r/20220421040426.171256-1-joel@jms.id.au Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/clk-ast2600.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/clk-ast2600.c b/drivers/clk/clk-ast2600.c index 24dab2312bc6..9c3305bcb27a 100644 --- a/drivers/clk/clk-ast2600.c +++ b/drivers/clk/clk-ast2600.c @@ -622,7 +622,7 @@ static int aspeed_g6_clk_probe(struct platform_device *pdev) regmap_write(map, 0x308, 0x12000); /* 3x3 = 9 */ /* P-Bus (BCLK) clock divider */ - hw = clk_hw_register_divider_table(dev, "bclk", "hpll", 0, + hw = clk_hw_register_divider_table(dev, "bclk", "epll", 0, scu_g6_base + ASPEED_G6_CLK_SELECTION1, 20, 3, 0, ast2600_div_table, &aspeed_g6_clk_lock); From patchwork Mon Oct 24 11:31:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9310 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp465032wru; Mon, 24 Oct 2022 06:51:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7DGc41hZFq7pqRDWK9Nmv8Kn2kxQ08p5BfHfKOmLnDJ/pj+hbHu4XTWQD9pvKgEDXXEknm X-Received: by 2002:a17:902:e807:b0:185:534d:4bd3 with SMTP id u7-20020a170902e80700b00185534d4bd3mr32041973plg.26.1666619505810; Mon, 24 Oct 2022 06:51:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619505; cv=none; d=google.com; s=arc-20160816; b=tf7OcF5mBvA4fooxNhdYZcLz34L1qI+k4dE9iuKWPdLb+KN5nvHik0oI61tGFW/szn MYjBf0OTefqceuIPqwGOKabuD/IppZpUAmzNW3Yh/ZNPG4pbTxQvPW53ZlrmX1k4c6Si BS+v0EeaCu/JOJ4k2u6mJa6pmBGVvyTRx5HLW3k7UdtFe/bXbmo9CZ6kGG7TgnIBIryy S8IrVwNaXJqegGGgU9Bi7pR5hcQ10qpgsWqsW0AMcmOWT/B00Gx1v0Urht5N7Q1iV5a7 Wz8WL71AENDdGogjbq1q2aFujhFDbunBqrsm2a3f8fXuTsu2Mg4E7oIu6ySaa7NnxG2y Shag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9RR5N0AorShVpTQBtOpomGrrxJoCwpqj9PDxq4B1+Ac=; b=h4ov7LEDQ5jp6un0McFBOiwFjZHFAIKthnmOPiI8MjoVj2/g24ObB66wooUe55WSIl tBGdD+1hoJCJ5QPG0fetiZYaV18WkWBIMx9t8nyT1als56uKKo/h6rPraulIgFQBoH3Y mZztxKOTEJdcMyu/uqf/5xRiwe8Q/6xj7ci2N/1alVh6oxiVmaahflUHnhspRvX2ZxmF rgA4gn+jfeX3IRU/JhYVf9OCScINdxq5Eh82U5ny8TcMBoIqEEcSjUnCeAv6AtZ8jQZf L2oG/Eya/9jbpFnLCXUFJuUAjp0Hfs1eJzEvtzyuli7aMTeru+hPJ0FsEfoV+WFZCmhC ySoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KXrfiV64; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056a0021c200b0054d5253e7d7si15216968pfj.190.2022.10.24.06.51.32; Mon, 24 Oct 2022 06:51: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=KXrfiV64; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236530AbiJXNuo (ORCPT + 99 others); Mon, 24 Oct 2022 09:50:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236679AbiJXNtl (ORCPT ); Mon, 24 Oct 2022 09:49:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4003CB8C39; Mon, 24 Oct 2022 05:41: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 AD195612E1; Mon, 24 Oct 2022 12:27:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C20A2C433D6; Mon, 24 Oct 2022 12:27:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614442; bh=krC0t6qtfnr3qlEDbOeoZ9RVBO7XPwtUOgKJvaaBlDM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KXrfiV64x+RGiDh4z3ERxSGmyL8GSy3JTaEeak3R6EzQb/oWIAQh7E8OyxzGuUWmd gmId3xS/+gKFDf/wFnSe9sHN4qO+yd3NU8crgdcAygP+gSsUeF3Iwev1rGOexwBzrM 3uitSdrifQ0Qkjk7TPZrnadTRVVrZtRfuP0Q3KfA= 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.10 263/390] mailbox: bcm-ferxrm-mailbox: Fix error check for dma_map_sg Date: Mon, 24 Oct 2022 13:31:00 +0200 Message-Id: <20221024113034.090423319@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747577215257057301?= X-GMAIL-MSGID: =?utf-8?q?1747577215257057301?= 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 bee33abb5308..e913ed1e34c6 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: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: 9646 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp533060wru; Mon, 24 Oct 2022 09:08:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4+KUyOS1Cs5CHAZ8LPwk8xJp9TmHP393WdGu+vZQ+GQtthQWLRsNym8CECcNSyGHks5pQp X-Received: by 2002:a05:6402:2756:b0:443:4a6d:f05a with SMTP id z22-20020a056402275600b004434a6df05amr31683336edd.396.1666627738302; Mon, 24 Oct 2022 09:08:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627738; cv=none; d=google.com; s=arc-20160816; b=S+drOF13s7PLet3X478MGUu1HSyy+w4UNVXaDDi2/XsTfDKvTs2jesoJPCBJRdu9PU v4fl+1rox6AhYks9nnK0pbAJ9lQTJCJjKL56WKT0m7684d2ppAlXcN34i9qdZrmLnJS4 IgAOmUi6NqCnsve5uATNzy64UcKB7yhlQbXktP4zErpfFPid0TF1MojCtdfIZUFWK+mv lGLbhXziJ8QOv5dYmGuPK7H1M+dfTcj9M/+cCc/rvt6/qCuQHwmHOTS2a2dIXN1wlU6A GZj9VOxpZhWbi6JerrC2FNLpYDBvbM2bmbkTYDwmMiECckB4aK8nOCfNp90aC56dPLqG mZhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=RMJ82II4RBUN1Xhzna4yVN+wz5TTqpIdZtnMwSptc1AOV2O+vLtxZIIQkzKrlBgc9C iZ8CjUOB7jcGPBnKeIniB/0bzJzsv0OmHtfr77jeS2+QALXuVvIoQv4GOH5MT/Rz+vlU vXVaarq6AIq2aWU8TF1pJihsCqtnh/kuPuA6jsN7M6Tpw5OYumcFEULlreoujOi+XlfO is8BzxXK3Ce7mrKWQgN+zF3YKx2FLISOnpBtipSU8e0Bz9sDUUVGce5bjGH/A4huqiJD O1h61rSiENZFfuILliXBd1lNxlRJw9sRItxmR75bi6bID5/+RagtX6qg4mFTBKMWyJOM xXXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dYnMpljy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dd18-20020a1709069b9200b007836ec6999dsi117628ejc.904.2022.10.24.09.08.33; Mon, 24 Oct 2022 09:08: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=dYnMpljy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233380AbiJXQHu (ORCPT + 99 others); Mon, 24 Oct 2022 12:07:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233209AbiJXQEV (ORCPT ); Mon, 24 Oct 2022 12:04: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 DA08C11878A; Mon, 24 Oct 2022 07:56:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 04DE3B81199; Mon, 24 Oct 2022 12:27:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64A85C433D6; Mon, 24 Oct 2022 12:27:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614444; bh=9MwbfkNRjPJYllnZP1afGD7xpA8qeU7cGP2m/ldY7I8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dYnMpljytLcbSj7/xcTa4PDhCh7X7VSmZrG8v29bMi/yhRyDHVy5vYcetjAkFZ1OJ FW0xlT+9t/8lJBtm2SBy3Hqhic11zvhHa93d2KGOzn0oFQjnC6uhkPJdX+wyCiPyBC k+9iO0IWrR3OXkQPlKjBtVEXYNrCDRuogw3+o8Lc= 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.10 264/390] powerpc/math_emu/efp: Include module.h Date: Mon, 24 Oct 2022 13:31:01 +0200 Message-Id: <20221024113034.138478077@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585847124457633?= X-GMAIL-MSGID: =?utf-8?q?1747585847124457633?= 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: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: 9615 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp531170wru; Mon, 24 Oct 2022 09:06:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5aK7LFRfbPMTM58miFK2S9X86v0c1adDUhrUL4Su5CdpmmyxUijwDYOle8rBviyWc4EcQG X-Received: by 2002:a17:907:7e87:b0:78e:2dc3:945 with SMTP id qb7-20020a1709077e8700b0078e2dc30945mr28518152ejc.326.1666627567159; Mon, 24 Oct 2022 09:06:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627567; cv=none; d=google.com; s=arc-20160816; b=ShQzItKB4966YKXHoxTAfEiHQ7lm9q/yC3Pu2oNAiLyZKJtK7NM6t3QlAG1BzuGoSa v4o9ISWhL/cmuT+BjMSL7CFs4CPacoy0WvI/L5oJy4ZSmnoDaMNLd9KnDGHc2A7+zmFs rriuyHtZ1tpEbzZAacEegJ8K03R9FzBZt+r2Q53NUAQ0/FLF3veL+j5VL73uBKMjmBlk BCkMCybHMuocusQhVuRvKwdPFpQajiO2GrtMumttIe8flY32a5MSTS8dloMMu11IWm9w 6U6iOnh3IzHbLuQJ3mVaR0GSk9FtW6wAiDBO8D83zljRX9hOiwg2faPSYGYkiOUnM436 qjBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=VRfiP3yXuxpn7cfuhg5CUNk1ds5GvZ/Wa78BiGrP6wNuz8483Qfb7pWtRiRa14KxAB G0eQPyh0iWgrjUvG93T5bhv5xxM48L5BFFnEwscacDEzr7EL4014LmIkimHYXky8R4K9 iLAVuJqiL7Qm85mthAq4iaVBa8yAsjooqbXsArKJB0hXHqITRTrTo89azpC4S0A3CXkk xRoJbvEEJ4UIkE/nX9mtcmdO9C+7qP24KLDy+k+u0Ror9o0IGb0RRCUnO76JxflNtN1g 31UDAenV/q6drt7un7VcmyyAeWL98D15CmGIVV0I4g3fkfINUviwYQp0WnOfswu4jF3B AeUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eYEC5txF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u8-20020a05640207c800b004617df75676si143896edy.245.2022.10.24.09.05.41; Mon, 24 Oct 2022 09:06: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=eYEC5txF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232834AbiJXQDp (ORCPT + 99 others); Mon, 24 Oct 2022 12:03:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232702AbiJXQCd (ORCPT ); Mon, 24 Oct 2022 12:02: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 279B8115413; Mon, 24 Oct 2022 07:55: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 9E596B811C4; Mon, 24 Oct 2022 12:27:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 038DCC433C1; Mon, 24 Oct 2022 12:27:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614447; bh=FpXhnLqOG5Yvh/g9j3Y6llbNQVhcq7oq+QMST9zMdbQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eYEC5txFK/haofjp+RU6au5pStmmcZjh9p9GJCxrK+6aJmJ1F6i6dgzAbpYI0MfLb htLzCfe/OldawfMhhsOHXZ6dNA9U5QccpWdv/UBLETd05SNOBwy41nOF6/qTUHSzEt ttBoSC9580czCNyf423X2GEpYypm2jx8zZ/NWQKM= 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.10 265/390] powerpc/sysdev/fsl_msi: Add missing of_node_put() Date: Mon, 24 Oct 2022 13:31:02 +0200 Message-Id: <20221024113034.188404880@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585668179281090?= X-GMAIL-MSGID: =?utf-8?q?1747585668179281090?= 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: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: 9181 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458274wru; Mon, 24 Oct 2022 06:37:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7furP1gYlc9+F7dklV2MaNu3nAYbW60g40zEFn7V8IAE7YBiA0kYJgmlrnIOj3uQhtpf/w X-Received: by 2002:aa7:d694:0:b0:461:7638:bde5 with SMTP id d20-20020aa7d694000000b004617638bde5mr11822272edr.105.1666618637097; Mon, 24 Oct 2022 06:37:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618637; cv=none; d=google.com; s=arc-20160816; b=JPAiqREYcZ3tV9nVE+s7I/IfSFYhDXTppTctYVdBvUxyRQL/7QXZ9LWCP9Mhi/xs5/ Ekhz5IHu0TYbc3DOb+T79WIO7E3TZHz2bva5x0T8ec0RIg4ap/4IQezzgoG5A24/gXi0 856Le/+B7boXS+pWV7O34NVUHcruEMsxan/y9lbVnjrnqsOZx2EN4TzLPBImtgz7UYCr UKZuP6ZiXQuldvhNKeIo4wPaOSknpG+76P7EcC5AUnlBP/8yeSuGcvcdFjzmxF2TNgmR FDna26NN6J2RAAJf7d1zYOlKV9SIaPg3Rnnw7Ql4+60DGnAuQqkZdqpdV8wvtaeLHet3 5wiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=J8lrOUq3ePOivxMbmdFPq/raGu4PMS0S74byryGAI6c=; b=HMcVc3PY3lMAKHAbKMQC6zsA/hLgRdLumdUtKg8lmDyYw7n8LZHEurMBWuL9ipHxW3 rmoRLs6qoeI/oFSGfCxVctG2vOfR93TRw3OJPPCvYeecuN6z4QtWygdpnVbLHZwlNNps edNYoCxOiNvYQnEQWv7WVTRXRVPwZXx5E9a0DsVmaZHH4//L/Eq8KHiO5LUukuwm+nHJ Y/wtQwl+deU7YiEAMTOJt9LgTubooUcJ0GS3hE5oYBRFTqgxcva6Db7gNZLXTfQhq1hy QpkpjOlQtlMnmxrht+OO3fY0K8HWpR0HkwFnj/xIUuHoFTa3DN9HYLb9lV5JxpPH17dW JiMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YF3GmO3Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cs12-20020a0564020c4c00b004618343b140si6410003edb.199.2022.10.24.06.36.43; Mon, 24 Oct 2022 06:37: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=YF3GmO3Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231620AbiJXN05 (ORCPT + 99 others); Mon, 24 Oct 2022 09:26:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236056AbiJXNYL (ORCPT ); Mon, 24 Oct 2022 09:24: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 DC8AA88DD2; Mon, 24 Oct 2022 05:30: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 851FA612E4; Mon, 24 Oct 2022 12:27:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 948BEC433C1; Mon, 24 Oct 2022 12:27:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614449; bh=YEZW9YOcl6ne1huyUwW1PkxEEPh/GPoovlTWplHf8eI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YF3GmO3Y2dDMFAccnlKtqwg5lPATtIkUojN8KOhmuAtsPKpFBlqo0o51ZX+dmKlRw XehfYFYFDkpCPwGmjqECdO5ms2nn5Vl/D8qEfVnLxlR+cFTGbi7wdgznrYGQwue0Oh LBSZsCSMyMZCFE466OHIgs9o4C6ZKl6Opr4Kj8fw= 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.10 266/390] powerpc/pci_dn: Add missing of_node_put() Date: Mon, 24 Oct 2022 13:31:03 +0200 Message-Id: <20221024113034.236546137@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576304166440688?= X-GMAIL-MSGID: =?utf-8?q?1747576304166440688?= 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 e99b7c547d7e..b173ba342645 100644 --- a/arch/powerpc/kernel/pci_dn.c +++ b/arch/powerpc/kernel/pci_dn.c @@ -330,6 +330,7 @@ struct pci_dn *pci_add_device_node_info(struct pci_controller *hose, INIT_LIST_HEAD(&pdn->list); parent = of_get_parent(dn); pdn->parent = parent ? PCI_DN(parent) : NULL; + of_node_put(parent); if (pdn->parent) list_add_tail(&pdn->list, &pdn->parent->child_list); From patchwork Mon Oct 24 11:31:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9642 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp532864wru; Mon, 24 Oct 2022 09:08:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM46V6FKFU7Z+43+LHAB6ZTVYwp/k074l9X3QrVTytBnavRmBeBsSkhLSkbPdOrkTaZDV35m X-Received: by 2002:a17:906:7308:b0:78e:191e:8389 with SMTP id di8-20020a170906730800b0078e191e8389mr28472918ejc.170.1666627693814; Mon, 24 Oct 2022 09:08:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627693; cv=none; d=google.com; s=arc-20160816; b=hnfy/V1D9VTxaRDSUD5GkNWuUtjAdB/QAvKwx+dT/UqrFhV/jhs4P35w7Y0X7cgOic tdEbYvDqBvcdXOF1uNV8/pLOtE2IP+1ObVFCUWjiToWsN8fWCWn4c9aNggN56GvpTPow ywYg5k3LggCpsKuVjOzI3pnTRFlJYRbPXKNgCB6Iyt0KxiRJcq3k8YvCxBYvjJATxYK2 a0sxUYj+QPzLNq5Pru+d+o7hLs+xd0XOGiiBge6BPOIMtdEH0JgpBJ3P9t2RrH+dPQJf Fec8EZiBsCnALarars5k5YdYxtTftB5X5eM5HIn8dBWNd0TtsnAIIrjDZpT2IgbQ/xHX Vtqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1a4moYShhHgdSxiZgoqNAxhQr3Tw69gy6Bwxd79gq+Q=; b=eo1PBqrJ/Y3LCTATJGOAiTMwri6beozGwDUVZBPqmIeS49AGE/Y5GuDgA76PpUK/FY KQlx7Ds1RX/JQDrKSAceqbdphikAVjd4MkO/6Se4Z4cfHvtKRoEqGedbBA8cdJk4DYte A9zNvDFRDeQdC3FVIc+I2INi6pUTHFbKThT/f7/x07JXBwZ96pdOtj3jaDCeyrpAOG6F uOdK+7KnOKjMXJwO1CwWQgCNUxLpHpR7cu9XSI5uxEQ3YSvpYA5Zq4IXCmjrctjlErLC JF5YQYDCEsk6QUUizg6fajaSCo+OYLkaiHgKdEWBxJdeAspTvqeiB1vkSIBEDt1Ts4F4 A+iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lT5oE62B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i29-20020a50d75d000000b004573107a5basi147719edj.352.2022.10.24.09.07.47; Mon, 24 Oct 2022 09:08:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lT5oE62B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233237AbiJXQHM (ORCPT + 99 others); Mon, 24 Oct 2022 12:07:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233055AbiJXQEM (ORCPT ); Mon, 24 Oct 2022 12:04:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19AFB34713; Mon, 24 Oct 2022 07:56: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 EBF69B8136E; Mon, 24 Oct 2022 12:27:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 536E0C433C1; Mon, 24 Oct 2022 12:27:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614452; bh=n8jAJNK8RHfxHdDp1rMTFCzsd2/JLy6UGwwnJymwJos=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lT5oE62BfFZHIphVNwdkF/KOok2/5F8Yornbhj49LT1elTVS4e8vLqbm57e4xAmdh JG6c2tLLijrgEdykac57ASx6uNcrXE1H2nClZenXyNdrxAwaUo+gtfTVKS6b+11CD7 wO74bBKNawE7mNbgI8AqNCc3bwXWMz7yaCn0Nv0E= 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.10 267/390] powerpc/powernv: add missing of_node_put() in opal_export_attrs() Date: Mon, 24 Oct 2022 13:31:04 +0200 Message-Id: <20221024113034.282951537@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585800486213300?= X-GMAIL-MSGID: =?utf-8?q?1747585800486213300?= 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 c61c3b62c8c6..1d05c168c8fb 100644 --- a/arch/powerpc/platforms/powernv/opal.c +++ b/arch/powerpc/platforms/powernv/opal.c @@ -892,6 +892,7 @@ static void opal_export_attrs(void) kobj = kobject_create_and_add("exports", opal_kobj); if (!kobj) { pr_warn("kobject_create_and_add() of exports failed\n"); + of_node_put(np); return; } From patchwork 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: 9550 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp511953wru; Mon, 24 Oct 2022 08:26:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7S3sz7kD8vOAQbk2k8QedAcEvXZLWXDMYCLzB5z15EfXCCAXnbhDGiJ5mHv1XCobxmDXxz X-Received: by 2002:a17:907:74a:b0:77e:9455:b4e3 with SMTP id xc10-20020a170907074a00b0077e9455b4e3mr28610551ejb.471.1666625215241; Mon, 24 Oct 2022 08:26:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666625215; cv=none; d=google.com; s=arc-20160816; b=nBNO7OrJEyuxPqysdHTYdrlLL40GzERSlRUFhOmMUAhXQKymWbthP8edYaX9qVIRd9 Z8rzQ5l5qLjriDG9y3I6fNCWsOdPsVAnguR4k69MsS7TFdhyir4xmd/33gkbbYsKkkdD gq49hyXdOLdFWGAlI7QnZzyHl7uN1JytgNvMlLWcO5s9dpW2u74XT4s63Lx7FOQDejDJ zTqk9t/2wclI0AuQk88xTqbGW2jxKP5aZD0zUAfnkdbS6281HsABHDsDmeXUmnoDm977 Uo0NJ5h5h8uyEgWof8Sb3DAfDYN1atN8OstCJ1+9AL7+9NLwJQTkFgkT11rg3TiFUjoy QO0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Vh2d0fLFK5z2MPK/kZPI5zMIHWsEU2tgbjvqn1AoJXA=; b=cDw7cghpCQ5HiywGSHNv3SBpIo7LKPg6MAY3hje0yAR6jYkvR8C2NZOGg+mqbct9wn zTtQANu8E7mxUsx5N5DQutelyoJfqE82kcmhwQqUNmk+hjKd+7n5lckbA8aHKNlYGOcP PusDxbMm17jVa5njtLtDdpkoxp8UzYrgAQVug6xlEG5f6kZbjHov/KrpHQjcjX81qZfm zEc6kPMxUivT2geT4ZLwbIavuu7ayA+aXUWfZDFDHfeDXTMISOC5IAayhHORf66mkfPq BqLA3si4+G4qsTJUQao922amyD+nv+2PFNOj2aC0uPfVtCvFjHRu5WlLOxGrwjF1m9Pl fsdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="gFl6nXr/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs12-20020a1709072d0c00b00781cde43588si90146ejc.58.2022.10.24.08.26.31; Mon, 24 Oct 2022 08:26: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="gFl6nXr/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232964AbiJXO6Q (ORCPT + 99 others); Mon, 24 Oct 2022 10:58:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233920AbiJXO5y (ORCPT ); Mon, 24 Oct 2022 10:57: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 850455143A; Mon, 24 Oct 2022 06:35: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 D80E7612A0; Mon, 24 Oct 2022 12:27:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EADE9C433C1; Mon, 24 Oct 2022 12:27:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614455; bh=6S8wkVtGZt0abelM+HE995JPE3aIj7ImAwxa7yJSGBE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gFl6nXr/Mk7NW7ND0cOyVqqN2sGDZjHK4Uv83Z+Ig6WQQau0wGD8GIIxO4JT55kPs yOblhYfGS1ZR2nq+3qJj0zfuQbg+WeP3Vahja4IB3LoECeXZbRxHwi0MiIJ03ICz91 UKi6UJwnIKd6goxaOqLK+AtoDKBOo+7LtT5KXG30= 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.10 268/390] x86/hyperv: Fix struct hv_enlightened_vmcs definition Date: Mon, 24 Oct 2022 13:31:05 +0200 Message-Id: <20221024113034.330762947@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747583201687152805?= X-GMAIL-MSGID: =?utf-8?q?1747583201687152805?= 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 0ed20e8bba9e..ae7192b75136 100644 --- a/arch/x86/include/asm/hyperv-tlfs.h +++ b/arch/x86/include/asm/hyperv-tlfs.h @@ -474,7 +474,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; @@ -482,7 +482,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: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: 9618 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp531257wru; Mon, 24 Oct 2022 09:06:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM60WoNCZrwPlMvNZq4Gkp5OvZR52Tc9IMtsdlWL67L+eC8l0IobIVptlKjjz4fTqQtQiXN9 X-Received: by 2002:a17:907:2e01:b0:78d:f24b:7330 with SMTP id ig1-20020a1709072e0100b0078df24b7330mr27931196ejc.604.1666627574346; Mon, 24 Oct 2022 09:06:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627574; cv=none; d=google.com; s=arc-20160816; b=rqUGS0tCv98Kj+sI92V0k0mUAvkh1N8Sl92ztm22DiYq2W89iqaRx2K2I21iUmICq9 ExyikAudaSrf8fYdiD4hq1NZuteiOaID5bi0opotlc4ITyxjqy3O+4c8O3ub2AsrURtP 1QnELaGFz1q8cBuxkR0tAZEJRePr1z+Bbv5kdsLGxD5FyFR053+8ILnK/aBK/YTKSXxr qd4gvZTjSg2dlubuRjavfZ3GjfEmhnKh157boLcP5pTQmviH3mTQ40PQQnrSBU+nTw9o snIlUE1OhGIu8njgR3l/fxv92OPLcpBoqp8aC+be0PZtS78HUGEMyLPesxaWTZbbUlMY wg+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=BWCeVcIir4O1Pxs8YY+BK3VMtOJw22vY6gc5r11Bm1k=; b=shqA/8PW/u63HEtxacZ+GGsI8NF5qvhksFLAQ9EYQNhFonLSM2oIPOuEfx/tVyZmR8 QQdqPVgy1+tkbsULCAbxsz3TVJoW0pYrfLCeKxzEyESSrho2Ji5KyDpoh275v9RqyXuQ Z1YU3FDysRdfNqV+Yio8UwSwRJ3W/tQu/WFSKKSEkdzzuOptbaDhx92nnJG8ARrHKTID 5gQ97nCU0CIBwRBJ6Ssub8DYbXJnUtSkeFwvzhVRdKNlCiHwjnW4RX+pdbMLYSoW0/12 s8EGMqfRt9SOAA2xuF8cboEFv/Vo95Anq4s3fJYx2MjYyLw1JyrKxM5KSQlN0NVqz/CG 2zSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mG+oOy4q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne10-20020a1709077b8a00b007418a1e877dsi132140ejc.580.2022.10.24.09.05.48; Mon, 24 Oct 2022 09:06: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=mG+oOy4q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231753AbiJXQFU (ORCPT + 99 others); Mon, 24 Oct 2022 12:05:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232540AbiJXQCi (ORCPT ); Mon, 24 Oct 2022 12:02: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 5B5B31C5A53; Mon, 24 Oct 2022 07:55:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3A89FB81258; Mon, 24 Oct 2022 12:27:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 961F0C433D6; Mon, 24 Oct 2022 12:27:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614457; bh=TdBw/XZ//KUbb7nc+UiUb1brIjebV2fUdY6YEQ2tcpA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mG+oOy4qz7cU5LXDmYAd1aPhTXKsqgvKZExFNtfesgzgP+yepUZenG/Wmmx2hidZj pdcn6Pr3AqtqkyaKcPuVi3FsWRCwnWeLcbDpyUMvIeMeS4ZuSCiXUhiaToQgbWTduf itNVLSExkPqrZch9NcZrek7zHT6HF/dVTJuFTbFc= 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.10 269/390] powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5 Date: Mon, 24 Oct 2022 13:31:06 +0200 Message-Id: <20221024113034.379631829@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585675366900289?= X-GMAIL-MSGID: =?utf-8?q?1747585675366900289?= 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 59175651f0b9..612254141296 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -153,7 +153,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:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9269 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp462308wru; Mon, 24 Oct 2022 06:45:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Hp4FgbtsRU8A1sIFPtIKLPUfXSak3P+UmDs/w6q9hfMN5pxa2SDRCu/SLObZZwgmoCsAr X-Received: by 2002:a17:907:9713:b0:78d:8e23:892c with SMTP id jg19-20020a170907971300b0078d8e23892cmr27410136ejc.449.1666619145831; Mon, 24 Oct 2022 06:45:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619145; cv=none; d=google.com; s=arc-20160816; b=ERz+C8SlTVQbTUK2gIx5YAUtzRnZzFx8FbaOlZkF4XO27xcCVh2zyfBkmpP26j9bwf AxAb5E7QSmit6F4brLzBkOe83Dd8+Ae1L/Bqnauu8HGUoI3PV9w2ZR5QpmwBWVF6lFVA M2TE5Uk0T7tTBDMU08hGcAd9mmhFcp1Z1WTz7xI87DgiEIfoV/0xUM0nDbNQvWlejHqS PvJCgfeEvZUuGcRx8qRDjOWA7/K5BdwN+/hD6kxiShX9ph3P/vNrnqwMFaLb26xwMfeQ 801PNNbvnxt/ShOCjH7MzTNIjxu7kEeJXD6QFT4bSkTQJM45PqrGYZKhAv3Hae4+Fbbv o+iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=G0gxlRFCxLawNnnGIJ/fJkjgl52krHVOqKK7F6qbE2D8ItXu9ivCf6DwThI6qficU9 HN8HuAfrNQ954FdIkLVqJjileiirof0ZAZU44nVXFRnqw6+LXxQ7tXx2fELiaxCrdAo3 KYx2s9IcTAzHM4DYNf71bGaUXOJmonAYMh9Syt+DiSA3Zo72xJKpll/XeKHEbnEciF1+ rbup0bBTQOdiclO+u+8wgRAJKjQz7muykYIVLpHNPQakECUcaoKcssNT6oqcnyZJlv4o Dsh+GoeZf0CD9Jfk+T0aHZMp6cMmxuFcloHt0d8UW1tVNr61LKkqqIJaY2DdyMJetGSG C7GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sHF3CwuY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hb10-20020a170907160a00b00782e85ae302si26454709ejc.574.2022.10.24.06.45.21; Mon, 24 Oct 2022 06:45: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=sHF3CwuY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236189AbiJXNnc (ORCPT + 99 others); Mon, 24 Oct 2022 09:43:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236873AbiJXNl1 (ORCPT ); Mon, 24 Oct 2022 09:41:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47AA6B5172; Mon, 24 Oct 2022 05:39: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 BCA8D612CA; Mon, 24 Oct 2022 12:27:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9D1FC433D7; Mon, 24 Oct 2022 12:27:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614463; bh=l0qQ2lCaxTmpz63zjBz0GZTyNJRYUHWb1NPdjSlk1wE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sHF3CwuYPYCBXaXNg+aLK9Kh13GaX4QwIejoA620qolQMcTRnc53ASl5K4PjjRs3g Iai9qsyMiyWI5L2YN9N4OgAycxr5MPgnNclDxaC10NuScvGh/gslODC6uxHaH/dWHl 0IJoPzYoFqV+Pds1VsAznmgdl5rZQfOkSYjR3HiA= 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.10 270/390] powerpc: Fix SPE Power ISA properties for e500v1 platforms Date: Mon, 24 Oct 2022 13:31:07 +0200 Message-Id: <20221024113034.430278937@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576837682952153?= X-GMAIL-MSGID: =?utf-8?q?1747576837682952153?= 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: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: 9149 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457514wru; Mon, 24 Oct 2022 06:36:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4pODrV08EsVsO+NNMFldfNsT7GAtLBBQMj3bKbU59OslHMbBOGPJRUvj3y9AGtT42/gjuL X-Received: by 2002:a17:907:805:b0:782:1a0d:337f with SMTP id wv5-20020a170907080500b007821a0d337fmr27992196ejb.475.1666618568025; Mon, 24 Oct 2022 06:36:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618568; cv=none; d=google.com; s=arc-20160816; b=TVaP2syJJZ848lSXn38QE43ZeV66cBJJEDLQfDlXmuwiakCa/wNj/X2DOvQx9L1nsI +uem2gbxCy3waWZ+cLOZFfb+Iq22XPVReTPlkPk1M2Lhni7ZkAKZyGJ692NdqRQhL74J bo09eZm4qKOIhUGgg9lInJ6H5V3RS4OpytE2MrcpJPLk/aflHeqxVLIc5su43v19y5rt d83KShNKS7oBtxzTPa9C3HeEZlqTKXhrz4do1NheJUi9ZpFsEKAs+0C5g6BsFajG9Dir vHixomCcNPiH8YrSId4QQ5AlL7YkHP+1X1FWzJC/aZKr0q1owCY8lu5GaJBKxNdsi8gP lAIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Mo4IJ3sTZ/kYBywsE9tl0ck0M/dF0C0XoOuDb0D28YI=; b=qNY8uYIa2de0kMPylQZ9eDH8a0WwVYL8yV8IVgNyI6YyKydLRY0uYDf3JGUZGoWJJz w0rP/iMEGil5Af0FdF6pOBYdewCq2AkT8iZopsY2xGjNW/06tQO+OdSbvqIhhHWsQ5kI R2VHW8SqMDdZPYHag8Y6LlBlaqbeGdzzFCBfp3uwJi/3tWAPpOJBadBEernA8yaTqz8o ldds7Sqya/sDkmSAA2+Wi7/HDpv8uIz6uodI6dnb4pI6GVvFwqRfSgrGeXR02tYWgafe HzzVQQamOOKxp4XEKdy98QRQWelBK+R0mPD4/szRtSDeqT2JF2zolvGD/5eCC3puHHmz eAcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="nQ+3/juH"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d6-20020a170906c20600b0078d27c1c8f4si22402284ejz.696.2022.10.24.06.35.27; Mon, 24 Oct 2022 06:36: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="nQ+3/juH"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234591AbiJXNXC (ORCPT + 99 others); Mon, 24 Oct 2022 09:23:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232767AbiJXNWJ (ORCPT ); Mon, 24 Oct 2022 09:22: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 376E41A5; Mon, 24 Oct 2022 05:29: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 53E65612A1; Mon, 24 Oct 2022 12:27:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6851FC433D6; Mon, 24 Oct 2022 12:27:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614465; bh=wq/nKH4U/hcOoZ8jQjN/KSVSJfCus0aPmsR5bOW/2xs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nQ+3/juHrRKDOH9xaZ38qjRkE0aDBVQdN3bHKf7C+ZiRI2gpQ6OqKA00qaYdX7XZg TbjexPOOfSDVhASnZabtgMzCrNPNNy38/Gb357xcOqjLl2SWVAZHfVMDCaqjtrAlBG ULNn4C1bkkId7pW7AgEr1eOj3YSQq1NakU/EggUs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhengchao Shao , Herbert Xu , Sasha Levin Subject: [PATCH 5.10 271/390] crypto: sahara - dont sleep when in softirq Date: Mon, 24 Oct 2022 13:31:08 +0200 Message-Id: <20221024113034.469304263@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576231358379819?= X-GMAIL-MSGID: =?utf-8?q?1747576231358379819?= From: Zhengchao Shao [ Upstream commit 108586eba094b318e6a831f977f4ddcc403a15da ] Function of sahara_aes_crypt maybe could be called by function of crypto_skcipher_encrypt during the rx softirq, so it is not allowed to use mutex lock. Fixes: c0c3c89ae347 ("crypto: sahara - replace tasklets with...") Signed-off-by: Zhengchao Shao Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/sahara.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c index d60679c79822..2043dd061121 100644 --- a/drivers/crypto/sahara.c +++ b/drivers/crypto/sahara.c @@ -25,10 +25,10 @@ #include #include #include -#include #include #include #include +#include #define SHA_BUFFER_LEN PAGE_SIZE #define SAHARA_MAX_SHA_BLOCK_SIZE SHA256_BLOCK_SIZE @@ -195,7 +195,7 @@ struct sahara_dev { void __iomem *regs_base; struct clk *clk_ipg; struct clk *clk_ahb; - struct mutex queue_mutex; + spinlock_t queue_spinlock; struct task_struct *kthread; struct completion dma_completion; @@ -641,9 +641,9 @@ static int sahara_aes_crypt(struct skcipher_request *req, unsigned long mode) rctx->mode = mode; - mutex_lock(&dev->queue_mutex); + spin_lock_bh(&dev->queue_spinlock); err = crypto_enqueue_request(&dev->queue, &req->base); - mutex_unlock(&dev->queue_mutex); + spin_unlock_bh(&dev->queue_spinlock); wake_up_process(dev->kthread); @@ -1042,10 +1042,10 @@ static int sahara_queue_manage(void *data) do { __set_current_state(TASK_INTERRUPTIBLE); - mutex_lock(&dev->queue_mutex); + spin_lock_bh(&dev->queue_spinlock); backlog = crypto_get_backlog(&dev->queue); async_req = crypto_dequeue_request(&dev->queue); - mutex_unlock(&dev->queue_mutex); + spin_unlock_bh(&dev->queue_spinlock); if (backlog) backlog->complete(backlog, -EINPROGRESS); @@ -1091,9 +1091,9 @@ static int sahara_sha_enqueue(struct ahash_request *req, int last) rctx->first = 1; } - mutex_lock(&dev->queue_mutex); + spin_lock_bh(&dev->queue_spinlock); ret = crypto_enqueue_request(&dev->queue, &req->base); - mutex_unlock(&dev->queue_mutex); + spin_unlock_bh(&dev->queue_spinlock); wake_up_process(dev->kthread); @@ -1454,7 +1454,7 @@ static int sahara_probe(struct platform_device *pdev) crypto_init_queue(&dev->queue, SAHARA_QUEUE_LENGTH); - mutex_init(&dev->queue_mutex); + spin_lock_init(&dev->queue_spinlock); dev_ptr = dev; From patchwork 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: 9135 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457352wru; Mon, 24 Oct 2022 06:35:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM53Q5srEKArNC4hLVyc447UbMnA8lmJIsWVFajJWDV0pOW0XhVNXekkda2TgjzGiL3+Shcz X-Received: by 2002:a17:902:eb8e:b0:17f:637b:9548 with SMTP id q14-20020a170902eb8e00b0017f637b9548mr34158796plg.158.1666618542287; Mon, 24 Oct 2022 06:35:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618542; cv=none; d=google.com; s=arc-20160816; b=CSNNey6B0eycqzfSSwGY4joBOUIbfGhfN3EKRfuPbgx+PZQsbdtIA2dNS2BqQbXr/n h5XT901x3V/xZqqx1JFtnhTgXzAlZaBFIE8v+NUuC33QzPhe/1ooYuERt6MDjhiEiHA7 weGnDyw4IpJdPJqQDZ833GOV0l09/nFFXNsXK/rrXFH4yZN9er6AR6G78JSvYhrZdIHf xRQuhXOhkH+xD9ZTuJKrEOCc+78oDoZJATJAgjMzj3wGVf/vt1gjkW323GqyIJ67m2/6 /KQk7wZCXwT4tufL0R9kYDE6CNwuHgntiebQ4GH0j93YjBSUZUIrIOOsfyr6BCMsTp8y y1zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=D43bALHqIk3U79ZyQ0knjGcncJa9vPFS5LB84W1AFEA=; b=Fr93PhmG6V9WX9TCGrHJ7PKt4eVg0IK+4M5b/z3vgjFyo3uKKs74FwO+GOIHhcYKxA W+xWked5J24+CSFJpqnziEseHbRnm9maQ+MzxhvjXhfPSmfZXTTE4zHWvtQeWeBaxNZQ ObZNJajWGluP7Y++q/IohpjLd2fNlM+dIppaXdi7LmCTz6USdlhd/eS+8kYu+FCIWpwm 5EmhkYYuPGtEr2ziy4P12VzxXXC/GX3PAmbqfdK4jFF+8LSANiPpydnOTYxeaeO8hoWc kviwnjm+3Rp1ICO34KKXGtKmXogDL0kFvr/en68eQFzeOaQzaTpmHnxM+JUxpuYUVT1g 5lQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H0Oh5Vnj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne12-20020a17090b374c00b00205eafb9fdbsi8027969pjb.37.2022.10.24.06.35.27; Mon, 24 Oct 2022 06:35: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=H0Oh5Vnj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233008AbiJXNXz (ORCPT + 99 others); Mon, 24 Oct 2022 09:23:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231822AbiJXNW6 (ORCPT ); Mon, 24 Oct 2022 09:22: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 5D2C624083; Mon, 24 Oct 2022 05:29:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 291C8612B3; Mon, 24 Oct 2022 12:27:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37B77C433D7; Mon, 24 Oct 2022 12:27:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614468; bh=13fqtjI0vtQERfNaoLg9PyWP43Gb0mwjx4u9RK6NVrU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H0Oh5VnjahO4av0fg20QPobzmMtDnL4C8GL2GRkdoWdH4jyfs7NUIrtN4VtHV/9Mi S3lygTiD4xGMUVChgN4xf77a4iEewvV39furyPTDDZd5FVV4+eJL1tK2tr6561jnjH Q1YtH3Z89DWNkqKZkEJ/Ly1Y/S0qw+FvH3Mof774= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ye Weihua , Herbert Xu , Sasha Levin Subject: [PATCH 5.10 272/390] crypto: hisilicon/zip - fix mismatch in get/set sgl_sge_nr Date: Mon, 24 Oct 2022 13:31:09 +0200 Message-Id: <20221024113034.510104215@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576204542182490?= X-GMAIL-MSGID: =?utf-8?q?1747576204542182490?= From: Ye Weihua [ Upstream commit d74f9340097a881869c4c22ca376654cc2516ecc ] KASAN reported this Bug: [17619.659757] BUG: KASAN: global-out-of-bounds in param_get_int+0x34/0x60 [17619.673193] Read of size 4 at addr fffff01332d7ed00 by task read_all/1507958 ... [17619.698934] The buggy address belongs to the variable: [17619.708371] sgl_sge_nr+0x0/0xffffffffffffa300 [hisi_zip] There is a mismatch in hisi_zip when get/set the variable sgl_sge_nr. The type of sgl_sge_nr is u16, and get/set sgl_sge_nr by param_get/set_int. Replacing param_get/set_int to param_get/set_ushort can fix this bug. Fixes: f081fda293ffb ("crypto: hisilicon - add sgl_sge_nr module param for zip") Signed-off-by: Ye Weihua Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/hisilicon/zip/zip_crypto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/hisilicon/zip/zip_crypto.c b/drivers/crypto/hisilicon/zip/zip_crypto.c index 08b4660b014c..5db7cdea994a 100644 --- a/drivers/crypto/hisilicon/zip/zip_crypto.c +++ b/drivers/crypto/hisilicon/zip/zip_crypto.c @@ -107,12 +107,12 @@ static int sgl_sge_nr_set(const char *val, const struct kernel_param *kp) if (ret || n == 0 || n > HISI_ACC_SGL_SGE_NR_MAX) return -EINVAL; - return param_set_int(val, kp); + return param_set_ushort(val, kp); } static const struct kernel_param_ops sgl_sge_nr_ops = { .set = sgl_sge_nr_set, - .get = param_get_int, + .get = param_get_ushort, }; static u16 sgl_sge_nr = HZIP_SGL_SGE_NR; From patchwork 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: 9279 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp462935wru; Mon, 24 Oct 2022 06:46:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM75qfFAEvSVVWKT3SpiHNyi3pGUBJDZ7DsGR12hXkB035Y6TCxMWN+wb3A386rSGMiHYN8Q X-Received: by 2002:a63:2155:0:b0:455:7b5b:c2d7 with SMTP id s21-20020a632155000000b004557b5bc2d7mr28024816pgm.309.1666619207661; Mon, 24 Oct 2022 06:46:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619207; cv=none; d=google.com; s=arc-20160816; b=ozLPU7XzfEVAcSYNP1BjAeFI/PlmVsfn+Irbdxl/2bvtycQEVGk5jN6v09eJHXpanP Xhc3eqGf1aDMiwgMEmGzYVyj/uY/R4DL1jm09xDOvq84YQhDDuHQh4+xM0sULz7kNT1u EWWlzWDheqKtKeJhcGJKXqKaeWKYgTILdRYN+FfnlsBC0zEP7nffUFN67dLV2Nyitzmq kcFKOYRkAAgaGNeW3MBG06EJzl6Gl2gGjqwp70koYKsakLFwGEvGmJsw4Aei4atAfv8A xYeUchGFbD7EnuA+0ZPM91xqi33RZgbteMjt+o+CzrZaAMEKXjtnymI09cCEP5ZBSY1w 1QVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JGMzoFWCauJr2CtVUPPX4n6ToV4XjybX+EyPEYqvG6c=; b=mtzRObtRuNPg4D9hEDhbw2rt2kocZ8pwBgdMz7HcxbQGLR1G+QnIpMJ/2HznJkx3oh ni9DIPZjE0ryMMNltuCXsYdObGXdrLyAMjgKIkuGtx9dfFkEsqIXGmvfO0Cs7hYx0iAZ Gzv/Vuh6gZmoeZVEzBUxCgdtlR8Tf7Ra3MwOueQX8LIpXa9k0x1E/7lBHLrGrlaMr0L+ J826Ht1uI+cDFTuRM8aKfFZKTFXpp5WxM/gjLU4UHTG4ZQh/hUIKUqSk9z6SN8bV0/1W 2HnRs2lXo3C8vuM3pGKwdTNLNB3Qfn9tkNLagmtEs6CWXx2EUS1ZvgFchLbQhhsCRKyT uUiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2LYwmQaz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x5-20020a654145000000b0046b3d6b786asi29114226pgp.186.2022.10.24.06.46.33; Mon, 24 Oct 2022 06:46:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2LYwmQaz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236278AbiJXNnT (ORCPT + 99 others); Mon, 24 Oct 2022 09:43:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236874AbiJXNl1 (ORCPT ); Mon, 24 Oct 2022 09:41:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E21788997B; Mon, 24 Oct 2022 05:39: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 B88ED612A5; Mon, 24 Oct 2022 12:27:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5F98C4314D; Mon, 24 Oct 2022 12:27:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614471; bh=ErzLkvRPieZMIDkHWj/wB4j77OLnn1K+rJFllpPoBzQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2LYwmQazhwsg+yPfG5tkbTl22368r5lqm5GiG5NXMzDsZSQvx3P/BcUVmrQd2pWc/ 6yPL2W+zmp1oJ11iYQQmH59eVw8WuaYXCFOzRc151pv1SviJI+GTBZXfQbKydnFLwM wQdGivjSc1ARN7DvHKJaQeYSXfsIIUaPkIBvdzkI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kshitiz Varshney , Herbert Xu , Sasha Levin Subject: [PATCH 5.10 273/390] hwrng: imx-rngc - Moving IRQ handler registering after imx_rngc_irq_mask_clear() Date: Mon, 24 Oct 2022 13:31:10 +0200 Message-Id: <20221024113034.548746044@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576901812241570?= X-GMAIL-MSGID: =?utf-8?q?1747576901812241570?= From: Kshitiz Varshney [ Upstream commit 10a2199caf437e893d9027d97700b3c6010048b7 ] Issue: While servicing interrupt, if the IRQ happens to be because of a SEED_DONE due to a previous boot stage, you end up completing the completion prematurely, hence causing kernel to crash while booting. Fix: Moving IRQ handler registering after imx_rngc_irq_mask_clear() Fixes: 1d5449445bd0 (hwrng: mx-rngc - add a driver for Freescale RNGC) Signed-off-by: Kshitiz Varshney Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/char/hw_random/imx-rngc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) --- a/drivers/char/hw_random/imx-rngc.c +++ b/drivers/char/hw_random/imx-rngc.c @@ -272,13 +272,6 @@ static int imx_rngc_probe(struct platfor goto err; } - ret = devm_request_irq(&pdev->dev, - irq, imx_rngc_irq, 0, pdev->name, (void *)rngc); - if (ret) { - dev_err(rngc->dev, "Can't get interrupt working.\n"); - goto err; - } - init_completion(&rngc->rng_op_done); rngc->rng.name = pdev->name; @@ -292,6 +285,13 @@ static int imx_rngc_probe(struct platfor imx_rngc_irq_mask_clear(rngc); + ret = devm_request_irq(&pdev->dev, + irq, imx_rngc_irq, 0, pdev->name, (void *)rngc); + if (ret) { + dev_err(rngc->dev, "Can't get interrupt working.\n"); + return ret; + } + if (self_test) { ret = imx_rngc_self_test(rngc); if (ret) { From patchwork 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: 9638 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp532641wru; Mon, 24 Oct 2022 09:08:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7011KRKbLj+/ExG/DgxltuERQZZzhSggH1WEN7oZ/rPknUDsS781j3Z78mLiM1S/doK1O8 X-Received: by 2002:a17:907:6d84:b0:78d:f2b0:14c8 with SMTP id sb4-20020a1709076d8400b0078df2b014c8mr27321662ejc.749.1666627700636; Mon, 24 Oct 2022 09:08:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627700; cv=none; d=google.com; s=arc-20160816; b=XkrvTsJNlNeYgWoOz9HNaKAC9k+uyg7q98hSLGtI+8wHoBgIujgOMIlMV/txsHxTKI UEuB/gL19884BhwJMbdLH81TOOqIEzLU3HaQObPeKOeby/jRGNU1LPPA5wuUInSOaPpM fI6VMvaWMN9dxhd2sBPnRYwjEGy/aPApGsjhkfXA3jnqbX0+gM8pC8SVi4XprKrmfFjI 8yrHys+fOo1a6wogJg94ia7Z8IT9P8bKDwSEUq3ZxdFTlxrECfFhXQF8PcNMNHX5WIgv FwFMe+Zv/lEu6HfinsadxmNyHi2+mXgBttrX0zhQpGD4o0ZbT9KCEleICd5li1M7FTgE J16w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7Y+w4tfSYLpFYrzpfNhkYsR/jp8zrZeIK8/gXU3N/W0=; b=earhhC9zW8jz14+eEdt4DAS+3gxhAYyTc/HDVOKMaI3bzbgjo1um/dKpXhQ9zfCq+8 Ep2xt6iZICX2twFV8Ia7xUUg6j+Gw5//rmKkL8cHv7BZ+mOjXjzj9zPBJbEH2U/k/naV 5dfUj1K+rjvUmeV0hJIZbWc1qoD3D7el9t57qw0ulO/UrbORlqFIU4dfAhyTTyBzy7xH SJP3VBmSICL7dY9rRHrPYLbOhWC8Y/IqwE0GPx4RbPeFpbAL/TgYc4XDUSjYTVZL8k81 BR3NLbrW7t+pSl3JSVJ8f2s3KsM5IsZmBfAJNKkMMhlsoBZhB4l0VITWtFMkhcP/0785 IjQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jh9LGlkc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga39-20020a1709070c2700b007835897050asi190770ejc.83.2022.10.24.09.07.55; Mon, 24 Oct 2022 09:08:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jh9LGlkc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233256AbiJXQHR (ORCPT + 99 others); Mon, 24 Oct 2022 12:07:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233099AbiJXQEO (ORCPT ); Mon, 24 Oct 2022 12:04: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 3C43C48C91; Mon, 24 Oct 2022 07:56: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 12AD5B811BE; Mon, 24 Oct 2022 12:27:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62653C433C1; Mon, 24 Oct 2022 12:27:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614473; bh=TSjoHx9SAKNV0MMEJApepwgZRfRkoPzmJXeQfO9jPJ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jh9LGlkc5xR5ChduVwXveTuJ+PXgGMnqLp2Auqg+sM1ZOCkPbO7SCosegAGznxnJZ aMNmE01vl+gVXhoMLSCu2mcAfM/ExOVJ8jTeTGem5I9601vU6dcSRRJH2ROJEGkucq 8RcC4KQcJ7qH4NG7Gu90FDklcTOIjAa5XdaecOGA= 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.10 274/390] cgroup/cpuset: Enable update_tasks_cpumask() on top_cpuset Date: Mon, 24 Oct 2022 13:31:11 +0200 Message-Id: <20221024113034.598799027@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585807896863737?= X-GMAIL-MSGID: =?utf-8?q?1747585807896863737?= 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 b7830f1f1f3a..43270b07b2e0 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -1059,10 +1060,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); } @@ -2016,12 +2025,7 @@ static int update_prstate(struct cpuset *cs, int new_prs) update_flag(CS_CPU_EXCLUSIVE, cs, 0); } - /* - * Update cpumask of parent's tasks except when it is the top - * cpuset as some system daemons cannot be mapped to other CPUs. - */ - if (parent != &top_cpuset) - update_tasks_cpumask(parent); + update_tasks_cpumask(parent); if (parent->child_ecpus_count) update_sibling_cpumasks(parent, cs, &tmpmask); From patchwork 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: 9188 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458596wru; Mon, 24 Oct 2022 06:37:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5h2fGnGLnPxedNnv7Kg7xzKdnA4kSuzWQuewW5zNuWdQ53H64NtLNX44xu874/3BJK3NwM X-Received: by 2002:a17:907:720b:b0:78e:c0e:a434 with SMTP id dr11-20020a170907720b00b0078e0c0ea434mr27663246ejc.741.1666618592372; Mon, 24 Oct 2022 06:36:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618592; cv=none; d=google.com; s=arc-20160816; b=ZHs95gkOH6cIhbFOgMwNsPw/ipKYqlCrbyeDmQkS/BSWQK9bwb1kC+JzXsiyGPfL5w b+TxHIZ0hcojMmHBrdVZXChUcA1I9G/ZGrKlHRVX5r5YuJd2pd/GANicFtSaXgCx/NlT jqKnwQgFm1Yom0QMjyaE9W2lDl6tC32Qf2rdqzfIrcHGWcINZXsRqErOCG/yrDWIQDma 8Nxah8jTSJaOaYe4Vq/6HVjYs6D5bNGOvhPv4Lml90ZXZdT4La2IimTieKvl8TwmU/BW VkblaC3sqe4xHMQM4EPDzGNX59MKmocB2voxd36JdJxfgji55LTLnYJrTTL1/x1QYxYV k9DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=jVtsyLKx+fdSxnLDtxnpQfnzmP8uLpkNuSiNpxnkIMhPPZX79J2LqPdZ+xVWsNttBa nQVxnGQkx36DzWWi856piwjfuMW2mhR/ZvJdk454W0ObvwNWO4JiLIIeD+xRVahJyLAC NTbz2LsyAgGT/xO4Y0vW3Qt/EmS5NX0iJDN32wxR63qtQs4hfLCip4bmi8CN948VHouJ kcqOtoZCWMFiof6SyQpN0tMo+moByKLnLJ/3HdHC1e/IPofbBDQerRKErJvkO87SNAfU xC8iExiS41BkgK+0LUYT3GY7LZaFxUhm2MyhsCz6c70nPW+1iDL1wwNdDTlsThMeofTb HKHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k5uMHShr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hw8-20020a170907a0c800b00787d0dfe70csi26004112ejc.981.2022.10.24.06.36.06; Mon, 24 Oct 2022 06:36: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=k5uMHShr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231319AbiJXNZs (ORCPT + 99 others); Mon, 24 Oct 2022 09:25:48 -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 S234058AbiJXNXB (ORCPT ); Mon, 24 Oct 2022 09:23:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C6A12F397; Mon, 24 Oct 2022 05:29:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D997A612E9; Mon, 24 Oct 2022 12:27:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC516C433D6; Mon, 24 Oct 2022 12:27:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614476; bh=AlKGxA5oHb1mhMs88++LuDXBhLryEnVpofotGpHubyE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k5uMHShrY1q2NtApzvhZieoSnKLhkEktpFNG9HOCNpVmRTYp0JEIrwk+6au1sjCvM FcPfkEKiY7SA4l5UtX1jRcxclubOGDFJ8GB2JKsnwp0hpAcPur8+KcyBvawluaWahm Zw0nXrV6yWiRQK3+m+ZPdxvvV1np83CQwW5GXnPc= 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.10 275/390] iommu/omap: Fix buffer overflow in debugfs Date: Mon, 24 Oct 2022 13:31:12 +0200 Message-Id: <20221024113034.648307904@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576257362181629?= X-GMAIL-MSGID: =?utf-8?q?1747576257362181629?= 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: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: 9895 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp572613wru; Mon, 24 Oct 2022 10:35:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7wCK7htwx7y9VJWGAhEXhV1n2ZvOzC7RqilZF89kzgaI9lsWZWbSJ6VOQXIKVBqCU9K4og X-Received: by 2002:a17:902:f54f:b0:186:a987:c733 with SMTP id h15-20020a170902f54f00b00186a987c733mr6290758plf.170.1666632943248; Mon, 24 Oct 2022 10:35:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666632943; cv=none; d=google.com; s=arc-20160816; b=J+O6olbvJXwkuVqUEHNgZ5E1y7skbnLWmRM+Hfmn69F6XtFecqsdFbPrbj801Zi6gA PhpuRsc0Jg4if+xzqtRuWJ5tmmKTpzbOeOfMg3nspCCtjaj+oLp7KlHpRYAqwRcTEqgW 8jj6vHeuX21MCw6HHp0Pc8kXHAU/8gbU8YMxwoAVbtcfBRlyl39W40EhnX8merJECaEe y8H6GwklsRJncBwgdW3d8oN0RCh5G2hnMn8jk8x1Tit8QR8z2DKXGn26+dElKgoGCtE+ fKDlaoUKFizQ8UDYszN9O877THAxfhq2uXLZtH3SeX0YK0FrK1IRsOMyPmw5DwrGW+0L //eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=s4TDZAiNiYSUYVklnJSXPar7Ef7VYkLcVSdzRuKqZDE=; b=mwZef2uatl3ocLOQyxMH+FOO5LIBYnk09okKme4OTNvPPyKq738TxIjj/b8eFZuy/j Adu+wJHLgiGB5Eab+5c8MyTEfi81nw+DgTzq37RACbbjoW8oB0LqJbCAqCPTaxam2JCB C8EE0jIgybKFiYn0wlTWJ++xFFIQzu0xVZiiDmfelEQ/hUJ+mivf5WLobfmTr+PuE62K 5BsC2Kk9Yaaitk40iRdoklzNRuBQngGwIv8oQ/ejWsEjN2j/OBQB+Fk+xb0eBQclNuiK O/olq+KsHcwISwUHt6FS9C2KgFOmsIDywQYUmh8gpUnCeh2ooTVhmElQw6CB7G3k9Fft PrmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QPYW0c3N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y12-20020a1709027c8c00b001869581f7eesi105642pll.154.2022.10.24.10.35.28; Mon, 24 Oct 2022 10:35:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QPYW0c3N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233428AbiJXRdD (ORCPT + 99 others); Mon, 24 Oct 2022 13:33:03 -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 S231709AbiJXRcJ (ORCPT ); Mon, 24 Oct 2022 13:32: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 9F3E412AFB; Mon, 24 Oct 2022 09:07: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 2F0B8B81687; Mon, 24 Oct 2022 12:28:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CB7CC433D6; Mon, 24 Oct 2022 12:27:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614478; bh=NI1fBXPVYlDZ4B6j6GMBIhhEi5k4CLiLesxDmWTMZN8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QPYW0c3NgrtsaZFLCqMr93Vr4BPK5MGD5LW4MlgcxowgJ+8TC2gNOZyEwFFByg+1p BvemKqfuf3ztEpPs8AOeZXyAxc+PfXe+xpJ3GDVZ3z68wrSChk62vCUrMYIyl3tJkq V3a9SnT6jewY4jiz7njhQeJNkVUQ+J40TEflAqTw= 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.10 276/390] crypto: akcipher - default implementation for setting a private key Date: Mon, 24 Oct 2022 13:31:13 +0200 Message-Id: <20221024113034.686505466@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747591305375765298?= X-GMAIL-MSGID: =?utf-8?q?1747591305375765298?= From: Ignat Korchagin [ Upstream commit bc155c6c188c2f0c5749993b1405673d25a80389 ] Changes from v1: * removed the default implementation from set_pub_key: it is assumed that an implementation must always have this callback defined as there are no use case for an algorithm, which doesn't need a public key Many akcipher implementations (like ECDSA) support only signature verifications, so they don't have all callbacks defined. Commit 78a0324f4a53 ("crypto: akcipher - default implementations for request callbacks") introduced default callbacks for sign/verify operations, which just return an error code. However, these are not enough, because before calling sign the caller would likely call set_priv_key first on the instantiated transform (as the in-kernel testmgr does). This function does not have a default stub, so the kernel crashes, when trying to set a private key on an akcipher, which doesn't support signature generation. I've noticed this, when trying to add a KAT vector for ECDSA signature to the testmgr. With this patch the testmgr returns an error in dmesg (as it should) instead of crashing the kernel NULL ptr dereference. Fixes: 78a0324f4a53 ("crypto: akcipher - default implementations for request callbacks") Signed-off-by: Ignat Korchagin Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- crypto/akcipher.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crypto/akcipher.c b/crypto/akcipher.c index f866085c8a4a..ab975a420e1e 100644 --- a/crypto/akcipher.c +++ b/crypto/akcipher.c @@ -120,6 +120,12 @@ static int akcipher_default_op(struct akcipher_request *req) return -ENOSYS; } +static int akcipher_default_set_key(struct crypto_akcipher *tfm, + const void *key, unsigned int keylen) +{ + return -ENOSYS; +} + int crypto_register_akcipher(struct akcipher_alg *alg) { struct crypto_alg *base = &alg->base; @@ -132,6 +138,8 @@ int crypto_register_akcipher(struct akcipher_alg *alg) alg->encrypt = akcipher_default_op; if (!alg->decrypt) alg->decrypt = akcipher_default_op; + if (!alg->set_priv_key) + alg->set_priv_key = akcipher_default_set_key; akcipher_prepare_alg(alg); return crypto_register_alg(base); From patchwork 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: 9625 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp531817wru; Mon, 24 Oct 2022 09:07:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5+74DrLu77t0aA1DI7XSGX9HECuTaanyF3O1k1NTUTEGjscXLXy9I7mAIDE2BM83gfUTGU X-Received: by 2002:a17:906:9bc3:b0:78d:816f:3743 with SMTP id de3-20020a1709069bc300b0078d816f3743mr28736311ejc.380.1666627624946; Mon, 24 Oct 2022 09:07:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627624; cv=none; d=google.com; s=arc-20160816; b=ONduCPBF03Bz8E2re7GEpq+5MouozgYOU5HO8dVAdiYP89Y2b/qlIDg24Q8hU/GB94 ZT0oTA4QC7iUrx+4xHqIptt/djPQCLmE1loyVR7QNr+HP0sKFyjvco3lW1XsUk7xf7Iv 9Vx7/VPb/Da850WPN9Uibo61suYTkbLxTyanTXpsz+MWx8dtNRnJabSWmWzHbontn/2m +hhr7UUJddcYR4dy/HKNZI22LYv+L1yyDvmUvoCDVlRPcBF6Tjh+xJAaC9gLNqvPTEEh RdjcJk1QNO8IXse2YdJWnz2gVASFVwzVGEFL9p3MPXAWc0DHUqxRffwvMHqeXmT+PGRJ D3vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=rv1+GHq/TpyE4AmfjA+cz8hLnAwkI50b+JSKa54We4jWeuJla8IlulCDb1nfLzg0Ms RILmLdbULDhcaZwF/cSnMY/99v16WVzlKOO1N+HH9IILgRAoWB0hRLTU8zut8Ti8UbEM XmJ/Oir6ocU9IMnM5n+iYnK6j0/Cdh1vXmo64s/0Y1YkcJ45wrL7YIvkztRQH8hOJxNs OOohOS+LNwidulEf0vgzLhkC0tivT6qB6HBHJdPzuVnMwmfTm9y2P/NDmcawWrksOZGJ cO8emc9odfxJImklztBkIJmhnON4MQmrCUhd7XEMshR2ExNCdeFNdauFj2j7i/aPiavD Be4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NaMT7sFm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rv20-20020a17090710d400b00780a882d337si104578ejb.480.2022.10.24.09.06.36; Mon, 24 Oct 2022 09:07:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NaMT7sFm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232896AbiJXQGD (ORCPT + 99 others); Mon, 24 Oct 2022 12:06:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232790AbiJXQDY (ORCPT ); Mon, 24 Oct 2022 12:03: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 A7CA21E099B; Mon, 24 Oct 2022 07:56: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 C4F68B8168A; Mon, 24 Oct 2022 12:28:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C6C7C433C1; Mon, 24 Oct 2022 12:28:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614481; bh=LFrupX4v25cr6gY6G5bOu9JuHOtT4txHADScSlAhRDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NaMT7sFmGDIflHR+w2TU4YowiFiYEFqWHYAO7hwlyyzWfoN640UdXcn8SQoHH3zkP zcMyeqZtQ0WxDptQEVE2UK9wIcVISn3ay5eGVvTMIz7Nb7hz019xc6LbglbW5A2cCx AHogY7Os8lmymaURdKocsHA+7gH2hwHneacWfyi0= 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.10 277/390] crypto: ccp - Release dma channels before dmaengine unrgister Date: Mon, 24 Oct 2022 13:31:14 +0200 Message-Id: <20221024113034.731136500@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585728445587985?= X-GMAIL-MSGID: =?utf-8?q?1747585728445587985?= 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: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: 9136 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457484wru; Mon, 24 Oct 2022 06:36:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6uuGFJPyD9w78SyHpNzZKchSgIclt6A7L/HGQ0WyUTgFIfB/MQzErWWYjf6M49rYM+7ywC X-Received: by 2002:a05:6402:1454:b0:461:9b5c:2fbc with SMTP id d20-20020a056402145400b004619b5c2fbcmr8465086edx.276.1666618566324; Mon, 24 Oct 2022 06:36:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618566; cv=none; d=google.com; s=arc-20160816; b=r+kMvwU6rIdxRK+GnGedHmttyBfFLKxXNNL2uW+T+xbgCmjnjSGJAk31hfPfHT2Cas 66pNdPvUoyK7Qx6dFeQj1oPalenfIEp4927hiDQ3xqp5z4WhGlXDkixU5Lx2yrPeRQGU f+J5wucvTZZdGaDYF/51QYzK+BL3eulUoEYb2qTjCZeGRVcfxOGqggJnOrMWa+Hv3ogO N03QftR/ulgBsdUcsqrE75Z9LCrGmaOeaGT9nGqY83drBElVWGmII+R+eSyMwp4cqUq0 NMNoKWRHssaffITDg4N6cs295MxQkR1R2ehgKqWlF3dbHPLKBBSKhq5ZONVQbDYK5yNZ 9dFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VN86ii+jcQXjsjJaXXsqLICrV2cLCqYX8NVHkANN/f8=; b=hcUX97w1GpGRcVwFk1NfkHEt/5cDEXn9gQwgAv3VB3pRw5kr2eIflwWYOZRThDbrBp 0emi60GQTVWzzaMm4l3l5wcVj53coYQ76MaWMXgwimmml4FJTBeTnPrYVBLnUVDSLUGq LKVPA6yCg3LcEeFb2bTtTC69BkJVfAmRtEUFgdkZTNoftKvBtvsKiQ2dHd3mDf11bpLB bqtp3ruoBh5yioOAI53dCDwc+YggYO5JZS25mFsdKYBA719aHaiDokj9Jb/uCxQuAaiS pm4J10ISSlrvnu+vbiZHKCanvCeWD8Q/v/U0khWGJ+nVCWTSfeDu5LVaB+FkJSQjlJMK L9qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Yur83e5C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp19-20020a170906c15300b0078c47b4478esi25972275ejc.106.2022.10.24.06.35.27; Mon, 24 Oct 2022 06:36:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Yur83e5C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231573AbiJXNXi (ORCPT + 99 others); Mon, 24 Oct 2022 09:23:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233288AbiJXNWx (ORCPT ); Mon, 24 Oct 2022 09:22: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 0C532399DE; Mon, 24 Oct 2022 05:30: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 AC1FC61014; Mon, 24 Oct 2022 12:28:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC4E9C433D6; Mon, 24 Oct 2022 12:28:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614484; bh=jr0TCbRMOB4Q39OQ40nhj67XsnQMm/VmhlxlIuIiE0g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yur83e5CbNXTzJ2vFBc74mbHYM10Z3IUfmOrOG3cvKItUSopviUf04iab0TSKlXeg XXvnKFOaTPA5kGPE21ECzx/pgg93y20gkQGHpD115B08xGPd8zqAN0LJkyQ8JbeXPd P5sM/0MVlY/eQq3A48bW59slht0Eyvu9+ey/vZhE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Harliman Liem , Antoine Tenart , Herbert Xu , Sasha Levin Subject: [PATCH 5.10 278/390] crypto: inside-secure - Change swab to swab32 Date: Mon, 24 Oct 2022 13:31:15 +0200 Message-Id: <20221024113034.779350726@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576229857889332?= X-GMAIL-MSGID: =?utf-8?q?1747576229857889332?= From: Peter Harliman Liem [ Upstream commit 664593407e936b6438fbfaaf98876910fd31cf9a ] The use of swab() is causing failures in 64-bit arch, as it translates to __swab64() instead of the intended __swab32(). It eventually causes wrong results in xcbcmac & cmac algo. Fixes: 78cf1c8bfcb8 ("crypto: inside-secure - Move ipad/opad into safexcel_context") Signed-off-by: Peter Harliman Liem Acked-by: Antoine Tenart Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/inside-secure/safexcel_hash.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/inside-secure/safexcel_hash.c b/drivers/crypto/inside-secure/safexcel_hash.c index 56d5ccb5cc00..1c9af02eb63b 100644 --- a/drivers/crypto/inside-secure/safexcel_hash.c +++ b/drivers/crypto/inside-secure/safexcel_hash.c @@ -381,7 +381,7 @@ static int safexcel_ahash_send_req(struct crypto_async_request *async, int ring, u32 x; x = ipad[i] ^ ipad[i + 4]; - cache[i] ^= swab(x); + cache[i] ^= swab32(x); } } cache_len = AES_BLOCK_SIZE; @@ -819,7 +819,7 @@ static int safexcel_ahash_final(struct ahash_request *areq) u32 *result = (void *)areq->result; /* K3 */ - result[i] = swab(ctx->base.ipad.word[i + 4]); + result[i] = swab32(ctx->base.ipad.word[i + 4]); } areq->result[0] ^= 0x80; // 10- padding crypto_cipher_encrypt_one(ctx->kaes, areq->result, areq->result); @@ -2104,7 +2104,7 @@ static int safexcel_xcbcmac_setkey(struct crypto_ahash *tfm, const u8 *key, crypto_cipher_encrypt_one(ctx->kaes, (u8 *)key_tmp + AES_BLOCK_SIZE, "\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3"); for (i = 0; i < 3 * AES_BLOCK_SIZE / sizeof(u32); i++) - ctx->base.ipad.word[i] = swab(key_tmp[i]); + ctx->base.ipad.word[i] = swab32(key_tmp[i]); crypto_cipher_clear_flags(ctx->kaes, CRYPTO_TFM_REQ_MASK); crypto_cipher_set_flags(ctx->kaes, crypto_ahash_get_flags(tfm) & @@ -2187,7 +2187,7 @@ static int safexcel_cmac_setkey(struct crypto_ahash *tfm, const u8 *key, return ret; for (i = 0; i < len / sizeof(u32); i++) - ctx->base.ipad.word[i + 8] = swab(aes.key_enc[i]); + ctx->base.ipad.word[i + 8] = swab32(aes.key_enc[i]); /* precompute the CMAC key material */ crypto_cipher_clear_flags(ctx->kaes, CRYPTO_TFM_REQ_MASK); From patchwork 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: 9220 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp459335wru; Mon, 24 Oct 2022 06:39:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5aqR1m8546Taqr0mtIx5CSOSITEu6z8TQuAF8bja6Gy9nSaK4TV3Bjn7iAH6NRgcDu8Lai X-Received: by 2002:a05:6402:3512:b0:461:e146:d2e7 with SMTP id b18-20020a056402351200b00461e146d2e7mr2666694edd.39.1666618762708; Mon, 24 Oct 2022 06:39:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618762; cv=none; d=google.com; s=arc-20160816; b=pTo75ehi7NHWZE/5QERlhWM9P4gw16j2DF4w6sbzP13dSJUMD88CULsW3C8cUWsa8U 0D6Jn1T+sxLLtPIqj2AlXq3VN9MF2Y2IhhbKVTIJQ7gKo6Te0veldNnPf+W6q6mauFpe w9zac4Og7CRR3MkwJpbMrGVo7UvNFasUSDKuT0qEQrbaxly5kL9nmeDY+NvMVAzFz+sL IVHcomfdz1RyGdHP+eEk4j0La5PMW3bNL0EEyHM7/dgidA6lnPxDzxmSqhtgrn+Y7c2X GHjVSK7PHwJPtNYfVdY/aZ7KUXgn2g8j1XHaB38sgH6i1VY9A1QK4mGO2+KHSjBSHyT5 E9yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6kpELCebdJjpwFuh9SY6oV768YuUFhCRFDl5vimlQNE=; b=itnL7j55Gces2R65f45rYQMBdoWo97Om1QUCVneSVj4WIufCU94/by5GBEYBhxJSQV WYxokErEJe1GkEyID+cyN0MCsbqtwwmik+WBKh1P2Z1yk0FJQo9iUVlehRzMJSeF/Qaj 9pqdkSDFN1twkYod1UAzKa31/1cd3xDJZBBrV9lVvq+2kiHFyOJVro/g5LsxrbpBBg71 MDFbmrCH305GglmYHHeWuUkBn4EG662IAulfg3qX6SDJhSEgDE261HPsdMogQ+HuNHMB uvNi8DJStp+haXS5BJz7G45KSFMAitpoK3b71tqsazTsIweG3rwQ9c2OpkUwYUUg0Xt1 DueQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A3Gk6v6H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw5-20020a1709066a0500b00787aba35b7asi26344942ejc.102.2022.10.24.06.38.56; Mon, 24 Oct 2022 06:39:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A3Gk6v6H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230121AbiJXNda (ORCPT + 99 others); Mon, 24 Oct 2022 09:33:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236087AbiJXN3f (ORCPT ); Mon, 24 Oct 2022 09:29: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 1E324AC284; Mon, 24 Oct 2022 05: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 dfw.source.kernel.org (Postfix) with ESMTPS id 4CBE4612EA; Mon, 24 Oct 2022 12:28:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EE4FC433C1; Mon, 24 Oct 2022 12:28:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614486; bh=rOZy5jmHipFrh/N8gaOxnhHAc/Cy3p/sYUSneBQ699w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A3Gk6v6H8Dy3idm1DU5qyn20PdnWM1EvN/GYXvmFAf5dsaoJxJJ2uyrX+pwteSEsm r136orKZXkPrZEWlRQm11IFdZalV/try7mAKzZojdU83RqXRM8S6pS+Sf/ytXD/GUh 8OQiP2V31H6pBb94/Udvfe0aa3CoOEd81f+gVE8U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hui Tang , kernel test robot , Dan Carpenter , Herbert Xu , Sasha Levin Subject: [PATCH 5.10 279/390] crypto: qat - fix use of dma_map_single Date: Mon, 24 Oct 2022 13:31:16 +0200 Message-Id: <20221024113034.829454728@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576435631815480?= X-GMAIL-MSGID: =?utf-8?q?1747576435631815480?= From: Hui Tang [ Upstream commit 7cc05071f930a631040fea16a41f9d78771edc49 ] DMA_TO_DEVICE synchronisation must be done after the last modification of the memory region by the software and before it is handed off to the device. Signed-off-by: Hui Tang Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Herbert Xu Stable-dep-of: cf5bb835b7c8 ("crypto: qat - fix DMA transfer direction") Signed-off-by: Sasha Levin --- drivers/crypto/qat/qat_common/qat_algs.c | 27 ++++++++++++------------ 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/crypto/qat/qat_common/qat_algs.c b/drivers/crypto/qat/qat_common/qat_algs.c index 06abe1e2074e..8625e299d445 100644 --- a/drivers/crypto/qat/qat_common/qat_algs.c +++ b/drivers/crypto/qat/qat_common/qat_algs.c @@ -669,8 +669,8 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, int n = sg_nents(sgl); struct qat_alg_buf_list *bufl; struct qat_alg_buf_list *buflout = NULL; - dma_addr_t blp; - dma_addr_t bloutp; + dma_addr_t blp = DMA_MAPPING_ERROR; + dma_addr_t bloutp = DMA_MAPPING_ERROR; struct scatterlist *sg; size_t sz_out, sz = struct_size(bufl, bufers, n + 1); @@ -685,10 +685,6 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, for_each_sg(sgl, sg, n, i) bufl->bufers[i].addr = DMA_MAPPING_ERROR; - blp = dma_map_single(dev, bufl, sz, DMA_TO_DEVICE); - if (unlikely(dma_mapping_error(dev, blp))) - goto err_in; - for_each_sg(sgl, sg, n, i) { int y = sg_nctr; @@ -704,6 +700,9 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, sg_nctr++; } bufl->num_bufs = sg_nctr; + blp = dma_map_single(dev, bufl, sz, DMA_TO_DEVICE); + if (unlikely(dma_mapping_error(dev, blp))) + goto err_in; qat_req->buf.bl = bufl; qat_req->buf.blp = blp; qat_req->buf.sz = sz; @@ -723,9 +722,6 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, for_each_sg(sglout, sg, n, i) bufers[i].addr = DMA_MAPPING_ERROR; - bloutp = dma_map_single(dev, buflout, sz_out, DMA_TO_DEVICE); - if (unlikely(dma_mapping_error(dev, bloutp))) - goto err_out; for_each_sg(sglout, sg, n, i) { int y = sg_nctr; @@ -742,6 +738,9 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, } buflout->num_bufs = sg_nctr; buflout->num_mapped_bufs = sg_nctr; + bloutp = dma_map_single(dev, buflout, sz_out, DMA_TO_DEVICE); + if (unlikely(dma_mapping_error(dev, bloutp))) + goto err_out; qat_req->buf.blout = buflout; qat_req->buf.bloutp = bloutp; qat_req->buf.sz_out = sz_out; @@ -753,17 +752,21 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, return 0; err_out: + if (!dma_mapping_error(dev, bloutp)) + dma_unmap_single(dev, bloutp, sz_out, DMA_TO_DEVICE); + n = sg_nents(sglout); for (i = 0; i < n; i++) if (!dma_mapping_error(dev, buflout->bufers[i].addr)) dma_unmap_single(dev, buflout->bufers[i].addr, buflout->bufers[i].len, DMA_BIDIRECTIONAL); - if (!dma_mapping_error(dev, bloutp)) - dma_unmap_single(dev, bloutp, sz_out, DMA_TO_DEVICE); kfree(buflout); err_in: + if (!dma_mapping_error(dev, blp)) + dma_unmap_single(dev, blp, sz, DMA_TO_DEVICE); + n = sg_nents(sgl); for (i = 0; i < n; i++) if (!dma_mapping_error(dev, bufl->bufers[i].addr)) @@ -771,8 +774,6 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, bufl->bufers[i].len, DMA_BIDIRECTIONAL); - if (!dma_mapping_error(dev, blp)) - dma_unmap_single(dev, blp, sz, DMA_TO_DEVICE); kfree(bufl); dev_err(dev, "Failed to map buf for dma\n"); 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: 9628 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp531986wru; Mon, 24 Oct 2022 09:07:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4CklDdjTVXyFKdamv3bVLbcZ7GJhvJwOLjui7rnH7/MddmkLNXI7K5/DKU0i0jo66FzKSt X-Received: by 2002:a17:906:9be6:b0:7aa:4186:c10c with SMTP id de38-20020a1709069be600b007aa4186c10cmr2627414ejc.137.1666627639739; Mon, 24 Oct 2022 09:07:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627639; cv=none; d=google.com; s=arc-20160816; b=epesOk6nwVSPUHQSwJyJei/imxF2mKs28Sq3PhH+Wi+jvsAb95shaMqag3SjgARoj9 exmOZl99VIQ+Lmm1/qMtoIWJKc4HnWAfZNUj7TcLBIylr8v9XG45fWbF7REzveOXzeJJ /9mprSYcGiyxJdBdDnRt3LveikXGfWPmLayaiet03yURVCmvWTumkMrztNtOuj6T3PiE a0qmMk5jq7bj0geGd0b2S1BUBLSvtNrTiDj+ZXba+pmXyHrSJs21abnHkbjWBEuEXPm5 RMD0scjJaYQ74/ad3MdC/FO3XeeC56u8/mig9dxi7I9PZPpJpepMtYsaulb6AD6+W33z P10g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cLGFOT1/SrQf8bvP++em+FamnNGaR+gSWvmOHAetBX4=; b=Gz/VQXeF0z+haQQXb819zP2uqu6z9TFZlwAhYXANiB+oStYu8gG2t3VzKOzbHtXeOF 9jFIGxcCVRvStMGfDf+dFQRorLP4XhFncGTBZJPGr8QNMVqnBKjSpKuEvvUXnoBFtSnw +mnEUITyoY9DWabgUThyFH5rQny/2tquC2/Pq/KJ+hjajpmWE7s2WbCq8FqhogzaqOOc MpIOzCNMWJkQbVGWYxmopQ4laDVsc9awPMzbb9zzlJnWaj7xogEobOMaV9ggWRK0QTI2 3b7o31kkWAW5x7Qr29rgeMqX+XHTYxxQGAg7bxvlIJiD67xrXgsFTO5RuzukcvGsmhLd DtCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QzvAjHny; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h27-20020a0564020e9b00b0045ccd2c9944si146001eda.233.2022.10.24.09.06.53; Mon, 24 Oct 2022 09:07: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=QzvAjHny; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232997AbiJXQFw (ORCPT + 99 others); Mon, 24 Oct 2022 12:05:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232797AbiJXQDZ (ORCPT ); Mon, 24 Oct 2022 12:03: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 10ECE19C26; Mon, 24 Oct 2022 07:56: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 3BE57B81691; Mon, 24 Oct 2022 12:28:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97A66C433C1; Mon, 24 Oct 2022 12:28:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614492; bh=I3APEIYWgiuxW3IfB7AeNLgtgSLLQmSp+8yJX6jJapw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QzvAjHny1S0tb3+OFlyhge+NDVc7vuDyI509ujBlD19i/9AQgS3wGtuqLxGSOYRH5 o6YmIaugLzaBQD+A57TJZjzqyBEdSG4P+eTnSt17fK0fmCdDMdmW0fKxujbalfEBqr Vxe6xtHG7LSeuvO9zvMY0pMgqj3TYqwPORzvUWcs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Giovanni Cabiddu , Marco Chiappero , Wojciech Ziemba , Herbert Xu , Sasha Levin Subject: [PATCH 5.10 280/390] crypto: qat - use pre-allocated buffers in datapath Date: Mon, 24 Oct 2022 13:31:17 +0200 Message-Id: <20221024113034.870903436@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585743557231376?= X-GMAIL-MSGID: =?utf-8?q?1747585743557231376?= From: Giovanni Cabiddu [ Upstream commit e0831e7af4e03f2715de102e18e9179ec0a81562 ] In order to do DMAs, the QAT device requires that the scatterlist structures are mapped and translated into a format that the firmware can understand. This is defined as the composition of a scatter gather list (SGL) descriptor header, the struct qat_alg_buf_list, plus a variable number of flat buffer descriptors, the struct qat_alg_buf. The allocation and mapping of these data structures is done each time a request is received from the skcipher and aead APIs. In an OOM situation, this behaviour might lead to a dead-lock if an allocation fails. Based on the conversation in [1], increase the size of the aead and skcipher request contexts to include an SGL descriptor that can handle a maximum of 4 flat buffers. If requests exceed 4 entries buffers, memory is allocated dynamically. [1] https://lore.kernel.org/linux-crypto/20200722072932.GA27544@gondor.apana.org.au/ Cc: stable@vger.kernel.org Fixes: d370cec32194 ("crypto: qat - Intel(R) QAT crypto interface") Reported-by: Mikulas Patocka Signed-off-by: Giovanni Cabiddu Reviewed-by: Marco Chiappero Reviewed-by: Wojciech Ziemba Signed-off-by: Herbert Xu Stable-dep-of: cf5bb835b7c8 ("crypto: qat - fix DMA transfer direction") Signed-off-by: Sasha Levin --- drivers/crypto/qat/qat_common/qat_algs.c | 64 +++++++++++++--------- drivers/crypto/qat/qat_common/qat_crypto.h | 24 ++++++++ 2 files changed, 61 insertions(+), 27 deletions(-) diff --git a/drivers/crypto/qat/qat_common/qat_algs.c b/drivers/crypto/qat/qat_common/qat_algs.c index 8625e299d445..2e2c2ac53609 100644 --- a/drivers/crypto/qat/qat_common/qat_algs.c +++ b/drivers/crypto/qat/qat_common/qat_algs.c @@ -34,19 +34,6 @@ static DEFINE_MUTEX(algs_lock); static unsigned int active_devs; -struct qat_alg_buf { - u32 len; - u32 resrvd; - u64 addr; -} __packed; - -struct qat_alg_buf_list { - u64 resrvd; - u32 num_bufs; - u32 num_mapped_bufs; - struct qat_alg_buf bufers[]; -} __packed __aligned(64); - /* Common content descriptor */ struct qat_alg_cd { union { @@ -644,7 +631,10 @@ static void qat_alg_free_bufl(struct qat_crypto_instance *inst, bl->bufers[i].len, DMA_BIDIRECTIONAL); dma_unmap_single(dev, blp, sz, DMA_TO_DEVICE); - kfree(bl); + + if (!qat_req->buf.sgl_src_valid) + kfree(bl); + if (blp != blpout) { /* If out of place operation dma unmap only data */ int bufless = blout->num_bufs - blout->num_mapped_bufs; @@ -655,7 +645,9 @@ static void qat_alg_free_bufl(struct qat_crypto_instance *inst, DMA_BIDIRECTIONAL); } dma_unmap_single(dev, blpout, sz_out, DMA_TO_DEVICE); - kfree(blout); + + if (!qat_req->buf.sgl_dst_valid) + kfree(blout); } } @@ -672,15 +664,24 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, dma_addr_t blp = DMA_MAPPING_ERROR; dma_addr_t bloutp = DMA_MAPPING_ERROR; struct scatterlist *sg; - size_t sz_out, sz = struct_size(bufl, bufers, n + 1); + size_t sz_out, sz = struct_size(bufl, bufers, n); + int node = dev_to_node(&GET_DEV(inst->accel_dev)); if (unlikely(!n)) return -EINVAL; - bufl = kzalloc_node(sz, GFP_ATOMIC, - dev_to_node(&GET_DEV(inst->accel_dev))); - if (unlikely(!bufl)) - return -ENOMEM; + qat_req->buf.sgl_src_valid = false; + qat_req->buf.sgl_dst_valid = false; + + if (n > QAT_MAX_BUFF_DESC) { + bufl = kzalloc_node(sz, GFP_ATOMIC, node); + if (unlikely(!bufl)) + return -ENOMEM; + } else { + bufl = &qat_req->buf.sgl_src.sgl_hdr; + memset(bufl, 0, sizeof(struct qat_alg_buf_list)); + qat_req->buf.sgl_src_valid = true; + } for_each_sg(sgl, sg, n, i) bufl->bufers[i].addr = DMA_MAPPING_ERROR; @@ -711,12 +712,18 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, struct qat_alg_buf *bufers; n = sg_nents(sglout); - sz_out = struct_size(buflout, bufers, n + 1); + sz_out = struct_size(buflout, bufers, n); sg_nctr = 0; - buflout = kzalloc_node(sz_out, GFP_ATOMIC, - dev_to_node(&GET_DEV(inst->accel_dev))); - if (unlikely(!buflout)) - goto err_in; + + if (n > QAT_MAX_BUFF_DESC) { + buflout = kzalloc_node(sz_out, GFP_ATOMIC, node); + if (unlikely(!buflout)) + goto err_in; + } else { + buflout = &qat_req->buf.sgl_dst.sgl_hdr; + memset(buflout, 0, sizeof(struct qat_alg_buf_list)); + qat_req->buf.sgl_dst_valid = true; + } bufers = buflout->bufers; for_each_sg(sglout, sg, n, i) @@ -761,7 +768,9 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, dma_unmap_single(dev, buflout->bufers[i].addr, buflout->bufers[i].len, DMA_BIDIRECTIONAL); - kfree(buflout); + + if (!qat_req->buf.sgl_dst_valid) + kfree(buflout); err_in: if (!dma_mapping_error(dev, blp)) @@ -774,7 +783,8 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, bufl->bufers[i].len, DMA_BIDIRECTIONAL); - kfree(bufl); + if (!qat_req->buf.sgl_src_valid) + kfree(bufl); dev_err(dev, "Failed to map buf for dma\n"); return -ENOMEM; diff --git a/drivers/crypto/qat/qat_common/qat_crypto.h b/drivers/crypto/qat/qat_common/qat_crypto.h index 12682d1e9f5f..5f9328201ba4 100644 --- a/drivers/crypto/qat/qat_common/qat_crypto.h +++ b/drivers/crypto/qat/qat_common/qat_crypto.h @@ -20,6 +20,26 @@ struct qat_crypto_instance { atomic_t refctr; }; +#define QAT_MAX_BUFF_DESC 4 + +struct qat_alg_buf { + u32 len; + u32 resrvd; + u64 addr; +} __packed; + +struct qat_alg_buf_list { + u64 resrvd; + u32 num_bufs; + u32 num_mapped_bufs; + struct qat_alg_buf bufers[]; +} __packed; + +struct qat_alg_fixed_buf_list { + struct qat_alg_buf_list sgl_hdr; + struct qat_alg_buf descriptors[QAT_MAX_BUFF_DESC]; +} __packed __aligned(64); + struct qat_crypto_request_buffs { struct qat_alg_buf_list *bl; dma_addr_t blp; @@ -27,6 +47,10 @@ struct qat_crypto_request_buffs { dma_addr_t bloutp; size_t sz; size_t sz_out; + bool sgl_src_valid; + bool sgl_dst_valid; + struct qat_alg_fixed_buf_list sgl_src; + struct qat_alg_fixed_buf_list sgl_dst; }; struct qat_crypto_request; 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: 10127 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp633683wru; Mon, 24 Oct 2022 13:15:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5IlU7KeMAsvQt6uOUBM3h9INmvDIhcoHKVv4gfTYUdzqiZDikIY6/SIMIk+qdIuk3fId75 X-Received: by 2002:a17:90b:33d1:b0:212:f02a:e5c7 with SMTP id lk17-20020a17090b33d100b00212f02ae5c7mr13792539pjb.137.1666642503575; Mon, 24 Oct 2022 13:15:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666642503; cv=none; d=google.com; s=arc-20160816; b=hJYAgO0R/ag+icMjGNs7fxL6g83+U7LHZfZ9hB1nuthUTZ76V+9zZNb64ejCSsekt8 rfycsAF2w/GJKpS9sfjVV8EXpWgOHlIiEYN+Cn33N2Ju+AaMBpsvWgZL1QSCBD/9zXQO 5UPZu7Ipqq9J0iGQH3X0N1Hk7tTb3WZVjUIrOuMi5CzOYawFNbd/HrxwuRRmpzV3fsx7 WRE++9MSxPtLM1pONvy726uPSeWXRbdX5OJJMERn+r2HJP43vwPHYnt8etNNRwL16+Cc PRtKIBfmwO8qTCT0oILITC7Cl88XaUSSn4YpcvXCDeZSoE5rIHxUXIMLnSzzncVpZXW1 FQwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=27N4/mI+fSrXKA2NcREoL8VKxHuV14z096vspLq6CXk=; b=RPFL1Xk1KFFx2glfQxf8ou4T5zoxL96sD0jXDOZrbL4Hevqz2snN/SRAkf1SGxk4RH TTdgbJ9az3aQzNpGcLblpq0tSo+/aB5h96Ou/x0e6zjfz/YYkIJ8n+GGVCFL7UgQWzgp 4/YU4XbHo6Se6IT86BwjOOYloeYCB+8GMSaxjgnKFbF18Ub6oMqmytDtmabWXNzn7V61 cz2yttRE5l5JcFH9FJTmF8achV8ITHxSCuvYyQMkPZNZZM64BSdZybsUIk0AfSvfa40C OBfbcHn5WH6Y8cc2GPdyxcWd9QBN7sxktZxOz/7PA7ry0QqZLCX/KApxdmki15prCESq v/3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gJuFj7DF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h20-20020a632114000000b004635d57777bsi415366pgh.748.2022.10.24.13.14.49; Mon, 24 Oct 2022 13:15: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=gJuFj7DF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232062AbiJXUFl (ORCPT + 99 others); Mon, 24 Oct 2022 16:05:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233886AbiJXUE5 (ORCPT ); Mon, 24 Oct 2022 16:04:57 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85EC0220FAF; Mon, 24 Oct 2022 11:26: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 sin.source.kernel.org (Postfix) with ESMTPS id 2B3C1CE1322; Mon, 24 Oct 2022 12:28:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3CA81C433C1; Mon, 24 Oct 2022 12:28:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614494; bh=K6gjyBoTvmkgn/KUrwOSZN1zLh0dTQkQIO3cap4BIT0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gJuFj7DF93KDU/UIKzn+tAzkAVr/5YwnkaBgHGtXwUesRcBOvIv5vaZJfdZGUNAx0 83SLYbDuqcmmw3D85+EximncPsWBOGlU8DyfvYQDr5wLtcyEAgeqqFlmTW4pKJJtN5 cS04hgT4woQmTKbMDrc+8nq8YNg5QFCR/YRF0nGM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Damian Muszynski , Giovanni Cabiddu , Herbert Xu , Sasha Levin Subject: [PATCH 5.10 281/390] crypto: qat - fix DMA transfer direction Date: Mon, 24 Oct 2022 13:31:18 +0200 Message-Id: <20221024113034.918728355@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747601329541194298?= X-GMAIL-MSGID: =?utf-8?q?1747601329541194298?= From: Damian Muszynski [ Upstream commit cf5bb835b7c8a5fee7f26455099cca7feb57f5e9 ] When CONFIG_DMA_API_DEBUG is selected, while running the crypto self test on the QAT crypto algorithms, the function add_dma_entry() reports a warning similar to the one below, saying that overlapping mappings are not supported. This occurs in tests where the input and the output scatter list point to the same buffers (i.e. two different scatter lists which point to the same chunks of memory). The logic that implements the mapping uses the flag DMA_BIDIRECTIONAL for both the input and the output scatter lists which leads to overlapped write mappings. These are not supported by the DMA layer. Fix by specifying the correct DMA transfer directions when mapping buffers. For in-place operations where the input scatter list matches the output scatter list, buffers are mapped once with DMA_BIDIRECTIONAL, otherwise input buffers are mapped using the flag DMA_TO_DEVICE and output buffers are mapped with DMA_FROM_DEVICE. Overlapping a read mapping with a write mapping is a valid case in dma-coherent devices like QAT. The function that frees and unmaps the buffers, qat_alg_free_bufl() has been changed accordingly to the changes to the mapping function. DMA-API: 4xxx 0000:06:00.0: cacheline tracking EEXIST, overlapping mappings aren't supported WARNING: CPU: 53 PID: 4362 at kernel/dma/debug.c:570 add_dma_entry+0x1e9/0x270 ... Call Trace: dma_map_page_attrs+0x82/0x2d0 ? preempt_count_add+0x6a/0xa0 qat_alg_sgl_to_bufl+0x45b/0x990 [intel_qat] qat_alg_aead_dec+0x71/0x250 [intel_qat] crypto_aead_decrypt+0x3d/0x70 test_aead_vec_cfg+0x649/0x810 ? number+0x310/0x3a0 ? vsnprintf+0x2a3/0x550 ? scnprintf+0x42/0x70 ? valid_sg_divisions.constprop.0+0x86/0xa0 ? test_aead_vec+0xdf/0x120 test_aead_vec+0xdf/0x120 alg_test_aead+0x185/0x400 alg_test+0x3d8/0x500 ? crypto_acomp_scomp_free_ctx+0x30/0x30 ? __schedule+0x32a/0x12a0 ? ttwu_queue_wakelist+0xbf/0x110 ? _raw_spin_unlock_irqrestore+0x23/0x40 ? try_to_wake_up+0x83/0x570 ? _raw_spin_unlock_irqrestore+0x23/0x40 ? __set_cpus_allowed_ptr_locked+0xea/0x1b0 ? crypto_acomp_scomp_free_ctx+0x30/0x30 cryptomgr_test+0x27/0x50 kthread+0xe6/0x110 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x1f/0x30 Fixes: d370cec ("crypto: qat - Intel(R) QAT crypto interface") Link: https://lore.kernel.org/linux-crypto/20220223080400.139367-1-gilad@benyossef.com/ Signed-off-by: Damian Muszynski Signed-off-by: Giovanni Cabiddu Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/qat/qat_common/qat_algs.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/qat/qat_common/qat_algs.c b/drivers/crypto/qat/qat_common/qat_algs.c index 2e2c2ac53609..5b71768fc0c7 100644 --- a/drivers/crypto/qat/qat_common/qat_algs.c +++ b/drivers/crypto/qat/qat_common/qat_algs.c @@ -624,11 +624,14 @@ static void qat_alg_free_bufl(struct qat_crypto_instance *inst, dma_addr_t blpout = qat_req->buf.bloutp; size_t sz = qat_req->buf.sz; size_t sz_out = qat_req->buf.sz_out; + int bl_dma_dir; int i; + bl_dma_dir = blp != blpout ? DMA_TO_DEVICE : DMA_BIDIRECTIONAL; + for (i = 0; i < bl->num_bufs; i++) dma_unmap_single(dev, bl->bufers[i].addr, - bl->bufers[i].len, DMA_BIDIRECTIONAL); + bl->bufers[i].len, bl_dma_dir); dma_unmap_single(dev, blp, sz, DMA_TO_DEVICE); @@ -642,7 +645,7 @@ static void qat_alg_free_bufl(struct qat_crypto_instance *inst, for (i = bufless; i < blout->num_bufs; i++) { dma_unmap_single(dev, blout->bufers[i].addr, blout->bufers[i].len, - DMA_BIDIRECTIONAL); + DMA_FROM_DEVICE); } dma_unmap_single(dev, blpout, sz_out, DMA_TO_DEVICE); @@ -666,6 +669,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, struct scatterlist *sg; size_t sz_out, sz = struct_size(bufl, bufers, n); int node = dev_to_node(&GET_DEV(inst->accel_dev)); + int bufl_dma_dir; if (unlikely(!n)) return -EINVAL; @@ -683,6 +687,8 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, qat_req->buf.sgl_src_valid = true; } + bufl_dma_dir = sgl != sglout ? DMA_TO_DEVICE : DMA_BIDIRECTIONAL; + for_each_sg(sgl, sg, n, i) bufl->bufers[i].addr = DMA_MAPPING_ERROR; @@ -694,7 +700,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, bufl->bufers[y].addr = dma_map_single(dev, sg_virt(sg), sg->length, - DMA_BIDIRECTIONAL); + bufl_dma_dir); bufl->bufers[y].len = sg->length; if (unlikely(dma_mapping_error(dev, bufl->bufers[y].addr))) goto err_in; @@ -737,7 +743,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, bufers[y].addr = dma_map_single(dev, sg_virt(sg), sg->length, - DMA_BIDIRECTIONAL); + DMA_FROM_DEVICE); if (unlikely(dma_mapping_error(dev, bufers[y].addr))) goto err_out; bufers[y].len = sg->length; @@ -767,7 +773,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, if (!dma_mapping_error(dev, buflout->bufers[i].addr)) dma_unmap_single(dev, buflout->bufers[i].addr, buflout->bufers[i].len, - DMA_BIDIRECTIONAL); + DMA_FROM_DEVICE); if (!qat_req->buf.sgl_dst_valid) kfree(buflout); @@ -781,7 +787,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, if (!dma_mapping_error(dev, bufl->bufers[i].addr)) dma_unmap_single(dev, bufl->bufers[i].addr, bufl->bufers[i].len, - DMA_BIDIRECTIONAL); + bufl_dma_dir); if (!qat_req->buf.sgl_src_valid) kfree(bufl); From patchwork 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: 9567 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp527193wru; Mon, 24 Oct 2022 09:00:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5JyiTCq5C1l3MSxg7W62ZCGomYj+skTx31jwtSfe8MkjS6kLDcAQx3/7fDe/8GJbI1eje3 X-Received: by 2002:a17:906:844c:b0:78d:ce8f:fc81 with SMTP id e12-20020a170906844c00b0078dce8ffc81mr28765861ejy.128.1666627228443; Mon, 24 Oct 2022 09:00:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627228; cv=none; d=google.com; s=arc-20160816; b=Th06ffwBkeMwu6Sy0p39DBnefcBDMi8hjbL/TElBccv5UfAho+iRlI5LLEuitLDJwY 6vriIwMgYmtKgF0tkfKG6uZm289Pb6iEMBBS8qer0qBTAXi16SCGgNFxcEuHaQd2S7/C PONsnOfQvkDU2PlV4sjbqF4cJMMolj3TowYIzNUKFKcQ+KuDvKvatq6w5+T4zrHoUksj k+CSZjnI/XpTrGRMhE0IS4EsgcHDM5Lfn2kdNGyB8F7X5N0b+GpVz7sErBsbBnJMrvIG +G7hiErFsyLF/ZTcYzp8NCg4GxNUOz7Nbm6I010qKZlSUES6gTwHD8mlC9DNQOU97ly9 VWCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=G5Dbd4poqE7deyjTRSv7SlWftVG2Nrcp2viwHavwZusjdn9xdBh8J/mOZh+PonHYCf /1i42BWi67Aky9JS3o7POVL1q5FkJNvI8BbZRvpLeJrT73r8ROJf+u8ntsSXMW8vls4P huGIki9ZJIkzYm7/iGTuD/Lt0dZ8suQOk+T5UDzGb0rFmP5BrJFZ8GSuHGv4rqdW5HR6 Phcmxj1R/zlhyIbqLPd+dcQeqRLPBY/h5zLdQA//5lqSGP1KwhKgSqODmAGOZBxQQzkk fLHlbuW3aUGGyogLoNhP/f9dKOqbB2W4UCqaWu+zF6F51Pa+tR1YgeV+tv1JVcyfHf46 Hzwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yLb3ubns; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w2-20020a056402268200b00461f1a036f0si139330edd.335.2022.10.24.08.59.59; Mon, 24 Oct 2022 09:00: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=yLb3ubns; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229907AbiJXPze (ORCPT + 99 others); Mon, 24 Oct 2022 11:55:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231797AbiJXPy6 (ORCPT ); Mon, 24 Oct 2022 11:54: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 7DFE5B4883; Mon, 24 Oct 2022 07:50:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7ADB2B8169B; Mon, 24 Oct 2022 12:29:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC426C433D6; Mon, 24 Oct 2022 12:29:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614597; bh=fzcrBvCZW7mXwVLKymyezTswcQKSn+eSTCs7/2xGe8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yLb3ubnsaWN+LGMJWFdDKBDpFYeNbMzSETWf58PSo9DKaBBDth4XMB9dQ/eJHhBT1 KcpprNVRJkrj91s2fsZv78y9ppS66Gy5ykAlXmrKm1emF50s1I6ZLya22sFQt2DLK5 bBFcNDyozjjgoRXEsCopEDomEmgvrzC9c8DljxWc= 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.10 282/390] iommu/iova: Fix module config properly Date: Mon, 24 Oct 2022 13:31:19 +0200 Message-Id: <20221024113034.963397269@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585312633266503?= X-GMAIL-MSGID: =?utf-8?q?1747585312633266503?= 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: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: 9596 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp529197wru; Mon, 24 Oct 2022 09:03:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7H40kTE1BPOyCiHQBXH7B2ie9+gvJBTSyoTQlisvrmsbffriaI5MakwEe9yegQ+EZSbk6v X-Received: by 2002:a17:902:9690:b0:17a:4cf:edeb with SMTP id n16-20020a170902969000b0017a04cfedebmr34333197plp.129.1666627397634; Mon, 24 Oct 2022 09:03:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627397; cv=none; d=google.com; s=arc-20160816; b=kxWZwwcIdvsB/McUOl8PUtrA2jpxEht/Odm7GKSCkmLlpF1CMzAIG7geKwmVC8EoJd EARqby6k8Y5iUjX0ffenBRLrFsiV2DOoRmYUpLD1bDpi+X3sWt6+Bfqh22D299W23bpT 7VomEeUeJKIypg3USaVt73+dUQvPuOzJPv7LlZzoUIicWYIm5AMj5g5W31eXIO+nHrOI ysI47gvbSF3mZTU8bTuiiydpeaIBEm6/QTT2lndMcnmVkA7iClQdhgQAumg3Nroagb5y sFqOUpdvdO8YAhqzIDA1jsgTokW+gvbu0WGA1bkz7NfkE07BBefFkGSin2qk1WktGPg/ G3nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KCkiCwAeM0DC4G4M8RXTYA9/YX5WvLBhBfIsZNV29lU=; b=DFzTaXXdOFf4eeCVjYB1uZ9RVZD0Y8qi4g6TlV1BpmXkFfdNKBiDBrnG/pIPRkM/VP axqpQfa3auJMmJMW/QMZzQ97EM1aWJX8060+qEDyCsHyasfHeafxuPh0tnlWADG7stkA YALfzIsvhwWasdp4cKFy4EBM2vc2sts2QJVPy9Z0Vwxs1V68SwCRHPj5lUkS8CFon/oo aLZeiWGqDEL44bhwCkcguDwtqtZbGAd3YaP3rkIGq/Pdjeb1oF3JqIOCIxnt3Fhf7GNr 80FQ2YYj7ECn4lQVIXdLmnU3ZYZTc3KSkyjai9imzR6FrkDx+fshkqEHT7pUj+Kvh+aJ QKLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xIL7Kig0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r9-20020a1709028bc900b001768a29b9dfsi9344416plo.68.2022.10.24.09.02.56; Mon, 24 Oct 2022 09:03: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=xIL7Kig0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230456AbiJXQBl (ORCPT + 99 others); Mon, 24 Oct 2022 12:01:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232377AbiJXP7C (ORCPT ); Mon, 24 Oct 2022 11:59: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 0531C9D52A; Mon, 24 Oct 2022 07:54: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 E2D91B8169A; Mon, 24 Oct 2022 12:28:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 218F9C433D6; Mon, 24 Oct 2022 12:28:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614515; bh=G2L0nwBjn5VtTyRobVNartiz1/0xuFjNYrEZ5NJlSKU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xIL7Kig0irVv/2KyxsITbg/4FxxHGkofIkh9tkgm2nfpYBeM9FAnPrTX8Fb9axMVn chPP0AyBphu3DO8MmKXWNp3GIZbPZGalipX9CvYb8tdHco6IKjXZ73GCPZ3uJVrK/+ PCxXGJFbEM80/UkSmwhqnJ7YlCezo+HC07VkxJJc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, linux-riscv@lists.infradead.org, mingo@redhat.com, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, zanussi@kernel.org, liaochang1@huawei.com, chris.zjh@huawei.com, Yipeng Zou , "Masami Hiramatsu (Google)" , "Steven Rostedt (Google)" , Sasha Levin Subject: [PATCH 5.10 283/390] tracing: kprobe: Fix kprobe event gen test module on exit Date: Mon, 24 Oct 2022 13:31:20 +0200 Message-Id: <20221024113034.994789643@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585489944667658?= X-GMAIL-MSGID: =?utf-8?q?1747585489944667658?= From: Yipeng Zou [ Upstream commit ac48e189527fae87253ef2bf58892e782fb36874 ] Correct gen_kretprobe_test clr event para on module exit. This will make it can't to delete. Link: https://lkml.kernel.org/r/20220919125629.238242-2-zouyipeng@huawei.com Cc: Cc: Cc: Cc: Cc: Cc: Cc: Cc: Fixes: 64836248dda2 ("tracing: Add kprobe event command generation test module") Signed-off-by: Yipeng Zou Acked-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt (Google) Signed-off-by: Sasha Levin --- kernel/trace/kprobe_event_gen_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/kprobe_event_gen_test.c b/kernel/trace/kprobe_event_gen_test.c index 18b0f1cbb947..e023154be0f8 100644 --- a/kernel/trace/kprobe_event_gen_test.c +++ b/kernel/trace/kprobe_event_gen_test.c @@ -206,7 +206,7 @@ static void __exit kprobe_event_gen_test_exit(void) WARN_ON(kprobe_event_delete("gen_kprobe_test")); /* Disable the event or you can't remove it */ - WARN_ON(trace_array_set_clr_event(gen_kprobe_test->tr, + WARN_ON(trace_array_set_clr_event(gen_kretprobe_test->tr, "kprobes", "gen_kretprobe_test", false)); From patchwork 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: 9572 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp527404wru; Mon, 24 Oct 2022 09:00:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Wub+NDLaqhS6AC73WYn3qCbQWZFhglz/Szxj86KMnvWggk+4dGf4Xu0dsGesSUz+9cL6d X-Received: by 2002:a17:907:1c8a:b0:782:1a0d:3373 with SMTP id nb10-20020a1709071c8a00b007821a0d3373mr27302485ejc.135.1666627247727; Mon, 24 Oct 2022 09:00:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627247; cv=none; d=google.com; s=arc-20160816; b=Aen/mcs5LqhGqYNKhQJVSxXBX6KzXMNYES8dljQp63f6zCHPZ1BpjRDJ9BF3Nb2hyo kQE0KzDWfaoTnmsvd6kB6fQApNj28DLVp0WLrNiq2T6d1Oi7QZU2TQFeQZwkkfpV+N89 mJMZZkIuqqegss1Jcard6g4OyJmaCgUssw0ATRFHRBxnks83u2Xyw2zRgV/HauyemPHF GCeZI5yzGxk0dBogyTbiaCNhVbzrh9v2Ir+q3YmQjoX44JoSv+YKLcoomWN2YDeLK6cB kmEAu2RwgNjE7S5O6mTjveZAoQhaG04x0Qmvj5tIbjh8d/zCCY1Z26ULLEAQj8vMBLbG KrvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=svhPfyiBknFcdK9Jb03uX0IgjMsCSeIO5LuOUGYZPMQ=; b=W8GoBIZJw/FtwpeDcWYUpfEcejGb4RBlY9yMtO20UL6qF9dUwshlZfJmTSCCvizSKM l3//KFdJOO8f0ftOZPHK3KbekAYqncu/xqCVDSi92dNqAouWNhPZBppPear7gBx77wZF 0tgmTMCABzpP6idzI1IREiWEUyekNWgG3jjYuEyMi1UHbBUWZOiz1Q2hbDAQ0BOKQ3Pd 2nxBcwlwQ3SDmNjTETo3A8vKuo+92VyRGvWVSB9NTqA84ZP20acvpSeUz3V7tt2LobNH q4jXenqgXKtINPGi0dOPuCI/IZpCoJPYe59LrssgmI+gZmRWaHchBB7ybai/0xQAg6F6 FV1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YQQgnIeR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056402279400b0045217702054si130703ede.501.2022.10.24.09.00.13; Mon, 24 Oct 2022 09:00: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=YQQgnIeR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231939AbiJXP5a (ORCPT + 99 others); Mon, 24 Oct 2022 11:57:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231878AbiJXP4t (ORCPT ); Mon, 24 Oct 2022 11:56: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 9087C106A62; Mon, 24 Oct 2022 07:51: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 B4DCEB811D7; Mon, 24 Oct 2022 12:29:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E28D9C433D6; Mon, 24 Oct 2022 12:29:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614544; bh=Xz/JYnNX+bv4d5sNBNrD5dHf4bfzzM5L7MEjHHLxJTw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YQQgnIeRsdjVFbwBnJicpowwdUv915+3gOQhtebb8ijEnZsbK3p10+fzUaOxs7veK zLe6l0bfBKCSfkkn11WReudJbBHPhrVcc8NIuajGLYNz5iK5hqtGyLfJbyaQScDBdv 8i8FX8p2exBj5GDj3xRDd9exF4zUiOJyTuqhY9Ms= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, linux-riscv@lists.infradead.org, mingo@redhat.com, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, zanussi@kernel.org, liaochang1@huawei.com, chris.zjh@huawei.com, Yipeng Zou , "Masami Hiramatsu (Google)" , "Steven Rostedt (Google)" , Sasha Levin Subject: [PATCH 5.10 284/390] tracing: kprobe: Make gen test module work in arm and riscv Date: Mon, 24 Oct 2022 13:31:21 +0200 Message-Id: <20221024113035.043873542@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585332896744699?= X-GMAIL-MSGID: =?utf-8?q?1747585332896744699?= From: Yipeng Zou [ Upstream commit d8ef45d66c01425ff748e13ef7dd1da7a91cc93c ] For now, this selftest module can only work in x86 because of the kprobe cmd was fixed use of x86 registers. This patch adapted to register names under arm and riscv, So that this module can be worked on those platform. Link: https://lkml.kernel.org/r/20220919125629.238242-3-zouyipeng@huawei.com Cc: Cc: Cc: Cc: Cc: Cc: Cc: Cc: Fixes: 64836248dda2 ("tracing: Add kprobe event command generation test module") Signed-off-by: Yipeng Zou Acked-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt (Google) Signed-off-by: Sasha Levin --- kernel/trace/kprobe_event_gen_test.c | 47 +++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/kernel/trace/kprobe_event_gen_test.c b/kernel/trace/kprobe_event_gen_test.c index e023154be0f8..80e04a1e1977 100644 --- a/kernel/trace/kprobe_event_gen_test.c +++ b/kernel/trace/kprobe_event_gen_test.c @@ -35,6 +35,45 @@ static struct trace_event_file *gen_kprobe_test; static struct trace_event_file *gen_kretprobe_test; +#define KPROBE_GEN_TEST_FUNC "do_sys_open" + +/* X86 */ +#if defined(CONFIG_X86_64) || defined(CONFIG_X86_32) +#define KPROBE_GEN_TEST_ARG0 "dfd=%ax" +#define KPROBE_GEN_TEST_ARG1 "filename=%dx" +#define KPROBE_GEN_TEST_ARG2 "flags=%cx" +#define KPROBE_GEN_TEST_ARG3 "mode=+4($stack)" + +/* ARM64 */ +#elif defined(CONFIG_ARM64) +#define KPROBE_GEN_TEST_ARG0 "dfd=%x0" +#define KPROBE_GEN_TEST_ARG1 "filename=%x1" +#define KPROBE_GEN_TEST_ARG2 "flags=%x2" +#define KPROBE_GEN_TEST_ARG3 "mode=%x3" + +/* ARM */ +#elif defined(CONFIG_ARM) +#define KPROBE_GEN_TEST_ARG0 "dfd=%r0" +#define KPROBE_GEN_TEST_ARG1 "filename=%r1" +#define KPROBE_GEN_TEST_ARG2 "flags=%r2" +#define KPROBE_GEN_TEST_ARG3 "mode=%r3" + +/* RISCV */ +#elif defined(CONFIG_RISCV) +#define KPROBE_GEN_TEST_ARG0 "dfd=%a0" +#define KPROBE_GEN_TEST_ARG1 "filename=%a1" +#define KPROBE_GEN_TEST_ARG2 "flags=%a2" +#define KPROBE_GEN_TEST_ARG3 "mode=%a3" + +/* others */ +#else +#define KPROBE_GEN_TEST_ARG0 NULL +#define KPROBE_GEN_TEST_ARG1 NULL +#define KPROBE_GEN_TEST_ARG2 NULL +#define KPROBE_GEN_TEST_ARG3 NULL +#endif + + /* * Test to make sure we can create a kprobe event, then add more * fields. @@ -58,14 +97,14 @@ static int __init test_gen_kprobe_cmd(void) * fields. */ ret = kprobe_event_gen_cmd_start(&cmd, "gen_kprobe_test", - "do_sys_open", - "dfd=%ax", "filename=%dx"); + KPROBE_GEN_TEST_FUNC, + KPROBE_GEN_TEST_ARG0, KPROBE_GEN_TEST_ARG1); if (ret) goto free; /* Use kprobe_event_add_fields to add the rest of the fields */ - ret = kprobe_event_add_fields(&cmd, "flags=%cx", "mode=+4($stack)"); + ret = kprobe_event_add_fields(&cmd, KPROBE_GEN_TEST_ARG2, KPROBE_GEN_TEST_ARG3); if (ret) goto free; @@ -128,7 +167,7 @@ static int __init test_gen_kretprobe_cmd(void) * Define the kretprobe event. */ ret = kretprobe_event_gen_cmd_start(&cmd, "gen_kretprobe_test", - "do_sys_open", + KPROBE_GEN_TEST_FUNC, "$retval"); if (ret) goto free; From patchwork 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: 9212 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp459213wru; Mon, 24 Oct 2022 06:39:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4+fQr+1wA9HNXust6c+R8THxvEIyMEkjcLiIQJOEgiKHRgTg1A5TIOX3xePz2a4AK2kqdc X-Received: by 2002:a05:6402:298d:b0:451:5fc5:d423 with SMTP id eq13-20020a056402298d00b004515fc5d423mr30327380edb.102.1666618746454; 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=mkdQFRUfwx2NTlNN5gQqRP13DtnvghklHZf8CsDTucN8zLG/qZxyCLdpBQXSK6xPkO ubn+blzObPGU61FT3FpMxB85FW26YaPKIlNCyAJIzAcP2RAQ5qlQe6PalWFYDVeAvTrg 4cjmA3U10t3sp6ZXzFQZ+Smd5wNp9/yzHtd1aKeH+F7McwmvQ8hn/zAAaiq/HX/qfRAm pQ16umhJUiZP5K/zJ6agHYgEEzwrEOQNlbpq0Nrnp4MVpYEl/3UkXuJsY+wWpBluhuQI nfda+vVgzEEFfSbZ2Icq6Y1tUABJ60vSxLjYkNGG3hKUkzNp8JySnNcBjqSKzToplfN+ RuaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=y3KBfCbCkTcOHLQw9ec194aTM3TVURTTsOGO+zjPtzs=; b=g5VAik2z2jbU6xX+DqsInsF5xPF+oGM13IdJMnpI5ABreyLrD2wQ/t5+VcdW9+vyrm FR49zk/Y7Gdj8oLDtEHQ+QurS+9/tnblH8TnPftVbrgDMSQq3EHf1Q4MwWxNStM0OqKB 2qQMltJbEqIzSZL4YmDMVCWkvMH0SGCecRZzE5zrgL51reDpxq+24sVotC5m5f2ZLz6V 1q/UXLfVXyHSzzk+SG3AjfrOW+On0ZFEjorXq3L49D8iQDth5MaCflF7ZHlsf9iUNaUe /2dQePumkhNGqhng+PSmvVLhTNfPoLGbnhD9sxnn8a1unk0Ujh/caGMalE4XRYlw4wNS d6IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MZNhZ3Iv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t20-20020a1709066bd400b00783698dd8b4si23925144ejs.722.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=MZNhZ3Iv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236245AbiJXNfH (ORCPT + 99 others); Mon, 24 Oct 2022 09:35:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236269AbiJXNaS (ORCPT ); Mon, 24 Oct 2022 09:30:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C9F6ACA1D; Mon, 24 Oct 2022 05:33: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 E3C2361253; Mon, 24 Oct 2022 12:29:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00613C433C1; Mon, 24 Oct 2022 12:29:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614573; bh=KwHi/Yz77vH5JpUvmQEm94H2dp2DiOF5mtJWc1mS1c4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MZNhZ3Iv9UOVknSDqrSkz1BqGsfCIp8aHDmcMom18AX7FcPo1/DHOM5sguaavMoXY WZJspw0Vw5rcou1mpUXHwMTa1ijv/cUrj1vqBwLxkucjpPjC11oEynyFivCsJE4n1Z eN5XHY60BNmJXH4kUw8L3FpO/wwoAGNSAa+sBlLA= 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.10 285/390] kbuild: remove the target in signal traps when interrupted Date: Mon, 24 Oct 2022 13:31:22 +0200 Message-Id: <20221024113035.087700162@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576418716830714?= X-GMAIL-MSGID: =?utf-8?q?1747576418716830714?= 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 0d6e11820791..25696de8114a 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -179,8 +179,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: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: 9206 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp459080wru; Mon, 24 Oct 2022 06:38:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM50u3Yn/jhvaoxalW98NmPALGWjpkUTJJ58kQzs9X0Cng9TT7ExZLGDt9yfadZIdTvbyAS1 X-Received: by 2002:a05:6402:2744:b0:45c:9978:eae8 with SMTP id z4-20020a056402274400b0045c9978eae8mr31111576edd.361.1666618731213; Mon, 24 Oct 2022 06:38:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618731; cv=none; d=google.com; s=arc-20160816; b=CXRVYLHso3F4/Huvx1fsN0J8jWWpVQvs8jDKmLT8PctTrVqUOq8xmBvLKQFaMy6Xj/ AYicz7zsbaNZOIIsrawjU2RS1S6LD6fZSkFYD6iifhb3YQ+wqEfRQVGcoh5BmxSsFz7z MWvHcQRl3paG1ID8prbQegvmHGveB/EhUYZLn4yzE+j/VFwkiPTDYwgimOkLC00DODnb dEtd9EoZjfDECJYIy5AR2JQDlqUMY5+9NoxKC45zcaRMte61xNwIBbDdwzAx5EykU/iH 4cmXJCsBjLjbNRkxPQHwjBmBQeqZ6t3niOBPY3iGkBtcXgpEkILDTdWpkwuHVvgluMqY fs1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yI2US8f+IXxCuSRWlihomRCIUWEFkrcOD+fhy8xKdfQ=; b=c7qUuNHn1AiVB22Bu0whEP1Vozk3xBt1GJb7BngQO7JRErRSyLiWAKTWm4VsLSne5C RbAA4r+Jn/i0L1F74Li1rCipDmVLcKehleaXK+HxN653xz1sgU3hOEn2+caZ9efRKKRi sfWeE7KhD0d7tq4ttbKJ0L9Y+tJu+FoIxyyEol+7M7Fm8xotYpoxpSDWKAcOsU4DFj13 PSmFVb9DYFsZS/o6duPubHjlsjnrQL8a3adnIZ0hOGSQJtprbL0KAz/7EQHazSt2gNbI dvx76H07SAt1FCkZPyWcma0iwsTrtly+L49xxXlF7YMwjDx4aAEOp7odwodU57tZKIsN plWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KdyKJpLJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz43-20020a1709077dab00b0079195d87013si21068025ejc.713.2022.10.24.06.38.19; Mon, 24 Oct 2022 06:38: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=KdyKJpLJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233846AbiJXN1f (ORCPT + 99 others); Mon, 24 Oct 2022 09:27:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236308AbiJXNZB (ORCPT ); Mon, 24 Oct 2022 09:25:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58EDDA8CEC; Mon, 24 Oct 2022 05:30: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 A97DA612B2; Mon, 24 Oct 2022 12:29:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2236C433C1; Mon, 24 Oct 2022 12:29:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614581; bh=aB5UaX4PEnngZ+QuGyOLg8annvuPF1tnFpPw2lzRz5k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KdyKJpLJgmFKoUktqz0ixUuE5OMWJ9LJa0akki710FoIwQRPUc4Ts18jHOs0ttuAZ P1czPUGSnqWFAbY7f9sI8Hzd7nhqYd0pPcPoTrjr2QClbrF+/PFMBUiUCc4oZg9T38 N3NYEnEKDWH232SmA/PvMXUK+fTMHKuJf2aTPXVQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Janis Schoetterl-Glausch , Masahiro Yamada , Sasha Levin Subject: [PATCH 5.10 286/390] kbuild: rpm-pkg: fix breakage when V=1 is used Date: Mon, 24 Oct 2022 13:31:23 +0200 Message-Id: <20221024113035.135868289@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576402654246522?= X-GMAIL-MSGID: =?utf-8?q?1747576402654246522?= From: Janis Schoetterl-Glausch [ Upstream commit 2e07005f4813a9ff6e895787e0c2d1fea859b033 ] Doing make V=1 binrpm-pkg results in: Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.EgV6qJ + umask 022 + cd . + /bin/rm -rf /home/scgl/rpmbuild/BUILDROOT/kernel-6.0.0_rc5+-1.s390x + /bin/mkdir -p /home/scgl/rpmbuild/BUILDROOT + /bin/mkdir /home/scgl/rpmbuild/BUILDROOT/kernel-6.0.0_rc5+-1.s390x + mkdir -p /home/scgl/rpmbuild/BUILDROOT/kernel-6.0.0_rc5+-1.s390x/boot + make -f ./Makefile image_name + cp test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \ echo >&2; \ echo >&2 " ERROR: Kernel configuration is invalid."; \ echo >&2 " include/generated/autoconf.h or include/config/auto.conf are missing.";\ echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \ echo >&2 ; \ /bin/false) arch/s390/boot/bzImage /home/scgl/rpmbuild/BUILDROOT/kernel-6.0.0_rc5+-1.s390x/boot/vmlinuz-6.0.0-rc5+ cp: invalid option -- 'e' Try 'cp --help' for more information. error: Bad exit status from /var/tmp/rpm-tmp.EgV6qJ (%install) Because the make call to get the image name is verbose and prints additional information. Fixes: 993bdde94547 ("kbuild: add image_name to no-sync-config-targets") Signed-off-by: Janis Schoetterl-Glausch Signed-off-by: Masahiro Yamada Signed-off-by: Sasha Levin --- scripts/package/mkspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 7c477ca7dc98..951cc60e5a90 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec @@ -85,10 +85,10 @@ $S mkdir -p %{buildroot}/boot %ifarch ia64 mkdir -p %{buildroot}/boot/efi - cp \$($MAKE image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE + cp \$($MAKE -s image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE ln -s efi/vmlinuz-$KERNELRELEASE %{buildroot}/boot/ %else - cp \$($MAKE image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE + cp \$($MAKE -s image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE %endif $M $MAKE %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install $MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install From patchwork 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: 9578 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp527724wru; Mon, 24 Oct 2022 09:01:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6xEb0unkoKXzFINuSXzkZavg+KUu0TTbb+soIXObaJdCAmCKVNOJNGp/OBo5py5jGieil/ X-Received: by 2002:a05:6402:517c:b0:461:e7e7:c0b9 with SMTP id d28-20020a056402517c00b00461e7e7c0b9mr2692466ede.73.1666627274356; Mon, 24 Oct 2022 09:01:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627274; cv=none; d=google.com; s=arc-20160816; b=f6SorbBlo5Xs/nkIcWgVmn/v3+l4JP3FgBBhAyTi15A275AJAZS3ZJXjRHJdyoBYJO IMdM+r4MyOVNx0uaFUcaDJVUDcixdWmSsqS0HIVw3BkCsOLvmDVaYPZTdADGMWerwfXh Vk7Dzy6RnZcUIpSIzgYSXv0fB3DIiIvmLdTdA/sLXYdM2bGa0ascT9xq2p1rVenN1lDh +tRxcU+SUfSUTp7TupYPvzmBMh9ZsByvr0GTMRrQL7QGh16aMerqPOKrZCSDwY2+iKzZ tD3tpfOaZYgR37q85uOdsA8/5YGsu6uiZUGC3ZDBx5DQWnNaLRFAaU6csdqrQF5EZNC0 I1WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VJ+Rg+1xcgXv+IYAaiAFf0JVtaFhhpPuyaFYntOWOtM=; b=fwYyYAXuVk39JeKPggf4SGrkdul3Lh3C5nEWXurBnbQqUixsCn4j2UxPfc4mawRNWP Nykc/NsfhU5xmMunNmNGl9XUgwfmcdN7N2zr4W6k8FKB2Qf4dNHN8ytj8Lzwho+YnUjl Ufcgr614cpROMlTgNmYnjg8n44PrnwvDydQIDesJ1919nkdLfUeiSE5nRWh728PgAh9E GSnEUWxzSwqlr5EsZXHJ+6hVnz0iSeXYDfXPEYl/eI4SV5OLVPG1hGb2Z+FgWtsLy35Q gvdgDQTAc0txEShsEYxbRLnxbosQZXoNVevboiLj+0uuoneCgqEnsFj3HURgFrNQEH1P jh0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ci6lj5MC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056402248700b0045e00384e8asi136564eda.380.2022.10.24.09.00.45; Mon, 24 Oct 2022 09:01: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=Ci6lj5MC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231903AbiJXP6v (ORCPT + 99 others); Mon, 24 Oct 2022 11:58:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231529AbiJXP54 (ORCPT ); Mon, 24 Oct 2022 11:57:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78F8D86F98; Mon, 24 Oct 2022 07:53: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 39130B8169D; Mon, 24 Oct 2022 12:29:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89031C433D7; Mon, 24 Oct 2022 12:29:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614583; bh=tzkFWHdBR1QJkTnAVZrUmtw9WJSWAiTSqmAiaamAgSg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ci6lj5MC5ikbIMpxzQOOnF6iyLWefVZYIR7ZGpfspRSf8mAiAVGB358JPBViq0a9R 8n6Q+fyFWLMLlhkagHPWkSwJydUYhmSA0xoDYDk9s8A1BGS1yjFs0q5I2StLo8L69R 6NixES1kOYZZgfiUM+LFbd7dckrDXNHDWZvLlwO8= 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.10 287/390] crypto: marvell/octeontx - prevent integer overflows Date: Mon, 24 Oct 2022 13:31:24 +0200 Message-Id: <20221024113035.175716869@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585361026295323?= X-GMAIL-MSGID: =?utf-8?q?1747585361026295323?= From: Dan Carpenter [ Upstream commit caca37cf6c749ff0303f68418cfe7b757a4e0697 ] The "code_length" value comes from the firmware file. If your firmware is untrusted realistically there is probably very little you can do to protect yourself. Still we try to limit the damage as much as possible. Also Smatch marks any data read from the filesystem as untrusted and prints warnings if it not capped correctly. The "code_length * 2" can overflow. The round_up(ucode_size, 16) + sizeof() expression can overflow too. Prevent these overflows. Fixes: d9110b0b01ff ("crypto: marvell - add support for OCTEON TX CPT engine") Signed-off-by: Dan Carpenter Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- .../crypto/marvell/octeontx/otx_cptpf_ucode.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c b/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c index 40b482198ebc..a765eefb18c2 100644 --- a/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c +++ b/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c @@ -286,6 +286,7 @@ static int process_tar_file(struct device *dev, struct tar_ucode_info_t *tar_info; struct otx_cpt_ucode_hdr *ucode_hdr; int ucode_type, ucode_size; + unsigned int code_length; /* * If size is less than microcode header size then don't report @@ -303,7 +304,13 @@ static int process_tar_file(struct device *dev, if (get_ucode_type(ucode_hdr, &ucode_type)) return 0; - ucode_size = ntohl(ucode_hdr->code_length) * 2; + code_length = ntohl(ucode_hdr->code_length); + if (code_length >= INT_MAX / 2) { + dev_err(dev, "Invalid code_length %u\n", code_length); + return -EINVAL; + } + + ucode_size = code_length * 2; if (!ucode_size || (size < round_up(ucode_size, 16) + sizeof(struct otx_cpt_ucode_hdr) + OTX_CPT_UCODE_SIGN_LEN)) { dev_err(dev, "Ucode %s invalid size\n", filename); @@ -886,6 +893,7 @@ static int ucode_load(struct device *dev, struct otx_cpt_ucode *ucode, { struct otx_cpt_ucode_hdr *ucode_hdr; const struct firmware *fw; + unsigned int code_length; int ret; set_ucode_filename(ucode, ucode_filename); @@ -896,7 +904,13 @@ static int ucode_load(struct device *dev, struct otx_cpt_ucode *ucode, ucode_hdr = (struct otx_cpt_ucode_hdr *) fw->data; memcpy(ucode->ver_str, ucode_hdr->ver_str, OTX_CPT_UCODE_VER_STR_SZ); ucode->ver_num = ucode_hdr->ver_num; - ucode->size = ntohl(ucode_hdr->code_length) * 2; + code_length = ntohl(ucode_hdr->code_length); + if (code_length >= INT_MAX / 2) { + dev_err(dev, "Ucode invalid code_length %u\n", code_length); + ret = -EINVAL; + goto release_fw; + } + ucode->size = code_length * 2; if (!ucode->size || (fw->size < round_up(ucode->size, 16) + sizeof(struct otx_cpt_ucode_hdr) + OTX_CPT_UCODE_SIGN_LEN)) { dev_err(dev, "Ucode %s invalid size\n", ucode_filename); From patchwork 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: 9202 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458908wru; Mon, 24 Oct 2022 06:38:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5vlf85FHtYKtvxE57YdHhz9hzXTT87vjEHQDyw9gt+LyCPCQe7brABFdkddwyb2OLQlM/d X-Received: by 2002:a17:906:8a6a:b0:79e:2efe:e0 with SMTP id hy10-20020a1709068a6a00b0079e2efe00e0mr12739979ejc.401.1666618699806; Mon, 24 Oct 2022 06:38:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618699; cv=none; d=google.com; s=arc-20160816; b=h5jiELPx4hbF/8EyQptZdZxwvvRsakdguO2QewgebzurlENKCBTVIcebhHVWGNLWIq 05BTM4d9Z9+ZZgAqa2Fvkh0wwmnKl0GLx3vkpHMTjnm/n0fgxnzhDScc6vNVDTLSQUZ/ UjqNHTKcQlvvbfi9HqK4raRmd6eLWRNwDVg93t4lRi0kTVyTVB0lGsmaVF8P+vskfWhw ks2F2mEMOA7kVHx7uhmwa1hf56xtpSdBnikzrJTxvHXjis+xKZrIWP9OnhbHn4iCr2dO nud4aGcqBGyuxfdSPhvhH+3qmn10mh9mJIVjfwj+RbXSMKL9dC/Tp246MyyvEPQsTqM4 JJtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=Jm/634WhS8X5HUE/+YauNeOoNTJeaj5UJGjagmrohmnay3Srpu1m8CG0Tl1gqa/8mf d+/03utjbcua9WeAhCEOWOgXp8KmUgFWQJRyAR023cHBpuyNm2WLSUqpDX2KFzuOU8TI 2rlRl2V8K7/b0QlYLQSQdqXHOnjIBMmchf1pb/F29BytOTXPSNHXC3HV5JwLKEEkFXjN b1F7kou8SccZt8quezpXvUJoMB/GVQn64QlYe4oUEA2HYtrgSpasLp1Q7UfHqtJDn8XD 93jmlf4sakXMZMDYFNA8gyfO5lNzTauUiLZE+k2G4t9X7y3+fYujhs3pRzFkYeUQklen kZWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oLKWArC4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xg11-20020a170907320b00b0073d92f673f8si26760905ejb.937.2022.10.24.06.37.35; Mon, 24 Oct 2022 06:38: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=oLKWArC4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233384AbiJXN1T (ORCPT + 99 others); Mon, 24 Oct 2022 09:27:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236150AbiJXNYd (ORCPT ); Mon, 24 Oct 2022 09:24: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 2FA5CA8CF0; Mon, 24 Oct 2022 05: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 dfw.source.kernel.org (Postfix) with ESMTPS id 14FBF61280; Mon, 24 Oct 2022 12:29:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27905C433D7; Mon, 24 Oct 2022 12:29:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614586; bh=afOYIS3FPYL4NSLiTIHXXLe3RlmHLDq9fyBIsk/Z1Ew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oLKWArC45giydtcq55y2AZkKEauX45CeRxRvwWKJSOvc4ti9lx8KHg/9LoLPRG47B W5SiHToO+Vk1IRKYbUWMb/Mw6EROuL3lwxwhkFp2JVKRRR0uasAIrtoy9kBDOu4HA+ wUZyRctj0VNGsKQJTDKm9LhBkX5y7rVGi1bpJkuc= 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.10 288/390] crypto: cavium - prevent integer overflow loading firmware Date: Mon, 24 Oct 2022 13:31:25 +0200 Message-Id: <20221024113035.229417744@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576369987292263?= X-GMAIL-MSGID: =?utf-8?q?1747576369987292263?= 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: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: 9438 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp479269wru; Mon, 24 Oct 2022 07:18:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6J+9z3vHY+hLNhHFDeAVTXV7cbRBod39tBglPoJIqquXolgyfQxkoT1nckGzFr15/AYhd7 X-Received: by 2002:a05:6402:42d0:b0:457:d16e:283d with SMTP id i16-20020a05640242d000b00457d16e283dmr30745489edc.395.1666621128546; Mon, 24 Oct 2022 07:18:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621128; cv=none; d=google.com; s=arc-20160816; b=VJrxKbyrr9vQvu+3DJVWA2H27loavnLgXjG3uMaSKslLvrLHjHftDlwx7tcJ+YGYZ9 UNty/ek8sxmwzXaqacoie1ollxPVqvRXNpGCRQ8tstzMgt2TpWVNFTZ55WgULh3EAIH7 5iCFqsxG9dvVeJ3E++qFGAvO9Xj82yOPX25Cus3TGOl2nRUcJUmDirzYPJ51/Xg4tTwp WmRmo/jy20KjX4CKv/czBxHQ+5oy6j59sfwVnwOKbJuQFsRvYRU/RsIGD1BID07tHvhp NgJVJaKM+CWHYT7DbNKs+3nZ8D0/opLRx2iG+3GFx1NJeCEgahm2EXkythu5HR9qqX2i 8xDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=v52LsNJRhRYgK1188VNSSNj6AzDEb8TE9Fh67feCAl4=; b=NxP3jDYB81mLOrRw+NaEzZOE9FCRaqcr5yi/tI8CC7JfTf1cybonNcXqTw6RcF4MgA nk6FEIol0pXR24lWxJF4ijSyIc4jJXD3poEfdeQw6jPv+L3Md/jPmHEBISZAuskV05kE 0SdvUJkrdArukPqLIjnSbZEC49XkgaGxrZ2TyTslrn5bO5fkHZJGQrce+6MRtkZWBe++ PeQefgyjTKI5USUBLVW8HcXMpwmSGCYN3Qy4YwXLutYvpzA/pew5uq2t8Xc33J1HOfsS HA9HRWy1+qA5/isAES93oIlFZvAcynq6iwAZY0VmaZ3UBpitAMx0A/D6WQ7CsVrdc7nm cXjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KLQ8Ws6d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fk4-20020a056402398400b00459b51c2b25si26802299edb.438.2022.10.24.07.18.15; Mon, 24 Oct 2022 07:18: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=KLQ8Ws6d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233996AbiJXOMJ (ORCPT + 99 others); Mon, 24 Oct 2022 10:12:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235387AbiJXOJL (ORCPT ); Mon, 24 Oct 2022 10: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 AAFCAC4C1A; Mon, 24 Oct 2022 05:51: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 5DFFFB8169E; Mon, 24 Oct 2022 12:29:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3D11C433D6; Mon, 24 Oct 2022 12:29:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614589; bh=c0fLL7Bh+LtakEfa2Bn6MBNMSqnGSRdb47GlY6/se8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KLQ8Ws6ddUYLCiKDOpRrFli2pADnVl4asqs7S/eZzm0tbf5lxzv4Zlp5ssI0PAiKD N1KFvshLHh2Dv394DQNdCtm4C+5MO/CHDpspISeCvaV9DO3n0F7ZMpUtgUrClT+Rj4 ocd2UsIUFnA4xMF/+IHfe5HhbI2jKm2ccsVc6h8c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Knecht , Dmitry Baryshkov , Bjorn Andersson , Bryan ODonoghue , Daniel Lezcano , Sasha Levin Subject: [PATCH 5.10 289/390] thermal/drivers/qcom/tsens-v0_1: Fix MSM8939 fourth sensor hw_id Date: Mon, 24 Oct 2022 13:31:26 +0200 Message-Id: <20221024113035.274825292@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747578916255077203?= X-GMAIL-MSGID: =?utf-8?q?1747578916255077203?= From: Vincent Knecht [ Upstream commit b0c883e900702f408d62cf92b0ef01303ed69be9 ] Reading temperature from this sensor fails with 'Invalid argument'. Looking at old vendor dts [1], its hw_id should be 3 instead of 4. Change this hw_id accordingly. [1] https://github.com/msm8916-mainline/android_kernel_qcom_msm8916/blob/master/arch/arm/boot/dts/qcom/msm8939-common.dtsi#L511 Fixes: 332bc8ebab2c ("thermal: qcom: tsens-v0_1: Add support for MSM8939") Signed-off-by: Vincent Knecht Reviewed-by: Dmitry Baryshkov Reviewed-by: Bjorn Andersson Reviewed-by: Bryan O'Donoghue Link: https://lore.kernel.org/r/20220811105014.7194-1-vincent.knecht@mailoo.org Signed-off-by: Daniel Lezcano Signed-off-by: Sasha Levin --- drivers/thermal/qcom/tsens-v0_1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thermal/qcom/tsens-v0_1.c b/drivers/thermal/qcom/tsens-v0_1.c index 4ffa2e2c0145..9b8ba429a304 100644 --- a/drivers/thermal/qcom/tsens-v0_1.c +++ b/drivers/thermal/qcom/tsens-v0_1.c @@ -522,7 +522,7 @@ static const struct tsens_ops ops_8939 = { struct tsens_plat_data data_8939 = { .num_sensors = 10, .ops = &ops_8939, - .hw_ids = (unsigned int []){ 0, 1, 2, 4, 5, 6, 7, 8, 9, 10 }, + .hw_ids = (unsigned int []){ 0, 1, 2, 3, 5, 6, 7, 8, 9, 10 }, .feat = &tsens_v0_1_feat, .fields = tsens_v0_1_regfields, From patchwork 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: 10151 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp639050wru; Mon, 24 Oct 2022 13:29:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7FtoFJCCYazKfgWX66SDomBZg6mJ3aG0LI8EEQ7FQmEtfi7fvOylnk3pLku84Xd1l0Ogpt X-Received: by 2002:a17:907:168e:b0:7a1:6786:f16 with SMTP id hc14-20020a170907168e00b007a167860f16mr11460309ejc.590.1666643345617; Mon, 24 Oct 2022 13:29:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643345; cv=none; d=google.com; s=arc-20160816; b=YeFsUVfABY84TJ2zDhsBp+2KInjBk1A/m8enG87ylWIsf6/G7IeCT0iIkDo/zZ5m+o NycP/QVOpIcAejX+fo0IRii3/SwQBsMGB0iBDgbuam+B7S8qyw62H6/C4qn5Wj3MsBoN Br8RQOBGaersRFd1buAEQlpBYe2K89yd1+98jhxJh9Mh0/nH0EZuOGTlNYFtfT/O4esD uGVBTrRGrUjIqqJAjkRMy5zGcGxYtXSvJxI8XAWnNNiJCv6K8zDky11jEI4jYC/ZkcVW 56CqcxELrgufHHExoeZN65QwSTXdia/NK9tYSF68+NtK6GHrvn5SbJRcfvzmazkMiA50 XHqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pU52KNfrFWQRkPxkmINKTMrbjamUVsH76BFBDb12iQU=; b=ySq38mmTXHirjDWtSVazsCKlgt/EkTXnsDVmhggRFJSSy8A3oR77Y22x0RpGi3F/mv 5JLchxv0eCKXmxsdzHiaxjSpJCNSUcNxHaqhttmg2WEAnNFVGJQ6VRBuZBH6r81n6ITu Q9Vk3uQPPRgzR59xTmhjEKmjm6JN90mWsyUK9zNGxd13/fmKXuDX/bbYOHgSDoRbzNyz aGZ3QY3rkAB0HDz1AmnSmg+h0ns57GcBCeZEz1Q5yeZK1Cjmx0YhZhjSLAQ7CL/Ndy0B YQShtKf3jS+gpk9F+cFwnRPSR+HDuI15OVEenpGANwzgtiqbA0TwnoUrBr+A+sNltT// yuqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RB7qKZAA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y9-20020a056402358900b00458d1c48708si816576edc.303.2022.10.24.13.28.41; Mon, 24 Oct 2022 13:29: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=RB7qKZAA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234020AbiJXUQh (ORCPT + 99 others); Mon, 24 Oct 2022 16:16:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234122AbiJXUQG (ORCPT ); Mon, 24 Oct 2022 16:16:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C0BCB65; Mon, 24 Oct 2022 11:33: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 EA3E4B815AC; Mon, 24 Oct 2022 12:29:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E5F6C433D7; Mon, 24 Oct 2022 12:29:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614591; bh=qdJdH1Ww3YeKPIgjETV1ThfvN509TAE5iFLPR3eu1+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RB7qKZAAruMHFPFNb/aU7VcrtqaPOZh4ZdWDiEl2mlg9VHqyjyQIWSZ2c/ot7Jf5m PVZTH5TGfiPqRn8GjsBw9UnyNfzbczYqdsdeP1rdZ14McSHi/WxFzIZNbybzoCthY1 9Q8QKoyEC7fZb+cuXsXnFTnpJT42C1UFxCFDGzMg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shuai Xue , Tony Luck , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.10 290/390] ACPI: APEI: do not add task_work to kernel thread to avoid memory leak Date: Mon, 24 Oct 2022 13:31:27 +0200 Message-Id: <20221024113035.325362340@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602212831667130?= X-GMAIL-MSGID: =?utf-8?q?1747602212831667130?= From: Shuai Xue [ Upstream commit 415fed694fe11395df56e05022d6e7cee1d39dd3 ] If an error is detected as a result of user-space process accessing a corrupt memory location, the CPU may take an abort. Then the platform firmware reports kernel via NMI like notifications, e.g. NOTIFY_SEA, NOTIFY_SOFTWARE_DELEGATED, etc. For NMI like notifications, commit 7f17b4a121d0 ("ACPI: APEI: Kick the memory_failure() queue for synchronous errors") keep track of whether memory_failure() work was queued, and make task_work pending to flush out the queue so that the work is processed before return to user-space. The code use init_mm to check whether the error occurs in user space: if (current->mm != &init_mm) The condition is always true, becase _nobody_ ever has "init_mm" as a real VM any more. In addition to abort, errors can also be signaled as asynchronous exceptions, such as interrupt and SError. In such case, the interrupted current process could be any kind of thread. When a kernel thread is interrupted, the work ghes_kick_task_work deferred to task_work will never be processed because entry_handler returns to call ret_to_kernel() instead of ret_to_user(). Consequently, the estatus_node alloced from ghes_estatus_pool in ghes_in_nmi_queue_one_entry() will not be freed. After around 200 allocations in our platform, the ghes_estatus_pool will run of memory and ghes_in_nmi_queue_one_entry() returns ENOMEM. As a result, the event failed to be processed. sdei: event 805 on CPU 113 failed with error: -2 Finally, a lot of unhandled events may cause platform firmware to exceed some threshold and reboot. The condition should generally just do if (current->mm) as described in active_mm.rst documentation. Then if an asynchronous error is detected when a kernel thread is running, (e.g. when detected by a background scrubber), do not add task_work to it as the original patch intends to do. Fixes: 7f17b4a121d0 ("ACPI: APEI: Kick the memory_failure() queue for synchronous errors") Signed-off-by: Shuai Xue Reviewed-by: Tony Luck Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/apei/ghes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index 0c8330ed1ffd..5206fd3b7867 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -985,7 +985,7 @@ static void ghes_proc_in_irq(struct irq_work *irq_work) ghes_estatus_cache_add(generic, estatus); } - if (task_work_pending && current->mm != &init_mm) { + if (task_work_pending && current->mm) { estatus_node->task_work.func = ghes_kick_task_work; estatus_node->task_work_cpu = smp_processor_id(); ret = task_work_add(current, &estatus_node->task_work, From patchwork 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: 9154 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457761wru; Mon, 24 Oct 2022 06:36:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6XL2qcXs68Gt4aFNvelgyXJyNV8s6gT5/1qRgkhItOikNNOX6UkaI8++1kOQ5FdALlg4LL X-Received: by 2002:a05:6402:2073:b0:461:5462:9dc9 with SMTP id bd19-20020a056402207300b0046154629dc9mr15512979edb.52.1666618589323; 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=oescngMZGbLfQG71NUvxfOQOLR0Mf7G2DTbF2hXBVGvPoJrql5olYh/DLjiXCfGZ75 s2THgjQDvTr6vN66hYvo0aSI2vEWS2QsxfNUtQa89AAPYZWyfLk78yXr6AQPm8npUN3U 2Y+D5F/Vwqeur8v2cjaYNIZD7Pz1bQBy8yb1Q9Sidjv6SPvRA9/gwKLZjNfP3XxUq/t7 bfUK/jFJUDqUQZs/q+X7uu2Nw1PSTNxl1jS68gzUYMg6PoxKq3/9blhDviEl8h7kTkzE SUhdhgb4F2SvLy/LoAhbYhrS//ixjDzGf+eA6SBGP+/SzDrBga1UeptBeV1zkbEQG/xV H3zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FbC/e+wJxcCvquUUbOiQGM7d2pvdSawDmN5qj1qnV78=; b=phvOiXJtUwo17PCZaChL3dSWc7no/hoM5dGjPPQKENyz1Mm6Sa4qZ8KocBi/OV81HT vP9xWziaOksdHjH0rMpT5AKhbTOfGgj1WGgg7Wzon+aNlqASxGWPh9Oka9pOyIiZrlPz bi88Ezxx7EXogYZVq0saQLWgCV2P1hbtgnlQlLiWXeO1vlTlNnw1wYzKUNJ5tBVgWQcD 3xy95Pcl6xN5E0iEqT5W5c4g2yhPbkthdmEulu4WtS5zqucDqZVsweDJgaZ1LJDPO5vS slhS4hXzWUSixE3VEltcVFW8BSuBqcKAoQnX4DFPTK8Jj+v1IzYhWiVaME6OARC9qhqB kkmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QGur3clO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dd11-20020a1709069b8b00b007a7d37e4684si3580721ejc.803.2022.10.24.06.35.57; 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=QGur3clO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232927AbiJXN1o (ORCPT + 99 others); Mon, 24 Oct 2022 09:27:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236311AbiJXNZB (ORCPT ); Mon, 24 Oct 2022 09:25: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 2FCEEA8CCA; Mon, 24 Oct 2022 05: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 dfw.source.kernel.org (Postfix) with ESMTPS id 2314361333; Mon, 24 Oct 2022 12:29:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 378ECC433C1; Mon, 24 Oct 2022 12:29:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614594; bh=VwMcaMFBPeYFXLMeNt06awjTRxjiHCwvRjs5lqUYO/M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QGur3clOEnokqvXyVlNaFPpoYcYv62tH74PSfEveZMEih3s4G0FVO779+fHJIWNJN Lld+wTVqeeRHTYaDCBzrYxzgwRQhJ40TCx+91VMWrrbNa/qSVr21qGlXX50Uf8nuxH 71Ge76Da9zBKj7e3Zt/qeIpuhjj2rchGyuRAuqvI= 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.10 291/390] f2fs: fix race condition on setting FI_NO_EXTENT flag Date: Mon, 24 Oct 2022 13:31:28 +0200 Message-Id: <20221024113035.374091493@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_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?1747576253963411252?= X-GMAIL-MSGID: =?utf-8?q?1747576253963411252?= 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 3ebf976a682d..bd16c78b5bf2 100644 --- a/fs/f2fs/extent_cache.c +++ b/fs/f2fs/extent_cache.c @@ -762,9 +762,8 @@ void f2fs_drop_extent_tree(struct inode *inode) if (!f2fs_may_extent_tree(inode)) return; - set_inode_flag(inode, FI_NO_EXTENT); - write_lock(&et->lock); + set_inode_flag(inode, FI_NO_EXTENT); __free_extent_tree(sbi, et); if (et->largest.len) { et->largest.len = 0; From patchwork Mon Oct 24 11:31:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9351 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp467113wru; Mon, 24 Oct 2022 06:56:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ecZlIwlHD8lWQ1ii44PEUJ2/BljWcR3GCyf85nJumCEqOCb3mO8LkAHVfstTf9fvj5YYh X-Received: by 2002:a17:902:b942:b0:178:be25:203f with SMTP id h2-20020a170902b94200b00178be25203fmr34144954pls.101.1666619803142; Mon, 24 Oct 2022 06:56:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619803; cv=none; d=google.com; s=arc-20160816; b=SWNcAvHEXmsaee56JSoJPxxNtDqA91MktFmZaII28M+NdAzhsJ29nQGlCbR9KDZLIY 0uUqpcymX09Tdk9NXOrSYjYNLpMyrCKnRzR3OKImHMx88II7uJv4rJ4ftA+TdD+NQlrI VI5kHoWeWzIywf/elTbAuY4vHXKzusSzMhMQBUCWX0x9AhiYXz0lFZNIFOkx+JP3AcGz FgyRJgChYxcMPnyUFtyvtwbl3DDx07KKPm1gSM3MEQUklP3Bset2QNTpgzhqskLCoopT DhzfXjuGycbCkaS9tzoDj/aKuB0rGRAHpyWfixPGsXVy7nCNk9v2WlBpwW8YE9cwwghH krzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AFL0En9K/ZWtcN74V2n1PX04U81WtC27940H5KcsPvY=; b=gITftMlL/UdNPjHVcU7H9Um5ySq9oc8zDMp4HzT3TmpIlfTUnf3l9XVjvqpeTUvbb5 P+ztXhoqkDOFR9BicFZjd9BZ8/EKhVOv5A1aI+htBmPUm+bm+BiNzObNwq3AVOJIZfUz UNQpNMSF3AsdcSsLhMMapHrxATF18dhFFdcX6Q6ZXKl4aclG3VBc8LWgy7E7CotkZr2n mCWULFbwGTO7TGUGfbUIgkM4QGU5qJNwjee/6qrD8URY8XpdpEf8wdnXNRLG+1pT22it h2QMVT5W7OkivqQzePUsJutIiky/zAWHQD5neup0TgTWm3YJ3N6TrjT6hRbdS2iE/j+w gt5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F6kfXTBr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n31-20020a17090a5aa200b00201d6d4cc79si9448701pji.113.2022.10.24.06.56.28; Mon, 24 Oct 2022 06:56: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=F6kfXTBr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236792AbiJXN4L (ORCPT + 99 others); Mon, 24 Oct 2022 09:56:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236777AbiJXNyG (ORCPT ); Mon, 24 Oct 2022 09: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 CCACFBC476; Mon, 24 Oct 2022 05:43:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C77A3612FC; Mon, 24 Oct 2022 12:28:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBA17C433D6; Mon, 24 Oct 2022 12:28:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614518; bh=xUR1DwuGdTG1CYeye9s5R/gGLasGeNQAl7kbcdATpBk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F6kfXTBrplyJIN4LlAErJDG1hfCxehAlCiSzOMyzNKUzhQKWhqIiSlqfV8RALpK90 QpSHNMAoxR+r5vXh1Vgki0ab8bYYxlXzMSLLo1o+/izwpD3UCwSF42EBR0QqrLNvIv Z8Ia1JCqXOiMbau08ySuaFBOxmne4Ge2GE8wgK0I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lei Li , Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.10 292/390] f2fs: fix to avoid REQ_TIME and CP_TIME collision Date: Mon, 24 Oct 2022 13:31:29 +0200 Message-Id: <20221024113035.422754576@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747577526485103134?= X-GMAIL-MSGID: =?utf-8?q?1747577526485103134?= From: Chao Yu [ Upstream commit 493720a4854343b7c3fe100cda6a3a2c3f8d4b5d ] Lei Li reported a issue: if foreground operations are frequent, background checkpoint may be always skipped due to below check, result in losing more data after sudden power-cut. f2fs_balance_fs_bg() ... if (!is_idle(sbi, REQ_TIME) && (!excess_dirty_nats(sbi) && !excess_dirty_nodes(sbi))) return; E.g: cp_interval = 5 second idle_interval = 2 second foreground operation interval = 1 second (append 1 byte per second into file) In such case, no matter when it calls f2fs_balance_fs_bg(), is_idle(, REQ_TIME) returns false, result in skipping background checkpoint. This patch changes as below to make trigger condition being more reasonable: - trigger sync_fs() if dirty_{nats,nodes} and prefree segs exceeds threshold; - skip triggering sync_fs() if there is any background inflight IO or there is foreground operation recently and meanwhile cp_rwsem is being held by someone; Reported-by: Lei Li Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Stable-dep-of: d80afefb17e0 ("f2fs: fix to account FS_CP_DATA_IO correctly") Signed-off-by: Sasha Levin --- fs/f2fs/f2fs.h | 19 +++++++++++++------ fs/f2fs/segment.c | 47 +++++++++++++++++++++++++++-------------------- 2 files changed, 40 insertions(+), 26 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index dbe9fcef07e3..70fec13d35b7 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -2426,24 +2426,31 @@ static inline void *f2fs_kmem_cache_alloc(struct kmem_cache *cachep, return entry; } -static inline bool is_idle(struct f2fs_sb_info *sbi, int type) +static inline bool is_inflight_io(struct f2fs_sb_info *sbi, int type) { - if (sbi->gc_mode == GC_URGENT_HIGH) - return true; - if (get_pages(sbi, F2FS_RD_DATA) || get_pages(sbi, F2FS_RD_NODE) || get_pages(sbi, F2FS_RD_META) || get_pages(sbi, F2FS_WB_DATA) || get_pages(sbi, F2FS_WB_CP_DATA) || get_pages(sbi, F2FS_DIO_READ) || get_pages(sbi, F2FS_DIO_WRITE)) - return false; + return true; if (type != DISCARD_TIME && SM_I(sbi) && SM_I(sbi)->dcc_info && atomic_read(&SM_I(sbi)->dcc_info->queued_discard)) - return false; + return true; if (SM_I(sbi) && SM_I(sbi)->fcc_info && atomic_read(&SM_I(sbi)->fcc_info->queued_flush)) + return true; + return false; +} + +static inline bool is_idle(struct f2fs_sb_info *sbi, int type) +{ + if (sbi->gc_mode == GC_URGENT_HIGH) + return true; + + if (is_inflight_io(sbi, type)) return false; if (sbi->gc_mode == GC_URGENT_LOW && diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 19224e7d2ad0..173161f1ced0 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -536,31 +536,38 @@ void f2fs_balance_fs_bg(struct f2fs_sb_info *sbi, bool from_bg) else f2fs_build_free_nids(sbi, false, false); - if (!is_idle(sbi, REQ_TIME) && - (!excess_dirty_nats(sbi) && !excess_dirty_nodes(sbi))) + if (excess_dirty_nats(sbi) || excess_dirty_nodes(sbi) || + excess_prefree_segs(sbi)) + goto do_sync; + + /* there is background inflight IO or foreground operation recently */ + if (is_inflight_io(sbi, REQ_TIME) || + (!f2fs_time_over(sbi, REQ_TIME) && rwsem_is_locked(&sbi->cp_rwsem))) return; + /* exceed periodical checkpoint timeout threshold */ + if (f2fs_time_over(sbi, CP_TIME)) + goto do_sync; + /* checkpoint is the only way to shrink partial cached entries */ - if (!f2fs_available_free_memory(sbi, NAT_ENTRIES) || - !f2fs_available_free_memory(sbi, INO_ENTRIES) || - excess_prefree_segs(sbi) || - excess_dirty_nats(sbi) || - excess_dirty_nodes(sbi) || - f2fs_time_over(sbi, CP_TIME)) { - if (test_opt(sbi, DATA_FLUSH) && from_bg) { - struct blk_plug plug; - - mutex_lock(&sbi->flush_lock); - - blk_start_plug(&plug); - f2fs_sync_dirty_inodes(sbi, FILE_INODE); - blk_finish_plug(&plug); + if (f2fs_available_free_memory(sbi, NAT_ENTRIES) || + f2fs_available_free_memory(sbi, INO_ENTRIES)) + return; - mutex_unlock(&sbi->flush_lock); - } - f2fs_sync_fs(sbi->sb, true); - stat_inc_bg_cp_count(sbi->stat_info); +do_sync: + if (test_opt(sbi, DATA_FLUSH) && from_bg) { + struct blk_plug plug; + + mutex_lock(&sbi->flush_lock); + + blk_start_plug(&plug); + f2fs_sync_dirty_inodes(sbi, FILE_INODE); + blk_finish_plug(&plug); + + mutex_unlock(&sbi->flush_lock); } + f2fs_sync_fs(sbi->sb, true); + stat_inc_bg_cp_count(sbi->stat_info); } static int __submit_flush_wait(struct f2fs_sb_info *sbi, 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: 9315 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp465222wru; Mon, 24 Oct 2022 06:52:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6cbFKRThWldyQBU/U6shpfLLF1Wt1E0ficN2UedtuoeQVd5v7r9HcgqEwrOH9FhnG1fevw X-Received: by 2002:a05:6a00:1504:b0:56b:bebb:4d2f with SMTP id q4-20020a056a00150400b0056bbebb4d2fmr6788937pfu.48.1666619532550; Mon, 24 Oct 2022 06:52:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619532; cv=none; d=google.com; s=arc-20160816; b=DIUvh1F08Sv1Cmx72cPb0Z5/GINAzPA1GtSuBustVFHhoNVq6933PmVo+Xw3x2cAHh qy5y1mubafjL7+Llu1lZFmtBnEWpKhnoUoxLknskxZfDasQLGY+rDaRtcg55TZFHe/Vg SwrktWNsIrxvEGij/UQflcfevuYwbisqbxM8FaDUG83fQOi9d2DXZRC0f8zCec0yQW1t PU/nmnBCwbaURmJr0BnVlAisvIvooK3ztEW/0fCB+V7WKbKzLGc5tX/3sk1VEvTjkVd+ Bayj2sgNI88WfHHcEeWoKGM1q0Prr3hzXaXQLo1JtPahXXILetkjafYLfBJ1yCXvrPPo rpNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GacF4dtoktsyw9Qs+WSfXI5fXv1l3edVHuGy9mQ4AEg=; b=EbUC7EJ43xv82SXu+jxR+/YJ7tQUmkgd8i53sd495vdQbAUQgjac7uP9ghdI/6NCKP TfOhxr1idYet754QMZnpo8Z/6PQ0GWpYv6TUAw5JpyATD8ejXpK8jlYi/lUWK4ZoAKev wGNRHOvzUOUotCEZahKzfu6YHNuti/AnquDUJclXMlgyKHONLE+RuNr2NFM+Zq6hzqsF 9buNVdj//+MNSt82SkLZhDJHNc2si8tGbZFJ4ImL3zpGtNp+9QBYMI8nL9YlOmrByqqR /3gzq1aNMjHqGV1ajKkgCHbOAR1kyvdrsHJOcTVXhW+Cvh88GvPH5tRtO/oA6p56tbeT FANQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IMlAKJbX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q16-20020a170902dad000b00177568a0e53si38954653plx.252.2022.10.24.06.51.59; Mon, 24 Oct 2022 06: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=IMlAKJbX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236560AbiJXNvf (ORCPT + 99 others); Mon, 24 Oct 2022 09:51:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236503AbiJXNub (ORCPT ); Mon, 24 Oct 2022 09:50:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FD80BA90A; Mon, 24 Oct 2022 05:42: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 3CC7E612FE; Mon, 24 Oct 2022 12:28:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 535A5C43142; Mon, 24 Oct 2022 12:28:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614520; bh=ZCeqhoq1YN+Prn8kkYYBW1IXUcvtUsTkx6uyw8fyukE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IMlAKJbXmvX5c7PnwMKPhy5gHkZ18eX5TnjyugCESIPt0fq2LOkEXVBLsFKBwW2/8 lG+mNLN2h+anj2bEjUEvw3GBm+VVZ7mSEv5/3Vsjf6uuTVH62sbD5cRikE/f4yFeAN 3q2d2/oy1HX2UlZhwoNvGGnnmbJHWWpJvBEgooCY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.10 293/390] f2fs: fix to account FS_CP_DATA_IO correctly Date: Mon, 24 Oct 2022 13:31:30 +0200 Message-Id: <20221024113035.474956443@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747577242960999095?= X-GMAIL-MSGID: =?utf-8?q?1747577242960999095?= From: Chao Yu [ Upstream commit d80afefb17e01aa0c46a8eebc01882e0ebd8b0f6 ] f2fs_inode_info.cp_task was introduced for FS_CP_DATA_IO accounting since commit b0af6d491a6b ("f2fs: add app/fs io stat"). However, cp_task usage coverage has been increased due to below commits: commit 040d2bb318d1 ("f2fs: fix to avoid deadloop if data_flush is on") commit 186857c5a14a ("f2fs: fix potential recursive call when enabling data_flush") So that, if data_flush mountoption is on, when data flush was triggered from background, the IO from data flush will be accounted as checkpoint IO type incorrectly. In order to fix this issue, this patch splits cp_task into two: a) cp_task: used for IO accounting b) wb_task: used to avoid deadlock Fixes: 040d2bb318d1 ("f2fs: fix to avoid deadloop if data_flush is on") Fixes: 186857c5a14a ("f2fs: fix potential recursive call when enabling data_flush") Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/checkpoint.c | 13 +++++++++---- fs/f2fs/data.c | 4 ++-- fs/f2fs/f2fs.h | 4 +++- fs/f2fs/segment.c | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 0653c54873b5..cd46a64ace1b 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -1047,7 +1047,8 @@ void f2fs_remove_dirty_inode(struct inode *inode) spin_unlock(&sbi->inode_lock[type]); } -int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type) +int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type, + bool from_cp) { struct list_head *head; struct inode *inode; @@ -1082,11 +1083,15 @@ int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type) if (inode) { unsigned long cur_ino = inode->i_ino; - F2FS_I(inode)->cp_task = current; + if (from_cp) + F2FS_I(inode)->cp_task = current; + F2FS_I(inode)->wb_task = current; filemap_fdatawrite(inode->i_mapping); - F2FS_I(inode)->cp_task = NULL; + F2FS_I(inode)->wb_task = NULL; + if (from_cp) + F2FS_I(inode)->cp_task = NULL; iput(inode); /* We need to give cpu to another writers. */ @@ -1215,7 +1220,7 @@ static int block_operations(struct f2fs_sb_info *sbi) /* write all the dirty dentry pages */ if (get_pages(sbi, F2FS_DIRTY_DENTS)) { f2fs_unlock_all(sbi); - err = f2fs_sync_dirty_inodes(sbi, DIR_INODE); + err = f2fs_sync_dirty_inodes(sbi, DIR_INODE, true); if (err) return err; cond_resched(); diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index b2016fd3a7ca..9270330ec5ce 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2912,7 +2912,7 @@ int f2fs_write_single_data_page(struct page *page, int *submitted, } unlock_page(page); if (!S_ISDIR(inode->i_mode) && !IS_NOQUOTA(inode) && - !F2FS_I(inode)->cp_task && allow_balance) + !F2FS_I(inode)->wb_task && allow_balance) f2fs_balance_fs(sbi, need_balance_fs); if (unlikely(f2fs_cp_error(sbi))) { @@ -3210,7 +3210,7 @@ static inline bool __should_serialize_io(struct inode *inode, struct writeback_control *wbc) { /* to avoid deadlock in path of data flush */ - if (F2FS_I(inode)->cp_task) + if (F2FS_I(inode)->wb_task) return false; if (!S_ISREG(inode->i_mode)) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 70fec13d35b7..c03fdda1bddf 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -701,6 +701,7 @@ struct f2fs_inode_info { unsigned int clevel; /* maximum level of given file name */ struct task_struct *task; /* lookup and create consistency */ struct task_struct *cp_task; /* separate cp/wb IO stats*/ + struct task_struct *wb_task; /* indicate inode is in context of writeback */ nid_t i_xattr_nid; /* node id that contains xattrs */ loff_t last_disk_size; /* lastly written file size */ spinlock_t i_size_lock; /* protect last_disk_size */ @@ -3400,7 +3401,8 @@ int f2fs_recover_orphan_inodes(struct f2fs_sb_info *sbi); int f2fs_get_valid_checkpoint(struct f2fs_sb_info *sbi); void f2fs_update_dirty_page(struct inode *inode, struct page *page); void f2fs_remove_dirty_inode(struct inode *inode); -int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type); +int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type, + bool from_cp); void f2fs_wait_on_all_pages(struct f2fs_sb_info *sbi, int type); int f2fs_write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc); void f2fs_init_ino_entry_info(struct f2fs_sb_info *sbi); diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 173161f1ced0..3123fd49c8ce 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -561,7 +561,7 @@ void f2fs_balance_fs_bg(struct f2fs_sb_info *sbi, bool from_bg) mutex_lock(&sbi->flush_lock); blk_start_plug(&plug); - f2fs_sync_dirty_inodes(sbi, FILE_INODE); + f2fs_sync_dirty_inodes(sbi, FILE_INODE, false); blk_finish_plug(&plug); mutex_unlock(&sbi->flush_lock); From patchwork 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: 9204 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp459024wru; Mon, 24 Oct 2022 06:38:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4JXY2PoKTXusNiWKQn1ols9kh+vZYQT6EIEwDlY+j4ybXWCbxtA6/+Qg5iQNbQvgixxvIz X-Received: by 2002:a17:906:fd8d:b0:780:997:8b7b with SMTP id xa13-20020a170906fd8d00b0078009978b7bmr28143918ejb.635.1666618713371; Mon, 24 Oct 2022 06:38:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618713; cv=none; d=google.com; s=arc-20160816; b=EtyEyAoPqc7Ee4NFiRwnrpBCK2RIX/gRx7ALIZhfO6uY/YdkTWXWgmSydOJ8MtBKd2 zHcnmPweey4Hytm+hbCNikP1g/176bSOV6zaQRhLvZKe9gekILy8tY527LUJGfWJ3Hst ihipSjTT0buG/xIr47h+XqAFYsngbE3ciEiQ8fATjectvWrOxpVJbT8a7CIPAu5OoqJe fjlrJiAqw1LqvNgP9RNHJGFZDiIbDba6iijX8bxG7bKPslDbBapY16t6iV9kWj8RXOfX nVGxsZW5yN6Sl03WQa+UerlKS3gnloto6E1bux5gBX3kQATXC/vaMx7/9Mx8foDV6+U+ JquA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qlt9lT4yKE11AXak/uwiVWcQH6N8U4aMfHMr/RU2qik=; b=hqP8j4W+mNfzcT9Ootr9glm6DxX3Nsenml5vDNDiA7V7E4owTvlyEByD3tm9CtSEAn pwGNQtms4jQX0xOYE3U24Vf1s7sNZfRj8ipiMoWq2gA71y7BVvG0JJg6XZi7VVg4VpgX 7huZekm4v/UEobp4y9Itph/sL9OG2oORhyKi91i8sraOpckD+MJlFGLowOou7SG6Vzfk a+RkZb9ZGQI5pybWhS1YazhBTay3U/yc8fQukFOSejx9f1IMPfj1byDIJQcxBi6OfaEZ 5zlJvImsKAzx5da4QxKKvGGt4/6dkcnfKd2yzaTofRQ4veaEbjcK+QqVDph3Kz1XqP9h Ev7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jOJwNlQk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb2-20020a170907960200b007882926c090si33405532ejc.773.2022.10.24.06.37.54; Mon, 24 Oct 2022 06:38: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=jOJwNlQk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231294AbiJXN00 (ORCPT + 99 others); Mon, 24 Oct 2022 09:26:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233747AbiJXNXh (ORCPT ); Mon, 24 Oct 2022 09:23:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46A3A5072F; Mon, 24 Oct 2022 05: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 dfw.source.kernel.org (Postfix) with ESMTPS id DD4EB61328; Mon, 24 Oct 2022 12:28:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC79EC433C1; Mon, 24 Oct 2022 12:28:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614523; bh=SQBhvpbr67nNnwBS9iLoISYpMqP1aXfZOUUFaVU+bMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jOJwNlQk/bc7Y1f4MO3jGG0G262z/aomhlQ8tcnOdXvb2qkRDQpvERoNZxWn3MZ3M i8yb/Vs/Ma4coqK8bEWnVjc2o8QmHuuOwI7K8KQZ0f7vd98YwgGtVzWKIxy8slXcFv 5TSAZkTou9cu+CbNhcwOz0qDLJ9WFGd69zzjVwCo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shuah Khan , linux-kselftest@vger.kernel.org, Jarkko Sakkinen , Stefan Berger , Sasha Levin Subject: [PATCH 5.10 294/390] selftest: tpm2: Add Client.__del__() to close /dev/tpm* handle Date: Mon, 24 Oct 2022 13:31:31 +0200 Message-Id: <20221024113035.525923548@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576383718629126?= X-GMAIL-MSGID: =?utf-8?q?1747576383718629126?= From: Stefan Berger [ Upstream commit 2d869f0b458547386fbcd8cf3004b271b7347b7f ] The following output can bee seen when the test is executed: test_flush_context (tpm2_tests.SpaceTest) ... \ /usr/lib64/python3.6/unittest/case.py:605: ResourceWarning: \ unclosed file <_io.FileIO name='/dev/tpmrm0' mode='rb+' closefd=True> An instance of Client does not implicitly close /dev/tpm* handle, once it gets destroyed. Close the file handle in the class destructor Client.__del__(). Fixes: 6ea3dfe1e0732 ("selftests: add TPM 2.0 tests") Cc: Shuah Khan Cc: linux-kselftest@vger.kernel.org Cc: Jarkko Sakkinen Signed-off-by: Stefan Berger Reviewed-by: Jarkko Sakkinen Signed-off-by: Jarkko Sakkinen Signed-off-by: Sasha Levin --- tools/testing/selftests/tpm2/tpm2.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/tpm2/tpm2.py b/tools/testing/selftests/tpm2/tpm2.py index f34486cd7342..3e67fdb518ec 100644 --- a/tools/testing/selftests/tpm2/tpm2.py +++ b/tools/testing/selftests/tpm2/tpm2.py @@ -370,6 +370,10 @@ class Client: fcntl.fcntl(self.tpm, fcntl.F_SETFL, flags) self.tpm_poll = select.poll() + def __del__(self): + if self.tpm: + self.tpm.close() + def close(self): self.tpm.close() From patchwork 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: 9387 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp478180wru; Mon, 24 Oct 2022 07:16:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7iUMV12hKrjyDZkVM7xC76l1SIeovIB/94JZ52H4wsKYp32PXEijhs9ClRQeIg0xQbVqVA X-Received: by 2002:a17:907:7b94:b0:731:1b11:c241 with SMTP id ne20-20020a1709077b9400b007311b11c241mr28475347ejc.676.1666621016950; Mon, 24 Oct 2022 07:16:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621016; cv=none; d=google.com; s=arc-20160816; b=Op8nP3qaWly89PSbsgQZK30y5ptr6ta52kZPU4Cv78SMwxBi/42KxII1+FqTRS0p0u LvYj64P5rvgTUoBoUf+zdUOCke8TThbjaHRfPrWDRPpsCFPZiZbF31T3RqNBNHUMxWT9 WcTFO2Ec7/tTKXezdJjvlwEggnaz5WKhxAdri9YIhoMaQvPj7Ka2mH2444NrdHRG/vw8 wV0zMViityxCzzUyoDBhgTxnLLsVGHKWEYjWptQ5LT5unaRrMV8wACi8jS4p23Wb/8zC CfGpOOtjciMrqSPRj/P59zI93yCcYofcOZoUi3f8V+9CZPZdQ0sK3bGRgYzUJzF/FYsl 7yAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eDLJJAY+5uIUqz7jDifqGbVUhvea7zHpB6Apq6tX1Mk=; b=HrqJZ9vnymccpebeDf5c2Iu0kGkcHLCv1RWoYtVCGFUmrzXeKekRKUpR29HwLivJZe rcUH7b1Ne6tv6P37r8fgVDpGAjDbTMUeG9zVC7rnJ1rAYMulhjSivY4oN1ZWKb0QGFoE Bn/DT6erQcLukfRHNiTgqGp6AX6Hcuc6thxYmNgrc6nEsslFpme8JALvLFcoyMiPP5gH t18D6agiQVbYTJV443/pNScIxgcJb5cTGutYMIvcQxAd0+Ts3UBePCeRoe0H8hg3AqO/ +LZ1Cq4zaec1donfXp/dpG3kzkxWIRcC9zBzmJaHWd+zpHZaVTISd+buO9SDNOfKDt88 IhwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KiYibeJ+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm4-20020a170907948400b007894b9de062si14861661ejc.631.2022.10.24.07.16.31; Mon, 24 Oct 2022 07:16:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KiYibeJ+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234643AbiJXOGW (ORCPT + 99 others); Mon, 24 Oct 2022 10:06:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235392AbiJXOCu (ORCPT ); Mon, 24 Oct 2022 10:02:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10A709083D; Mon, 24 Oct 2022 05:48:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8544C612E6; Mon, 24 Oct 2022 12:28:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69A34C433C1; Mon, 24 Oct 2022 12:28:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614525; bh=la6Focf99ixLU4gXyDPCNI6jI7AOOZrRr8SSC+3kks4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KiYibeJ+4YFAQx1zcFpOkZgBQGYXmQbXn5+7NM8+ZKwFCvZNt+AYEMryAmdI1uO4b u4FfC6q5IgHr6XQUUIouc99mGgXIN1fTn6S4Io1DcVg/eCCQS5UZSaEu6CRIq23e9B tSH1gH/gWCJ3cCiddYS0STlGfIdNRVwvuB1ZRco8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Uladzislau Rezki (Sony)" , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Joel Fernandes , Michal Hocko , Sasha Levin Subject: [PATCH 5.10 295/390] rcu: Back off upon fill_page_cache_func() allocation failure Date: Mon, 24 Oct 2022 13:31:32 +0200 Message-Id: <20221024113035.566284035@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747578799245569443?= X-GMAIL-MSGID: =?utf-8?q?1747578799245569443?= From: Michal Hocko [ Upstream commit 093590c16b447f53e66771c8579ae66c96f6ef61 ] The fill_page_cache_func() function allocates couple of pages to store kvfree_rcu_bulk_data structures. This is a lightweight (GFP_NORETRY) allocation which can fail under memory pressure. The function will, however keep retrying even when the previous attempt has failed. This retrying is in theory correct, but in practice the allocation is invoked from workqueue context, which means that if the memory reclaim gets stuck, these retries can hog the worker for quite some time. Although the workqueues subsystem automatically adjusts concurrency, such adjustment is not guaranteed to happen until the worker context sleeps. And the fill_page_cache_func() function's retry loop is not guaranteed to sleep (see the should_reclaim_retry() function). And we have seen this function cause workqueue lockups: kernel: BUG: workqueue lockup - pool cpus=93 node=1 flags=0x1 nice=0 stuck for 32s! [...] kernel: pool 74: cpus=37 node=0 flags=0x1 nice=0 hung=32s workers=2 manager: 2146 kernel: pwq 498: cpus=249 node=1 flags=0x1 nice=0 active=4/256 refcnt=5 kernel: in-flight: 1917:fill_page_cache_func kernel: pending: dbs_work_handler, free_work, kfree_rcu_monitor Originally, we thought that the root cause of this lockup was several retries with direct reclaim, but this is not yet confirmed. Furthermore, we have seen similar lockups without any heavy memory pressure. This suggests that there are other factors contributing to these lockups. However, it is not really clear that endless retries are desireable. So let's make the fill_page_cache_func() function back off after allocation failure. Cc: Uladzislau Rezki (Sony) Cc: "Paul E. McKenney" Cc: Frederic Weisbecker Cc: Neeraj Upadhyay Cc: Josh Triplett Cc: Steven Rostedt Cc: Mathieu Desnoyers Cc: Lai Jiangshan Cc: Joel Fernandes Signed-off-by: Michal Hocko Reviewed-by: Uladzislau Rezki (Sony) Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin --- kernel/rcu/tree.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index b41009a283ca..b10d6bcea77d 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -3393,15 +3393,16 @@ static void fill_page_cache_func(struct work_struct *work) bnode = (struct kvfree_rcu_bulk_data *) __get_free_page(GFP_KERNEL | __GFP_NORETRY | __GFP_NOMEMALLOC | __GFP_NOWARN); - if (bnode) { - raw_spin_lock_irqsave(&krcp->lock, flags); - pushed = put_cached_bnode(krcp, bnode); - raw_spin_unlock_irqrestore(&krcp->lock, flags); + if (!bnode) + break; - if (!pushed) { - free_page((unsigned long) bnode); - break; - } + raw_spin_lock_irqsave(&krcp->lock, flags); + pushed = put_cached_bnode(krcp, bnode); + raw_spin_unlock_irqrestore(&krcp->lock, flags); + + if (!pushed) { + free_page((unsigned long) bnode); + break; } } From patchwork 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: 9197 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458924wru; Mon, 24 Oct 2022 06:38:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7cu/IzNuB45I6NgF4z19lUpYcWY2j6/ICzBrmfIcw1cZd1nISVjmXWUGKmsFo+NLbJf/1o X-Received: by 2002:a05:6402:3645:b0:45f:e918:9f35 with SMTP id em5-20020a056402364500b0045fe9189f35mr21765048edb.118.1666618711935; Mon, 24 Oct 2022 06:38:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618711; cv=none; d=google.com; s=arc-20160816; b=z2W8Rso+1r2THCi8ZFPD0uFE+bkStggjY9FxyfhHiHkhAfX51H5zZosKaD1C8SDaIv VTaOZe0BLLCKrzC/uBOnIwbLlWcZgDwutamXDiAIP+hhmzj3rPX5feNwQdKTIfnVBrNY oRQD+d+Pa7JKF8drEt6MuyGkRn1arH6BxhNikqIiNVJaUivEAGO2sCunbH+7dx7i+dyT NH+ubK9dI5FDX/MuLJWgygwb02hPP74e5viuy4yAuEVCeqQaOTYgQ22ynqGl9sfTWb5y MquXo8h0psvfs57cTkp+tWP/RuK1TdKYAhy1HZbcMa+bgdl/zDeag5sf9LZZf/KG6O3s ur2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ykvVFnRRm1cLAR1KbjAheT2ulbhsVVh1kZjf4ld2xAY=; b=gbarInvRJe9xfMge9GctEAHgCal26KouZXWRMIl86D6JljZgnZxeUO2xFCyjJAxYcJ cpdqrWqMMDHOsPvjH1umz9CSefFNMboHD6IeHx5DcnDYfu0iPVyds+G9O03hVFFQ7sXm aB2uFLS/2jKHtvoiMVoB4m1wbA4O/DBO72yNevKWLNp0apUt7S6Bl7MXcSmceVKss50x fbcaA71ttRYF3LJLOMCOI7pBT7PuwLK//Dl0GBDVbWiV3bxBE7YXN3Bg341ChkoDVkQ5 yCzeV3PyRCkhBDtr9zEr664XlAtt84VdM2w1/F+x3FKyBnftCusHiAFqGrVTTTBPqW5Y gKJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KQS5Pd5l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z19-20020a056402275300b00461d8ee1316si2339503edd.21.2022.10.24.06.37.50; Mon, 24 Oct 2022 06:38: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=KQS5Pd5l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232907AbiJXN0d (ORCPT + 99 others); Mon, 24 Oct 2022 09:26:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235897AbiJXNX5 (ORCPT ); Mon, 24 Oct 2022 09:23:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC0EA53001; Mon, 24 Oct 2022 05: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 dfw.source.kernel.org (Postfix) with ESMTPS id 1B134612E7; Mon, 24 Oct 2022 12:28:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30544C433D6; Mon, 24 Oct 2022 12:28:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614528; bh=oSqopbRO77nvGov1G/esShYNUZjCZlTROPXoWvX/7Ic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KQS5Pd5lTAO8Ztw1Y3n8L2HH0vhbQ2KKUFPJVrOFEKOG2q8cvFdRvgsfpmUAP/cgJ ZyqSoLlDvCOfb17+jhchUPz+x8qZZ082ZALwErZ3cjE2xc1uxioIMdvrNJsmLTn0+V 5z10uEl1Hlwbm1MJaE55WxnrH8r6TApNPF5dC698= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zqiang , "Paul E. McKenney" , Sasha Levin Subject: [PATCH 5.10 296/390] rcu-tasks: Convert RCU_LOCKDEP_WARN() to WARN_ONCE() Date: Mon, 24 Oct 2022 13:31:33 +0200 Message-Id: <20221024113035.607806092@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576382106766893?= X-GMAIL-MSGID: =?utf-8?q?1747576382106766893?= From: Zqiang [ Upstream commit fcd53c8a4dfa38bafb89efdd0b0f718f3a03f884 ] Kernels built with CONFIG_PROVE_RCU=y and CONFIG_DEBUG_LOCK_ALLOC=y attempt to emit a warning when the synchronize_rcu_tasks_generic() function is called during early boot while the rcu_scheduler_active variable is RCU_SCHEDULER_INACTIVE. However the warnings is not actually be printed because the debug_lockdep_rcu_enabled() returns false, exactly because the rcu_scheduler_active variable is still equal to RCU_SCHEDULER_INACTIVE. This commit therefore replaces RCU_LOCKDEP_WARN() with WARN_ONCE() to force these warnings to actually be printed. Signed-off-by: Zqiang Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin --- kernel/rcu/tasks.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h index 14af29fe1377..8b51e6a5b386 100644 --- a/kernel/rcu/tasks.h +++ b/kernel/rcu/tasks.h @@ -171,7 +171,7 @@ static void call_rcu_tasks_generic(struct rcu_head *rhp, rcu_callback_t func, static void synchronize_rcu_tasks_generic(struct rcu_tasks *rtp) { /* Complain if the scheduler has not started. */ - RCU_LOCKDEP_WARN(rcu_scheduler_active == RCU_SCHEDULER_INACTIVE, + WARN_ONCE(rcu_scheduler_active == RCU_SCHEDULER_INACTIVE, "synchronize_rcu_tasks called too soon"); /* Wait for the grace period. */ 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: 9169 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457823wru; Mon, 24 Oct 2022 06:36:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4TzQJK6uBvpZtkvLvXwdOmReBpg8NataouQhLPXrIDRY3eaUd4GlqsIP644vDbGDD9PoRh X-Received: by 2002:a05:6402:5ca:b0:43b:6e01:482c with SMTP id n10-20020a05640205ca00b0043b6e01482cmr31459859edx.189.1666618595550; Mon, 24 Oct 2022 06:36:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618595; cv=none; d=google.com; s=arc-20160816; b=PkbZxRQEquvC6q57iY1EfxJTyWL8bDvP3H7TXAqk/UEV97qrOusiZDfXm2j5/a36B5 j7NGqmD6iIoma59BnQpiNvZg+kKSVqN+q2x1VS9wLLh9PyTGLXWJ58WDoIUjKUqniYWV fToTCutcKvW8MMf/DM+mgdx7ydbmdnxK4DiJqZJ97zATa2i9qWfq0AAmzt/ByhdVuZKE JE83tXPqgAigEWuVb+h5CNt3DiMFIGB8mP9ipP5nA0mNfuqc6PhDce3OZsThKEm5mDkA ++fNPsCY/DJzVg8N4CJNY4XFGKdxY+e0gGRrTABhUfaMT+t+0ql3vM5iCOu6K6xFiQu8 1G2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kbNKepokClBC+Fd8kc0clG847l0ryo303tvA4pxU038=; b=Q7wKN3I+qJjkttVfOHdk768JNPsc2qfDIDg/PZCrLWuWHyzCzGZlo52qsXAP+8IS7S 6qQ6a3yju+ntBUrSrUkVTv+lxLPSiPigx+J6C00zguAGGqNXRmVPO7kfEmboOBTxaVP4 qpoaRkE71Y+tL9/66gBwzX7MxnmfwfRZn2G3Aqb5Kcr8l2urmVSWS39aVopWQLdbhWfW NgKjZ2L6AdIe/U8mCJjM4KsVCjDKI6oTn4SW0ky0FuM5aaLa3aHaYyEUL1bT4OSNJDsg xoHnhl75Uc9E2XtCihg3/D3mY7JmOtMul6BjnA5xd3XjXhhWcbQBcsumf1yqB+ieSd0Y Vx3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZXqT+niD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b16-20020a1709063f9000b0078d44c5da0esi24560881ejj.667.2022.10.24.06.36.09; Mon, 24 Oct 2022 06: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=ZXqT+niD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232339AbiJXNbj (ORCPT + 99 others); Mon, 24 Oct 2022 09:31:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231627AbiJXN2e (ORCPT ); Mon, 24 Oct 2022 09:28:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D7FBABD6B; Mon, 24 Oct 2022 05:32: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 DDAE56128D; Mon, 24 Oct 2022 12:28:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F184BC433C1; Mon, 24 Oct 2022 12:28:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614531; bh=/hfU9Hs/EoqRC2bMqwxFdnQrXTEESji2BHKsq/LzPyQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZXqT+niDogm6V3WZfT9ZoCnpSNOjr6ZY4CibqziVrUcw4exQk42enaS06/oE6CSeA r5Pe56YdS7Ao8W8vsQp3DOLGwB0lsh97cxWBdZjlJYWdIZq2LyaPe4hnle3bEauuIh qeqCA03KBe9GwQFScB1vNIUlfYmBL2A6SqsT/PoM= 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.10 297/390] ACPI: video: Add Toshiba Satellite/Portege Z830 quirk Date: Mon, 24 Oct 2022 13:31:34 +0200 Message-Id: <20221024113035.662313201@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576260315926574?= X-GMAIL-MSGID: =?utf-8?q?1747576260315926574?= 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 eb04b2f828ee..cf6c9ffe04a2 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: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: 9886 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp571429wru; Mon, 24 Oct 2022 10:33:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7LGMsbCNAo3Fymre+nrfGVKHDV83FBDzOSvM+UGH4HknEKo+gIKEQy2SAdGQUvqqGQofQT X-Received: by 2002:a62:7b0f:0:b0:56b:e472:9e81 with SMTP id w15-20020a627b0f000000b0056be4729e81mr4721662pfc.13.1666632789854; Mon, 24 Oct 2022 10:33:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666632789; cv=none; d=google.com; s=arc-20160816; b=i6z41ueyW5qOqqLmlOo1aKXiGVNzsBtfNRVK5WAFZj2PDTW3Z5F+DkYtz8d8RA8Unw DgJsiq20qdnnOqJGpne3YT3HUMNu3cfQSp4kTUnoyssLNH5oA+x6GuNy0rTQSyQJTRkZ YwOdCSTPzsgv3tfhZPBGeV4807i2FTnhAMqvaqrMXlHKYMjMV3HWdxDN3P4i+mEhQxCL sZ8fFw51BBXWJmCvGA6dLA7yxfANrSobxG0TfFNIqA0K/ymvh4BT2CRoo50T5pgd29WZ cs5vUPS1co0/ayjNZAzAxZ+Kq9i0aNUo1xJ4ZSgOo96VJuPNTVho4N04SYIsLmGJslj1 6aoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gSykExTMx3nTCTPi7Tjh+QZ8i7+60yauknQWARfhyoc=; b=eDHO486V5yEx5p73K98WyokhYsIkN5Fm+QDKyxLuQAdOPov3Wg0VQ0Q/5cuEqrcdi1 sivLjM3Zd04RIBvylGCkXrHFeg+XSaJ9Xd7y3avK3TudVHJ2fSqFMIcYakQ8mtTEj/FP Txk5ubbUUXuKi0uYmeblNFjFIAl/hZTclL0Hi51x2bY4/QR1njDtLpSoRxksRDLUeq95 8JpG+rsAW4HTFaHOCGPwZdfJeahXqjsW8DsNq0ZVM7n8+P3o6XlfRKTxgfTEWiNeMjtV Cv2LSi0crwDq6NjJwva029ZfUg6RDNhdEFZo1mzrUC9CRDMVhZYHmZs4j4+X3lsmwRLu V4Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="My30US/X"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ng10-20020a17090b1a8a00b00205d798ce68si636781pjb.139.2022.10.24.10.32.56; Mon, 24 Oct 2022 10:33: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="My30US/X"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233143AbiJXRbn (ORCPT + 99 others); Mon, 24 Oct 2022 13:31:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231271AbiJXRbV (ORCPT ); Mon, 24 Oct 2022 13:31: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 D09102248F7; Mon, 24 Oct 2022 09:06:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 46449B8169C; Mon, 24 Oct 2022 12:28:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 703E5C433C1; Mon, 24 Oct 2022 12:28:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614534; bh=/OXXMxHwFAPpWYWH3Twq50RGB1+01cfTvXGSwWG1oCs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=My30US/Xa8JGI5vpKuIJo2oGAKC2WENgYAKVcrcl0yTgxxCZ3jk2xqoRyWJaDhxo3 7PBSup/1lXGy3qimMUOd/1IlN777hGzBLD/iZJ96BnoheHERolwRil21oErWuCu80a P6V46tUcSCUwzVBXyUhhFoNEx04CRdI7khhgzMpU= 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.10 298/390] MIPS: BCM47XX: Cast memcmp() of function to (void *) Date: Mon, 24 Oct 2022 13:31:35 +0200 Message-Id: <20221024113035.709028609@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747591144038834344?= X-GMAIL-MSGID: =?utf-8?q?1747591144038834344?= 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 3e2a8166377f..22509b5fab74 100644 --- a/arch/mips/bcm47xx/prom.c +++ b/arch/mips/bcm47xx/prom.c @@ -86,7 +86,7 @@ static __init void prom_init_mem(void) pr_debug("Assume 128MB RAM\n"); break; } - if (!memcmp(prom_init, prom_init + mem, 32)) + if (!memcmp((void *)prom_init, (void *)prom_init + mem, 32)) break; } lowmem = mem; @@ -163,7 +163,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: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: 9142 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457513wru; Mon, 24 Oct 2022 06:36:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4EIv6kA75Q26lSRwjbf9Ey3AC1wgEQHfwdn3YmiQexhqncr4tlDOpHPqf1x9lfnFwXGHmF X-Received: by 2002:a17:907:97c7:b0:79b:f7c7:35ec with SMTP id js7-20020a17090797c700b0079bf7c735ecmr13499954ejc.362.1666618568049; Mon, 24 Oct 2022 06:36:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618568; cv=none; d=google.com; s=arc-20160816; b=VVkVfUvK5XP+Jm8Y2z/V6LhRtHpCXar6ucY4lcVWATP1RADm+enf9KIXnEWxCOz61J Sr20Or5bB78g35OOHLNrEeya71CkmzFnY+8FLKRNIU2a88vr4NuqmSGXNBDkwie/H5qO E9cAUukN4nNDHkqtQq0+pbu8sxfPY02cVx+3/GE1XHR2gbGgLoRNPJCt7MqjVBel11Hh AwTK74WkqIhFE1PyYHgQuH6GryWsJDTO6JXJa7U8eJSpIUtOQFwyaIv8T1DqWIxI8Cy+ bz0QKr9fT6QfIsma1Nl7xKIcrUZEw6e72COjJMHYsmARtS9wfNrpl1vuKXF3RpOY8BTm /5TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=z88ZqQIWYE5GAUiXHsn6DX9DoS6IeTZcTk4Do9pPT0M=; b=Ie4BrXoCZM7pGhBXbSjHdv9u9xMIKt/VNFPqK4WY0hxB9FgLOPLsEq4kMOScl6/Z7Y cWDNloXxFh3O06xSFMVbTCQ2ygGbB0X/iRh+zEiJ9/f72pDLt4b+eQI8KcKQXKDNtaVq SXbwO9t6mZC7ai5iEUF1BRjUpiKzjqCPUpYh0x/Ne2/03XaX/DUVdZANbo8A1d4mlKQm rva/FEFPnASInYQlnJA5NjMN5K/UkMKolDJN7oD1k+LEuIWJM5fOgkckC3ZrCDUOEYR8 PInS6EPtk1F3oI+rJiJ8qO/0bpH+ppKeWuXgmRm1UdqF56D1eAQWr0ptya9FAzzN4iuA Pksg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=s9vHXgRq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056402350f00b0045bfaaab6d1si29293481edd.48.2022.10.24.06.35.27; Mon, 24 Oct 2022 06:36: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=s9vHXgRq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232711AbiJXN0E (ORCPT + 99 others); Mon, 24 Oct 2022 09:26:04 -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 S229983AbiJXNXb (ORCPT ); Mon, 24 Oct 2022 09:23:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 238095FF5D; Mon, 24 Oct 2022 05:30: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 2EE45612FD; Mon, 24 Oct 2022 12:28:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E9DEC433D6; Mon, 24 Oct 2022 12:28:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614536; bh=GkeTiV1jLGPSKAFxenl8FDBEIWxxDohqsgMKG+3O+rU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s9vHXgRqDGbfWiqHs65y3LPodk1MWLaS7dB9vvJ3pyaa+2TgAi7W0WVsAmOHkuLM2 dTnEfI469rdllQM3D/67oQTldyKCCIUqS95Ul0RSQ2NYk3UJ13mZujyGBw1Er8PlBW V5SN1lnXgBBN7LtDFUyzhvb2uvMH0gOPyEH2g44Q= 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.10 299/390] powercap: intel_rapl: fix UBSAN shift-out-of-bounds issue Date: Mon, 24 Oct 2022 13:31:36 +0200 Message-Id: <20221024113035.746902883@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576231312498616?= X-GMAIL-MSGID: =?utf-8?q?1747576231312498616?= 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 a13a07f475d2..285420c1eb7c 100644 --- a/drivers/powercap/intel_rapl_common.c +++ b/drivers/powercap/intel_rapl_common.c @@ -938,6 +938,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: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: 9514 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp481983wru; Mon, 24 Oct 2022 07:24:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4C1cGn/WrIJjJj86gvIzVYkeK8R7HYkvkvxhPwkXIBWjTqSfk9DYs/l0vUP4vgIGlnQBWa X-Received: by 2002:a05:6402:5483:b0:45c:1336:6d9b with SMTP id fg3-20020a056402548300b0045c13366d9bmr31063967edb.100.1666621440097; Mon, 24 Oct 2022 07:24:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621440; cv=none; d=google.com; s=arc-20160816; b=VvTkaG91HMhnHM2lOunkSQM/LextC69znfbIofWeNGwygsJhMfiFO3/WWzsSyYTK0o njr57EowJ4YZ/L+XHS9gTFL8kZ9wvK+LGeKe3vc3kpyHmwA6jI46EQoAuB7gvXVwNAvO PBEyy2Nx4b5ahDJspMsMzvgcig9Cw4AQDRxUR2Q5hLh+zLEogLfDDCkn8IUWqFcd1vZ2 3folXKouDlrpsJA+BW7CNtAKr3eP5/WoS4HJtcZEhqa6oFuk/yi7gaPr4kcsR7wuGf/K XvPwqgmdBuj1mTMsxKy+cC+/tq3ivJ7l80f3sJeP0tHUmkizpSY61fvox2v8kwmGeVfd Z7xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SzCnd8F0uIomxgYBaxg/YS8VIwVAO0rHcSo5Xqb19c8=; b=b3VQGOkcnOMFv+mRjr+J1yc9aIV/Z/6z03P/iKzhHD/WK22Y76+yc1Yfj931u3WHJp 1zIVJ4IafMcX7qno+r+1WOHAm8OzuB6E+JF7DfEi7CF9+cUfHMM6V3h9AKlmMJyAdCi9 xdXYDdduaE7E+irmy6PLKYjo2BM+ar4vHp795x500F14f7ZJcKUblAyHrl6Wj/avcbha lP8MFbuhrIqND3VqCbhk2KvyTJXARSC+5I3okseJlOp5kooQO5HN/JqwLICpdVU+i5tK X6ZAjxWOFh9yc0owBN72ZYYuW3oyYEueyH8ZSX12QGj9BzcnvhkNaECsB0s5RsShxM2m fj9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lYTtHGZg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fk5-20020a056402398500b0045154775089si27165859edb.625.2022.10.24.07.23.36; Mon, 24 Oct 2022 07:24:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lYTtHGZg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235176AbiJXOWS (ORCPT + 99 others); Mon, 24 Oct 2022 10:22:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231738AbiJXORm (ORCPT ); Mon, 24 Oct 2022 10:17: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 D42193685D; Mon, 24 Oct 2022 05:56: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 734BDB81696; Mon, 24 Oct 2022 12:29:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0ABAC433C1; Mon, 24 Oct 2022 12:28:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614539; bh=sMbI5Gj5LiK/Mj6Nr4l6ukPafQ7m5GMQYGZXTlMT9Ck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lYTtHGZglLl6iXzw0Nso53vN6fTm3Bg9USPDJy7B58BJ4udMpchiqRlYXCgAG8+hw EJbGymFSs2QEcuI1ZHg22zojFhmaLp8yCNhQVGDTT0AQIqKzIfGbg2juzfG/qdlzSj ovapUKCj9jAPoUIvqLEQoqxXgckgtVMRtoVdhrxw= 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.10 300/390] thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to avoid crash Date: Mon, 24 Oct 2022 13:31:37 +0200 Message-Id: <20221024113035.795106399@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747579243116871605?= X-GMAIL-MSGID: =?utf-8?q?1747579243116871605?= 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 b0eb5ece9243..14381f7587ff 100644 --- a/drivers/thermal/intel/intel_powerclamp.c +++ b/drivers/thermal/intel/intel_powerclamp.c @@ -532,8 +532,10 @@ static int start_power_clamp(void) /* prefer BSP */ control_cpu = 0; - if (!cpu_online(control_cpu)) - control_cpu = smp_processor_id(); + if (!cpu_online(control_cpu)) { + control_cpu = get_cpu(); + put_cpu(); + } clamping = true; schedule_delayed_work(&poll_pkg_cstate_work, 0); From patchwork 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: 9455 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp480129wru; Mon, 24 Oct 2022 07:20:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7zqk+U5G7GVGdqrwQFz94jHsg+1rz8nVJFsalHVBhm9oCoxL6ncENG6R4fq1WSZPD7Pbe2 X-Received: by 2002:a17:907:160c:b0:78d:b6f5:9f56 with SMTP id hb12-20020a170907160c00b0078db6f59f56mr26409619ejc.325.1666621228798; Mon, 24 Oct 2022 07:20:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621228; cv=none; d=google.com; s=arc-20160816; b=ViYkWf7YH5wZz7b4UNC/VjfDxjh3QR60xKVGH1Qd+UnwKMnAiOT9ZQBY4+Tf/3hwdy 8LXTOgoL+F4/3JBBr3gPpKnAwPruXfkPeO5MUrgIansipjRg3pxPZ6+7DeDvGgB91+2V J06KIWsX1FFK3EzecZTyoPpedLmXLQ7fbr4R2IobXOCQ7e7T+aFR5dNxP/BCaj1sn9KI +Cu6vT76BMscybUtV/EWrnt1cu4TMPHJCcyTMMMBPxtbx7k84OK1Cer4KAsJyPmYcb8B obTllNxvAtPrjzSjl9frRRfhS2fy3hPcjuozZ+QiJkoq0aShFk2FX0DsgjfBayChQ1Wn LKlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=O8rtQZvCK3QrKkEijY70c3BNQMjq20RYlITf+boiZWE=; b=jBFL095+kIgRWPFIm07HLNmQi+47cwQfTk9PPiCe/vKnq6WBjFZ0j56cAmCk6tpBs0 F4Zf7aViirm8psnm0KDXwYAQSbYm+hM+oppmsfZ+DXtSC0rQ0IuX0oSgnj65n7tGMj85 bpeCIGTMGoX3HQtibtJyopcW6udoulyG1gpka7fT+yGeC/5g2yf9qT6oRWtXlqpK1k9v ooTWGcmB6ZfEtytdPWJi2FPgIk7xVMnBq+9afrKXIYgBJVr9pKIAlhs3ppqzSpECYCdI 1C6poRuFA0dltShktVs+lUGdYiOh+nowv17hfnbbT5+WBcSkdBUY/GaTSQjg0iuu/3If aG3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zZ9jdxTe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s21-20020a056402015500b00458a650f3fasi24353298edu.409.2022.10.24.07.20.00; Mon, 24 Oct 2022 07:20: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=zZ9jdxTe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231712AbiJXORo (ORCPT + 99 others); Mon, 24 Oct 2022 10:17:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234786AbiJXOOJ (ORCPT ); Mon, 24 Oct 2022 10:14: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 C32DBCAE60; Mon, 24 Oct 2022 05:54: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 5ADE46126B; Mon, 24 Oct 2022 12:29:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D5D9C433C1; Mon, 24 Oct 2022 12:29:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614541; bh=KJQPpJ32UIqN4u7A8mzjqm34rg4kJPRAbyTUOPAsbIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zZ9jdxTeDiCUHcQ9BJ9F25VWRYCfuZLLq2iOmIAwrooEMcK49e5Hy6h22xfZL452j cRmT7MSMP5VyNx6Zn13GT2gjZQoCYS8UUS0PS+1OeqvHr32uTDarky6m1D4+2M0tlV 6vOGgHr7INUaPRrKyQfhS/i8Io8F9gpI7ghwgnlo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Russell King , linux-arm-kernel@lists.infradead.org, Kees Cook , Sasha Levin Subject: [PATCH 5.10 301/390] ARM: decompressor: Include .data.rel.ro.local Date: Mon, 24 Oct 2022 13:31:38 +0200 Message-Id: <20221024113035.833900007@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747579021606180718?= X-GMAIL-MSGID: =?utf-8?q?1747579021606180718?= From: Kees Cook [ Upstream commit 1b64daf413acd86c2c13f5443f6b4ef3690c8061 ] The .data.rel.ro.local section has the same semantics as .data.rel.ro here, so include it in the .rodata section of the decompressor. Additionally since the .printk_index section isn't usable outside of the core kernel, discard it in the decompressor. Avoids these warnings: arm-linux-gnueabi-ld: warning: orphan section `.data.rel.ro.local' from `arch/arm/boot/compressed/fdt_rw.o' being placed in section `.data.rel.ro.local' arm-linux-gnueabi-ld: warning: orphan section `.printk_index' from `arch/arm/boot/compressed/fdt_rw.o' being placed in section `.printk_index' Reported-by: kernel test robot Link: https://lore.kernel.org/linux-mm/202209080545.qMIVj7YM-lkp@intel.com Cc: Russell King Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Kees Cook Signed-off-by: Sasha Levin --- arch/arm/boot/compressed/vmlinux.lds.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/compressed/vmlinux.lds.S b/arch/arm/boot/compressed/vmlinux.lds.S index 1bcb68ac4b01..3fcb3e62dc56 100644 --- a/arch/arm/boot/compressed/vmlinux.lds.S +++ b/arch/arm/boot/compressed/vmlinux.lds.S @@ -23,6 +23,7 @@ SECTIONS *(.ARM.extab*) *(.note.*) *(.rel.*) + *(.printk_index) /* * Discard any r/w data - this produces a link error if we have any, * which is required for PIC decompression. Local data generates @@ -57,6 +58,7 @@ SECTIONS *(.rodata) *(.rodata.*) *(.data.rel.ro) + *(.data.rel.ro.*) } .piggydata : { *(.piggydata) From patchwork 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: 9200 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458972wru; Mon, 24 Oct 2022 06:38:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5j4P47mCvHeiP0deczXu4XWmMuni+V3BrP1cy8YSIa5itushGasrUQGUyuOp0RKgLCKOrr X-Received: by 2002:a05:6402:3223:b0:461:8635:e5c with SMTP id g35-20020a056402322300b0046186350e5cmr10254858eda.303.1666618718489; Mon, 24 Oct 2022 06:38:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618718; cv=none; d=google.com; s=arc-20160816; b=Pz+AnYwNNWLBURIk47wYD3nNDKGuQEjZXnSqZQy/OQoF9JKHX+Vcb8a7LjlQWIncY5 LxaifCLcv9RC+ZM9LdMalz1k/YFzVe9sQvnYmGfgXexwgmj+TXbMdlQa32ZnzZj6hvQv YlKWzOjxjkK1ORocwfuea4QUC3LwslnfN92twLLDJ9miZTm2ZR/C9fV1S6qphTuXL4mn el/W8giBqF/34ra0SJVBNk3pzCe98ZmgvH3yBCgLbQ9w/I6y1XNo6pMtNrJkpyeh1jbQ 3dc8+AguVTVV9FQV9+PYLfBNzn2voYJWLDw7VzWlwqlhBj5HThGiFvqQfbu9o0oerMsQ ZIrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IbbWqmYjuSoMs9kJL+hYuCFITHWvOGfOAlYLvFr6ENY=; b=MPp7Hoa+s6OCn79ZW9/BpewTze7FFMB2EBRJMRJk4wbZUKLwoi7yTiZQ5RBJhjIkwK UJf+GvvyqoaKWSvO/kVX9OlfILyqs9g5/1CMWX0MjL/1cKhBUlmbmB4up/gFrKoaPyEy 7DkrBxb0zSJ3UiXRn+NYsG37y63s72U3VEkI/0wHAuK6ZRNTCwE//wpAg9wMS7IefOxV 6Aktg+8mcnRXbTDU+rL/JwJ+/9nVy8zmrXbSORDvbOta/p7H74uvaYKTYccLN20/cfOp nw590Dah6/UxptEMX9KRELTfCQU1z4Z8mms/ADz7HGE3GkLifwvT9os5otYJT9l+CIIi iFjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cQtyDm7t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s17-20020aa7c551000000b0045c9dbe290csi24585236edr.406.2022.10.24.06.37.56; Mon, 24 Oct 2022 06: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=cQtyDm7t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232270AbiJXN0q (ORCPT + 99 others); Mon, 24 Oct 2022 09:26:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236019AbiJXNYG (ORCPT ); Mon, 24 Oct 2022 09:24:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 017818768A; Mon, 24 Oct 2022 05:30:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 911BE612F5; Mon, 24 Oct 2022 12:29:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A5BCC433D6; Mon, 24 Oct 2022 12:29:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614547; bh=aW+O/Bep5E72Knf9F5KLUligbpxqba0bCHR1Uql63Oo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cQtyDm7tvpANV4AlaDyclQKUJhPvkh6ix3TEF/Pmh/UHGFZ0K62W+PbDuPCK1TCwq gLqfRAKygujAdEWgsogkoaxob480dvaiC6ZKlQCPN4bBzOSfbRwq+QAK+cF94ZrYO7 m2rmpZ/eLuonEkxUyNpu0DUjvi4+ZyEHPwupMz3w= 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.10 302/390] x86/entry: Work around Clang __bdos() bug Date: Mon, 24 Oct 2022 13:31:39 +0200 Message-Id: <20221024113035.871644092@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_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?1747576389458656208?= X-GMAIL-MSGID: =?utf-8?q?1747576389458656208?= 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 804c65d2b95f..815030b7f6fa 100644 --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c @@ -768,6 +768,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); @@ -777,7 +778,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: 9199 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458948wru; Mon, 24 Oct 2022 06:38:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5x6sClUa0qt8kFFFcHecoRVleCjHK4l2YEP0rhfaOrn4WJ4Br4uZR4zWm4dBMA7i6OGEOB X-Received: by 2002:aa7:c054:0:b0:453:98c6:f6c4 with SMTP id k20-20020aa7c054000000b0045398c6f6c4mr30604336edo.2.1666618715608; Mon, 24 Oct 2022 06:38:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618715; cv=none; d=google.com; s=arc-20160816; b=K3LADUKvEZm2UxsTZQ6bjoONaGmDfODw56fmPy0QtYpKNw7BCNUrOzwmQcA76ZJ/5W 6JZhvQY4OChitC9mleZX2gJLX0ide6j9VAQWGykDqI7lZcPN2nWxnYIi361hbr3lmxNs fzfK4HQ78u42HpXN6tuY4XRMLbSZIS1y+/dp0+GFbS61OuR1In3RGpfik/Sns2eruWW7 ZUecPWXgzEPBlJpRcejDHnz0W6eEouayVoNVHfw3EkuVpMCHNc0IHmMWv/IOiR/lX3wf StFvnyWtkldMnyv0att3SLpicyH7VzWi4Y/nMP7lmbqFph8BrWVmA0v7gzjZJx6FBLAz Pl/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=Zt7YkkVYzkVKi8ct6efit3lKJayIy1l139+x3wliYag=; b=vDa+xoSO9yh61KlTj1xMMKekTrS7eGX309eDP1tjOIBZ1Mt0FMKcbthazs8M2x5RR2 Dbr67L6x0yu/bjFfzBOf+YX06WqvGXXPzArZLxasnd9q24TdCrYAVpIEkv+7q4+2i3KF ujn7gNT0PIkVaQrqf4s0gAIZ7YCQTMKCGi08dUOQDG5Du+Qzm9NBfdZfBhJXF9eHeJKM CRYvylySOrM+0wzq8pDJMyl6yLW9j7BTizI0KvaxZkwtLieKO2Cx1lKzAV6qBQIwOrrb VA2ATdjLZiTCIrrAAS/awvuz4oIJs05W4OvSBmh+iBgmYw2SxZ8InNH9Gax9Ea/kM+4d IwyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uW+RLj3G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv20-20020a17090760d400b007919388d2d1si20807666ejc.970.2022.10.24.06.37.55; Mon, 24 Oct 2022 06:38:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uW+RLj3G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233282AbiJXN0u (ORCPT + 99 others); Mon, 24 Oct 2022 09:26:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236043AbiJXNYJ (ORCPT ); Mon, 24 Oct 2022 09:24: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 83F2D2A711; Mon, 24 Oct 2022 05: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 dfw.source.kernel.org (Postfix) with ESMTPS id 34CCB61325; Mon, 24 Oct 2022 12:29:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47502C433D6; Mon, 24 Oct 2022 12:29:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614549; bh=KwiBHAeC4ATIsxRiekASCeySPN3bCa3arjbO0thAJmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uW+RLj3GcRMlfOekZcuYgvHgUdq2I/nfE9q18H47V9DUaKui5GKzfmiXKpL/zdxme /HMTtfr9LjjCh1Cc4hjocJWIZk51q3bEvQU9YjOERdrSSEE1YbxUmAkjBAsFcIloS7 ZbYcE4z1bmfKPGCW9x6eU4aretz2j9D1nB/HKFZY= 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.10 303/390] NFSD: Return nfserr_serverfault if splice_ok but buf->pages have data Date: Mon, 24 Oct 2022 13:31:40 +0200 Message-Id: <20221024113035.915651681@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576386347533953?= X-GMAIL-MSGID: =?utf-8?q?1747576386347533953?= 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 46f825cf53f4..cc605ee0b2fa 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -3871,7 +3871,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: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9235 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp461105wru; Mon, 24 Oct 2022 06:43:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5e6P9i5mYtjA+VtQxyYDDZhXY9WpWb+xzIJtFtL+OE97w++kDGu3SjrVvx05Ho4IzqhuR1 X-Received: by 2002:a17:907:7610:b0:79e:da2d:c126 with SMTP id jx16-20020a170907761000b0079eda2dc126mr12599000ejc.27.1666618990836; Mon, 24 Oct 2022 06:43:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618990; cv=none; d=google.com; s=arc-20160816; b=nML25DwA1p2zLenfFIKYcBl7+NmrDJVOPYqga9ii7EjHcvJ4AR103aEYkxLJj8Gy/U pT0F8SH0WFPBtZgvpr6m9PyT0uiUDGXdfHZLIJW7WKwCSEPaWQPFsXZwxYllu4uVBba+ bNpGQ2Hy9W4FYs/09KOVr8Owq9N9uTgt2md/9a1Ieczyc1i0xtPMB8x8X/scvZNBWdSl qH3OMOViyjBylsK01iDSN7h8kBAF6yLgMuUOJ3tOi6feBHafew6fngo5f+btgkKzrHKJ 4dfc9Vj6DOomhdYM9xk6F4wtgaYwlL58mqNg95S3PubzQjodIdUBihD3pF29BV2OeEwn NsTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=s3VH7kNH99YVf3YGlEA5l7GRK45nnQOJv/W2ci+Ef+c=; b=AYlNj7OSrmLXgEFCRwUqcG9knkhAReDKfGAql0CVrotxhHQC5C6sUUpKyqDa/i6Lhg PPZxH/VS5V/Oz8gWqfXoDjy4j4y72mKmu4rK3xnP9LXCat/VnYoCT/4wmvZwmKhVP/fh eUr0IVrOsuagUWwfGVPEtAAmHG9lVtcxkKePpg5Y7wmes+kGtb5q7PXc25nEWoLBFCJr 7ezCzJoqOY8LtLpM/bq+xy5K00jy8hee4Mp0SdY5wComPf6xGtCQm3WjZwZFpZ2XCSnX YDO7Sc6Rfd/n5Yq1JWYzRfYIF43cyb2D7GLm82bN7VE1WjzQfuSMUruCYuxQjNmqkV3a +giw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YfpsV6P8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a0564021f0800b00461b0566a29si3719033edb.137.2022.10.24.06.42.42; Mon, 24 Oct 2022 06:43: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=YfpsV6P8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230107AbiJXNdP (ORCPT + 99 others); Mon, 24 Oct 2022 09:33:15 -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 S236068AbiJXN3c (ORCPT ); Mon, 24 Oct 2022 09:29:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83816ABF30; Mon, 24 Oct 2022 05:32: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 C609761314; Mon, 24 Oct 2022 12:29:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7973C433D6; Mon, 24 Oct 2022 12:29:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614552; bh=8kvMFNiK8S3+BVnSHaJK1OdWmE6iurGgh/4op3yCUVY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YfpsV6P8o9gMeO6BM/g1AVNQwR3AVDDNosf8HaduyyjCOBU8R27caUpwFZXgX7Vyj IuhvKC6ItuDZ4c2mhMB7KKt2aZHyrXDC+kB64yrk7pXDbUcKfQK4BzXYs4DftUsKfA 1KbsxA9DIYIPtDD8SU5ypAfaywJydAefrdUjqfpg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dai Ngo , Chuck Lever , Sasha Levin Subject: [PATCH 5.10 304/390] NFSD: fix use-after-free on source server when doing inter-server copy Date: Mon, 24 Oct 2022 13:31:41 +0200 Message-Id: <20221024113035.948291024@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576674694790541?= X-GMAIL-MSGID: =?utf-8?q?1747576674694790541?= From: Dai Ngo [ Upstream commit 019805fea91599b22dfa62ffb29c022f35abeb06 ] Use-after-free occurred when the laundromat tried to free expired cpntf_state entry on the s2s_cp_stateids list after inter-server copy completed. The sc_cp_list that the expired copy state was inserted on was already freed. When COPY completes, the Linux client normally sends LOCKU(lock_state x), FREE_STATEID(lock_state x) and CLOSE(open_state y) to the source server. The nfs4_put_stid call from nfsd4_free_stateid cleans up the copy state from the s2s_cp_stateids list before freeing the lock state's stid. However, sometimes the CLOSE was sent before the FREE_STATEID request. When this happens, the nfsd4_close_open_stateid call from nfsd4_close frees all lock states on its st_locks list without cleaning up the copy state on the sc_cp_list list. When the time the FREE_STATEID arrives the server returns BAD_STATEID since the lock state was freed. This causes the use-after-free error to occur when the laundromat tries to free the expired cpntf_state. This patch adds a call to nfs4_free_cpntf_statelist in nfsd4_close_open_stateid to clean up the copy state before calling free_ol_stateid_reaplist to free the lock state's stid on the reaplist. Signed-off-by: Dai Ngo Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin --- fs/nfsd/nfs4state.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index f1b503bec222..665d0eaeb8db 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -843,6 +843,7 @@ static struct nfs4_ol_stateid * nfs4_alloc_open_stateid(struct nfs4_client *clp) static void nfs4_free_deleg(struct nfs4_stid *stid) { + WARN_ON(!list_empty(&stid->sc_cp_list)); kmem_cache_free(deleg_slab, stid); atomic_long_dec(&num_delegations); } @@ -1358,6 +1359,7 @@ static void nfs4_free_ol_stateid(struct nfs4_stid *stid) release_all_access(stp); if (stp->st_stateowner) nfs4_put_stateowner(stp->st_stateowner); + WARN_ON(!list_empty(&stid->sc_cp_list)); kmem_cache_free(stateid_slab, stid); } @@ -6207,6 +6209,7 @@ static void nfsd4_close_open_stateid(struct nfs4_ol_stateid *s) struct nfs4_client *clp = s->st_stid.sc_client; bool unhashed; LIST_HEAD(reaplist); + struct nfs4_ol_stateid *stp; spin_lock(&clp->cl_lock); unhashed = unhash_open_stateid(s, &reaplist); @@ -6215,6 +6218,8 @@ static void nfsd4_close_open_stateid(struct nfs4_ol_stateid *s) if (unhashed) put_ol_stateid_locked(s, &reaplist); spin_unlock(&clp->cl_lock); + list_for_each_entry(stp, &reaplist, st_locks) + nfs4_free_cpntf_statelist(clp->net, &stp->st_stid); free_ol_stateid_reaplist(&reaplist); } else { spin_unlock(&clp->cl_lock); From patchwork Mon Oct 24 11:31: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: 9251 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp461288wru; Mon, 24 Oct 2022 06:43:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6/eqgjAnTldfEhFwSYWtBKhPJxGZg0fKCt0Ir6SWqQX7p5IY/NDJIlYiKasqmkFk7H0dG/ X-Received: by 2002:a17:907:7628:b0:7a7:45d4:ed9 with SMTP id jy8-20020a170907762800b007a745d40ed9mr5015046ejc.132.1666619014207; 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=tTiZrPS/CG/R6OBFn4p0mOeYikHFgx/Aw0p3laxuT59jAXlqasXwyzNiDjtveo996m 5oEid17w/0Qj6Ljjx1R1KfOop5QKF4357VpZ7+dpuvsBTMjF9jMXzEPhM93tttoQ6+IX E8a5EPIaZ6cHn0VXkF2lS4Nxk1ystQoSgqiGFbb2LVdnvACVKdpBtG8qVNUr5r3ndTM1 G+qogtNSbZa+RhQEXQ6GB2tFmtIjSbIOI0p3xU4lcrzbJUmaEYYeJfgRDhuNmrdVLnrP D39LT2+ofBaGbkbzIq6Lfetnc2Y+mbp6TGX/LLGZw/n4jpDgxAsWNruvfhSixu7dcBqS NEQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3FDYm5qWRAQ5l345ryfobEqKAwddUGp/eoaICeD9bzg=; b=ZVALLuZdyLUpqe7vHVXmuTXdoice3CdRR4zNmW9FGKn4fZXiN4JQpmXp+1zAxMa93n MlB5tWvisYOBButYHtskeE7P2kLNS0mFbSjKoaT7YWRiW77XD1RmtJPrQnAFv2s3Lc1n enUczmts1CUHvHobGSeQvRXeqs1RfkSfLqjFIjFQOYScbVHdKVWtYyf36zPwjdvVN7Wz I4NyLqha92tn+CNX00M8X4Cw7q7Ai7BU8XvcYivNvK2U0+OYR/Cqxyg3JQsdzFi/YdXJ BshEE6nXdeNFJST4g8m61KhGfGgZ8vzmy9C1ItZJVuKjk37oe/dDh6NwFYrfHzQvSgA5 pH8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iHvkMNfH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w19-20020a056402269300b00461eb5cdcdcsi1271149edd.23.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=iHvkMNfH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236031AbiJXNeT (ORCPT + 99 others); Mon, 24 Oct 2022 09:34:19 -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 S236203AbiJXN35 (ORCPT ); Mon, 24 Oct 2022 09:29: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 6C28AAC48B; Mon, 24 Oct 2022 05:33: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 67910612DA; Mon, 24 Oct 2022 12:29:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77BF6C433C1; Mon, 24 Oct 2022 12:29:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614554; bh=bPQpXuTiwSD2XHaeEE3f7S0MAGju3li9gNzgfMUaygQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iHvkMNfH6ks+deCJztQzk8uTwWJ4NGHxmo7ZtV8bAhqwNdA/veY/rqy9IiMuHUOX3 jKwWQHlANtnU/3sdaQ2aeRedCgWOEQ6ORFs4PPUhxJsFMWrL8uq5Gqko6BJoKefQLs LR05G1G4w6mWaP7AmXMpkYj/oPV0aR8hzdUU7hms= 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.10 305/390] wifi: brcmfmac: fix invalid address access when enabling SCAN log level Date: Mon, 24 Oct 2022 13:31:42 +0200 Message-Id: <20221024113035.997982350@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576699414007714?= X-GMAIL-MSGID: =?utf-8?q?1747576699414007714?= From: Wright Feng [ Upstream commit aa666b68e73fc06d83c070d96180b9010cf5a960 ] The variable i is changed when setting random MAC address and causes invalid address access when printing the value of pi->reqs[i]->reqid. We replace reqs index with ri to fix the issue. [ 136.726473] Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000000 [ 136.737365] Mem abort info: [ 136.740172] ESR = 0x96000004 [ 136.743359] Exception class = DABT (current EL), IL = 32 bits [ 136.749294] SET = 0, FnV = 0 [ 136.752481] EA = 0, S1PTW = 0 [ 136.755635] Data abort info: [ 136.758514] ISV = 0, ISS = 0x00000004 [ 136.762487] CM = 0, WnR = 0 [ 136.765522] user pgtable: 4k pages, 48-bit VAs, pgdp = 000000005c4e2577 [ 136.772265] [0000000000000000] pgd=0000000000000000 [ 136.777160] Internal error: Oops: 96000004 [#1] PREEMPT SMP [ 136.782732] Modules linked in: brcmfmac(O) brcmutil(O) cfg80211(O) compat(O) [ 136.789788] Process wificond (pid: 3175, stack limit = 0x00000000053048fb) [ 136.796664] CPU: 3 PID: 3175 Comm: wificond Tainted: G O 4.19.42-00001-g531a5f5 #1 [ 136.805532] Hardware name: Freescale i.MX8MQ EVK (DT) [ 136.810584] pstate: 60400005 (nZCv daif +PAN -UAO) [ 136.815429] pc : brcmf_pno_config_sched_scans+0x6cc/0xa80 [brcmfmac] [ 136.821811] lr : brcmf_pno_config_sched_scans+0x67c/0xa80 [brcmfmac] [ 136.828162] sp : ffff00000e9a3880 [ 136.831475] x29: ffff00000e9a3890 x28: ffff800020543400 [ 136.836786] x27: ffff8000b1008880 x26: ffff0000012bf6a0 [ 136.842098] x25: ffff80002054345c x24: ffff800088d22400 [ 136.847409] x23: ffff0000012bf638 x22: ffff0000012bf6d8 [ 136.852721] x21: ffff8000aced8fc0 x20: ffff8000ac164400 [ 136.858032] x19: ffff00000e9a3946 x18: 0000000000000000 [ 136.863343] x17: 0000000000000000 x16: 0000000000000000 [ 136.868655] x15: ffff0000093f3b37 x14: 0000000000000050 [ 136.873966] x13: 0000000000003135 x12: 0000000000000000 [ 136.879277] x11: 0000000000000000 x10: ffff000009a61888 [ 136.884589] x9 : 000000000000000f x8 : 0000000000000008 [ 136.889900] x7 : 303a32303d726464 x6 : ffff00000a1f957d [ 136.895211] x5 : 0000000000000000 x4 : ffff00000e9a3942 [ 136.900523] x3 : 0000000000000000 x2 : ffff0000012cead8 [ 136.905834] x1 : ffff0000012bf6d8 x0 : 0000000000000000 [ 136.911146] Call trace: [ 136.913623] brcmf_pno_config_sched_scans+0x6cc/0xa80 [brcmfmac] [ 136.919658] brcmf_pno_start_sched_scan+0xa4/0x118 [brcmfmac] [ 136.925430] brcmf_cfg80211_sched_scan_start+0x80/0xe0 [brcmfmac] [ 136.931636] nl80211_start_sched_scan+0x140/0x308 [cfg80211] [ 136.937298] genl_rcv_msg+0x358/0x3f4 [ 136.940960] netlink_rcv_skb+0xb4/0x118 [ 136.944795] genl_rcv+0x34/0x48 [ 136.947935] netlink_unicast+0x264/0x300 [ 136.951856] netlink_sendmsg+0x2e4/0x33c [ 136.955781] __sys_sendto+0x120/0x19c Signed-off-by: Wright Feng Signed-off-by: Chi-hsien Lin Signed-off-by: Ahmad Fatoum Signed-off-by: Alvin Šipraga Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220722115632.620681-4-alvin@pqrs.dk Signed-off-by: Sasha Levin --- .../net/wireless/broadcom/brcm80211/brcmfmac/pno.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c index fabfbb0b40b0..d0a7465be586 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c @@ -158,12 +158,12 @@ static int brcmf_pno_set_random(struct brcmf_if *ifp, struct brcmf_pno_info *pi) struct brcmf_pno_macaddr_le pfn_mac; u8 *mac_addr = NULL; u8 *mac_mask = NULL; - int err, i; + int err, i, ri; - for (i = 0; i < pi->n_reqs; i++) - if (pi->reqs[i]->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { - mac_addr = pi->reqs[i]->mac_addr; - mac_mask = pi->reqs[i]->mac_addr_mask; + for (ri = 0; ri < pi->n_reqs; ri++) + if (pi->reqs[ri]->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { + mac_addr = pi->reqs[ri]->mac_addr; + mac_mask = pi->reqs[ri]->mac_addr_mask; break; } @@ -185,7 +185,7 @@ static int brcmf_pno_set_random(struct brcmf_if *ifp, struct brcmf_pno_info *pi) pfn_mac.mac[0] |= 0x02; brcmf_dbg(SCAN, "enabling random mac: reqid=%llu mac=%pM\n", - pi->reqs[i]->reqid, pfn_mac.mac); + pi->reqs[ri]->reqid, pfn_mac.mac); err = brcmf_fil_iovar_data_set(ifp, "pfn_macaddr", &pfn_mac, sizeof(pfn_mac)); if (err) From patchwork 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: 9185 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458431wru; Mon, 24 Oct 2022 06:37:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6jIt8GpIuoRHm9Jgn/qKFKvVf94Bc2eBZQkUoPy7KzH/u/S2WTGuhA7kT+s0pI2TquYkKs X-Received: by 2002:a17:906:4795:b0:794:8b93:2e43 with SMTP id cw21-20020a170906479500b007948b932e43mr22357053ejc.184.1666618654509; Mon, 24 Oct 2022 06:37:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618654; cv=none; d=google.com; s=arc-20160816; b=F8qLOYmkkxG0y0cXUU6wopK7Su2bLPbAyYEQzM82wFMf7kcJuKyLkuv7YVzE3OQMCj 4W7+psMG0wDHtgQcCiNzN4TBWUR8suyIpOPFLSDtr1fdLUIylU1zLDXKbxw2/Jc1lcI0 AQf0J+858zouCtwWnfiHzmrWRUGhzexe/qxUoLj6KOrIjECN/s4JHuhsf2aaHFOHTLtL lNiCeTkrt5STmEunV2rq1rTgRPoARfOs6A5VQgoAMFFn0F1ww4z8j/NK0F0MwWXO9J4Z eF/5GHePQlVFJ/grzvURz9q1gb+ROEFTKefpasu7v93wv/HgbhjV/f6M1cOyeFciQhwO XhpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NJmes5OrMH2AXwGSap2+LdmlgToHLw6Lh1KT8dfYTxM=; b=etbstbOnXjop8cVXMvz36C0ZUyE3JYiHcn+VgbrjIG7F7W0gFqxSUfeQfnIme3R35X plkREKlIDpFKKBDEm7BSc9OLy5WlyQY/zoKX5BGlaxS5B27bonwyZtAXYrj1gWwWG0Wy md45Qa4ugP+94TE8Jb9qM3jFAMQDzlDKnrT8MLqh7l+zEtFOo0PjKisPM8wCQnzDICyU Ohm1OQbkDU+u1a+7AKftUUB9ypRlUyi9Iky63BtdL9JMV0Nz+CwdfKlY2gfZ4X7V0n6I 3YWhlSo6YotCtcp054OiOGmbR4hHDcGVg99aYpABjKz6XqF43F3RT2XQ06JP4o2L+qnn SCpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dCdCVu3O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr2-20020a170907720200b0078dbec2e632si30836862ejc.620.2022.10.24.06.37.01; Mon, 24 Oct 2022 06:37: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=dCdCVu3O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233609AbiJXN1X (ORCPT + 99 others); Mon, 24 Oct 2022 09:27:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236253AbiJXNYv (ORCPT ); Mon, 24 Oct 2022 09:24:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 766E088A06; Mon, 24 Oct 2022 05:30: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 0BFCF61330; Mon, 24 Oct 2022 12:29:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 208E2C433D6; Mon, 24 Oct 2022 12:29:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614557; bh=s/TgH2cZHDS2UeT0O4dRQAweALS5Vjeej9+FSzcTV9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dCdCVu3OAUtfAGnxHeFcvJ6NEEYb7p7A3Yg5um20KOgcjY7C40ED99oVgTpRrFHOB U/T9SGL8oOVEw6drLtDP+QK1bCdwgN5WI39gzR8Grxc+bJcizqVrpvjf9q3CwZHrPi dXm3+2mnSucz/AwIjVfcUKDQSCA6lYDFMDTy/HCo= 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.10 306/390] bpftool: Clear errno after libcaps checks Date: Mon, 24 Oct 2022 13:31:43 +0200 Message-Id: <20221024113036.032845428@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576322286903708?= X-GMAIL-MSGID: =?utf-8?q?1747576322286903708?= 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 1854d6b97860..4fd4e3462ebc 100644 --- a/tools/bpf/bpftool/main.c +++ b/tools/bpf/bpftool/main.c @@ -398,6 +398,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: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: 9575 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp527542wru; Mon, 24 Oct 2022 09:01:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7oJrBVpmhDrVVNcnTpLNoBP3kvMl3MUy0lcuepif3a/KjHA4p5AJwhKwCOeTRYeaIn7Of8 X-Received: by 2002:a63:8643:0:b0:46b:2bef:338b with SMTP id x64-20020a638643000000b0046b2bef338bmr28939364pgd.357.1666627260625; Mon, 24 Oct 2022 09:01:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627260; cv=none; d=google.com; s=arc-20160816; b=prVCYAlA6O128wOCq5rCWlFv1Hm1rFuUOIijdpZWgmUMPuo5tWX/XYzCOtYmyQA0oK jWnd1KDveVpAl1wKefxP2GpaCH6MAh9gtYnibK8yZgkJJBo5Oe1pWu0ZkqFB5LR0SxNM nd0sc1sBADLgVzD4SIlMVkvlzCapoJtVvBfI+1ekoukftGqcaP+PhO+mt2PdpJ3+W3js k8sY/kucoKaa/AOGe3KTZd9CYoHUqfmMWPd632tp8Zvr5Q6RjCTMChwpjrVwVeDiuWDl AP6xRSitgMyGdra2T2FcOrA8wBYDyt04GirhozLxcS45aEt6VwHXTrEcetASBi9/TTor hNAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vaBewzWYI4Dv2QgP8WbbgMMxroCYVPJPRYhz6sAjoCc=; b=Qy4Ry+LHEH8jb3bJ7wTI/TZgEHvV5thkn5YkMN18t97nSrEfZjnQY3TNlV4PN3PDya YAI9mg+gg/N7lq9qWVOdVj4r29BNO66ZJYaNcjxZ/Pbf3EtgU355R411eSCK2m88YZvk Ucf5wLUrHZ8YmGQXhvW29laFqC9Svtjz5K1cnDHAOMhQnPA3rPBd2i8p8UHOXBn+tbQJ qH53lSSWfZIeBhcD13J0LaZGgrX5J1tqsIGxJsBtH7HANfcNrjZGuv9GxJMLXnqimSEe wGnuQQpfyAKcWzuW7jQhUCrgBwkAL4Koxk5P8LJjawETqOYeH2T5WrYPwgoqxpqhCvcM 4LQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Z0Cfh5fl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oo16-20020a17090b1c9000b001fd8713170csi11535700pjb.179.2022.10.24.09.00.25; Mon, 24 Oct 2022 09:01: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=Z0Cfh5fl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231245AbiJXP6g (ORCPT + 99 others); Mon, 24 Oct 2022 11:58:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232164AbiJXP5w (ORCPT ); Mon, 24 Oct 2022 11:57: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 83CF02EF72; Mon, 24 Oct 2022 07:52:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4FE22B8119E; Mon, 24 Oct 2022 12:29:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A802BC433C1; Mon, 24 Oct 2022 12:29:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614560; bh=KOyJZ8EAro8rxOf+fthAnt3nxSGIZ91HYgHAzMiTWno=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z0Cfh5flAW0M503sNHW2HfRaXQK4hfIA48xw4JnCUdxJDuZfjifmNbdAzFxmp4hen prI4seNUKzIuYF/xOj9a3GCawbUOnWoDflTa98OOijG6KLO1GE7Qz84VIpH/JrYduY r4oru7Sjwho0ZjiSJJnt4oEszKn9+jm2nqyUI/a8= 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.10 307/390] openvswitch: Fix double reporting of drops in dropwatch Date: Mon, 24 Oct 2022 13:31:44 +0200 Message-Id: <20221024113036.067859854@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585346499038901?= X-GMAIL-MSGID: =?utf-8?q?1747585346499038901?= 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 9d6ef6cb9b26..4d2d91d6f990 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -241,10 +241,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: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: 9589 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp528643wru; Mon, 24 Oct 2022 09:02:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6KwyfKP3i+Vf3BmlRigRzcXhaJFcepiQcINdLN8uCTmJ9kPrnRcJXSRMNCjvmhZbwF53et X-Received: by 2002:a17:907:a072:b0:7ab:23e9:bc1 with SMTP id ia18-20020a170907a07200b007ab23e90bc1mr1234060ejc.72.1666627347329; Mon, 24 Oct 2022 09:02:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627347; cv=none; d=google.com; s=arc-20160816; b=cr4Yisp9gwnLp7kztHuwH3mwcgkvoU/hSxr736/+CApD6//QJTP5mJdz/ej480YQQu hLMEQRPcPBJ66tqv0MgsCQ9o2XRFnqsK2Q9m+o9JNVeb5hB7t5fdhozU0WRii9OGK9RX aUVCS4lfNFqQj8mlqKOkP7h6cZ67xp1mjbE7SiG/3MX3oxBaYwZ4JKK9tNadKc3smc4I TAQDCzw7/lVHG/ZqOF6TOCzcUW3UMAeJ+yi00HPXly6/PRq+mDb6WNa70Hg2c1j6g9Lm I5qe68YJmhM0mAhxGRIMNKt2ErJxQoR7lTa272qGfKuluD8pSAAf7RAbIU/HwBs0jFcI 4Ngg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Io64MeL0+Xb5ZjqSwo1cspbW4lBwooTpVOjLX7RihVc=; b=TLs0A1/radTI3OP52HHemFvXpTskVjJlOP37+JIDzBdFT3LxLcxVLt4qqZ2HLZtdEs yRCaaCedmj+E4QYd/M/yUuWNSTvlQTACUheq1Pn2DQdZH1MfXnd2+fN2wY3vA+Yj9iAK vRuFyfBSVOlotzz+NAOYMU54YyWWgkBGJMj8S9N2ohcxvW0zMxOlCCD4aDE1g66OqpKL 0V3uBaNkOweUI1V/QX/3bittY5UKIAlpFWBcPDTEpbbmTKL1l4e6O6uMcyzDhN5ugR40 XEDKC3MicIeIbFi2+9nAd5J/p2smObLrqVtipEAkI136FLRm13QoUSwt34HiM9TyZtV7 6kCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=as3enCYU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020aa7c949000000b0045fd458991fsi101066edt.428.2022.10.24.09.02.00; Mon, 24 Oct 2022 09:02: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=as3enCYU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231901AbiJXQAX (ORCPT + 99 others); Mon, 24 Oct 2022 12:00:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232320AbiJXP66 (ORCPT ); Mon, 24 Oct 2022 11:58:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0122D9D507; Mon, 24 Oct 2022 07:54: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 E8743B810F5; Mon, 24 Oct 2022 12:29:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46F56C433C1; Mon, 24 Oct 2022 12:29:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614562; bh=+/eBksvJ6ANRQNCMZf75gc4o8p99cJ/gFuvAAZ+Tmzg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=as3enCYU+KdrIlKMQRvQvqP+U9Uh9WzHFjepZhL5pap1d0v6yNGQs1ugFvvCE42nk E6gSauiya24kporiXiv3+jSbDR25g1AgcPPqz+WQKu8OP1p7xUlBVRR8broMpJX1Ry 3j2oBBC41qAepg5ryv5jib+V3BbRl28R4CqLy/Vk= 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.10 308/390] openvswitch: Fix overreporting of drops in dropwatch Date: Mon, 24 Oct 2022 13:31:45 +0200 Message-Id: <20221024113036.103797063@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585437288412279?= X-GMAIL-MSGID: =?utf-8?q?1747585437288412279?= 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 4d2d91d6f990..6b5c0abf7f1b 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -544,8 +544,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: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: 9182 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458339wru; Mon, 24 Oct 2022 06:37:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7QGlbw3cnBJxftHvinhGzSjQDzClCFkksA5/Jslzg6utcbe2cj+1gcrJhUL8uGl/ABdnqb X-Received: by 2002:a17:907:7e87:b0:78e:1a4:130 with SMTP id qb7-20020a1709077e8700b0078e01a40130mr28257312ejc.101.1666618643572; Mon, 24 Oct 2022 06:37:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618643; cv=none; d=google.com; s=arc-20160816; b=rFT6/5IMGMdC0nS5yyNtzg3iaKFjqB9M/3Gh8yNuJ62SpssD/BA3jx2lvJzHky2t6p qdJaF0dokNYKzb2r+9Rz1xi/1HToA8uc4YgnAmU+ji7WM7yaA0aGLIk2JK6ILo3VSiLT p1aEWkERe5DcwPyaVU+hG9lkMEXuKaNSNuoJGug8gUFbMuj/+WXxDjZF3wgkfrsMvWuV GCvaDox395AVchjvyA+2WubErDSoOvSKtwuBtCrxA7zMPRVnY2ZNrhyLbGAhL9e5/7Fu 1JgZ1IWi20QzC27YhqAycTqLDCLZMr/L9m5O8isU3fWT8CUGNgQUIFjrlJrGjmMtz6H2 2wDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yTHx9IWBwOVSNXxyy5nl/5Y11eXhiJPeCUw3lOyhiKs=; b=wSNGRSfw8OGxDzjydVcC+9C7FqII6xiRHrjVjs1dVbtdLCNsCClqGAVCcbXx9oOkAG 5mVxPKIzD0elkE/dhOaYQK8ZDTQ6teqGk/LZDs1FsOBDREzQAUYlLTbif5tgzSODqryR beeYxrEDG5jiXOZaBaRJDN3ao1gZun7LNxJjK+O1p3dMSjI1vi+rPezJlKQtwK9h8OaV WhAZwKtl8eFWU9JAwtZN8XKtCAKcE1flFMJckSH2phZoYatlXSL5UAD2fnI50Oy/PSFo zNKpU6EEP6LfTsiIob16pdc0n2A+s8EEhdVvwmKKzDq2f/vHDyJLoqpcFTGyL3wGyNl6 CjgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=unhsNdqC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e26-20020a170906c01a00b007826cb6f57csi24365242ejz.407.2022.10.24.06.36.49; Mon, 24 Oct 2022 06:37: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=unhsNdqC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232540AbiJXN1G (ORCPT + 99 others); Mon, 24 Oct 2022 09:27:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236126AbiJXNY3 (ORCPT ); Mon, 24 Oct 2022 09:24:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E6078E449; Mon, 24 Oct 2022 05:30: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 CE609612C4; Mon, 24 Oct 2022 12:29:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFFEBC433D6; Mon, 24 Oct 2022 12:29:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614565; bh=WHQd8DRSzLmK/d2fpQEoWkzVxb3qPP9gECYJoEJorIQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=unhsNdqCb6sB26lql9XK5rTxXpm4G/qrgrJHzYDmquKYrkSfAGD4gc82pY66ro1Oz VYaxcKfJq5YQ6t82OhYq3iZgsT2iy3taxYwrl+v3dk/4joi8JgqvGT63CHK6R6qstA fOpcEX57wxUAX3IY+kPrE/IUOeqFKAdqcqkd2kFQ= 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.10 309/390] tcp: annotate data-race around tcp_md5sig_pool_populated Date: Mon, 24 Oct 2022 13:31:46 +0200 Message-Id: <20221024113036.150412531@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576311208961783?= X-GMAIL-MSGID: =?utf-8?q?1747576311208961783?= 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 24328ad00278..b0aa7cc69d51 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -4043,12 +4043,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) { @@ -4059,7 +4063,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); @@ -4075,7 +4080,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:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9595 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp529063wru; Mon, 24 Oct 2022 09:03:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7thMuksSwEAXFVvBr2iRVsvlPIRduuc67cslxB1YcSC7CEK9b2dxUpNkTwKnhFgTZKIMeX X-Received: by 2002:a05:6402:428a:b0:42e:8f7e:1638 with SMTP id g10-20020a056402428a00b0042e8f7e1638mr31817623edc.228.1666627386647; Mon, 24 Oct 2022 09:03:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627386; cv=none; d=google.com; s=arc-20160816; b=q2bPznDpl3PVQe2p4MB/VHINOZkeA/7eLY0TBBfv3Kq6MZWc2DkkWqKswfWfXPfHj5 sbmBPLuIE8yJPpZPrQzQEWjGA2SbColnwOZ8bQM3S7MpNADh3cOt0/W+YRT9XwqwYTpy fvlWE64Lvl1WWZ1+cnf9UQI4WqttC8JZCFoTL/9yTKDbvV5KiR3AqgqQQz9q9Gbm9q2s UmtV5TYzJFPgEAkEFmS2/OugOlEKwQeN+umaiqVUwJij/PxtCAtB+Q/G/mCHR8Yn5Yr8 6v9b3s2BMIEHxg7nisJmSSRxtoxtaoAeCBOShqrv1BTKUtbfj8P7wsFgcSkYpasS7ewY Hqfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=resT7KR4xZfly9AMCgB7Z/QPKEiwhiCA49I/I/SkwLBTgx+4U+nljg9LIhQuGmBbpx avAcZjnWz8tNZ8tYIe4nl/Qf+nrkN/hf7RCqaJVkkLd2PCpx4RJ92Tu9MmGj1lvbvP61 CTC19CjBt0A0RKQ0F+XaxrmfxhvdCynuwpzCyXQroDXhnI8IMaKf+sQ+R7QbzPCSSTSP sNUKDvcxzhWLClZc0kSi2Vye21bwHDq7eU28BCgIyq712WTMdvTGwAKy2kEw0x0EUeCJ P0p3ZtiNdql5TdaPD/EhD86HyEWHGKUcej/JwA/FKt81zGsp1jMdZEkkSv+U6YcMlj7A XjYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Ic6clXL/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170907724100b007ab1b8b719csi187298ejc.0.2022.10.24.09.02.35; Mon, 24 Oct 2022 09:03: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="Ic6clXL/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232417AbiJXQBQ (ORCPT + 99 others); Mon, 24 Oct 2022 12:01:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232695AbiJXP7O (ORCPT ); Mon, 24 Oct 2022 11:59:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A22F46383; Mon, 24 Oct 2022 07:54: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 2C051B811FE; Mon, 24 Oct 2022 12:29:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87707C433D6; Mon, 24 Oct 2022 12:29:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614567; bh=uFZzpqGeI0F+s1iei+vQqMl4q+FdPp2Sji8X1gj9HgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ic6clXL/N9lXbk0e/ubfbwf9yf06M0VsKr4ypzeJCLoIBX4mdw7P67CfmhfwbeMJa txQ5FCXdzxAnApuwC3IHFrmc+1dt2IP/MX3yl1Wvj31/f0HUWgQux+M2y05nJOAHhd hWlZ+E1jOBtCJ4th3AA/hDSB/iQXVuQPDC0nVapg= 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.10 310/390] wifi: ath9k: avoid uninit memory read in ath9k_htc_rx_msg() Date: Mon, 24 Oct 2022 13:31:47 +0200 Message-Id: <20221024113036.188006028@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585478808188786?= X-GMAIL-MSGID: =?utf-8?q?1747585478808188786?= 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: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: 9183 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458340wru; Mon, 24 Oct 2022 06:37:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7afxhg2dzFDOarf87VH3oLUFanf+R1C66B1evTtwgQvgr6Z07yevgfckKuD81tQEe+KE9H X-Received: by 2002:a17:907:2e0b:b0:7a5:fc2e:dc7 with SMTP id ig11-20020a1709072e0b00b007a5fc2e0dc7mr6004051ejc.257.1666618644102; Mon, 24 Oct 2022 06:37:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618644; cv=none; d=google.com; s=arc-20160816; b=KQ+Ygw5VbWxrPI+Usxiyf+5CBCuX0FkHXXv26lHQen5Ln1N6GJphNSTMeu/u3OumeO EKbSpAOCJz3irPCQb/EeXTeT+vHmJRHz4mpCitCxpm9txT1U0JymQuXMsBdYnD11bx6O aYyceG3KIfOICoVM2vd5WQ0hEDUPAHrZPAyNpv5KT7ESiP+bpWZrJ+2aKafdI5803wPJ bATQaPKMAxmabVOzcg7QdcGR+ZvsATffAc+wYmspQTKpnMcsKeuqfFSbd1ENVqQ6ml2D 7NMm6tMtRMoRApM2DMkjWCTk9AEJQrfHjfFvVUW4Xd82jWStZWoiX4EC8ALCjd4qk9yU Qhyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BuhjIss6Rgrewa1XtK15PpkMW6kPfqoVkQrQO9Wwag0=; b=LmaPEpW4cOhNz/EHk09lsf2w/68KCYDC2NO0vP3X7iY4d3Zt5jw2Uuuftsk4LpLY5n FrwcY8aJ+WwyZ53BzAcdGjym0g3EOFQr4gL4CxcWcnaiuTcGpAzrswBTrJqRMgDOoOV/ REOYu86w3r5PY/wf/4NbCX4Guv5OjN8NRSRyhsdT+2Rf1tYf5UuSUOK9wAuq+fTZysgH ip6vn5EhGrmpGU8T3J3TtGRf1FvlIIWzWI/jP+oVjY6ns2I/s6X03uOh69kdiFumkqTz WXtbDmr0zX/4XMBU5DrpjAQrxOE/UcTPAE22ZH5u0yUksdLsxw6seF2+tZ9o6YLq72Kd e3PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hzI1oSKM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gv28-20020a1709072bdc00b0079800b81731si11666688ejc.82.2022.10.24.06.36.44; Mon, 24 Oct 2022 06:37:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hzI1oSKM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230128AbiJXN1A (ORCPT + 99 others); Mon, 24 Oct 2022 09:27:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236127AbiJXNY3 (ORCPT ); Mon, 24 Oct 2022 09:24: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 BA67918383; Mon, 24 Oct 2022 05:30: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 26F9E612FF; Mon, 24 Oct 2022 12:29:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39700C433D6; Mon, 24 Oct 2022 12:29:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614570; bh=Jad87ZPGbOMCQZjFg6peU5RSSRiKnGTlnlSYbcbi8sA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hzI1oSKMH4D6t8Ir7PW6yB4NxGgIDPrz4eNrwDgEhNOsRq6JXQcNet8c+FG34iyEk kRJ4RoP2V7fyFP6rIJXngxA1RljWgpoRibWtClUqUYTxIUXXj1V0hrGVjcmw+2pRw0 cHU6iv+5f/U8Mh1qwjbOxPjhcqniyWVtMHpujPmA= 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.10 311/390] xfrm: Update ipcomp_scratches with NULL when freed Date: Mon, 24 Oct 2022 13:31:48 +0200 Message-Id: <20221024113036.218746726@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576311401710093?= X-GMAIL-MSGID: =?utf-8?q?1747576311401710093?= 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 0814320472f1..24ac6805275e 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: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: 9580 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp527817wru; Mon, 24 Oct 2022 09:01:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6DWZBZYYlvfB5exr3UPUDTqoc0hhIHtP4W9QRlR1xtr4deuAOdJazTfUjSGvzN7ev+frDB X-Received: by 2002:aa7:d9d1:0:b0:461:9556:23e6 with SMTP id v17-20020aa7d9d1000000b00461955623e6mr9864068eds.25.1666627281397; Mon, 24 Oct 2022 09:01:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627281; cv=none; d=google.com; s=arc-20160816; b=eunwJlnphn7BAfZ4cT7SVjDIAu0K03RaTjT+QsfvIWUmId/7jnd0KlDdjK/yakXxkA 647HERctwpJqejZIH0Nn1vWsdkWJVT+9DM3WeB4ydCDT+Y+VwmbGphbTpLcF56LAtU2Q xtbtfhqZ1ZiuU4vEjPRNDRAIyNq0fzKhxLHIFyVEkt8KleQxIUJW/EOzXVK6IsRIAfFS p2PjLJUHLfGQcgjah7z4+Ew0x9wfde4SdpxkgoxCyOAbbKd0GOflL6cvB8v+1ekQulAG s+QZeR/+B62l/x6Fc47xaLVNhyquQe1cJWZrfjKefrCKCD0hW16RNzGtN2vjSRsEYlYK +MAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1pGqZ3xvI8Tkme6vHyah0R0CYzKvq9iFMvCcRLE9/OM=; b=rvb4UMsfl4G9LPm4dMMZRN0JwNUqUhuVA6sodUs5OOJd6TFGXqh8QS4JzdG0j5fd6U CA8wJo1EgHA8fa4f+34BKvz370mwpcxohYi1oW/qPdhD7WTv1W1nldp3OSf/Rh/YSWo9 2eJUAow1G8lMggEGnFfG+i44XV4X4n7SO+eoxzIGAmIpjNn+1LeyG7R1GgLirb2LgaSB CH8x5/0nLOPgwxk/OLS0TCwb14BW/vFNaP9x8FUfI//YvcXrjRshWDOI1K9fT8v2qLfl tLRNhaJdRJk2C9p1A8nGxcW9K/Svpu21QGBlw6AzNnfYhqrOsAZVgavFRVXUZfjn/M6A U2xQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Yi5F0S+2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f14-20020a056402068e00b00461fc07a835si160903edy.18.2022.10.24.09.00.53; Mon, 24 Oct 2022 09:01: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=Yi5F0S+2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230417AbiJXP71 (ORCPT + 99 others); Mon, 24 Oct 2022 11:59:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231824AbiJXP6A (ORCPT ); Mon, 24 Oct 2022 11:58: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 15908ABF33; Mon, 24 Oct 2022 07:53: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 347DBB811FC; Mon, 24 Oct 2022 12:29:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C9C1C433C1; Mon, 24 Oct 2022 12:29:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614575; bh=wDzhue31XLNHt55NrDeEwqRpEBMxu6FjW/bq0+Z9MQs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yi5F0S+2CDkxv2r9tajo1RvHO7Lqj4O4LPL2BF3VrstInmBMyHYNZpxrpYAGP08DV nqaVBjTpLiQOmwaQS3BJia3eFmjKcSgLr1bBvkyodyxxzSaIfGEKHncO47nz6j/wxk fmQG0gyg93qosJ5o0CIJFKBFnHnESNDDqgpZ3ikw= 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.10 312/390] wifi: brcmfmac: fix use-after-free bug in brcmf_netdev_start_xmit() Date: Mon, 24 Oct 2022 13:31:49 +0200 Message-Id: <20221024113036.257119856@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585368135728634?= X-GMAIL-MSGID: =?utf-8?q?1747585368135728634?= 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 61039538a15b..c8e1d505f7b5 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); @@ -364,7 +365,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: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: 9166 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457883wru; Mon, 24 Oct 2022 06:36:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7b8BlHF0s/ePkIDq8iH5DEkFvp5o6c3hgYf75K1+agWp3wL7SddoOJf1yv3aKXzVtObveA X-Received: by 2002:a05:6402:2211:b0:461:5d0a:6678 with SMTP id cq17-20020a056402221100b004615d0a6678mr14455164edb.378.1666618600883; Mon, 24 Oct 2022 06:36:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618600; cv=none; d=google.com; s=arc-20160816; b=V1jZLC7Uqg1pu+eyMR5UU4ptOZ5h3sbRll/Af3i/woqSDHGCTQM5fxKVkNTZOpzlWw eebiTpU2AXDZI23MZBrMpGYvTJCziMfG9bH3YrkMRXucHn0UIaVgMCrePlPpdSsRb2v+ zApmTiRKFWwuBfmEiREsS2G+RtBU0DrigORX0e2SVUz5rT0EwSXRsltNfSvAGB3HXE0E /mVcWn86T3b5EpojFlHz8/gkTZQKakanfuSvz9t6TFPV9vz14mu3r7MWAIQjdEcJxLxy sNYr/FlzGZ4u5lEB4YAoHZ3sHZZmvw1eaI2x1SL1NLuwXkcPv+TJNHQ3NwioCeSjYVVW 8Unw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mKKtrtuIDBSFWxGJ/Tuas3kdLnm85rYjf1NFp71KmC4=; b=n+6cC8qXFlrxoTSAPqYTydRLkI+8QoQegYPIKw6ib9njPcsAbT5YPsrCvkI8j1vfgh y12fugi/z3aE6EMTL3h6V17C93jlZfUP+1oc75b4nkNa4z67vo38kpqLanoZpSDoftUz s/eSMtGwZ+laMuNt2qLt9iO+cp2+hvbbOfv0VadPZSphbHNBMjpgt89EB98EI3MkT0gC 4UAGLhDI08hsb3MCLhE+XXbWrXyQoDcYEQ0lFlJwkKgvh0+4IDJAkdRtdvAAWgXkHOLS qtl3B+MO91kEbWgOzD55qcyKirHp80km/i2CyBeINrKk3dL9NWn9fg4F8dX3Sa42Gqvc LGDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GKteBCsP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hc33-20020a17090716a100b007a11c253eaasi7206694ejc.809.2022.10.24.06.35.57; Mon, 24 Oct 2022 06:36:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GKteBCsP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234286AbiJXN1j (ORCPT + 99 others); Mon, 24 Oct 2022 09:27:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236151AbiJXNYd (ORCPT ); Mon, 24 Oct 2022 09:24: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 1D9E19F74D; Mon, 24 Oct 2022 05:30: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 1603D61331; Mon, 24 Oct 2022 12:29:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27E6AC433C1; Mon, 24 Oct 2022 12:29:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614578; bh=wzVrqqZRg7fswRLItuLjYSP7Zzpk6JKxUzObx4VK59E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GKteBCsP0Zvgn7dIgWAQ8cY00GKpm4GHiukRQmtP98tqhu6Mp8XZBEVxXyShRriSc JJWa6WSn6Q+W4b/TxF4KSyYi4Hte0DyKXFF3FxjfSgtHH6ocsXR5DK/KwaRBJW73Q/ KkJF71Yeoz9k67RzZYMGvuYOX+vLupNd0D91hlRA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Patrick Rudolph , Mark Brown , Sasha Levin Subject: [PATCH 5.10 313/390] regulator: core: Prevent integer underflow Date: Mon, 24 Oct 2022 13:31:50 +0200 Message-Id: <20221024113036.294889422@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576265854318649?= X-GMAIL-MSGID: =?utf-8?q?1747576265854318649?= From: Patrick Rudolph [ Upstream commit 8d8e16592022c9650df8aedfe6552ed478d7135b ] By using a ratio of delay to poll_enabled_time that is not integer time_remaining underflows and does not exit the loop as expected. As delay could be derived from DT and poll_enabled_time is defined in the driver this can easily happen. Use a signed iterator to make sure that the loop exits once the remaining time is negative. Signed-off-by: Patrick Rudolph Link: https://lore.kernel.org/r/20220909125954.577669-1-patrick.rudolph@9elements.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/regulator/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 317d701487ec..bf8ba73d6c7c 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -2544,7 +2544,7 @@ static int _regulator_do_enable(struct regulator_dev *rdev) * expired, return -ETIMEDOUT. */ if (rdev->desc->poll_enabled_time) { - unsigned int time_remaining = delay; + int time_remaining = delay; while (time_remaining > 0) { _regulator_enable_delay(rdev->desc->poll_enabled_time); 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: 9424 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp478853wru; Mon, 24 Oct 2022 07:18:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4C5P1EzMT9Kx7H0gmceJI2jffnFzof+3Xlcp5tG8B4jo1en8acLko9R2E0jG1W4U8dVht6 X-Received: by 2002:a17:907:d0f:b0:78d:a335:8368 with SMTP id gn15-20020a1709070d0f00b0078da3358368mr28485811ejc.260.1666621086850; Mon, 24 Oct 2022 07:18:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621086; cv=none; d=google.com; s=arc-20160816; b=yzIDt8+nRTuROF7f3F/omt5w8lHAOaqYBLto84F4hETwJ8r1yMMxK7DtCyCD+brh3D ea4SN7FXbCzxLIpt9zS9RT1C7zI0MQs4rPF/0TA/GPxEl2hs/qPSrH8V4W7fVNUq/+02 sZIMmr1WkP9FrzsCHHF92tjp/4mRfAGHU0L918gsp8g6Vl4gGJChfMb9ZGuNFjzkpEa6 5Gb3HW+NAzRzhkLCxo2iJI3RpjOKr6NftgcTKWt4xcLXxj3SzjATe4MIxZjd6qGjwVFD 38Au2lfCpfqGHt4rNdEeu/e76Wf895TExcFcjfkvABxNLCp3Cn/e7Z2D0xYu6QfCz/0b o7tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+2aS56KocB0BkZU6WEWM3pRdq9EZx6A1OEjyMnPSdUQ=; b=l9k2wXc+z5nV9XSUVsDrUiecZGNHCn9o3qf4sf5SaqHWFu+yraGDi1yoVpeeEVk/TY DAA0dIKFClwjQwxfTAfqCv3mexgDaGJjLrqdti4940c5ghtehvwIaoQeEr9Uak1UAsZE J/3seOPXOS7L4i6UwVOwk3tN8QVV11UyS6Yiw2zyJK47uzH2KqqPk1iTWdD1+5TVZlLe L+1xN8poriwPuqm2Aqz5BHyH+JJREjSpal/oEN0l2MDdBgPhZTdkcQhO1Bc87L5RqTAB FZFwn5SQfDLBKRza70M5idg2ngiPUoSSDStSoS8Virbj/+3uMbrsRWGXueVJK6VlqqYW +HEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=e+uFerGL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go32-20020a1709070da000b007aac98ec3dfsi891770ejc.303.2022.10.24.07.17.37; Mon, 24 Oct 2022 07:18: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=e+uFerGL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230517AbiJXOLr (ORCPT + 99 others); Mon, 24 Oct 2022 10:11:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230273AbiJXOIl (ORCPT ); Mon, 24 Oct 2022 10:08: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 2B40E923F2; Mon, 24 Oct 2022 05:50:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5693AB816AA; Mon, 24 Oct 2022 12:31:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0B3CC433D6; Mon, 24 Oct 2022 12:31:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614686; bh=EdcwY0D8B7I0Mwb7B6eSp2g/eQ+WY0LiEEa3Q5KACew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e+uFerGLyrTALq/0fNRijS0U4pNFx20JOGiAcUHB4SRZilY+Bmd4sMZt7jk4YG5mr XKoLsqiTVHxjGu9XlVOzqSil92ig9O1Ugrj3TzuiGXs15Q1Jrojhd8y2lLpZz4YOWn ChZLyrURrXf0otGVwqWBPadhZjQQlWSgPCfpNt2s= 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.10 314/390] Bluetooth: L2CAP: initialize delayed works at l2cap_chan_create() Date: Mon, 24 Oct 2022 13:31:51 +0200 Message-Id: <20221024113036.346100455@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747578873044284811?= X-GMAIL-MSGID: =?utf-8?q?1747578873044284811?= 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 0c38af2ff209..8d5029c81ee7 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -61,6 +61,9 @@ static void l2cap_send_disconn_req(struct l2cap_chan *chan, int err); static void l2cap_tx(struct l2cap_chan *chan, struct l2cap_ctrl *control, struct sk_buff_head *skbs, u8 event); +static void l2cap_retrans_timeout(struct work_struct *work); +static void l2cap_monitor_timeout(struct work_struct *work); +static void l2cap_ack_timeout(struct work_struct *work); static inline u8 bdaddr_type(u8 link_type, u8 bdaddr_type) { @@ -476,6 +479,9 @@ struct l2cap_chan *l2cap_chan_create(void) write_unlock(&chan_list_lock); INIT_DELAYED_WORK(&chan->chan_timer, l2cap_chan_timeout); + INIT_DELAYED_WORK(&chan->retrans_timer, l2cap_retrans_timeout); + INIT_DELAYED_WORK(&chan->monitor_timer, l2cap_monitor_timeout); + INIT_DELAYED_WORK(&chan->ack_timer, l2cap_ack_timeout); chan->state = BT_OPEN; @@ -3316,10 +3322,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: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: 10145 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp638399wru; Mon, 24 Oct 2022 13:26:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7AWw8CVczdhDSA7LxIX6eIjN9FvGouykwcxjtLZvfm6uJbcBs3LmEV/Rl6ByxwOKDeVQTs X-Received: by 2002:a17:907:980e:b0:78d:b6ea:25b3 with SMTP id ji14-20020a170907980e00b0078db6ea25b3mr29307384ejc.98.1666643209289; Mon, 24 Oct 2022 13:26:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643209; cv=none; d=google.com; s=arc-20160816; b=JyMb/0X7C3OIM2Y+zECPKjUCVB0PPI0wdjipF26O3SFmYto/VPYaW/NYSYSWWkhmIl xAd+5meU3RwjECBTROEvtfJhvjMdo+0U3qROuuv3hbmmkW7U+fyq1gaKLdelKUBHjvyM F8M3puMelTAMyT6CCciH+5zKftBEjAiIEdu3TKgdHWz7+12svRHOATgNpVJbYO0YeU9x R7Eh2EVaI19QtMCAofjYamVVQlwk/5LHvJbAkaFGETOIOltyA7g8tPNyEUXFMz0zHWjN o0fWJbGYaazOYYeO/cP0unn5knhXvMl7JMhaYhgVZrhKFPX3zs8tSpps2FKX9qU0eGWY 3vLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=kaLBTeVaxzqxZJERpsyTMqQEmip4o+xKA17A9mJ8tf9rWT0qoOnA9LtSOibBA7njht MJpHsmNORkgosoDMYlkbr0MpTXzQ8KQ7ZeyF3ncccQv6HKS6ojseWSgC0eXGPUeETPKh kf7F7oLKhacuLQdRqnbJhhrckEu/0jvnWMqNP2xCk6lBTp7mxBju0mCHxMo+hUk7sNCk 4G9YB2YBguwQvlsSVULfDTGcl7gYpCr2Yv/xFxiQzaN2pcSUYSxMxojPGHXSsOhUSoQ9 /7gjgttXuPqrIttN/HZZrjegMF6WzR18SArYumD0YxhWKdwC//jXLXLgWBuR2UH8qzpr 3weg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=txliZiNS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hy12-20020a1709068a6c00b0078de51e658esi676259ejc.208.2022.10.24.13.26.23; Mon, 24 Oct 2022 13:26:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=txliZiNS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232040AbiJXUQZ (ORCPT + 99 others); Mon, 24 Oct 2022 16:16:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231740AbiJXUPr (ORCPT ); Mon, 24 Oct 2022 16:15: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 5609DDFC33; Mon, 24 Oct 2022 11:32:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 16304B81154; Mon, 24 Oct 2022 12:30:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 735E5C433C1; Mon, 24 Oct 2022 12:29:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614599; bh=/BleCwNH4q+MxKT7DR0P99zio7f8ZwEn9aOrqdQJuJE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=txliZiNSios80Dd6eD8VI0jAkRmx0KD8y/vHUuB3hUmA4FLZ0aLqZE/YvpKuc/nsr +XKgIzCxt6pbSsE2949d5xstovj1vWz3Hc+SVmPnXV7+5stbnZ6rF7Bu8mNN3eBg14 EhirtJkGEF39bDmTAoEaYyf+6H3bZUM7+zuZjS18= 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.10 315/390] Bluetooth: hci_sysfs: Fix attempting to call device_add multiple times Date: Mon, 24 Oct 2022 13:31:52 +0200 Message-Id: <20221024113036.395960480@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602070043798623?= X-GMAIL-MSGID: =?utf-8?q?1747602070043798623?= 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: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: 9887 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp571512wru; Mon, 24 Oct 2022 10:33:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7dnk3mAhNTabFx+CgVrMNb113z7XsvwVNVETCwyMgBO5oZetMKFiU6854xkRzLbuZDxytS X-Received: by 2002:a05:6a00:1acd:b0:56b:8181:d78d with SMTP id f13-20020a056a001acd00b0056b8181d78dmr13426878pfv.50.1666632799053; Mon, 24 Oct 2022 10:33:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666632799; cv=none; d=google.com; s=arc-20160816; b=dVurFEmHgSYuFZwDTySo1705c481uZaTKuwmeggsWF8+0n9e9rckzrRMmQA2VsrdU8 n3FCdD+j1Nwv5jmgcJKGzaGOCDmLbqDDeSxMWxjpthw90c4SumSp8/IcHbk8X5DJs9cl vVDR13jXg+BNx49gSpR2sDE7YgLigDmO+8GU0X6TwISlzqG+6p778FNxU36vZl/CcRGu ozvSFHS/OZFwvbUL/MwYp+Dw6MA+4orpt8bhzP7ZSre9vIT8SWcHuNyDRnk+vjNFcTXN F8J4pgCxb+E2AF54g6l0KL9PwqpTj9mBxlq0mB/1BQpMyc/+GEIZ15RE28ru+Qer1TTU B9dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Xea3MDJMMsqpbd3YGxLLNJXKCNg7Xf4g7W3G5mMNdFM=; b=VoNgFiW6QCg0opqPj5HHLSIDDEnogSFiC1yv+czGw+RgpxkMv7RLTBNWDS89hf2sD+ IXhIBD6ZZ0BEFhORmcjA6HorLqd7jaQSMnF53Qu9wHbBwRpGhC/P6dlp789a+gvuyfZL 1IqgbZsNVP9swKWBtim9LXitmdrNkb5zdk48Cz8YCvkUoCmqxcruoZ6pvDQtIAkmQOI+ IogqqwSUuNIeecKxbGt4P07HkIWuIijPwNuGREXDr9UkS01ze2VqqupJVyHFyo5iNoJV 4oCbIpImlAS/pQbHhOl8QaplOx87VMyHaZocKeynHBV9tBVHO5K69SJmVfHLnCyUIQzR Y/Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=q22QP8Ko; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w13-20020a17090a380d00b0020a97a92a2fsi475037pjb.135.2022.10.24.10.33.05; Mon, 24 Oct 2022 10:33: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=q22QP8Ko; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229833AbiJXRcG (ORCPT + 99 others); Mon, 24 Oct 2022 13:32:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232940AbiJXRbe (ORCPT ); Mon, 24 Oct 2022 13:31:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 888A343615; Mon, 24 Oct 2022 09:06:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C3E89B816A9; Mon, 24 Oct 2022 12:30:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 240F5C433D6; Mon, 24 Oct 2022 12:30:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614628; bh=WtmUHpXH7zAUYwCL3i2VSbXYr6kSqUkFecpd0pNxcTY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q22QP8Konm7p4P1vFgMeEkPJ/gqNB06zuzOi7z/Tw6IQJ9lElnyFrkDY2p0i/b1Ax 1SOYhMl5krRNTvD6x2PxKSZw65ha0z9RDKnCGkvppeLVCWU6HyH9rqdTQYdeP9leI4 8Fw4v+q6TOZ37PUy2d+CkRAzwc7xDicwUJ7yvUH8= 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.10 316/390] can: bcm: check the result of can_send() in bcm_can_tx() Date: Mon, 24 Oct 2022 13:31:53 +0200 Message-Id: <20221024113036.443708770@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747591153995187758?= X-GMAIL-MSGID: =?utf-8?q?1747591153995187758?= 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 e918a0f3cda2..afa82adaf6cd 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c @@ -274,6 +274,7 @@ static void bcm_can_tx(struct bcm_op *op) struct sk_buff *skb; struct net_device *dev; struct canfd_frame *cf = op->frames + op->cfsiz * op->currframe; + int err; /* no target device? => exit */ if (!op->ifindex) @@ -298,11 +299,11 @@ static void bcm_can_tx(struct bcm_op *op) /* send with loopback */ skb->dev = dev; can_skb_set_owner(skb, op->sk); - can_send(skb, 1); + err = can_send(skb, 1); + if (!err) + op->frames_abs++; - /* update statistics */ op->currframe++; - op->frames_abs++; /* reached last frame? */ if (op->currframe >= op->nframes) From patchwork 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: 9406 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp478453wru; Mon, 24 Oct 2022 07:17:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7zUOARFONoTnrbIdhm0HlnsYcEuwLoXoOxy2ZhRnv50nBtoZVqtvsEtk6Qn6rfXIXsAwir X-Received: by 2002:a17:907:7203:b0:7a5:b062:2338 with SMTP id dr3-20020a170907720300b007a5b0622338mr6638895ejc.8.1666621041274; Mon, 24 Oct 2022 07:17:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621041; cv=none; d=google.com; s=arc-20160816; b=Kr6XWCQ3Ml4xhEku2k3gjced3fkt5vHD3ZWk6+hELGx+J31R0oo/AKetgWBFVuVMd8 DixyHHqMlBp/QE1PSJLoXCxXxOR3qkIKqkBLlagf2m+wN+1u6MBcswCTyHpedgL2iqRc VWMnxMBaqGfpbjIP7VBQO3AFS5UwWN295WaLzvHdakd9qysIDMoF4T9WDNxWxqFRYB5K bJLnbRBkTPTaLQYKOlb9DK3rSWZ6/0RzMjVAAeAUkGoXxf+zlbQ+7ao8lI5nEq9waOsJ Y3NGxKKkETQZZsDVuD0APrVknIBgRivUUysooR23jie8IrMUnbpg+GL1K6EWxvv7kYuS FTLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OUhylasl+mSYAEY++1OMrw36UJk+YkBk3vJu/V29pfE=; b=uCCgCGPPKObNcM3z/ExspUSg5/1CZm7NRQLlhM8wHkxRPmvB7dHPZ0ExkVJSET9eeX 7SWMyJEVEjvZ5vRKW9bUNIStCQ9f8WzmaFSIHpQ2Nv4o9y0Z9rMHRB5arij83b1550gC c2Wo3C11d2hUPw1GvuIuQIII/CTLm79miwFgT9WSmKP4FBtwmxq4nJnUehSzeybi4q+N UxXUW0RYqdfwVemcDkfxvgRS+AMS/hVP8RjJ4JqDMICc0FYiGZ8iQ7ynX4JmDWdS+ny+ cr48KfpT9VwIR40rgIMHtsTZkkIAH1NpEpiRMKm64NO0LolieGvjwld7hE0FTvXX8+pS kdmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aXfd0iqS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b19-20020a056402351300b00459e1ce80a7si20948052edd.241.2022.10.24.07.16.55; Mon, 24 Oct 2022 07:17: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=aXfd0iqS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233890AbiJXOIL (ORCPT + 99 others); Mon, 24 Oct 2022 10:08:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237070AbiJXOEg (ORCPT ); Mon, 24 Oct 2022 10:04: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 27A6F915DA; Mon, 24 Oct 2022 05: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 8FF08B816A6; Mon, 24 Oct 2022 12:30:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6B31C433D6; Mon, 24 Oct 2022 12:30:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614657; bh=jyyJhhngZWyi1HqqiBN7m3fK6xGknx14ephTtA11qjA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aXfd0iqSI6UgHSHhSVDR322UMZGC/JpE1TiqRUmYSrEL3Qw8ulWzqRjSEF7o4M8Dv KlXzBS+4UwYWG9mdzXwBL8ttVILEmlmnrVNBAw2TfIqT/6Aj34Qh+rGPmPxCyYZ/i2 RQtUreA00ADuWjZblmsSNDTOEQ/lfKalIai5iU8w= 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.10 317/390] wifi: rt2x00: dont run Rt5592 IQ calibration on MT7620 Date: Mon, 24 Oct 2022 13:31:54 +0200 Message-Id: <20221024113036.491462091@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747578825183305463?= X-GMAIL-MSGID: =?utf-8?q?1747578825183305463?= 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 fed6d21cd6ce..3f2c10c2aaf8 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -4352,7 +4352,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: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: 9152 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457633wru; Mon, 24 Oct 2022 06:36:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4eFDqWjLG9EFQs9ivEySbPL79AGCOcsEzFuAVGyCDUh8FGbQ/6aItMnuzWai7q/fn5haGA X-Received: by 2002:a17:90b:33d1:b0:212:f02a:e5c7 with SMTP id lk17-20020a17090b33d100b00212f02ae5c7mr11995255pjb.137.1666618578055; Mon, 24 Oct 2022 06:36:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618578; cv=none; d=google.com; s=arc-20160816; b=X3lIqOS/dqdvi0ha6dCmcUFmeuJla400cOIw5exCEJ/7YzSxsG2c1jwAnToBmE2gNs zgmIvsErZIxoCNmFqXvbTbO1ePD5Q5/ERW3P5e2hGU4xtTE/KPAXlrqx/9hGUtVobwDv lh3wQocTmuSGCKrWRyCZ7hGN1SGNADK9JxoMM5k9YpGtpP5c++QipbSBk6E62zh56r5G j2jQyW1ag0omTypY+I+dJFKzpM9gA4K/TZl9tVyvKHYTPQNq7/xV1SuRY5DGcIfEYGsh HCgEBU2SDPN+6/SYmh40uyRnVPquLEK84MwV9FGmjZqklO9RhPtx3j4wpPNyPN+TZ34L Jzng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ijQdXiO1i6Yo/ceR3e2UpQkHkHWOa7STgxeHGJ+f6w4=; b=n7i/43NgHuoIqIR/CCNS+pIXVfu5bweSDNtr0YP16OlxEUHB2GzwWsNCbgwrFoHg8l Ka3WnoWV5W+g97MsJd28KSfzaPyC0ykLxepcBVex6x11195KVVhQMRrBvFTWkuI1MNfa DLCGZX/QPgxMOble5KbKmA3pHq22wJtpKEe4xnNlHoiEUqHiN0SXLHQX/1IUSMr5fjvP nASZ13N/GzXTcUZTwQNuPZ4TvZiPUKS2TrkTHl5PRD+hgXu9z21WHp+cwJ40pLeisUTc UISEfB2/OX8gj593UGDMo7vKxm7Eavc/GO4ivLn7FekL6cOGlZAktfNf7Ka4vbzUDIgz bC5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SUqlAPe8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z6-20020a056a00240600b00562b0b92756si37968818pfh.297.2022.10.24.06.35.57; Mon, 24 Oct 2022 06:36:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SUqlAPe8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229649AbiJXN2d (ORCPT + 99 others); Mon, 24 Oct 2022 09:28:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232662AbiJXN0E (ORCPT ); Mon, 24 Oct 2022 09:26:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF074A99D2; Mon, 24 Oct 2022 05:31:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ED42A612E4; Mon, 24 Oct 2022 12:31:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E855C433D6; Mon, 24 Oct 2022 12:31:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614670; bh=fx3JHcvtdVhm6G9pDbFUGab8CHujgq2yvps8m0vWMQ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SUqlAPe8ewP9D1efxyls3W4ryaFHHRMp+0haCnZXX2iw6P3blHzvsD9jRSlUBzSuH Gp73W5J7kGwfDw8vWVIKeKxF71YmutXXCxcvE/zzN0CdL4m2hEUMf5H4pCriGhx3F1 wYPwhaoQRpDfeZUawfQEpZBydPf7rQS8WqbggIkA= 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.10 318/390] wifi: rt2x00: set correct TX_SW_CFG1 MAC register for MT7620 Date: Mon, 24 Oct 2022 13:31:55 +0200 Message-Id: <20221024113036.530957602@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576242198910834?= X-GMAIL-MSGID: =?utf-8?q?1747576242198910834?= 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 3f2c10c2aaf8..327f19cae4d7 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -5849,7 +5849,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: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: 9160 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457785wru; Mon, 24 Oct 2022 06:36:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7tcPUfgr8M3Gu/1XAinJ36w6kovd1vJqwcmyU2IN+KzjYCSoW1tDvxYLv+WTKNqnGtTlMQ X-Received: by 2002:a17:907:7639:b0:79f:d1dd:2f86 with SMTP id jy25-20020a170907763900b0079fd1dd2f86mr11570491ejc.586.1666618591641; Mon, 24 Oct 2022 06:36:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618591; cv=none; d=google.com; s=arc-20160816; b=Oe/nXI5uY7XjL8FWcLgr13aVAWzpbScoT0lJVWmIvltMmf6GUuszCzwsaUu7ISel+L Zy1UmsY/MQbQv07as8TEobMESQagCAZdSdfBtf8Av19HXSx+GCBK0v5mmmjm6oSEKiEh TF7q2OWRitVjySTmkgJ5bbcA5W1afVvEXSf+95d4N+TNFr6K8XMRXtVYPrTJWgGxcTz/ ApSPys00P6DHYH2rXg87aBJ5gmxZ8UfiB/EmS47trWm957SDUd5NxUe6pp3MEBwa8rwo o5r29JVpxpoAtRimNxH1O7klglz9/NMqQ6qAaTJf7TStEpCZPv6Re0OV96eXOO0XffC0 w28w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8AaY3RDkfMCbtnFDVF3LuZ85G3FSsvN0woVS55VBjeg=; b=aXSTYzMKNTInKL0XMxTv4z+lSpzRMbmhpQYMqKHjbqFswXVrNLPZdCSrevE6zkWgZf PHTuTS2ecIsOlssV/xSs51b+sKlZN1wEaBxDzgCKqaUpfgopUvXMx1sZ9s/UG3e0Sq0B Gc/C1dO6/scWNMau9RAoEiA2cCfczmzd1X33jFDjfqeWqfhvz9Ar9gvsBpVNy7j2b5Z0 WBUZrYzDLDX/g67HWC4aTFkFNFBZwZxrZsndEUoFkP3FpCw907sT/B/ruOFh5hgsqRrp 5ukPCeEkf0KCsu9WoopaGnvwmJhRHTo5pvia9TYL+nlDfSXF0F0zPOMS4lrQ2f2Ralxc BHTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UvmAVbmM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb38-20020a1709071ca600b00773db351c39si30475481ejc.64.2022.10.24.06.36.04; Mon, 24 Oct 2022 06:36: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=UvmAVbmM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231348AbiJXNbS (ORCPT + 99 others); Mon, 24 Oct 2022 09:31:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231490AbiJXN10 (ORCPT ); Mon, 24 Oct 2022 09:27: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 3411B2EF4B; Mon, 24 Oct 2022 05:31: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 879276132F; Mon, 24 Oct 2022 12:31:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98522C433D6; Mon, 24 Oct 2022 12:31:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614673; bh=Fn1K+X/+sml9GeVaAfUJeFE3H7qKf+y8us/IxIyghng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UvmAVbmMn8xrUq8cZmNBCy5cHIUz0kbmMzGic0HT2QZOQCrbOrhJYRd5voE3hIJCB em7db+mdICEPEjkDcAahGNVMPiau5/tmXGer4wpf4Of9x2n7G7mrM1E+nsgnIU94Cq sQ3ozG/P/MtKtMMxxCti9LElXDipRKxN8M4+8Ayk= 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.10 319/390] wifi: rt2x00: set VGC gain for both chains of MT7620 Date: Mon, 24 Oct 2022 13:31:56 +0200 Message-Id: <20221024113036.573682550@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576256257534850?= X-GMAIL-MSGID: =?utf-8?q?1747576256257534850?= 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 327f19cae4d7..94e5c3c373ba 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -5626,7 +5626,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: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: 9164 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457850wru; Mon, 24 Oct 2022 06:36:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6CYH5bUoCaVvu2I5otqpGMhA2lfI/qovr5L7t5R5ylzb9C/foCxD+q1d+edSXsJ1uhbIIF X-Received: by 2002:a62:b404:0:b0:56b:e147:1ae5 with SMTP id h4-20020a62b404000000b0056be1471ae5mr4014671pfn.78.1666618598375; Mon, 24 Oct 2022 06:36:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618598; cv=none; d=google.com; s=arc-20160816; b=SO34I0nc8HhFtghoHH8l6qNA+vzEVnozLRjMLLmSLAqvCWSAlwvyRrlMBSiNZRK23H uCijysoh0hiMG1UFudbJ64ral7ZmSn6giYEDSvxTsoZ6qFzOQ3ytHCqQnpV+xyn60OHt hJ7HuKaDJDQ0wm6ukQGiqMAgJaRBbvXdX9lTMWTqQmgwpPtiq+gHEyKxZZn2VEEI+OWJ uCAG8DzrY6HOQUiNp5WC1p9W8DOI16IbF3c2/z3YuK4piYHku7jlir+RTuIa9LbSyrfG kjt6oYXgedSZVayBp/hSNXsN3lWx6pWfjTzAg6N7J7QeQ92QPj454wVJ3wcX6F68wwml 28ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TCG/H56168Z/FStdZ5pbf4QHdW7UjOmTrQQM51mXBYE=; b=Hd+jEe3CsSY9DavJX1uMIotcFDhptmaHspaMroLsVlWe1ooZ5bMlhdbYTFkVeqvJbE eX69MjTnP6Y3dEVYGagVqfKlcPsAEPpC5WhPz3apMajAGkvHrPOpYSx64Sci8AA0RXP7 ECg2HVU79VfxVbNAJQWDJKfbkkh37UZ45dmXhCM1RD6ZWYBko7SHDwT5dFJVGICQZdk2 ycc0IeiZKuFJNyqCSDuacxgmJRAwg1XVJhJcshutz/xQT3VeiEv+/AE33NnhzXMxOfsl IfgU33rSIdK0MxJUxbNk8P2yv9klYkHnDz+PIgxsrzWLZY/wV7x6TacfOJjPmo238oqA A50Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jzbXUN0r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d18-20020a631d52000000b0044d470e823fsi35854080pgm.327.2022.10.24.06.35.57; Mon, 24 Oct 2022 06:36: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=jzbXUN0r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231516AbiJXN2Q (ORCPT + 99 others); Mon, 24 Oct 2022 09:28:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236448AbiJXNZr (ORCPT ); Mon, 24 Oct 2022 09:25:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E18EA87A0; Mon, 24 Oct 2022 05:31: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 353436132D; Mon, 24 Oct 2022 12:31:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43CC6C433D6; Mon, 24 Oct 2022 12:31:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614675; bh=G/OHn58614PeSTz3odz4MZOluuswRe+RhmJGMZbmQEM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jzbXUN0rGKFqyTTu2fJKMNiD2WwRLUeRbPDGzC83WeDKT79NzpmtK7BNJqCC/STaJ 0hZCNW/QgvhQWvLL7gxfYutGIj00WdcjQ2otgsVh62zKHtnndthBwpRjFMnAM4SlqJ n5mKZDcE65rWWiQAtkCv9j495aASczWRvSnO4TJI= 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.10 320/390] wifi: rt2x00: set SoC wmac clock register Date: Mon, 24 Oct 2022 13:31:57 +0200 Message-Id: <20221024113036.623667593@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576263102706617?= X-GMAIL-MSGID: =?utf-8?q?1747576263102706617?= 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 94e5c3c373ba..f237fc17dedc 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -6112,6 +6112,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: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: 9168 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457784wru; Mon, 24 Oct 2022 06:36:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM519lK7XmwX6G6PxzgqiMiEKL+QjRXTD17rxycORB4tk1BBjNvKHUwZD1jKTuzg1102Woyl X-Received: by 2002:a17:907:7ea6:b0:791:81f4:b0e3 with SMTP id qb38-20020a1709077ea600b0079181f4b0e3mr28047574ejc.164.1666618591597; Mon, 24 Oct 2022 06:36:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618591; cv=none; d=google.com; s=arc-20160816; b=hpeiibpp0LcPA3vZu3RUDzmik+j9j+vdTnCP4q8JDEutwk1xaRJYXM4JsirjF7WCRO ivQaf+YUqKkWhv5iZYxJwydlOaulKM/0262McUlHjw7jbpnEth11CXPq6sVnzVzyi7Hg VzXuECGCOc/Ajc3DFTPoD7txTVN2AQOXCjrUBiqUMws4b1phEJOp+KibYntNFOIo16op ZGWwjMRGLZ2kQQFdIA9Ykzos+jEvaXOwrPxfqL8LJeP0rOfIP3bxoOImrL8c/oLiRGVU CPmbA9g6ObeicnWsb2PzYiq5n4CQAVPGwgRf8C8dAEpfP1V5ZemhyUeKxWl+jnh8Zhas X7jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8IauuaD9ExZX9/dSPZaFTGHyKWBhs9aK7+52XJICDdA=; b=jJusb0QDSf0nMTExXfnUINOkRQAOL/aEk/M9n9YJ6/j/JVPui/T4HfoCw9sjOEbkTk YheVpyfR1M42FvMEOYeGvY3n+sHisWFKuhtAO4uA0jmg2ESFm69fg/V7ha9Mojlh4JSS AeCR3ffO4Hmy99u70jWKjqRQEpZeai/E3mctV+BRuRqwYtuz1cGooce9VGFxr++1Y4Lv IrOz3VyUK7CTJ7V3JHNKWK8gOuYShsYMSQjrGSIUNAF9SaVddygHMGHNYktl3Ifz+4jW qmDp0rt4FKPVxQ+ufp7OAci4JZDFr9I0AFGCXnuKcadJwDf4g5RpNTNZnjuQwTvFINYy EQ5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VXyMCr6g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a50ec83000000b00461cdfb307fsi2067554edr.487.2022.10.24.06.36.05; Mon, 24 Oct 2022 06:36: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=VXyMCr6g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229926AbiJXNbN (ORCPT + 99 others); Mon, 24 Oct 2022 09:31:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231511AbiJXN1X (ORCPT ); Mon, 24 Oct 2022 09:27:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EFF2AA37C; Mon, 24 Oct 2022 05:31: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 D2F4561335; Mon, 24 Oct 2022 12:31:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD8E0C43143; Mon, 24 Oct 2022 12:31:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614678; bh=jK2U0kMit3XifFXgslKElWEhectg9xFFpdtHA6qSl64=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VXyMCr6gRMlkUQcgXR9KdNl+kp493QvveDg4JimgIgWjfoSpJvFOe4Ot6eubiZZpW w6+fbvScQuLFh2PNId+E/XjzImjXoYFGO5jOLeaylbJl4SEVxYGOgrAFWp3aCYsCXS /g1fIuSXVFZAXJMtQo83o46cfEVITIZGmjY1HZrQ= 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.10 321/390] wifi: rt2x00: correctly set BBP register 86 for MT7620 Date: Mon, 24 Oct 2022 13:31:58 +0200 Message-Id: <20221024113036.672385626@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576256242334085?= X-GMAIL-MSGID: =?utf-8?q?1747576256242334085?= 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 f237fc17dedc..4bdd3a95f2d2 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -4151,7 +4151,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: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: 9167 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457891wru; Mon, 24 Oct 2022 06:36:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7W6FFmS2RqJiuDexZhzdv6E4bkK7JR4dsLcUWbZ3q8ULNGyLhSpBAaheyPznSQtUlwcuGE X-Received: by 2002:a17:907:320a:b0:741:72ee:8f3 with SMTP id xg10-20020a170907320a00b0074172ee08f3mr27665037ejb.168.1666618591580; Mon, 24 Oct 2022 06:36:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618591; cv=none; d=google.com; s=arc-20160816; b=zADt3kIZaQ6Ne0smOB/wxg1rJvYrxjUa65rGXraFWfhMKstWCa2s7MAFUwZDfFfzbV pm+UMhVnwB/VyayJaOf7ZstoW+5M4y6UuZDnYj3SXF/ZoMV7u9zGd97kmc61pPSl4UmM wW5OsmaKKx7Rel9HLu4/p/LuWFSsWSr8uwwP46RYqXhhmdkNzWkhVff1I8nxVvksMwY1 fG0l5iGBi2TZKS5UAmqMv/fhv6waRu6C28JWPAooR/3qSz66SOJNKJL8/eoN8TY9pLB5 avO2kch68osU28aE/2U+znz9A4ArZHL83TvT8lr0GefYO19LTwJAsMLJTJ5x5pSwo/r1 mJqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=p0o94ZshT80VN3WOqMN88z0BeseIso4iGaquoE22D0cgnVE/xmTMNMjXQvE/wpsxiF e4+zWnHCcHYDDyKVruMhoO2gng+/lgMWiHYHSQyJBYXzXMVSReAaKkDQUo1wRAtan7y6 3tsVddNQ/0cGT5NqSfN5NlrGKJzaWWw8f5+hjBbS2Xbq0BwaTzFonbb7M/C/iMQpTdX+ AVFphdKuMIkXqfT6nDjJfVCXMX1NQgRFCU9jBRgqk/dZEvOgRWlXmW8Ix2vxmMPI2ISs a/8ulRS73bTHDwDNWKgtl3Vq40Y0k9ILvKQQ8ze7vF9IjGHblA3JX1mV4ZRavb8BGpo8 WFWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BR4geQnm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ji9-20020a170907980900b0078e2bd72aedsi27706616ejc.811.2022.10.24.06.36.05; Mon, 24 Oct 2022 06:36: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=BR4geQnm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231872AbiJXNbY (ORCPT + 99 others); Mon, 24 Oct 2022 09:31:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232505AbiJXN10 (ORCPT ); Mon, 24 Oct 2022 09:27: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 5E138AA37E; Mon, 24 Oct 2022 05:31: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 684B561290; Mon, 24 Oct 2022 12:31:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BA58C433C1; Mon, 24 Oct 2022 12:31:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614680; bh=9F/WwTjHJoxdBWqRa6iOQ5UCJYl2sd5H82WhROoztuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BR4geQnmAZyt76ZPwnakLo+VwBIN1X1fLjsRZzPK0kuG98dIwnRFYdNu6veLds+E4 gkQBvUmrxyN0QCq5TjxxnCvY5NepyaUvUz+y4LLNUcNTMNP2FHiU47jpEhbC/VGZ9Q k5QLGKpRfmh1XOYkyTi9YmnDn4XJxgPzS5pHsBgA= 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.10 322/390] net: If sock is dead dont access socks sk_wq in sk_stream_wait_memory Date: Mon, 24 Oct 2022 13:31:59 +0200 Message-Id: <20221024113036.715388452@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576256436060900?= X-GMAIL-MSGID: =?utf-8?q?1747576256436060900?= 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: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: 9178 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458141wru; Mon, 24 Oct 2022 06:37:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM70vaS6veKxhfN1N/WDXULtXaVPshVx63KnWK48CBsZYzkypk0aoQXe1J1jUIILisNvLp4O X-Received: by 2002:a17:907:7294:b0:7a9:8a22:74d4 with SMTP id dt20-20020a170907729400b007a98a2274d4mr2819237ejc.139.1666618626633; Mon, 24 Oct 2022 06:37:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618626; cv=none; d=google.com; s=arc-20160816; b=DA1mPhPF0VhkGtb1I+BFt38wkZezUiO80tBRF/5qBzvFD7uC/ax2FrY70wKmIZUfDP 8fHN4NR2+JNg4BnPo/BBQbKiTbug0sw81GHWjljLaeGUMKfiK7/YWu7xrVQDoH/1HHB7 EszCY3BUuwmpjBrjrc71J71O0kzh0oi8SqpSSU4G5vef9x6aoL+BoY5XXy8rcVxPYgOe u/hYI5YnECpqZFLWWKLNU+cWuZhGBM2PA7r37u2ZuVBsjGTAtcDMbdZf2AMPcbKcbUHD +56XLPtYDkeE+nKB4p+0k2zEKzpFsvZVEcy1e8V+le8ss9ECBb+NdbDjRFpIZhfkXHAf OfLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+CAUdllp8De5S7kL94KxNmMiRjkP1aVzg8Xfo28htpA=; b=QnGUdWBXA6wXUfvefcOCvlo9wLR5w2ykqIlSOxSD9keYVQo+KaUzP4JwuGu6zs3/f4 z0JhFkd10uqq5BRx/Ci1Cb4aYBZT2LXB6MH22huv4K6c7yby/l+r7uMxQdC6g6Rt/ycK TN6fVFaiem2L4HkXkrlBfgnyNgq8Dert06R7eu7lT25FSFC7m42AkOAMzTeBRFKmXHC7 LUd0cP1mCPzvqs7dl6Cv97qqQwxk1VQ7KwflBmkZoTI4L2MjoOz+Cv2lWnLkg+68qs4t 91SW3rV4X0PR6tN6a24P14m3MZPIhkNMrnuzTTkhkh60w5z/RDWHA+ll8NFa8nzLbFo9 ZjCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rm+Jjzj7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sz15-20020a1709078b0f00b007918f58458bsi16811169ejc.441.2022.10.24.06.36.32; Mon, 24 Oct 2022 06:37:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rm+Jjzj7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233475AbiJXNbe (ORCPT + 99 others); Mon, 24 Oct 2022 09:31:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231649AbiJXN2F (ORCPT ); Mon, 24 Oct 2022 09:28:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 592EBAA342; Mon, 24 Oct 2022 05:31: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 02AFE612B2; Mon, 24 Oct 2022 12:31:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 187A2C433C1; Mon, 24 Oct 2022 12:31:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614683; bh=RjcwV9hFrPRXuhgEUhxyJ95z6UzuutUEERVXHOYHQnI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rm+Jjzj7ii+MWy70Qbv3YCYOFnjitbtanAoktIYNatJ4OLX6aL4AZqXDOg+BikEbV GQymkgXDpR1P2oAxeaAmO8GZzkOyL1fi2lqvY6Id7j3Lv6E54YqvnOiUVpct267pmr zrU48Jha1Srk6lCiOdWwBrEjd4IQh3pbbqpcOlpQ= 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.10 323/390] Bluetooth: L2CAP: Fix user-after-free Date: Mon, 24 Oct 2022 13:32:00 +0200 Message-Id: <20221024113036.750158970@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576293201495747?= X-GMAIL-MSGID: =?utf-8?q?1747576293201495747?= 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 8d5029c81ee7..83dd76e9196f 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -4305,6 +4305,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); @@ -4334,6 +4340,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: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: 9153 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457724wru; Mon, 24 Oct 2022 06:36:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4buSqIfhp2RXKjhVT3TuRDdBuw2gndCNp4vgrlYFQwqriHt1NOnpUG97ZZ8W0sAU+rmw7c X-Received: by 2002:a17:90a:e592:b0:20d:3b10:3817 with SMTP id g18-20020a17090ae59200b0020d3b103817mr23726663pjz.43.1666618586067; Mon, 24 Oct 2022 06:36:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618586; cv=none; d=google.com; s=arc-20160816; b=hOw2BK886MMhsqaDGVvsLchsINzB8t4alhvZojlnHHSM1QieRzVNmbxOIMFxzhWWS/ I5cqCNSUoS5MdKgAqX9gdgqVwOGOPKEWTM26lxezY3dYds2luCdHMY73E1VGrGESBPOu HqvdIe+B7PfptpVfVBPkW2oDmNLwB3jU3ENLTcyFqvy7ROtDBnPSoDy4eDtgGrrOFf4A ScQMNExWMpoGGVXQROTQYxnrsRkIk41Pm2Zq20gTR75zmEL3H0amDyfiI5djKx4jurgw UFiMZoDct6lMj6LnxSxU/OeCRKa1wiGuLgjZmPHPHfz3MJcEUIq4QovI/NnXZ61eJTbb YOVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lgcRTXpqPH6qcXn873teujM27SxFsJ+8rE+yw2Ag7+g=; b=wIhFpkaTgvhQION4Nqe3/wILPZaDJQxy+4mNK7dWhayumxKntlCK2Pnwpu2rfxJDIy jnlmwBGDbiEi3XIZLAxVXIZD13n1dpgmoT4iuGvnzbdH9+NliAiixCZInRh/5KdbLVTM NIxT7NBKgiCcDryDZPsmdEl8OexnKpRkiOG8bhDSNmDTvlXyyRHXk30AKBD9lP1DmUeZ OLJBuNns/oO4WqqrHlHPqR+UOreqNNFpWxf1ie/HqPunHs748VR6XHVoLow1U8YQyI/j T7QO0M3sL25N1R/GwENosfVKHhxlzDlOLFvp7+sxvOTW8zEDTFUpUMJpIuz0YcT2T2D7 60yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Dh9kj4+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 oc9-20020a17090b1c0900b001fe2de6a2c9si19243957pjb.4.2022.10.24.06.36.12; Mon, 24 Oct 2022 06:36:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Dh9kj4+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 S233775AbiJXN1b (ORCPT + 99 others); Mon, 24 Oct 2022 09:27:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236259AbiJXNYw (ORCPT ); Mon, 24 Oct 2022 09:24: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 62D2FA9258; Mon, 24 Oct 2022 05:31: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 23DA7612A1; Mon, 24 Oct 2022 12:30:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FFA3C43142; Mon, 24 Oct 2022 12:30:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614602; bh=gFrW7cGD5JJ4ll2P3SrnHW8IEKo4ms+qt3S6ja08OKM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dh9kj4+ZIUqFc7qpDRpC2ffvN4oQY2mFxr1vTpoaMaknEeVew4orZS4g9ec/wscKc vZGy/kFNigq9CXN+a3nY+IrjpjjVzOHFCyYh23GnGgS8d1o2ode2S6W2ro7DcfBA/Y hVuSks7QypKLMvPNWYe8eQj2jfS1PiPLD8xS/wsU= 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.10 324/390] r8152: Rate limit overflow messages Date: Mon, 24 Oct 2022 13:32:01 +0200 Message-Id: <20221024113036.797564152@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576250474901973?= X-GMAIL-MSGID: =?utf-8?q?1747576250474901973?= 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 0bb5b1c78654..a526242a3e36 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -1689,7 +1689,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: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: 9523 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp483185wru; Mon, 24 Oct 2022 07:26:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5yyCJCrqlO662Jcc1gjcHDuBdtF6koXfqL33lTqz/xQe62Ttv3L6jcfizI3l0sYVcqPxfa X-Received: by 2002:a17:906:5dac:b0:791:93de:c61d with SMTP id n12-20020a1709065dac00b0079193dec61dmr27271013ejv.751.1666621608000; Mon, 24 Oct 2022 07:26:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621607; cv=none; d=google.com; s=arc-20160816; b=Qf/BmNUR6gg0DlkeZGaeL+eyEtfSZW2rTY9Q/b6SYBiIo1Zi0rSwB/xEf7+5K/gfri FcvYqrynEHYdYsShx0VJXaIHjCS6XMlGvkU/nDG+2PHUcpo2KmOONFfpjXzPlX4s7sJE lz5jSRpYFYgBd7qpx1yn4vPKBSO4CHyJ3FOSle6u9B49NrAK2GoQnyYVHKX7wgzL9YFC B3VEAlRwka/FYshqCIneH5P116szAzFVftpn/8uWznPM1IfezY5K+HL6iW/yJsxLrn/y BBe+FxDBMM7ntcuwRPKx6k3jxBs0M1K859ZnoNgURbdfGQZqWgVCf7NqhFZOSq41pHMW e+tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=86Tzfm407mQTA/k5JCLfS2ZDe8GlqE9oSkmvMF4v0/c=; b=aznOB2ym0RivcRj9idvMo1/BIMyYhdIc+VKaC/o4O/PrOeo+fiBiPtMN3RlGRuQmYb VBzP6RK0NySQE+TU56fc+wyoPMmdw4yMALx5McC9cwAF5K9VIvTQrG9XWmRmPGeqtDHB WD11dW4fivrMzxtfsctOZUUWta2EZ+CffNkOBKxu1d8l7RD6BEt88kxhK6n/h650olVx DdpYma+qZlncrelnROGweSaYbRTeoNGfFDwl5RqZhUUKu+UDqoHeMP/RCvs8SChO90cO xKTxHQ5QbZXzZmAVqsg/xPs6XzeqVdfKdjLtamS+6v9xT9kh0wt7tp0e69N7/uDfUjHw 2a5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=x+ZoV3Wj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f22-20020a0564021e9600b00461e582ef0fsi1890669edf.381.2022.10.24.07.26.23; Mon, 24 Oct 2022 07:26: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=x+ZoV3Wj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235790AbiJXOWI (ORCPT + 99 others); Mon, 24 Oct 2022 10:22:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237224AbiJXOQT (ORCPT ); Mon, 24 Oct 2022 10:16: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 9F91432A9C; Mon, 24 Oct 2022 05:55:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 703ADB8169F; Mon, 24 Oct 2022 12:30:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE310C433C1; Mon, 24 Oct 2022 12:30:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614605; bh=+AaMpEEtbRsAd0445XliC1VO8cMNV1cNMNF7QtsWu+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x+ZoV3WjLOVh/2nS41UW854bP+ESWH0t+f9jlv/RA3hTZPj6Gj9hWjRwdS7c8uuYm 4yVnJRIz5hvxzsyCGkd0r2GqQqS6J4iABqIeMejaemSuDvP93M5gGbpcSNQCMQV+Cv FAKTiwN/Njy4bCU8xEYJQ+j7q06i+E18MTw7E5VI= 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.10 325/390] drm/nouveau/nouveau_bo: fix potential memory leak in nouveau_bo_alloc() Date: Mon, 24 Oct 2022 13:32:02 +0200 Message-Id: <20221024113036.839853734@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747579419485776990?= X-GMAIL-MSGID: =?utf-8?q?1747579419485776990?= 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 b4946b595d86..b57dcad8865f 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -279,8 +279,10 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 *size, int *align, u32 domain, break; } - if (WARN_ON(pi < 0)) + if (WARN_ON(pi < 0)) { + kfree(nvbo); return ERR_PTR(-EINVAL); + } /* Disable compression if suitable settings couldn't be found. */ if (nvbo->comp && !vmm->page[pi].comp) { From patchwork Mon Oct 24 11:32:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9583 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp528084wru; Mon, 24 Oct 2022 09:01:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7sgtMHGuvBpCnASpo0sEX1oCfsGL7nDPb1GAjIhdy6GUM3GYFhTlGQL0EVrsYamQBE+vbf X-Received: by 2002:a17:907:7fa5:b0:791:9a5f:101a with SMTP id qk37-20020a1709077fa500b007919a5f101amr28191113ejc.453.1666627303571; Mon, 24 Oct 2022 09:01:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627303; cv=none; d=google.com; s=arc-20160816; b=AKhcNCCizNWHH352442H0X0ZEauBTYOYiJZg9xLwE5bI8L79+rJzBBDnMwHgokvGa9 jvCq0rN8dvwFdsNz8kKLsBi/i9r8lZdvfpsMVY9a40pCryalWENfftj6SSOrN0TPXk+g 9pc3kgDVooA57Ey57UJWXR1nlHzzZXCJGNbsTH+/4VfNiQjaAx9I5C60Sf9GMZoFzwX9 by4jwGV3dK1MHbRKhbT7CSyIWuJ+ogdEHthgMph84JKj3ytIxkmomNzkssBSRYld5puu 7I3/6awpbqeF7YPk88CXea6T/Tt7NcAJvssEu52iAIhecphjc5041F6bsSLjP5p+WQI2 9zWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dRKjkhxSiXyCxMoxVXdjbs5O9+jTCf3iaRIi6A6J8JA=; b=NbCXZ/ueBiZCZdClP/j8SGP+rd063grj/93sGeNWuDmIXfqIylwxlCSQpgOjkTgQNL jXVimMOYREMP68e5b+oKz37tXvK65A/G5RCPOTAFInAJCc9Ez/6g+x9tmmbGs8dAZvFV tmvf1gewW7Hj+O6t1Nl+2XFkb4I4tc5zP5H8XlGnlLOipzVp+CVvTefDga84hrDyVsk6 IbmfsCWqqHOoWcHsdHgqrfitEqPN3KmwiVdkmALS3tsP6QkwVoMVXDLY/JOTy/biQVkE IDazxujfsTzhqJJa/7JI0m/mfCBMuaxP/hu5yABLIg/5os1Djes44Bq6+zS+d2Bs06k0 aMQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Cqbx1Nda; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056402090b00b00461c74a07c8si156423edz.343.2022.10.24.09.01.16; Mon, 24 Oct 2022 09:01:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Cqbx1Nda; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229679AbiJXP7f (ORCPT + 99 others); Mon, 24 Oct 2022 11:59:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231911AbiJXP6Q (ORCPT ); Mon, 24 Oct 2022 11:58: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 60439AB80F; Mon, 24 Oct 2022 07:53:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1A08FB816A0; Mon, 24 Oct 2022 12:30:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73C8AC433C1; Mon, 24 Oct 2022 12:30:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614607; bh=UgTu8csKsVfByuJaIAwUtmNsQx8OeEppTNvLnEVGaeY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cqbx1NdaksUjfD4iQDNqCX7TZvaaYX7kX+x6MHYRpr+N7pq8J5Oja8qbzfji3FEI2 Ue4W8AFtWnvGemDFZO0PBdP2+OWTg20d0dCqhbn0/5W26WzB+Upp/2YQs+66xX0+Uy 0C01G1cuMRGc3G6XuJU150VdNFlfMlVuNWQ6GLkk= 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.10 326/390] drm: Use size_t type for len variable in drm_copy_field() Date: Mon, 24 Oct 2022 13:32:03 +0200 Message-Id: <20221024113036.888486566@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585391745933955?= X-GMAIL-MSGID: =?utf-8?q?1747585391745933955?= 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 4606cc938b36..a15d55d06510 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: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: 9565 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp527149wru; Mon, 24 Oct 2022 09:00:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7jgowRXdVE+Dnt6dHVko0J66HMLQCSWvCW1db1kUTCpYNvUCK7OSE0bKM6qtZznpPuY4IE X-Received: by 2002:a63:4b5f:0:b0:43c:428d:507c with SMTP id k31-20020a634b5f000000b0043c428d507cmr27659325pgl.607.1666627224006; Mon, 24 Oct 2022 09:00:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627223; cv=none; d=google.com; s=arc-20160816; b=YLvsPt53aWrPi/i2O/hirERtCSx8OGC22mndbHKBAbAxXB2ixD4KdlqKjTj2XXHcID U+olLy0YzeGCpEaKg1wcw+h+T+FVIQSJ/XUDPgAkN9FQ5m7DVbaVBvZqaqR07c8VrS74 S8TRApC5bvOXRtO2rO/80xlPHqfQlyfSH2V021mEMflVD64WHT85dlwbh0kwvfV3XMO/ s423LrSlLhsnMwAJ5+awQgkk+HVaYB4Wi1ABb4WWrzzetE5C3gMP3Wgtw/MZiJarsBGy z8dgLBtShPGdIjwRVM63R5h0yrLJpqmKhGXjcj/eWBcjP5B7xuI67XM6H2Oo7GeIgvWc 4HDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dWpCGzg5nGkDukznSjrcbbwCIAiYNYY4G0GMtWPdt2Y=; b=HrNjQBTJPAe3mDgIqvEcqc87JhlByNq+YoVMi3W1Gd9LgaenWVpzN4EAnJmXol0GT+ K+fp9YmDJkk/JiffDX3gGjyIfVjsMI6y2lMTV9J73mkxTMAq0DthY6O3jxoKdafPqFbw poGhEtsB0ypoROnIhqXJYsCCgbkTWZUR2VgNtP9bc7z8r7XMZNY6IHPbB1vHjSSN7p+U Ik+1o3SNygexLO6aNn/QjpROPg5UGtU57MXdTBM4P02SUXHc3Ec9FxDWicm9iog64xk1 mO10RlZv7zTAlTY7OtKyEdLCPEBIEJ2ngbAtGwSlzFpAlLwXVIuNI2AExcZ4UIKR1JwX 5teg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=M0vU0lKX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a20-20020aa794b4000000b0056bfad4be89si1557110pfl.311.2022.10.24.09.00.05; Mon, 24 Oct 2022 09:00: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=M0vU0lKX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229766AbiJXP4c (ORCPT + 99 others); Mon, 24 Oct 2022 11:56:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231173AbiJXP4G (ORCPT ); Mon, 24 Oct 2022 11:56:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE86F3AE63; Mon, 24 Oct 2022 07:51: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 B2220B816A2; Mon, 24 Oct 2022 12:30:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18F99C433C1; Mon, 24 Oct 2022 12:30:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614610; bh=ORPUXJO0viEh1P8BNPldmNbr1lMupp+4Sp/W0JIIkBA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M0vU0lKXMVKiiRNvmgPADdVNtspzef6gVwxsw6XgEVYwkLU++FYAQ70xPvjmGiDAG UnP6Z1BBHNmr/G3ODYkWSLRqL/J3nAkzhwwZ6lpYJuwSOhaPht0NNzmYVChTRgFFuy CHux+X55s1S5bncqBHO85eVc9VoQwkd0fzOVW7LE= 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.10 327/390] drm: Prevent drm_copy_field() to attempt copying a NULL pointer Date: Mon, 24 Oct 2022 13:32:04 +0200 Message-Id: <20221024113036.938744218@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585307633522405?= X-GMAIL-MSGID: =?utf-8?q?1747585307633522405?= 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 a15d55d06510..c160a45a4274 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: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: 9574 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp527540wru; Mon, 24 Oct 2022 09:01:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Jx5k5If2vJi2nuSSwtBdzKlmNpndcFK98vu9syBiyOgvI27kMQ7eQermPVrc1HbnVRobB X-Received: by 2002:a17:90b:3103:b0:213:2578:e5c5 with SMTP id gc3-20020a17090b310300b002132578e5c5mr3065868pjb.217.1666627260578; Mon, 24 Oct 2022 09:01:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627260; cv=none; d=google.com; s=arc-20160816; b=CByr4dwz2s3YwD8StLG4h7Nwvx3XL6SZP4b2eWZvTVFlZhVqoRsExdsq9Xz9kZ7xes RnNiHlJ1UIYTg6X7KrWJilSng9uqbSKSjVeyyUmRlzfMOst1293XdGg1v+E4wPgSkjtX UlAFx0QqrlmMEuYAIJTpLrbUPBIjs3jJC5bkWYsjsYL3mUPYzyyp8m5xWiIwvrkzda6t Tyf6RvyVTdHTwQ8bu+poKtYEFoe/zjIiCubficvX7hSFsvQon62t9MzhOPCGGNnXnBhR uOIwOcLMRvNbuu+6RzHDVxhYJIifGcChpR4PVqMzVqTRRFLocw6RZAfZtaMo1y3iu7ju BbMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=goENrzwVvX4mMIGK699+yLO8Wevp3RuRLdAuzp2MWvg=; b=rD6GdvCaKRta4xu+kFCvhVMiDBDwxff3Sg0qJX0RMFIfrxlerize75qKnMEnYUpUBP jiE8dYZP13JgGUfqIj2IqdcN06tkfBp6GhS3CzG9Oprwqvssvnk/PPYiOPzsaSjrmsXJ WxKJuE6Fe35pycEH1a4l4/gOxey4OWbUMm3TIljbaBV0kJ06nUMIO/k3QcFoG21T/GJJ /+QwxMspTusnMSmW3V+IL/d32brlNgdOHN8mmpEuVcRl1tepwvFM3FGF5vSbS05ErDFa /lEyPi9CK0V6AlyijfGgA4GpAzhO9ZcNP4VkKL3KJQJyk/o1SkfPuKlXRPd1ZVAnUXZB VuRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pCjIGIDU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s17-20020a632c11000000b0046f0b3f7dbesi4168349pgs.408.2022.10.24.09.00.25; Mon, 24 Oct 2022 09:01: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=pCjIGIDU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231638AbiJXP60 (ORCPT + 99 others); Mon, 24 Oct 2022 11:58:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231610AbiJXP5h (ORCPT ); Mon, 24 Oct 2022 11:57:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2C1575491; Mon, 24 Oct 2022 07:52: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 4748FB816A3; Mon, 24 Oct 2022 12:30:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A516EC433C1; Mon, 24 Oct 2022 12:30:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614613; bh=/NdS3g71STJA3Pftdp1Yvvm9X41utaI30ce2S5p5+E4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pCjIGIDUoMFnuZXSwQokhuRzWF76MvBlU2NdzTZ5E2i1BBipVnWBRY2CdI6YU0s9L ZwHijxtU6mw45ki86vTJwRi4UU6JXIi/I3TdwtoX7c1SpiCW0mHMDbbSi3yKgQUkHm +TQWrWh7yM/RRZqaORVqNG/zMh/Y8xW0XlyRRugE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zeng Jingxiang , Robert Foss , Sasha Levin Subject: [PATCH 5.10 328/390] gpu: lontium-lt9611: Fix NULL pointer dereference in lt9611_connector_init() Date: Mon, 24 Oct 2022 13:32:05 +0200 Message-Id: <20221024113036.976751511@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585346697383614?= X-GMAIL-MSGID: =?utf-8?q?1747585346697383614?= From: Zeng Jingxiang [ Upstream commit ef8886f321c5dab8124b9153d25afa2a71d05323 ] A NULL check for bridge->encoder shows that it may be NULL, but it already been dereferenced on all paths leading to the check. 812 if (!bridge->encoder) { Dereference the pointer bridge->encoder. 810 drm_connector_attach_encoder(<9611->connector, bridge->encoder); Signed-off-by: Zeng Jingxiang Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220727073119.1578972-1-zengjx95@gmail.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/lontium-lt9611.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c index 29b1ce2140ab..1dcc28a4d853 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -816,13 +816,14 @@ static int lt9611_connector_init(struct drm_bridge *bridge, struct lt9611 *lt961 drm_connector_helper_add(<9611->connector, <9611_bridge_connector_helper_funcs); - drm_connector_attach_encoder(<9611->connector, bridge->encoder); if (!bridge->encoder) { DRM_ERROR("Parent encoder object not found"); return -ENODEV; } + drm_connector_attach_encoder(<9611->connector, bridge->encoder); + return 0; } From patchwork Mon Oct 24 11:32:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9284 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp463202wru; Mon, 24 Oct 2022 06:47:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7/5P3pdBqueNiLMw+1g2KFzEzyAC/O2mSJL1z3fEgnAXBPEZer+puUDr4nilNL8bkE/mMC X-Received: by 2002:a17:907:760d:b0:7a9:5281:9eda with SMTP id jx13-20020a170907760d00b007a952819edamr3041396ejc.50.1666619240905; Mon, 24 Oct 2022 06:47:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619240; cv=none; d=google.com; s=arc-20160816; b=Dmxs28T0DtO5m9QcFAJ6YwBy4b+ATD7yPE4bt9WDEwNL3JRnjvgO9NL3gSeXUIYex7 ndB9aeROEkkvmdBdp8mof+HoXegLpC4qUSNI5WrbHF9OehnMfQUvb8NWoTnFqOrWK/9E HuhQ67vv/ShFos3vRglR8iJW+d22fVPSwl9DSm2k6YfQpHFLk7KEN3ifhgojgyPigz6w acevNkRtIg6AgUvb+UQQ86LiT8tE5KalF3Oe0hSDKtBDgsiq65BrgR1HoklyEEPGmsUJ +Ffptbs+r360NbcQ9kmoE1LaqNCTZty0mQXVH5duQvQla9c1GXIQJYkSeTOxnOBz0r9b g9AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=ag5OGgu6Px13oDMV28emLk0u5Kz6srPX1CbtTzp51ZLIb7TVQv+Vd9ZzexgrmN2Zpk foEV3knmY/XVaZoaz9XMwdKuzA9KWVl3fpxDNhRtBZdwnlP+Wrynse8Uz7ZcpvNpEMdU B7cxtEUHImi1PY4ll2FYyLzcM2b7Yf/bR+ZzYV3r/zD/2gcL89pKDv4XbgpnopYBQ5a8 93djn/wDeSouDUF+HlBVaQzmu46fif/LMJhW1gshDMShW51YwnxOZE0PAVnEF2uYYJP9 eJiNkCaC9Zo0OGqZMj1js9k2qhhi9TKXalbvicqCJAhMJN8Uxz+/GSOgRSmqE12G2/Ad NBUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PSzx6uOn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp1-20020a1709073e0100b0077b2e822b8fsi25995129ejc.76.2022.10.24.06.46.52; Mon, 24 Oct 2022 06:47:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PSzx6uOn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236541AbiJXNoY (ORCPT + 99 others); Mon, 24 Oct 2022 09:44:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236965AbiJXNlr (ORCPT ); Mon, 24 Oct 2022 09:41:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E07ECB40EF; Mon, 24 Oct 2022 05:39: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 5CD3861286; Mon, 24 Oct 2022 12:30:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73394C433C1; Mon, 24 Oct 2022 12:30:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614615; bh=IqXIc2zb1gPqjZAiZAuDXqBufstMjobSxTTlD79UXjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PSzx6uOnXXIiA1oVKdJYAKVwPivdwe7tTaIB3D43UmRE6ZGdHlbZsShjDbIRU3gmQ T1Q+H1sYoDFGYZ34laG45/KF09PqED+V0t6cL2CTky+U/Xfti/XNcbuIyBx/7GIVhv Geh/4jaL5vjjkhrCLrIyORfwtKYfqHs6puh3ossg= 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.10 329/390] drm/amd/display: fix overflow on MIN_I64 definition Date: Mon, 24 Oct 2022 13:32:06 +0200 Message-Id: <20221024113037.018109490@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576936989752785?= X-GMAIL-MSGID: =?utf-8?q?1747576936989752785?= 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: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: 9412 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp478594wru; Mon, 24 Oct 2022 07:17:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7lcXvd/sqlcef51csTjh32AARzp3Zuzq6ghWm4iIwk65mtmJHHcYa2s/wPUAzSfCcX73Ec X-Received: by 2002:a17:907:6e93:b0:78d:dff1:71e3 with SMTP id sh19-20020a1709076e9300b0078ddff171e3mr26641056ejc.94.1666621057107; Mon, 24 Oct 2022 07:17:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621057; cv=none; d=google.com; s=arc-20160816; b=IChaiw+2VlflWXdCxnNOT9h4WMFRxd+oQw4OJ1mUHYn2HYECH+TaT8SRfQRjMa6kLg nyWvVMQhUYZ1qHHLRU8naPxmzHDjv2TkfW9gI6YyqJW4XVSiqCGQYRfJk3dkfw1vMUvx VNRRGeodsvV9QdKGwLYcCm2RFjGKhqO3QM/lc0nOuigPAdc/Cjyh/zAhSIh/Sj8wEp4J euXG7MYvsxl7mZKGPNzV1H1sLhqxIRGjmAbpBm3MgIi/P+6y9y0ng6E3xEuZRgRXTYMN Hom9+4ZXDV+lEPCHb6ySQXAN73SYezpukasRVv/kzu9JLBYbxgDcOq0Tr+OjcN9rqXPx ULMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zQlG7m36gw1oJYJYvw/NJuoqbMPdiJmx+bPaGidaYc4=; b=0iCwB+Ey2iPPyFHgLpGnkOOYy3tcfngZ/DOHF8F0k/4Kj2xs7W9pLc0g29ZosbZVPf SYZYYIDGdaHUiBacXrmqPjPKXhrFxh9Di9SpmjNKKJvmulUSZj22LTQ5XxOrYbmRY+Tk nudnF8n4RSt0QWypP216K4hFlAJYarXw36Bmpppg4z9GYqvfHNeUOSPV2ErI8CRSoLxK 9KOiusyxG9prG8JN2kSR/BpRe2kxwUIJUk5f4BXrh9MMrNW/B+dbvgPXPGORV7+ShGMj jeGBKuCf12/aWkv+5ZyUkj8az83XAb6i0Um7c67imYXyw7dLqljKmRpNUgvhl9USpe/X 8uQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="v6/hcnNz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y15-20020a056402440f00b00459f6b0fa96si34937076eda.355.2022.10.24.07.17.11; Mon, 24 Oct 2022 07:17: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="v6/hcnNz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230341AbiJXOIu (ORCPT + 99 others); Mon, 24 Oct 2022 10:08:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237288AbiJXOFQ (ORCPT ); Mon, 24 Oct 2022 10:05: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 E90373C8D6; Mon, 24 Oct 2022 05:50: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 85358B816A1; Mon, 24 Oct 2022 12:30:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E38C3C433D6; Mon, 24 Oct 2022 12:30:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614618; bh=qjR24BSMmkAFS/BFtuOkdK3KlnwctJ3VBLjJxkzooCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v6/hcnNzggMIrG3PZUIG76qoqjNyQOkakZvJd+0t2zjgSxRlNLnua+FVwlbMCXYBO 0+fdsVE0+wG7tNRWAuHElGUCF1uLL2MUpPqbquyHgfuxcZZ/PqD8z3ELAoa0HQ6TIv 9q1FT5nSUirlQghuFDfkHYs6TMzhBN4nofmyYpsE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+c80e9ef5d8bb45894db0@syzkaller.appspotmail.com, Gerd Hoffmann , Vivek Kasireddy , Sasha Levin Subject: [PATCH 5.10 330/390] udmabuf: Set ubuf->sg = NULL if the creation of sg table fails Date: Mon, 24 Oct 2022 13:32:07 +0200 Message-Id: <20221024113037.057296244@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747578841695516636?= X-GMAIL-MSGID: =?utf-8?q?1747578841695516636?= From: Vivek Kasireddy [ Upstream commit d9c04a1b7a15b5e74b2977461d9511e497f05d8f ] When userspace tries to map the dmabuf and if for some reason (e.g. OOM) the creation of the sg table fails, ubuf->sg needs to be set to NULL. Otherwise, when the userspace subsequently closes the dmabuf fd, we'd try to erroneously free the invalid sg table from release_udmabuf resulting in the following crash reported by syzbot: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] CPU: 0 PID: 3609 Comm: syz-executor487 Not tainted 5.19.0-syzkaller-13930-g7ebfc85e2cd7 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022 RIP: 0010:dma_unmap_sgtable include/linux/dma-mapping.h:378 [inline] RIP: 0010:put_sg_table drivers/dma-buf/udmabuf.c:89 [inline] RIP: 0010:release_udmabuf+0xcb/0x4f0 drivers/dma-buf/udmabuf.c:114 Code: 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 2b 04 00 00 48 8d 7d 0c 4c 8b 63 30 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 14 02 48 89 f8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 e2 RSP: 0018:ffffc900037efd30 EFLAGS: 00010246 RAX: dffffc0000000000 RBX: ffffffff8cb67800 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffffff84ad27e0 RDI: 0000000000000000 RBP: fffffffffffffff4 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000000 R11: 000000000008c07c R12: ffff88801fa05000 R13: ffff888073db07e8 R14: ffff888025c25440 R15: 0000000000000000 FS: 0000555555fc4300(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fc1c0ce06e4 CR3: 00000000715e6000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: dma_buf_release+0x157/0x2d0 drivers/dma-buf/dma-buf.c:78 __dentry_kill+0x42b/0x640 fs/dcache.c:612 dentry_kill fs/dcache.c:733 [inline] dput+0x806/0xdb0 fs/dcache.c:913 __fput+0x39c/0x9d0 fs/file_table.c:333 task_work_run+0xdd/0x1a0 kernel/task_work.c:177 ptrace_notify+0x114/0x140 kernel/signal.c:2353 ptrace_report_syscall include/linux/ptrace.h:420 [inline] ptrace_report_syscall_exit include/linux/ptrace.h:482 [inline] syscall_exit_work kernel/entry/common.c:249 [inline] syscall_exit_to_user_mode_prepare+0x129/0x280 kernel/entry/common.c:276 __syscall_exit_to_user_mode_work kernel/entry/common.c:281 [inline] syscall_exit_to_user_mode+0x9/0x50 kernel/entry/common.c:294 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fc1c0c35b6b Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24 0c e8 63 fc ff ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 a1 fc ff ff 8b 44 RSP: 002b:00007ffd78a06090 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000007 RCX: 00007fc1c0c35b6b RDX: 0000000020000280 RSI: 0000000040086200 RDI: 0000000000000006 RBP: 0000000000000007 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000293 R12: 000000000000000c R13: 0000000000000003 R14: 00007fc1c0cfe4a0 R15: 00007ffd78a06140 Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:dma_unmap_sgtable include/linux/dma-mapping.h:378 [inline] RIP: 0010:put_sg_table drivers/dma-buf/udmabuf.c:89 [inline] RIP: 0010:release_udmabuf+0xcb/0x4f0 drivers/dma-buf/udmabuf.c:114 Reported-by: syzbot+c80e9ef5d8bb45894db0@syzkaller.appspotmail.com Cc: Gerd Hoffmann Signed-off-by: Vivek Kasireddy Link: http://patchwork.freedesktop.org/patch/msgid/20220825063522.801264-1-vivek.kasireddy@intel.com Signed-off-by: Gerd Hoffmann Signed-off-by: Sasha Levin --- drivers/dma-buf/udmabuf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c index b624f3d8f0e6..e359c5c6c4df 100644 --- a/drivers/dma-buf/udmabuf.c +++ b/drivers/dma-buf/udmabuf.c @@ -118,17 +118,20 @@ static int begin_cpu_udmabuf(struct dma_buf *buf, { struct udmabuf *ubuf = buf->priv; struct device *dev = ubuf->device->this_device; + int ret = 0; if (!ubuf->sg) { ubuf->sg = get_sg_table(dev, buf, direction); - if (IS_ERR(ubuf->sg)) - return PTR_ERR(ubuf->sg); + if (IS_ERR(ubuf->sg)) { + ret = PTR_ERR(ubuf->sg); + ubuf->sg = NULL; + } } else { dma_sync_sg_for_cpu(dev, ubuf->sg->sgl, ubuf->sg->nents, direction); } - return 0; + return ret; } static int end_cpu_udmabuf(struct dma_buf *buf, From patchwork 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: 9190 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458630wru; Mon, 24 Oct 2022 06:37:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4lHR2X0sVPg0r8q/6Quoh+e3uOqPedJ7naTxJGG7ZIDTYeBdWlnh1uX8PPk09SUIDeEEH1 X-Received: by 2002:a05:6402:5162:b0:457:6ef2:df3 with SMTP id d2-20020a056402516200b004576ef20df3mr30697069ede.128.1666618675307; Mon, 24 Oct 2022 06:37:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618675; cv=none; d=google.com; s=arc-20160816; b=g8hlG1IlKzmmSTAWLdq1EPk4WlCs5S82f/3i4HpQsJIQdhH9vaEW5Dri6rNl40vfwF c1tr5lU8f9plpvoqnGHCNgZkPvJs4bNyN2hbZTd6xmB9k7p03rNPjLQk+Ge05S6xrZ3h KLmWsFf/qe069udY8KmFhRsc1VwFhZQQVGoXkRjrXtXBtT4QHcLJY7Z66nuEkYil4mUb zzmmA+s8OwpvGLrtTk+Wrouz7ykd3r5VSPDfg8w7m7eDyWbVyOW/PBaAVBRHAcelbdGA F3WvZmZYCb+ZWobpEx9+fg3y2yE7RIImKC1NE7wlS9v2URH/4OVLDlukZf9htQ7IKYs5 XzkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SpoZtMMqYs35YJ5JcRhVRVmgMoTfCpxTSrBK1sSyq50=; b=AuTzVMXniDChAEjW9IbHHlMcyEHDhM2NFdpi/SQ7M7vWGyaoUIoUf0HVQ6Dw2NGkgA HRv1QZA/jVzO0S0HPEWu48E3zrp/2d+z9r3S+NfL7mF3R6MddV+mXbXpGIEksv7kq4cc N3oMy9SUE/ZrmCyceRF8L+bK2TJx6ET79eGK9D1cmEsiEn8GYYnp/+PXH41iHZebisjz B1YGfgqyLhIzqJnMXBx6QM5HECkradCvWUpNbyJdD8YbNfccnFV/HIJ/rOZ2gr1ZpORD tks2llb6OxhOWRZmZdtQDo79m388vrGPTe+meaImcpa+X2hiLrV5GE8jAhettvZ25hZ4 6cVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Cmo8sF30; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b26-20020a1709062b5a00b0078cbe9d08c6si22201628ejg.197.2022.10.24.06.37.13; Mon, 24 Oct 2022 06:37: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=Cmo8sF30; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233731AbiJXN11 (ORCPT + 99 others); Mon, 24 Oct 2022 09:27:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236258AbiJXNYw (ORCPT ); Mon, 24 Oct 2022 09:24: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 6270C1B79F; Mon, 24 Oct 2022 05:31: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 6BB09612CF; Mon, 24 Oct 2022 12:30:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7AAA6C433D6; Mon, 24 Oct 2022 12:30:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614620; bh=t5hmdcnuv44cMjaNtCCxpqakrK7D417F3SSIMY/c0Z4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cmo8sF30d3KocjFR4UGSo52Pa4BiQ3R0DiZi59++aH4/u3piEwQr3N2dK+HlQVCB4 EeEgy/UcfDeinsiT2sObcplNes8npHKI1jZTJD3/uM3/+ZKGxw7NYxNwuTHz19Q5QM +ydgS3B9LdfyiACyyi9dmvLTx43RuyfrcPRbkBJw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lucas Stach , Robert Foss , Sasha Levin , Neil Armstrong Subject: [PATCH 5.10 331/390] drm: bridge: dw_hdmi: only trigger hotplug event on link change Date: Mon, 24 Oct 2022 13:32:08 +0200 Message-Id: <20221024113037.096221850@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576344494046045?= X-GMAIL-MSGID: =?utf-8?q?1747576344494046045?= From: Lucas Stach [ Upstream commit da09daf881082266e4075657fac53c7966de8e4d ] There are two events that signal a real change of the link state: HPD going high means the sink is newly connected or wants the source to re-read the EDID, RX sense going low is a indication that the link has been disconnected. Ignore the other two events that also trigger interrupts, but don't need immediate attention: HPD going low does not necessarily mean the link has been lost and should not trigger a immediate read of the status. RX sense going high also does not require a detect cycle, as HPD going high is the right point in time to read the EDID. Signed-off-by: Lucas Stach Reviewed-by: Neil Armstrong (v1) Reviewed-by: Robert Foss Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220826185733.3213248-1-l.stach@pengutronix.de Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index b10228b9e3a9..356c7d0bd035 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2984,6 +2984,7 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) { struct dw_hdmi *hdmi = dev_id; u8 intr_stat, phy_int_pol, phy_pol_mask, phy_stat; + enum drm_connector_status status = connector_status_unknown; intr_stat = hdmi_readb(hdmi, HDMI_IH_PHY_STAT0); phy_int_pol = hdmi_readb(hdmi, HDMI_PHY_POL0); @@ -3022,13 +3023,15 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); mutex_unlock(&hdmi->cec_notifier_mutex); } - } - if (intr_stat & HDMI_IH_PHY_STAT0_HPD) { - enum drm_connector_status status = phy_int_pol & HDMI_PHY_HPD - ? connector_status_connected - : connector_status_disconnected; + if (phy_stat & HDMI_PHY_HPD) + status = connector_status_connected; + + if (!(phy_stat & (HDMI_PHY_HPD | HDMI_PHY_RX_SENSE))) + status = connector_status_disconnected; + } + if (status != connector_status_unknown) { dev_dbg(hdmi->dev, "EVENT=%s\n", status == connector_status_connected ? "plugin" : "plugout"); From patchwork Mon Oct 24 11:32:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9564 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp527113wru; Mon, 24 Oct 2022 09:00:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6j9Q6+JiY5Nytn05hYYLQlpANPDesFl5IW++fubQM74m4NFA7ueDCzP49YbQ5jUx+Ar7Ex X-Received: by 2002:a17:90b:4f8c:b0:213:245b:b49 with SMTP id qe12-20020a17090b4f8c00b00213245b0b49mr3304003pjb.110.1666627221201; Mon, 24 Oct 2022 09:00:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627221; cv=none; d=google.com; s=arc-20160816; b=l2BZml2jbZk/43tMPZRgyLRuMGqHHaHOsRLHfs0IS9FNx/xpOcA0RE2RtdhqxiBtFm 0VwqsWcR4Ws847YjYR1ZgHFVj2UXXky8d0/9FIi6T3kfNSJ15hS2GtZ0R82PZ/txDvFm Yb9hYWoL21x4OmeueHC5iRtnV8yaGAbH49VS3B/y554KqR1Vnb3OxhgLWJG1UFue22PQ J0Ta3nVH6L9HzJHmSVW3O5SWoyXOfs8TFDZR2W4GlDJRWcrhecE/Bqmqjk441viFIaTm dakzD0f4yIKxh+c0eA4/EFyxSbRGhasqiWA9F8+VuGpmOK2G2YL58TI1xeBp7rlcyl/R Qntg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dXqMaEDLXttI5E50FlEe9vocTnHrhfAcqvBQtlc0e3o=; b=rG7mFR+3s3kjR30zclIUxiIpJ+dwdUdxMZ8Qf1sH6hr03pwVsQeQCXQUL4m3wb9prb tHMuuR4yiVJAifnuaYOnwL7Gc92l/KnFTAWTYT0WS2pNjCR28Sjjo/JP5zUqtKUMJSMV 6LPNqlPvPrI2p2QPTJ0Isa8nI6fHTeJMIlthBfmZuvJiiNUAGRQZCgoEvHGB/RPGye6C kNsKcOKGBsm/iMsx34uSIgITBCfwayGI1KoALaDnKzRkM3XJxDfdpIgjoRsxxEz0IBRc unfNIM3yBWZke+563CcfVAIAec2syZZvJfjXJxJEbfxIm7YClRWwXOLQrCBZ6yOTPiwf 1hkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=i++qnugb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w7-20020a056a0014c700b0053a339cafb3si66860pfu.53.2022.10.24.09.00.00; Mon, 24 Oct 2022 09:00: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=i++qnugb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230287AbiJXPzx (ORCPT + 99 others); Mon, 24 Oct 2022 11:55:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231165AbiJXPzJ (ORCPT ); Mon, 24 Oct 2022 11:55: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 B5FB4100BD4; Mon, 24 Oct 2022 07:50: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 BF678B81331; Mon, 24 Oct 2022 12:30:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19D96C433D6; Mon, 24 Oct 2022 12:30:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614623; bh=rDGR6WxWcKz0GLoKdiF+LPWjqv10NnK1ij4BucIKLCg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i++qnugbjnNBo5oNHmopCxEaqEDitclgvJstAqToxiL/2U5UuAncoJYIhVRNSaTo0 dDGZGml8w0uHnzHWGD3TNDXeaRU6l7f2/7vyE1tn6Hi+TGgNcDYqS+dqOgHSXSYLYd ULG4krffXlcXm5g//1LsvjQZH4kQ0NixQXFNFKkM= 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.10 332/390] drm/vc4: vec: Fix timings for VEC modes Date: Mon, 24 Oct 2022 13:32:09 +0200 Message-Id: <20221024113037.135772623@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585305339452696?= X-GMAIL-MSGID: =?utf-8?q?1747585305339452696?= 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 bd5b8eb58b18..c6bd168a5898 100644 --- a/drivers/gpu/drm/vc4/vc4_vec.c +++ b/drivers/gpu/drm/vc4/vc4_vec.c @@ -257,7 +257,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) }; @@ -279,7 +279,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: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: 9283 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp463130wru; Mon, 24 Oct 2022 06:47:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6EC8xzTECG/eAPLThCx8LbKa1W6fsb4JgdH8HAH7U/wzEk3RnUZuNr2ZvE3fCNTeYOOq4s X-Received: by 2002:a05:6402:3509:b0:45d:c25b:b80e with SMTP id b9-20020a056402350900b0045dc25bb80emr30900139edd.250.1666619231187; Mon, 24 Oct 2022 06:47:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619231; cv=none; d=google.com; s=arc-20160816; b=mCtSUL+wVqkCaIg6Vgs1ddwW0mCVsonFgLNDiH0d7D/kns3DqqN9uxpCrzTn6arg5i gd1d7ZWDbE1xKVNf+1GQa6Uc4uE6IBIzZLNEjPD6tVbQCm3YMO595sWGfMtx6EFfNX8u 37WOYXt+1RlNVxJ8BM2cXwjJYZU6zElUe8fs12mCjptt/KvBNszueZ1UZBFtpVKcfWTW EJ5JvnldMnwXT70Lcvch4EPdOcKPFkEP8LwQ0rRdYuceTyWpfFllUCWnKU6uz3HmMiPY ERbDEx7AJLjnEfQbBe+wrh1lUDzApSnWKXPtQ7OVr2txYl75WkuBgAc0IA/fhFE/4tdF 8fPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=IY3CZ8HJb3Kh8xEERek/BoefHvUS2tKf6p4Ymga2QySoZF7OyLGZD8Z+Hq8g5Aq2YL cNTmKeZAtjqiDtwSSeKXSD3cok87B4FKo6bZQMiDu02oLYzqs7hIy4HWc/YNeyj56NAC oHc6cQDR7pfa47C0gdvcvfehk03GTLtFSareHNHLqhBml/kYFID7qLJSnNX8awsca96x ile6aO53TeWMu1Uwk9cTCXtrua9fBXa33QeMKcS/VbmXgwAl+OAmf4kgYKo+eTVqZhMs +MH+gWU2AwWwdOtL93f/oWamqPCdPCs8v7d50flUAF36dK4uYXW6RV4Lm6ygp/tmaB1v CugA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="reOId/jh"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa2-20020a1709076d0200b00780a882d337si26280259ejc.480.2022.10.24.06.46.42; Mon, 24 Oct 2022 06:47:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="reOId/jh"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236226AbiJXNpp (ORCPT + 99 others); Mon, 24 Oct 2022 09:45:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236043AbiJXNmT (ORCPT ); Mon, 24 Oct 2022 09:42:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A35B6402; Mon, 24 Oct 2022 05:39: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 742B9612E3; Mon, 24 Oct 2022 12:30:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 864F7C433D6; Mon, 24 Oct 2022 12:30:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614625; bh=CZYsMphJMpaNrKDew+OX76nRYFASQeGDTo1/8Np2474=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=reOId/jhJT0uNI3zm+XUXLFy8mp4RpLB5OHaCIVsIHGnuM0ol5mcoLnUAd7XSLnf6 +ZSC1e4vq/c+iyptYQK4OaJ/ticu+L/zgfGiGXfigSXlguHOhs8SYEuS904zoe3qxv 5jF58WHoe2yBUXpAIQCMQQRGz3SWZ1GySM7Xv4V0= 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.10 333/390] drm: panel-orientation-quirks: Add quirk for Anbernic Win600 Date: Mon, 24 Oct 2022 13:32:10 +0200 Message-Id: <20221024113037.180598584@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576926743904591?= X-GMAIL-MSGID: =?utf-8?q?1747576926743904591?= 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: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: 9275 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp462627wru; Mon, 24 Oct 2022 06:46:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4nh5jolTHdOcpaSKUXmp+QLHjizOdEtXpuEYs60t1SbeIfR8o3IthXBn2SYXOBvJVVJmFX X-Received: by 2002:a17:907:75e9:b0:7a4:31c:ae0d with SMTP id jz9-20020a17090775e900b007a4031cae0dmr7693837ejc.79.1666619177716; Mon, 24 Oct 2022 06:46:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619177; cv=none; d=google.com; s=arc-20160816; b=I7TiTiaRSWRcwyKYSo2S4aPbc/y6wsFp1NHZjJWAXgRybCz2AWgh8r76KivAoxR0TI bNeq+bMS2TE5ufaFwpDPmyyNCVQMcaKwgmb86rw6x09tYqiwKpav5ik1VptPIVUY9CFf zCBPD6EXmmzGDUbPGyaWwFWXodjNi6I6T3fZNeNe4cAmzBbhBIlB5OR63/K5QHXpxjgt HhWEGNv47y/zEn7HhHPxN9CYmegtENmI1Suay9DTPsFisUocLUYKnsYLNqgiO11dIqQJ S64+6i3ktpDd3PbpQtOk7qAhEhBX+aQT69bJDFbJV+3g23YOQfHIWD3gnXstlouAf9/X Z+KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ut/ykMHpnjtV+JHjUSSdABWWx+60AFNoMBIIm5q4HT8=; b=EAPK9v7qxnmmvb1oe/Z30yFs247NabZCTTzZLqCUck1vjwi1GFlx4k+va1GvB6YdJu z0a22AmGkDGrKdyvwDsOH1PNQ52uCaM+EJxFo1Dw+rhB7+iRCER0tgzqOQ1DCCNr1n+f Fi8cXi1yEBpMdgcdJCB/bFQT5PsFDdicEKW9sKLYnklRNYCfqnYE/SUFOxcsJJnKWLc1 U/5yvB4pu4kKagPcDN0IJkhppDwgeAU2v51VaGR/1VX9e/lVEPrU81xRXEZ8Kxb/+F/W 35GZqm6xyftIJIP+OvSGAPVvOsGkMs3KgNKq7AYMq2/GAwijQsNEYU2YOniUdTEmJ+gA XG5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=X+VZh+4a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y26-20020aa7d51a000000b00461a7962c26si3616210edq.527.2022.10.24.06.45.53; Mon, 24 Oct 2022 06:46: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=X+VZh+4a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236475AbiJXNoR (ORCPT + 99 others); Mon, 24 Oct 2022 09:44:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236926AbiJXNlj (ORCPT ); Mon, 24 Oct 2022 09:41:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 015AC7CE1F; Mon, 24 Oct 2022 05:39: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 A1B8B612E7; Mon, 24 Oct 2022 12:30:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1505C433C1; Mon, 24 Oct 2022 12:30:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614631; bh=o3vtTwlB4jCOZ2PyHCmxu2zJ9FHZxZzmrmeAx8nin9U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X+VZh+4awW8ieTbOPH0617svpX/bJT0q+Cn6DX0qzSVCbt3g7nCQvKIm+VMJ/cCyB h+p37F1Yb9g9aR+ZvnXFHd+omKKfyDemqpbYeAM338GPAzAg0YrgTg37ngnQ5ZAJVW dqPkiqegploHJP/q9td/ukP7LK6lntHm0FFaOOvw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jameson Thies , Prashant Malani , Benson Leung , Tzung-Bi Shih , Sasha Levin Subject: [PATCH 5.10 334/390] platform/chrome: cros_ec: Notify the PM of wake events during resume Date: Mon, 24 Oct 2022 13:32:11 +0200 Message-Id: <20221024113037.220491883@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576871117902556?= X-GMAIL-MSGID: =?utf-8?q?1747576871117902556?= From: Jameson Thies [ Upstream commit 8edd2752b0aa498b3a61f3caee8f79f7e0567fad ] cros_ec_handle_event in the cros_ec driver can notify the PM of wake events. When a device is suspended, cros_ec_handle_event will not check MKBP events. Instead, received MKBP events are checked during resume by cros_ec_report_events_during_suspend. But cros_ec_report_events_during_suspend cannot notify the PM if received events are wake events, causing wake events to not be reported if received while the device is suspended. Update cros_ec_report_events_during_suspend to notify the PM of wake events during resume by calling pm_wakeup_event. Signed-off-by: Jameson Thies Reviewed-by: Prashant Malani Reviewed-by: Benson Leung Signed-off-by: Tzung-Bi Shih Link: https://lore.kernel.org/r/20220913204954.2931042-1-jthies@google.com Signed-off-by: Sasha Levin --- drivers/platform/chrome/cros_ec.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cros_ec.c index c4de8c4db193..5a622666a075 100644 --- a/drivers/platform/chrome/cros_ec.c +++ b/drivers/platform/chrome/cros_ec.c @@ -332,10 +332,16 @@ EXPORT_SYMBOL(cros_ec_suspend); static void cros_ec_report_events_during_suspend(struct cros_ec_device *ec_dev) { + bool wake_event; + while (ec_dev->mkbp_event_supported && - cros_ec_get_next_event(ec_dev, NULL, NULL) > 0) + cros_ec_get_next_event(ec_dev, &wake_event, NULL) > 0) { blocking_notifier_call_chain(&ec_dev->event_notifier, 1, ec_dev); + + if (wake_event && device_may_wakeup(ec_dev->dev)) + pm_wakeup_event(ec_dev->dev, 0); + } } /** From patchwork 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: 9605 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp529632wru; Mon, 24 Oct 2022 09:03:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5lrX+QdN88xPAWtnLgj3dxhQgjYOQahmhYsDljsKJoiDfAewQXaIrCSPGVL32oVkmytN18 X-Received: by 2002:a17:902:ce8f:b0:186:b051:1caa with SMTP id f15-20020a170902ce8f00b00186b0511caamr3926247plg.12.1666627435221; Mon, 24 Oct 2022 09:03:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627435; cv=none; d=google.com; s=arc-20160816; b=LajmP99s+mpb57xYs1zkvVnR3RS3dFE54G+mi99SggQfHYoyeV4iYV8aEy5BR3EaWo od5N0J0faVVQoaLcZopcCvmPd33c6k3PCUNvJkZwtV1nc5IRUjrYPNPhIo5IrxfRtJA8 AdIeb4y4NMSvZzpL573dIfgAVoIWhsifaUWc5JHws17xasrnbT5mGB2QIUl27kjb1KHa Nhg0RoAPFM2C0VvIJQiRNZkp/QzOu7H8zSo2eV4N3Vfs3O/oS1CUhE33MxC8T9GJiBu9 FD2DRerwULB7JC5tEwER46ZGGjvW0uVI/4IzsI9vtKtABjVPHHS/U/WVyS32eH6EucAt PdTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=ywn5mPBdJGgzFtpdHXZWlpx7IEsWQOfS8ShvEsngSuUvPGXrFQELPyCKoCi24SuAgB aVRhiAwl/+Jza1/3KPHRCoZ5P2SxeRRrY/fIc7kXdrhehzQbf1YwiHv9cN6ogoSM3hqZ 37L2WI/ILJnZozvYul464T1M0payae7JLKTPm+5YxJLBkbasiQcMGDRp8S2f7KsuYbt+ 8SkzXccetYep8sHmU3qA9yXfbC0QWtbKOBTQggE5KyxWy3bHIAuNnvOjODgw9Th4Aevn gGAdGhVmN09zpiMfskaiXaoiczZzBYdNUS3HT4Rjg9+QAEPOvN9BmTpSqoxkg7MRtgng oJrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qFVei7Wx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f22-20020a17090a9b1600b0020ade3b9825si268056pjp.52.2022.10.24.09.03.40; Mon, 24 Oct 2022 09:03: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=qFVei7Wx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231895AbiJXQAQ (ORCPT + 99 others); Mon, 24 Oct 2022 12:00:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231758AbiJXP6r (ORCPT ); Mon, 24 Oct 2022 11:58: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 8873321E04; Mon, 24 Oct 2022 07:53:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 113D8B816B8; Mon, 24 Oct 2022 12:30:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6191FC433D6; Mon, 24 Oct 2022 12:30:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614633; bh=VyRbyK2ww2404bbaV+nZGsh7aEeNQVyazO8tGuaL5hY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qFVei7WxuFonIozhkfSMOVrVYYY/Z57amCxoepZwXID44Fo2bfe1TulED/kVKHOyt OJ+dtJBlnEs1vDAbFOyQKVDGIxvowRswEUXD/rdt/4sTVdcQwPol4JErxc89DqREmZ XI6trKrYgFU+WGBFCN2BhawuXcP5pEK+3A6xRcMI= 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.10 335/390] platform/x86: msi-laptop: Change DMI match / alias strings to fix module autoloading Date: Mon, 24 Oct 2022 13:32:12 +0200 Message-Id: <20221024113037.270449887@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585529378152319?= X-GMAIL-MSGID: =?utf-8?q?1747585529378152319?= 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: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: 9161 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457795wru; Mon, 24 Oct 2022 06:36:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5jUoJZEOSxNIFVPijbCAJhG4qxGa/reJa7yWSorNh81T2EH3RMF0AplGTohADriD8MLs56 X-Received: by 2002:a17:907:2c68:b0:78d:eac6:2d0d with SMTP id ib8-20020a1709072c6800b0078deac62d0dmr28257577ejc.55.1666618593196; Mon, 24 Oct 2022 06:36:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618593; cv=none; d=google.com; s=arc-20160816; b=F62eFXewZaL4taSpmwAAb2kVRdwe5aG5A76zupPqgBkIROFtKjNLLmhovUsMbjjGQb gm8ZCT8croFB8FYVlHJFW8QD83QPVLVJRgNk1UtTs1RHdKJN1nZPzTqB+vIUyEWq7wJo LhWzdDqZclMwdnPqjl0EFLoJ5VcDxmIu9BFkXYkWoogZpVEb2NpgdEclU1lTn23bCOBU sCMXbGThudF7Ue1ZmFDO/LcmQqGKHVuEfFNvGLtc5bHkRiwtd64s5quHPqybvJ6AvOKd dyvBkWlQ8Dy2BJky8GaCRcVzqS8vQnvoEW7MwuV9u5Yeyn0bT+YoXMRvNN45/2NFZMm7 zVcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LN0zsSC0xJw5mkSveoOLLJ8NRZxWU6v4uulO5oaad9g=; b=y39TchDz04A/zwn1KpH1sRJvNCvAQ+At3PxxQki2uFljXe1i039NvogGsYnd9/dwUT lim4sP0yTuAGZGJKljqUP6fG8fFJUgQP+Xo9gVS5G7tou5n7n6a6Jq/aLF/fqfMn7RWF rQXQjznTupCnMJOziCjriHMaTmTQVbZhBUmNTTPxuS2nY4/LN+koJQ8xGZBMNlY3wzSw wwzZI52COs1/5Zwz2oi0MW0Ly8S2TrOsLefd2LVfbT6pYAPr6fc7hnCk59PoZFUovb/P +B+te+Z8kllBO6Q+c8Xv6Cg1wrCUZ6QF45eL9qGN8bBDk7flC5msiNJlULPFAle8/wR+ MZYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AcVXltSR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d6-20020a50ea86000000b0045c3592301dsi25646131edo.191.2022.10.24.06.35.58; Mon, 24 Oct 2022 06:36: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=AcVXltSR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232537AbiJXN2K (ORCPT + 99 others); Mon, 24 Oct 2022 09:28:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236429AbiJXNZn (ORCPT ); Mon, 24 Oct 2022 09:25: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 EE9FA88DCE; Mon, 24 Oct 2022 05:31: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 DAE4261342; Mon, 24 Oct 2022 12:30:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7B3BC43143; Mon, 24 Oct 2022 12:30:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614636; bh=63049ETEStgnvN3LHZqBIKMkCgOEwpomPcHwDqtiUmI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AcVXltSRzXPgNqmZoyevOvUshYJtWsprpYs1C98NZJKhYcwIJ3tCuzzrqwK9sHyMX Am4ER/zHfKxGFMvEC/DQTRhWBKS3eTED4yMku7QAgyNTpOKM7031T7VhrmFKevEdep rKo3c81a701yEohWhcY8JGAv8nkGQmCSDfswd2xM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ranjani Sridharan , Chao Song , Curtis Malainey , Jairaj Arava , Curtis Malainey , Sathyanarayana Nujella , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 5.10 336/390] ASoC: SOF: pci: Change DMI match info to support all Chrome platforms Date: Mon, 24 Oct 2022 13:32:13 +0200 Message-Id: <20221024113037.317848440@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576258066114751?= X-GMAIL-MSGID: =?utf-8?q?1747576258066114751?= From: Jairaj Arava [ Upstream commit c1c1fc8103f794a10c5c15e3c17879caf4f42c8f ] In some Chrome platforms if OEM's use their own string as SYS_VENDOR than "Google", it leads to firmware load failure from intel/sof/community path. Hence, changing SYS_VENDOR to PRODUCT_FAMILY in which "Google" is used as common prefix and is supported in all Chrome platforms. Reviewed-by: Ranjani Sridharan Reviewed-by: Chao Song Reviewed-by: Curtis Malainey Signed-off-by: Jairaj Arava Signed-off-by: Curtis Malainey Signed-off-by: Sathyanarayana Nujella Signed-off-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20220919114429.42700-1-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/sof/sof-pci-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/sof/sof-pci-dev.c b/sound/soc/sof/sof-pci-dev.c index 75657a25dbc0..fe9feaab6a0a 100644 --- a/sound/soc/sof/sof-pci-dev.c +++ b/sound/soc/sof/sof-pci-dev.c @@ -75,7 +75,7 @@ static const struct dmi_system_id community_key_platforms[] = { { .ident = "Google Chromebooks", .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Google"), + DMI_MATCH(DMI_PRODUCT_FAMILY, "Google"), } }, {}, 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: 10013 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp618515wru; Mon, 24 Oct 2022 12:34:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6PrOMUBzXD+VuQlTkyytC3Z0U6/lzkVtBGaz0yYENGaKjY3yfYPFpJJLt1QgAQSVL7oPZL X-Received: by 2002:a17:90a:fab:b0:213:1431:86d0 with SMTP id 40-20020a17090a0fab00b00213143186d0mr6952567pjz.154.1666640049025; Mon, 24 Oct 2022 12:34:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640049; cv=none; d=google.com; s=arc-20160816; b=J1/5Od/3vmIVt4IlAF+HH4TWvQ5BtzpgN738WuuaAj4ILyRLpZPRtZxRfEH4ZeGODC icX0iMwCqmo31UzG3Ov5r3Yxd7rOU/Z5P/rbASRzR07N1aC6fy8jxGGE9t4sJSZKSofL KNOP0GpgMvMOyeM8AQHi+/OAub3a4o3tuTNzef3kweIizcgQ5aHRvaPYJfx64Xsx21X9 my3sujx9d/MLOBFhoh6j7wcLTdf+CB53E4Wr0TOHArhfWoRTov/9zARLgmPAGkB+7cnb +OlWNnZY2kah9KXIN99ggKOBlqsgIV/+hlABUYBnlHPsWHiQYnUwDX+OgW4IKf5rYF/7 pAPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ToENxg+GaELwG/rA5lKC/sdWSh1znNdo94CCQ0qXcHQ=; b=LxSgovaFx7EU8MaGKP51XOWDS1YAyLd4BB9BVzxk+8uIoNbUhfRfUYVvRBbj+CWwPN ck8wkLJ3HXTWl00kj1dQxBNJxqkoTnC8dSf9xokIAdWIsTi2x155cPy0J7NxKabilVFv s7XXPl6PH2ABbWauH2d3G9QzD6YsWbOujr88BwB9fIrLptMyIMxz0yxAF9umzaPOfD9P /SAXnA0Q101ssg5xAPjNxkZyAh4L0XYI+1LnQPyKPO8SLhluLbLs06hTD3ORfnctKMT4 OBg6wc9PsAKcTdCOrNZJ16C7VpAihHZRIZtOquSeOgYrmHe7lbsfxQFi0d359GkomF5p NAjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0ijuYElF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s64-20020a632c43000000b0046b1a7c6679si370433pgs.414.2022.10.24.12.33.56; Mon, 24 Oct 2022 12:34: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=0ijuYElF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232939AbiJXTdL (ORCPT + 99 others); Mon, 24 Oct 2022 15:33:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230006AbiJXTcu (ORCPT ); Mon, 24 Oct 2022 15:32: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 01601D73E5; Mon, 24 Oct 2022 11:03: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 54178B816AF; Mon, 24 Oct 2022 12:30:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EFBCC433D7; Mon, 24 Oct 2022 12:30:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614639; bh=Rb9Cpi+DHBOf+LtpoHqa9AhLp5UsfP7z+yEnGXy9dsk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0ijuYElF0bGi62adrIGP93RBmdI20x126a0i4nsXwOdJh7jsZLoNhqrhUkU1mK4n6 wL6DX0UHaG4dhmz0zqyDuwVV++Boif2cjMcVJdokRL6/3yb38pzh43E9w2++ngwqTJ VSw1qVzksC/bhUoVpFogguVz+fVIxtE29fDwKnAc= 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.10 337/390] drm/amdgpu: fix initial connector audio value Date: Mon, 24 Oct 2022 13:32:14 +0200 Message-Id: <20221024113037.353781579@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747598756142125741?= X-GMAIL-MSGID: =?utf-8?q?1747598756142125741?= 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 df1f9b88a53f..98d3661336a4 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c @@ -1671,10 +1671,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; @@ -1796,6 +1798,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, @@ -1849,6 +1852,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, @@ -1899,6 +1903,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:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9592 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp528940wru; Mon, 24 Oct 2022 09:02:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7PVnSziKdzImawFhwPIOivkvtst0w+M0hz/pGFMKeIejC3NAEBIB/MaCX3ukHdz8x4BB78 X-Received: by 2002:a17:90a:198a:b0:213:8a8:dbb with SMTP id 10-20020a17090a198a00b0021308a80dbbmr7806895pji.73.1666627375031; Mon, 24 Oct 2022 09:02:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627375; cv=none; d=google.com; s=arc-20160816; b=WeqM/sH594qcxvoQTnnIwAm9zt5m/xqfCKbWWGnvxlzAufj6m16jvtW7dTw/7qM8rw XlZRdLbp1LwjKa4Xkxd19HzTnz27T2gllG/SdWFqnLTeUSP/WcRgSoeiMCZ9Md4YI8kP UmpRcjgrWtES4iRhI3FA/uFTbGSWXHypWWFT9pKnfY94MBPFAlSRBT/1QH2ULrepPeec OIKZfhPo2ZFrTtP/TlMkDSg65mzC1abxuz7IX1NxUTCIKB354lB6dJDo6vZb0g261RMK 4pjpwxiAKxvmlyqHmRHgESMMwX5PJKu1OozfyqmBGAdN0q4GyVnvPL6L0jUBHVHzmZo7 AlOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CER6k+GyX9CvAbwOI8gq1GN3+SthRzzj4PcK0w8nemQ=; b=uzAHrM7gF56FgEC7Gqw2tV3sUCiUFj324VN7YJUsZ8GkS6fYL+SVLe7nkxQxoj5x1F ei0mctzuToxT4SbNHEmwtyLvXfYunhK53fdFpQUlRv3iL5yxD9HxGiz87ek+O3kPh9sI 1ivDfzs7XuZs1kanIr5BHi0/cLyxxOghAtJ1cRN8EG6iWksylfEoevF2ujUXqLNVhuVg uc32cSxD8iQUWLvEyZJTyeZjQEwkxTkuoA0/IpSvD3cpxrGiBj4auxzu0U02RI0QQQ83 a2WY9dP7tIqVKbDqwXna+dIeWoQX/bHE98S4c3hUy44Hi8+jhaN2jUnRcAmF0o8G46ft JTiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uXmLgEYn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b3-20020a056a000a8300b0052f60f7e0a1si91842pfl.5.2022.10.24.09.02.34; Mon, 24 Oct 2022 09:02: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=uXmLgEYn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232398AbiJXQBL (ORCPT + 99 others); Mon, 24 Oct 2022 12:01:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232599AbiJXP7K (ORCPT ); Mon, 24 Oct 2022 11:59:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF353140B3; Mon, 24 Oct 2022 07:54: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 00020B816C8; Mon, 24 Oct 2022 12:30:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49090C433D6; Mon, 24 Oct 2022 12:30:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614641; bh=0gWKJ9x//ROWJyMZlHURdDx24kxWE5ztqRDFVXlbxQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uXmLgEYn2bTFqE8J+vOPdK4XJczP2Cl85THCM2UAWiGBg3MamSOhk3MVxkvpeCR8m dOxWkygDij6jgEZ5kY0D9IRTCsd9nde1kI6Lxr6UGzQVmsMIkwpQCtpm7j92VbxalF rxrWS0UuUOUGsFmnQKbIuQ2oqOczLk38zS+/L6Yw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Adri=C3=A1n_Larumbe?= , Neil Armstrong , Sasha Levin Subject: [PATCH 5.10 338/390] drm/meson: explicitly remove aggregate driver at module unload time Date: Mon, 24 Oct 2022 13:32:15 +0200 Message-Id: <20221024113037.402130384@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585466215304574?= X-GMAIL-MSGID: =?utf-8?q?1747585466215304574?= From: Adrián Larumbe [ Upstream commit 8616f2a0589a80e08434212324250eb22f6a66ce ] Because component_master_del wasn't being called when unloading the meson_drm module, the aggregate device would linger forever in the global aggregate_devices list. That means when unloading and reloading the meson_dw_hdmi module, component_add would call into try_to_bring_up_aggregate_device and find the unbound meson_drm aggregate device. This would in turn dereference some of the aggregate_device's struct entries which point to memory automatically freed by the devres API when unbinding the aggregate device from meson_drv_unbind, and trigger an use-after-free bug: [ +0.000014] ============================================================= [ +0.000007] BUG: KASAN: use-after-free in find_components+0x468/0x500 [ +0.000017] Read of size 8 at addr ffff000006731688 by task modprobe/2536 [ +0.000018] CPU: 4 PID: 2536 Comm: modprobe Tainted: G C O 5.19.0-rc6-lrmbkasan+ #1 [ +0.000010] Hardware name: Hardkernel ODROID-N2Plus (DT) [ +0.000008] Call trace: [ +0.000005] dump_backtrace+0x1ec/0x280 [ +0.000011] show_stack+0x24/0x80 [ +0.000007] dump_stack_lvl+0x98/0xd4 [ +0.000010] print_address_description.constprop.0+0x80/0x520 [ +0.000011] print_report+0x128/0x260 [ +0.000007] kasan_report+0xb8/0xfc [ +0.000007] __asan_report_load8_noabort+0x3c/0x50 [ +0.000009] find_components+0x468/0x500 [ +0.000008] try_to_bring_up_aggregate_device+0x64/0x390 [ +0.000009] __component_add+0x1dc/0x49c [ +0.000009] component_add+0x20/0x30 [ +0.000008] meson_dw_hdmi_probe+0x28/0x34 [meson_dw_hdmi] [ +0.000013] platform_probe+0xd0/0x220 [ +0.000008] really_probe+0x3ac/0xa80 [ +0.000008] __driver_probe_device+0x1f8/0x400 [ +0.000008] driver_probe_device+0x68/0x1b0 [ +0.000008] __driver_attach+0x20c/0x480 [ +0.000009] bus_for_each_dev+0x114/0x1b0 [ +0.000007] driver_attach+0x48/0x64 [ +0.000009] bus_add_driver+0x390/0x564 [ +0.000007] driver_register+0x1a8/0x3e4 [ +0.000009] __platform_driver_register+0x6c/0x94 [ +0.000007] meson_dw_hdmi_platform_driver_init+0x30/0x1000 [meson_dw_hdmi] [ +0.000014] do_one_initcall+0xc4/0x2b0 [ +0.000008] do_init_module+0x154/0x570 [ +0.000010] load_module+0x1a78/0x1ea4 [ +0.000008] __do_sys_init_module+0x184/0x1cc [ +0.000008] __arm64_sys_init_module+0x78/0xb0 [ +0.000008] invoke_syscall+0x74/0x260 [ +0.000008] el0_svc_common.constprop.0+0xcc/0x260 [ +0.000009] do_el0_svc+0x50/0x70 [ +0.000008] el0_svc+0x68/0x1a0 [ +0.000009] el0t_64_sync_handler+0x11c/0x150 [ +0.000009] el0t_64_sync+0x18c/0x190 [ +0.000014] Allocated by task 902: [ +0.000007] kasan_save_stack+0x2c/0x5c [ +0.000009] __kasan_kmalloc+0x90/0xd0 [ +0.000007] __kmalloc_node+0x240/0x580 [ +0.000010] memcg_alloc_slab_cgroups+0xa4/0x1ac [ +0.000010] memcg_slab_post_alloc_hook+0xbc/0x4c0 [ +0.000008] kmem_cache_alloc_node+0x1d0/0x490 [ +0.000009] __alloc_skb+0x1d4/0x310 [ +0.000010] alloc_skb_with_frags+0x8c/0x620 [ +0.000008] sock_alloc_send_pskb+0x5ac/0x6d0 [ +0.000010] unix_dgram_sendmsg+0x2e0/0x12f0 [ +0.000010] sock_sendmsg+0xcc/0x110 [ +0.000007] sock_write_iter+0x1d0/0x304 [ +0.000008] new_sync_write+0x364/0x460 [ +0.000007] vfs_write+0x420/0x5ac [ +0.000008] ksys_write+0x19c/0x1f0 [ +0.000008] __arm64_sys_write+0x78/0xb0 [ +0.000007] invoke_syscall+0x74/0x260 [ +0.000008] el0_svc_common.constprop.0+0x1a8/0x260 [ +0.000009] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000008] el0t_64_sync_handler+0x11c/0x150 [ +0.000008] el0t_64_sync+0x18c/0x190 [ +0.000013] Freed by task 2509: [ +0.000008] kasan_save_stack+0x2c/0x5c [ +0.000007] kasan_set_track+0x2c/0x40 [ +0.000008] kasan_set_free_info+0x28/0x50 [ +0.000008] ____kasan_slab_free+0x128/0x1d4 [ +0.000008] __kasan_slab_free+0x18/0x24 [ +0.000007] slab_free_freelist_hook+0x108/0x230 [ +0.000010] kfree+0x110/0x35c [ +0.000008] release_nodes+0xf0/0x16c [ +0.000008] devres_release_all+0xfc/0x180 [ +0.000008] device_unbind_cleanup+0x24/0x164 [ +0.000008] device_release_driver_internal+0x3e8/0x5b0 [ +0.000010] driver_detach+0xac/0x1b0 [ +0.000008] bus_remove_driver+0x158/0x29c [ +0.000008] driver_unregister+0x70/0xb0 [ +0.000009] platform_driver_unregister+0x20/0x2c [ +0.000007] 0xffff800003722d98 [ +0.000012] __do_sys_delete_module+0x288/0x400 [ +0.000009] __arm64_sys_delete_module+0x5c/0x80 [ +0.000008] invoke_syscall+0x74/0x260 [ +0.000008] el0_svc_common.constprop.0+0xcc/0x260 [ +0.000008] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000008] el0t_64_sync_handler+0x11c/0x150 [ +0.000009] el0t_64_sync+0x18c/0x190 [ +0.000013] Last potentially related work creation: [ +0.000007] kasan_save_stack+0x2c/0x5c [ +0.000007] __kasan_record_aux_stack+0xb8/0xf0 [ +0.000009] kasan_record_aux_stack_noalloc+0x14/0x20 [ +0.000008] insert_work+0x54/0x290 [ +0.000009] __queue_work+0x48c/0xd24 [ +0.000008] queue_work_on+0x90/0x11c [ +0.000008] call_usermodehelper_exec+0x188/0x404 [ +0.000010] kobject_uevent_env+0x5a8/0x794 [ +0.000010] kobject_uevent+0x14/0x20 [ +0.000008] driver_register+0x230/0x3e4 [ +0.000009] __platform_driver_register+0x6c/0x94 [ +0.000007] gxbb_driver_init+0x28/0x34 [ +0.000010] do_one_initcall+0xc4/0x2b0 [ +0.000008] do_initcalls+0x20c/0x24c [ +0.000010] kernel_init_freeable+0x22c/0x278 [ +0.000009] kernel_init+0x3c/0x170 [ +0.000008] ret_from_fork+0x10/0x20 [ +0.000013] The buggy address belongs to the object at ffff000006731600 which belongs to the cache kmalloc-256 of size 256 [ +0.000009] The buggy address is located 136 bytes inside of 256-byte region [ffff000006731600, ffff000006731700) [ +0.000015] The buggy address belongs to the physical page: [ +0.000008] page:fffffc000019cc00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff000006730a00 pfn:0x6730 [ +0.000011] head:fffffc000019cc00 order:2 compound_mapcount:0 compound_pincount:0 [ +0.000008] flags: 0xffff00000010200(slab|head|node=0|zone=0|lastcpupid=0xffff) [ +0.000016] raw: 0ffff00000010200 fffffc00000c3d08 fffffc0000ef2b08 ffff000000002680 [ +0.000009] raw: ffff000006730a00 0000000000150014 00000001ffffffff 0000000000000000 [ +0.000006] page dumped because: kasan: bad access detected [ +0.000011] Memory state around the buggy address: [ +0.000007] ffff000006731580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ +0.000007] ffff000006731600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] >ffff000006731680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ^ [ +0.000006] ffff000006731700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ +0.000007] ffff000006731780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ +0.000006] ================================================================== Fix by adding 'remove' driver callback for meson-drm, and explicitly deleting the aggregate device. Signed-off-by: Adrián Larumbe Reviewed-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20220919010940.419893-3-adrian.larumbe@collabora.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/meson/meson_drv.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c index 2d022f3fb437..b0bfe85f5f6a 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c @@ -528,6 +528,13 @@ static int meson_drv_probe(struct platform_device *pdev) return 0; }; +static int meson_drv_remove(struct platform_device *pdev) +{ + component_master_del(&pdev->dev, &meson_drv_master_ops); + + return 0; +} + static struct meson_drm_match_data meson_drm_gxbb_data = { .compat = VPU_COMPATIBLE_GXBB, }; @@ -565,6 +572,7 @@ static const struct dev_pm_ops meson_drv_pm_ops = { static struct platform_driver meson_drm_platform_driver = { .probe = meson_drv_probe, + .remove = meson_drv_remove, .shutdown = meson_drv_shutdown, .driver = { .name = "meson-drm", From patchwork 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: 10046 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp622776wru; Mon, 24 Oct 2022 12:46:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4qXIZrZStK9vlcueUwzEkJ1djX88cjMhZslSigJxRZ5BDaAdZXfsc6gWp6Ie0uVNgP1EX5 X-Received: by 2002:a17:902:c405:b0:181:83e4:490e with SMTP id k5-20020a170902c40500b0018183e4490emr34358173plk.4.1666640789028; Mon, 24 Oct 2022 12:46:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640789; cv=none; d=google.com; s=arc-20160816; b=Bo46aKVm85Dj1+SG5VIaCWmllrszIktH4zMNz2XyWBBCeuZgZJtII/ZMYnbGHVi5mt SCIL7YIXvffKq6LrYDDetIVynh9GJTlLvRt8aCt+l+ssQNDl3PpQ0/8NzMoXkAhUt5h/ eLxevqNu7NIxpI4C50aBmCW5/DiPcOJtRhx0dYFcFR1x43mW0tWJO7gXStF+Z9qStaEQ O2hJgBLWLtfjX8GlXh8LzYBFdv3lwYWjTU2qlCOLtLKQU2oOGnNSSCb94VEkc6S7U67x oI9cWLPGfym9xwxQeSqCDPoqgm/zj+KyXKwx3bfDl4AbkoQt1awQY97VwlvGo4TJz91H bo0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=E2pD4RVo1bGGzjVZQsTmoLtusCLLRSkz1Xwl67Af8s8=; b=gcedZZjOHygY6tLzhIUutyHjyEd2+gTBY+ZqaGqI8BKETiu+4Qnq31D1jaB2XpndVW vI0Ul0Ss+V2UQRHhjLNbUOyFGOrDp6IqO+duSkLIWbhlRvfWudvjBFywPYkx7Pp3sTy0 tDEmAxhRQRVMEAP+mLH+FUjKJVGyh1/cept2+KN0bHPxmr3L0CGX4wcu89yGSHeS12fD WG33BFNe9/cf82d8n9MtrPHzFTCfDGciCcBzar6W9L99YXs9U3kK62QjY7JFNECIWy+B Q+PbU3rNhdQmf4UudUNCw/tI19AHTyZ7U+TYsqxyT+Ixv5wRARwXhwB+5OgENU2uMJR7 oc+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b+91PZ3F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z3-20020a655a43000000b0043bd8458031si409433pgs.435.2022.10.24.12.46.08; Mon, 24 Oct 2022 12:46:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b+91PZ3F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231605AbiJXTmp (ORCPT + 99 others); Mon, 24 Oct 2022 15:42:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233475AbiJXTla (ORCPT ); Mon, 24 Oct 2022 15:41:30 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7062E263B69; Mon, 24 Oct 2022 11:11: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 sin.source.kernel.org (Postfix) with ESMTPS id CE2FECE12E6; Mon, 24 Oct 2022 12:30:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBB85C433D6; Mon, 24 Oct 2022 12:30:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614644; bh=mUdPkcinbaaDmr2EIH5eTUOcBG9ba61MG0Xo4Gj1jWg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b+91PZ3FGNIQscWh30z8uC1xAq2naUGF5Ag4eSlQkIdjEAqA0Fcv45Ga5r6hsft2o jZCMEitJWtrPOFYxb9ojXQGSHCbL5/84MfWMefmcoiT3tMlED6uD/+OXVhpFVFsIHQ pnFsTrVaeQswqkHiQk5v4UP0Pd/cegg+pGPbqlqo= 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.10 339/390] mmc: sdhci-msm: add compatible string check for sdm670 Date: Mon, 24 Oct 2022 13:32:16 +0200 Message-Id: <20221024113037.444908281@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599532364599129?= X-GMAIL-MSGID: =?utf-8?q?1747599532364599129?= 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 192cb8b20b47..ad2e73f9a58f 100644 --- a/drivers/mmc/host/sdhci-msm.c +++ b/drivers/mmc/host/sdhci-msm.c @@ -2182,6 +2182,7 @@ static const struct sdhci_msm_variant_info sm8250_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}, {.compatible = "qcom,sm8250-sdhci", .data = &sm8250_sdhci_var}, {.compatible = "qcom,sc7180-sdhci", .data = &sdm845_sdhci_var}, 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: 9600 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp529575wru; Mon, 24 Oct 2022 09:03:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ykVlargwOvkj8q0U7Nk6NyYaeo/TXT7MS0b1UX9PZEo8i9ew+oa+P/bIqXuMMTC7nazYe X-Received: by 2002:a17:90a:aa91:b0:212:f865:4f0d with SMTP id l17-20020a17090aaa9100b00212f8654f0dmr10374775pjq.90.1666627429417; Mon, 24 Oct 2022 09:03:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627429; cv=none; d=google.com; s=arc-20160816; b=SL4SKMIqdAd1e5D4iHf3TBcxJuU8qdPafgC4y8Nx3mKa3kjwtSAUEtfDkfgE8/WvLI QTddaGTQaUpc5efOM4X2WyjY9Rgv+YeMYIF3JNT/hTLeVpRtD7ot9cTKzojf7Qrwx9t7 9KZgSJc0r46lrQ89ZZaMDja230ZE+Nr3Ap0REJlbAar4FJRFMu0iU60baM3/xg6C2KHs M47v2i4xQJzDfAlrkiSQsuXGqgeaBDZFAkB9jJPWEGyl3jZyr6K1+nH1uZ5OJxV6ilei /z7RcHgPxDj2do5l1pP8SO0XiADCQduV2r+gL8nNXmMmSeweKrHfuOqPC+RsnjhwD4FT nMjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ridJDXsywHk6tYhjPLCa06mpbI7ZxbRWWsJr7zQQc9w=; b=x4sjBblwox7fyRrncDjsUkGjJGOVVuJLe5BlPIETUzGqnxkTgkJD+ESWJfsmFmdNkv fWpocKHloIj9oL2QWHtT8aG7DR/blEBErxA9rcNhLruYbhfcTYPLMYOrom9/Zh95QK5h w3E2eAAV7YJsnxgxg50GcwXs41cutMX52dEb8VAezI8lg0aFngqfmuShFPGo67HJvNrW VPytbiUQj7tHZUpdKyxvivpauTcAbjGzuEzqPoOOCQCYfN5Z7PgqvjL77lwRk3Ks2Dzk 4IgErLEy7pvaj9DFMI0YzrJ9vTcVLbdMrwI/rOhHNHmSFC45BklpEwIhZQu+bLRaGtBP sDXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DOAtLH73; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a630002000000b00455d13a2a6dsi33872663pga.571.2022.10.24.09.03.30; Mon, 24 Oct 2022 09:03: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=DOAtLH73; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230474AbiJXP7w (ORCPT + 99 others); Mon, 24 Oct 2022 11:59:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232191AbiJXP6j (ORCPT ); Mon, 24 Oct 2022 11:58: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 4292416DC33; Mon, 24 Oct 2022 07:53: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 1B71BB816A7; Mon, 24 Oct 2022 12:30:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BA85C433C1; Mon, 24 Oct 2022 12:30:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614646; bh=BdfJixTWVY9uxH5Y7CFWtnrm9ZR7+RkdkXJtLPFhc3E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DOAtLH73oruFBpjhY3vIp4/A3Pf2g+XNZneA68uYL5IlyWG/zoo92cihV/FeJ8Puy 9D9Y+ssakCl4e/MlnSdZuVaYi6f56tm1H20C1IC7ObUOkf/+flnT4lkI+Fa6jKELk1 Xd7m6ihtTCkX/nG14S4U9my9MnMQ5BwigHvXY3Os= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Imre Deak , Jani Nikula , Or Cochvi , Khaled Almahallawy , Sasha Levin Subject: [PATCH 5.10 340/390] drm/dp: Dont rewrite link config when setting phy test pattern Date: Mon, 24 Oct 2022 13:32:17 +0200 Message-Id: <20221024113037.479901737@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585523456967799?= X-GMAIL-MSGID: =?utf-8?q?1747585523456967799?= From: Khaled Almahallawy [ Upstream commit 7b4d8db657192066bc6f1f6635d348413dac1e18 ] The sequence for Source DP PHY CTS automation is [2][1]: 1- Emulate successful Link Training(LT) 2- Short HPD and change link rates and number of lanes by LT. (This is same flow for Link Layer CTS) 3- Short HPD and change PHY test pattern and swing/pre-emphasis levels (This step should not trigger LT) The problem is with DP PHY compliance setup as follow: [DPTX + on board LTTPR]------Main Link--->[Scope] ^ | | | | | ----------Aux Ch------>[Aux Emulator] At step 3, before writing TRAINING_LANEx_SET/LINK_QUAL_PATTERN_SET to declare the pattern/swing requested by scope, we write link config in LINK_BW_SET/LANE_COUNT_SET on a port that has LTTPR. As LTTPR snoops aux transaction, LINK_BW_SET/LANE_COUNT_SET writes indicate a LT will start [Check DP 2.0 E11 -Sec 3.6.8.2 & 3.6.8.6.3], and LTTPR will reset the link and stop sending DP signals to DPTX/Scope causing the measurements to fail. Note that step 3 will not trigger LT and DP link will never recovered by the Aux Emulator/Scope. The reset of link can be tested with a monitor connected to LTTPR port simply by writing to LINK_BW_SET or LANE_COUNT_SET as follow igt/tools/dpcd_reg write --offset=0x100 --value 0x14 --device=2 OR printf '\x14' | sudo dd of=/dev/drm_dp_aux2 bs=1 count=1 conv=notrunc seek=$((0x100)) This single aux write causes the screen to blank, sending short HPD to DPTX, setting LINK_STATUS_UPDATE = 1 in DPCD 0x204, and triggering LT. As stated in [1]: "Before any TX electrical testing can be performed, the link between a DPTX and DPRX (in this case, a piece of test equipment), including all LTTPRs within the path, shall be trained as defined in this Standard." In addition, changing Phy pattern/Swing/Pre-emphasis (Step 3) uses the same link rate and lane count applied on step 2, so no need to redo LT. The fix is to not rewrite link config in step 3, and just writes TRAINING_LANEx_SET and LINK_QUAL_PATTERN_SET [1]: DP 2.0 E11 - 3.6.11.1 LTTPR DPTX_PHY Electrical Compliance [2]: Configuring UnigrafDPTC Controller - Automation Test Sequence https://www.keysight.com/us/en/assets/9922-01244/help-files/ D9040DPPC-DisplayPort-Test-Software-Online-Help-latest.chm Cc: Imre Deak Cc: Jani Nikula Cc: Or Cochvi Signed-off-by: Khaled Almahallawy Signed-off-by: Jani Nikula Link: https://patchwork.freedesktop.org/patch/msgid/20220916054900.415804-1-khaled.almahallawy@intel.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/drm_dp_helper.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index 3c55753bab16..6ba16db77500 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -2172,17 +2172,8 @@ int drm_dp_set_phy_test_pattern(struct drm_dp_aux *aux, struct drm_dp_phy_test_params *data, u8 dp_rev) { int err, i; - u8 link_config[2]; u8 test_pattern; - link_config[0] = drm_dp_link_rate_to_bw_code(data->link_rate); - link_config[1] = data->num_lanes; - if (data->enhanced_frame_cap) - link_config[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN; - err = drm_dp_dpcd_write(aux, DP_LINK_BW_SET, link_config, 2); - if (err < 0) - return err; - test_pattern = data->phy_pattern; if (dp_rev < 0x12) { test_pattern = (test_pattern << 2) & From patchwork 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: 9147 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457616wru; Mon, 24 Oct 2022 06:36:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM40DkCSHmaBviK+OkrGzILsiVVXBiBA3L7BnItePQJB1aFLqtBYuiVF0+9T90VG92RYwISJ X-Received: by 2002:a17:90b:390c:b0:20d:a662:dac2 with SMTP id ob12-20020a17090b390c00b0020da662dac2mr66687212pjb.5.1666618576975; Mon, 24 Oct 2022 06:36:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618576; cv=none; d=google.com; s=arc-20160816; b=jBiCRvKk20xdmB+Vl8Xu0qg5HUlV59bHMO58cZsFg3X7mePil8McrUDaX/zy19bi0F AwYp22GecgK+XtC5oumD/HbfY0ofC0dvypth4/OPXCi4pLKvPfcpmdQFTOjK7dklP4K1 c43SLlex/2+10EPiVJ4F5Jny5C5kKgTemhmJEXa67Df3lhWE/uujPjcLrSH/3BEj3vNT g9uS/+GvHYDECbAfVoTT1FlTqegzjvBiqo/p1PhuYOl0cF8rKIclivfloDHZEgV7R1A1 B22hnUHDQdl/Y7Cs3D4MAeVtha+ulHpjcdOFh4RPLBEPA66020Bg3iiE3+GlpSHHxEvs q6pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zao/Z0PvPjfJWFhqRGUigyEtBbbbVzGehTWXWL2XF9A=; b=lDNzl0Xo5W3xpUak1paOEYcnmaHYLQWVtQ2GVkH7G1sYoaBITIpbREtRWHz0iJert7 2dNY7G3/BnTR0SYqAAsiL5mMlWPDtMOlkIH3PLb3D0JzJILYdh565jTTUQdEaaYp7Ldu pjQFdHRyfwx3wuGSDpCBoMR/RP1Ii7qFWt69vDAfYWAc8qWQVNlH7ixup+8UPOxN+os/ FYtF2XeksYG0jT7aT7lx75Syit3A62+mLRJzld71/QB2VgUqnRdeDEb3lN7cvzjxYGSu MrQv7JIjSv8Fh35gCp61zqVUd+AUHawlTH5Fq1bNgXhzG5ekBSPMwCnGx5DF1M4/VGZ8 Mjbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QJn55OA5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h71-20020a636c4a000000b0045190ea3f14si33814473pgc.471.2022.10.24.06.35.57; Mon, 24 Oct 2022 06:36:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QJn55OA5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235922AbiJXN1y (ORCPT + 99 others); Mon, 24 Oct 2022 09:27:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236366AbiJXNZc (ORCPT ); Mon, 24 Oct 2022 09:25:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEB2D88DFF; Mon, 24 Oct 2022 05:31: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 0FEA4612B3; Mon, 24 Oct 2022 12:30:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1DB19C433D6; Mon, 24 Oct 2022 12:30:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614649; bh=0Rj5oDI/zVqSP4IONDE510+rQzQ6XHEWox2i8JUDLcc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QJn55OA5ZJ2BAv5szXjRI1CVL6dmOuqMvQ3R9i7jnutLMpkaded6+wxw/994Ymrij DfDU1BSmgdb5P46IIAI4QmIcxZFg/WeqMg0HfxbntzDHmDs6DlEhsP1KjobDtVF/j4 yT+q7sr/NQV9oA7nNfcgfj+XlkAzn+TBJhJNbarM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jaehyun Chung , Jasdeep Dhillon , Aric Cyr , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 5.10 341/390] drm/amd/display: Remove interface for periodic interrupt 1 Date: Mon, 24 Oct 2022 13:32:18 +0200 Message-Id: <20221024113037.525868052@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576241032022621?= X-GMAIL-MSGID: =?utf-8?q?1747576241032022621?= From: Aric Cyr [ Upstream commit 97d8d6f075bd8f988589be02b91f6fa644d0b0b8 ] [why] Only a single VLINE interrupt is available so interface should not expose the second one which is used by DMU firmware. [how] Remove references to periodic_interrupt1 and VLINE1 from DC interfaces. Reviewed-by: Jaehyun Chung Acked-by: Jasdeep Dhillon Signed-off-by: Aric Cyr Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/core/dc.c | 16 +++------ drivers/gpu/drm/amd/display/dc/dc_stream.h | 6 ++-- .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 35 ++++++------------- .../amd/display/dc/dcn10/dcn10_hw_sequencer.h | 3 +- .../gpu/drm/amd/display/dc/inc/hw_sequencer.h | 8 +---- 5 files changed, 18 insertions(+), 50 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c index 93f5229c303e..99887bcfada0 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -2202,11 +2202,8 @@ static void copy_stream_update_to_stream(struct dc *dc, if (update->abm_level) stream->abm_level = *update->abm_level; - if (update->periodic_interrupt0) - stream->periodic_interrupt0 = *update->periodic_interrupt0; - - if (update->periodic_interrupt1) - stream->periodic_interrupt1 = *update->periodic_interrupt1; + if (update->periodic_interrupt) + stream->periodic_interrupt = *update->periodic_interrupt; if (update->gamut_remap) stream->gamut_remap_matrix = *update->gamut_remap; @@ -2288,13 +2285,8 @@ static void commit_planes_do_stream_update(struct dc *dc, if (!pipe_ctx->top_pipe && !pipe_ctx->prev_odm_pipe && pipe_ctx->stream == stream) { - if (stream_update->periodic_interrupt0 && - dc->hwss.setup_periodic_interrupt) - dc->hwss.setup_periodic_interrupt(dc, pipe_ctx, VLINE0); - - if (stream_update->periodic_interrupt1 && - dc->hwss.setup_periodic_interrupt) - dc->hwss.setup_periodic_interrupt(dc, pipe_ctx, VLINE1); + if (stream_update->periodic_interrupt && dc->hwss.setup_periodic_interrupt) + dc->hwss.setup_periodic_interrupt(dc, pipe_ctx); if ((stream_update->hdr_static_metadata && !stream->use_dynamic_meta) || stream_update->vrr_infopacket || diff --git a/drivers/gpu/drm/amd/display/dc/dc_stream.h b/drivers/gpu/drm/amd/display/dc/dc_stream.h index 205bedd1b196..0487c1b8957c 100644 --- a/drivers/gpu/drm/amd/display/dc/dc_stream.h +++ b/drivers/gpu/drm/amd/display/dc/dc_stream.h @@ -179,8 +179,7 @@ struct dc_stream_state { /* DMCU info */ unsigned int abm_level; - struct periodic_interrupt_config periodic_interrupt0; - struct periodic_interrupt_config periodic_interrupt1; + struct periodic_interrupt_config periodic_interrupt; /* from core_stream struct */ struct dc_context *ctx; @@ -244,8 +243,7 @@ struct dc_stream_update { struct dc_info_packet *hdr_static_metadata; unsigned int *abm_level; - struct periodic_interrupt_config *periodic_interrupt0; - struct periodic_interrupt_config *periodic_interrupt1; + struct periodic_interrupt_config *periodic_interrupt; struct dc_info_packet *vrr_infopacket; struct dc_info_packet *vsc_infopacket; diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c index 31a13daf4289..71a85c5306ed 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c @@ -3611,7 +3611,7 @@ void dcn10_calc_vupdate_position( { const struct dc_crtc_timing *dc_crtc_timing = &pipe_ctx->stream->timing; int vline_int_offset_from_vupdate = - pipe_ctx->stream->periodic_interrupt0.lines_offset; + pipe_ctx->stream->periodic_interrupt.lines_offset; int vupdate_offset_from_vsync = dc->hwss.get_vupdate_offset_from_vsync(pipe_ctx); int start_position; @@ -3636,18 +3636,10 @@ void dcn10_calc_vupdate_position( static void dcn10_cal_vline_position( struct dc *dc, struct pipe_ctx *pipe_ctx, - enum vline_select vline, uint32_t *start_line, uint32_t *end_line) { - enum vertical_interrupt_ref_point ref_point = INVALID_POINT; - - if (vline == VLINE0) - ref_point = pipe_ctx->stream->periodic_interrupt0.ref_point; - else if (vline == VLINE1) - ref_point = pipe_ctx->stream->periodic_interrupt1.ref_point; - - switch (ref_point) { + switch (pipe_ctx->stream->periodic_interrupt.ref_point) { case START_V_UPDATE: dcn10_calc_vupdate_position( dc, @@ -3656,7 +3648,9 @@ static void dcn10_cal_vline_position( end_line); break; case START_V_SYNC: - // Suppose to do nothing because vsync is 0; + // vsync is line 0 so start_line is just the requested line offset + *start_line = pipe_ctx->stream->periodic_interrupt.lines_offset; + *end_line = *start_line + 2; break; default: ASSERT(0); @@ -3666,24 +3660,15 @@ static void dcn10_cal_vline_position( void dcn10_setup_periodic_interrupt( struct dc *dc, - struct pipe_ctx *pipe_ctx, - enum vline_select vline) + struct pipe_ctx *pipe_ctx) { struct timing_generator *tg = pipe_ctx->stream_res.tg; + uint32_t start_line = 0; + uint32_t end_line = 0; - if (vline == VLINE0) { - uint32_t start_line = 0; - uint32_t end_line = 0; + dcn10_cal_vline_position(dc, pipe_ctx, &start_line, &end_line); - dcn10_cal_vline_position(dc, pipe_ctx, vline, &start_line, &end_line); - - tg->funcs->setup_vertical_interrupt0(tg, start_line, end_line); - - } else if (vline == VLINE1) { - pipe_ctx->stream_res.tg->funcs->setup_vertical_interrupt1( - tg, - pipe_ctx->stream->periodic_interrupt1.lines_offset); - } + tg->funcs->setup_vertical_interrupt0(tg, start_line, end_line); } void dcn10_setup_vupdate_interrupt(struct dc *dc, struct pipe_ctx *pipe_ctx) diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h index e5691e499023..81b5057d5ff1 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h @@ -174,8 +174,7 @@ void dcn10_set_cursor_attribute(struct pipe_ctx *pipe_ctx); void dcn10_set_cursor_sdr_white_level(struct pipe_ctx *pipe_ctx); void dcn10_setup_periodic_interrupt( struct dc *dc, - struct pipe_ctx *pipe_ctx, - enum vline_select vline); + struct pipe_ctx *pipe_ctx); enum dc_status dcn10_set_clock(struct dc *dc, enum dc_clock_type clock_type, uint32_t clk_khz, diff --git a/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h b/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h index 64c1be818b0e..3165a66c5362 100644 --- a/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +++ b/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h @@ -32,11 +32,6 @@ #include "inc/hw/link_encoder.h" #include "core_status.h" -enum vline_select { - VLINE0, - VLINE1 -}; - struct pipe_ctx; struct dc_state; struct dc_stream_status; @@ -112,8 +107,7 @@ struct hw_sequencer_funcs { int group_index, int group_size, struct pipe_ctx *grouped_pipes[]); void (*setup_periodic_interrupt)(struct dc *dc, - struct pipe_ctx *pipe_ctx, - enum vline_select vline); + struct pipe_ctx *pipe_ctx); void (*set_drr)(struct pipe_ctx **pipe_ctx, int num_pipes, unsigned int vmin, unsigned int vmax, unsigned int vmid, unsigned int vmid_frame_number); 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: 10296 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp654232wru; Mon, 24 Oct 2022 14:11:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6TvG7S6IYjZ3vb3meC6lKMYNqxQ5z12wywqu/cqF47APQNMtn7mHcE+Tu7K/8oeL4Yb8E3 X-Received: by 2002:a17:90a:d588:b0:202:aa2d:1022 with SMTP id v8-20020a17090ad58800b00202aa2d1022mr76860921pju.31.1666645906554; Mon, 24 Oct 2022 14:11:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666645906; cv=none; d=google.com; s=arc-20160816; b=jbv9+PkDNoPKXsO155uJtVy7pHDA4Tix6g2OpSto4TLw/0NROy7sRKP17u4Vg9JJ5V T3elZqKoTc3aHWurVJUmyDeaK7t+f6lLGYKe7AZCVhAL/CNHivXTYkwqFmISoakH4RSb 9achTxMSxB+Yfpt69CG5qwvopKR7+QhSOpNKgIVzLtI+ETKXmlg7rzYBshX5Cr30RPpK Xrk2KEOIydK9vRp9b7V5yd0Sy+sI0RW+DmdQZm0knrNUbmcYkSN8GRAWBaF4JN25hxxX jRFfdg4wlil0UngD1I/oqCt6oq8bbfz9z+K06cSRlijBPFTQAu/absyGlpBe2ZY5gglO /wyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dPum1CgfahmUkjkw1ckkYoH6V3rIVWXAr632t7/30Kk=; b=0F+ffJvC3qeosMimpdw8OOjgfqaOuq+Nh2ZIvSo7MXHxMx+O5PCxpG4R6uCasNUcDo 6AHwRBzVhIFCoQWOBI1pT98bHSfLnO9MC5/G6MUb0+SiiNe6lwo9XO9+MHYI+u1jCuXf HdgvFA+MmTeT2fO2teoKRjwcjDlccm92lM1vrDnYyNVtuDIhquS4kJimMN7ebZ/X+qrm Jh1bzyGb9LFUFcpWPbhHeiIp0KcMW9ZPTuQoZQyUu1/w/j+8v+cgOOuv0g5rZY0nDFv7 17WghWyRlSh3VO3SWlaJiFCKrvYV+ZyulVRwHjCA0uilfxnKEqgva4DYNbqC1bw+vS8J RXAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yaC5C5vb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h20-20020a056a001a5400b005644806915csi968880pfv.42.2022.10.24.14.11.33; Mon, 24 Oct 2022 14:11: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=yaC5C5vb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233722AbiJXVCL (ORCPT + 99 others); Mon, 24 Oct 2022 17:02:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232118AbiJXVBl (ORCPT ); Mon, 24 Oct 2022 17:01: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 9D410CBFF6; Mon, 24 Oct 2022 12:07: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 5DB25B816AC; Mon, 24 Oct 2022 12:30:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEE05C433D6; Mon, 24 Oct 2022 12:30:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614652; bh=VGwng5KoEppwx8R2sr4fCGRsT/D50Q6HJ4MaAt6yWvo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yaC5C5vbUrVzW4z03ukfOjn4AbLs71f6gT/r7BtYZgA3QCLtx5vUDaNQyGrhxpj/z qXTR6T3vjtzHbab72NzK7A/vkDPuYWImyw5Eb7QBeyhXf7plWty2MaiBN7YMkoVKmI jipb61TC0dK//poe8yvbwGgyrEJ8w0U3h2T6aqW4= 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.10 342/390] ARM: dts: imx7d-sdb: config the max pressure for tsc2046 Date: Mon, 24 Oct 2022 13:32:19 +0200 Message-Id: <20221024113037.556163653@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747604898223269332?= X-GMAIL-MSGID: =?utf-8?q?1747604898223269332?= 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 6823b9f1a2a3..6d562ebe9029 100644 --- a/arch/arm/boot/dts/imx7d-sdb.dts +++ b/arch/arm/boot/dts/imx7d-sdb.dts @@ -199,12 +199,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: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: 9165 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457880wru; Mon, 24 Oct 2022 06:36:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Z6KBClwSUjPledjYa2a7TgcAB8YKPbjQ2HL0OiwdZh/oDJzCD3ZJCIHAx0JxRyzK9wce/ X-Received: by 2002:a17:907:a073:b0:78d:51c4:5b8c with SMTP id ia19-20020a170907a07300b0078d51c45b8cmr27001597ejc.355.1666618600399; Mon, 24 Oct 2022 06:36:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618600; cv=none; d=google.com; s=arc-20160816; b=z6aWCvn6ozLQAPmpPUGtIIgytVaemBuooGM0fjRToSIT05hQLpaCZJ4R02DjflK90E rUE4KaMbTlxgva+/9tN5oI7lMgxbDVnr3a5QjiSzBHcmwg/mRi9uR6fbFeiv/OPXazWc rFc+nT1Jv70h+sYx9BG2NVjEl3Gs0ynEa32ugURfV7fb6U3lcI/EmSVCKtfwXR/ZAdcQ bBeSLyNl1ACi8032Frfs59AQ2PBzWECp5vdv76MOr3YVSc5xf+Ww/2Z0ADUMbG9ZU/7C E04DATUjDsGvQLf4lHxSope6MEnd/jwAUAowaiIMlntNvo9HIh2ojDJyN8cxvBKuikIH bPew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=r6Lzpn63kvcjkm75+OlsZqf5eJRfCjMth0z03ZQhQI4=; b=I9TX0ORlh2ona14vgbRUOc6KjFQeP/IQ0pp3sNs4dZj/JYC/nsY464TjbgmKi2WsLI KWJI/1Qddk6KgcCfm6pM9yZgbLdZCg9TO8KHWQDuAH4gMdJxMhOhKDLo8IeuSsH5NIwZ Yqb8E7LwgPOUwgKK/9sHJMflJuQiVAoA+rZCq/irA33zQPtYFUD6CzRqoJRWbtxcK69D qwUJb7bdrBBg4f2Q7/RbhKQFpA2T79oJesbik7hqqJq7t8kA2k8mRObBt79UvJLjjN/b kv0Q5iS+GS3BpmpaIo0SHH1l6IPKnUDIUKuIjvEl/SBvsDDZGif6C1UNjKa/T36PqKfc JzIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=irUdgLNk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090639d300b0076ed46e4440si7143555eje.636.2022.10.24.06.35.57; Mon, 24 Oct 2022 06:36:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=irUdgLNk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231881AbiJXN1u (ORCPT + 99 others); Mon, 24 Oct 2022 09:27:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236330AbiJXNZK (ORCPT ); Mon, 24 Oct 2022 09:25:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8F28A87AB; Mon, 24 Oct 2022 05:31: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 403FB6130D; Mon, 24 Oct 2022 12:30:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52273C433D7; Mon, 24 Oct 2022 12:30:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614654; bh=ESBlktG6PmlJe5kVaKRkcjiBK0TRHMnkGcZgp4o3+AI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=irUdgLNkMEfI2w040eP1DERi3vkMNApEiBVLsPPaX/lrHaeAQPwuICOxkAupcnxI9 2Qr9QrFDyQMjJ8zREvkLkd4VjEgROlZF9gscUP95JBJL3i6aSjyCZw9drB60efH7CS s6Cw+bLDYD3VDhigUepUdb44rBDjzBB188qnvTmM= 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.10 343/390] ARM: dts: imx6q: add missing properties for sram Date: Mon, 24 Oct 2022 13:32:20 +0200 Message-Id: <20221024113037.595675195@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576265538147302?= X-GMAIL-MSGID: =?utf-8?q?1747576265538147302?= 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 5277e3903291..afec1677e6ba 100644 --- a/arch/arm/boot/dts/imx6q.dtsi +++ b/arch/arm/boot/dts/imx6q.dtsi @@ -163,6 +163,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x40000>; + ranges = <0 0x00900000 0x40000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; From patchwork 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: 9148 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457635wru; Mon, 24 Oct 2022 06:36:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7U2wq8pvn3LEQAdekLAiPVMVzGufUi5ZYuG0/EiXBXeF0hXqYXakglxjcDOK9udxpN6IHk X-Received: by 2002:a17:90b:4c42:b0:20d:7820:2e4e with SMTP id np2-20020a17090b4c4200b0020d78202e4emr74301325pjb.40.1666618578190; Mon, 24 Oct 2022 06:36:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618578; cv=none; d=google.com; s=arc-20160816; b=mcDOV3cMeMeNxyW2OJenSCSfkFGqm53i/5nrf2g2uZg7rN02HntE3BK8k4SKYoNigF qfMG/0X/uHrIzrgBPS6CmsHLeu5eTyHXsCXLIh0KY4e31fC0YAENJzJ8iCzPaR1eqNr1 gnJ8z57udFxyX/KlX11iOV3ScvkJyFWuYG3bebmX3gWFTOOKN/oniUAmtk1h8l0U+xTA 3QRWGO5QM044V0puBigfBCwrz2cdxfRdZz7dXaF6SiZ81/knhGur6YGotJ3WNj3ODfFN IF5cm99pQccgDNv1/eLo7w1lgQRdFrrXGjS7tV1gzXdDEafSJZt3dTolY3v3Me+2SGjt pjkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7nzlRDQQs4xMcjeVuIzRa9t5sck3BV27cgI5ew6IoQs=; b=rHjJZCLYQlEYcynzfjvyKTNwow4U4tKZWbOXMko0XaoyxDKLog8T2RTFJ2lF5ahNu6 g5rNUHCoYkRtZStByNiU7oSlZjN+i8II9LOxyf8OABl9vDL8nj8soG5wqwEzQOPrWGQW Pwt/Jftiyo+vLO8e5v+8DyiXcq67mcxLyakS0G8kcqHs9Hbte8fPJ32qe6tL5RJcWSXY 7wTTfoYVJEA2fmhnAiBLtTjErGdK19/TISqh/kzU/5IR/GGo3rLb8okC6sum/izs3TCw +7/Rrn6XGeoOnjjfyVPpWOU/XMGNVC/aNrWEEeppHrjl58Rm/rhJz49ggrk7uIp9KuH9 7RYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OhyR1A6D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b199-20020a621bd0000000b0056171a19036si32097595pfb.312.2022.10.24.06.35.57; Mon, 24 Oct 2022 06:36:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OhyR1A6D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235943AbiJXN2T (ORCPT + 99 others); Mon, 24 Oct 2022 09:28:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231731AbiJXNZz (ORCPT ); Mon, 24 Oct 2022 09:25: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 7C31CA8CFE; Mon, 24 Oct 2022 05:31: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 77A7D61313; Mon, 24 Oct 2022 12:31:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D81AC433C1; Mon, 24 Oct 2022 12:30:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614659; bh=iKZ/2Bz6UW9cY4lla+MqAFAxTOi1scQ+KSJMNOOVpDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OhyR1A6DBhDzArwvR4fVPfqKZsEk03BHVzDs1/JRQI8ozP5zFYFfTZp5MA5PgFm3J G2ueVNIQON0h2RDsHTQ+3Xhp272A+urQLfyXHVjaj2lqUY7Aaf5QYRF41st6oWO0Yh N+bdvlzuvxlM6XbkYjdO/+x7s7OcMCDpdvWZRWWE= 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.10 344/390] ARM: dts: imx6dl: add missing properties for sram Date: Mon, 24 Oct 2022 13:32:21 +0200 Message-Id: <20221024113037.643529034@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576242107131786?= X-GMAIL-MSGID: =?utf-8?q?1747576242107131786?= From: Alexander Stein [ Upstream commit f5848b95633d598bacf0500e0108dc5961af88c0 ] All 3 properties are required by sram.yaml. Fixes the dtbs_check warning: sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property Signed-off-by: Alexander Stein Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- arch/arm/boot/dts/imx6dl.dtsi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/boot/dts/imx6dl.dtsi b/arch/arm/boot/dts/imx6dl.dtsi index fdd81fdc3f35..cd3183c36488 100644 --- a/arch/arm/boot/dts/imx6dl.dtsi +++ b/arch/arm/boot/dts/imx6dl.dtsi @@ -84,6 +84,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; From patchwork 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: 9613 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp531022wru; Mon, 24 Oct 2022 09:05:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6iXFyQ5COj3ST5O3OZEtwTT/IA2dZrFHTUqsXKQHM3zdRNvAJFKZo9vyllJl9/mN3Lx0LS X-Received: by 2002:a17:90b:2705:b0:20a:b25d:5d93 with SMTP id px5-20020a17090b270500b0020ab25d5d93mr75006522pjb.218.1666627551850; Mon, 24 Oct 2022 09:05:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627551; cv=none; d=google.com; s=arc-20160816; b=oRUeV8LjGsd/lPqzgAcMjN+YgD3rdaG6izoVEK642A59ZqAPm2b1iJl91M4Ou8Qiaf 1HN0418PKhoMg+7rT94uLErPMstoD/PNkk8HgTRu99dlWzu/5cq8KGM07maTd4qcOX2N y2nlnFwxji4/CsGZIwjDDnWw93tElX1/vhRJlGeTD955xtiLgqNe952nY3La4Wu6mYDQ 7qLm9h9AFsqnG3z72R/8dC2IEEH2vaOiD+/IC3iQqunPRITqAbncz1w6V33DgLCZkGFZ 3rMyO1uNyl12udV7Pzjz0ij5FUWeSKW1UANXaj9OgCTdTXnRju1RwYCsxaOgFbyGmEfW 9yYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cjICEmuj8Ge/jD3+avh20K6EsQGbEdBMu7eP8PagzU8=; b=TzGYJ0xIpIo37mq0hhk4rBYNJTCbO3Q5RlV6lPb9BNeO/rZERo8defn2mqBcum5D8G yGR/C2u7xaV6/YZYFqg7fRPvIy+sZ3qc78TzfEzEDbw3eqWdg7T/vdDPgQihCCAvsjcm i5pjhfPH8BEUr7FlDECkZn0YhwKX0WUCpWSa3tnAEZAbmhvy0QEI2kiiwMW1QrMz+SNC a5UNoznWZo7iUuYPg0khRlHywC+rVxTHVb4yu07lPD4TTFD5tfX4pgWdUJiCeHr+4yc4 IYBUVUoGFVMZEmcX1nsD7sNqsNuJhjfPBzqYYg6Auont9XQTdMIAMhHlhD+s6teqRgrQ nMVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZpBeAeoW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e16-20020a62aa10000000b0056c07a694dasi35989pff.158.2022.10.24.09.05.37; Mon, 24 Oct 2022 09:05:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZpBeAeoW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232716AbiJXQDh (ORCPT + 99 others); Mon, 24 Oct 2022 12:03:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232464AbiJXQCb (ORCPT ); Mon, 24 Oct 2022 12:02: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 70B021A39B; Mon, 24 Oct 2022 07:55: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 CBA4DB816F4; Mon, 24 Oct 2022 12:31:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D141C433C1; Mon, 24 Oct 2022 12:31:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614662; bh=xDZ5H2RmEQh2bUXmTz0UOznmAG4tgU7w8djHcP5pD1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZpBeAeoWIj+ckR9yDFJdWTbp6mk3FUp3WNDGMrcU7VhMK4J2dXBh+7wMue44woWqC qKl73ubE3yRt4y7NmmgUAZOW2idZpufQezNYORAA6s1/8PcPL3KZ68Rl/OLACJnXhY cfDgE6DW23EAR4QBX9tmfWVqRocFVgLlx9GrjRug= 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.10 345/390] ARM: dts: imx6qp: add missing properties for sram Date: Mon, 24 Oct 2022 13:32:22 +0200 Message-Id: <20221024113037.681235570@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585651797853797?= X-GMAIL-MSGID: =?utf-8?q?1747585651797853797?= 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 b310f13a53f2..4d23c92aa8a6 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: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: 9483 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp480649wru; Mon, 24 Oct 2022 07:21:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7CzCBEfW9EtAMQIcMNjfLQBHyj6sn/TUHEW8HKi3TvWayPQC+uT8LOzOGwddGfe2CHzZwy X-Received: by 2002:a17:907:7294:b0:7a9:8a22:74d4 with SMTP id dt20-20020a170907729400b007a98a2274d4mr3013745ejc.139.1666621284924; Mon, 24 Oct 2022 07:21:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621284; cv=none; d=google.com; s=arc-20160816; b=qjB/+FTvOr4CEpDED3wlMX6vtcPMJXWFU1OuduGqF830qaru8kUpriM0MTEp320vol +SiUg5o2SkLGboidUSvqDSZjAG493RFSJ+W7iR6jwDSPWLK0kpCbIlJWYNqj/3B0ENQR 1gLNwWEvm2p2EIP4v7FOZiwOsEY4yvbYeNvz50ZbpJaR/ImGVtjCaL/nfSy1zMZtHw/6 aeRAp8oKCNIlSkwt04XezhMRg+sJ3vEHUeSzvieXbNbpPEJlQgNNWzR5xqHrsTy6geJ0 ze0I5cgDlkTjGOM6jEXwFFzg5ASMhbwglZIuqpXWwQFTaUPDCIc3crU91A7b9YQOcQpI dVCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oLCwcc4fT3cMm4pi9wuoPXbdw9JHjFPCmHSspCMhR3w=; b=uYeuT+o4bl9fRE8T3U4WHFaMcr4nl6LJvIGRg57dhn4q8sMI3877LJAzVBPnkn3h4c PG+B/yN1NkzemTjAMHz0dfGInW5Ho902C35oIr/ze/sw+lcH+7fc/nUGwKtrjjUD/BRP rZHLn8HYF7PEAHcKvHn2medu4gEl3D6sLqUac+x2hDLC3DKg9dxGNlerisoX4zhF3biH sV0pIx8AgDFu9/Uems+SoCUg1lVvWAWzCA15XNF9h6jbuDdvtr1+h4d3naWxDH9HrQt7 +Oulm1SEWvfhWg6NiTAb0AWFA202dljcjOxvo38YWIXLlQ+k507G3HSfsqBZRt5dQb5j 5sYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uJ5uVVyG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170906eecd00b0078d93245e34si31241067ejb.793.2022.10.24.07.20.59; Mon, 24 Oct 2022 07:21: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=uJ5uVVyG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237014AbiJXOTh (ORCPT + 99 others); Mon, 24 Oct 2022 10:19:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234388AbiJXON7 (ORCPT ); Mon, 24 Oct 2022 10:13:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48743B480; Mon, 24 Oct 2022 05:53:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B6FFA6133B; Mon, 24 Oct 2022 12:31:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C983EC433C1; Mon, 24 Oct 2022 12:31:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614665; bh=mXLSeP956HT/AZ/Rp+m665U+px0Ug7ClZwVnXMpLbZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uJ5uVVyGt/Zla4My870pdm/jJGnfNmpGRbFmUaLjIGIq6fTIKTltdQCBOKI9wuqAr xsERaN4BwusWkLK1OiMkbOW4KT45SUbb/xyt1KG5xaMiXs3oCQuCxv+HItLKQAyLOC K6vz2t1fH1kJOGiA5nFfJTjWQa4nSI818v8fIg8s= 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.10 346/390] ARM: dts: imx6sl: add missing properties for sram Date: Mon, 24 Oct 2022 13:32:23 +0200 Message-Id: <20221024113037.719677710@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747579080775040744?= X-GMAIL-MSGID: =?utf-8?q?1747579080775040744?= 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 91a8c54d5e11..c184a6d5bc42 100644 --- a/arch/arm/boot/dts/imx6sl.dtsi +++ b/arch/arm/boot/dts/imx6sl.dtsi @@ -114,6 +114,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: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: 9598 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp529351wru; Mon, 24 Oct 2022 09:03:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Ix8ihgGHVGd04JbG4un3TLqne99/3NCymPZ1q5ipXXP+yaJ3D1Zb7uX53v3sSVVtASgzI X-Received: by 2002:a17:90b:4a92:b0:213:2421:5f38 with SMTP id lp18-20020a17090b4a9200b0021324215f38mr3347732pjb.10.1666627409792; Mon, 24 Oct 2022 09:03:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627409; cv=none; d=google.com; s=arc-20160816; b=KxxY8sLWnewpfbPzW9sj/YmvUZC+RAZPnjgSJGwGifoHx5F97LWzxHuSml8m/SP0h5 8nK0V6/Qnp7e1CC8wy6zhPAwUPcEytyQR2NcQASvHt5cmHDm6h3qPdbU3hj+OWraiy/I hZEwLH/d+kj67nrEeDa2nlg96FYnRZAnOFIMTKzhViGI84LAO0MhxXKr4QlvSlbrPWOl IIGteGU6OQyj6oviaj3GSr7RbZ+KkK+H1eJx76ePBTHNMU3Xm7bs5042vCDeasRCtERE kMAMB3U4uRo1uUSYFJRbfXEmNVOa7Av+2rqVocCj0ByuDFkqQXgqFavgCCkz37tXlOMb qhpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HH5FJHsKRMLuKUAeaYRfVHW+4QFkw6s5y30NAYYiv54=; b=wXHCFP5ZPJUTJDOdV+KHC854Z5z5RSEacUT+RuSDTKGC14+YHtLJBSBlH5SwC14zKW 4QfR8E7y+PbuungcEAFvqIJr++2t7f/xrL8Sg7m5vnaR5eGZqlNsWCPLC8p+xZcTYg1m 5pthcaM2Kjjd+1DWuaOYg7PUyqZd5vPwoO5GX33GwK22WlJ7trHCZRiQ7xRlJUd76bmc nvpXic0yDg52wJGvsgmeXdJH5LI4TtDsXTNSXfH02knhfeDhO7G2F5Yxw+n1qjaXLGm+ Nl1SvgM5+N73eWbyuh+w0yTXkpKivqiMXGC2IMYTxM+h3SVXvT7PPja7qHN79E3rUa8q 5KjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UlltY2Hr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mw15-20020a17090b4d0f00b0020a7f4402d0si355749pjb.27.2022.10.24.09.03.15; Mon, 24 Oct 2022 09:03: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=UlltY2Hr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231806AbiJXP7m (ORCPT + 99 others); Mon, 24 Oct 2022 11:59:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232125AbiJXP6f (ORCPT ); Mon, 24 Oct 2022 11:58:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 682EE143A58; Mon, 24 Oct 2022 07:53:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1F5EEB81339; Mon, 24 Oct 2022 12:31:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FC65C433C1; Mon, 24 Oct 2022 12:31:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614667; bh=4FjH9BRTsH6KAHs5Hei+T4T984SR+zlhF2Yp4tsD4EE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UlltY2HrJR95mEe4CZ7X66KhCtrC35+IO98A9l1ra08yEz7mGg50EFapNHvS+eSti toRkR58cUCQfF1af+kjNIe7LnBzq+eADyxl3ENUprEyvz9ymMVhij7qM2eWgPe3WPl Gvn6ET+wHGGPKMLXXD5ROI3YsaFJM8UUNWIg4ApE= 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.10 347/390] ARM: dts: imx6sll: add missing properties for sram Date: Mon, 24 Oct 2022 13:32:24 +0200 Message-Id: <20221024113037.768874549@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585502775634472?= X-GMAIL-MSGID: =?utf-8?q?1747585502775634472?= 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 0b622201a1f3..bf5b262b91f9 100644 --- a/arch/arm/boot/dts/imx6sll.dtsi +++ b/arch/arm/boot/dts/imx6sll.dtsi @@ -115,6 +115,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; }; intc: interrupt-controller@a01000 { From patchwork 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: 10101 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp626195wru; Mon, 24 Oct 2022 12:56:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6XWhZpsdXgJF3NBzKDmWzA8F7mDhGtcBgCIl/DdcBbClOVi2IVCLZixAXbi/jj44uws3QP X-Received: by 2002:a17:907:608d:b0:7a2:b93e:a765 with SMTP id ht13-20020a170907608d00b007a2b93ea765mr10338244ejc.273.1666641374401; Mon, 24 Oct 2022 12:56:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666641374; cv=none; d=google.com; s=arc-20160816; b=a13AnKVNiXgvPBOyZ5/zZU0BkJfu6E0VaQuH+ywA6ipVeb079k1gfQzqlEa/7Uyeje VGe893+mlN9PzVLgzUCB8eDCTZNimLbA5Ro8MwnnHbUetHuNd11y0ksWg1XilLngk17+ AuF+2v+uM9QkcYg8HbsSbhy6uy/MwGCsxddoOPQE50Z5T8HIKcieaElRCvTaT3u2vfqi 43Yp5ryFR/N5V0jCCew2w+CbS9gpajhYpKbwAweG9sJNeiD4klOWW8umbwwApoholOn8 EW3ojLN5oLarXutMb6xl50h1aEU0VNT2mftdY64OfcjNwNbguxngIwrYENp2R4aDp7Bf Hv7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NwVVKOSkmmnbqg34DCjCBW6rMbkqMozGi0OZ+A3ryeA=; b=GmEYD0ZnHT5Owc+dDouBwk1B8MUX+SvUOLASRfzu6DnY9bA3lHOQeXkFXQVHWiz4By AIqaRBox7tGszk2vJrz6Dd+Egv8s/LbSnoGk/tkPFx8iLqWyqBdvztzunwckDJc2xlN5 sbS/2lFNp0MJ6zuSUfqtbiCijsWP7e+VbM7o8e/bMAj4Jqa0NI2eT5+ALoZ9rQJP2HMd /9RTQkecb2vusIthmmyVPNqGGhF5mQUVQ4dvg0ivN8wD3crYhFMv1UxQ3S4bisfttOJI jqJzPvzuw7GvqFxgSCnfrHoZ7pM/aK7oEdEpP3FmJEvUVjz562PXdICXsK2di9Z03E40 VSrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kFxmSJDJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056402084c00b0045cafc51fbfsi699346edz.525.2022.10.24.12.55.50; Mon, 24 Oct 2022 12:56:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kFxmSJDJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233770AbiJXTy5 (ORCPT + 99 others); Mon, 24 Oct 2022 15:54:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233652AbiJXTxQ (ORCPT ); Mon, 24 Oct 2022 15:53: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 A6C5A130D58; Mon, 24 Oct 2022 11:17: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 0C12EB81719; Mon, 24 Oct 2022 12:32:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5931DC433D7; Mon, 24 Oct 2022 12:32:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614772; bh=CtaTkCKsIWReAOnT0gyCALrUoxF2/7iB/EmKhECp+hA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kFxmSJDJTzDGM1Ks+gnvrHx3s+6ZXb5sLDVlfPHA1WQfQFFI6u4fepf3nr+fBRwCQ YxDB4PWRUsflYrPBqVbxwBi9vVBlAtHU6Blg+uWzVxHOpI5bSxMV2TGl7G7zdlDMUB MU83BtJaZwyukvpde4tjfWHrrdSNzeWWYHYPGwyw= 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.10 348/390] ARM: dts: imx6sx: add missing properties for sram Date: Mon, 24 Oct 2022 13:32:25 +0200 Message-Id: <20221024113037.815074361@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747600145714886056?= X-GMAIL-MSGID: =?utf-8?q?1747600145714886056?= 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 dfdca1804f9f..c399919943c3 100644 --- a/arch/arm/boot/dts/imx6sx.dtsi +++ b/arch/arm/boot/dts/imx6sx.dtsi @@ -161,12 +161,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: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: 10138 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp636702wru; Mon, 24 Oct 2022 13:22:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5P5+RVF10OZvGVzZj0Dby+nalOMveeKzh0W+HWEB0f8GfuyxMK4kJK6Q490Nc5Lwg6055w X-Received: by 2002:a05:6402:1045:b0:461:a28b:17ab with SMTP id e5-20020a056402104500b00461a28b17abmr8915534edu.90.1666642954898; Mon, 24 Oct 2022 13:22:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666642954; cv=none; d=google.com; s=arc-20160816; b=H//W/ZVaOfONcp5bhY7JyzchkWIewqAC4qOwqXSOnsdfjTmKauyuYn/Oq8rwVA3V+k GTVYljTSWnxv2TXCKUvEEA52zJwZlyWLYDspFv8NM6KO1pM4mHFLxHOrycSm/bno9Rup k21it3VOwff3FQPB9Ztu1qLnZ7tiFVtpyiVcJB21xozDQy/D25eOqekXaTvyxZSpPr5v 0I6Kr6T0ypRxiCK+6MSWM6bTQ70CruyptHSuKm+zWycv/+SF7Js5CiaQz097CcgkoPK0 ZX/T21U6vE+Sf+/UV/6oLy3A5/Gg/hsq5PM7pQCVyppeG+M5TqvSdg9G5fOa2GV0QUVm d1Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=a/obIfrV/ZrAqOk2Ixy7N2LciTGeONRCGwaF/82QJgM=; b=lx0saS1kr6rj0UOuq98PrVoDA1CpvazUNO/CHIBqSgwPiAA4CXcAKomOwC4QpH8Drx aPliKmdMITV3fV7fRTBes/g2FaBSWhKNZDLt6izcO47u81iWMJz84EYNeNe7mi3EJQxx LbIvsL5KqfgR5rD12F0t0S3LcPdc3AVPSgDiCTVUEgAlU9vBBr32OLGHyOnhCAqsF9lk oUiSig0Ok79rO3TAA70yCz+C89X7IOqi+mT+8BtdS+WDVOpemhKzosFvqmh/rvGIUEtj C9DE9NG6gW39vPyuqTt2VlsZA8Dtkl1yLYE+iXFq8uH7bgcVRnA5Wa08FiXrkFahcPGX i0Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NBBT95jK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e18-20020aa7d7d2000000b00460f0ff4906si619587eds.130.2022.10.24.13.22.10; Mon, 24 Oct 2022 13:22: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=NBBT95jK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234037AbiJXUQJ (ORCPT + 99 others); Mon, 24 Oct 2022 16:16:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234013AbiJXUPi (ORCPT ); Mon, 24 Oct 2022 16:15: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 9879EA98DD; Mon, 24 Oct 2022 11:33:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0D331B816FF; Mon, 24 Oct 2022 12:31:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F81CC43141; Mon, 24 Oct 2022 12:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614688; bh=4jU+b9rw56L/HuCT8xKDJBBo+NptefMm9VOF60OgbkA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NBBT95jKmEw7o0q3KwoQlVrzUMHUA9nX4Prjdn+Q5tUIcFzqufGZuHpVhdt3zhdgI yk8BvbmDH+i0BUIBGu0iUrypZBqAWON/MeWB0lyQz1I+TdjfzdJ/nuUpph4JQaHGGQ 1Dhopz41IXHBbxj4AC+5D2EujeB0ZkBBxzFMdpTM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Brown , Catalin Marinas , Sasha Levin Subject: [PATCH 5.10 349/390] kselftest/arm64: Fix validatation termination record after EXTRA_CONTEXT Date: Mon, 24 Oct 2022 13:32:26 +0200 Message-Id: <20221024113037.846538203@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747601803174676145?= X-GMAIL-MSGID: =?utf-8?q?1747601803174676145?= From: Mark Brown [ Upstream commit 5c152c2f66f9368394b89ac90dc7483476ef7b88 ] When arm64 signal context data overflows the base struct sigcontext it gets placed in an extra buffer pointed to by a record of type EXTRA_CONTEXT in the base struct sigcontext which is required to be the last record in the base struct sigframe. The current validation code attempts to check this by using GET_RESV_NEXT_HEAD() to step forward from the current record to the next but that is a macro which assumes it is being provided with a struct _aarch64_ctx and uses the size there to skip forward to the next record. Instead validate_extra_context() passes it a struct extra_context which has a separate size field. This compiles but results in us trying to validate a termination record in completely the wrong place, at best failing validation and at worst just segfaulting. Fix this by passing the struct _aarch64_ctx we meant to into the macro. Signed-off-by: Mark Brown Link: https://lore.kernel.org/r/20220829160703.874492-4-broonie@kernel.org Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin --- tools/testing/selftests/arm64/signal/testcases/testcases.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/arm64/signal/testcases/testcases.c b/tools/testing/selftests/arm64/signal/testcases/testcases.c index 61ebcdf63831..a3ac5c2d8aac 100644 --- a/tools/testing/selftests/arm64/signal/testcases/testcases.c +++ b/tools/testing/selftests/arm64/signal/testcases/testcases.c @@ -33,7 +33,7 @@ bool validate_extra_context(struct extra_context *extra, char **err) return false; fprintf(stderr, "Validating EXTRA...\n"); - term = GET_RESV_NEXT_HEAD(extra); + term = GET_RESV_NEXT_HEAD(&extra->head); if (!term || term->magic || term->size) { *err = "Missing terminator after EXTRA context"; return false; From patchwork 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: 9171 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457986wru; Mon, 24 Oct 2022 06:36:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6xaxg3smQRgoGsXSQ7mem0vEOZHnF55yEaQEO+Y/fkNF7SXR/Q5o7RZ9otkOywUs9vg4uK X-Received: by 2002:a63:6a06:0:b0:439:cc64:50e6 with SMTP id f6-20020a636a06000000b00439cc6450e6mr27722155pgc.483.1666618611474; Mon, 24 Oct 2022 06:36:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618611; cv=none; d=google.com; s=arc-20160816; b=uvILDU0hYKxyTf0P2HaprO2QaZXaiXb5zGg6UX1/Do26vt2BL5KOTy6k+kjTyFdE7V 1k9IXE7VuYjbvsUZfNhelBSq0bYs/VvpDS5k7pK2fOMCmz173SdcyIK1HnkLqLi6ReSP /HmnrmwUuOAmyXPRZbUwj0fVmg8e0RBZPgAS3RAiejB/WwYr3+cbvB11ojIBUCScbvlV fwTF77vCoWVBLD85rE5ApfV2Jby1PP5HBHNM1avkRu1Q7LZO5ONRwWY0/2ZWXiTp1EuY MZGIKCILCKA8JuRx1ZpEQk9glTXbw6XkO1GyNC7aTTn0BGZHIBtaZ6+oHFHTF+CbfDsY z2vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/QMxWNXxA6U0i2oxKxVqnjqWH4+nio9c3hyRqhQ9bi4=; b=BPm1CqxEkKfDIrfYykYyjgUjMEPYBUgrM9ZNf7rPIMpbcP09zJl9EO80Ld5ks5/1Dg 6VKxuLOa0COHgEKoL8ljHlUkBsQ5vqh4ymDZF+TApVHSe7Ek8r292i00c/NMYiVUtagf 8E655YRpH0DBD2s8sQl/+KOHMv4Wg4eT2sm/m75bMYuuZunCYYNdKxvPh6BSLUd364v6 wG/qcssyJe977TZJrUsl5xsI7g/lyHX9S0fvb5S2sr3rsZFPvM4JhrTZF3R3p2jPpGQ5 5NwZIHnuYdbSx2VQGeSyqg8lEVQ0Ej5rRnhp54JV+TShqGLSnxAfX//GqI++yAK0SFdl pJsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hS3h8rTp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a635749000000b00458fbbabb21si33025868pgm.710.2022.10.24.06.36.15; Mon, 24 Oct 2022 06:36: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=hS3h8rTp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230344AbiJXNbv (ORCPT + 99 others); Mon, 24 Oct 2022 09:31:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230267AbiJXN2o (ORCPT ); Mon, 24 Oct 2022 09:28: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 4DD65AA35C; Mon, 24 Oct 2022 05:32: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 3FBF0612E4; Mon, 24 Oct 2022 12:31:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 565BEC433C1; Mon, 24 Oct 2022 12:31:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614717; bh=XcyvMctpBNh06pi2hf3azrwB4tMOQO3O6k/SbrYlzeQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hS3h8rTpes8zJ/3t9UsnTJ6T1dV4b5ayEeTxQ9btdCzB1LJvdkV0n4uvT798g5Hbt m0gWbtdpuONrQrz1DQ14jx20HytYOnmGH+JudWBJtageUppd1h7cyWiV0g1YNcHN9a 84lCbkEN/9notramTHLeYnYZKtkN7ZUgIwHUjxjA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sebastian Krzyszkowiak , Martin Kepplinger , Shawn Guo , Sasha Levin Subject: [PATCH 5.10 350/390] arm64: dts: imx8mq-librem5: Add bq25895 as max17055s power supply Date: Mon, 24 Oct 2022 13:32:27 +0200 Message-Id: <20221024113037.884053050@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576277165210470?= X-GMAIL-MSGID: =?utf-8?q?1747576277165210470?= From: Sebastian Krzyszkowiak [ Upstream commit 6effe295e1a87408033c29dbcea9d5a5c8b937d5 ] This allows the userspace to notice that there's not enough current provided to charge the battery, and also fixes issues with 0% SOC values being considered invalid. Signed-off-by: Sebastian Krzyszkowiak Signed-off-by: Martin Kepplinger Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi b/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi index e3c6d1272198..325ea100969a 100644 --- a/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi @@ -899,6 +899,7 @@ interrupts = <20 IRQ_TYPE_LEVEL_LOW>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_gauge>; + power-supplies = <&bq25895>; maxim,over-heat-temp = <700>; maxim,over-volt = <4500>; maxim,rsns-microohm = <5000>; From patchwork 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: 9571 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp527352wru; Mon, 24 Oct 2022 09:00:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ULNLNB18vUNI70hKtSIn6wASz+0sr9R3rgMUnZiNsU0vpVKsCbm1KgixptUZLz6iX0f6T X-Received: by 2002:a17:902:8601:b0:181:6c26:110d with SMTP id f1-20020a170902860100b001816c26110dmr33198031plo.27.1666627242966; Mon, 24 Oct 2022 09:00:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627242; cv=none; d=google.com; s=arc-20160816; b=iZ6U2+My5CyBlLBG5/m2Gn1ZREjdRgOxDfZGMXzYnz9F30EHvR1FhFr7TmgbSVbl3J C/IM3zJsOUBbG5Vg1Fxp054Jt+O2bcUk03X/TL0WoSMmYEjwKMRGoxhWvj16KKyl92z0 fAH6/dxp8YrO2KDfHJWARkYzLMNHMPNYpY1aquz6H4oe3OBQp+O1oHbeMsEXnTMHLNRM GqQZESy/qMUx4iGocAbfekSKyR7DEuRUug46ciZLEFzUI+2aaDNhynoa4dnwDPrlrg0O q/3OUUqkX8nog4EMEMaduFdMnuei0BbeNOHYdqK84geQuq2TJPMQwLSbSgRelCtVivRr 5siw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lpR+7VeyOCSNKPcxy2snUrk+IpTgOdZkXtOreYot/vs=; b=KhxHIgB1nse3UwzH3jDizda6FzgU7bTIJYfdBx6vgOWVeSxfMhwsPRQ46rOrtEQLF4 nw9Ezddh1R0J4oT1SK+BCakOnKLSmClI3D8g9I+JQHr5HnwyCFwylkpoAUHxKy0mybGb rUaeGXsn04D/5K8iI+IyTzCDzbCu5rrmWwubCCFLJqkCyXS43gNlZWDr+DoDGhkWm3zJ HltPBz3LB6uyJLR10s7xH4JymHe7l9uPES0gv61noTdzlPh69J6isKzB9ES0jsEsFqJo hxtkkly8VvDPjS2lhyGIeg8HbTVY+UAHc4VK9fwSERPkjHDvx0f6cgMp88o6N6oU91ml XT8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tnvfFaHO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y4-20020a17090322c400b00186be035c64si374999plg.416.2022.10.24.09.00.23; Mon, 24 Oct 2022 09:00: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=tnvfFaHO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230422AbiJXP6S (ORCPT + 99 others); Mon, 24 Oct 2022 11:58:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231725AbiJXP5d (ORCPT ); Mon, 24 Oct 2022 11:57:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3092525C4D; Mon, 24 Oct 2022 07:52: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 BB1E1B816BF; Mon, 24 Oct 2022 12:32:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16DB2C433D6; Mon, 24 Oct 2022 12:32:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614746; bh=DldUW7Lm57Tuv67v64bf+Aur5Zpyj3o2v/3TEU1dk1o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tnvfFaHObqDZoN+IPbeAzxeghY0l6MlPI8vh1IP8IH8LjL/FqIAgx7F3Jk83wVgwr 9LR/k2rUmpHs4NV0yoBfthoUso6ezl6H+9/8MgikNN7etbqImof2PfS8CZvFpxXJbh jJDCLlz3AsaYwhbQcbQ535ciwsRCh0bA3PEHXnAM= 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.10 351/390] btrfs: scrub: try to fix super block errors Date: Mon, 24 Oct 2022 13:32:28 +0200 Message-Id: <20221024113037.930726069@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585327958555896?= X-GMAIL-MSGID: =?utf-8?q?1747585327958555896?= 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 0392c556af60..88b9a5394561 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -3811,6 +3811,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; @@ -3924,6 +3925,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 @@ -3932,6 +3939,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) @@ -3958,6 +3975,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: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: 9218 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp459315wru; Mon, 24 Oct 2022 06:39:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7rnyeOcc04Cx20VAOESRCzdcwybNXE4Fd1C6B5wQCrQywaZyvCFKWkX/mAb1cK0ba7STOO X-Received: by 2002:a17:907:7f0b:b0:78d:c16e:e5fc with SMTP id qf11-20020a1709077f0b00b0078dc16ee5fcmr28176425ejc.713.1666618758604; Mon, 24 Oct 2022 06:39:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618758; cv=none; d=google.com; s=arc-20160816; b=b0ALAuH80zPZWkZSTiiQxKe0NUcHLe7qFSA1mvrWF51jQbA/XED8nN8SCBhSpnc3EL 0BLbb/v/Mg3F7r+L0Og7aLPxQaMoe/BGs8nqn2jtO/FgTihToT8cfOsV9/lCdq8I3bEp 9AAybfuzVK8zaZkrdzKQ4nZGW/d/pb83g4+PEFd7iCoD0lNCw+MNB2lA2rnlKYy4h+N5 tc8EqffBl+6aD8kee37C6qF0mML6BHxme3arschotkJXIRMtKlDKytrzuZIGnUQA+2CX wckL6gCe+GYPUWEXECX3HpfV+UE3Cn00hlsQJ2PMhOrM0lgRBV0X7hOpGj+mKZiMh/vF hDnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aKUQu7eMN4Vb7kZjxClAejXNlVqhu9tWL8DoND6B7D0=; b=NXrgKnlTNXsx/NM9OZfMH2ykM21VHc3/ARoshakKaba2Y2Y14KM1JEAyJa0C+9ihrO aFs1+LN3/t2pA+/SbPHgAAi7Bf1PgiZGAObC3mMsuqb6rmiuZz7EOGneZEV3HzfTwvuy y/7aqwnmSMgEeSwyNA3sLFfWveSb4nnjiSD6P0AGWF53FIqfa7F/8UkjP4RX0RsoELK5 Uz9SFNtfXh8ObdxFmjXoqUZqSlp5IX5dPLbjOGY2qVYXOlerxXZ8uKAcWxfyVBFDCFKg rAk16wIyP4Y/b5U/MZfFT9qBrt2ap/FbUuNwt2BE1Pe3HCoUy302Cz3EHWQPLFAFPwYC 9S6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="S/c7Fvz8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sd19-20020a1709076e1300b007822665aa36si27555403ejc.430.2022.10.24.06.38.52; Mon, 24 Oct 2022 06:39:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="S/c7Fvz8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231777AbiJXNdK (ORCPT + 99 others); Mon, 24 Oct 2022 09:33:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236046AbiJXN33 (ORCPT ); Mon, 24 Oct 2022 09:29:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5A4F1EEED; 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 dfw.source.kernel.org (Postfix) with ESMTPS id 694F36132F; Mon, 24 Oct 2022 12:32:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C03FC433C1; Mon, 24 Oct 2022 12:32:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614756; bh=+uNZkwr6oPBtDUd6jzY7rCjmM98v3IRGZerJnhG2IWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S/c7Fvz8l8VJniiAezVrypLe+aeJS2TwjQlMtXb+zrj0PKzlV1AfPwx92JWzGK78A MSsa5BLD9CRK1x6evLHZJqzWIynJwkystPap8w9b/gyS9gQK1p5bImeVlB50Mwop+v nb3d0//CGWjZyiPeEGPGG4RejCqDsGQ4zUS/KjfA= 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.10 352/390] clk: zynqmp: Fix stack-out-of-bounds in strncpy` Date: Mon, 24 Oct 2022 13:32:29 +0200 Message-Id: <20221024113037.971885118@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=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?1747576430970012751?= X-GMAIL-MSGID: =?utf-8?q?1747576430970012751?= 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 db8d0d7161ce..9c82ae240c40 100644 --- a/drivers/clk/zynqmp/clkc.c +++ b/drivers/clk/zynqmp/clkc.c @@ -687,6 +687,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: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: 10086 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp625209wru; Mon, 24 Oct 2022 12:53:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Rv5VYGUM8+jVYZfuT9vXKmJ8hzovuNrPHn8OEG+lPHLYKilkXihkw3t5IRLHoeAM9H13k X-Received: by 2002:a05:6a00:2291:b0:563:9d0d:62ae with SMTP id f17-20020a056a00229100b005639d0d62aemr35784222pfe.17.1666641224350; Mon, 24 Oct 2022 12:53:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666641224; cv=none; d=google.com; s=arc-20160816; b=ZNOA0fP1X3hi04EWLKqv6wwrwn4aASI93qTeqnJOhfx8GEAXwke5HO+ho8QSBKALnc CpCfpH/bQ85jyIVu7tdC6SBKEwK7Mqso2G4MlngSKkBQa8rZgJ5f8K9JTPseNMauR9lK dPfhU8OMF5hNYZ2t3rkOSyjnMyACRA+eD6snzXuOp47E65lrqCF29wmmv07xxwp2heCd zt86ahZqCUbAkj/B0Bl3wjwTbxotoIZNu9Wl4GISjIBCMyFBZpLuVFPkrJ8ftUYT2JRd uqjaaf9gM2BIHGNevtHiIgOVv/9grSqpecGusPAEAhzSxSuI48mNtyBTc3w4xy/ILyL4 grnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=y8bx4JGWNCY9HCpCfwX/Y2VkzTiI+7tmS6RHnY5eyzU=; b=EOdI06V5GaAcQTwDK6fcSeVzFHeoDHNj7o8RBOcBtQkFSRM/B47T671z1YCpYZhXo9 H6jOOJPBjN+diRKWv/s+YizMdAOuC1xDLZHtiUf9sS7ATL6YM/DL408PxdWapQ3++gIs QnjqFuhAOPPTfpwtRtRvA5IwIQf33u/+S8WjhD37Q4QXucoIQN03BsN7Q+DnqxPZ83z4 U9htA7ZJWrGnyj4GXqkqoXiMoRP+esRVDmscRCuhhm7Y8KXpKCLSfp1nw73OcXK4Fcwh E9qnZVwVrFM/dELqIXbwxK+9O/RNaiKHffA1YPCDGx3msiecxI2tbl9NQ3Gu+IvNZ546 eA+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vzUQkuU8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902eb4200b0018685257c0csi382395pli.121.2022.10.24.12.53.31; Mon, 24 Oct 2022 12:53:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vzUQkuU8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233610AbiJXTwu (ORCPT + 99 others); Mon, 24 Oct 2022 15:52:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233606AbiJXTvt (ORCPT ); Mon, 24 Oct 2022 15:51: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 9C85371986; Mon, 24 Oct 2022 11:17:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CE684B81708; Mon, 24 Oct 2022 12:32:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22F23C433D7; Mon, 24 Oct 2022 12:32:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614759; bh=1SmYVK8UXkMZ0CnGE36Jjtb8MHpUjmz7Nvs32E/1b0I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vzUQkuU854vwbAx7omXnyd0mWmBX0fW7H1si8Y4gK3NpVHTEkx7lQZVe9Q26oWwLE jrZ6NXTdrS7SXcosRPlAbidUVw8FuCGI1HSJSQi0LXqUoAyCaIEJllAT7mzoXqmhes d1hjlXt/q25pmUPELz79rdJo/qQTgsQVhGsejNVk= 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.10 353/390] media: cx88: Fix a null-ptr-deref bug in buffer_prepare() Date: Mon, 24 Oct 2022 13:32:30 +0200 Message-Id: <20221024113038.019412650@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599988687639707?= X-GMAIL-MSGID: =?utf-8?q?1747599988687639707?= 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 8cffdacf6007..e5adffa3a99a 100644 --- a/drivers/media/pci/cx88/cx88-video.c +++ b/drivers/media/pci/cx88/cx88-video.c @@ -431,6 +431,7 @@ static int queue_setup(struct vb2_queue *q, static int buffer_prepare(struct vb2_buffer *vb) { + int ret; struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); struct cx8800_dev *dev = vb->vb2_queue->drv_priv; struct cx88_core *core = dev->core; @@ -445,35 +446,35 @@ static int buffer_prepare(struct vb2_buffer *vb) switch (core->field) { case V4L2_FIELD_TOP: - cx88_risc_buffer(dev->pci, &buf->risc, - sgt->sgl, 0, UNSET, - buf->bpl, 0, core->height); + ret = cx88_risc_buffer(dev->pci, &buf->risc, + sgt->sgl, 0, UNSET, + buf->bpl, 0, core->height); break; case V4L2_FIELD_BOTTOM: - cx88_risc_buffer(dev->pci, &buf->risc, - sgt->sgl, UNSET, 0, - buf->bpl, 0, core->height); + ret = cx88_risc_buffer(dev->pci, &buf->risc, + sgt->sgl, UNSET, 0, + buf->bpl, 0, core->height); break; case V4L2_FIELD_SEQ_TB: - cx88_risc_buffer(dev->pci, &buf->risc, - sgt->sgl, - 0, buf->bpl * (core->height >> 1), - buf->bpl, 0, - core->height >> 1); + ret = cx88_risc_buffer(dev->pci, &buf->risc, + sgt->sgl, + 0, buf->bpl * (core->height >> 1), + buf->bpl, 0, + core->height >> 1); break; case V4L2_FIELD_SEQ_BT: - cx88_risc_buffer(dev->pci, &buf->risc, - sgt->sgl, - buf->bpl * (core->height >> 1), 0, - buf->bpl, 0, - core->height >> 1); + ret = cx88_risc_buffer(dev->pci, &buf->risc, + sgt->sgl, + buf->bpl * (core->height >> 1), 0, + buf->bpl, 0, + core->height >> 1); break; case V4L2_FIELD_INTERLACED: default: - cx88_risc_buffer(dev->pci, &buf->risc, - sgt->sgl, 0, buf->bpl, - buf->bpl, buf->bpl, - core->height >> 1); + ret = cx88_risc_buffer(dev->pci, &buf->risc, + sgt->sgl, 0, buf->bpl, + buf->bpl, buf->bpl, + core->height >> 1); break; } dprintk(2, @@ -481,7 +482,7 @@ static int buffer_prepare(struct vb2_buffer *vb) buf, buf->vb.vb2_buf.index, __func__, core->width, core->height, dev->fmt->depth, dev->fmt->fourcc, (unsigned long)buf->risc.dma); - return 0; + return ret; } static void buffer_finish(struct vb2_buffer *vb) From patchwork 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: 9192 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458727wru; Mon, 24 Oct 2022 06:38:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM757lc2nia01WChbCekS0RJ/qkLMOADfhh4MzXMcPBXilfYhAAHKCdMgQikMMrTjd0HELF4 X-Received: by 2002:a63:8941:0:b0:46f:1673:92c0 with SMTP id v62-20020a638941000000b0046f167392c0mr2977849pgd.425.1666618689453; Mon, 24 Oct 2022 06:38:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618689; cv=none; d=google.com; s=arc-20160816; b=lbmlAWspH827sZPLPPYp7vdmfNERzgQpu75ArULcPGsnhBrzGaE9BbLizEwW+JOZTm DHNIBa3QkkBW8hPFr/aS6fZboAbyzqKo/MwztjC+WC979KSynGtk+kTDZ+PoT3JqlM9j WN5jZCTZHgxtYHzernrsxACIDaRtkt8FQTGn15MGSQdg+qgY+QU64GwaaS2WBbOlQ3Vn Aq0bNtx8dmX+ohlcxFRWCfJlYIgBoeVatKoBtMPEQD6tBsyaaGQ9MG/cHP7+7OFzGqUH 5BI4heaqJUINM6hQp74r+E4G6wAFKZAg1Qg1L6ZYjinXjfUxTUKzUSLQvIcGIF9l/qrm 6Rag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2uIF82GmaIiqk5Itc7oHkX08QrZPwclJ10AHgI8nOGU=; b=lt1w5riwk6P7abwbO/uo8HVrl7vwUyNOafXYAQT116/APeu5QzPpl/LCf0/+3wKfx+ YVkiskppAFlwHGhj5SzfDmBVdNXyqauzo8zpJvbrNsjkp8vztllvh+KuhAE/b88FwHgf ApHVsKKdFEG1KFLDIcR5TNk32BX8vOR/aVexByVwK7NPdt9jjuchuv5CkqH1uNQNvH2c WPYhhK4vuMOs/GNjCeANoIdqhmvFmycgKQWIvEI3nrkZZfb7kZ+EzlB9Jn7C1OkP61fJ n4iy5jAh8i3BUnWPryiaam0qmYi8RqXVU6LmS1+0Wt04WfdT1IyFGRxD1CWtwWen7Ytt bFgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=09OYMQTp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jl3-20020a170903134300b0017f77d19d92si31349754plb.127.2022.10.24.06.37.38; Mon, 24 Oct 2022 06:38: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=09OYMQTp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232195AbiJXNdT (ORCPT + 99 others); Mon, 24 Oct 2022 09:33:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236079AbiJXN3e (ORCPT ); Mon, 24 Oct 2022 09:29: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 EBACCABF25; Mon, 24 Oct 2022 05:32: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 A196E612DB; Mon, 24 Oct 2022 12:32:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4812C433D6; Mon, 24 Oct 2022 12:32:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614762; bh=4yEgmnwTZHctMTUP9k2Sgbjd3eyxLywPyXolyPXXje0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=09OYMQTpnOEcjF+WXQBYzzeh4Ip1xTDVK4q3fODg4uYDsl/Sr3P+gOR/1RyDPfkbm NDjCwrmR+PGFplfkrHE1epakbLI0P5rfcI0mSWoslZnKMpBiV12wBN2EX7TgMy714o EV6yLLU9eGKiZWHaix51gyWIPK8lBWBq56CWLaac= 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.10 354/390] clk: zynqmp: pll: rectify rate rounding in zynqmp_pll_round_rate Date: Mon, 24 Oct 2022 13:32:31 +0200 Message-Id: <20221024113038.073824230@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576358861860159?= X-GMAIL-MSGID: =?utf-8?q?1747576358861860159?= 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 abe6afbf3407..2ae7f9129b07 100644 --- a/drivers/clk/zynqmp/pll.c +++ b/drivers/clk/zynqmp/pll.c @@ -99,26 +99,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: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: 10091 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp625367wru; Mon, 24 Oct 2022 12:54:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM73LwLBvivWX3F4PVgSUF/nWYplVIevARUrifIqTzWZcPFUCM75i2OUIjJPXr3cbV3b0/W7 X-Received: by 2002:a17:90b:384a:b0:213:2907:a528 with SMTP id nl10-20020a17090b384a00b002132907a528mr3608641pjb.183.1666641245781; Mon, 24 Oct 2022 12:54:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666641245; cv=none; d=google.com; s=arc-20160816; b=Nh1u65vBNQ7s7EJBi4YnKJHXhgRTUvNApyXKdXzUBmKINLaOZbI6GeXOT/4kIj/57I HV8FLObR1ESYyXXRMV164Cssk7HwKaXZD6SakD3cTTDTtnI4ToDiEtmrXjLYlOxJKWie juQjaQOG66mwQlza9LBzR2Jy8h0BRpJkAV29SAY09u7VC+K0pBSQsZ+QiREnIkmto42y z2XnA0U+b+xPP8AVlqsPzkMkGUj5gs6625PnkNpgx8yOpYPTRYcHrMdjyNnoIaE0Fw0S SRIvoCowB9UvgEVNk7QZAErVuK89pwF47DBaKMZ2tH7NUnK8OjYBJUQTiK61JQEBnTRC FpEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lOIMTWlgyilb48cpy6ef2nL+3f4BmSivj+OezN2O+fQ=; b=u9EnGniSXbaZc96onAJtSZ3qILZZcAcgpm3g5YBlydPZ1YHGvJfVcCI2Ssm1esXprF iPvdV1hL4onlpIcGheIKluyitXCnpNhf8a97m82rVeXBbpuysCtSJH/iMGvlclXnGMwJ mNQTGYeBkhzx6XfFh33Fz9hYksdq2KQSqTTBJuDw43AB+03QHtrltAti+OyNvZ1vbc8g GiSpq5cWl+0IJWPXdokFs+YknTPQpFJPMxojYs/0JEFQZR3IP2DU2VwkWTq+D0U4tzsA NJoOvMabOYVu32pgmlq0GJ4qGRcencr8E//xNeGML4Fx6B2vA7B5ZMUvx6KTZD1GneGA DYCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dC8hprsM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a656944000000b00453f9620c4dsi380653pgq.503.2022.10.24.12.53.53; Mon, 24 Oct 2022 12:54: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=dC8hprsM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233768AbiJXTxS (ORCPT + 99 others); Mon, 24 Oct 2022 15:53:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233657AbiJXTwA (ORCPT ); Mon, 24 Oct 2022 15:52: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 9349889AC2; Mon, 24 Oct 2022 11:17: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 1F705B81212; Mon, 24 Oct 2022 12:32:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DA54C433D6; Mon, 24 Oct 2022 12:32:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614764; bh=pxzcX1ROjpWKjpZ7QbfdNIYZWj4LiTFYhQyNtt/GFNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dC8hprsMX6D3WhzvG7XXOnMyrX5gb6UWdH7yrVfHC7OJrdD9gCWRjhQPebEKz2Kdu H4P0NCnqTmaJQX7xvkbX4g/Y0imQSW8jHnquqZEIIHlogS+CvbhPvgQDeJ74N9x3vn 7Io8v/BR8eSS920B1hEgLPigsa7z9Imy//a5jwHM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , Justin Chen , Sasha Levin Subject: [PATCH 5.10 355/390] usb: host: xhci-plat: suspend and resume clocks Date: Mon, 24 Oct 2022 13:32:32 +0200 Message-Id: <20221024113038.120826036@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747600011004364250?= X-GMAIL-MSGID: =?utf-8?q?1747600011004364250?= From: Justin Chen [ Upstream commit 8bd954c56197caf5e3a804d989094bc3fe6329aa ] Introduce XHCI_SUSPEND_RESUME_CLKS quirk as a means to suspend and resume clocks if the hardware is capable of doing so. We assume that clocks will be needed if the device may wake. Reviewed-by: Florian Fainelli Signed-off-by: Justin Chen Link: https://lore.kernel.org/r/1660170455-15781-2-git-send-email-justinpopo6@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/host/xhci-plat.c | 16 +++++++++++++++- drivers/usb/host/xhci.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index dc570ce4e831..2687662f26b6 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -447,7 +447,16 @@ static int __maybe_unused xhci_plat_suspend(struct device *dev) * xhci_suspend() needs `do_wakeup` to know whether host is allowed * to do wakeup during suspend. */ - return xhci_suspend(xhci, device_may_wakeup(dev)); + ret = xhci_suspend(xhci, device_may_wakeup(dev)); + if (ret) + return ret; + + if (!device_may_wakeup(dev) && (xhci->quirks & XHCI_SUSPEND_RESUME_CLKS)) { + clk_disable_unprepare(xhci->clk); + clk_disable_unprepare(xhci->reg_clk); + } + + return 0; } static int __maybe_unused xhci_plat_resume(struct device *dev) @@ -456,6 +465,11 @@ static int __maybe_unused xhci_plat_resume(struct device *dev) struct xhci_hcd *xhci = hcd_to_xhci(hcd); int ret; + if (!device_may_wakeup(dev) && (xhci->quirks & XHCI_SUSPEND_RESUME_CLKS)) { + clk_prepare_enable(xhci->clk); + clk_prepare_enable(xhci->reg_clk); + } + ret = xhci_priv_resume_quirk(hcd); if (ret) return ret; diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 6f16a05b1958..e668740000b2 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1888,6 +1888,7 @@ struct xhci_hcd { #define XHCI_SG_TRB_CACHE_SIZE_QUIRK BIT_ULL(39) #define XHCI_NO_SOFT_RETRY BIT_ULL(40) #define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42) +#define XHCI_SUSPEND_RESUME_CLKS BIT_ULL(43) unsigned int num_active_eps; unsigned int limit_active_eps; From patchwork 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: 10122 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp633249wru; Mon, 24 Oct 2022 13:13:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5xrR8I2OkmK4OJFMUfE5MKJNSq+G+xm94+fZGjFPW0wD1qHeUC1PLHzjhJ31QLPSPC0m08 X-Received: by 2002:a17:90a:b00d:b0:212:f91d:88c7 with SMTP id x13-20020a17090ab00d00b00212f91d88c7mr11514716pjq.112.1666642431261; Mon, 24 Oct 2022 13:13:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666642431; cv=none; d=google.com; s=arc-20160816; b=lhWHPEhk1isRZsES0IxzpN6QBuHBMapsLo5Vly/tuPJpyfrzXuvyDBvSStYgDo6ajo EkQCmDCsOB/+Wy2lwKFCukzgkdtoZv3l8LrSCm1iHRve1XjHclMyJifby7PubS3pVVFL uEu6YkGUcr0hVM0iTVHxTzsgbR7IuUBM6Ir12TQ8CcIQPBT+c/ssfBPFBHePybxeMuz+ cDa5bUlaZC9PfQEqj5ExzqUeG/c9VVtwV/cY9hPnc2ZOMj6CE/ZEhbuSsDN/6tySGeM5 7qJlESTOl9m21OJah62T8jID8S38xtGt5WrBh6PhZ/JXINAg6pcjWIauulDGj9nYY9y9 M5zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=evwbZJi310Rh2Z0NekhGOVQ4nIW0q4SC8jyrlTTRmEk=; b=V538Mwi96qAZEyyoklvJ7Dw3uoB9R/W9RGI2QALpaJzdtyd/IrHIweMc3GVTITfdKy 7O5rQAjPIVXYD3CoVTJuQ8tAjkH2T48cPJAvbKjGIN0P9hNhgAgIxVvS90SDrgrcco/O rurpdr+SCJCS6LDQfBCMluc0cgtobDumTR43GY/42mTQMIy5xXjcyIZE/OmWukLcC8qm OziANCw0RWNf3aAO/Hviipp310+W0sXW2xR5Bgnw1ocYWl6hceg/v/yqOUQ1PTFnW2rJ RPXrEfy3AjKKcEAWmsbPlTL84KRTD9d16mVUGnhyjhq5dGo8v3M6biFdBQjlAQnTt9/n gM1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DqlTOAYi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a628745000000b005624037d3efsi600285pfe.295.2022.10.24.13.13.37; Mon, 24 Oct 2022 13:13: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=DqlTOAYi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233970AbiJXUBV (ORCPT + 99 others); Mon, 24 Oct 2022 16:01:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234358AbiJXT7n (ORCPT ); Mon, 24 Oct 2022 15:59: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 57E201B157C; Mon, 24 Oct 2022 11:22: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 AAA88B816B7; Mon, 24 Oct 2022 12:32:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15E0DC433D6; Mon, 24 Oct 2022 12:32:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614767; bh=eeYR1pQLtcJDxO9LFF9+dLExakAoN06GkoHBkN1iWGI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DqlTOAYiepW+0cLOAnj35Ot3vft68JL9DdH4Achk6AllA/jDmQuk5MUuPtbV5U0HK sQlDfELmTchM14eUYj2J++s3BBr3tKCxcWAcawzlCrWlhSL+7cjWx36n6rFQFX6cTx 4mQGY4EPX09lrINT1oFIGUw8mXJMDvTGu9D/osKc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , Justin Chen , Sasha Levin Subject: [PATCH 5.10 356/390] usb: host: xhci-plat: suspend/resume clks for brcm Date: Mon, 24 Oct 2022 13:32:33 +0200 Message-Id: <20221024113038.168196058@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747601253853918148?= X-GMAIL-MSGID: =?utf-8?q?1747601253853918148?= From: Justin Chen [ Upstream commit c69400b09e471a3f1167adead55a808f0da6534a ] The xhci_plat_brcm xhci block can enter suspend with clock disabled to save power and re-enable them on resume. Make use of the XHCI_SUSPEND_RESUME_CLKS quirk to do so. Reviewed-by: Florian Fainelli Signed-off-by: Justin Chen Link: https://lore.kernel.org/r/1660170455-15781-3-git-send-email-justinpopo6@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/host/xhci-plat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 2687662f26b6..972a44b2a7f1 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -134,7 +134,7 @@ static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen3 = { }; static const struct xhci_plat_priv xhci_plat_brcm = { - .quirks = XHCI_RESET_ON_RESUME, + .quirks = XHCI_RESET_ON_RESUME | XHCI_SUSPEND_RESUME_CLKS, }; static const struct of_device_id usb_xhci_of_match[] = { From patchwork 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: 9210 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp459202wru; Mon, 24 Oct 2022 06:39:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Y+6JQ7JuH/tIlxnqUmyR/jyD+M54DYBe/b0wNh3ZtbEeVCkYD9ui8PwIhQ23txoDYJSIM X-Received: by 2002:a17:907:6e18:b0:78d:b374:8989 with SMTP id sd24-20020a1709076e1800b0078db3748989mr27598343ejc.552.1666618745280; Mon, 24 Oct 2022 06:39:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618745; cv=none; d=google.com; s=arc-20160816; b=L6rGXaHhV7/O70lum1HfJ2bMu4jjx19rsiFBwtVt9ugCC3rj27R+DkbsxG3Ciz+anV kWc0V2RN1r+omHpaLGScgbXX4u13baTqb7OLApXOvq6Zl4PqJJMjJLnukC4tyMH1T9qx 1YE41ld03DmRtwGDexXph+w52w2TlStaTxYIJWW6ywFuQGrf4Nhews4sLo5sRIAhV+hd YFB6hNYsOGefHtFoOriVPsm0gnDoiRBMw3UcSCV0YyIzsPlJnuGWgOCd1x+9MI9kctue 0wmCteGqypnjFjl5eSY/COKNxHQKP2LUvb3IAj3OMoakdIg9E4MPlDm1/FJ+kytFR3Zz NeYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=E+EkB3tQO9JZG+0RKdhoOXuNUZEm2fBSKm/e6s1ywt5+kia4dl+JphIC0MLuQ3fTAr 5ewuc/h/eD8n8NjvJwXrbymtQKstpXfCjycGYCFNo5GPD9X09kImC0AamIBMiOUqRmFQ fj6y90bAKta+I/bmqPFTafEClRjp2oxOwb6L9dZUrltheB391FGV8eXI45fRPEcSgpIz JGDwjsFk7PucBkPwNnp7Nkznu2oBEsKOiAihGDta7pdNfjb754xHNC5C6Z7rruTYeD62 cCi0nioPlfApKjqwjhtPCn7wggmDlh7WbQOeLQsMWs0CgqPVVwJLxxiTAuf3jU7XvIzn 55LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dk6WjIp6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hg6-20020a1709072cc600b00791a41d1b39si17220750ejc.656.2022.10.24.06.38.41; Mon, 24 Oct 2022 06:39:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dk6WjIp6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236359AbiJXNfZ (ORCPT + 99 others); Mon, 24 Oct 2022 09:35:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236327AbiJXNat (ORCPT ); Mon, 24 Oct 2022 09:30: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 89E9BAC2A7; Mon, 24 Oct 2022 05:33: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 9B481612FF; Mon, 24 Oct 2022 12:32:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0A5EC433C1; Mon, 24 Oct 2022 12:32:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614770; bh=N/ic3nvsn6gbap9xn1FFJo7xJmazvDTuIdIeuNaNTDk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dk6WjIp6h0Lp3thwlTeuiCM89mC+g1X1wTpzxsvSMZay1MrW9b5eZ4YdzaeL2GSKB jxOfx9ZbEtgteQqEt3dqhatGYHfKsPHn7XwW9sqIh8G/XpVrzUvRfvVOrPRc1shLWB vEDwewK1CH6QCU09QzYIhDNukhTiNY3ZpzSpzUC4= 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.10 357/390] scsi: 3w-9xxx: Avoid disabling device if failing to enable it Date: Mon, 24 Oct 2022 13:32:34 +0200 Message-Id: <20221024113038.202753438@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576417365264963?= X-GMAIL-MSGID: =?utf-8?q?1747576417365264963?= 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: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: 9884 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp571185wru; Mon, 24 Oct 2022 10:32:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ksNLyymDJfJVpOTlVik8XI3IqwXdvIS846Epm51Va2yUKNsximCHc5H0lpC97wmpJJGD0 X-Received: by 2002:a05:6a00:1943:b0:563:8173:b46a with SMTP id s3-20020a056a00194300b005638173b46amr33777288pfk.34.1666632761959; Mon, 24 Oct 2022 10:32:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666632761; cv=none; d=google.com; s=arc-20160816; b=eyIBcx1odxlx7YMQ5VhrWeiXAbMKuHl5ldxIsw3L6pRlidnop8FEwk/0a9O5A9aEs/ uGc3K8xuwpTSaowu+OX0SuYKDR9AmmM+3JC6HmePdKM5ljGqm2xssL1XHTFVU6gxl3Ab WTeVMvjjrVYJL2eBJEPUk8mY42JJ6VSwbfHgODOmkWnAOX3BdcFr/T8Ude/iQvHoGFLf /rdB17SR7wEgkS9zQ3+gxom2YjbvvjHrDoBmFJS3lYnojthTxTc0orh8en9aUsIeCNie l7KaoM2B8C8cXEVumOLjc3PuXFlSzWh9KfmInblPw/CG1x4qeYVFHVNlNYe1pwocAdA0 eSqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KSb0X/FApwiPuKN+plDBynOQWCXhdlC8YtLovIo606A=; b=KRZRXOnfUQ87XdXpOoAYVlpRfodFjahYT4pY6Wj7pDw3TqeLOAbawY8bdhns3iPU9T oYjq74OPNKxH8cLVNyd9GrhsIp/vSNsS5hZqYkhVVN2JpfNJohnJ3uHeHKtsn1VEFoLl rmnVA9pEOWhCAX6j7vFZk2z01jzZz6dysCLQwwQoqJ5EOwy+5Hgo5Cfbd/7ISjIV3mXo +kN0WuxEBgx6zXgvxFSbzPiCyMSVmSY5VS+v82jZY8AR9T5aqGRoG+aL2jvEcmZN9F36 rhLpSBg1yNnA2AUX6aYlU2bSkYLP0BDNH6HLuZ+HoDh/wedw2ldWuqc9u5bL5o5tyRm4 PE8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mREXkcK7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a63d316000000b0045650af278bsi10837pgg.817.2022.10.24.10.32.28; Mon, 24 Oct 2022 10:32: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=mREXkcK7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232068AbiJXR30 (ORCPT + 99 others); Mon, 24 Oct 2022 13:29:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233364AbiJXR2t (ORCPT ); Mon, 24 Oct 2022 13:28: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 4B1723472F; Mon, 24 Oct 2022 09:04: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 92D6BB81711; Mon, 24 Oct 2022 12:31:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3D1DC4314C; Mon, 24 Oct 2022 12:31:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614691; bh=UR63eXK32mdq79RpdY/D8aufxHgBPZJACfCRDlovMcc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mREXkcK7qX+01GyJZ0MyRUZnhv3eNxmMpyg1L6doLbUm6hkTaFeXdFjQSibiy4DJE HSZXx/R1XqEeVSWsIv6FxSGVJom5VrfHQsB/oP1GSkZqs5LsfkoezAMUmynBdXwwmi H1liHgFcsrm3n9r8/JAHCFbIPDfghQiqRTV/wCog= 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.10 358/390] nbd: Fix hung when signal interrupts nbd_start_device_ioctl() Date: Mon, 24 Oct 2022 13:32:35 +0200 Message-Id: <20221024113038.239469781@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747591115422162765?= X-GMAIL-MSGID: =?utf-8?q?1747591115422162765?= 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 4a6b82d434ee..b0d3dadeb964 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -1342,10 +1342,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: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: 9597 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp529206wru; Mon, 24 Oct 2022 09:03:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4mQfMNOUVXZZayF6SA4p31wTfA84JJp3ERw8gFdvRaG5VkMsA6LO+qBueOpHjPL4lDg2if X-Received: by 2002:a65:6bd3:0:b0:42b:9117:b9d1 with SMTP id e19-20020a656bd3000000b0042b9117b9d1mr28613695pgw.238.1666627398152; Mon, 24 Oct 2022 09:03:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627398; cv=none; d=google.com; s=arc-20160816; b=KD5qrCTfTndEtQb3GAWl96EIhoLDm/jBVN95Iht0ErxvmSzpiJoJVW4+sjd3FyyQxe UoVuCk/ljYHKR6iEoPz/Oi8Dg3SDz+7A9GkeXGt/cYeVqs4LifM7f5684YSgh/hBcnNh FVTXRTVAcQyJRITjNKzxh4S9kdnO0El73Nkyj/rm0kKDMsGZa6T/7EeK4P9kc8le7bjN mmtLATlP3GhLdkQgf3OKbUET/XcKC7PVatdw3Trn6VbzdgY6CqD7q13x6fTUstvALrbB F+XYFJlTA2dKITj9vussXZMSgJ9QcN+0ToAh6OPZzat8G++fwuWsP0SWQ7aGcJhHLW0/ tADQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=QZg/ud0PR4HhIKufE3DtO9Ps8OikgAh8HSKmBubdDFUdYdqpdwHgzEB4KANq0F6YUv FBIcsBdhC1qnV42WqgxbpO1+l64bkNFnwzgqteLM2/hASH2+PTUgCtMo8g56AjcQSM3R LfHRx6MnB8BPdE0YBzJYSP46lIqF+qd1rr8NhnhNTEWoNRLAL2kwa+xtRB61NlEfqs3l 93JfWsVT13QhMkSpG3Q8fnVYKAmgqPlwPd3rv3uV1tCafhc/udNLEbMwLpD7Q0yWvasC IldUeWR5WOtcwxl1EucQXv6ZUWBqPUbEwboECNyC2DsUrx4SejfJU5hjr6oAOi0uxUz2 NBkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sN5VldWl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s1-20020a17090ae68100b00211f23d6f49si9305603pjy.15.2022.10.24.09.03.03; Mon, 24 Oct 2022 09:03: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=sN5VldWl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232561AbiJXQBv (ORCPT + 99 others); Mon, 24 Oct 2022 12:01:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232799AbiJXP7W (ORCPT ); Mon, 24 Oct 2022 11:59: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 1076A40BD0; Mon, 24 Oct 2022 07:54: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 29EF2B8136F; Mon, 24 Oct 2022 12:31:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 855CEC433C1; Mon, 24 Oct 2022 12:31:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614693; bh=PyVuP224LTfOgKeY7PGhWDcswJIc+RIZ/ujbhn1tRm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sN5VldWlkDacHmzuuKaQzuJGcOX1ydcNZy5fBzODSZVNfHD8/kFMC8/W05MRoAZJJ yyQljQBfay8OeZAotdi5Tgr8RUzlAEj9t/Lvd8qPTMIobwXoZLkrqI+X4efCl3+cjZ MmoZVa9xhKBFsOTX3jvef5WugWVTPDK+6d1oZWuU= 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.10 359/390] power: supply: adp5061: fix out-of-bounds read in adp5061_get_chg_type() Date: Mon, 24 Oct 2022 13:32:36 +0200 Message-Id: <20221024113038.282171909@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585490971032593?= X-GMAIL-MSGID: =?utf-8?q?1747585490971032593?= 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: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: 9556 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp519283wru; Mon, 24 Oct 2022 08:41:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6M7fMcpzpZm5mxVruGZk4IUfIQQNk/w/cZIzdm8CWyegOQDUO01VSTzixCUfRku31KSiZo X-Received: by 2002:a63:1a53:0:b0:44d:e5ba:5acf with SMTP id a19-20020a631a53000000b0044de5ba5acfmr27648227pgm.461.1666626088245; Mon, 24 Oct 2022 08:41:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666626088; cv=none; d=google.com; s=arc-20160816; b=UxoP2QKvcwMjfO8/2tHD061Xhh1rscPnxFqovqyZNNv24/KkaWropINohI2h0l8D0P 5PmN720yT7kae1IgXnCG+lbIgzGu+INSlcXvW0jyH4SFshovUB90hDc6OLGOVCm8u+6D yJGP6zlK6/UWtT/XC8iX7F4ISmHmagiJQEF6sff5ydQ6/jHTHAy6nVVb+7M9qUysRp9F Y2T49n/Rtqh528w+RQ9aDNf+OgojysmqjHSdykPe0e6QspNEgL0air2ax3gOEnavbjBq xQWYQuUp7EJoA/HXoNWP9eUO8qCsTS9EyOVcOgXF5pkIVHS8IzqBAuNcKIwCU5IflKNG +BQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NFwgjsoyaOJesc1Ss5O4VCV1gJR4V/TL4H1W8uGcVg4=; b=ZqOsD4uqs+cVtiBnCGBHX9W8+KXTd98NiI5F4hjG/MUT2m9NNfEH8KGttImGHcTu0w D1ltyg5emikmJUfvw3QOSaXTQjiXcBDHk1RKe1lBZBKFoCX7IC4q464910MI9CQujTCP 355sy2VqzvpDtOEYh2LhvWMGqPweHpY/cys74mnEJtohEI7uB1YkvE18IlCwpqoDRDCg 5UmgXxnSWg8M4ULXiPwivtQmhHvGDLI30zUTW4rukXIf8HpzyBwkyl7ppetQ8OrGRCqO R2n4B4TPsoFrxuPIDq533Cz+tJ13P9AXgBfZMcIZqopbVbOM0hEy0+Sh2HmfcV9E3B4Y jFZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=csh7SZMD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y4-20020a056a00180400b0056bc14f1cd2si12517pfa.10.2022.10.24.08.41.14; Mon, 24 Oct 2022 08:41: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=csh7SZMD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231397AbiJXP2I (ORCPT + 99 others); Mon, 24 Oct 2022 11:28:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231944AbiJXP1m (ORCPT ); Mon, 24 Oct 2022 11:27:42 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDD5CC8963; Mon, 24 Oct 2022 07:13:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 2517CCE13BD; Mon, 24 Oct 2022 12:31:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A37BC433C1; Mon, 24 Oct 2022 12:31:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614696; bh=XP41Tj68mNCGeN/XBl6NTU46Edzwp7ROZmpjlXBJb6I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=csh7SZMDSmgkMviDuzdgqgpQfpcAmtGnHVIPI19rr/KoS8GCZqIlsOvAIbeNhV71L mWJHlKCkJ/d4XrQ8ilZYw/E5nB5RYEaZSwAwEgC2wNiNJZjgZqR6okBvlnD2Oz3Ckb Tu0bqceXcuwFbGSn7LFOhf90KZ+d4fg4agyoVBaQ= 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.10 360/390] staging: vt6655: fix potential memory leak Date: Mon, 24 Oct 2022 13:32:37 +0200 Message-Id: <20221024113038.322912201@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747584117120881045?= X-GMAIL-MSGID: =?utf-8?q?1747584117120881045?= 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 0dd70173a754..343f0de03154 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -675,7 +675,7 @@ static int device_init_td0_ring(struct vnt_private *priv) return 0; err_free_desc: - while (--i) { + while (i--) { desc = &priv->apTD0Rings[i]; kfree(desc->td_info); } From patchwork 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: 9215 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp459237wru; Mon, 24 Oct 2022 06:39:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4+gni3Quwi+fmDFFqAUlinuK1FyREySBs6VNifHkF3xifjvHVjqoHPAq1C0lswykQz53cm X-Received: by 2002:a05:6402:1d86:b0:457:e84:f0e with SMTP id dk6-20020a0564021d8600b004570e840f0emr30599330edb.241.1666618748945; Mon, 24 Oct 2022 06:39:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618748; cv=none; d=google.com; s=arc-20160816; b=ugJSR7Gr4XnK29ci4x8KNM5YDhssJVFR9pmhL0Qr7amRrFCbC4uym56bEF6ftDwN4j 73UogoBsl+v+mcarl4wY6abVvVv+X73T3gE0V+V1rCoRHLUQ/jJVte9FK7XukqoNpuDH 0LWao6jgqpjhKOCwmnmPWHYgcuy38RSp0BgOEd9g+8Rzr2g1QmyD/sOXMX2R/utTtRU8 XyhhvNJzfOWAWkgJmZiHqkKjhbW30fnbBdhMOqc8jrd+MEtY5NpH4da5+aCQbTADdqD0 RHeDmg0i3XhnDn8vremJ2rRyZ234YxJslejHumRBGuBi2TJ/TLlifPqGfaGflnepuKtv srqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FXvPYFDkJe26cKCP95AmcLeHvoYKFfADUu03GmNp2Vk=; b=zt+997hpD5CeFCpmKJ28ED49U7uftdv0YqglABC61j/LfdqUZ+RwtqTH6WRWkKm1iU A/euR7LtaV6X2hmEGgsjm/aIJ+5KDloG7/zDkRmwA5uFCfzoplWd36kfIVNmEh6hSc1C x6RDc9carSlGkccugEHS1nvBA2mZCEltqmwzklM0PD3l9BGm2k7kdJZI31iZ/9H2/nPo cA28lX30NzvkWjDbYQ+6FWqbGffybG8DMUHby0DuwUXoBWjCR1X+QNHXJmKIXdKR+vKK EKRaI9yw6J6ErB938mFquSCGEqg8gzTwNCvegPav9FvLOB7egYB36kSeV06c92uyCQZ0 BFpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ADWkvwv5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne22-20020a1709077b9600b007701a050273si32473997ejc.942.2022.10.24.06.38.42; Mon, 24 Oct 2022 06:39:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ADWkvwv5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232499AbiJXNfq (ORCPT + 99 others); Mon, 24 Oct 2022 09:35:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231640AbiJXN2r (ORCPT ); Mon, 24 Oct 2022 09:28:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E682AA36F; Mon, 24 Oct 2022 05:31:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 98F3C61280; Mon, 24 Oct 2022 12:31:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AED34C433D6; Mon, 24 Oct 2022 12:31:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614699; bh=p6GiSY8fKFEwVLEYaOs1ega9J3UWlailRKtYivPY8dg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ADWkvwv5LE+JOxdbESB5viC1rvWlvR1Pi9O1ZbeX2t8IQggPbygxtoWt/NPAew0/Q tVLx6SpjJI6eUgN38pM5gJ287JvmTu+tr3VzEF/JR8R67QsKhAuIVpZeahZUCsNjCj ACCutL6DbKFDDNn/RNMuLiDLuZAUBhvcTaY9d7hk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yu Kuai , Tejun Heo , Jens Axboe , Sasha Levin Subject: [PATCH 5.10 361/390] blk-throttle: prevent overflow while calculating wait time Date: Mon, 24 Oct 2022 13:32:38 +0200 Message-Id: <20221024113038.365489430@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576421792111437?= X-GMAIL-MSGID: =?utf-8?q?1747576421792111437?= From: Yu Kuai [ Upstream commit 8d6bbaada2e0a65f9012ac4c2506460160e7237a ] There is a problem found by code review in tg_with_in_bps_limit() that 'bps_limit * jiffy_elapsed_rnd' might overflow. Fix the problem by calling mul_u64_u64_div_u64() instead. Signed-off-by: Yu Kuai Acked-by: Tejun Heo Link: https://lore.kernel.org/r/20220829022240.3348319-3-yukuai1@huaweicloud.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- block/blk-throttle.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/block/blk-throttle.c b/block/blk-throttle.c index c53a254171a2..c526fdd0a7b9 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -944,7 +944,7 @@ static bool tg_with_in_bps_limit(struct throtl_grp *tg, struct bio *bio, u64 bps_limit, unsigned long *wait) { bool rw = bio_data_dir(bio); - u64 bytes_allowed, extra_bytes, tmp; + u64 bytes_allowed, extra_bytes; unsigned long jiffy_elapsed, jiffy_wait, jiffy_elapsed_rnd; unsigned int bio_size = throtl_bio_data_size(bio); @@ -961,10 +961,8 @@ static bool tg_with_in_bps_limit(struct throtl_grp *tg, struct bio *bio, jiffy_elapsed_rnd = tg->td->throtl_slice; jiffy_elapsed_rnd = roundup(jiffy_elapsed_rnd, tg->td->throtl_slice); - - tmp = bps_limit * jiffy_elapsed_rnd; - do_div(tmp, HZ); - bytes_allowed = tmp; + bytes_allowed = mul_u64_u64_div_u64(bps_limit, (u64)jiffy_elapsed_rnd, + (u64)HZ); if (tg->bytes_disp[rw] + bio_size <= bytes_allowed) { if (wait) From patchwork 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: 9360 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp476237wru; Mon, 24 Oct 2022 07:13:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Oiq1pCa3FRAEherkhML4OiHkrY0TRoFQk3/yTFo2mGT7BZjMGly64MCd2XxSSsMDSDHOw X-Received: by 2002:a17:907:2d89:b0:78d:9c30:452b with SMTP id gt9-20020a1709072d8900b0078d9c30452bmr26336259ejc.533.1666620812028; Mon, 24 Oct 2022 07:13:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666620812; cv=none; d=google.com; s=arc-20160816; b=INGOCsXf628nJZZ1UC4Wdf3MpZFNSepu8i1T1bbxnqIZImR6h9tfBZBtthPcavZ+nr wntGIs6CKKTxAyuq3n5pLu6GRt8EVXCyBfgf8aaZpVDwXZ6r3M3/3E8EgKU5jCaqYupj al3X2tp6s1D5jqngK94o+nt3F0alDRKMSakjQWtA0aSDEkGz6fsteq7OElxu62CNz5BG Tvnl98foSCzuNGY/MEsniVhVymlJkcz2bupwaUVClP/7nBPegUaVKAmKkPhCQtKAgLQc YvHwbSkamB6VsaKJldjbtE4K/+pSUyv7fyyYMGsHJoZo+GX5CPeOI/eweTnLAwsE9BIL O35A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AaUhWEz2XIGNtScn4QMC+WmDjQ+8BXUOG+rblKALsP4=; b=CcGmdmlCPoMOtgxwrO8FPDs7HNQTrbQLcQnCrDl/FaoF7mT8mENFy7jybTnaV34lkJ ZqT+hn8MIa4stRjOihLXjMtv+IElAmK2an1vJuuv4n7cwaW7PCfCuKR+PoqTj036A92M TgMPoNdbiLlCQTWLPgpJC/jOT2P5ejwO9IS812pbaCPSQIkwR7f9yqhmWy6S53f9QQrD SXBnbYF5J1J3y6EwAZ9KtUMl0svE59auNqtYMjzz5Y2RzC+asPXcIWFhLMHACCwfz7MW +Kk0ZvWctvH5cqdf/fRQSAtO+G37AKn0rKaq/OH1Qe2HgFskMjCegox/OGq7S601dcWJ wMBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZnmZKdqy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020aa7d04f000000b0046109fd5943si6242499edo.544.2022.10.24.07.13.07; Mon, 24 Oct 2022 07:13: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=ZnmZKdqy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236717AbiJXN55 (ORCPT + 99 others); Mon, 24 Oct 2022 09:57:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236772AbiJXN5e (ORCPT ); Mon, 24 Oct 2022 09:57:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A5FA61128; Mon, 24 Oct 2022 05:45: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 6D1F8612DD; Mon, 24 Oct 2022 12:31:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DFA5C433D6; Mon, 24 Oct 2022 12:31:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614701; bh=eYYfN7zhVXu7HoSsesfCM1CBNUKWw1PFo052PAgMnNo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZnmZKdqyKAGS+sa3hf/Wi18sOMGCNc1rcikJzHkELZMgGL3DTwRO6HiKDKl9/YbSB sgHPPEWQLokdK+sLrKgZ/TUoGvzgMituPzLthtwf5vdKCUBZAEfWq6gkNvt4W9mdLj WqUSE0amRS1lx3CqgnqhxgR9mZR27Bzi/bKGisDo= 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.10 362/390] ata: libahci_platform: Sanity check the DT child nodes number Date: Mon, 24 Oct 2022 13:32:39 +0200 Message-Id: <20221024113038.411997440@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747578584854744371?= X-GMAIL-MSGID: =?utf-8?q?1747578584854744371?= 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 0910441321f7..64d6da0a5303 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: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: 10160 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp640127wru; Mon, 24 Oct 2022 13:31:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Zbo30yY6O8JQuXTnsIcGKdq2TD/8DsJ8VyDqqCNcOJZY4iWzTZN03CZMJCaVdiNOerptJ X-Received: by 2002:a17:907:6e1b:b0:78e:15a3:5be6 with SMTP id sd27-20020a1709076e1b00b0078e15a35be6mr29645727ejc.750.1666643508648; Mon, 24 Oct 2022 13:31:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643508; cv=none; d=google.com; s=arc-20160816; b=hmKH+ypuGu6ZhmoGEbWDzLESDoCeOcw900oK3i0GQwdwPzyUZT9NxlFfXfaX4zalVT YO0tvLfSoApD1jvXBwQIUvVD221ZlCKPLR/LwnR1gqzEI6hV70RUJ0keFKc85L5rNsVm wRgR14DSGG1AJMNjLJp4msuwo4lWtQ7ica7nWDKsq/ZDh5P0FsJDgbabeUA2OpqcgsDn DCi0dw+jjt3WCEWNlrf7SIRJpSrX4RKYALSzr0GZbm/Bid+G9q9l9+mXY+r9ZppDvzg7 u8Tcg0jO5MjHz00jOBxPOt4Zxl8omE+TrMqiYbe+ypJGDqJ4UJS8LiwgvD98ONnGezAQ FWqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oUNRmBaJyiMgq59VSHEGkjjpBqSHzeskTIjTR9dkllo=; b=KkqbW/madow2iTWXp2/k9EiaxLsgYS/3rK+y9YLJ4coFUDCBXcsOLjVkhvgvNaKPV+ 5MZsKtwtnVkWYvaT4KMG7PszMcTcOZF0oQPP0+ZI+igZhJqs7HziaEGvv5BmNRPxuDun aOMr8YRUs0b/XuQHCjmqNEfXL+8+/5MhJmKi6Mi4qy48TfHlJFs5voE1kd0ltztZJ2Zf E8Hm4ka1ykHGkWrq+Qbfpi9uq6q1sNQJPKm5p3rlSHNwtHf1ALJ9WAnFrkG7b8V9cGfa 0a8hmVB5KqLi8OFbvz2jjK/DJUT2Qayf1Kectq/FNw9ZgQzIB1cwC8xjSiQnCRDnNTe0 twEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=X5SruKY3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa23-20020a1709076d1700b0078d9c0e8971si698527ejc.752.2022.10.24.13.31.22; Mon, 24 Oct 2022 13:31: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=X5SruKY3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234019AbiJXUOu (ORCPT + 99 others); Mon, 24 Oct 2022 16:14:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233985AbiJXUNw (ORCPT ); Mon, 24 Oct 2022 16:13: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 15D8B2ED66; Mon, 24 Oct 2022 11:32: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 BF439B81710; Mon, 24 Oct 2022 12:31:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22069C433D6; Mon, 24 Oct 2022 12:31:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614704; bh=UMLoBgi4k5Lyf0I6VJ8FPvogfAyJm2Wqk4bnqOfZTXI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X5SruKY3ZEjxaWWwo+hpHsn4sxcazwzHt/Y1Y6WE4E/DuhpxcbnULV7XTsDkvrb08 baDXNFd8wEXa/Rce53BDWCVlf6ACqLi5OMXJw0YjZTd+L9EWZaCmj2RDXczLgYsjd6 OlidRUf7BK99QOVIMdAzrF3dRIdILomT1c/tKrfg= 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.10 363/390] bcache: fix set_at_max_writeback_rate() for multiple attached devices Date: Mon, 24 Oct 2022 13:32:40 +0200 Message-Id: <20221024113038.457305777@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602383376783732?= X-GMAIL-MSGID: =?utf-8?q?1747602383376783732?= 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 a878b959fbcd..3aa73da2c67b 100644 --- a/drivers/md/bcache/writeback.c +++ b/drivers/md/bcache/writeback.c @@ -119,6 +119,53 @@ static void __update_writeback_rate(struct cached_dev *dc) dc->writeback_rate_target = target; } +static bool idle_counter_exceeded(struct cache_set *c) +{ + int counter, dev_nr; + + /* + * If c->idle_counter is overflow (idel for really long time), + * reset as 0 and not set maximum rate this time for code + * simplicity. + */ + counter = atomic_inc_return(&c->idle_counter); + if (counter <= 0) { + atomic_set(&c->idle_counter, 0); + return false; + } + + dev_nr = atomic_read(&c->attached_dev_nr); + if (dev_nr == 0) + return false; + + /* + * c->idle_counter is increased by writeback thread of all + * attached backing devices, in order to represent a rough + * time period, counter should be divided by dev_nr. + * Otherwise the idle time cannot be larger with more backing + * device attached. + * The following calculation equals to checking + * (counter / dev_nr) < (dev_nr * 6) + */ + if (counter < (dev_nr * dev_nr * 6)) + return false; + + return true; +} + +/* + * Idle_counter is increased every time when update_writeback_rate() is + * called. If all backing devices attached to the same cache set have + * identical dc->writeback_rate_update_seconds values, it is about 6 + * rounds of update_writeback_rate() on each backing device before + * c->at_max_writeback_rate is set to 1, and then max wrteback rate set + * to each dc->writeback_rate.rate. + * In order to avoid extra locking cost for counting exact dirty cached + * devices number, c->attached_dev_nr is used to calculate the idle + * throushold. It might be bigger if not all cached device are in write- + * back mode, but it still works well with limited extra rounds of + * update_writeback_rate(). + */ static bool set_at_max_writeback_rate(struct cache_set *c, struct cached_dev *dc) { @@ -129,21 +176,8 @@ static bool set_at_max_writeback_rate(struct cache_set *c, /* Don't set max writeback rate if gc is running */ if (!c->gc_mark_valid) return false; - /* - * Idle_counter is increased everytime when update_writeback_rate() is - * called. If all backing devices attached to the same cache set have - * identical dc->writeback_rate_update_seconds values, it is about 6 - * rounds of update_writeback_rate() on each backing device before - * c->at_max_writeback_rate is set to 1, and then max wrteback rate set - * to each dc->writeback_rate.rate. - * In order to avoid extra locking cost for counting exact dirty cached - * devices number, c->attached_dev_nr is used to calculate the idle - * throushold. It might be bigger if not all cached device are in write- - * back mode, but it still works well with limited extra rounds of - * update_writeback_rate(). - */ - if (atomic_inc_return(&c->idle_counter) < - atomic_read(&c->attached_dev_nr) * 6) + + if (!idle_counter_exceeded(c)) return false; if (atomic_read(&c->at_max_writeback_rate) != 1) @@ -157,13 +191,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: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: 9436 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp479238wru; Mon, 24 Oct 2022 07:18:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM54zx/acDcQYPX8G53XYbybxVNha7JGIyTWtu2uvsOmkcDhUD8O9A2pLhqIGaQD7/5hxYgL X-Received: by 2002:a05:6402:298d:b0:451:5fc5:d423 with SMTP id eq13-20020a056402298d00b004515fc5d423mr30496241edb.102.1666621125578; Mon, 24 Oct 2022 07:18:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621125; cv=none; d=google.com; s=arc-20160816; b=AAjNNWja4zUtL+NdNVRkge2uCH9vhbcsp2sv/yFrmskRcgIf1TcH2frzubzmYXT323 IWd9YNllFgx+AFRxF/az8re/tVxq9YadRB50OL6UjZEtsKI/eK4tLINgW6bLImibxAB/ 7capW1LoP0wC+yQsnYDKFL7jCm+0vxLBxv4HJ/Z15kTHJSbjNftqhSiK5IMBgV/Wgitk j1u2GpQQ5XCnfYnqNWSP/txjgripocirbIFeTnswl5auFTNWMSmcZK8GRK8i3il+t0NG 93RDXQwXxmxA7a3yQXnA5bwu5ujX8UeKhLAHqbz3QSEUL8R+4/zGII79dPA3wl2kZ/gR lDuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=55i4xDSgE2IbVtFLZLygVL64rS+NZAVGVtJgnedq9ao=; b=v0rnZGKyNA8AaYh1OpUyVpcbQJN3g/Js3kbT4gU8oOWLFflX3GtARokuWQRacIAhup kgbMoMOMRVReNnWi+V76a4hWuFizBigMYuO7wB608Dzgod26CwlNH9SjqjGvDsS/MUvl vx3CpeVV4jXOnBFrjRmB9oMKcOZqbQkEQzTxq9YJAQdU7ngD/dGsRv48ZRn+dNrrKEGN Rd1BEylo3VvvklTu1e6QhlOzXyAiNCqNQF8GlRcJwVOWO42UyxCy3mV4UVS0HKGcMTAX gLVzrL5LvOzWKDkz+w/2fRxVJyb6B+HEcoCsFcW3rlDP1ajkv33LsSmFFtOIg8wkXAq9 jXAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=z+spuVQC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ez14-20020a056402450e00b00461d9b36740si1838358edb.240.2022.10.24.07.18.12; Mon, 24 Oct 2022 07:18: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=z+spuVQC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233450AbiJXONS (ORCPT + 99 others); Mon, 24 Oct 2022 10:13:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237168AbiJXOKT (ORCPT ); Mon, 24 Oct 2022 10:10: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 E4AF3C8234; Mon, 24 Oct 2022 05:52:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5D34EB8125C; Mon, 24 Oct 2022 12:31:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B305EC433D6; Mon, 24 Oct 2022 12:31:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614707; bh=Af8giS2+ZfpdZxS5MHM8Plt2o38OtS7fPeNrZbHoCb4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z+spuVQCWbSyFqKhLvWyHTvaQHzSG+Vp+lGcdRfYujMIuig+IfEWCDlcvlN6qF5LK MiPilTmgtZycf7R/4DhIcQPcNNhWgEIfxli0i5JlgU8K/tHxVeZHsWyvB0VsLsHmjE s0/SC48i+itijmqAD+I/3CQwfAZgXbBZiSGUwUU8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Fitzgerald , Pierre-Louis Bossart , Vinod Koul , Sasha Levin Subject: [PATCH 5.10 364/390] soundwire: cadence: Dont overwrite msg->buf during write commands Date: Mon, 24 Oct 2022 13:32:41 +0200 Message-Id: <20221024113038.497535574@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747578913085839774?= X-GMAIL-MSGID: =?utf-8?q?1747578913085839774?= From: Richard Fitzgerald [ Upstream commit ba05b39d265bdd16913f7684600d9d41e2796745 ] The buf passed in struct sdw_msg must only be written for a READ, in that case the RDATA part of the response is the data value of the register. For a write command there is no RDATA, and buf should be assumed to be const and unmodifable. The original caller should not expect its data buffer to be corrupted by an sdw_nwrite(). Signed-off-by: Richard Fitzgerald Reviewed-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20220916103505.1562210-1-rf@opensource.cirrus.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/soundwire/cadence_master.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c index c6d421a4b91b..a3247692ddc0 100644 --- a/drivers/soundwire/cadence_master.c +++ b/drivers/soundwire/cadence_master.c @@ -501,9 +501,12 @@ cdns_fill_msg_resp(struct sdw_cdns *cdns, return SDW_CMD_IGNORED; } - /* fill response */ - for (i = 0; i < count; i++) - msg->buf[i + offset] = FIELD_GET(CDNS_MCP_RESP_RDATA, cdns->response_buf[i]); + if (msg->flags == SDW_MSG_FLAG_READ) { + /* fill response */ + for (i = 0; i < count; i++) + msg->buf[i + offset] = FIELD_GET(CDNS_MCP_RESP_RDATA, + cdns->response_buf[i]); + } return SDW_CMD_OK; } From patchwork Mon Oct 24 11:32: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: 9162 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457807wru; Mon, 24 Oct 2022 06:36:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4C68m/ZKdyFqZ6oidBNaJwcbHIJ34PqWPqRsncNt5lrWa5ndrEAxqKtfwEtP4V92OOXchH X-Received: by 2002:a63:9:0:b0:461:f0b6:759a with SMTP id 9-20020a630009000000b00461f0b6759amr28229969pga.153.1666618594058; Mon, 24 Oct 2022 06:36:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618594; cv=none; d=google.com; s=arc-20160816; b=u850C8+Ha8auYBiDLHV7gQizkFEJm3G21ADpi04pP6toSDPbZyfZsgx3d043VuDr3e bwdUje3yZNfpVZ0PlLsKKITXL5G0LiqweVRuqxBtgbWQq40gXX4TK5gmwKTOSczxFykE Y1GQlu5ldMofRotVMJBllQU4hMbLpd4FGhekVWebAydlVXPo1UjGzESAuXc3kNk4gCTy caAR2ut5U/wjzQKu8ne+JK/waEgGLq9ENZBmMB3BJ4t5nG0k52v8FCpgm88LEPEwPGK6 2G999KnwjTHzdRCtBkIGcps8KKkbswCTJzeYhlAOj2J13vIPtjRt08mIg1xc+Pq4u+9T kwvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/y9mpkCYtypgQv5fxqagbW7pObJRTEvpnr/Rmei1qHQ=; b=M0MiFdkHsk6U24QM4wplHpYxWMsaCNa18DfSERMowW6qB10QD1NZwNDEOGUchnTYIY rKT8SiRmAxGrPH6b+SKGe6avpdqA/Vx6J1v3PnUqQkSnNitvYz4PMIdFB7NUWG+JM+W3 nn0KZ0hkT2qezX8s2HBzhpXY4r07/yTNaSGGmpBFUxBAL3bFHwcLs1TSZl/GVdhBOQ72 NEMHpRBM0+CWORrXHgWaPHAA8qvCElgvWXc5vfOrkM2ljdv8gSW875v4s0W2kND82mec aUZP8Pgs12OUsG9iolZec93BF+FTgDoMBnENa5E5N1rlmZi+qutKtlsaRvsCkRt+mfBf AFGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ljTaymOl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q82-20020a632a55000000b0046ed54becfdsi8447688pgq.30.2022.10.24.06.36.17; Mon, 24 Oct 2022 06:36:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ljTaymOl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231809AbiJXNb5 (ORCPT + 99 others); Mon, 24 Oct 2022 09:31:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232520AbiJXN2s (ORCPT ); Mon, 24 Oct 2022 09:28: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 C3F8CAA349; Mon, 24 Oct 2022 05:32: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 5A86F6130D; Mon, 24 Oct 2022 12:31:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AFB6C433C1; Mon, 24 Oct 2022 12:31:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614709; bh=y1DBNfu6J+1iXQV3cyheZ8RvEKrcWUOykKgA/HCuzNU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ljTaymOlqSXrUTN4CpjKh+sy2yllVu5XHvdWSnWR03lNg27CnGFEf91cQYKdTDQJp TbqKN62+aVAxhTibAWQolFF6Z14HhlJ0zsON+GvgygvB9YcS4/hmkCMO43B7PRu7EG VUIU6tGk7oKIiU+DcRSziLPa8jMsx+u08+2BHA70= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre-Louis Bossart , Rander Wang , Bard Liao , Vinod Koul , Sasha Levin Subject: [PATCH 5.10 365/390] soundwire: intel: fix error handling on dai registration issues Date: Mon, 24 Oct 2022 13:32:42 +0200 Message-Id: <20221024113038.546823903@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576258980665708?= X-GMAIL-MSGID: =?utf-8?q?1747576258980665708?= From: Pierre-Louis Bossart [ Upstream commit c6867cda906aadbce5e71efde9c78a26108b2bad ] The call to intel_register_dai() may fail because of memory allocation issues or problems reported by the ASoC core. In all cases, when a error is thrown the component is not registered, it's invalid to unregister it. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Signed-off-by: Bard Liao Link: https://lore.kernel.org/r/20220919175721.354679-2-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/soundwire/intel.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index 824d9f900aca..942d2fe13218 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -1470,7 +1470,6 @@ int intel_master_startup(struct platform_device *pdev) ret = intel_register_dai(sdw); if (ret) { dev_err(dev, "DAI registration failed: %d\n", ret); - snd_soc_unregister_component(dev); goto err_interrupt; } From patchwork 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: 10157 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp640047wru; Mon, 24 Oct 2022 13:31:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6c8q9/aSwc2QCzAccnzaqV7j5LxMdDCzitaczlxXEOh3eLzemGDBaM5kTijByOHAbIIg1N X-Received: by 2002:a65:4b85:0:b0:46f:63e:9e30 with SMTP id t5-20020a654b85000000b0046f063e9e30mr6170897pgq.409.1666643499524; Mon, 24 Oct 2022 13:31:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643499; cv=none; d=google.com; s=arc-20160816; b=FtAeXvbkwg0OLhdDDIv7tpZWcOlx2EWOUHu+kBtf/Zj0OjzqOdtvBiLNGpT+xwdFuD hB6CVWsHBSv9uoJCMBDglThGFAj24Ai6hJMZfJtP7+tKU9UX2JeZfLBQL3razE3FwOeo 8CeLq6H5FLkECI05L8Jpt7oRRtu5nV0XXVL1r4Ms6FwLgkSxD5+vRBoIWD1K3TRWbChn GNEI1BcaS6siPYNX3o1ptkis2EuD1tg5KgGVvT7iSfgSGAzfzHefTxE34UbPWzWumROm caeHIgoMB2p4SxNQr9t+Z7cRvpHlYTJWt/ej2wKVH/aK+kf94cJ576Z/mutWGtIV7Ww3 9V9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=k6JcXCzMM3vdIBwFo6UdxbLUkom/ypIc9guZsKNGotIZwNfzbFASyGhE6dG3G81FPM n2mKbjHMnlTDAjHu4MHV8b2DmsInvw5c1aziiTVhAomglgTnoQRAiIm40UQjFb1EDeZA mQI1qP2YxS9+u9E4NnAwd24DqhrQE70ANQelddGrQ5RU8On15jp8ccdzlfCz2uAi8N3h qsygYKdImkz8/krrEZSQ//RzkiawxtAA+XwoHKj9XMa/W8YlgUfE5uJyjne2hipSCTph zH2wsYDbhRM7DJeArQeWowswPmJD7p3lFlv16/JZ2ZM1H8mfofBVkEZIeFiw2wvpqihR Jtog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BE8+CxG2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x191-20020a6386c8000000b0045fd7ef7478si501636pgd.851.2022.10.24.13.31.24; Mon, 24 Oct 2022 13:31: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=BE8+CxG2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234150AbiJXUVR (ORCPT + 99 others); Mon, 24 Oct 2022 16:21:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234145AbiJXUUs (ORCPT ); Mon, 24 Oct 2022 16:20: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 EF64610EE6A; Mon, 24 Oct 2022 11:37: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 AB32DB8170E; Mon, 24 Oct 2022 12:31:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CB06C433C1; Mon, 24 Oct 2022 12:31:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614712; bh=D8ozL383GaaeAGtKQvIA9IdpVRSMEvGm6dPoBfIkAio=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BE8+CxG2ZyrZVDGvIGm2WQcMQuYIqGHg4+SSuLzsSX7QjLb5WWb0c0gyJp2SZ/ox/ 42bdF/7BdZFKwlCddx2KKWAZRmKkAs5rfnpaJDPw/pYojafyEw4rxXKKkjU5elyusB zbL2dY1HaH29OtCAdIb1orAzwWGT1gR29mk3zoLU= 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.10 366/390] HID: roccat: Fix use-after-free in roccat_read() Date: Mon, 24 Oct 2022 13:32:43 +0200 Message-Id: <20221024113038.588672567@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602374131088029?= X-GMAIL-MSGID: =?utf-8?q?1747602374131088029?= 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: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: 9325 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp465842wru; Mon, 24 Oct 2022 06:53:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Ap8iJ7KMyDh/C6IsqhK1Z9+HL7EMKkIADutO/0uhzJ5LkqimWXa0h8XFTkzOp/gSAWzsM X-Received: by 2002:a17:903:2284:b0:178:349b:d21b with SMTP id b4-20020a170903228400b00178349bd21bmr33768026plh.49.1666619616193; Mon, 24 Oct 2022 06:53:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619616; cv=none; d=google.com; s=arc-20160816; b=BQ3ZOSlHLQ1R1e9ilpRaiq9WvjU08KlpyGuCLW7fco3oKq5IpXb8OtZDxai/ndhL98 X6y5yVFl9Qq10BOO0Q+aDRZzXdPaEpRkzEea+P7XtIBp3y95IKu5SgcyTdBPSHBx5dPL K+sVkiyDaF+/S++X4qOHKh/R7JeNklHhvZBo+6MKJBKRuYBeLGrDaVNc4qL3XcOwRwkr 10wVXFflMJl3wQe1ux+UwTCbgfuSEmlihLTBIsTXy0v1GkZbgt2CicJ/9wV+z0KFdWna skCbiybksEAnA8WRKgrX1Stw3xrdsfSQSV7nQGKCy97YKTwzLXKJLUE8e0yAvdZZs61z Ifaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5MjHDxgNgi1xjxqcKjnBJR9CRxXafpBWOdYwwUavTEE=; b=bsMLVYl+2uoV7SOBi5KqEMKhjuecLBtPb/EdGh+Yx8IJaQAwfk8RShRYb4NM8HLVYG Z7O3CzdAlbHwHcRPOVE7UoZRJ51gWQBya0JCs20CAw5d9HySkKn+uWnX2oeO2hQJnuWC Xv88MNtOeNlDZyEjUI0wOw5OQrN25BRRpJlZaf4/r7QPVohL7mBu1eQyl2J4rIoKma7X +3F7H5S+4aoHTBCI56pcqj34emBnzTUfBIR6hOCOTxypI1vz1gB7MXBzzET46ei8TnPP ULvLniDL9iB8COnhNIaCIH6W2ZYvDkDVD7zFb94GxSXvuknZHeIj4MhDgCEEOMxgrdsU ayvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=x0KOkgQl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q197-20020a632ace000000b004276c7b2253si35044514pgq.584.2022.10.24.06.53.23; Mon, 24 Oct 2022 06:53: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=x0KOkgQl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236673AbiJXNw4 (ORCPT + 99 others); Mon, 24 Oct 2022 09:52:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236546AbiJXNwO (ORCPT ); Mon, 24 Oct 2022 09:52:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5884BBE3D; Mon, 24 Oct 2022 05:42: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 9D036612B3; Mon, 24 Oct 2022 12:31:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF318C433D6; Mon, 24 Oct 2022 12:31:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614715; bh=ZLHmBl7SgzlYxWJA7nPniQHE3Slsklt5AB8R/hjdLz4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x0KOkgQluakBMDrjyXAhDQlsYkgju0MRK0erK2+3/B6zoMRBeSt/wlGqAcH3tDF6e GgiWxKpXjRpdisNGRobIoDwpvrN61r8Gi0cKcngrhQgDD9nKYuuiQSsDBwfU2Ne+Ez r93rUfG1y4Wz1uLWVytn3QJWsS7qgHLTTRwKHdyw= 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.10 367/390] md/raid5: Wait for MD_SB_CHANGE_PENDING in raid5d Date: Mon, 24 Oct 2022 13:32:44 +0200 Message-Id: <20221024113038.632818385@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747577330652885461?= X-GMAIL-MSGID: =?utf-8?q?1747577330652885461?= 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(+) --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -36,6 +36,7 @@ */ #include +#include #include #include #include @@ -6519,7 +6520,18 @@ static void raid5d(struct md_thread *thr 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: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: 9232 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp460902wru; Mon, 24 Oct 2022 06:42:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4M+IVNgVcxig7ePrMAxEm2F1nlEjTbIGTvZGo5FSUCrQDWrElkDRwTNVgBb30kz+5Sa4fn X-Received: by 2002:a05:6a00:1505:b0:56b:6d78:3304 with SMTP id q5-20020a056a00150500b0056b6d783304mr14491315pfu.44.1666618962467; Mon, 24 Oct 2022 06:42:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618962; cv=none; d=google.com; s=arc-20160816; b=EwIWpO8GDpg6fyIXX7RWoi10yPta9vfrir/C1AaeIzN5xMtudpt5lOBqmkqhkKB9Pp TnqxuWyR017M9oG8X3pX/ISFoKCiFFi4yHzsWL2JkeMnaeBtMmj/6mgPwhUwAPbZ2nXe 9iw3SfAjK8nwBEOjrpgOz0iI2rwuIR4fzHyRQpyD979iibIkqvcERm7OIShBJR2dHACs EUzQHoq17gXSF7uYnhubjIe28s+FglgR5dp09H6xUg0vzCMYk2N0wHfb0l7FrJYtfBYi wpiP4B8d8KxoqFVEXfOfsonoPcoGMV9ZivNn1y/cUtx+pL8lM9GMgStKZIljE2hqBljo cPxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8KGx8gzHH05/DhXjVKcnsb/CjFEqOl9FTlG2T+IUcdg=; b=UeaBs8JxRFJ7LwCnib9LXc4zPo9vH4XMvaKcQE1QwqvniQpLCE2WNIw9x4cfgYonEA 1GuQSCNtJz9Jfv2g7xuYW+MNPgrlasP5IJ2SQSN9xFC1oPQSSNj5mJufcSe5qq+Uc6RL 48zfUG9wF34Y7UVAtfJuGRS2x/Uxz+TImvMiQxHjOjLsW0MlT6e9kSGjB4OTB57krIVZ ZB9IQGWnQnrRTes6Y8aVCx9/CLVTJvrRwZpY8UlkxBAu5d9v4rdRD2NuJ7NQX7t8KkHv YfsbThJ/L+qbuXjBePvK6hTS5yAHQb3tm3S7cE5Wat2O4g91zEnetu4AHoqVXrNNa4iq AxTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wGZqH7xd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j3-20020a170903028300b0017d2311af5dsi9172006plr.69.2022.10.24.06.42.26; Mon, 24 Oct 2022 06: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=wGZqH7xd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235989AbiJXNhU (ORCPT + 99 others); Mon, 24 Oct 2022 09:37:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232397AbiJXNcX (ORCPT ); Mon, 24 Oct 2022 09:32:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB7DA6302; Mon, 24 Oct 2022 05:34: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 D7C2B6132D; Mon, 24 Oct 2022 12:32:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAC23C433D7; Mon, 24 Oct 2022 12:31:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614720; bh=Wnt1e56a265JEkQ4o4iV0N8uiQJ92I/u9tYnSpq0WhQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wGZqH7xdYHGJcqSbv199Ar80ARgfJtBcBYU8TxhMZ46PA/dkqloKg1PLQD7e2IMaf ZZgv5okNXuDhQNDhuu8/NRZwUgYRimkTmgFKi6FoMGrfrku9q8M9yPJDB4OOvZCsJ9 bmvpWbLpcl9n+9pLAJGhJYTpYTbvG+S09Lx6/WbE= 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.10 368/390] usb: host: xhci: Fix potential memory leak in xhci_alloc_stream_info() Date: Mon, 24 Oct 2022 13:32:45 +0200 Message-Id: <20221024113038.675947689@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576645318205496?= X-GMAIL-MSGID: =?utf-8?q?1747576645318205496?= 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 024e8911df34..1fba5605a88e 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -659,7 +659,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); @@ -720,6 +720,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: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: 9226 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp460882wru; Mon, 24 Oct 2022 06:42:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6bPgooWw96pJrXFv/9m9sSrgAu727mhxJw1peKveO257M+T4bxvh01po7gwg+XXeEaAFSx X-Received: by 2002:a17:906:5a5f:b0:79f:9f1f:2fef with SMTP id my31-20020a1709065a5f00b0079f9f1f2fefmr11916973ejc.396.1666618959332; 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=HI1lT04iuLH/o0drZHcPxVjtrJDj4OByxsrnTW1JKsPbVLZE1xU27Q4/QYTXkjrZYj mMi3bdSj0TOYGEV2J5kX/+RvL4nuD/p98lxz9Yxwu/hsMdlC3LKgBIljfQu/CKfS5aTI j7ifBi9FfBg9vOAv2yCfypeLjcvUw8ryfnlbiG2Ss6wD955H940I23MQ7wVSFIFDzbsS fMt7+YaBzaYoZQukG4dPjKBUzHfVFhSqB6F+/Vc/AcrAXO/BRMxEWrbZe6dNErqDQ6yD 0yzkKC5vEay5jiXnfFL2GXAeyyTiJGO0dUWbTydeodod18Wuf2ULa2C93dDymAzjQ/ZQ H1jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Eg70nrCqtj90NKLr+TETyrVyA2OqDmPIc0oreNgrmZY=; b=fAlqcwA03XJ2pK8pjUUJlyWOZUGbgR8yhaCO6gNprKvxSGgofkz1deUTK1ElxMjXOS VINevJvbm0tEHunmO6V3F3akQ7lo3EmpD3ThlXPFrY1TOpkHQk9pXr5Snu1v8Ok4hvsR IC9Ldvql3RMEia5Usikn06SqD8b3VOkLiJPGSfOlhaUJfpNrwASSOAZuidtE2PERsSO2 NkgysKkidPqDysJz7GvglQke3aDZqd/0bwJhjJViNLwqYrNTeuliqiyqQvy4J2+3XSoT o8GLWoA7QL42+DiY3Iz5DLAK11Gkf+HulNt1pw0HDuKteu/xTb9YOhoFBLfklmALkgr2 3e5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RaI9TUdN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t4-20020a508d44000000b004574154f09asi26918097edt.529.2022.10.24.06.42.04; 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=RaI9TUdN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232166AbiJXNcn (ORCPT + 99 others); Mon, 24 Oct 2022 09:32:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235987AbiJXN3T (ORCPT ); Mon, 24 Oct 2022 09:29:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6339AABD78; Mon, 24 Oct 2022 05:32: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 7EF5B6132F; Mon, 24 Oct 2022 12:32:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E413C433C1; Mon, 24 Oct 2022 12:32:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614722; bh=7sB32oWCb0KoLBpJX2Qr1UEhrUV8KsBVv2ewNAThFVE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RaI9TUdN2fEHRi5BLXXzIRw3uIAP8Bw3HdJboKXAlFUFZbOf2Hn/deSz21W91o08O qYUL66enrNgZquVnzztcb3HeUzCUPF0QLVkT1ku8iCE5GSqKIkY3RHOLKOboTtdzm1 MkFAqLq92b+RALvSJuFZprfvc4Iy/7geCdnJ69Z0= 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.10 369/390] usb: musb: Fix musb_gadget.c rxstate overflow bug Date: Mon, 24 Oct 2022 13:32:46 +0200 Message-Id: <20221024113038.721314356@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576641721431191?= X-GMAIL-MSGID: =?utf-8?q?1747576641721431191?= 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 fb806b33178a..c273eee35aaa 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: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: 9573 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp527455wru; Mon, 24 Oct 2022 09:00:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6t1/YVPRI8VfVgDC9n+Zt/GcyL6+n90S7gNSQAj5xprPvuo8NHD5xgsOKHJOY8uMvcqqle X-Received: by 2002:a17:906:2699:b0:781:a473:9791 with SMTP id t25-20020a170906269900b00781a4739791mr28479834ejc.644.1666627242308; Mon, 24 Oct 2022 09:00:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627242; cv=none; d=google.com; s=arc-20160816; b=YTkPyAEelKlx2H77QpDmCfLsYRaMiikujL9vqIwzepHTDGjOdvNBF8n7PGlSjWx1Bp Dtu3+6VxfXE8xjemfPJjLw2noy6tzFTUwHhfVyK97xmFCzxkYLBGGbT97qcT/F2+NCV8 bz6FvG8GzKLtb7jx6eNZIXe7ayLKUXj+QpboZWel2PB9KjQHKXWdCuoUuyDl17Tl9kX1 uIzSPLdXyPeajTOYcc++pV9gH+/t46xS++DQ3COnwhyrapYgbfM/1FqLHVgwRFyxQ5w5 5W6nLl1RQJ4zrd32tDFvZKxIg+iPuEYlWYfNCgXAkJHhr3QBK/mmCR2piEqFfhpiARuw QXpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xJQEd/tw+5bihUtS8xNDx4uOCFTFc7l87/IjfaVZf1w=; b=fakOYXHxgr5N5ogv2okUAuTF7vgwmaZiHhJrJrrpf6CrAargTOJHk6LIsm0X6eJ7z0 tmbrQz/YJmj91zTECQGJQzlDyRHlbOfHtzs4st2mSwu7YWUxSv/4tt/AODU6JpLEH6I7 ZA0g9ECeUEZR9ch2RI9LDrI2nguriU7x5N4F/sRlhfYrsjkGGltVkYC/XlO8H+2/kRrp PgcPPPcIhk4lN/MVY1MvDmc+5HZT2JGYCFbIf6igUDSPdIzN+/vAdklGnDgVvdZEPXB2 ydhBZ33GFLlyB0tba7p3EEkjiWqXY5vmdnH8h507CG9FVix4uJ+m40SjzoTJenw3mGkg 2Z8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aJYHcBHi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ht16-20020a170907609000b00741a18d4a5asi69572ejc.994.2022.10.24.09.00.08; Mon, 24 Oct 2022 09:00: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=aJYHcBHi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231929AbiJXP4u (ORCPT + 99 others); Mon, 24 Oct 2022 11:56:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231919AbiJXP4P (ORCPT ); Mon, 24 Oct 2022 11:56: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 68FE9B0B0B; Mon, 24 Oct 2022 07:51:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BB3ACB81716; Mon, 24 Oct 2022 12:32:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24F6CC433C1; Mon, 24 Oct 2022 12:32:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614725; bh=6vbKmmz0ryFxKZLGyy2yrARzgTOezGzvxGBhsplRrh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aJYHcBHibyD3QEHoyI/0lpc2sYNIKGhxqXoFl0/ewfMYG4B52RHazGE2jl+YNEZ4z DYQjhXVhJNnNtca63a2P3mjGF0MQbQGpAcnUE9v0KdW53/R/1eZXJZXDCnw9sXjfFx smrvg/Hl30S22bvvEkXLwIO9g0W55NvViliYQbNM= 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.10 370/390] Revert "usb: storage: Add quirk for Samsung Fit flash" Date: Mon, 24 Oct 2022 13:32:47 +0200 Message-Id: <20221024113038.769124036@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585327303929759?= X-GMAIL-MSGID: =?utf-8?q?1747585327303929759?= From: sunghwan jung [ Upstream commit ad5dbfc123e6ffbbde194e2a4603323e09f741ee ] This reverts commit 86d92f5465958752481269348d474414dccb1552, which fix the timeout issue for "Samsung Fit Flash". But the commit affects not only "Samsung Fit Flash" but also other usb storages that use the same controller and causes severe performance regression. # hdparm -t /dev/sda (without the quirk) Timing buffered disk reads: 622 MB in 3.01 seconds = 206.66 MB/sec # hdparm -t /dev/sda (with the quirk) Timing buffered disk reads: 220 MB in 3.00 seconds = 73.32 MB/sec The commit author mentioned that "Issue was reproduced after device has bad block", so this quirk should be applied when we have the timeout issue with a device that has bad blocks. We revert the commit so that we apply this quirk by adding kernel paramters using a bootloader or other ways when we really need it, without the performance regression with devices that don't have the issue. Signed-off-by: sunghwan jung Link: https://lore.kernel.org/r/20220913114913.3073-1-onenowy@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/storage/unusual_devs.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 4993227ab293..20dcbccb290b 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h @@ -1275,12 +1275,6 @@ UNUSUAL_DEV( 0x090a, 0x1200, 0x0000, 0x9999, USB_SC_RBC, USB_PR_BULK, NULL, 0 ), -UNUSUAL_DEV(0x090c, 0x1000, 0x1100, 0x1100, - "Samsung", - "Flash Drive FIT", - USB_SC_DEVICE, USB_PR_DEVICE, NULL, - US_FL_MAX_SECTORS_64), - /* aeb */ UNUSUAL_DEV( 0x090c, 0x1132, 0x0000, 0xffff, "Feiya", From patchwork Mon Oct 24 11:32: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: 9175 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458107wru; Mon, 24 Oct 2022 06:37:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Z4+j8+W28tVtbWV6mMUOG+rYBcxNVWW/5Nk1zpa6b8oCqKHFVtaB1aVxingUyhP2x2LzM X-Received: by 2002:a17:90a:8048:b0:212:c605:522c with SMTP id e8-20020a17090a804800b00212c605522cmr23009784pjw.230.1666618623546; Mon, 24 Oct 2022 06:37:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618623; cv=none; d=google.com; s=arc-20160816; b=QJpKfw2/sZ6IJe1A5amaTd7XB6ef8iCKV/kTEtnvISl4eujy/ahOCIbrDgKSIqv7y+ XhCsXMhUkJutufAv0G6cN1LASnvrX/bTv8YIc3Pm8cgcXfGChRQWRjsHaF990SXy8cd6 plFlxBqhuLzrxCxBKWkmaniliTS3949Omv9cp4wQHuT6BfIQIY3Q11loXHy7+gONigRg BJ8t3Me4i/KdNYTEDQWli2iTH2gUwS8tQE7iInNoRhhiCI5f4bdpLDYIbgxOHCj75a1z DKA0vRM9s3GedpxWC6DL+OQTSs0AH94aP5ZGQxajQp6afhUtM9wgQ00ZUlR9px2og3dl PAmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=i7otV6XHcwHblpEht23/RIJ9EytwuxU6X/iWwn++BzE=; b=Tpz+vXYpY3FTgOE0TpAk0KDfxpS6tSrRdo01i0AXbksgZHVRDnT4l/RTyvLjeIg/u+ OgeL3aL/cnDJQ7YjCnFbTrXzd7eHPVd7h7wSQvjqx31EfgbXlJBx9shQmQK74BT7y2ky SDPtd7jqqkL9r6KThIN0mxdUzeaVh7Dq4HEQ3lRc2ZK++h/Vi31u1ptmqa42QGL4kNSE rWzWGxrnLh7RuSdcKRexVZ99Ve1fLV9wPNw7tODkFNb9lYCBIKxJkBFv68W2bcmpOVXA RJtZGOXlvqUnlsCdGq9NEEzdvnWL0nryfBm60ebB9fL6s5Zl3NqwXT9snrDmBXaPiZdW LjcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dI6qICXF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k18-20020a170902ce1200b0017cca111726si36074432plg.432.2022.10.24.06.36.43; Mon, 24 Oct 2022 06:37: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=dI6qICXF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232523AbiJXNcB (ORCPT + 99 others); Mon, 24 Oct 2022 09:32:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232727AbiJXN2x (ORCPT ); Mon, 24 Oct 2022 09:28: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 0BEBFABD7A; Mon, 24 Oct 2022 05:32: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 9D4C361330; Mon, 24 Oct 2022 12:32:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B13A4C433D6; Mon, 24 Oct 2022 12:32:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614728; bh=AkOcEHZmdaA81I6y7tbCcNTRyBxYzqfv88yAdxAyoJ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dI6qICXFkzJKTaSQG0aFj5GUsculEWYO+g6X4mJuShMifMczjFBzfBe4Szb6zl5+Q BpEzW3aAc9Pw10Q9Y6UHwmpHRyNJFu53Ag7Yv7B04rFYoSdVZsMkxzOw5+xbQG10ev O1Vr75zesvztqhX5HG/p+zBCP36OWC5DLwiM5yDI= 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.10 371/390] staging: rtl8723bs: fix a potential memory leak in rtw_init_cmd_priv() Date: Mon, 24 Oct 2022 13:32:48 +0200 Message-Id: <20221024113038.819163549@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576290242232417?= X-GMAIL-MSGID: =?utf-8?q?1747576290242232417?= 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 2abe205e3453..cee05385f872 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); @@ -199,8 +195,8 @@ int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) pcmdpriv->rsp_cnt = 0; mutex_init(&pcmdpriv->sctx_mutex); -exit: - return res; + + return 0; } static void c2h_wk_callback(_workitem * work); From patchwork Mon Oct 24 11:32: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: 9337 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp466597wru; Mon, 24 Oct 2022 06:55:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6z7kTtDaj0M4sFhVb5W0YiuCcbVvQ/M89IzGrz+lrRipiMZtqu/e4MvxNwwc1oDe1Gj6Ma X-Received: by 2002:a05:6a00:301c:b0:567:6e2c:45f0 with SMTP id ay28-20020a056a00301c00b005676e2c45f0mr30037798pfb.84.1666619729371; Mon, 24 Oct 2022 06:55:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619729; cv=none; d=google.com; s=arc-20160816; b=WgtZ5PpUhlkMm8+CdXiMoxa/C/UdvjY4IKvcLE0NgH17jmzvPfI/voKEiJaF/W/8wH +NisGGhGq5AG9Y5JZ9reAf2KmsCqeMA2oFKqRifiQJgdUGmjdaAuFhiIarKZlElgLYjN BNmbYAowoQQ3OO1vbdQT82Qt3fgD4c6M/ty/d5Ppfwk1nMtLDwWGbJ3T3me8Des+YVlW cgy1yfAcbfLCYn7keP/j45esRp6w9c6PiGaO4IqasbvNTyGKexwhxqolVd+CHJlObAZ4 /xWkFvOZJSxfZm7K2HwOx9xxhtoqqboz8znAi5R6hcILR/CN04qlsQPGqOpDlxLrjFWY X51w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mxIMaErCXLQ6SGlus45arc5+X5f7tGiN8FqdqXx1cUY=; b=CgMM9PpCVAq+AR6XCPgLk7mN4mfMC+hluWkSJcYpfGAAKGnjruZhTOpQTkZZqRfXhS m1XU7vOrrpbUwsJFmjIaZMErKwRgy1EGKzch7c7C0W5jvB6tdXpSYWM8Eay5FBrjgeaV jFY8QDOxLb9Yags7xZ5eWbVQ0t73vmZxCkR1I1yQ2DNrFzuKTyCt0hK+oteYXHUics+b tvqhhUSoGcYhE8/jUX7o37ltNqHLsUTWaq5J6yUJQoQ4fUGO3/i7fCdTiv2P5OPdMSNx 14A7dkOCGGkyr8qA2MDQIUYIYES3BXitJdKA7rfMgmTFVrH6vU449tgvJsGAlFpKNynF 3v5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=x0J0TAJc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d4-20020a655ac4000000b0043c5d3dc0d4si36529277pgt.332.2022.10.24.06.55.15; Mon, 24 Oct 2022 06:55: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=x0J0TAJc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236426AbiJXNzA (ORCPT + 99 others); Mon, 24 Oct 2022 09:55:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236545AbiJXNxS (ORCPT ); Mon, 24 Oct 2022 09:53:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E28B0BC447; Mon, 24 Oct 2022 05:43: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 3C37F6131A; Mon, 24 Oct 2022 12:32:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51A45C433D6; Mon, 24 Oct 2022 12:32:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614730; bh=kpCVKSVx4edmN/FF2ES1UPayu/qR0i3LiEngz2CZ+Ss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x0J0TAJcjN6INNx6uzzCZ+bJtqCGjpkWSiojqgxGPLMVnWipLpVmyl+ChJYm1JWRI ygpGDg1UJs9ditKm8V0Cu/oqM/mvxGCGbgNRyqUgHCQCrIOgOW44aSHVVPCE3hhl/5 /X1nbWM8PxlbBbA1D5HYxJI8q5qpNECZ1WwZUdHA= 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.10 372/390] nvme: copy firmware_rev on each init Date: Mon, 24 Oct 2022 13:32:49 +0200 Message-Id: <20221024113038.861652338@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747577449166586156?= X-GMAIL-MSGID: =?utf-8?q?1747577449166586156?= 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 265d9199b657..e9c13804760e 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2949,7 +2949,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); @@ -3110,6 +3109,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: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: 9227 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp460880wru; Mon, 24 Oct 2022 06:42:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7qoOqGtdFtOlKKlGjIXsfm2Bj/LlKLILk3jAs1oS8KPIjr6SRlzfMCdG6HRf6H8e/LjnqC X-Received: by 2002:a50:fd94:0:b0:461:5131:d3c with SMTP id o20-20020a50fd94000000b0046151310d3cmr15215742edt.112.1666618959346; 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=VDHRwZ/VYVMZwExSR2m5woiXLIYi2TYa0tFwbGHGdi4MR46i5Twj/dBSIfjuR2/iaS YpmaJH3ViQr9Ukxu/qyLEvHKBKAtOpJJh7+6YMcwZquTdXPXuJrBxKCD2T/aRCjoCt6F c4/KITIGyRB38Zcjg3yvYgiyqcionN0UW4eOF1f62z3cunXA1fwEXMXZXxIMjG9iDYcG /UHsNcQSB2OWRJC1cr4/abDpcjtj2gP2BHf3rgMfJyo2dZ0zx8kyrBetZ0Dc83L8y7nU DVVbKXONFtki+89cy4uA0/X8hMnvZf0TpQ2noeXVz/TaBYncfCc8BIp8mq41OcECoAlG q6fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bq42xQuaRM/uafj7pRTh8fSHm914PHX5xMxZKSqSO7g=; b=jjgwIzEuHMrQyPbCglpRFiK4T5XWU37RLx8oImNuHiprkQulnX7ysaT2UD4MgQG/Ru tbJCZvBj5CLXqE783cvMftVgOQ1lvgh7VklVWDxHJ6OU7eki7+RXUNnJF8KTkY1iUuHs BvVsEr5pAUJ7q1a2TGmdjcBTCSIryfgL74xTsaOjb0XWsoThrB5NZuU+Xc6X36lwZr9t jyXE9ObgYwJ8P3sP7aZ/0Hf8DslGvNnuDdW0k8JJFba9Ih9KUoE1GLwisdlPDpwnYXh+ CE1bqVg48BaSYLPOEArLGS7aoXeJ4QzkG0MXl5Bxv5RTghOfLWHYKmcniZgawmjUU08p Xutg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DwbxD2FD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a0564021e8b00b0045ca1098d05si33173908edf.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=DwbxD2FD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232834AbiJXNc3 (ORCPT + 99 others); Mon, 24 Oct 2022 09:32:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235993AbiJXN3T (ORCPT ); Mon, 24 Oct 2022 09:29:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84DB3ABF00; Mon, 24 Oct 2022 05:32:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D331E612DB; Mon, 24 Oct 2022 12:32:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E999BC433C1; Mon, 24 Oct 2022 12:32:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614733; bh=bp9G17ff+AGvKAiisHdp5V9YGOcAbJR9l6FKgPCOQTE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DwbxD2FDKCxgTzEgm19pFxQ1I9bT66ANHUt4/mURIa/9gcybpXWOC95Yaqz/czU8j vyu5POJVGgLjARDQLW07SYei9OyuDh0PUmeD7VDT0YTyGi5Tz7MdDPwH0laFA8nDzC ns0+3J8sn2vYwwm/wCN7l6Xq6I1azuWw7TWN2Yhg= 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.10 373/390] nvmet-tcp: add bounds check on Transfer Tag Date: Mon, 24 Oct 2022 13:32:50 +0200 Message-Id: <20221024113038.902327612@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576641722750943?= X-GMAIL-MSGID: =?utf-8?q?1747576641722750943?= 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 e3e35b9bd684..2ddbd4f4f628 100644 --- a/drivers/nvme/target/tcp.c +++ b/drivers/nvme/target/tcp.c @@ -922,10 +922,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: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: 9398 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp478371wru; Mon, 24 Oct 2022 07:17:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6nJpOAulG4pzYQUaxad2bw91LW9QGXqEOKskk6O8IWXpIHg/sxE8ve96C/XO/5B8jOPwGl X-Received: by 2002:a17:906:cc0d:b0:78e:2c06:8e70 with SMTP id ml13-20020a170906cc0d00b0078e2c068e70mr27098075ejb.732.1666621033346; Mon, 24 Oct 2022 07:17:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621033; cv=none; d=google.com; s=arc-20160816; b=o9bbqZFSMV0TBie8Gf6QFzDIK8dEi0Vy1wZHE0/D+Q1sOCgpZ2z06DVOS0ie1onng9 gl5S4qshYzsFbWs+mcyX7BqC98pU//jddrUvrOMZsHQhQRPhwkoap/m9J//sUfPHenKm pnW7rEvp8odNkYapdfBT8ohqdkY55fS+TQ0Ohe1a4hA+91e/1PrYy4dWAG9CqJSnMugz cnF53gma0tQ6CmOZogmM8Cge5vUDMdJZIaornLBddWK+WShkcksKWkDcA0SHoaX+iqJL 4fQJTwUe8rFG5CoXj0OHh4gmNXPviywetPjHs41+2A6JPbcKJra7bDj+iyKz3isBg+SQ ijUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iEyLnsxdEbZpgMXxUMGXoRqchhpdzybvnC2uj9cSaYU=; b=BtR7+t8UNHPk59WtH53tpECrbBcT1IVAaiY1+qu68EzgFA0yYjcXt94w4vuDJboRSK gHzjcjI/ynXLI34kd1pDxLTERTs16ERVS9LP4pFbHRl37JqUbBhLRGWyLWoWxzUvB+r4 ZdtIcF8OSHrmwF7To4JT9fOahqDtZYwW5Hesvy9XRDXTdel7Or65xbzTHF5Nlsb21NWR lcm0zzZHvj1vD6vp8lPBsmH2pyHSJkVv063Z1PQt36kMFHMLKdOrqVYVm8eYI2s+ckZx qRiFhoxTJ6I0fxqbBLkHlC/3McXhoAit3SnkmDbXrACtktb8QM+ioQNPPCVWTSLXk6+d BT5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VfTAUdP0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y9-20020a056402270900b0045bc5ea5334si17402738edd.115.2022.10.24.07.16.48; Mon, 24 Oct 2022 07:17: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=VfTAUdP0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232338AbiJXOGF (ORCPT + 99 others); Mon, 24 Oct 2022 10:06:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234919AbiJXOCr (ORCPT ); Mon, 24 Oct 2022 10:02:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA616C06A6; Mon, 24 Oct 2022 05:48:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7C8B161290; Mon, 24 Oct 2022 12:32:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AE39C433D6; Mon, 24 Oct 2022 12:32:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614735; bh=2ZxUg/1wAsgJI7Aj9gDfm/S13ITpUsPEtiIhR3IIIoc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VfTAUdP0w3q9qjdQuIIFJ6fBLHXL408foK11KPrL5dY3cbC0shwxMJPYWX1+PePXx fFlIlaFFVlTEPXcDQbv7TLuGyGr0JCZPXPljCJCurBXg8KjQFONo/7ifrmH7RwQVly n/WfV80MxlcBHpiDJadb1lN1yd4gbc0Hx7xXKKSY= 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.10 374/390] usb: idmouse: fix an uninit-value in idmouse_open Date: Mon, 24 Oct 2022 13:32:51 +0200 Message-Id: <20221024113038.944051888@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747578816708133353?= X-GMAIL-MSGID: =?utf-8?q?1747578816708133353?= From: Dongliang Mu [ Upstream commit bce2b0539933e485d22d6f6f076c0fcd6f185c4c ] In idmouse_create_image, if any ftip_command fails, it will go to the reset label. However, this leads to the data in bulk_in_buffer[HEADER..IMGSIZE] uninitialized. And the check for valid image incurs an uninitialized dereference. Fix this by moving the check before reset label since this check only be valid if the data after bulk_in_buffer[HEADER] has concrete data. Note that this is found by KMSAN, so only kernel compilation is tested. Reported-by: syzbot+79832d33eb89fb3cd092@syzkaller.appspotmail.com Signed-off-by: Dongliang Mu Link: https://lore.kernel.org/r/20220922134847.1101921-1-dzm91@hust.edu.cn Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/misc/idmouse.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c index e9437a176518..ea39243efee3 100644 --- a/drivers/usb/misc/idmouse.c +++ b/drivers/usb/misc/idmouse.c @@ -177,10 +177,6 @@ static int idmouse_create_image(struct usb_idmouse *dev) bytes_read += bulk_read; } - /* reset the device */ -reset: - ftip_command(dev, FTIP_RELEASE, 0, 0); - /* check for valid image */ /* right border should be black (0x00) */ for (bytes_read = sizeof(HEADER)-1 + WIDTH-1; bytes_read < IMGSIZE; bytes_read += WIDTH) @@ -192,6 +188,10 @@ static int idmouse_create_image(struct usb_idmouse *dev) if (dev->bulk_in_buffer[bytes_read] != 0xFF) return -EAGAIN; + /* reset the device */ +reset: + ftip_command(dev, FTIP_RELEASE, 0, 0); + /* should be IMGSIZE == 65040 */ dev_dbg(&dev->interface->dev, "read %d bytes fingerprint data\n", bytes_read); From patchwork Mon Oct 24 11:32:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9184 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458413wru; Mon, 24 Oct 2022 06:37:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5cj22e1twY3GrhTmnjEnz2I+ivtlgDB+8lHVAlmLUvbl9neaCH6DWZj7/MipQWMDQ109DE X-Received: by 2002:a17:906:15ca:b0:78d:b7b3:2afa with SMTP id l10-20020a17090615ca00b0078db7b32afamr27716720ejd.69.1666618653554; Mon, 24 Oct 2022 06:37:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618653; cv=none; d=google.com; s=arc-20160816; b=LFQZT6AIeWjqujjNhnpNaYf/8rGHdgZtBSLKjdi0LJdwipc7B6Wf6w6OLe/uHP82RF onOppPttuaIHjRb8no9BXItdLOPi02Fwb8cqRdLhthIrQpFV/Nvpk6ZQLlJIgZ/TZa+N RAa7l58GTUnW5QqKWCF0M6mA5fWWkgpeHIta4yc90Exi00aAobBi/dTBrcK9ZE6bLeNl h14lLVucqc0HrH/VLzd2w3ytIsbcMi5foipB8IYDtpbb9XeABCNDLntb0JfISBJmSc+W 5O3tkByb1VyIkN1MKlliSsttpTp42LENsd9IPBdKGuq9vAk9hCGBHro22uKww9atcnVu Ib1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8NyhdaZ3LuVBoF9vL+vt4dIc1FNcstlKRIHhoHJyq0Q=; b=gUVLFlv0PHn6JboHdpR7jsmG6E5EQ7Xv0Clqcsrn1P41fj9gFmKCrgg1xbtwL5IVDv KfS0Rxcgi6Z+MzPxycngbsEHYVdzQ70jy1F4dJfkQCmogWSs+o9qFZcp9zU5ThKGiEGt ddBPtHCqjB7Jnq20pIGxTAnoPRLspfsGhdYBPy63Pi84odn4mBYwpwtibY5iVXk0Y7xj Hwo6cRuMpB8JfLFPIo6kdZRoMSFU6rOHZXp8YF3fmejisu40On+75hksA47bVRjMKisJ 5EwNbBIZ9mO3qjxysw6iNK4WpG9gLFccykKa6Tkk6dC1mLsSYunglkFLfsQw+tsCc/Ys YNHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=W+2+Mm9s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a05640227d400b0045d27c0ba90si29425950ede.577.2022.10.24.06.37.01; Mon, 24 Oct 2022 06:37: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=W+2+Mm9s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229967AbiJXNcs (ORCPT + 99 others); Mon, 24 Oct 2022 09:32:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236013AbiJXN3X (ORCPT ); Mon, 24 Oct 2022 09:29:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F214AABF08; Mon, 24 Oct 2022 05:32: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 2520E61338; Mon, 24 Oct 2022 12:32:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38CC0C433D6; Mon, 24 Oct 2022 12:32:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614738; bh=1zSzDiAVmfYGGXOfDWhFwcYMeLXritnbgm9Z9d7MIdU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W+2+Mm9sTJpvYn6SE42DOEEd1xQNVNvRrCpYgGFSzeExK639C7gIUZ1KTNkxRJxGB S+HaZr2lVhbiYrlmSCjLlV7i6OJJD970//ln14QleLLH6U7pPE7T4rG8+ivaUZdNAi jm+YW6qBoDDMOY77W+0cR9r7K6rlgycRRz2pQwso= 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.10 375/390] clk: bcm2835: Make peripheral PLLC critical Date: Mon, 24 Oct 2022 13:32:52 +0200 Message-Id: <20221024113038.975228832@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576321181779241?= X-GMAIL-MSGID: =?utf-8?q?1747576321181779241?= 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 f306b959297d..b7f89873fcf5 100644 --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c @@ -1786,7 +1786,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: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: 9194 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458897wru; Mon, 24 Oct 2022 06:38:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7aUI9gDTKCov4MFJv8Qzs15+6GXNfH4ofK6JPbsEWyS6j7zzgBvQeE0Ug5QNPpUZwzdX6z X-Received: by 2002:a05:6402:5419:b0:457:c955:a40f with SMTP id ev25-20020a056402541900b00457c955a40fmr29974748edb.391.1666618709697; Mon, 24 Oct 2022 06:38:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618709; cv=none; d=google.com; s=arc-20160816; b=KfftaS8QZpz38qSSit1XnCk1u6UwZYS+TtWGH/64Emk4yI3IlHHE8AAxv8Z6E7ESwK l9tFcx0X38pDHBc0ERAB2Tr1LoItqWhDBak4B1eVEc0+oJoG7/8ecjLJG72BFRVIAbp3 CPE28Rrol+lC+EgTglwQ9m5sTKsQ/YOau3A19qmuW4Rz3TW4pyJr2AIpAUueLVYCmxgb hx0X8fNypnKmKo5ctike0VOBKcp82OQK9/SLHNs+XwIecWI9zBnkBvhkoAJixzA7bu79 Y1jmpnQPxoU6ZwQWnrTL60rSvA/9MBJUY71cwZApc6oW/chxH0IjMgPkxklcoFCDgC0P 9FPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+nFqRe4wY2zZiWNqBGvAkNeHyMke6yQt+cCAdjHsfyM=; b=VOEmdic3c8DHYmVG7ynuA+cPv3kuaoWKYTsJSWEPGznV9QW5A3cmGbZpaIbqHJsWqn sRsT3mcjgrjFZ/BZi23LZiezQLaiLVnaBP1Ojh83j70ktO/4aIawfZ2GlDYPMnmD/LIl kTvWkRLDR47UtZXk8BRjT8ZWoqs9ys0GIpnLFh8zCD9Hq1kTAEIrDl9qN1gsVs1wUb8c lbQ/SzKJBg/+MBsnAE2cChOsoIVVcR8akDsIrS4i3Rc2E2L6b1SqxlS5Wz/HwhO9N5R2 SDLD/KPlmiiMPPuxtaZ/xW8MHPW82kQ7QQGYupae71ewzWozV+WGHy3m9kgam9xyai69 9CFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ytOJA4XC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa17-20020a170907869100b0078dec48d439si30777568ejc.590.2022.10.24.06.37.46; Mon, 24 Oct 2022 06:38: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=ytOJA4XC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230471AbiJXNcx (ORCPT + 99 others); Mon, 24 Oct 2022 09:32:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236016AbiJXN3X (ORCPT ); Mon, 24 Oct 2022 09:29:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDD70B1E1; 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 dfw.source.kernel.org (Postfix) with ESMTPS id B2C43612B2; Mon, 24 Oct 2022 12:32:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8809C433D6; Mon, 24 Oct 2022 12:32:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614741; bh=3ierzcmJ1iX1qGa2HEvurAr4/bygL9us4GsEWEsJVYk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ytOJA4XCR08vCIZE8iuE87Jzpa7qvjusJ9bbYiulEJD3SrJAv4Tvsq/Hl0x+0qTfg QnVvc/qeZjwMQdXTo9i8nWhdPdVV/q+Uwnsd1Tab0m6cLp6i8uC48abtnUjv4jEh1N LpzYETF4UjCdVxms0Sw9pwLs/6r3jaHugwvjGVFI= 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.10 376/390] perf intel-pt: Fix segfault in intel_pt_print_info() with uClibc Date: Mon, 24 Oct 2022 13:32:53 +0200 Message-Id: <20221024113039.005803311@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576380378217686?= X-GMAIL-MSGID: =?utf-8?q?1747576380378217686?= 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 @@ -3279,6 +3279,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", @@ -3293,8 +3294,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: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: 9331 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp466039wru; Mon, 24 Oct 2022 06:54:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6nACLcdLn7DXwP+YE6HNBsYd2WkNpGDqyAVpvDlIs6BiM0JYrKC4MjlN3lZxg7I9g3BMPt X-Received: by 2002:a17:90a:cc0b:b0:213:cef:1ffc with SMTP id b11-20020a17090acc0b00b002130cef1ffcmr6544287pju.36.1666619643682; Mon, 24 Oct 2022 06:54:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619643; cv=none; d=google.com; s=arc-20160816; b=NPStIk8fvHKv3jXdFP2L8Tf77VbClh0eEzzy7Mm3LPJt4DME7G3D9wEVZQubkrM/02 pWy+DSKYzPZe0nh+Go0B/lE9zSjxsrtuy2pH7Fvdk4i9bEg/NS66gG6Wi7Dyj1GwKNLF xalerg6RsvjYA/DfuY/+7jrubsZ3uwbFc9dKTmbgUaozWAt20SY5xMj5La+vCDb/KJM6 ME+smx/pPwGKqcFtZCDB92HMKjRDO6UuXkFniNGzK04Yg4FRF1S5aAhzsUbRUSbxEdGr u6gwH3qSlOxTFChQh2uT5uniD82c14mVqDnEgnc67WUWH+zlU1+7vvmh/I1uMr+CerTc wq2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BSw8g5AbWwNJRKU29yuOjOOMRM7+RWwlcZIruzWfjE0=; b=058PwwbTsXIY4vTnerqPmUcIOzOClI51F3F45gP8UgP7nB/vL7ASnJ2/tqqp3iYSpp w4mfizRUcDURKnRG5DbECc06vaeO0iw+gA9QsM3JqjIo7veQ0no3sVPgto2NDSPUOByi BrYrcZn6uNMDZre+8mWKDlavuRWSf6+cPPZN+aZr1FQZ4EXtmyN1uXGPYhC7Vurz33qY Y2vuUaGI7QQ8wfGat7/M4rwQ0H5UT9izWSMI+pV16mw/vs+uXWcHv0SVTHbDQUAM41cn 5k2GvU4zbRamx24SrTpjJfAgtexXMYWUMhKbXRKdCcTbCKkA/8jdp5rulTOYCk5MnG8g reBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YRqs9Lt4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a639516000000b00437ec09f591si35430432pgd.135.2022.10.24.06.53.50; Mon, 24 Oct 2022 06:54:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YRqs9Lt4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236701AbiJXNxa (ORCPT + 99 others); Mon, 24 Oct 2022 09:53:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236591AbiJXNwc (ORCPT ); Mon, 24 Oct 2022 09:52:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A913BA902; Mon, 24 Oct 2022 05:42:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5FF1461280; Mon, 24 Oct 2022 12:32:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73716C43470; Mon, 24 Oct 2022 12:32:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614743; bh=HHUg5KckEKVunibn2u7StkIkV/6yefiT8qKsdvKKleE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YRqs9Lt4Nu4FqtNHQNP0vloQvemerN1pShKjvqJetLq6GdjoezL5mUQrHiHJvw19a rEZumvUTh1YO019o2Ek/IPpAukXnmiPloNDe6Bpdz03HecQzNMBrd2gNf5WIvowBy9 D/ibdM+/s1AFIo6TeIHIEF35PL3jqUQlj4nyCtr4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Shtylyov , Will Deacon Subject: [PATCH 5.10 377/390] arm64: topology: fix possible overflow in amu_fie_setup() Date: Mon, 24 Oct 2022 13:32:54 +0200 Message-Id: <20221024113039.036524410@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747577359395508545?= X-GMAIL-MSGID: =?utf-8?q?1747577359395508545?= From: Sergey Shtylyov commit d4955c0ad77dbc684fc716387070ac24801b8bca upstream. cpufreq_get_hw_max_freq() returns max frequency in kHz as *unsigned int*, while freq_inv_set_max_ratio() gets passed this frequency in Hz as 'u64'. Multiplying max frequency by 1000 can potentially result in overflow -- multiplying by 1000ULL instead should avoid that... Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool. Fixes: cd0ed03a8903 ("arm64: use activity monitors for frequency invariance") Signed-off-by: Sergey Shtylyov Link: https://lore.kernel.org/r/01493d64-2bce-d968-86dc-11a122a9c07d@omp.ru Signed-off-by: Will Deacon Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kernel/topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/arm64/kernel/topology.c +++ b/arch/arm64/kernel/topology.c @@ -158,7 +158,7 @@ static int validate_cpu_freq_invariance_ } /* Convert maximum frequency from KHz to Hz and validate */ - max_freq_hz = cpufreq_get_hw_max_freq(cpu) * 1000; + max_freq_hz = cpufreq_get_hw_max_freq(cpu) * 1000ULL; if (unlikely(!max_freq_hz)) { pr_debug("CPU%d: invalid maximum frequency.\n", cpu); return -EINVAL; From patchwork Mon Oct 24 11:32: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: 10100 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp625940wru; Mon, 24 Oct 2022 12:55:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7tiurCEt7CD65zV9x1AI2kKjQao+1KpRroHbqhHIg3GN/EsciTbS2Piadx5ROPM30R1NNC X-Received: by 2002:a17:90a:8988:b0:212:e1b9:e8fd with SMTP id v8-20020a17090a898800b00212e1b9e8fdmr15934382pjn.148.1666641340101; Mon, 24 Oct 2022 12:55:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666641340; cv=none; d=google.com; s=arc-20160816; b=vv/Fu9TYGsh/jBQtpYyc5EzATg6nR6DmaoNDGMZ9uGrrPMl2TymSZI1cynrCuvkCS2 DcQ7he+9s8S6L4p+ijEhWoO166M6y8kSnG5uZRoK7YPW+tDLAtXK1At0Jr8VXptdV5o/ TSGisNT1skZdJPB+ttjwtf9SIC9bGokRHUexlJ36Pb34qzo9QC44o9T0fzq8VLDAL6Fe 21q5wcvrwTp/HihWYYYggZUYPCN/tTzmct6c71eHtIBG9S+gLWKYlWYuGEWhSOYj4dHy M+y0U14fuqAQ4E8V1gZK68q3i21kyD5U04acue7F8oQYAWxlhpUYq/7/bMKikn96laXT CkBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TSaJLsL+ZvVATr7B9nv92vFsyQa8oprEds1ZUWvlVqs=; b=LD0IDxqat9uFMlBDCnKKbv+GDVWqOjPwBIrDH50niQo+TaTP2OChTWvCy4xqXgDopZ 3MkhgwVWWKXwA2se4FBW5I8PhoOkykml18tealH/5/+hcsx1UoXYaxJ/WhWOjclq7Xme U+NIuQha2To27FOgFNvSXn2iom3IQbunGDy4noWIKC+xUwMwixxC/1ugpdXRVv+MjXBU lE3DFfnrJ7H7uD4n4yU8g8/Y+/L6awm18PbJM28eSt9AhO/DSblmoeRUOCOnmF+sVbWT sRUd+fBc/FAmpNrOiv5BO0lnOf0+VEep30zX3gnQfTNE0bI7LAiycfVxt+q1Kds5l36V EhDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ixUI3Vuo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t3-20020a62d143000000b0053708adb535si516618pfl.257.2022.10.24.12.55.25; Mon, 24 Oct 2022 12:55: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=ixUI3Vuo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233655AbiJXTyx (ORCPT + 99 others); Mon, 24 Oct 2022 15:54:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233427AbiJXTxP (ORCPT ); Mon, 24 Oct 2022 15:53: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 D39E12DE1; Mon, 24 Oct 2022 11:17: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 4B2DDB8171F; Mon, 24 Oct 2022 12:32:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3999C433D7; Mon, 24 Oct 2022 12:32:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614749; bh=lRex0KZaajbNq/rIhcn4HcwjpNYtfESEz/jQaZV8qrc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ixUI3Vuo07ySv1W6cY1htQuTA8EYybuFF7HBDmPUAml68lxW/0BGIWcWs4gvhJQ8W 2iqh7Bizgsnqg3w5i659nFAFbBF5RH14iPOnkDTmK3f+Y9OoDfF5ewQ+XZIS0alZOk zcTnK2YfPqGyx4DbhWwpBfUBE44QR93oUYWWYdu4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Stable@vger.kernel.org, Pavel Begunkov , Jens Axboe Subject: [PATCH 5.10 378/390] io_uring: correct pinned_vm accounting Date: Mon, 24 Oct 2022 13:32:55 +0200 Message-Id: <20221024113039.072215330@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747600109892552733?= X-GMAIL-MSGID: =?utf-8?q?1747600109892552733?= From: Pavel Begunkov [ upstream commit 42b6419d0aba47c5d8644cdc0b68502254671de5 ] ->mm_account should be released only after we free all registered buffers, otherwise __io_sqe_buffers_unregister() will see a NULL ->mm_account and skip locked_vm accounting. Cc: Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/6d798f65ed4ab8db3664c4d3397d4af16ca98846.1664849932.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- fs/io_uring.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -8436,8 +8436,6 @@ static void io_ring_ctx_free(struct io_r if (ctx->sqo_task) { put_task_struct(ctx->sqo_task); ctx->sqo_task = NULL; - mmdrop(ctx->mm_account); - ctx->mm_account = NULL; } #ifdef CONFIG_BLK_CGROUP @@ -8456,6 +8454,11 @@ static void io_ring_ctx_free(struct io_r } #endif + if (ctx->mm_account) { + mmdrop(ctx->mm_account); + ctx->mm_account = NULL; + } + io_mem_free(ctx->rings); io_mem_free(ctx->sq_sqes); From patchwork Mon Oct 24 11:32: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: 10093 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp625649wru; Mon, 24 Oct 2022 12:54:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Eq60mHiELL7lekA13p9E0K90EMVGgH2a22itvc6iJ1OzfH7bHUe1VZ1z/+jgHpOjY5bpX X-Received: by 2002:a63:e04:0:b0:46b:2bef:338c with SMTP id d4-20020a630e04000000b0046b2bef338cmr29183239pgl.206.1666641298067; Mon, 24 Oct 2022 12:54:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666641298; cv=none; d=google.com; s=arc-20160816; b=fCL8jWjVz/RqbA6pXNRmAZX86YrcAGUIyapxWP+D7jHw8juVNFNY4miDCQXY23KMF2 hD1nkHb6kNodCkTZJwg9maoCkTqZrttg0AzS59NG9UbIhfXcTUQr7oHEXmNFlNc6py4A iDrPEy28I4pXrza3LDneZZOaXGlxS/6n7qrp5K+MrP0Rdwebp6TOp9NLHSBJO/i2qgS2 XzFIfwGFLXZ74HubTqbXoUvZ3jPSWnjzy3zGj4tffF0BLhXPk1gW76GvuDtPYCZ2n8TV UsUNwf1DZXjJG7xTeQiWgdAYS/wNNdIUFW6A17sCtLQcdycKzeD+TgMikMnnkAO5e3E0 T8Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=G+YdJOFXodV5XEpap+SfrcnmmVA0ibFoW6OENZxUqyE=; b=bMJ4upHlOa/Lk+CoqrDW04TWSXMwT7p8bm3c9W/AwA50hcJDRJctzpoXxa1U6nT/1i 4JLf6dg25ckSQEhuRB5fRDgb5yStbl+/cY/2fHEN/bNRV4w8CzOuAgvnfW/9hv/ftAIj KmQuT0jF5l3YdjcQEV0WgzwwQbIaCqQjLbrd23krDdMx+rm+qp8rcqgXRFccmS7p5chk wvVewq/ebmsVrJLXxMczN3VIPjfCJ4JqzqDDq/GxkwXtpzMluxKQw6wv/aOyUjHZ5xXt 1tnErX1CEoZmR2F7fdTvPtOKgRsnT6R3ED9+saqnUeABE7nDovrTEDhvwALPTPsNAv32 4FkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="OobV/Hlb"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w19-20020a656953000000b00462c469b730si373681pgq.648.2022.10.24.12.54.45; Mon, 24 Oct 2022 12:54: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="OobV/Hlb"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233548AbiJXTxa (ORCPT + 99 others); Mon, 24 Oct 2022 15:53:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233664AbiJXTwB (ORCPT ); Mon, 24 Oct 2022 15:52:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C4FB1C438; Mon, 24 Oct 2022 11:17: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 E5CBDB811BF; Mon, 24 Oct 2022 12:32:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40F9DC433C1; Mon, 24 Oct 2022 12:32:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614751; bh=V9I1S9ZPJGwn5TpHKyAKfFQ4a5L+krK6cws/EQNVcSw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OobV/Hlbgv3M7yZYcMeP2o3CtQXNSgEg/GdUR8LHt33tF+bqxcDVALOIAA0+gpTTp Tlm7PCxxOWtuk46PA+yBOOxgsVv/cXJHpP6CdbGdV4olalJ+Eegv5lEGQUPIBCwpLK xjl5eVZdBeyZpJI3I6FqhKuZ+VkGCUuvhASKZhYg= 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.10 379/390] io_uring/af_unix: defer registered files gc to io_uring release Date: Mon, 24 Oct 2022 13:32:56 +0200 Message-Id: <20221024113039.118238854@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747600065682174928?= X-GMAIL-MSGID: =?utf-8?q?1747600065682174928?= 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 @@ -7301,6 +7301,7 @@ static int __io_sqe_files_scm(struct io_ } skb->sk = sk; + skb->scm_io_uring = 1; nr_files = 0; fpl->user = get_uid(ctx->user); --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -681,6 +681,7 @@ typedef unsigned char *sk_buff_data_t; * @csum_level: indicates the number of consecutive checksums found in * the packet minus one that have been verified as * CHECKSUM_UNNECESSARY (max 3) + * @scm_io_uring: SKB holds io_uring registered files * @dst_pending_confirm: need to confirm neighbour * @decrypted: Decrypted SKB * @napi_id: id of the NAPI struct this skb came from @@ -858,6 +859,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: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: 9338 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp466622wru; Mon, 24 Oct 2022 06:55:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM70Tvgo91AxSkXcXoysdPSZLKhJU/7hYw4BbxG1jBB5saJe7khxdlwLqvXFNlOzGGBG7YqP X-Received: by 2002:a17:90b:3847:b0:20d:c41f:de7a with SMTP id nl7-20020a17090b384700b0020dc41fde7amr57776605pjb.85.1666619724370; Mon, 24 Oct 2022 06:55:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619724; cv=none; d=google.com; s=arc-20160816; b=iWqmR04FcCo+Ebf6hDRDwK+FF/FBAMsIvL+KyJabPe5PRzo9DXkW5SjMN12KN5esXH gIhTg4eLmRkHYNmd2C6SsbJ5Uax3PW2fx7AN5CUtCSFLJHNgbGcHAo2PB5dUC4GjovNv GeySQ4VVQpNJXQOtVwC2TDRMX27zksW1Rk1XOni/tpRIhZRGNTdSygXktHDrWA2YWgrQ g0iddcmuV6+mwgDfwcimcYstIQf6vJ1FSzZCBVdUlhaPv9yKsG2tUl1xsOpFGz3bZqA3 JwCE/HccM0Mp6438MNjqbiqC3llRLRqQU8ya8yhaXhpkL7QFf2o1LrpTmAZrP0MAev7m 1P3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2CKumIkUn46bVun7DLRVRENHyrRRRsI0SReBmtrzcdU=; b=Rgw46ykd8h6lOYVRFd0bBTZcCLa6H9haG3zLb2U0yPKr0vVFXS4i2Y8wpOpTpcrlYZ ZGNbzEzrC3O5eyaP/QJfk+ph/FL+1bzQJrPXAOsa911IzWR1bv6KwSbfBo6txRZrIg3L W/541SqjHlB6XIiKTXq8Kj9PFZuVY0LLUSSryBAxEV0XtBHVigvZnC6FxBnicMPhPU8K +R5yTZhhMzWmTQH9kZdUFwvs3mvjP14ja1eaw3pghzkj5NzX8sU7wHQAqRaEKzCcXTJj f7Uw4UxarOnk/iNnbzxNEHvMlSBn+UC2Fb5QD5ww2s+mWMlfkxiGOAXWRRyLpkHzwEOq 8UuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=K+mDlLyy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a634608000000b00461d9cce57dsi12155991pga.254.2022.10.24.06.55.07; Mon, 24 Oct 2022 06: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=K+mDlLyy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236643AbiJXNxz (ORCPT + 99 others); Mon, 24 Oct 2022 09:53:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236553AbiJXNw7 (ORCPT ); Mon, 24 Oct 2022 09:52: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 21F42BC44D; Mon, 24 Oct 2022 05:43: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 C45E76133D; Mon, 24 Oct 2022 12:32:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B085CC433C1; Mon, 24 Oct 2022 12:32:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614754; bh=bNzgAFP22hNtf2DtuINAlIo+vZoacqJSXYftjrlrzFk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K+mDlLyy5qRs1OMuDQwYw/+Qr5LzHWFRHYQ9q8WVMdYFLfSRu8Y2QygYsP4lIYitu 5n46cNNWm01yksq2dEAQsvi/LzcYgYFIu6YEf8RI4B4hOVMkfeHQWdLsCF4OUZ12Xe SrJrgJumyiAogfy/LyBkvF2TyITzh+HX8IQXCsdE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liu Shixin , Kefeng Wang , syzbot+193f9cee8638750b23cf@syzkaller.appspotmail.com, Liu Zixian , Mike Kravetz , David Hildenbrand , John Hubbard , Muchun Song , Sidhartha Kumar , Andrew Morton Subject: [PATCH 5.10 380/390] mm: hugetlb: fix UAF in hugetlb_handle_userfault Date: Mon, 24 Oct 2022 13:32:57 +0200 Message-Id: <20221024113039.156393036@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747577444150077638?= X-GMAIL-MSGID: =?utf-8?q?1747577444150077638?= From: Liu Shixin commit 958f32ce832ba781ac20e11bb2d12a9352ea28fc upstream. The vma_lock and hugetlb_fault_mutex are dropped before handling userfault and reacquire them again after handle_userfault(), but reacquire the vma_lock could lead to UAF[1,2] due to the following race, hugetlb_fault hugetlb_no_page /*unlock vma_lock */ hugetlb_handle_userfault handle_userfault /* unlock mm->mmap_lock*/ vm_mmap_pgoff do_mmap mmap_region munmap_vma_range /* clean old vma */ /* lock vma_lock again <--- UAF */ /* unlock vma_lock */ Since the vma_lock will unlock immediately after hugetlb_handle_userfault(), let's drop the unneeded lock and unlock in hugetlb_handle_userfault() to fix the issue. [1] https://lore.kernel.org/linux-mm/000000000000d5e00a05e834962e@google.com/ [2] https://lore.kernel.org/linux-mm/20220921014457.1668-1-liuzixian4@huawei.com/ Link: https://lkml.kernel.org/r/20220923042113.137273-1-liushixin2@huawei.com Fixes: 1a1aad8a9b7b ("userfaultfd: hugetlbfs: add userfaultfd hugetlb hook") Signed-off-by: Liu Shixin Signed-off-by: Kefeng Wang Reported-by: syzbot+193f9cee8638750b23cf@syzkaller.appspotmail.com Reported-by: Liu Zixian Reviewed-by: Mike Kravetz Cc: David Hildenbrand Cc: John Hubbard Cc: Muchun Song Cc: Sidhartha Kumar Cc: [4.14+] Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/hugetlb.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -4337,6 +4337,7 @@ static vm_fault_t hugetlb_no_page(struct spinlock_t *ptl; unsigned long haddr = address & huge_page_mask(h); bool new_page = false; + u32 hash = hugetlb_fault_mutex_hash(mapping, idx); /* * Currently, we are forced to kill the process in the event the @@ -4346,7 +4347,7 @@ static vm_fault_t hugetlb_no_page(struct if (is_vma_resv_set(vma, HPAGE_RESV_UNMAPPED)) { pr_warn_ratelimited("PID %d killed due to inadequate hugepage pool\n", current->pid); - return ret; + goto out; } /* @@ -4365,7 +4366,6 @@ retry: * Check for page in userfault range */ if (userfaultfd_missing(vma)) { - u32 hash; struct vm_fault vmf = { .vma = vma, .address = haddr, @@ -4380,17 +4380,14 @@ retry: }; /* - * hugetlb_fault_mutex and i_mmap_rwsem must be - * dropped before handling userfault. Reacquire - * after handling fault to make calling code simpler. + * vma_lock and hugetlb_fault_mutex must be dropped + * before handling userfault. Also mmap_lock will + * be dropped during handling userfault, any vma + * operation should be careful from here. */ - hash = hugetlb_fault_mutex_hash(mapping, idx); mutex_unlock(&hugetlb_fault_mutex_table[hash]); i_mmap_unlock_read(mapping); - ret = handle_userfault(&vmf, VM_UFFD_MISSING); - i_mmap_lock_read(mapping); - mutex_lock(&hugetlb_fault_mutex_table[hash]); - goto out; + return handle_userfault(&vmf, VM_UFFD_MISSING); } page = alloc_huge_page(vma, haddr, 0); @@ -4497,6 +4494,8 @@ retry: unlock_page(page); out: + mutex_unlock(&hugetlb_fault_mutex_table[hash]); + i_mmap_unlock_read(mapping); return ret; backout: @@ -4592,10 +4591,12 @@ vm_fault_t hugetlb_fault(struct mm_struc mutex_lock(&hugetlb_fault_mutex_table[hash]); entry = huge_ptep_get(ptep); - if (huge_pte_none(entry)) { - ret = hugetlb_no_page(mm, vma, mapping, idx, address, ptep, flags); - goto out_mutex; - } + if (huge_pte_none(entry)) + /* + * hugetlb_no_page will drop vma lock and hugetlb fault + * mutex internally, which make us return immediately. + */ + return hugetlb_no_page(mm, vma, mapping, idx, address, ptep, flags); ret = 0; From patchwork Mon Oct 24 11:32: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: 9994 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp615854wru; Mon, 24 Oct 2022 12:27:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Wruj6o/7a+aQz28A6F4fWZTBAkl4TLCPzxuRzvWKCpfIl0aqRwVe6UAWYpfvUn13eAJNA X-Received: by 2002:a17:907:7632:b0:7a1:d4f0:e7c5 with SMTP id jy18-20020a170907763200b007a1d4f0e7c5mr10859733ejc.160.1666639642700; Mon, 24 Oct 2022 12:27:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666639642; cv=none; d=google.com; s=arc-20160816; b=NxAKjb0tUkUWXHaJVs7xmSo2jP4v5lncVdIuSpCciZGZ/nLo8xhnPtzEqmLw3Irm+I Y4PRLJMAi78uXH5okQihqmqua7LNy29C88u3zbIF5aJsm2UGraW5fKdPx8Qz+aiuzLAl 3Y+LsOpCeVejAoTxMru//hYYmXJxQUbPIFbXzJaaQ6vw1zb70bmhr+B86OINtJ35XJuH CC8ZCWVXz5uWx9wzb5BaycKX7w1juwuwsiZ2CHIn2Tb9ELiVHlzWkaJ/PGY50FWury+S zJoWfyFJd2nJ60yfA6KFvcb5mHecEECyp0OcrvI3+6P1R9OPe6pkZet/C3UOuww5jSMs 4sOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=AIQ4P3eUeSSZGK2aYuOvd8bDTUL7RCTgj6987eS4s4CxlanWw85Er2p0GyfZhQRgdJ mziJ6cqk88iGdfkswzhGdo5k1VOcJwbq/+zUFF+sl4JRpoYaJykpdZn2PcEEXWwsXyYY V5XyjqwVCd8+Eh3eruH3Wv9QbesJo9tKpzPlACT8+9hmU4HPJnMkOtBeOMo6FACzolv7 7yiv5+GuhNCXWm475BgREEhvoMddNeMLLRf5x9KnAHreDwamxXznmuQ18mszXOWuRkvh xccrkeYBMWWJexnvdM2rmiTDgVpoz38kaAdEI/0ss4jMqlo+uOzj0hG7pnfFArzg+3Mk 7Fow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DDX6FhU7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y6-20020a056402270600b004615c5728e8si675270edd.494.2022.10.24.12.26.58; Mon, 24 Oct 2022 12:27: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=DDX6FhU7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232354AbiJXTZS (ORCPT + 99 others); Mon, 24 Oct 2022 15:25:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232520AbiJXTXE (ORCPT ); Mon, 24 Oct 2022 15:23:04 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA21C29C; Mon, 24 Oct 2022 10:57: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 sin.source.kernel.org (Postfix) with ESMTPS id 688DCCE1345; Mon, 24 Oct 2022 12:33:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 693AEC433B5; Mon, 24 Oct 2022 12:33:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614798; bh=OjZ0L2KyAgkZPt75DZB7YHk9PytepHMPjogVsy2mw0A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DDX6FhU7l0QX2G5OUh6WYgz3iyuXEInm/7K+jhHZslTUxRRV4iJ17AJLqQ1bApjGD 63bNkVJFyt7twku02t2R3KecHGDhF9skoGpdBqYCxbtjK9ANODuKonfdTRPSoNw9IH eeuQzI/kpyk6UnCxOP2Vks+NfT3jMp5BEBYojLx8= 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.10 381/390] net: ieee802154: return -EINVAL for unknown addr type Date: Mon, 24 Oct 2022 13:32:58 +0200 Message-Id: <20221024113039.197309148@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747598329913024136?= X-GMAIL-MSGID: =?utf-8?q?1747598329913024136?= 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: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: 9987 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp615392wru; Mon, 24 Oct 2022 12:26:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5aF2IaZ1tC0dbK1BmOJ0WJOrGD3VUz87Baf0tskIC2vDOt8PSnAPa3MgFXenh1jaCABFna X-Received: by 2002:a17:906:2699:b0:781:a473:9791 with SMTP id t25-20020a170906269900b00781a4739791mr29249723ejc.644.1666639563704; Mon, 24 Oct 2022 12:26:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666639563; cv=none; d=google.com; s=arc-20160816; b=X+VVe9Yj7xFDESauo72Gqb+g25RdUIRDx4eK3QBJGBAJkcDWqKzxrztLtB5BMZ07Hm ClS2e+601rShgCmOHGa4h2mpAUjVm96SlEedYnBkDVtYK8JnvwAVjZj+apCj6BIX1qbm lKDe0Q4EzqkU4kYbInvaS79g94lnUCcSikdEAS3SbyqPmxtyNelRkU/yCFCfVe0h87dC 4HCaZmkEe9xRtNB6gX9w+byzsDfoefyLLTNFCKmbiqYDgCGXmpKnQYbsWqb11mTXBjqQ sHaZtrCewPDr2wRc+6dHyzATFNjjw1AfTQ8qFo1mYO6g8rP3KbA+w2WZX4gGom/30CIp IsOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oEEwqC69raoJMfMnlySdFWCf8JFKQXHX8aJ1oV1f+o4=; b=YfIHpUFTSaIVq5d2jHXmUckIE9Vdr3NCTqJJfJxU7WOqJ6by2jfqwM17Kavs2epOp6 VUbMP/AgcR8tgSyxJAh9Tp0bEKn8Ra+SWTLIKwZw4zZylHl69rbvS4kDg5pw/gq4zyee beQ35cjhmnnQv+YTfE4jkIL6yuiWhKCszxzt/SN21G/XgmVaLf7dO6y5l3MlpjnCJU0q V1jTuWsEIakkj3VjSs5HAE8r+YCt7lxHoXxrfq8/OQrZJdcy6DMkv87T3YK/xxCHJhuL 7+ry88wjyfNfGUBm/ZZegTypgHpzN79BnFE13cow1pZ5HT7VpGMeoAMWZfciGQhYUH9G 9vLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="x/hUwflN"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gw24-20020a170906f15800b0078d0f57b0e2si499037ejb.412.2022.10.24.12.25.40; Mon, 24 Oct 2022 12:26:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="x/hUwflN"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232284AbiJXTVU (ORCPT + 99 others); Mon, 24 Oct 2022 15:21:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231464AbiJXTUn (ORCPT ); Mon, 24 Oct 2022 15:20:43 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BE861D1E0B; Mon, 24 Oct 2022 10:56: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 sin.source.kernel.org (Postfix) with ESMTPS id E9567CE147A; Mon, 24 Oct 2022 12:32:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 051E2C433D6; Mon, 24 Oct 2022 12:32:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614775; bh=XFRkCfAJHCaYT5OdRdGtKdxR0dcdcuxZLYpauLQ+i6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x/hUwflNtgDfCXyIjC0pihUr7oc1ZCT7AdObhJLXimqh6weVjp36gn4l3WRFK3K0b 4jM6OJ//Xc5cZwvYfV2/OFZ5O/IbXBUzaYhmdfIu6MTqOXJe2wbVptb3y8JslfIgq0 yUVrrPL1LRxV9rT1UtN2+8OP6v8qtc0iP1cP1CBE= 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.10 382/390] Revert "net/ieee802154: reject zero-sized raw_sendmsg()" Date: Mon, 24 Oct 2022 13:32:59 +0200 Message-Id: <20221024113039.246515196@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747598246809425209?= X-GMAIL-MSGID: =?utf-8?q?1747598246809425209?= 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 d4c162d63634..7edec210780a 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:33: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: 9216 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp459307wru; Mon, 24 Oct 2022 06:39:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM45Yc+xX7ygkinV1R0PkW1+uV3Bty59Kg5Dl2U9NdcsbiiBi11ccymW+Ov+c6QVpLpn0edM X-Received: by 2002:a17:906:2699:b0:781:a473:9791 with SMTP id t25-20020a170906269900b00781a4739791mr27851820ejc.644.1666618745934; Mon, 24 Oct 2022 06:39:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618745; cv=none; d=google.com; s=arc-20160816; b=KYaVDXR9yNJTx88ZtL2Fqb41fVK5zxEcPVj8772+djLSrOmcG+NPOsxuEiD2gzqlk/ CBErJ/5QHkdKOZi7Zlhr7JFg7++mgePXDl7a3VE7/9B+4K9JvDGCYfmyPeMFrdhOc1Bk 9V0kDbEVS/dDGF9co9FmwlHakU2MXqE5t072PlVrzb3M4hdEgsoG69rxZQ7NNCnhB358 Is1SXisc7Awm48msgxEyNbBGthpUN/+7zyc1LRVTDk566MeVwIROTxqz4M2IdXhjW/6c 3M7Kim2T1K5DXr9TrEU9Ge9rbbDcGml1o5KNVL9cV1E9pUTH3CO3KaohzqSS1ZZi6zWV 0l0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=u5PtEDXFOiXhs3A2XlO1TlyuCpjSbEaazdjWk3Zg3M0=; b=zDMAB8IYdt9s5J+z/lAYWqSJglA6uWRtdIaHPs5zT15Klus0yPIFKUl5RNTwfojOfE 88k9xqZpyVwSDTjG7PfntPHRCVui8Kba+p4Z98NZD+udHscmUdPW6CHhSUioLPWivqZf igA3BAePK6rjcImdQO8We0zQUwCSL0oe15n/zBCBB3BQBdM5lR3PkOP7QzzOrjiHuJeK FnRElDW4GMEELc0Y5H62YIoN9xv1+aaRFPW25iMqfllu/V7vZZrIplFbgxVSsRLa4A7W 6bgSn2BRRWzif2fpcyvBIg8IzfgshyP4C//u8KEm7cvEITQ1HkbpbqnAQo3y51uuFSu3 QP4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="0tp/xru1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv12-20020a17090760cc00b0078c4a772ea7si31643150ejc.11.2022.10.24.06.38.41; Mon, 24 Oct 2022 06:39:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="0tp/xru1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231589AbiJXNfb (ORCPT + 99 others); Mon, 24 Oct 2022 09:35:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236328AbiJXNat (ORCPT ); Mon, 24 Oct 2022 09:30:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55263ACF6A; Mon, 24 Oct 2022 05:33: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 88C4E612EA; Mon, 24 Oct 2022 12:32:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 993D7C433C1; Mon, 24 Oct 2022 12:32:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614778; bh=prPm0ATSNYkvAd08Z+HiA2aBLpQEIm265Ft6Sna0oPg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0tp/xru1ebgVDh0Tix0um9yZweiWsF7OA4bECs0Q9Pe8xamIm60YK/6jyePZzxnw1 aMlEhaCRUZCy2fYdJSoyEcrh1MbK3LV0QJNx9aTfEZGYRhHOZwtjsGDkyS7ugHf9FP gqrQ1ejgKeqfUq66/j7XHFl9M7m9HMh+Ozegem70= 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.10 383/390] net/ieee802154: dont warn zero-sized raw_sendmsg() Date: Mon, 24 Oct 2022 13:33:00 +0200 Message-Id: <20221024113039.294009918@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576418412179494?= X-GMAIL-MSGID: =?utf-8?q?1747576418412179494?= 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 7edec210780a..ecc0d5fbde04 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:33: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: 10087 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp625220wru; Mon, 24 Oct 2022 12:53:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4fsGcXI+e+C6pzgS34B4dru/S5zy8Opm5lVUhixLd8vTNkyrFPRbwXypBhqLOg9pzizDKz X-Received: by 2002:a17:90b:4b0c:b0:20d:7ffa:4b1b with SMTP id lx12-20020a17090b4b0c00b0020d7ffa4b1bmr74621868pjb.16.1666641226463; Mon, 24 Oct 2022 12:53:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666641226; cv=none; d=google.com; s=arc-20160816; b=lbtTTqClYxttX8jpMQGnH5EoZsw0WzoCK5aRSfpt+0jjRaVml/Ilo5ECPXZAqfUMeV cek8Wd2DHkSwRUHPDkB5i88YR8+ELKjj70FGCCSudUkYi5w9kfwAis/wO4nAr+j+Nou3 5HbaFZMrWk8B8CoY2+XMEjdvwVZohT61moZubf0Ry7ystce4g40j+HeTvkfQ9lSCoA7E OhPF3r73JU1Jj4YojNfhKUhKQgw2hOeCj8+0aoJRrsDN5NDmOawORh/i7KWo5nzQld7I BrZ79NE0BwzO7S2IoJ6wh/d2K452lonNqBkWkeyFO3yUuYwMfgerxRplT2KTy7GPUxTj /hBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NTeqgfbegbPNcnhpOXQ+n4PIAUZgNFdE7BO7vVsgJCs=; b=FRVaGQHyaMzKMg6xrXVBNv2IJf55/qjOWVBZJH3VRCtDmjZNGOKIl4DbdmoWRKi9h4 5CdFt/vdw642BqPFAfAqo0mVZ011L1kI1ehJNEapxARcpXBYKzk4PXLwQjA/FvRMxyPR IzsPK2bzaiFALA3kBlF2WrJeQgJq1gDuhEYlfLcX2FzywU08H01jpMfv8lzpquFy9Kzl nGcaWLAmW0Dzx2mOBbSXl+5InHgBBXnLa1W3UQza2DbyzBnu1/2HVTXaxGTdlAhyxbLc 8wo1TubFEpyX2DY1xJiiXoN2u0+jCv18qRLjf06wxAmoinMd+FVADGq/ZhXb6/WEkDDF iOKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tERuVVmT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l18-20020a170902d35200b001854f631c8esi406826plk.221.2022.10.24.12.53.33; Mon, 24 Oct 2022 12:53:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tERuVVmT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233755AbiJXTw7 (ORCPT + 99 others); Mon, 24 Oct 2022 15:52:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232017AbiJXTvv (ORCPT ); Mon, 24 Oct 2022 15:51:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA16712090; Mon, 24 Oct 2022 11:17: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 E0DB1B81707; Mon, 24 Oct 2022 12:33:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47539C433D6; Mon, 24 Oct 2022 12:33:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614780; bh=KN6zdcrsXcZJMufsfn/WcJ8PZyFn64Q/Y6o20hfW248=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tERuVVmTzteLI3iIfV7qu2cdH85DEEhJ4pT/wwllvo4oywk1Bm2TBZvR1mq5zal9g Prg8Js6feaJfHmV7BbHUJH6ZN9UEbSGXEeZKUBGMi+WluAOqCNrk76bzqCZRZ2YG+v mXxAGHl6aREbPzb79hil68b46CddpHY6K9X8K61A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shuah Khan Subject: [PATCH 5.10 384/390] Revert "drm/amdgpu: move nbio sdma_doorbell_range() into sdma code for vega" Date: Mon, 24 Oct 2022 13:33:01 +0200 Message-Id: <20221024113039.334437223@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599990728316628?= X-GMAIL-MSGID: =?utf-8?q?1747599990728316628?= From: Shuah Khan This reverts commit 9f55f36f749a7608eeef57d7d72991a9bd557341 which is commit e3163bc8ffdfdb405e10530b140135b2ee487f89 upstream. This commit causes repeated WARN_ONs from drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amd gpu_dm.c:7391 amdgpu_dm_atomic_commit_tail+0x23b9/0x2430 [amdgpu] dmesg fills up with the following messages and drm initialization takes a very long time. Cc: # 5.10 Signed-off-by: Shuah Khan Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 5 ----- drivers/gpu/drm/amd/amdgpu/soc15.c | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 5 deletions(-) --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c @@ -1475,11 +1475,6 @@ static int sdma_v4_0_start(struct amdgpu WREG32_SDMA(i, mmSDMA0_CNTL, temp); if (!amdgpu_sriov_vf(adev)) { - ring = &adev->sdma.instance[i].ring; - adev->nbio.funcs->sdma_doorbell_range(adev, i, - ring->use_doorbell, ring->doorbell_index, - adev->doorbell_index.sdma_doorbell_range); - /* unhalt engine */ temp = RREG32_SDMA(i, mmSDMA0_F32_CNTL); temp = REG_SET_FIELD(temp, SDMA0_F32_CNTL, HALT, 0); --- a/drivers/gpu/drm/amd/amdgpu/soc15.c +++ b/drivers/gpu/drm/amd/amdgpu/soc15.c @@ -1332,6 +1332,25 @@ static int soc15_common_sw_fini(void *ha return 0; } +static void soc15_doorbell_range_init(struct amdgpu_device *adev) +{ + int i; + struct amdgpu_ring *ring; + + /* sdma/ih doorbell range are programed by hypervisor */ + if (!amdgpu_sriov_vf(adev)) { + for (i = 0; i < adev->sdma.num_instances; i++) { + ring = &adev->sdma.instance[i].ring; + adev->nbio.funcs->sdma_doorbell_range(adev, i, + ring->use_doorbell, ring->doorbell_index, + adev->doorbell_index.sdma_doorbell_range); + } + + adev->nbio.funcs->ih_doorbell_range(adev, adev->irq.ih.use_doorbell, + adev->irq.ih.doorbell_index); + } +} + static int soc15_common_hw_init(void *handle) { struct amdgpu_device *adev = (struct amdgpu_device *)handle; @@ -1351,6 +1370,12 @@ static int soc15_common_hw_init(void *ha /* enable the doorbell aperture */ soc15_enable_doorbell_aperture(adev, true); + /* HW doorbell routing policy: doorbell writing not + * in SDMA/IH/MM/ACV range will be routed to CP. So + * we need to init SDMA/IH/MM/ACV doorbell range prior + * to CP ip block init and ring test. + */ + soc15_doorbell_range_init(adev); return 0; } From patchwork Mon Oct 24 11:33: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: 9332 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp466557wru; Mon, 24 Oct 2022 06:55:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM46+HhvDuL3zbiCH976I2xWHRAhuk0HzANbE/YfAu+HJH7MPgHnpgyOQe52ARBEsoIPvE1r X-Received: by 2002:a17:902:b210:b0:17d:c3ca:4a4f with SMTP id t16-20020a170902b21000b0017dc3ca4a4fmr32643630plr.33.1666619724331; Mon, 24 Oct 2022 06:55:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619724; cv=none; d=google.com; s=arc-20160816; b=rsHo1JmaC639EpgVTz1GfhB9mQeXqP4rELFWwsWKTXYpeEH0nIVhWFDY4Bg5xnlWNJ RH6qj9x5Z2rriNQWsPHU077M1aBmtDmlV3o+lwcoZBOSymDGL/XjHIyrC3EexFSf+jNr WzNI+jbb10iPRV/HZJIwyEjy8O6BZcGOde5U/TpgF1Y08zo2MyOwshsqgBgmWQvEqV5C c0hSULic5chqmlezlXqTBj7UO5BkQnfxRMvv2hcSCDtXBPXVsQvKG07vwb9z1EV9KILS /3PbQqbqYWWTMWv528bSSAiGGYaryXpWP1vf+RtwUcmb5mYzG0BT/hRrmyA3Vqqed+N2 svww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0WxvFn1hQwre//tJdjZz3m1ITOWz52m+U27nbrsjVY4=; b=xCOWvvs/LU6hcSn2yM2cJtIFqR8yVIzzKW29TBpQ+Wx51lWDwGkQ4SuxGdkHJfr61D QRBShReVBnNxgCZah/eRuliht/p+iaxXo9iU2UPxCJDPytmBjm0GVMq7s1fBLpwRQMAE nDUP9ZluyYbTBsFDEH4V+7I4Pspfn4w5ZF64T4K1TECQiyqtBQbUMoH4sLVZ71DZvka4 tARdirzBC64Ar/Z3JuhHz8H/PCWO6EmDde6PQrQYYRwmgNG6WOPfPA2aDYL7pDy07GGI yopTEUYkNoRLCnek63crEZqolAgF8R1Lgty3vVhbFU6dD2hOufgo94Rny0zIjZpqAMfp iogg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=op8mMeUZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902da9200b00179f8a3f838si39508043plx.593.2022.10.24.06.55.10; Mon, 24 Oct 2022 06: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=op8mMeUZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236745AbiJXNyA (ORCPT + 99 others); Mon, 24 Oct 2022 09:54:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236600AbiJXNw7 (ORCPT ); Mon, 24 Oct 2022 09:52: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 9B318BBE3F; Mon, 24 Oct 2022 05:43: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 C19F361311; Mon, 24 Oct 2022 12:33:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7F32C433D7; Mon, 24 Oct 2022 12:33:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614783; bh=NPOknD0rJ0I/KWRESIDmNBsqO1xyQsFCXZyiqgfPqj0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=op8mMeUZE0neJYd3c2Ogkvzi7dQTYt3NlU/AtTGF2f0oyeUHTW8A3kiaATVt+CVOQ +wEEU7vv+UkgTGcdYD+HVY8lCT8zhpU3LPBPZe4/NoJILzyNjhtidIcyB1CfHFJ8YT AsV9Vo2CRQZzJfw0+18E8jvaBDkVDDljNn86Zrmg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shuah Khan Subject: [PATCH 5.10 385/390] Revert "drm/amdgpu: use dirty framebuffer helper" Date: Mon, 24 Oct 2022 13:33:02 +0200 Message-Id: <20221024113039.374918348@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747577444231909501?= X-GMAIL-MSGID: =?utf-8?q?1747577444231909501?= From: Shuah Khan This reverts commit 867b2b2b6802fb3995a0065fc39e0e7e20d8004d which is commit 66f99628eb24409cb8feb5061f78283c8b65f820 upstream. With this commit, dmesg fills up with the following messages and drm initialization takes a very long time. This commit has bee reverted from 5.4 [drm] Fence fallback timer expired on ring sdma0 [drm] Fence fallback timer expired on ring gfx [drm] Fence fallback timer expired on ring sdma0 [drm] Fence fallback timer expired on ring gfx [drm] Fence fallback timer expired on ring sdma0 [drm] Fence fallback timer expired on ring sdma0 [drm] Fence fallback timer expired on ring sdma0 [drm] Fence fallback timer expired on ring gfx Cc: # 5.10 Signed-off-by: Shuah Khan Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 -- 1 file changed, 2 deletions(-) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -499,7 +498,6 @@ bool amdgpu_display_ddc_probe(struct amd static const struct drm_framebuffer_funcs amdgpu_fb_funcs = { .destroy = drm_gem_fb_destroy, .create_handle = drm_gem_fb_create_handle, - .dirty = drm_atomic_helper_dirtyfb, }; uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev, From patchwork Mon Oct 24 11:33: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: 9213 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp459219wru; Mon, 24 Oct 2022 06:39:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6EwP3/m5m3OsPHAW/zcqtpz6rCfMGx9TBhlYqIj+x2ZVA00gPRIGs5Bk9OP9SmfWtYCCbO X-Received: by 2002:a17:907:3f91:b0:78e:2fdc:92a3 with SMTP id hr17-20020a1709073f9100b0078e2fdc92a3mr26074486ejc.770.1666618747000; Mon, 24 Oct 2022 06:39:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618746; cv=none; d=google.com; s=arc-20160816; b=LQeejj0pjkd2vw/62SPjJ2TcFhQWtMlJrTsTNgfdSCbuMSiY166WmNkjNhl6HX4OHL perh0Efh/qZByjaw8ihFWEgb1aOoF+Eiaijo5vG6iGy47gpMDtcJSAwCPdVDAVlXc52R 95+2mYna1JDgRgxwhxX40etVkD2wb4gzy69m5s5FNBQMIRvuhcjKH8X2A+sWk7/YMvYn LehTriFNgcYQ/Zu+LDHyyEZng7MIWo6/T/cg59zAhHeD7OtECBBSOPl/mwk5wvMX05WJ P3ipcYPTh9YdZUb8yp9LV0VMX7mRQZMyKj4zmlLhPAoEWjrlEom2ezXPJxZeoHwoFBP2 GkRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Dc6iPtvmGaWka3gqLYOd/VKNfy1Tpm1+rtnybA6VT6M=; b=EWNVAMTE+kQGE/PDWT2pxVSDYgSHeVcC/xNgzqCN+2Xsgq+Qi18uL53Uct/cbrFNrW RcoF/Zik3Rv6v7bwJtIYE1bOPZ8dyOvw0TxpcUbqT+q2HzIdUylDE/ZVQiETJY1I1D+k UdX8MTWG1n+bCtDnYCxwU9KYYkBE7NjLCuRTk3gUmvlu0lQGwbvnAx8xxRhyTIbb9NKp ZqtGQGSH2R4FEsH1+X6Elhr4JFH1R5dQ3XGVQahxlPYFp2ySLlw3wFgxHjYluJ8ko656 jRilXdI3pEOfwp94e31Q5BqbHEN+A39gO7+Ln34BwoOkVfDFJdp1HDsA/M7jzkhcYBAg fhmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=f9GmnhJc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id et3-20020a056402378300b004534c7d4ebfsi25988749edb.434.2022.10.24.06.38.42; 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=f9GmnhJc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232307AbiJXNfk (ORCPT + 99 others); Mon, 24 Oct 2022 09:35:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236347AbiJXNaw (ORCPT ); Mon, 24 Oct 2022 09:30: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 CBD0DACF6D; Mon, 24 Oct 2022 05:33: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 68C58612B2; Mon, 24 Oct 2022 12:33:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7728DC433D6; Mon, 24 Oct 2022 12:33:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614785; bh=m46WRPqwV8xo+n5ULSOirJuExbBMsPyhDHOI55Rofmw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f9GmnhJc/qb3oeMiPTLqDwQJLrJtYN3jgBmD0Le38hL5YlEYvGZqq/KMpnKN+ME9d 6Z/+Co/S2HBWExluObRv5I3lwZQDZ0NvhZNLG7ywg9tjegmbvkUPDGntwT2eCnh8qj sr7Pmoh/eXz5/i1Z+wgP2dQMCYeLbD3mf+A/oWRE= 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.10 386/390] ext4: continue to expand file system when the target size doesnt reach Date: Mon, 24 Oct 2022 13:33:03 +0200 Message-Id: <20221024113039.412630993@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576419216741909?= X-GMAIL-MSGID: =?utf-8?q?1747576419216741909?= 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 @@ -2068,7 +2068,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:33: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: 10075 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp624786wru; Mon, 24 Oct 2022 12:52:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7HyQiOFS4vSy/3+AA+VR+ty2T5qS2LLMEhbPsDcMze44g9/GhKIQ4BBQEtnb3z5RE7AC1x X-Received: by 2002:a17:902:f687:b0:185:4163:3368 with SMTP id l7-20020a170902f68700b0018541633368mr35662606plg.25.1666641154898; Mon, 24 Oct 2022 12:52:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666641154; cv=none; d=google.com; s=arc-20160816; b=ez0wX9P4XPH4W+p5Ozos+qwXb4QMa15M/Y7rymZPnlkKt9qOjbwbaRPlZ3jkjBQuA7 8AqdVf4ocGduwPMceewpO2USqsTUABlPzfC5PUSs4W9a6vabV+YhcHnImKeM01oXxQ4x jJ22DcGRl56v9f3DTZ3Aiiuus7Mkp1Pxo8RBu5VUbGEt79u3ruE+317kghm8W07AB02/ oZtwbbxc5OVL0/YfHW9m4iBBJhxrOPmy19CSMTHbaynqxtTuDvFBsyKksE9D/aT3e2Ow fnatzamNA0+eDg95Z4G/fbFk7wGeaAcEnqLBfat8OslaMrqdYBchNnoJUgZkPgLUzMZ0 igGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RlbhFox2LoSXQXzXCMwSBAGyjZikBEY//VLEzXzPRXw=; b=RVj3lskbAr9x6OweQQ6/kxbb/DghFrXr4lZrWtuLxvqYrtkoo1IfNAWN9YNkpmiawI jrKAihWugtPssZLvnwZCuP3c7/DUdIMI1nCAjfnQ8LZOEqfBoIk0f6+dGBuiCCFMJsox 5GUMUtNcSkw2WHUutgugVBq0nP69X49MhXMTRion/zysUNb54GZDP/X6dZ9+uPWs33gG y79wsGl1ETpxWpVVk6O3MnoezH6dcMF/MDvidTfW5NLf5s4J4nuqFJ4JVnUhJFJWf+Ng o9RY2LfWto9d767aMG93w4IY3KYwQNvtqD/8m4I7KdR0VEsP0bBsq3mtMo6FcYDacAFk 5azg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="rc/uXL1d"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w20-20020a634914000000b0043abd68507esi424810pga.392.2022.10.24.12.52.21; Mon, 24 Oct 2022 12:52: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="rc/uXL1d"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232049AbiJXTvy (ORCPT + 99 others); Mon, 24 Oct 2022 15:51:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232498AbiJXTv0 (ORCPT ); Mon, 24 Oct 2022 15:51: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 9674B27B081; Mon, 24 Oct 2022 11: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 ams.source.kernel.org (Postfix) with ESMTPS id B0E7BB811C5; Mon, 24 Oct 2022 12:33:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DAAAC433B5; Mon, 24 Oct 2022 12:33:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614788; bh=he+o9fSBeQgAEsT/bGqcFZ43PVDHX7iLxCrq5dah16Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rc/uXL1dhwFTqw70O43z5NtLsS+2LypAU4zGEtzULLsTXG0kiMX/TelvMcKTPuoe2 u1ojMAr4jyr22BK1xXFGOIbilZnzzetoTP9MvIFpICKPFJXsD4gYsVqi0LRN1vOIB+ 67nSM9iBGWIp0v0Ri2Lnrzqfs4ySrsTGKG/YAaiw= 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.10 387/390] inet: fully convert sk->sk_rx_dst to RCU rules Date: Mon, 24 Oct 2022 13:33:04 +0200 Message-Id: <20221024113039.459596539@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599915367830271?= X-GMAIL-MSGID: =?utf-8?q?1747599915367830271?= 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 @@ -421,7 +421,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 @@ -158,7 +158,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 @@ -2816,8 +2816,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 @@ -5777,7 +5777,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 @@ -1670,15 +1670,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); @@ -1753,7 +1756,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); @@ -2162,7 +2165,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 @@ -2193,7 +2193,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; } @@ -2383,7 +2383,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); @@ -2541,7 +2541,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 @@ -107,7 +107,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); } @@ -1482,15 +1482,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; } } @@ -1842,7 +1845,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 @@ -941,7 +941,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) { @@ -1055,7 +1055,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:33: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: 10174 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp640848wru; Mon, 24 Oct 2022 13:33:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Rm/jJjBgkXKso2OqmZAR8lC3MITltxYNH+wX+Ns13iHEZO0jjAv6D14NoqeFSaFtxxPCC X-Received: by 2002:a05:6a00:168e:b0:53b:3f2c:3213 with SMTP id k14-20020a056a00168e00b0053b3f2c3213mr35218321pfc.56.1666643623755; Mon, 24 Oct 2022 13:33:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643623; cv=none; d=google.com; s=arc-20160816; b=L2BCNIy826sk6XoEWKhqofLj3fdohXPmJ2gKwKYiW+8SBSEtbgS0LN1Qh8d6rAMLmN 7WNE1cT8HeIWAfxOBGGBe72EJQ2LehSlErsGhXA7693P+zeGhzdpYdlIbvS87Cu3f7IT c3V2sOo9BK73ADHU7vmu/oZLsEBqyXnzpGl7MtcANoV1eZSA+ObTAcVNA5JSf9+xbBlU n2nLNu5Z4yI43ZoGBhVOS0wwDsBp4G8LsDkvAVXJRMnZ7joDNoh1wlS4jqdZqqtbLrBc N7s6vckHd3WF7qA2aR23/sm2VoelxA0r4YmoIvMTvtxHJ+ObPHT83zHUBJoavevTcvhT NScg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vs6CA6HZUEE4hdopd+3UrlFv4oKFlsugaK5trybsL7Q=; b=NK3cA1EUFrTyyRQi5AOpeKRg8WnAxG9wMyX7qQy92EXM0/MRjerCsfnhwH29qoh3Kk JI3M9Z6IcSp59dgrEa+A15QSpySM4UXdu9WP1J0iPBamoDTryoK7EdMUkgqThBszcrTK fVzsFO12htw2beM2PAN7+fuLFxb99uuO7aAXlS9h2HiyefzF9SSpW/Vx11ScYcbbPvuR aGRB6bp6W+MhnCe4TC9Jp+b8WkS1bLlVuGEaaibJ09oBi6H/es47/EEdXjmn/xr3XU+X 14DK7pawz6SZVRi2KwmvV5whPqR8cHHSB66ZS5dtVoRYrZjPfXMPh1wFU+NmtFa1Dc5O GGqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=esIBHyrf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j191-20020a6380c8000000b0046afcba3088si457591pgd.735.2022.10.24.13.33.30; Mon, 24 Oct 2022 13:33:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=esIBHyrf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234216AbiJXUV0 (ORCPT + 99 others); Mon, 24 Oct 2022 16:21:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234193AbiJXUUx (ORCPT ); Mon, 24 Oct 2022 16:20:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 890C5127BC9; Mon, 24 Oct 2022 11:37: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 51ABDB81714; Mon, 24 Oct 2022 12:33:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8BCFC433D6; Mon, 24 Oct 2022 12:33:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614791; bh=AW2HmN9TqaQ00WLNTP/efmBXWbdmYViKnrGlcIbwwjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=esIBHyrfZld3/bmDjWGOPPjJel04SBoJ1mA5ByF31/LTD1AyYe/6AMrC2MQkCpBUT MPErjeOjNr8qxF2wBLFTBGirFcHqqD3dXsNcbc9J9BnASou68aB9arPrsQfxQHD0vm 7ZFW7HhL/6wN3gDne55bSGecWp+AzAEzTp35W2Ec= 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.10 388/390] thermal: intel_powerclamp: Use first online CPU as control_cpu Date: Mon, 24 Oct 2022 13:33:05 +0200 Message-Id: <20221024113039.490974083@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602504113490692?= X-GMAIL-MSGID: =?utf-8?q?1747602504113490692?= 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 @@ -531,11 +531,7 @@ static int start_power_clamp(void) get_online_cpus(); /* prefer BSP */ - control_cpu = 0; - if (!cpu_online(control_cpu)) { - control_cpu = get_cpu(); - put_cpu(); - } + control_cpu = cpumask_first(cpu_online_mask); clamping = true; schedule_delayed_work(&poll_pkg_cstate_work, 0); From patchwork Mon Oct 24 11:33: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: 9211 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp459207wru; Mon, 24 Oct 2022 06:39:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5goIqlqRN8QOCDfl2+5JtiNaHbG9so3fRGYAhk1xG9xMWXvyHZ79zUTEmEW+3/Hzq+NzxH X-Received: by 2002:a17:907:845:b0:731:2f6c:6dbd with SMTP id ww5-20020a170907084500b007312f6c6dbdmr27454326ejb.551.1666618745632; Mon, 24 Oct 2022 06:39:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618745; cv=none; d=google.com; s=arc-20160816; b=kd5LITLkJ/igHzvDrkATNs8LwCfDcjsXbz9/Cf1cVhR/iGt+DI4WUM0gbqb6qZhuz7 t5PWS4c6YV7C2QLp1briIu0nj70IUx4KeoBRdMS3cpOZ4miUrXDsfieNNELj/WsyHX5t 87sZ/eMYCRwBtK1b9iJH+nYE1fVupMcA7u3mFitfAfctMg6CylLmUAeBHFC4J06yOdU8 q3ReQKwrhpn1uBP70f4BfUTu8eAJ2KSiPrYNu/lehI2+Oo/Zia1TK2SKCy5x9xWkgj5s 6ORV9Mnee0vzvhu218URT9Wr1lDB3w2fciLqkemyVs2b1QvSQbEpNeTPC1YM+Yk5ABMs KdOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PdXM0tSEvd7XBL3vR0Mie5ix/q5kIs0QcGP8p+Cjp0Q=; b=dn7nFn3AdEl4zhXnkjVchJEl7BElaGYpxNMWaiRZAIb3evdswjgjtUYDh+EgcOd0Xr Jt+3rzu80Jj1HGvFDI0l5SOcrBVQzsMePYLChyS1Y4ajwsmCuN4cM7Od1mspKZm+58/W D+nwpK7oZZYmx3nd8i+KmcQSL+McKigj2J6azjflJjG9W9B0eHYLZnzWhSIcvkdMmcMN L5TgcNQsDTtmWKNdLLlrK2qJhX9BN/h9YewIvguCnkNQ52cM6HpwoiLxzulREwawlbRb sCn9+CRjIEbyvKmQaIx64MxHSrp1NLjA3iHcqJULE9lHwpvMSPf7FjNBk+Hj80WWdlL5 6Qvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WmWeM7kM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dz13-20020a0564021d4d00b00453a0393deasi33133877edb.368.2022.10.24.06.38.41; Mon, 24 Oct 2022 06:39:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WmWeM7kM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231947AbiJXNfh (ORCPT + 99 others); Mon, 24 Oct 2022 09:35:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236348AbiJXNaw (ORCPT ); Mon, 24 Oct 2022 09:30:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C2733FD7B; Mon, 24 Oct 2022 05:33: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 32F6261313; Mon, 24 Oct 2022 12:33:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4313DC433C1; Mon, 24 Oct 2022 12:33:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614793; bh=nqodhHA0fSZ4fj1OvI0ZHU49pSobUpzwzF2u4uXB7xg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WmWeM7kMrNSs60bZEc8Kp0bKjGRZP1MJ8vSa5vpqHbejGK2/Lpk7GlmFJTd9ukR7O IDNEmJznIubNE5VcVSpwx+lxdtHCzvyoPvbt4RF/B/EY3b/MBqeIl0HwnJKGVaR/XF NY+nEc6ouubAx13hGBMMzvwvJPiwj1e0Ac7gGd1g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim Subject: [PATCH 5.10 389/390] f2fs: fix wrong condition to trigger background checkpoint correctly Date: Mon, 24 Oct 2022 13:33:06 +0200 Message-Id: <20221024113039.529510342@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576417980591820?= X-GMAIL-MSGID: =?utf-8?q?1747576417980591820?= From: Chao Yu commit cd6d697a6e2013a0a85f8b261b16c8cfd50c1f5f upstream. In f2fs_balance_fs_bg(), it needs to check both NAT_ENTRIES and INO_ENTRIES memory usage to decide whether we should skip background checkpoint, otherwise we may always skip checking INO_ENTRIES memory usage, so that INO_ENTRIES may potentially cause high memory footprint. Fixes: 493720a48543 ("f2fs: fix to avoid REQ_TIME and CP_TIME collision") Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/segment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -550,7 +550,7 @@ void f2fs_balance_fs_bg(struct f2fs_sb_i goto do_sync; /* checkpoint is the only way to shrink partial cached entries */ - if (f2fs_available_free_memory(sbi, NAT_ENTRIES) || + if (f2fs_available_free_memory(sbi, NAT_ENTRIES) && f2fs_available_free_memory(sbi, INO_ENTRIES)) return; From patchwork Mon Oct 24 11:33: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: 9511 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp481908wru; Mon, 24 Oct 2022 07:23:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4pARVUuCr58/ZH9TIRFN+kjvLxL6AC9NLSjfKV5AApiwS3MjzHU4rf4xDuIupXNBLyDBTg X-Received: by 2002:a05:6402:501a:b0:457:f093:cadb with SMTP id p26-20020a056402501a00b00457f093cadbmr30429052eda.143.1666621439602; Mon, 24 Oct 2022 07:23:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621439; cv=none; d=google.com; s=arc-20160816; b=YHL9JNXUOMaF1+DVD5sSKH1BVTy407Ha6Z+IzMzzsKKWOGcQbFUghv8uIn/W3IK8LJ eyxLnOp9OhuQyQs9/9Ypid9JMM7raa7t2d0YqFLDUPvQl3jSPsYzXRsELpuIbirddPEE AFsGyadUppkhwNaJl5g+w/CZVplDLlj4S1WGm3fgxiDMe5HuecQhHkS1oWpA70vo60n7 plmN4xagcrWfTxvLReER1fAxn+o79yJ6SmFV2ClrJmepSO1bgQGISVrbm4ooCDXYF022 w6q6ATMaPjd9zRAkLEA1maBfgR1a+uRgjjCzpOfu2NX3npQo8vk4fID+QzghcrTzhPyO sR1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=rlRWaHmSR4BQOx/mziSkxKTXKFQpdjGCAbJHKhM3Z7GgMprZ0iCz3fR4gGV67Q0rLK nSdZNxNbqpOd6fvEtQ/vwB78f9ryRBHQjLbkUFTZu/DUIBSjDdCQDszScTPsCGJtLx1a l3FVJQ39bInXCd7QK7q5H9YAOFx5I8YT9pL71q18gTYJQLhm16raNUPCE99VLa8pEwGm oOouUucoSQQKavXaeZJjauJ0ps33z+kUX+xBstbCueebZ65cCF09LJv3RDDEf3imA75m u/F9bTN7Hlf/+6/+JmSQk3CsSriDEEzl1N4csMy8smwnnn1jHMmuBw4J9pGlti802ha1 8FRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nq5gbjgP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170906180f00b0078d20d71475si24243088eje.413.2022.10.24.07.23.35; Mon, 24 Oct 2022 07:23: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=nq5gbjgP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235843AbiJXOWP (ORCPT + 99 others); Mon, 24 Oct 2022 10:22:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233583AbiJXOQf (ORCPT ); Mon, 24 Oct 2022 10:16:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89D2BCC836; Mon, 24 Oct 2022 05:56: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 7B380B8171A; Mon, 24 Oct 2022 12:33:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D056BC433C1; Mon, 24 Oct 2022 12:33:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614796; bh=QHolA/OG9b0aq0+4xFDwS22hchZVMgKudTulwkkkeH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nq5gbjgP6pv0emZCv5n7lcXV0/W/4JB+iliVPSs6G0IcNDaeWFC9aWeutAd4pCYyO RQg3ZVADg+XiByk3oZ/qejCBBZLp3/b7sNuOuuuwqPT0l+4B/HOd5FVVKl8aZ+GLvV SRgirzZuWjWkKzmVhA7Beuc+HMVM5kv2yvTmsKnY= 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.10 390/390] gcov: support GCC 12.1 and newer compilers Date: Mon, 24 Oct 2022 13:33:07 +0200 Message-Id: <20221024113039.579086999@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747579242888088837?= X-GMAIL-MSGID: =?utf-8?q?1747579242888088837?= 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,