From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7DDCC43334 for ; Tue, 19 Jul 2022 12:28:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240208AbiGSM21 (ORCPT ); Tue, 19 Jul 2022 08:28:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240169AbiGSM2E (ORCPT ); Tue, 19 Jul 2022 08:28:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A859763901; Tue, 19 Jul 2022 05:10:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 971CBB81B37; Tue, 19 Jul 2022 12:10:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE86AC341D1; Tue, 19 Jul 2022 12:10:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232625; bh=eqJ1kaZrV44f6wYOz6lq1yaPfibIdefM7ab4FIqkoXI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mAse247i1jBU2HNp7e4rccz5qonqbRPdmnH7m8CKkCS6Dl3sWlOwlFFqbJX2Cq51Y QjaxArzvjnSbLMgeIIzPSQ4tT1myOor8nVLohw7MfanruG7t3I9Ez3ukcXdIAD9cls 51e5dyNsPbvEccBMvLimM2cc3Z0aWQWQnMhjldw0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meng Tang , Takashi Iwai Subject: [PATCH 5.15 001/167] ALSA: hda - Add fixup for Dell Latitidue E5430 Date: Tue, 19 Jul 2022 13:52:13 +0200 Message-Id: <20220719114656.873452656@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Meng Tang commit 841bdf85c226803a78a9319af9b2caa9bf3e2eda upstream. Another Dell model, another fixup entry: Latitude E5430 needs the same fixup as other Latitude E series as workaround for noise problems. Signed-off-by: Meng Tang Cc: Link: https://lore.kernel.org/r/20220712060005.20176-1-tangmeng@uniontech.c= om Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- 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 @@ -8704,6 +8704,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_AC= ER_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HE= ADPHONE_AND_MIC), SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), + SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7= X), SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS), SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7= X), SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7= X), From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA54FC433EF for ; Tue, 19 Jul 2022 12:31:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234315AbiGSMbb (ORCPT ); Tue, 19 Jul 2022 08:31:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231387AbiGSM3I (ORCPT ); Tue, 19 Jul 2022 08:29:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD56167163; Tue, 19 Jul 2022 05:10: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 9DD45617B5; Tue, 19 Jul 2022 12:10:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B795C341C6; Tue, 19 Jul 2022 12:10:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232656; bh=sbQIp1iuSqFAx1B/WohVsdh2Cc+XuohFd1zUxHgf1og=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BYFaj3ZLrX4AC+l9hw2DAKsouOsE4qTBeH99ZXDXrg0d69G0Ye3Oa+xM4eR6zZYtC ElI6/BHZrQsdrNNueWVUIXKkFNm3W3AbPM/axGR/iCDtye+mfjq3W3RGq5f/lPA6lM IoOv9khsQqdabWjYv5W14GW4EtDfRrq38P+2eKC4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meng Tang , Takashi Iwai Subject: [PATCH 5.15 002/167] ALSA: hda/conexant: Apply quirk for another HP ProDesk 600 G3 model Date: Tue, 19 Jul 2022 13:52:14 +0200 Message-Id: <20220719114656.967739813@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Meng Tang commit d16d69bf5a25d91c6d8f3e29711be12551bf56cd upstream. There is another HP ProDesk 600 G3 model with the PCI SSID 103c:82b4 that requires the quirk HP_MIC_NO_PRESENCE. Add the corresponding entry to the quirk table. Signed-off-by: Meng Tang Cc: Link: https://lore.kernel.org/r/20220711101744.25189-1-tangmeng@uniontech.c= om Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/pci/hda/patch_conexant.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -944,6 +944,7 @@ static const struct snd_pci_quirk cxt506 SND_PCI_QUIRK(0x103c, 0x828c, "HP EliteBook 840 G4", CXT_FIXUP_HP_DOCK), SND_PCI_QUIRK(0x103c, 0x8299, "HP 800 G3 SFF", CXT_FIXUP_HP_MIC_NO_PRESEN= CE), SND_PCI_QUIRK(0x103c, 0x829a, "HP 800 G3 DM", CXT_FIXUP_HP_MIC_NO_PRESENC= E), + SND_PCI_QUIRK(0x103c, 0x82b4, "HP ProDesk 600 G3", CXT_FIXUP_HP_MIC_NO_PR= ESENCE), SND_PCI_QUIRK(0x103c, 0x836e, "HP ProBook 455 G5", CXT_FIXUP_MUTE_LED_GPI= O), SND_PCI_QUIRK(0x103c, 0x837f, "HP ProBook 470 G5", CXT_FIXUP_MUTE_LED_GPI= O), SND_PCI_QUIRK(0x103c, 0x83b2, "HP EliteBook 840 G5", CXT_FIXUP_HP_DOCK), From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2DAACCA48C for ; Tue, 19 Jul 2022 12:31:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240867AbiGSMaE (ORCPT ); Tue, 19 Jul 2022 08:30:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240284AbiGSM3M (ORCPT ); Tue, 19 Jul 2022 08:29:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A70EF67581; Tue, 19 Jul 2022 05:11: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 6BE9D61772; Tue, 19 Jul 2022 12:11:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E828C341C6; Tue, 19 Jul 2022 12:10:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232659; bh=K2zyLpMT+XKd5jGxKUQWOsfD37JAJYKfQXFsLTKzpSE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ap4rQhE8WfmbW+3ddBlZWEWhUavByxrx8Z9qPpSQJjvMMkDOqz6Mst2kiD1RzNIjU TsOTNRggIX3m6r9uPCQO6rBuUVM/YRhbhAiX0SNZ2Z/pJBBES1c/kpvLFp+tSGR54q mxBUshnnz98bhdoqNfSc0lvwvJNrIU7WtXxcoKts= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meng Tang , Takashi Iwai Subject: [PATCH 5.15 003/167] ALSA: hda/realtek: Fix headset mic for Acer SF313-51 Date: Tue, 19 Jul 2022 13:52:15 +0200 Message-Id: <20220719114657.049527772@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Meng Tang commit 5f3fe25e70559fa3b096ab17e13316c93ddb7020 upstream. The issue on Acer SWIFT SF313-51 is that headset microphone doesn't work. The following quirk fixed headset microphone issue. Note that the fixup of SF314-54/55 (ALC256_FIXUP_ACER_HEADSET_MIC) was not successful on my SF313-51. Signed-off-by: Meng Tang Cc: Link: https://lore.kernel.org/r/20220711081527.6254-1-tangmeng@uniontech.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- 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 @@ -8695,6 +8695,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AI= O_HEADSET_MIC), SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AI= O_HEADSET_MIC), SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HE= ADSET_MIC), + SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MI= C_NO_PRESENCE), SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MI= C_NO_PRESENCE), SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AI= O_HEADSET_MIC), SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACE= R_HEADSET_MIC), From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0C35CCA48E for ; Tue, 19 Jul 2022 12:31:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238923AbiGSMaI (ORCPT ); Tue, 19 Jul 2022 08:30:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239233AbiGSM3O (ORCPT ); Tue, 19 Jul 2022 08:29:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00CE44B49E; Tue, 19 Jul 2022 05:11: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 59DCB61790; Tue, 19 Jul 2022 12:11:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 215B9C341C6; Tue, 19 Jul 2022 12:11:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232662; bh=NDIw0550BlAjQeUJ86DMabZpA7bsOh327jpeTdDHULI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hDb0G6knALbaj7vWsSKn976jZAgZfnpe0NzXfVRUTT4y3mRFJz/q5DQyZBBJSjQkV 7N0Iueuv9C/wnz644/hFaU1YjJWZG+d2ysgifLrZR6OGl1W8fHgfmErAa72bBOBP63 XUzwvUpHsn926IzhQkjk+WgcSeKuXSSpDk55eXKA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meng Tang , Takashi Iwai Subject: [PATCH 5.15 004/167] ALSA: hda/realtek - Fix headset mic problem for a HP machine with alc671 Date: Tue, 19 Jul 2022 13:52:16 +0200 Message-Id: <20220719114657.152138901@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Meng Tang commit dbe75d314748e08fc6e4576d153d8a69621ee5ca upstream. On a HP 288 Pro G6, the front mic could not be detected.In order to get it working, the pin configuration needs to be set correctly, and the ALC671_FIXUP_HP_HEADSET_MIC2 fixup needs to be applied. Signed-off-by: Meng Tang Cc: Link: https://lore.kernel.org/r/20220712092222.21738-1-tangmeng@uniontech.c= om Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- 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 @@ -11003,6 +11003,7 @@ static const struct snd_pci_quirk alc662 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB), SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2), + SND_PCI_QUIRK(0x103c, 0x877e, "HP 288 Pro G6", ALC671_FIXUP_HP_HEADSET_MI= C2), SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MI= C2), SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE), SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50), From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C866CCA47F for ; Tue, 19 Jul 2022 12:30:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240137AbiGSMaM (ORCPT ); Tue, 19 Jul 2022 08:30:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240345AbiGSM3S (ORCPT ); Tue, 19 Jul 2022 08:29:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 394DB67CB3; Tue, 19 Jul 2022 05:11: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 B1E9FB81B31; Tue, 19 Jul 2022 12:11:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FB06C341C6; Tue, 19 Jul 2022 12:11:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232665; bh=myOxGa24Q0NLoBS0Hx/dDNK5aQV8wrjyQ1yqeZ7tf9U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WZ2RNRGBzp35lq3Yo+oPMtqaMMgLlsvyIrR1LF11YoLeWPDqyEqKdD1fyuWZQf7u0 XvPJLFEAHs4gBnv0xNdOpY4640FbLnPgUBKkG9H/Rn21Fj8ScCJoqd6v1oLxqpK37B WkiCr1R9ZJEiw1g0u7rOjaAdWS+Sozp2Y/azwqr4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeremy Szu , Takashi Iwai Subject: [PATCH 5.15 005/167] ALSA: hda/realtek: fix mute/micmute LEDs for HP machines Date: Tue, 19 Jul 2022 13:52:17 +0200 Message-Id: <20220719114657.242905348@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jeremy Szu commit 61d307855eb1a2ae849da445edd5389db8a58a5c upstream. The HP ProBook 440/450 G9 and EliteBook 640/650 G9 have multiple motherboard design and they are using different subsystem ID of audio codec. Add the same quirk for other MBs. Signed-off-by: Jeremy Szu Cc: Link: https://lore.kernel.org/r/20220713022706.22892-1-jeremy.szu@canonical= .com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/pci/hda/patch_realtek.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -8887,6 +8887,10 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x103c, 0x89c3, "HP", ALC285_FIXUP_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF= ), SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC= _BOOST), + SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP= _HP_GPIO_LED), + SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP= _HP_GPIO_LED), + SND_PCI_QUIRK(0x103c, 0x8aa8, "HP EliteBook 640 G9 (MB 8AA6)", ALC236_FIX= UP_HP_GPIO_LED), + SND_PCI_QUIRK(0x103c, 0x8aab, "HP EliteBook 650 G9 (MB 8AA9)", ALC236_FIX= UP_HP_GPIO_LED), SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC), SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300), SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BO= OST), From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83B36C433EF for ; Tue, 19 Jul 2022 12:30:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237548AbiGSMaV (ORCPT ); Tue, 19 Jul 2022 08:30:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240357AbiGSM3S (ORCPT ); Tue, 19 Jul 2022 08:29:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB9E16870E; Tue, 19 Jul 2022 05:11: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 083C3617B5; Tue, 19 Jul 2022 12:11:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E087CC341C6; Tue, 19 Jul 2022 12:11:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232668; bh=rhpQEq/oB6hGwhDnyAMoy3GgV5P1P5xzERDptJlyhb8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FJ7ZtyFTAcvThfxC1AwkF6CBVBXxU0S7VJ9F0TxW7ClTK/uokguMeMuGszKPSy+ce GzFBAiOjahMvW3sfQNDIQn3/jLNI7H5+4CAKHap7i0mdKyPvlwZQ8xy+ywHI3BGyTF OC9weWn8N8mrKnAS1wEDo3oiZqd1Ryfa9N7Yjy2E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meng Tang , Takashi Iwai Subject: [PATCH 5.15 006/167] ALSA: hda/realtek - Fix headset mic problem for a HP machine with alc221 Date: Tue, 19 Jul 2022 13:52:18 +0200 Message-Id: <20220719114657.339485130@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Meng Tang commit 4ba5c853d7945b3855c3dcb293f7f9f019db641e upstream. On a HP 288 Pro G2 MT (X9W02AV), the front mic could not be detected. In order to get it working, the pin configuration needs to be set correctly, and the ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE fixup needs to be applied. Signed-off-by: Meng Tang Cc: Link: https://lore.kernel.org/r/20220713063332.30095-1-tangmeng@uniontech.c= om Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/pci/hda/patch_realtek.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -6780,6 +6780,7 @@ enum { ALC298_FIXUP_LENOVO_SPK_VOLUME, ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, ALC269_FIXUP_ATIV_BOOK_8, + ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE, ALC221_FIXUP_HP_MIC_NO_PRESENCE, ALC256_FIXUP_ASUS_HEADSET_MODE, ALC256_FIXUP_ASUS_MIC, @@ -7707,6 +7708,16 @@ static const struct hda_fixup alc269_fix .chained =3D true, .chain_id =3D ALC269_FIXUP_NO_SHUTUP }, + [ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE] =3D { + .type =3D HDA_FIXUP_PINS, + .v.pins =3D (const struct hda_pintbl[]) { + { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detec= t */ + { 0x1a, 0x01813030 }, /* use as headphone mic, without its own jack det= ect */ + { } + }, + .chained =3D true, + .chain_id =3D ALC269_FIXUP_HEADSET_MODE + }, [ALC221_FIXUP_HP_MIC_NO_PRESENCE] =3D { .type =3D HDA_FIXUP_PINS, .v.pins =3D (const struct hda_pintbl[]) { @@ -8820,6 +8831,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), + SND_PCI_QUIRK(0x103c, 0x2b5e, "HP 288 Pro G2 MT", ALC221_FIXUP_HP_288PRO_= MIC_NO_PRESENCE), SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESE= NCE), SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC), From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C748DC43334 for ; Tue, 19 Jul 2022 12:30:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240327AbiGSMaZ (ORCPT ); Tue, 19 Jul 2022 08:30:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240399AbiGSM3V (ORCPT ); Tue, 19 Jul 2022 08:29:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BB5B67598; Tue, 19 Jul 2022 05:11: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 DC5AA61614; Tue, 19 Jul 2022 12:11:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA18CC341C6; Tue, 19 Jul 2022 12:11:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232671; bh=LsnCz5CVOq/TfFnwBQFFj4Cv7CudoW66po+20PVqBg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oZoiKN4KgZ/3zLcyCRoHXU0qXg9Xw6bb8oiy8odougAdtWKm4BG85hRQuSzNuxfnT pVBP8l3WmC7e/TMWzUelgK2nOHBGvSZOT5dc3WvQScaMlESwZg7HyQXEZT8jDVpglD etET0Yc0rsMD9b92k6RzXkEQTMPxvv1KzXYyTO54= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meng Tang , Takashi Iwai Subject: [PATCH 5.15 007/167] ALSA: hda/realtek - Enable the headset-mic on a Xiaomis laptop Date: Tue, 19 Jul 2022 13:52:19 +0200 Message-Id: <20220719114657.424419693@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Meng Tang commit 9b043a8f386485c74c0f8eea2c287d5bdbdf3279 upstream. The headset on this machine is not defined, after applying the quirk ALC256_FIXUP_ASUS_HEADSET_MIC, the headset-mic works well Signed-off-by: Meng Tang Cc: Link: https://lore.kernel.org/r/20220713094133.9894-1-tangmeng@uniontech.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- 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 @@ -9158,6 +9158,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MI= C), SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MI= C_NO_PRESENCE), SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_M= IC), + SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC), SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSE= T_MIC), SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC= ), SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NU= C8_RUGGED), From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC7FCC43334 for ; Tue, 19 Jul 2022 12:30:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240372AbiGSMah (ORCPT ); Tue, 19 Jul 2022 08:30:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240494AbiGSM3f (ORCPT ); Tue, 19 Jul 2022 08:29:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9EC3691CB; Tue, 19 Jul 2022 05:11: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 44AC6B81B82; Tue, 19 Jul 2022 12:11:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 964F7C341CF; Tue, 19 Jul 2022 12:11:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232674; bh=Xm0MwoDW/hV6tsQcoq3CJwBjGnfYANhsNhn7svWmwSM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fTKqVGnyofBZNQ5wHyQIeMDaJELnjyetFKgGTPwV23U2ReUAfr4kbrbxlc8rSClgp kBoOUc8byOJei/BOuAldeZYGVLH6+mOxRi5H9KY4Q/jcVF+9MpJZz6a5bERJybO+EQ IUZzPadJzizd8dqg+8su+0FbqiRvMbjpTAyBLSgE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juergen Gross , Jan Beulich , Paul Durrant , Jakub Kicinski Subject: [PATCH 5.15 008/167] xen/netback: avoid entering xenvif_rx_next_skb() with an empty rx queue Date: Tue, 19 Jul 2022 13:52:20 +0200 Message-Id: <20220719114657.512129756@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Juergen Gross commit 94e8100678889ab428e68acadf042de723f094b9 upstream. xenvif_rx_next_skb() is expecting the rx queue not being empty, but in case the loop in xenvif_rx_action() is doing multiple iterations, the availability of another skb in the rx queue is not being checked. This can lead to crashes: [40072.537261] BUG: unable to handle kernel NULL pointer dereference at 000= 0000000000080 [40072.537407] IP: xenvif_rx_skb+0x23/0x590 [xen_netback] [40072.537534] PGD 0 P4D 0 [40072.537644] Oops: 0000 [#1] SMP NOPTI [40072.537749] CPU: 0 PID: 12505 Comm: v1-c40247-q2-gu Not tainted 4.12.14-= 122.121-default #1 SLE12-SP5 [40072.537867] Hardware name: HP ProLiant DL580 Gen9/ProLiant DL580 Gen9, B= IOS U17 11/23/2021 [40072.537999] task: ffff880433b38100 task.stack: ffffc90043d40000 [40072.538112] RIP: e030:xenvif_rx_skb+0x23/0x590 [xen_netback] [40072.538217] RSP: e02b:ffffc90043d43de0 EFLAGS: 00010246 [40072.538319] RAX: 0000000000000000 RBX: ffffc90043cd7cd0 RCX: 00000000000= 000f7 [40072.538430] RDX: 0000000000000000 RSI: 0000000000000006 RDI: ffffc90043d= 43df8 [40072.538531] RBP: 000000000000003f R08: 000077ff80000000 R09: 00000000000= 00008 [40072.538644] R10: 0000000000007ff0 R11: 00000000000008f6 R12: ffffc90043c= e2708 [40072.538745] R13: 0000000000000000 R14: ffffc90043d43ed0 R15: ffff88043ea= 748c0 [40072.538861] FS: 0000000000000000(0000) GS:ffff880484600000(0000) knlGS:0= 000000000000000 [40072.538988] CS: e033 DS: 0000 ES: 0000 CR0: 0000000080050033 [40072.539088] CR2: 0000000000000080 CR3: 0000000407ac8000 CR4: 00000000000= 40660 [40072.539211] Call Trace: [40072.539319] xenvif_rx_action+0x71/0x90 [xen_netback] [40072.539429] xenvif_kthread_guest_rx+0x14a/0x29c [xen_netback] Fix that by stopping the loop in case the rx queue becomes empty. Cc: stable@vger.kernel.org Fixes: 98f6d57ced73 ("xen-netback: process guest rx packets in batches") Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich Reviewed-by: Paul Durrant Link: https://lore.kernel.org/r/20220713135322.19616-1-jgross@suse.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/xen-netback/rx.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/net/xen-netback/rx.c +++ b/drivers/net/xen-netback/rx.c @@ -495,6 +495,7 @@ void xenvif_rx_action(struct xenvif_queu queue->rx_copy.completed =3D &completed_skbs; =20 while (xenvif_rx_ring_slots_available(queue) && + !skb_queue_empty(&queue->rx_queue) && work_done < RX_BATCH_SIZE) { xenvif_rx_skb(queue); work_done++; From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09C9BC433EF for ; Tue, 19 Jul 2022 12:30:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240410AbiGSMar (ORCPT ); Tue, 19 Jul 2022 08:30:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240557AbiGSM3l (ORCPT ); Tue, 19 Jul 2022 08:29: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 978876A9DB; Tue, 19 Jul 2022 05:11: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 076F9B81B31; Tue, 19 Jul 2022 12:11:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E492C36AEF; Tue, 19 Jul 2022 12:11:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232676; bh=GWvAQx0tgg8EEA1qM3b01H386Iq5ubCuuE5kSze3yTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eWId6kjQ0NWZbLSwzjDLJFa3QN/KT6pDQgBHqSImehsuTiL/uJuKpAVg32e6/ykY+ tC0Ohk/DpcN/0X4+p/pY2Hb28xSD/bY1Nzw7pu0VeBu5p8lo6vfQobfLTPkMhK79L0 Gk+y5ptnS/hl5upG94laAiPDnD42Svdky866cucc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, chris@accessvector.net, Oleg Nesterov , Linus Torvalds Subject: [PATCH 5.15 009/167] fix race between exit_itimers() and /proc/pid/timers Date: Tue, 19 Jul 2022 13:52:21 +0200 Message-Id: <20220719114657.607636428@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Oleg Nesterov commit d5b36a4dbd06c5e8e36ca8ccc552f679069e2946 upstream. As Chris explains, the comment above exit_itimers() is not correct, we can race with proc_timers_seq_ops. Change exit_itimers() to clear signal->posix_timers with ->siglock held. Cc: Reported-by: chris@accessvector.net Signed-off-by: Oleg Nesterov Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- fs/exec.c | 2 +- include/linux/sched/task.h | 2 +- kernel/exit.c | 2 +- kernel/time/posix-timers.c | 19 ++++++++++++++----- 4 files changed, 17 insertions(+), 8 deletions(-) --- a/fs/exec.c +++ b/fs/exec.c @@ -1298,7 +1298,7 @@ int begin_new_exec(struct linux_binprm * bprm->mm =3D NULL; =20 #ifdef CONFIG_POSIX_TIMERS - exit_itimers(me->signal); + exit_itimers(me); flush_itimer_signals(); #endif =20 --- a/include/linux/sched/task.h +++ b/include/linux/sched/task.h @@ -81,7 +81,7 @@ static inline void exit_thread(struct ta extern void do_group_exit(int); =20 extern void exit_files(struct task_struct *); -extern void exit_itimers(struct signal_struct *); +extern void exit_itimers(struct task_struct *); =20 extern pid_t kernel_clone(struct kernel_clone_args *kargs); struct task_struct *create_io_thread(int (*fn)(void *), void *arg, int nod= e); --- a/kernel/exit.c +++ b/kernel/exit.c @@ -796,7 +796,7 @@ void __noreturn do_exit(long code) =20 #ifdef CONFIG_POSIX_TIMERS hrtimer_cancel(&tsk->signal->real_timer); - exit_itimers(tsk->signal); + exit_itimers(tsk); #endif if (tsk->mm) setmax_mm_hiwater_rss(&tsk->signal->maxrss, tsk->mm); --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c @@ -1051,15 +1051,24 @@ retry_delete: } =20 /* - * This is called by do_exit or de_thread, only when there are no more - * references to the shared signal_struct. + * This is called by do_exit or de_thread, only when nobody else can + * modify the signal->posix_timers list. Yet we need sighand->siglock + * to prevent the race with /proc/pid/timers. */ -void exit_itimers(struct signal_struct *sig) +void exit_itimers(struct task_struct *tsk) { + struct list_head timers; struct k_itimer *tmr; =20 - while (!list_empty(&sig->posix_timers)) { - tmr =3D list_entry(sig->posix_timers.next, struct k_itimer, list); + if (list_empty(&tsk->signal->posix_timers)) + return; + + spin_lock_irq(&tsk->sighand->siglock); + list_replace_init(&tsk->signal->posix_timers, &timers); + spin_unlock_irq(&tsk->sighand->siglock); + + while (!list_empty(&timers)) { + tmr =3D list_first_entry(&timers, struct k_itimer, list); itimer_delete(tmr); } } From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6EBDAC43334 for ; Tue, 19 Jul 2022 12:28:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240209AbiGSM2a (ORCPT ); Tue, 19 Jul 2022 08:28:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240024AbiGSM2H (ORCPT ); Tue, 19 Jul 2022 08:28: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 62DF74B490; Tue, 19 Jul 2022 05:10:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6F002B81B8E; Tue, 19 Jul 2022 12:10:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC45BC341D3; Tue, 19 Jul 2022 12:10:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232628; bh=+KDoRkjBmF3pif3IRz2d5yYUZse+/oAz/rt4lDnLJVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SEoJdXTm6LJHGto5bn29yeF6rMmlPlZ7bmuDJBCiNiMhLqj6CZDfHkowjSZpVY1kC c5eRU+JEEdelTRa6Hf4LuG6fv3JCn9VNNLSJQNY2KeIhgCPdkAb3mkOcOmRWOf1ClX PRO8NAg/aLNIA15SzVlJLVymn2YVIP29ug64UsO0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Axel Rasmussen , Peter Xu , Hugh Dickins , Andrew Morton Subject: [PATCH 5.15 010/167] mm: userfaultfd: fix UFFDIO_CONTINUE on fallocated shmem pages Date: Tue, 19 Jul 2022 13:52:22 +0200 Message-Id: <20220719114657.687671904@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Axel Rasmussen commit 73f37dbcfe1763ee2294c7717a1f571e27d17fd8 upstream. When fallocate() is used on a shmem file, the pages we allocate can end up with !PageUptodate. Since UFFDIO_CONTINUE tries to find the existing page the user wants to map with SGP_READ, we would fail to find such a page, since shmem_getpage_gfp returns with a "NULL" pagep for SGP_READ if it discovers !PageUptodate. As a result, UFFDIO_CONTINUE returns -EFAULT, as it would do if the page wasn't found in the page cache at all. This isn't the intended behavior. UFFDIO_CONTINUE is just trying to find if a page exists, and doesn't care whether it still needs to be cleared or not. So, instead of SGP_READ, pass in SGP_NOALLOC. This is the same, except for one critical difference: in the !PageUptodate case, SGP_NOALLOC will clear the page and then return it. With this change, UFFDIO_CONTINUE works properly (succeeds) on a shmem file which has been fallocated, but otherwise not modified. Link: https://lkml.kernel.org/r/20220610173812.1768919-1-axelrasmussen@goog= le.com Fixes: 153132571f02 ("userfaultfd/shmem: support UFFDIO_CONTINUE for shmem") Signed-off-by: Axel Rasmussen Acked-by: Peter Xu Cc: Hugh Dickins Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- mm/userfaultfd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/mm/userfaultfd.c +++ b/mm/userfaultfd.c @@ -227,7 +227,10 @@ static int mcontinue_atomic_pte(struct m struct page *page; int ret; =20 - ret =3D shmem_getpage(inode, pgoff, &page, SGP_READ); + ret =3D shmem_getpage(inode, pgoff, &page, SGP_NOALLOC); + /* Our caller expects us to return -EFAULT if we failed to find page. */ + if (ret =3D=3D -ENOENT) + ret =3D -EFAULT; if (ret) goto out; if (!page) { From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AB14C43334 for ; Tue, 19 Jul 2022 12:28:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240245AbiGSM2y (ORCPT ); Tue, 19 Jul 2022 08:28:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240194AbiGSM2Z (ORCPT ); Tue, 19 Jul 2022 08:28:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4878764E29; Tue, 19 Jul 2022 05:10: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 6E7CFB81B31; Tue, 19 Jul 2022 12:10:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADC51C36AE3; Tue, 19 Jul 2022 12:10:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232631; bh=d+71EalB50Uc0i6nLQFzHJCfV5jCOiAfGvQG3wu8oN0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kusrt80Obfnxv8/LPq+cWVpnMzSOm4lqshArtUtofocBDPJvtzGy8rOCSmlWM0N8g Ly6/lW3ClGPHvNRSM82TdN+DWMzmY+kO8sm2i3EqJaKXpwFlj2NoG2oFlx2/d7Vdfk ZGneCzmslrrJxgj0TG6Ko0HM6hwS2ioAzBRLGCkI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Gowans , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , =?UTF-8?q?Christian=20K=C3=B6nig?= , "=?UTF-8?q?Jan=20H . =20Sch=C3=B6nherr?=" , Andrew Morton Subject: [PATCH 5.15 011/167] mm: split huge PUD on wp_huge_pud fallback Date: Tue, 19 Jul 2022 13:52:23 +0200 Message-Id: <20220719114657.774064569@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Gowans, James commit 14c99d65941538aa33edd8dc7b1bbbb593c324a2 upstream. Currently the implementation will split the PUD when a fallback is taken inside the create_huge_pud function. This isn't where it should be done: the splitting should be done in wp_huge_pud, just like it's done for PMDs. Reason being that if a callback is taken during create, there is no PUD yet so nothing to split, whereas if a fallback is taken when encountering a write protection fault there is something to split. It looks like this was the original intention with the commit where the splitting was introduced, but somehow it got moved to the wrong place between v1 and v2 of the patch series. Rebase mistake perhaps. Link: https://lkml.kernel.org/r/6f48d622eb8bce1ae5dd75327b0b73894a2ec407.ca= mel@amazon.com Fixes: 327e9fd48972 ("mm: Split huge pages on write-notify or COW") Signed-off-by: James Gowans Reviewed-by: Thomas Hellstr=C3=B6m Cc: Christian K=C3=B6nig Cc: Jan H. Sch=C3=B6nherr Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- mm/memory.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) --- a/mm/memory.c +++ b/mm/memory.c @@ -4491,6 +4491,19 @@ static vm_fault_t create_huge_pud(struct defined(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD) /* No support for anonymous transparent PUD pages yet */ if (vma_is_anonymous(vmf->vma)) + return VM_FAULT_FALLBACK; + if (vmf->vma->vm_ops->huge_fault) + return vmf->vma->vm_ops->huge_fault(vmf, PE_SIZE_PUD); +#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ + return VM_FAULT_FALLBACK; +} + +static vm_fault_t wp_huge_pud(struct vm_fault *vmf, pud_t orig_pud) +{ +#if defined(CONFIG_TRANSPARENT_HUGEPAGE) && \ + defined(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD) + /* No support for anonymous transparent PUD pages yet */ + if (vma_is_anonymous(vmf->vma)) goto split; if (vmf->vma->vm_ops->huge_fault) { vm_fault_t ret =3D vmf->vma->vm_ops->huge_fault(vmf, PE_SIZE_PUD); @@ -4501,19 +4514,7 @@ static vm_fault_t create_huge_pud(struct split: /* COW or write-notify not handled on PUD level: split pud.*/ __split_huge_pud(vmf->vma, vmf->pud, vmf->address); -#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ - return VM_FAULT_FALLBACK; -} - -static vm_fault_t wp_huge_pud(struct vm_fault *vmf, pud_t orig_pud) -{ -#ifdef CONFIG_TRANSPARENT_HUGEPAGE - /* No support for anonymous transparent PUD pages yet */ - if (vma_is_anonymous(vmf->vma)) - return VM_FAULT_FALLBACK; - if (vmf->vma->vm_ops->huge_fault) - return vmf->vma->vm_ops->huge_fault(vmf, PE_SIZE_PUD); -#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ +#endif /* CONFIG_TRANSPARENT_HUGEPAGE && CONFIG_HAVE_ARCH_TRANSPARENT_HUGE= PAGE_PUD */ return VM_FAULT_FALLBACK; } =20 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BCE2CCA481 for ; Tue, 19 Jul 2022 12:28:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240197AbiGSM2w (ORCPT ); Tue, 19 Jul 2022 08:28:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240182AbiGSM2Z (ORCPT ); Tue, 19 Jul 2022 08:28: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 D45D26556D; Tue, 19 Jul 2022 05:10: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 A8A2861746; Tue, 19 Jul 2022 12:10:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 782B3C341CA; Tue, 19 Jul 2022 12:10:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232633; bh=rq7NF9/tOFm6Aq6DbFiY6QDlf4ceEsnv+kPLrsWJb/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lr59wufhKjtYqt+wiKe0uedCjFocUnf57f3wxwQ/GUm9EOnlcJqtrtJalx99UhLBY q4YEFVHPaexktuM3tiBFNgOtWLlpW+2Prf5NkP63Q3+WZa9faNsZ5/CxQFjY615z// fnsDdpda8wptKBT67k0uR9Ea3IxzHwb4nz+6eiRY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Steven Rostedt , Tom Zanussi , Zheng Yejian Subject: [PATCH 5.15 012/167] tracing/histograms: Fix memory leak problem Date: Tue, 19 Jul 2022 13:52:24 +0200 Message-Id: <20220719114657.877994957@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zheng Yejian commit 7edc3945bdce9c39198a10d6129377a5c53559c2 upstream. This reverts commit 46bbe5c671e06f070428b9be142cc4ee5cedebac. As commit 46bbe5c671e0 ("tracing: fix double free") said, the "double free" problem reported by clang static analyzer is: > In parse_var_defs() if there is a problem allocating > var_defs.expr, the earlier var_defs.name is freed. > This free is duplicated by free_var_defs() which frees > the rest of the list. However, if there is a problem allocating N-th var_defs.expr: + in parse_var_defs(), the freed 'earlier var_defs.name' is actually the N-th var_defs.name; + then in free_var_defs(), the names from 0th to (N-1)-th are freed; IF ALLOCATING PROBLEM HAPPENED HERE!!! -+ \ | 0th 1th (N-1)-th N-th V +-------------+-------------+-----+-------------+----------- var_defs: | name | expr | name | expr | ... | name | expr | name | /// +-------------+-------------+-----+-------------+----------- These two frees don't act on same name, so there was no "double free" problem before. Conversely, after that commit, we get a "memory leak" problem because the above "N-th var_defs.name" is not freed. If enable CONFIG_DEBUG_KMEMLEAK and inject a fault at where the N-th var_defs.expr allocated, then execute on shell like: $ echo 'hist:key=3Dcall_site:val=3D$v1,$v2:v1=3Dbytes_req,v2=3Dbytes_allo= c' > \ /sys/kernel/debug/tracing/events/kmem/kmalloc/trigger Then kmemleak reports: unreferenced object 0xffff8fb100ef3518 (size 8): comm "bash", pid 196, jiffies 4295681690 (age 28.538s) hex dump (first 8 bytes): 76 31 00 00 b1 8f ff ff v1...... backtrace: [<0000000038fe4895>] kstrdup+0x2d/0x60 [<00000000c99c049a>] event_hist_trigger_parse+0x206f/0x20e0 [<00000000ae70d2cc>] trigger_process_regex+0xc0/0x110 [<0000000066737a4c>] event_trigger_write+0x75/0xd0 [<000000007341e40c>] vfs_write+0xbb/0x2a0 [<0000000087fde4c2>] ksys_write+0x59/0xd0 [<00000000581e9cdf>] do_syscall_64+0x3a/0x80 [<00000000cf3b065c>] entry_SYSCALL_64_after_hwframe+0x46/0xb0 Link: https://lkml.kernel.org/r/20220711014731.69520-1-zhengyejian1@huawei.= com Cc: stable@vger.kernel.org Fixes: 46bbe5c671e0 ("tracing: fix double free") Reported-by: Hulk Robot Suggested-by: Steven Rostedt Reviewed-by: Tom Zanussi Signed-off-by: Zheng Yejian Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- kernel/trace/trace_events_hist.c | 2 ++ 1 file changed, 2 insertions(+) --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -4056,6 +4056,8 @@ static int parse_var_defs(struct hist_tr =20 s =3D kstrdup(field_str, GFP_KERNEL); if (!s) { + kfree(hist_data->attrs->var_defs.name[n_vars]); + hist_data->attrs->var_defs.name[n_vars] =3D NULL; ret =3D -ENOMEM; goto free; } From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21026C43334 for ; Tue, 19 Jul 2022 12:29:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240022AbiGSM26 (ORCPT ); Tue, 19 Jul 2022 08:28:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239664AbiGSM2i (ORCPT ); Tue, 19 Jul 2022 08:28:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B99C065D5B; Tue, 19 Jul 2022 05:10: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 7F60E6177E; Tue, 19 Jul 2022 12:10:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CE93C341C6; Tue, 19 Jul 2022 12:10:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232636; bh=kPJAsjLpGBb2Q5ipTE7OnPID7nGe121aKEl9He9CuPQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JInfe+sNLlK7r/GJZ1xpO/AMrIPBz5fnHfkJsKjeYYM4PA1+sMW4xVniXGzJIBnLq 2t/eZKqs5GiRx9jIow8FgU0ukQt2Pa8dZ1TbRH93DlzFlYc5mQTtGCv8Hd2rWguTrY dm+t49Nfcdn4tuTXotwEY9JLFgdBI5t6HNr5q7Y8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Steven Rostedt (Google)" , Kuniyuki Iwashima , "David S. Miller" Subject: [PATCH 5.15 013/167] net: sock: tracing: Fix sock_exceed_buf_limit not to dereference stale pointer Date: Tue, 19 Jul 2022 13:52:25 +0200 Message-Id: <20220719114657.982708181@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steven Rostedt (Google) commit 820b8963adaea34a87abbecb906d1f54c0aabfb7 upstream. The trace event sock_exceed_buf_limit saves the prot->sysctl_mem pointer and then dereferences it in the TP_printk() portion. This is unsafe as the TP_printk() portion is executed at the time the buffer is read. That is, it can be seconds, minutes, days, months, even years later. If the proto is freed, then this dereference will can also lead to a kernel crash. Instead, save the sysctl_mem array into the ring buffer and have the TP_printk() reference that instead. This is the proper and safe way to read pointers in trace events. Link: https://lore.kernel.org/all/20220706052130.16368-12-kuniyu@amazon.com/ Cc: stable@vger.kernel.org Fixes: 3847ce32aea9f ("core: add tracepoints for queueing skb to rcvbuf") Signed-off-by: Steven Rostedt (Google) Acked-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- include/trace/events/sock.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/include/trace/events/sock.h +++ b/include/trace/events/sock.h @@ -98,7 +98,7 @@ TRACE_EVENT(sock_exceed_buf_limit, =20 TP_STRUCT__entry( __array(char, name, 32) - __field(long *, sysctl_mem) + __array(long, sysctl_mem, 3) __field(long, allocated) __field(int, sysctl_rmem) __field(int, rmem_alloc) @@ -110,7 +110,9 @@ TRACE_EVENT(sock_exceed_buf_limit, =20 TP_fast_assign( strncpy(__entry->name, prot->name, 32); - __entry->sysctl_mem =3D prot->sysctl_mem; + __entry->sysctl_mem[0] =3D READ_ONCE(prot->sysctl_mem[0]); + __entry->sysctl_mem[1] =3D READ_ONCE(prot->sysctl_mem[1]); + __entry->sysctl_mem[2] =3D READ_ONCE(prot->sysctl_mem[2]); __entry->allocated =3D allocated; __entry->sysctl_rmem =3D sk_get_rmem0(sk, prot); __entry->rmem_alloc =3D atomic_read(&sk->sk_rmem_alloc); From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B652CCA47F for ; Tue, 19 Jul 2022 12:31:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240258AbiGSM3I (ORCPT ); Tue, 19 Jul 2022 08:29:08 -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 S240119AbiGSM2o (ORCPT ); Tue, 19 Jul 2022 08:28:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22A4D66AE1; Tue, 19 Jul 2022 05:10:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C6497B81B37; Tue, 19 Jul 2022 12:10:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24A27C36AED; Tue, 19 Jul 2022 12:10:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232639; bh=LJ0bZOhkY762LRAckvDUrHlvWHgbHjuwRbE7KKyNk/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fnanUM2ZKH2JkIilai8qTR4WY5Pl2U8RbC2eOz024ns0QDVFEcJQxjswebJ9ywgWb mgeLnnRHZOwzvyDdSiqq3ZwyPFL8GThERwCz4zOoWPYP2qZZPNNZQQVMpaDSC0Ggld PKzn1C0KLZY9O/9xRnpXO4T+K0MOXBra9ewK92bs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Edwin Brossette , Nicolas Dichtel , Paolo Abeni Subject: [PATCH 5.15 014/167] ip: fix dflt addr selection for connected nexthop Date: Tue, 19 Jul 2022 13:52:26 +0200 Message-Id: <20220719114658.089156765@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nicolas Dichtel commit 747c14307214b55dbd8250e1ab44cad8305756f1 upstream. When a nexthop is added, without a gw address, the default scope was set to 'host'. Thus, when a source address is selected, 127.0.0.1 may be chosen but rejected when the route is used. When using a route without a nexthop id, the scope can be configured in the route, thus the problem doesn't exist. To explain more deeply: when a user creates a nexthop, it cannot specify the scope. To create it, the function nh_create_ipv4() calls fib_check_nh() with scope set to 0. fib_check_nh() calls fib_check_nh_nongw() wich was setting scope to 'host'. Then, nh_create_ipv4() calls fib_info_update_nhc_saddr() with scope set to 'host'. The src addr is chosen before the route is inserted. When a 'standard' route (ie without a reference to a nexthop) is added, fib_create_info() calls fib_info_update_nhc_saddr() with the scope set by the user. iproute2 set the scope to 'link' by default. Here is a way to reproduce the problem: ip netns add foo ip -n foo link set lo up ip netns add bar ip -n bar link set lo up sleep 1 ip -n foo link add name eth0 type dummy ip -n foo link set eth0 up ip -n foo address add 192.168.0.1/24 dev eth0 ip -n foo link add name veth0 type veth peer name veth1 netns bar ip -n foo link set veth0 up ip -n bar link set veth1 up ip -n bar address add 192.168.1.1/32 dev veth1 ip -n bar route add default dev veth1 ip -n foo nexthop add id 1 dev veth0 ip -n foo route add 192.168.1.1 nhid 1 Try to get/use the route: > $ ip -n foo route get 192.168.1.1 > RTNETLINK answers: Invalid argument > $ ip netns exec foo ping -c1 192.168.1.1 > ping: connect: Invalid argument Try without nexthop group (iproute2 sets scope to 'link' by dflt): ip -n foo route del 192.168.1.1 ip -n foo route add 192.168.1.1 dev veth0 Try to get/use the route: > $ ip -n foo route get 192.168.1.1 > 192.168.1.1 dev veth0 src 192.168.0.1 uid 0 > cache > $ ip netns exec foo ping -c1 192.168.1.1 > PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data. > 64 bytes from 192.168.1.1: icmp_seq=3D1 ttl=3D64 time=3D0.039 ms > > --- 192.168.1.1 ping statistics --- > 1 packets transmitted, 1 received, 0% packet loss, time 0ms > rtt min/avg/max/mdev =3D 0.039/0.039/0.039/0.000 ms CC: stable@vger.kernel.org Fixes: 597cfe4fc339 ("nexthop: Add support for IPv4 nexthops") Reported-by: Edwin Brossette Signed-off-by: Nicolas Dichtel Link: https://lore.kernel.org/r/20220713114853.29406-1-nicolas.dichtel@6win= d.com Signed-off-by: Paolo Abeni Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv4/fib_semantics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -1228,7 +1228,7 @@ static int fib_check_nh_nongw(struct net =20 nh->fib_nh_dev =3D in_dev->dev; dev_hold(nh->fib_nh_dev); - nh->fib_nh_scope =3D RT_SCOPE_HOST; + nh->fib_nh_scope =3D RT_SCOPE_LINK; if (!netif_carrier_ok(nh->fib_nh_dev)) nh->fib_nh_flags |=3D RTNH_F_LINKDOWN; err =3D 0; From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B26DC433EF for ; Tue, 19 Jul 2022 12:31:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240152AbiGSMbS (ORCPT ); Tue, 19 Jul 2022 08:31:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240165AbiGSM2u (ORCPT ); Tue, 19 Jul 2022 08:28:50 -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 2C94866B91; Tue, 19 Jul 2022 05:10: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 sin.source.kernel.org (Postfix) with ESMTPS id 044B1CE1BDA; Tue, 19 Jul 2022 12:10:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2E2CC341C6; Tue, 19 Jul 2022 12:10:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232642; bh=PEuV/4o35jeAEzG8xHkh/SJRBVMvdGbRaqzCgxIJ/OY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DENkrDhnswKAZZO9jq3L/wxmUBqTFz3/qaNaZ1JFCh2P3BtNteJl6jwg1GQCIqPMT PhsQYJtOqNw1KT1eRJaM9rJ58RCdZw5p0IlZH0NhiAhltadtCzGKwHwLj49/dTjIBO MkSxNKDSfaE9EgaS3qfwOlYrIEbU4lA6bxidBkSE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , "Russell King (Oracle)" Subject: [PATCH 5.15 015/167] ARM: 9213/1: Print message about disabled Spectre workarounds only once Date: Tue, 19 Jul 2022 13:52:27 +0200 Message-Id: <20220719114658.191987818@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dmitry Osipenko commit e4ced82deb5fb17222fb82e092c3f8311955b585 upstream. Print the message about disabled Spectre workarounds only once. The message is printed each time CPU goes out from idling state on NVIDIA Tegra boards, causing storm in KMSG that makes system unusable. Cc: stable@vger.kernel.org Signed-off-by: Dmitry Osipenko Signed-off-by: Russell King (Oracle) Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/arm/mm/proc-v7-bugs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/arch/arm/mm/proc-v7-bugs.c +++ b/arch/arm/mm/proc-v7-bugs.c @@ -108,8 +108,7 @@ static unsigned int spectre_v2_install_w #else static unsigned int spectre_v2_install_workaround(unsigned int method) { - pr_info("CPU%u: Spectre V2: workarounds disabled by configuration\n", - smp_processor_id()); + pr_info_once("Spectre V2: workarounds disabled by configuration\n"); =20 return SPECTRE_VULNERABLE; } From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 367ACC433EF for ; Tue, 19 Jul 2022 12:31:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240034AbiGSMbO (ORCPT ); Tue, 19 Jul 2022 08:31:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240168AbiGSM2u (ORCPT ); Tue, 19 Jul 2022 08:28: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 03C3666B93; Tue, 19 Jul 2022 05:10: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 7056CB81B81; Tue, 19 Jul 2022 12:10:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB3EDC341C6; Tue, 19 Jul 2022 12:10:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232645; bh=Rs6tJx4noeNRuRacr17BW7h+FGcVD0qglmkeEcifLKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UxfU7bUP/LKYTorHVJQrfEIKHHKwxVqo0lz0BmWxhX0QN1cQoz2J6H/WeErfCEGFR Lt1rpoEzviA7Q3kaIidY/avmOusdUD7uMXbR6Gddx7XcZ3Yihm4Ps8JCKj7fCdoJpy eHGGAeXUeswFxeCV1wH5PMHx67AvBY85WF2XBdgY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Walleij , Ard Biesheuvel , "Russell King (Oracle)" Subject: [PATCH 5.15 016/167] ARM: 9214/1: alignment: advance IT state after emulating Thumb instruction Date: Tue, 19 Jul 2022 13:52:28 +0200 Message-Id: <20220719114658.299446631@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ard Biesheuvel commit e5c46fde75e43c15a29b40e5fc5641727f97ae47 upstream. After emulating a misaligned load or store issued in Thumb mode, we have to advance the IT state by hand, or it will get out of sync with the actual instruction stream, which means we'll end up applying the wrong condition code to subsequent instructions. This might corrupt the program state rather catastrophically. So borrow the it_advance() helper from the probing code, and use it on CPSR if the emulated instruction is Thumb. Cc: Reviewed-by: Linus Walleij Signed-off-by: Ard Biesheuvel Signed-off-by: Russell King (Oracle) Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/arm/include/asm/ptrace.h | 26 ++++++++++++++++++++++++++ arch/arm/mm/alignment.c | 3 +++ arch/arm/probes/decode.h | 26 +------------------------- 3 files changed, 30 insertions(+), 25 deletions(-) --- a/arch/arm/include/asm/ptrace.h +++ b/arch/arm/include/asm/ptrace.h @@ -163,5 +163,31 @@ static inline unsigned long user_stack_p ((current_stack_pointer | (THREAD_SIZE - 1)) - 7) - 1; \ }) =20 + +/* + * Update ITSTATE after normal execution of an IT block instruction. + * + * The 8 IT state bits are split into two parts in CPSR: + * ITSTATE<1:0> are in CPSR<26:25> + * ITSTATE<7:2> are in CPSR<15:10> + */ +static inline unsigned long it_advance(unsigned long cpsr) +{ + if ((cpsr & 0x06000400) =3D=3D 0) { + /* ITSTATE<2:0> =3D=3D 0 means end of IT block, so clear IT state */ + cpsr &=3D ~PSR_IT_MASK; + } else { + /* We need to shift left ITSTATE<4:0> */ + const unsigned long mask =3D 0x06001c00; /* Mask ITSTATE<4:0> */ + unsigned long it =3D cpsr & mask; + it <<=3D 1; + it |=3D it >> (27 - 10); /* Carry ITSTATE<2> to correct place */ + it &=3D mask; + cpsr &=3D ~mask; + cpsr |=3D it; + } + return cpsr; +} + #endif /* __ASSEMBLY__ */ #endif --- a/arch/arm/mm/alignment.c +++ b/arch/arm/mm/alignment.c @@ -935,6 +935,9 @@ do_alignment(unsigned long addr, unsigne if (type =3D=3D TYPE_LDST) do_alignment_finish_ldst(addr, instr, regs, offset); =20 + if (thumb_mode(regs)) + regs->ARM_cpsr =3D it_advance(regs->ARM_cpsr); + return 0; =20 bad_or_fault: --- a/arch/arm/probes/decode.h +++ b/arch/arm/probes/decode.h @@ -14,6 +14,7 @@ #include #include #include +#include #include =20 void __init arm_probes_decode_init(void); @@ -35,31 +36,6 @@ void __init find_str_pc_offset(void); #endif =20 =20 -/* - * Update ITSTATE after normal execution of an IT block instruction. - * - * The 8 IT state bits are split into two parts in CPSR: - * ITSTATE<1:0> are in CPSR<26:25> - * ITSTATE<7:2> are in CPSR<15:10> - */ -static inline unsigned long it_advance(unsigned long cpsr) - { - if ((cpsr & 0x06000400) =3D=3D 0) { - /* ITSTATE<2:0> =3D=3D 0 means end of IT block, so clear IT state */ - cpsr &=3D ~PSR_IT_MASK; - } else { - /* We need to shift left ITSTATE<4:0> */ - const unsigned long mask =3D 0x06001c00; /* Mask ITSTATE<4:0> */ - unsigned long it =3D cpsr & mask; - it <<=3D 1; - it |=3D it >> (27 - 10); /* Carry ITSTATE<2> to correct place */ - it &=3D mask; - cpsr &=3D ~mask; - cpsr |=3D it; - } - return cpsr; -} - static inline void __kprobes bx_write_pc(long pcv, struct pt_regs *regs) { long cpsr =3D regs->ARM_cpsr; From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0ED60C433EF for ; Tue, 19 Jul 2022 12:31:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240187AbiGSMbV (ORCPT ); Tue, 19 Jul 2022 08:31:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240210AbiGSM2x (ORCPT ); Tue, 19 Jul 2022 08: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 EFC8066BA2; Tue, 19 Jul 2022 05:10: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 BC37661746; Tue, 19 Jul 2022 12:10:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E6E7C341C6; Tue, 19 Jul 2022 12:10:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232648; bh=tN+Yms2lOPAuzEgL9UFe3c+rrRIeWkblCZ6G8JUZFis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iAaf9newImqn/mETYPximiSpfpsfCsXyAVbecelzP/L+FQSY+mAdkXg5OonJSS+Au tzx6eCanQbwkG7juBjRo+wLs4r/KxOL5YA7AiDev1tszY+3oxccvqyKqb4X8E6C/iy cNv/zvK6j2wkJLp5jsrQJz49Lv+JAmyKSG5mhVX8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Felix Fietkau , Johannes Berg Subject: [PATCH 5.15 017/167] wifi: mac80211: fix queue selection for mesh/OCB interfaces Date: Tue, 19 Jul 2022 13:52:29 +0200 Message-Id: <20220719114658.410007643@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Felix Fietkau commit 50e2ab39291947b6c6c7025cf01707c270fcde59 upstream. When using iTXQ, the code assumes that there is only one vif queue for broadcast packets, using the BE queue. Allowing non-BE queue marking violates that assumption and txq->ac =3D=3D skb_queue_mapping is no longer guaranteed. This can cause issues with queue handling in the driver and also causes issues with the recent ATF change, resulting in an AQL underflow warning. Cc: stable@vger.kernel.org Signed-off-by: Felix Fietkau Link: https://lore.kernel.org/r/20220702145227.39356-1-nbd@nbd.name Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/mac80211/wme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/mac80211/wme.c +++ b/net/mac80211/wme.c @@ -147,8 +147,8 @@ u16 __ieee80211_select_queue(struct ieee bool qos; =20 /* all mesh/ocb stations are required to support WME */ - if (sdata->vif.type =3D=3D NL80211_IFTYPE_MESH_POINT || - sdata->vif.type =3D=3D NL80211_IFTYPE_OCB) + if (sta && (sdata->vif.type =3D=3D NL80211_IFTYPE_MESH_POINT || + sdata->vif.type =3D=3D NL80211_IFTYPE_OCB)) qos =3D true; else if (sta) qos =3D sta->sta.wme; From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C57D4CCA47F for ; Tue, 19 Jul 2022 12:31:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240218AbiGSMb1 (ORCPT ); Tue, 19 Jul 2022 08:31:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238410AbiGSM3C (ORCPT ); Tue, 19 Jul 2022 08:29:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A72D366BB3; Tue, 19 Jul 2022 05:10: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 C855A6178A; Tue, 19 Jul 2022 12:10:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94190C341CA; Tue, 19 Jul 2022 12:10:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232651; bh=A64X1RU+bQFq0XR1Htb93ty9wG2o38cb1wA2elF1EpQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OL2tk1Y7NGs0gh7jcZCjjHUIebtmrwhdlRqvgX3GwwLfciOmopaaGnVFr+ZGN+c3l ddKGNxL46VT1j7j/h9v1JzjnBhJmxZ8HJNCfsrCswMyF2DzAw1E4PmF2GPEGkef+Eq Jc8wzJ6TDroUBe9A8nPTyZp1MCKLHsc/gw7HF8D0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tejun Heo , Mukesh Ojha , shisiyuan Subject: [PATCH 5.15 018/167] cgroup: Use separate src/dst nodes when preloading css_sets for migration Date: Tue, 19 Jul 2022 13:52:30 +0200 Message-Id: <20220719114658.510438799@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tejun Heo commit 07fd5b6cdf3cc30bfde8fe0f644771688be04447 upstream. Each cset (css_set) is pinned by its tasks. When we're moving tasks around across csets for a migration, we need to hold the source and destination csets to ensure that they don't go away while we're moving tasks about. This is done by linking cset->mg_preload_node on either the mgctx->preloaded_src_csets or mgctx->preloaded_dst_csets list. Using the same cset->mg_preload_node for both the src and dst lists was deemed okay as a cset can't be both the source and destination at the same time. Unfortunately, this overloading becomes problematic when multiple tasks are involved in a migration and some of them are identity noop migrations while others are actually moving across cgroups. For example, this can happen with the following sequence on cgroup1: #1> mkdir -p /sys/fs/cgroup/misc/a/b #2> echo $$ > /sys/fs/cgroup/misc/a/cgroup.procs #3> RUN_A_COMMAND_WHICH_CREATES_MULTIPLE_THREADS & #4> PID=3D$! #5> echo $PID > /sys/fs/cgroup/misc/a/b/tasks #6> echo $PID > /sys/fs/cgroup/misc/a/cgroup.procs the process including the group leader back into a. In this final migration, non-leader threads would be doing identity migration while the group leader is doing an actual one. After #3, let's say the whole process was in cset A, and that after #4, the leader moves to cset B. Then, during #6, the following happens: 1. cgroup_migrate_add_src() is called on B for the leader. 2. cgroup_migrate_add_src() is called on A for the other threads. 3. cgroup_migrate_prepare_dst() is called. It scans the src list. 4. It notices that B wants to migrate to A, so it tries to A to the dst list but realizes that its ->mg_preload_node is already busy. 5. and then it notices A wants to migrate to A as it's an identity migration, it culls it by list_del_init()'ing its ->mg_preload_node and putting references accordingly. 6. The rest of migration takes place with B on the src list but nothing on the dst list. This means that A isn't held while migration is in progress. If all tasks leave A before the migration finishes and the incoming task pins it, the cset will be destroyed leading to use-after-free. This is caused by overloading cset->mg_preload_node for both src and dst preload lists. We wanted to exclude the cset from the src list but ended up inadvertently excluding it from the dst list too. This patch fixes the issue by separating out cset->mg_preload_node into ->mg_src_preload_node and ->mg_dst_preload_node, so that the src and dst preloadings don't interfere with each other. Signed-off-by: Tejun Heo Reported-by: Mukesh Ojha Reported-by: shisiyuan Link: http://lkml.kernel.org/r/1654187688-27411-1-git-send-email-shisiyuan@= xiaomi.com Link: https://www.spinics.net/lists/cgroups/msg33313.html Fixes: f817de98513d ("cgroup: prepare migration path for unified hierarchy") Cc: stable@vger.kernel.org # v3.16+ Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- include/linux/cgroup-defs.h | 3 ++- kernel/cgroup/cgroup.c | 37 +++++++++++++++++++++++-------------- 2 files changed, 25 insertions(+), 15 deletions(-) --- a/include/linux/cgroup-defs.h +++ b/include/linux/cgroup-defs.h @@ -264,7 +264,8 @@ struct css_set { * List of csets participating in the on-going migration either as * source or destination. Protected by cgroup_mutex. */ - struct list_head mg_preload_node; + struct list_head mg_src_preload_node; + struct list_head mg_dst_preload_node; struct list_head mg_node; =20 /* --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -764,7 +764,8 @@ struct css_set init_css_set =3D { .task_iters =3D LIST_HEAD_INIT(init_css_set.task_iters), .threaded_csets =3D LIST_HEAD_INIT(init_css_set.threaded_csets), .cgrp_links =3D LIST_HEAD_INIT(init_css_set.cgrp_links), - .mg_preload_node =3D LIST_HEAD_INIT(init_css_set.mg_preload_node), + .mg_src_preload_node =3D LIST_HEAD_INIT(init_css_set.mg_src_preload_node), + .mg_dst_preload_node =3D LIST_HEAD_INIT(init_css_set.mg_dst_preload_node), .mg_node =3D LIST_HEAD_INIT(init_css_set.mg_node), =20 /* @@ -1239,7 +1240,8 @@ static struct css_set *find_css_set(stru INIT_LIST_HEAD(&cset->threaded_csets); INIT_HLIST_NODE(&cset->hlist); INIT_LIST_HEAD(&cset->cgrp_links); - INIT_LIST_HEAD(&cset->mg_preload_node); + INIT_LIST_HEAD(&cset->mg_src_preload_node); + INIT_LIST_HEAD(&cset->mg_dst_preload_node); INIT_LIST_HEAD(&cset->mg_node); =20 /* Copy the set of subsystem state objects generated in @@ -2596,21 +2598,27 @@ int cgroup_migrate_vet_dst(struct cgroup */ void cgroup_migrate_finish(struct cgroup_mgctx *mgctx) { - LIST_HEAD(preloaded); struct css_set *cset, *tmp_cset; =20 lockdep_assert_held(&cgroup_mutex); =20 spin_lock_irq(&css_set_lock); =20 - list_splice_tail_init(&mgctx->preloaded_src_csets, &preloaded); - list_splice_tail_init(&mgctx->preloaded_dst_csets, &preloaded); + list_for_each_entry_safe(cset, tmp_cset, &mgctx->preloaded_src_csets, + mg_src_preload_node) { + cset->mg_src_cgrp =3D NULL; + cset->mg_dst_cgrp =3D NULL; + cset->mg_dst_cset =3D NULL; + list_del_init(&cset->mg_src_preload_node); + put_css_set_locked(cset); + } =20 - list_for_each_entry_safe(cset, tmp_cset, &preloaded, mg_preload_node) { + list_for_each_entry_safe(cset, tmp_cset, &mgctx->preloaded_dst_csets, + mg_dst_preload_node) { cset->mg_src_cgrp =3D NULL; cset->mg_dst_cgrp =3D NULL; cset->mg_dst_cset =3D NULL; - list_del_init(&cset->mg_preload_node); + list_del_init(&cset->mg_dst_preload_node); put_css_set_locked(cset); } =20 @@ -2652,7 +2660,7 @@ void cgroup_migrate_add_src(struct css_s =20 src_cgrp =3D cset_cgroup_from_root(src_cset, dst_cgrp->root); =20 - if (!list_empty(&src_cset->mg_preload_node)) + if (!list_empty(&src_cset->mg_src_preload_node)) return; =20 WARN_ON(src_cset->mg_src_cgrp); @@ -2663,7 +2671,7 @@ void cgroup_migrate_add_src(struct css_s src_cset->mg_src_cgrp =3D src_cgrp; src_cset->mg_dst_cgrp =3D dst_cgrp; get_css_set(src_cset); - list_add_tail(&src_cset->mg_preload_node, &mgctx->preloaded_src_csets); + list_add_tail(&src_cset->mg_src_preload_node, &mgctx->preloaded_src_csets= ); } =20 /** @@ -2688,7 +2696,7 @@ int cgroup_migrate_prepare_dst(struct cg =20 /* look up the dst cset for each src cset and link it to src */ list_for_each_entry_safe(src_cset, tmp_cset, &mgctx->preloaded_src_csets, - mg_preload_node) { + mg_src_preload_node) { struct css_set *dst_cset; struct cgroup_subsys *ss; int ssid; @@ -2707,7 +2715,7 @@ int cgroup_migrate_prepare_dst(struct cg if (src_cset =3D=3D dst_cset) { src_cset->mg_src_cgrp =3D NULL; src_cset->mg_dst_cgrp =3D NULL; - list_del_init(&src_cset->mg_preload_node); + list_del_init(&src_cset->mg_src_preload_node); put_css_set(src_cset); put_css_set(dst_cset); continue; @@ -2715,8 +2723,8 @@ int cgroup_migrate_prepare_dst(struct cg =20 src_cset->mg_dst_cset =3D dst_cset; =20 - if (list_empty(&dst_cset->mg_preload_node)) - list_add_tail(&dst_cset->mg_preload_node, + if (list_empty(&dst_cset->mg_dst_preload_node)) + list_add_tail(&dst_cset->mg_dst_preload_node, &mgctx->preloaded_dst_csets); else put_css_set(dst_cset); @@ -2962,7 +2970,8 @@ static int cgroup_update_dfl_csses(struc goto out_finish; =20 spin_lock_irq(&css_set_lock); - list_for_each_entry(src_cset, &mgctx.preloaded_src_csets, mg_preload_node= ) { + list_for_each_entry(src_cset, &mgctx.preloaded_src_csets, + mg_src_preload_node) { struct task_struct *task, *ntask; =20 /* all tasks in src_csets need to be migrated */ From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE22BCCA482 for ; Tue, 19 Jul 2022 12:31:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240787AbiGSM35 (ORCPT ); Tue, 19 Jul 2022 08:29:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237838AbiGSM3G (ORCPT ); Tue, 19 Jul 2022 08:29: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 EA4E467157; Tue, 19 Jul 2022 05:10: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 BD175616F8; Tue, 19 Jul 2022 12:10:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 884AEC341C6; Tue, 19 Jul 2022 12:10:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232653; bh=qvrK/dgaVvy8Ibcvi3b3/DXHImhH9aiPUqLY+jKaZKA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0TzwcOobmVlPMlJikqVpuf6RNGqoDCH8GaXmIR12V+jKRiUW3vzwFbYv4Nw/bYN7Y T3KkaeHJbnJpFk2MLBn46y5AJi0dbjsQREgqut+ypUBLxVuWm/KC3xjYBx5IC82iJ4 e58GJqhNeHUejqfe89+hjBtoAgoW9CSjy5YMdXeA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dominique MARTINET , Christoph Hellwig , Filipe Manana , David Sterba Subject: [PATCH 5.15 019/167] btrfs: return -EAGAIN for NOWAIT dio reads/writes on compressed and inline extents Date: Tue, 19 Jul 2022 13:52:31 +0200 Message-Id: <20220719114658.606783628@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Filipe Manana commit a4527e1853f8ff6e0b7c2dadad6268bd38427a31 upstream. When doing a direct IO read or write, we always return -ENOTBLK when we find a compressed extent (or an inline extent) so that we fallback to buffered IO. This however is not ideal in case we are in a NOWAIT context (io_uring for example), because buffered IO can block and we currently have no support for NOWAIT semantics for buffered IO, so if we need to fallback to buffered IO we should first signal the caller that we may need to block by returning -EAGAIN instead. This behaviour can also result in short reads being returned to user space, which although it's not incorrect and user space should be able to deal with partial reads, it's somewhat surprising and even some popular applications like QEMU (Link tag #1) and MariaDB (Link tag #2) don't deal with short reads properly (or at all). The short read case happens when we try to read from a range that has a non-compressed and non-inline extent followed by a compressed extent. After having read the first extent, when we find the compressed extent we return -ENOTBLK from btrfs_dio_iomap_begin(), which results in iomap to treat the request as a short read, returning 0 (success) and waiting for previously submitted bios to complete (this happens at fs/iomap/direct-io.c:__iomap_dio_rw()). After that, and while at btrfs_file_read_iter(), we call filemap_read() to use buffered IO to read the remaining data, and pass it the number of bytes we were able to read with direct IO. Than at filemap_read() if we get a page fault error when accessing the read buffer, we return a partial read instead of an -EFAULT error, because the number of bytes previously read is greater than zero. So fix this by returning -EAGAIN for NOWAIT direct IO when we find a compressed or an inline extent. Reported-by: Dominique MARTINET Link: https://lore.kernel.org/linux-btrfs/YrrFGO4A1jS0GI0G@atmark-techno.co= m/ Link: https://jira.mariadb.org/browse/MDEV-27900?focusedCommentId=3D216582&= page=3Dcom.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#c= omment-216582 Tested-by: Dominique MARTINET CC: stable@vger.kernel.org # 5.10+ Reviewed-by: Christoph Hellwig Signed-off-by: Filipe Manana Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- fs/btrfs/inode.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -7957,7 +7957,19 @@ static int btrfs_dio_iomap_begin(struct if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags) || em->block_start =3D=3D EXTENT_MAP_INLINE) { free_extent_map(em); - ret =3D -ENOTBLK; + /* + * If we are in a NOWAIT context, return -EAGAIN in order to + * fallback to buffered IO. This is not only because we can + * block with buffered IO (no support for NOWAIT semantics at + * the moment) but also to avoid returning short reads to user + * space - this happens if we were able to read some data from + * previous non-compressed extents and then when we fallback to + * buffered IO, at btrfs_file_read_iter() by calling + * filemap_read(), we fail to fault in pages for the read buffer, + * in which case filemap_read() returns a short read (the number + * of bytes previously read is > 0, so it does not return -EFAULT). + */ + ret =3D (flags & IOMAP_NOWAIT) ? -EAGAIN : -ENOTBLK; goto unlock_err; } From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60490C433EF for ; Tue, 19 Jul 2022 12:36:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239269AbiGSMgA (ORCPT ); Tue, 19 Jul 2022 08:36:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240299AbiGSMdy (ORCPT ); Tue, 19 Jul 2022 08:33:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E644F74E0E; Tue, 19 Jul 2022 05:13: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 2182C6178A; Tue, 19 Jul 2022 12:12:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E281FC341C6; Tue, 19 Jul 2022 12:12:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232742; bh=b62/LnGN3DMyJH6v6wEGeykOzNPEdSGpc3TGkTYraqs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tMZHbfb0WTbt1PnIRXebMeHpcFssdJ94UhjK/rXhv8MGYnnUy2Fch2LDTHIrezaP4 XywlEDcI/x5pCsorlM5mQPYXVCjJ9NLdL5DeLYPnG/9vDI38cORYOjOuxzw0jPAHmO 51htYWTia7EnYacBzwII+63Ry+KyFqcl3HYowCNc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Steven Price , Dmitry Osipenko Subject: [PATCH 5.15 020/167] drm/panfrost: Put mapping instead of shmem obj on panfrost_mmu_map_fault_addr() error Date: Tue, 19 Jul 2022 13:52:32 +0200 Message-Id: <20220719114658.709020344@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dmitry Osipenko commit fb6e0637ab7ebd8e61fe24f4d663c4bae99cfa62 upstream. When panfrost_mmu_map_fault_addr() fails, the BO's mapping should be unreferenced and not the shmem object which backs the mapping. Cc: stable@vger.kernel.org Fixes: bdefca2d8dc0 ("drm/panfrost: Add the panfrost_gem_mapping concept") Reviewed-by: Steven Price Signed-off-by: Dmitry Osipenko Signed-off-by: Steven Price Link: https://patchwork.freedesktop.org/patch/msgid/20220630200601.1884120-= 2-dmitry.osipenko@collabora.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpu/drm/panfrost/panfrost_mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/panfrost/panfrost_mmu.c +++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c @@ -501,7 +501,7 @@ err_map: err_pages: drm_gem_shmem_put_pages(&bo->base); err_bo: - drm_gem_object_put(&bo->base.base); + panfrost_gem_mapping_put(bomapping); return ret; } From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75325C43334 for ; Tue, 19 Jul 2022 12:30:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238629AbiGSMay (ORCPT ); Tue, 19 Jul 2022 08:30:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240590AbiGSM3p (ORCPT ); Tue, 19 Jul 2022 08:29: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 B00E067C90; Tue, 19 Jul 2022 05:11:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 880206177D; Tue, 19 Jul 2022 12:11:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C8F5C341C6; Tue, 19 Jul 2022 12:11:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232682; bh=gzhjaOxqShtKsnl0k/dz8F2fpvMZRtxKSgsm9ZB+LV0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=erxXx10kD1i5EMspLEBi/EOEhR7p0O2NavEIT9bHTiQGZvI6cdF0t8VaXlw8HSvqx h4FJsPDjSeyjZQflqCApc8qKVmPYi0zRXSv4ew37ETZ5zj2K7hOscHoLK84jmHY3Y9 85sqNolj6mmZqlrR2YODdUuulIEOh0aWvaE6HGlQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alyssa Rosenzweig , Steven Price , Dmitry Osipenko Subject: [PATCH 5.15 021/167] drm/panfrost: Fix shrinker list corruption by madvise IOCTL Date: Tue, 19 Jul 2022 13:52:33 +0200 Message-Id: <20220719114658.810006825@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dmitry Osipenko commit 9fc33eaaa979d112d10fea729edcd2a2e21aa912 upstream. Calling madvise IOCTL twice on BO causes memory shrinker list corruption and crashes kernel because BO is already on the list and it's added to the list again, while BO should be removed from the list before it's re-added. Fix it. Cc: stable@vger.kernel.org Fixes: 013b65101315 ("drm/panfrost: Add madvise and shrinker support") Acked-by: Alyssa Rosenzweig Reviewed-by: Steven Price Signed-off-by: Dmitry Osipenko Signed-off-by: Steven Price Link: https://patchwork.freedesktop.org/patch/msgid/20220630200601.1884120-= 3-dmitry.osipenko@collabora.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpu/drm/panfrost/panfrost_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/panfrost/panfrost_drv.c +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c @@ -422,8 +422,8 @@ static int panfrost_ioctl_madvise(struct =20 if (args->retained) { if (args->madv =3D=3D PANFROST_MADV_DONTNEED) - list_add_tail(&bo->base.madv_list, - &pfdev->shrinker_list); + list_move_tail(&bo->base.madv_list, + &pfdev->shrinker_list); else if (args->madv =3D=3D PANFROST_MADV_WILLNEED) list_del_init(&bo->base.madv_list); } From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4749C433EF for ; Tue, 19 Jul 2022 12:32:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240296AbiGSMca (ORCPT ); Tue, 19 Jul 2022 08:32:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229895AbiGSMcB (ORCPT ); Tue, 19 Jul 2022 08:32:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB5D46F7CE; Tue, 19 Jul 2022 05:12: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 0A176B81B37; Tue, 19 Jul 2022 12:11:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74F0FC341CE; Tue, 19 Jul 2022 12:11:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232713; bh=LImAdXCTNx1YClH8FEaycD4Q8yoRVyjvoe4rawmcKfo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IH6yoco+wmYardx2AtuSluZYciXQR+4/DaQmZdUA5lBUfhivt0GsaRJ3/Ex3wrkTo IXyx9a4P7Xxj3OcCAP9B1hVtShNaX1pMvvU1uAA24PF+6i605u5oX7cNXFfHH9z1Pz OMh6RTvKrZR5B855qWvpcvBvX/q/WSVVuZS5OJME= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Ansgar=20L=C3=B6=C3=9Fer?= , Dave Chinner , Linus Torvalds Subject: [PATCH 5.15 022/167] fs/remap: constrain dedupe of EOF blocks Date: Tue, 19 Jul 2022 13:52:34 +0200 Message-Id: <20220719114658.901074235@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dave Chinner commit 5750676b64a561f7ec920d7c6ba130fc9c7378f3 upstream. If dedupe of an EOF block is not constrainted to match against only other EOF blocks with the same EOF offset into the block, it can match against any other block that has the same matching initial bytes in it, even if the bytes beyond EOF in the source file do not match. Fix this by constraining the EOF block matching to only match against other EOF blocks that have identical EOF offsets and data. This allows "whole file dedupe" to continue to work without allowing eof blocks to randomly match against partial full blocks with the same data. Reported-by: Ansgar L=C3=B6=C3=9Fer Fixes: 1383a7ed6749 ("vfs: check file ranges before cloning files") Link: https://lore.kernel.org/linux-fsdevel/a7c93559-4ba1-df2f-7a85-55a1436= 96405@tu-darmstadt.de/ Signed-off-by: Dave Chinner Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- fs/remap_range.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/remap_range.c +++ b/fs/remap_range.c @@ -71,7 +71,8 @@ static int generic_remap_checks(struct f * Otherwise, make sure the count is also block-aligned, having * already confirmed the starting offsets' block alignment. */ - if (pos_in + count =3D=3D size_in) { + if (pos_in + count =3D=3D size_in && + (!(remap_flags & REMAP_FILE_DEDUP) || pos_out + count =3D=3D size_out= )) { bcount =3D ALIGN(size_in, bs) - pos_in; } else { if (!IS_ALIGNED(count, bs)) From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39769C433EF for ; Tue, 19 Jul 2022 12:32:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237648AbiGSMck (ORCPT ); Tue, 19 Jul 2022 08:32:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239026AbiGSMcF (ORCPT ); Tue, 19 Jul 2022 08:32:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B0546F7FE; Tue, 19 Jul 2022 05:12: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 0EE60617B4; Tue, 19 Jul 2022 12:12:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1832C36AE2; Tue, 19 Jul 2022 12:12:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232722; bh=7ZYWiRyY+pdBvXiE3F4IZL5+o6eMslmSkCprIoHSkHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DOQ4tVIO7Sdc8149dJ/VOLNjpHrOmOenfnZUTrvdGFj5gxDpSt93CSzrko9/0hNL7 Ln4cO8/PWnejfIiU948fx4qPAhdi2HvEGczW1reBQ4m6DG1aeukjO9cEjGYW0py5UT fjOOcHkqUKRcCNdJbvRu3knPM2dVb7Bdr15+hxaQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryusuke Konishi , Tommy Pettersson , Ciprian Craciun , Andrew Morton Subject: [PATCH 5.15 023/167] nilfs2: fix incorrect masking of permission flags for symlinks Date: Tue, 19 Jul 2022 13:52:35 +0200 Message-Id: <20220719114659.003165138@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ryusuke Konishi commit 5924e6ec1585445f251ea92713eb15beb732622a upstream. The permission flags of newly created symlinks are wrongly dropped on nilfs2 with the current umask value even though symlinks should have 777 (rwxrwxrwx) permissions: $ umask 0022 $ touch file && ln -s file symlink; ls -l file symlink -rw-r--r--. 1 root root 0 Jun 23 16:29 file lrwxr-xr-x. 1 root root 4 Jun 23 16:29 symlink -> file This fixes the bug by inserting a missing check that excludes symlinks. Link: https://lkml.kernel.org/r/1655974441-5612-1-git-send-email-konishi.ry= usuke@gmail.com Signed-off-by: Ryusuke Konishi Reported-by: Tommy Pettersson Reported-by: Ciprian Craciun Tested-by: Ryusuke Konishi Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- fs/nilfs2/nilfs.h | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/nilfs2/nilfs.h +++ b/fs/nilfs2/nilfs.h @@ -198,6 +198,9 @@ static inline int nilfs_acl_chmod(struct =20 static inline int nilfs_init_acl(struct inode *inode, struct inode *dir) { + if (S_ISLNK(inode->i_mode)) + return 0; + inode->i_mode &=3D ~current_umask(); return 0; } From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C12B4C433EF for ; Tue, 19 Jul 2022 12:32:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240452AbiGSMcs (ORCPT ); Tue, 19 Jul 2022 08:32:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240419AbiGSMcL (ORCPT ); Tue, 19 Jul 2022 08:32:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 389735288A; Tue, 19 Jul 2022 05:12: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 D8586617D9; Tue, 19 Jul 2022 12:12:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA5D7C341C6; Tue, 19 Jul 2022 12:12:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232725; bh=YiegBnLb7fzcdAG/9lSyNYztOpy0PPrHib+C+dJG+4s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vucm7Gu8PZLZSRoXLoMqGNWaaWhwoMLVsQrwbwEvQW6sjzkSihhsub+kC9yYVKs9R mlim0W0V11He1GU4w6WqANx9rUI/Sqvm2NNf3brveYDa8brfyby1Qw39i2aQZO1C4F IAYlnCehLAO5r/Ao1Bwanv/rnnqxksQdyYYznnsk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , kernel test robot , Jonathan Cameron , Christoph Hellwig , Andrew Morton Subject: [PATCH 5.15 024/167] sh: convert nommu io{re,un}map() to static inline functions Date: Tue, 19 Jul 2022 13:52:36 +0200 Message-Id: <20220719114659.090878190@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Geert Uytterhoeven commit d684e0a52d36f8939eda30a0f31ee235ee4ee741 upstream. Recently, nommu iounmap() was converted from a static inline function to a macro again, basically reverting commit 4580ba4ad2e6b8dd ("sh: Convert iounmap() macros to inline functions"). With -Werror, this leads to build failures like: drivers/iio/adc/xilinx-ams.c: In function `ams_iounmap_ps': drivers/iio/adc/xilinx-ams.c:1195:14: error: unused variable `ams' [-We= rror=3Dunused-variable] 1195 | struct ams *ams =3D data; | ^~~ Fix this by replacing the macros for ioremap() and iounmap() by static inline functions, based on . Link: https://lkml.kernel.org/r/8d1b1766260961799b04035e7bc39a7f59729f72.16= 55708312.git.geert+renesas@glider.be Fixes: 13f1fc870dd74713 ("sh: move the ioremap implementation out of line") Signed-off-by: Geert Uytterhoeven Reported-by: kernel test robot Reported-by: Jonathan Cameron Acked-by: Jonathan Cameron Reviewed-by: Christoph Hellwig Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/sh/include/asm/io.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/arch/sh/include/asm/io.h +++ b/arch/sh/include/asm/io.h @@ -271,8 +271,12 @@ static inline void __iomem *ioremap_prot #endif /* CONFIG_HAVE_IOREMAP_PROT */ =20 #else /* CONFIG_MMU */ -#define iounmap(addr) do { } while (0) -#define ioremap(offset, size) ((void __iomem *)(unsigned long)(offset)) +static inline void __iomem *ioremap(phys_addr_t offset, size_t size) +{ + return (void __iomem *)(unsigned long)offset; +} + +static inline void iounmap(volatile void __iomem *addr) { } #endif /* CONFIG_MMU */ =20 #define ioremap_uc ioremap From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E56BECCA47F for ; Tue, 19 Jul 2022 12:33:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237781AbiGSMdA (ORCPT ); Tue, 19 Jul 2022 08:33:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238375AbiGSMc0 (ORCPT ); Tue, 19 Jul 2022 08:32: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 49EA470E56; Tue, 19 Jul 2022 05:12: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 322C8B81B31; Tue, 19 Jul 2022 12:12:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9536EC341C6; Tue, 19 Jul 2022 12:12:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232728; bh=Z1JtSfxrx09o6ta6fOCcZnqAzuj3UPKp2mD7YWnzRFI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EIFsBrrXi4RQOa2rsRUXxeo0q/If2ltn4SFLW9aG5RHsvY/TmqOFu4WHjKljHoi7v 1OZo3KSylQ+oocwULsiT8DFtDMK83IxG0RaM3BKt+9ZKdwkZC+cL4atDcn3juG+UKK jbHwnk6nps3oOnTc/RukD0pdmHi/cB3DScvemhGo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Guozihua (Scott)" , Xiu Jianfeng , Mimi Zohar Subject: [PATCH 5.15 025/167] Revert "evm: Fix memleak in init_desc" Date: Tue, 19 Jul 2022 13:52:37 +0200 Message-Id: <20220719114659.180339695@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiu Jianfeng commit 51dd64bb99e4478fc5280171acd8e1b529eadaf7 upstream. This reverts commit ccf11dbaa07b328fa469415c362d33459c140a37. Commit ccf11dbaa07b ("evm: Fix memleak in init_desc") said there is memleak in init_desc. That may be incorrect, as we can see, tmp_tfm is saved in one of the two global variables hmac_tfm or evm_tfm[hash_algo], then if init_desc is called next time, there is no need to alloc tfm again, so in the error path of kmalloc desc or crypto_shash_init(desc), It is not a problem without freeing tmp_tfm. And also that commit did not reset the global variable to NULL after freeing tmp_tfm and this makes *tfm a dangling pointer which may cause a UAF issue. Reported-by: Guozihua (Scott) Signed-off-by: Xiu Jianfeng Signed-off-by: Mimi Zohar Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- security/integrity/evm/evm_crypto.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) --- a/security/integrity/evm/evm_crypto.c +++ b/security/integrity/evm/evm_crypto.c @@ -75,7 +75,7 @@ static struct shash_desc *init_desc(char { long rc; const char *algo; - struct crypto_shash **tfm, *tmp_tfm =3D NULL; + struct crypto_shash **tfm, *tmp_tfm; struct shash_desc *desc; =20 if (type =3D=3D EVM_XATTR_HMAC) { @@ -120,16 +120,13 @@ unlock: alloc: desc =3D kmalloc(sizeof(*desc) + crypto_shash_descsize(*tfm), GFP_KERNEL); - if (!desc) { - crypto_free_shash(tmp_tfm); + if (!desc) return ERR_PTR(-ENOMEM); - } =20 desc->tfm =3D *tfm; =20 rc =3D crypto_shash_init(desc); if (rc) { - crypto_free_shash(tmp_tfm); kfree(desc); return ERR_PTR(rc); } From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C548EC43334 for ; Tue, 19 Jul 2022 12:32:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240443AbiGSMcp (ORCPT ); Tue, 19 Jul 2022 08:32:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240361AbiGSMcG (ORCPT ); Tue, 19 Jul 2022 08:32: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 738905289D; Tue, 19 Jul 2022 05:12: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 ECD0DB81B29; Tue, 19 Jul 2022 12:12:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FD51C341C6; Tue, 19 Jul 2022 12:12:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232730; bh=n9UWrIeuMWWOu3oegqOKDGwjTmkWyBE+icbEFLRLnmw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Am2tXZAajmhyjPB5RdCln7g5Mcrakfxdhsl2GdTni4RE9RuPC2hCXa5L/urLzz1bK PldAncjTmk9PuYQNT2JRKQQn8XrZE9O+0eigdmwbMPKWpZFo7vYv6iy8jJT28S/CZu 9sHCEMQAmqAfjKPLFDvAyH1GmQsUH7ppt6yePSDo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" , Chandan Babu R , Dave Chinner , Leah Rumancik Subject: [PATCH 5.15 026/167] xfs: only run COW extent recovery when there are no live extents Date: Tue, 19 Jul 2022 13:52:38 +0200 Message-Id: <20220719114659.277503687@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Darrick J. Wong" [ Upstream commit 7993f1a431bc5271369d359941485a9340658ac3 ] As part of multiple customer escalations due to file data corruption after copy on write operations, I wrote some fstests that use fsstress to hammer on COW to shake things loose. Regrettably, I caught some filesystem shutdowns due to incorrect rmap operations with the following loop: mount # (0) fsstress & # (1) while true; do fsstress mount -o remount,ro # (2) fsstress mount -o remount,rw # (3) done When (2) happens, notice that (1) is still running. xfs_remount_ro will call xfs_blockgc_stop to walk the inode cache to free all the COW extents, but the blockgc mechanism races with (1)'s reader threads to take IOLOCKs and loses, which means that it doesn't clean them all out. Call such a file (A). When (3) happens, xfs_remount_rw calls xfs_reflink_recover_cow, which walks the ondisk refcount btree and frees any COW extent that it finds. This function does not check the inode cache, which means that incore COW forks of inode (A) is now inconsistent with the ondisk metadata. If one of those former COW extents are allocated and mapped into another file (B) and someone triggers a COW to the stale reservation in (A), A's dirty data will be written into (B) and once that's done, those blocks will be transferred to (A)'s data fork without bumping the refcount. The results are catastrophic -- file (B) and the refcount btree are now corrupt. In the first patch, we fixed the race condition in (2) so that (A) will always flush the COW fork. In this second patch, we move the _recover_cow call to the initial mount call in (0) for safety. As mentioned previously, xfs_reflink_recover_cow walks the refcount btree looking for COW staging extents, and frees them. This was intended to be run at mount time (when we know there are no live inodes) to clean up any leftover staging events that may have been left behind during an unclean shutdown. As a time "optimization" for readonly mounts, we deferred this to the ro->rw transition, not realizing that any failure to clean all COW forks during a rw->ro transition would result in catastrophic corruption. Therefore, remove this optimization and only run the recovery routine when we're guaranteed not to have any COW staging extents anywhere, which means we always run this at mount time. While we're at it, move the callsite to xfs_log_mount_finish because any refcount btree expansion (however unlikely given that we're removing records from the right side of the index) must be fed by a per-AG reservation, which doesn't exist in its current location. Fixes: 174edb0e46e5 ("xfs: store in-progress CoW allocations in the refcoun= t btree") Signed-off-by: Darrick J. Wong Reviewed-by: Chandan Babu R Reviewed-by: Dave Chinner Signed-off-by: Leah Rumancik Acked-by: Darrick J. Wong Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- fs/xfs/xfs_log_recover.c | 24 +++++++++++++++++++++++- fs/xfs/xfs_mount.c | 10 ---------- fs/xfs/xfs_reflink.c | 5 ++++- fs/xfs/xfs_super.c | 9 --------- 4 files changed, 27 insertions(+), 21 deletions(-) --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c @@ -27,7 +27,7 @@ #include "xfs_buf_item.h" #include "xfs_ag.h" #include "xfs_quota.h" - +#include "xfs_reflink.h" =20 #define BLK_AVG(blk1, blk2) ((blk1+blk2) >> 1) =20 @@ -3502,6 +3502,28 @@ xlog_recover_finish( =20 xlog_recover_process_iunlinks(log); xlog_recover_check_summary(log); + + /* + * Recover any CoW staging blocks that are still referenced by the + * ondisk refcount metadata. During mount there cannot be any live + * staging extents as we have not permitted any user modifications. + * Therefore, it is safe to free them all right now, even on a + * read-only mount. + */ + error =3D xfs_reflink_recover_cow(log->l_mp); + if (error) { + xfs_alert(log->l_mp, + "Failed to recover leftover CoW staging extents, err %d.", + error); + /* + * If we get an error here, make sure the log is shut down + * but return zero so that any log items committed since the + * end of intents processing can be pushed through the CIL + * and AIL. + */ + xfs_force_shutdown(log->l_mp, SHUTDOWN_LOG_IO_ERROR); + } + return 0; } =20 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c @@ -922,15 +922,6 @@ xfs_mountfs( xfs_warn(mp, "Unable to allocate reserve blocks. Continuing without reserve pool."); =20 - /* Recover any CoW blocks that never got remapped. */ - error =3D xfs_reflink_recover_cow(mp); - if (error) { - xfs_err(mp, - "Error %d recovering leftover CoW allocations.", error); - xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); - goto out_quota; - } - /* Reserve AG blocks for future btree expansion. */ error =3D xfs_fs_reserve_ag_blocks(mp); if (error && error !=3D -ENOSPC) @@ -941,7 +932,6 @@ xfs_mountfs( =20 out_agresv: xfs_fs_unreserve_ag_blocks(mp); - out_quota: xfs_qm_unmount_quotas(mp); out_rtunmount: xfs_rtunmount_inodes(mp); --- a/fs/xfs/xfs_reflink.c +++ b/fs/xfs/xfs_reflink.c @@ -749,7 +749,10 @@ xfs_reflink_end_cow( } =20 /* - * Free leftover CoW reservations that didn't get cleaned out. + * Free all CoW staging blocks that are still referenced by the ondisk ref= count + * metadata. The ondisk metadata does not track which inode created the + * staging extent, so callers must ensure that there are no cached inodes = with + * live CoW staging extents. */ int xfs_reflink_recover_cow( --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1742,15 +1742,6 @@ xfs_remount_rw( */ xfs_restore_resvblks(mp); xfs_log_work_queue(mp); - - /* Recover any CoW blocks that never got remapped. */ - error =3D xfs_reflink_recover_cow(mp); - if (error) { - xfs_err(mp, - "Error %d recovering leftover CoW allocations.", error); - xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); - return error; - } xfs_blockgc_start(mp); =20 /* Create the per-AG metadata reservation pool .*/ From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 352D7C43334 for ; Tue, 19 Jul 2022 12:33:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240309AbiGSMdD (ORCPT ); Tue, 19 Jul 2022 08:33:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240250AbiGSMc3 (ORCPT ); Tue, 19 Jul 2022 08:32:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7AD971705; Tue, 19 Jul 2022 05: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 EFBEBB81B1A; Tue, 19 Jul 2022 12:12:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3974AC341CB; Tue, 19 Jul 2022 12:12:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232733; bh=K0qI5JGPQVL01VOKQJTzPyxE85bFwIX1MY5FCr7W8b8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pgsXRCFfIvn6/1FaMId1CW+Wjz8gfXEwqNB2OvP5gIutp5H4TwynPSy1+MhfRF6GD VEw1OyNS9ZLJIF0PyWMjm4DxKYy4J7BBLrPfjrviAL9jH/68q/18TOGBb00+hdC765 h+zk0yIsP1CILbOzk5GRqq89D6uoPwRwZyAz7dpo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Foster , "Darrick J. Wong" , Dave Chinner , Leah Rumancik Subject: [PATCH 5.15 027/167] xfs: dont include bnobt blocks when reserving free block pool Date: Tue, 19 Jul 2022 13:52:39 +0200 Message-Id: <20220719114659.364707400@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Darrick J. Wong" [ Upstream commit c8c568259772751a14e969b7230990508de73d9d ] xfs_reserve_blocks controls the size of the user-visible free space reserve pool. Given the difference between the current and requested pool sizes, it will try to reserve free space from fdblocks. However, the amount requested from fdblocks is also constrained by the amount of space that we think xfs_mod_fdblocks will give us. If we forget to subtract m_allocbt_blks before calling xfs_mod_fdblocks, it will will return ENOSPC and we'll hang the kernel at mount due to the infinite loop. In commit fd43cf600cf6, we decided that xfs_mod_fdblocks should not hand out the "free space" used by the free space btrees, because some portion of the free space btrees hold in reserve space for future btree expansion. Unfortunately, xfs_reserve_blocks' estimation of the number of blocks that it could request from xfs_mod_fdblocks was not updated to include m_allocbt_blks, so if space is extremely low, the caller hangs. Fix this by creating a function to estimate the number of blocks that can be reserved from fdblocks, which needs to exclude the set-aside and m_allocbt_blks. Found by running xfs/306 (which formats a single-AG 20MB filesystem) with an fstests configuration that specifies a 1k blocksize and a specially crafted log size that will consume 7/8 of the space (17920 blocks, specifically) in that AG. Cc: Brian Foster Fixes: fd43cf600cf6 ("xfs: set aside allocation btree blocks from block res= ervation") Signed-off-by: Darrick J. Wong Reviewed-by: Brian Foster Reviewed-by: Dave Chinner Signed-off-by: Leah Rumancik Acked-by: Darrick J. Wong Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- fs/xfs/xfs_fsops.c | 2 +- fs/xfs/xfs_mount.c | 2 +- fs/xfs/xfs_mount.h | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) --- a/fs/xfs/xfs_fsops.c +++ b/fs/xfs/xfs_fsops.c @@ -434,7 +434,7 @@ xfs_reserve_blocks( error =3D -ENOSPC; do { free =3D percpu_counter_sum(&mp->m_fdblocks) - - mp->m_alloc_set_aside; + xfs_fdblocks_unavailable(mp); if (free <=3D 0) break; =20 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c @@ -1132,7 +1132,7 @@ xfs_mod_fdblocks( * problems (i.e. transaction abort, pagecache discards, etc.) than * slightly premature -ENOSPC. */ - set_aside =3D mp->m_alloc_set_aside + atomic64_read(&mp->m_allocbt_blks); + set_aside =3D xfs_fdblocks_unavailable(mp); percpu_counter_add_batch(&mp->m_fdblocks, delta, batch); if (__percpu_counter_compare(&mp->m_fdblocks, set_aside, XFS_FDBLOCKS_BATCH) >=3D 0) { --- a/fs/xfs/xfs_mount.h +++ b/fs/xfs/xfs_mount.h @@ -478,6 +478,21 @@ extern void xfs_unmountfs(xfs_mount_t *) */ #define XFS_FDBLOCKS_BATCH 1024 =20 +/* + * Estimate the amount of free space that is not available to userspace an= d is + * not explicitly reserved from the incore fdblocks. This includes: + * + * - The minimum number of blocks needed to support splitting a bmap btree + * - The blocks currently in use by the freespace btrees because they reco= rd + * the actual blocks that will fill per-AG metadata space reservations + */ +static inline uint64_t +xfs_fdblocks_unavailable( + struct xfs_mount *mp) +{ + return mp->m_alloc_set_aside + atomic64_read(&mp->m_allocbt_blks); +} + extern int xfs_mod_fdblocks(struct xfs_mount *mp, int64_t delta, bool reserved); extern int xfs_mod_frextents(struct xfs_mount *mp, int64_t delta); From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C4D4C43334 for ; Tue, 19 Jul 2022 12:33:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240513AbiGSMdG (ORCPT ); Tue, 19 Jul 2022 08:33:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240301AbiGSMcc (ORCPT ); Tue, 19 Jul 2022 08:32: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 6EAC570981; Tue, 19 Jul 2022 05:12: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 6AC9B61790; Tue, 19 Jul 2022 12:12:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38D04C341C6; Tue, 19 Jul 2022 12:12:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232736; bh=1Qub2fswFuzzoeBd0ixISFLs/Kq4vBg+9VYfqpwwPpI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z51z73qxldXzdexEnGhZLxb8kAx6/RLPlYwBiHtQT9ZZaWRP10FbqgsVNzOUJQBBo KRIzLeLvywYug0ftbdj2tdE+7NRjyRTvby3/X8s5YF2b5Gw+JaqqGau+LKUu//tvJX qLUYyuK7PJE3r81TEV/bN3i37bBGKkUb9h1DOU+k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Foster , Dave Chinner , "Darrick J. Wong" , Leah Rumancik Subject: [PATCH 5.15 028/167] xfs: run callbacks before waking waiters in xlog_state_shutdown_callbacks Date: Tue, 19 Jul 2022 13:52:40 +0200 Message-Id: <20220719114659.450856104@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Chinner [ Upstream commit cd6f79d1fb324968a3bae92f82eeb7d28ca1fd22 ] Brian reported a null pointer dereference failure during unmount in xfs/006. He tracked the problem down to the AIL being torn down before a log shutdown had completed and removed all the items from the AIL. The failure occurred in this path while unmount was proceeding in another task: xfs_trans_ail_delete+0x102/0x130 [xfs] xfs_buf_item_done+0x22/0x30 [xfs] xfs_buf_ioend+0x73/0x4d0 [xfs] xfs_trans_committed_bulk+0x17e/0x2f0 [xfs] xlog_cil_committed+0x2a9/0x300 [xfs] xlog_cil_process_committed+0x69/0x80 [xfs] xlog_state_shutdown_callbacks+0xce/0xf0 [xfs] xlog_force_shutdown+0xdf/0x150 [xfs] xfs_do_force_shutdown+0x5f/0x150 [xfs] xlog_ioend_work+0x71/0x80 [xfs] process_one_work+0x1c5/0x390 worker_thread+0x30/0x350 kthread+0xd7/0x100 ret_from_fork+0x1f/0x30 This is processing an EIO error to a log write, and it's triggering a force shutdown. This causes the log to be shut down, and then it is running attached iclog callbacks from the shutdown context. That means the fs and log has already been marked as xfs_is_shutdown/xlog_is_shutdown and so high level code will abort (e.g. xfs_trans_commit(), xfs_log_force(), etc) with an error because of shutdown. The umount would have been blocked waiting for a log force completion inside xfs_log_cover() -> xfs_sync_sb(). The first thing for this situation to occur is for xfs_sync_sb() to exit without waiting for the iclog buffer to be comitted to disk. The above trace is the completion routine for the iclog buffer, and it is shutting down the filesystem. xlog_state_shutdown_callbacks() does this: { struct xlog_in_core *iclog; LIST_HEAD(cb_list); spin_lock(&log->l_icloglock); iclog =3D log->l_iclog; do { if (atomic_read(&iclog->ic_refcnt)) { /* Reference holder will re-run iclog callbacks. */ continue; } list_splice_init(&iclog->ic_callbacks, &cb_list); >>>>>> wake_up_all(&iclog->ic_write_wait); >>>>>> wake_up_all(&iclog->ic_force_wait); } while ((iclog =3D iclog->ic_next) !=3D log->l_iclog); wake_up_all(&log->l_flush_wait); spin_unlock(&log->l_icloglock); >>>>>> xlog_cil_process_committed(&cb_list); } This wakes any thread waiting on IO completion of the iclog (in this case the umount log force) before shutdown processes all the pending callbacks. That means the xfs_sync_sb() waiting on a sync transaction in xfs_log_force() on iclog->ic_force_wait will get woken before the callbacks attached to that iclog are run. This results in xfs_sync_sb() returning an error, and so unmount unblocks and continues to run whilst the log shutdown is still in progress. Normally this is just fine because the force waiter has nothing to do with AIL operations. But in the case of this unmount path, the log force waiter goes on to tear down the AIL because the log is now shut down and so nothing ever blocks it again from the wait point in xfs_log_cover(). Hence it's a race to see who gets to the AIL first - the unmount code or xlog_cil_process_committed() killing the superblock buffer. To fix this, we just have to change the order of processing in xlog_state_shutdown_callbacks() to run the callbacks before it wakes any task waiting on completion of the iclog. Reported-by: Brian Foster Fixes: aad7272a9208 ("xfs: separate out log shutdown callback processing") Signed-off-by: Dave Chinner Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Leah Rumancik Acked-by: Darrick J. Wong Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- fs/xfs/xfs_log.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c @@ -487,7 +487,10 @@ out_error: * Run all the pending iclog callbacks and wake log force waiters and iclog * space waiters so they can process the newly set shutdown state. We real= ly * don't care what order we process callbacks here because the log is shut= down - * and so state cannot change on disk anymore. + * and so state cannot change on disk anymore. However, we cannot wake wai= ters + * until the callbacks have been processed because we may be in unmount and + * we must ensure that all AIL operations the callbacks perform have compl= eted + * before we tear down the AIL. * * We avoid processing actively referenced iclogs so that we don't run cal= lbacks * while the iclog owner might still be preparing the iclog for IO submssi= on. @@ -501,7 +504,6 @@ xlog_state_shutdown_callbacks( struct xlog_in_core *iclog; LIST_HEAD(cb_list); =20 - spin_lock(&log->l_icloglock); iclog =3D log->l_iclog; do { if (atomic_read(&iclog->ic_refcnt)) { @@ -509,14 +511,16 @@ xlog_state_shutdown_callbacks( continue; } list_splice_init(&iclog->ic_callbacks, &cb_list); + spin_unlock(&log->l_icloglock); + + xlog_cil_process_committed(&cb_list); + + spin_lock(&log->l_icloglock); wake_up_all(&iclog->ic_write_wait); wake_up_all(&iclog->ic_force_wait); } while ((iclog =3D iclog->ic_next) !=3D log->l_iclog); =20 wake_up_all(&log->l_flush_wait); - spin_unlock(&log->l_icloglock); - - xlog_cil_process_committed(&cb_list); } =20 /* @@ -583,11 +587,8 @@ xlog_state_release_iclog( * pending iclog callbacks that were waiting on the release of * this iclog. */ - if (last_ref) { - spin_unlock(&log->l_icloglock); + if (last_ref) xlog_state_shutdown_callbacks(log); - spin_lock(&log->l_icloglock); - } return -EIO; } =20 @@ -3904,7 +3905,10 @@ xlog_force_shutdown( wake_up_all(&log->l_cilp->xc_start_wait); wake_up_all(&log->l_cilp->xc_commit_wait); spin_unlock(&log->l_cilp->xc_push_lock); + + spin_lock(&log->l_icloglock); xlog_state_shutdown_callbacks(log); + spin_unlock(&log->l_icloglock); =20 return log_error; } From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63D66C43334 for ; Tue, 19 Jul 2022 12:35:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240532AbiGSMfW (ORCPT ); Tue, 19 Jul 2022 08:35:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240487AbiGSMdy (ORCPT ); Tue, 19 Jul 2022 08:33:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 772DC74DDF; Tue, 19 Jul 2022 05:12: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 A377AB81B08; Tue, 19 Jul 2022 12:12:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10F22C341CA; Tue, 19 Jul 2022 12:12:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232739; bh=EkMMijScdJpqvrBoJcjJDVvLlq1cuE20IbyyS62zhro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FJYtjpQcZ8/UdrYYRaS171QLLZMc0uiEmqoNepQVTzHeevJ111qikBp+OsFvP1voA i0yop0svGdyrG3zOSLhf5DztBXZ7sG60fYGltlOSFtEZGGkU/a4942/T/7lszbnQsS adkswc+5zakxzV7snhodj3m2cUR5+Upc1vsuJr9U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Chinner , "Darrick J. Wong" , Leah Rumancik , Jan Kara Subject: [PATCH 5.15 029/167] xfs: drop async cache flushes from CIL commits. Date: Tue, 19 Jul 2022 13:52:41 +0200 Message-Id: <20220719114659.579342281@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Chinner [ Upstream commit 919edbadebe17a67193533f531c2920c03e40fa4 ] Jan Kara reported a performance regression in dbench that he bisected down to commit bad77c375e8d ("xfs: CIL checkpoint flushes caches unconditionally"). Whilst developing the journal flush/fua optimisations this cache was part of, it appeared to made a significant difference to performance. However, now that this patchset has settled and all the correctness issues fixed, there does not appear to be any significant performance benefit to asynchronous cache flushes. In fact, the opposite is true on some storage types and workloads, where additional cache flushes that can occur from fsync heavy workloads have measurable and significant impact on overall throughput. Local dbench testing shows little difference on dbench runs with sync vs async cache flushes on either fast or slow SSD storage, and no difference in streaming concurrent async transaction workloads like fs-mark. Fast NVME storage. >From `dbench -t 30`, CIL scale: clients async sync BW Latency BW Latency 1 935.18 0.855 915.64 0.903 8 2404.51 6.873 2341.77 6.511 16 3003.42 6.460 2931.57 6.529 32 3697.23 7.939 3596.28 7.894 128 7237.43 15.495 7217.74 11.588 512 5079.24 90.587 5167.08 95.822 fsmark, 32 threads, create w/ 64 byte xattr w/32k logbsize create chown unlink async 1m41s 1m16s 2m03s sync 1m40s 1m19s 1m54s Slower SATA SSD storage: >From `dbench -t 30`, CIL scale: clients async sync BW Latency BW Latency 1 78.59 15.792 83.78 10.729 8 367.88 92.067 404.63 59.943 16 564.51 72.524 602.71 76.089 32 831.66 105.984 870.26 110.482 128 1659.76 102.969 1624.73 91.356 512 2135.91 223.054 2603.07 161.160 fsmark, 16 threads, create w/32k logbsize create unlink async 5m06s 4m15s sync 5m00s 4m22s And on Jan's test machine: 5.18-rc8-vanilla 5.18-rc8-patched Amean 1 71.22 ( 0.00%) 64.94 * 8.81%* Amean 2 93.03 ( 0.00%) 84.80 * 8.85%* Amean 4 150.54 ( 0.00%) 137.51 * 8.66%* Amean 8 252.53 ( 0.00%) 242.24 * 4.08%* Amean 16 454.13 ( 0.00%) 439.08 * 3.31%* Amean 32 835.24 ( 0.00%) 829.74 * 0.66%* Amean 64 1740.59 ( 0.00%) 1686.73 * 3.09%* Performance and cache flush behaviour is restored to pre-regression levels. As such, we can now consider the async cache flush mechanism an unnecessary exercise in premature optimisation and hence we can now remove it and the infrastructure it requires completely. Fixes: bad77c375e8d ("xfs: CIL checkpoint flushes caches unconditionally") Reported-and-tested-by: Jan Kara Signed-off-by: Dave Chinner Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Leah Rumancik Acked-by: Darrick J. Wong Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- fs/xfs/xfs_bio_io.c | 35 ----------------------------------- fs/xfs/xfs_linux.h | 2 -- fs/xfs/xfs_log.c | 36 +++++++++++------------------------- fs/xfs/xfs_log_cil.c | 42 +++++++++++++----------------------------- fs/xfs/xfs_log_priv.h | 3 +-- 5 files changed, 25 insertions(+), 93 deletions(-) --- a/fs/xfs/xfs_bio_io.c +++ b/fs/xfs/xfs_bio_io.c @@ -9,41 +9,6 @@ static inline unsigned int bio_max_vecs( return bio_max_segs(howmany(count, PAGE_SIZE)); } =20 -static void -xfs_flush_bdev_async_endio( - struct bio *bio) -{ - complete(bio->bi_private); -} - -/* - * Submit a request for an async cache flush to run. If the request queue = does - * not require flush operations, just skip it altogether. If the caller ne= eds - * to wait for the flush completion at a later point in time, they must su= pply a - * valid completion. This will be signalled when the flush completes. The - * caller never sees the bio that is issued here. - */ -void -xfs_flush_bdev_async( - struct bio *bio, - struct block_device *bdev, - struct completion *done) -{ - struct request_queue *q =3D bdev->bd_disk->queue; - - if (!test_bit(QUEUE_FLAG_WC, &q->queue_flags)) { - complete(done); - return; - } - - bio_init(bio, NULL, 0); - bio_set_dev(bio, bdev); - bio->bi_opf =3D REQ_OP_WRITE | REQ_PREFLUSH | REQ_SYNC; - bio->bi_private =3D done; - bio->bi_end_io =3D xfs_flush_bdev_async_endio; - - submit_bio(bio); -} int xfs_rw_bdev( struct block_device *bdev, --- a/fs/xfs/xfs_linux.h +++ b/fs/xfs/xfs_linux.h @@ -197,8 +197,6 @@ static inline uint64_t howmany_64(uint64 =20 int xfs_rw_bdev(struct block_device *bdev, sector_t sector, unsigned int c= ount, char *data, unsigned int op); -void xfs_flush_bdev_async(struct bio *bio, struct block_device *bdev, - struct completion *done); =20 #define ASSERT_ALWAYS(expr) \ (likely(expr) ? (void)0 : assfail(NULL, #expr, __FILE__, __LINE__)) --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c @@ -527,12 +527,6 @@ xlog_state_shutdown_callbacks( * Flush iclog to disk if this is the last reference to the given iclog an= d the * it is in the WANT_SYNC state. * - * If the caller passes in a non-zero @old_tail_lsn and the current log ta= il - * does not match, there may be metadata on disk that must be persisted be= fore - * this iclog is written. To satisfy that requirement, set the - * XLOG_ICL_NEED_FLUSH flag as a condition for writing this iclog with the= new - * log tail value. - * * If XLOG_ICL_NEED_FUA is already set on the iclog, we need to ensure tha= t the * log tail is updated correctly. NEED_FUA indicates that the iclog will be * written to stable storage, and implies that a commit record is contained @@ -549,12 +543,10 @@ xlog_state_shutdown_callbacks( * always capture the tail lsn on the iclog on the first NEED_FUA release * regardless of the number of active reference counts on this iclog. */ - int xlog_state_release_iclog( struct xlog *log, - struct xlog_in_core *iclog, - xfs_lsn_t old_tail_lsn) + struct xlog_in_core *iclog) { xfs_lsn_t tail_lsn; bool last_ref; @@ -565,18 +557,14 @@ xlog_state_release_iclog( /* * Grabbing the current log tail needs to be atomic w.r.t. the writing * of the tail LSN into the iclog so we guarantee that the log tail does - * not move between deciding if a cache flush is required and writing - * the LSN into the iclog below. + * not move between the first time we know that the iclog needs to be + * made stable and when we eventually submit it. */ - if (old_tail_lsn || iclog->ic_state =3D=3D XLOG_STATE_WANT_SYNC) { + if ((iclog->ic_state =3D=3D XLOG_STATE_WANT_SYNC || + (iclog->ic_flags & XLOG_ICL_NEED_FUA)) && + !iclog->ic_header.h_tail_lsn) { tail_lsn =3D xlog_assign_tail_lsn(log->l_mp); - - if (old_tail_lsn && tail_lsn !=3D old_tail_lsn) - iclog->ic_flags |=3D XLOG_ICL_NEED_FLUSH; - - if ((iclog->ic_flags & XLOG_ICL_NEED_FUA) && - !iclog->ic_header.h_tail_lsn) - iclog->ic_header.h_tail_lsn =3D cpu_to_be64(tail_lsn); + iclog->ic_header.h_tail_lsn =3D cpu_to_be64(tail_lsn); } =20 last_ref =3D atomic_dec_and_test(&iclog->ic_refcnt); @@ -601,8 +589,6 @@ xlog_state_release_iclog( } =20 iclog->ic_state =3D XLOG_STATE_SYNCING; - if (!iclog->ic_header.h_tail_lsn) - iclog->ic_header.h_tail_lsn =3D cpu_to_be64(tail_lsn); xlog_verify_tail_lsn(log, iclog); trace_xlog_iclog_syncing(iclog, _RET_IP_); =20 @@ -875,7 +861,7 @@ xlog_force_iclog( iclog->ic_flags |=3D XLOG_ICL_NEED_FLUSH | XLOG_ICL_NEED_FUA; if (iclog->ic_state =3D=3D XLOG_STATE_ACTIVE) xlog_state_switch_iclogs(iclog->ic_log, iclog, 0); - return xlog_state_release_iclog(iclog->ic_log, iclog, 0); + return xlog_state_release_iclog(iclog->ic_log, iclog); } =20 /* @@ -2413,7 +2399,7 @@ xlog_write_copy_finish( ASSERT(iclog->ic_state =3D=3D XLOG_STATE_WANT_SYNC || xlog_is_shutdown(log)); release_iclog: - error =3D xlog_state_release_iclog(log, iclog, 0); + error =3D xlog_state_release_iclog(log, iclog); spin_unlock(&log->l_icloglock); return error; } @@ -2630,7 +2616,7 @@ next_lv: =20 spin_lock(&log->l_icloglock); xlog_state_finish_copy(log, iclog, record_cnt, data_cnt); - error =3D xlog_state_release_iclog(log, iclog, 0); + error =3D xlog_state_release_iclog(log, iclog); spin_unlock(&log->l_icloglock); =20 return error; @@ -3054,7 +3040,7 @@ restart: * reference to the iclog. */ if (!atomic_add_unless(&iclog->ic_refcnt, -1, 1)) - error =3D xlog_state_release_iclog(log, iclog, 0); + error =3D xlog_state_release_iclog(log, iclog); spin_unlock(&log->l_icloglock); if (error) return error; --- a/fs/xfs/xfs_log_cil.c +++ b/fs/xfs/xfs_log_cil.c @@ -681,11 +681,21 @@ xlog_cil_set_ctx_write_state( * The LSN we need to pass to the log items on transaction * commit is the LSN reported by the first log vector write, not * the commit lsn. If we use the commit record lsn then we can - * move the tail beyond the grant write head. + * move the grant write head beyond the tail LSN and overwrite + * it. */ ctx->start_lsn =3D lsn; wake_up_all(&cil->xc_start_wait); spin_unlock(&cil->xc_push_lock); + + /* + * Make sure the metadata we are about to overwrite in the log + * has been flushed to stable storage before this iclog is + * issued. + */ + spin_lock(&cil->xc_log->l_icloglock); + iclog->ic_flags |=3D XLOG_ICL_NEED_FLUSH; + spin_unlock(&cil->xc_log->l_icloglock); return; } =20 @@ -864,10 +874,7 @@ xlog_cil_push_work( struct xfs_trans_header thdr; struct xfs_log_iovec lhdr; struct xfs_log_vec lvhdr =3D { NULL }; - xfs_lsn_t preflush_tail_lsn; xfs_csn_t push_seq; - struct bio bio; - DECLARE_COMPLETION_ONSTACK(bdev_flush); bool push_commit_stable; =20 new_ctx =3D xlog_cil_ctx_alloc(); @@ -938,23 +945,6 @@ xlog_cil_push_work( spin_unlock(&cil->xc_push_lock); =20 /* - * The CIL is stable at this point - nothing new will be added to it - * because we hold the flush lock exclusively. Hence we can now issue - * a cache flush to ensure all the completed metadata in the journal we - * are about to overwrite is on stable storage. - * - * Because we are issuing this cache flush before we've written the - * tail lsn to the iclog, we can have metadata IO completions move the - * tail forwards between the completion of this flush and the iclog - * being written. In this case, we need to re-issue the cache flush - * before the iclog write. To detect whether the log tail moves, sample - * the tail LSN *before* we issue the flush. - */ - preflush_tail_lsn =3D atomic64_read(&log->l_tail_lsn); - xfs_flush_bdev_async(&bio, log->l_mp->m_ddev_targp->bt_bdev, - &bdev_flush); - - /* * Pull all the log vectors off the items in the CIL, and remove the * items from the CIL. We don't need the CIL lock here because it's only * needed on the transaction commit side which is currently locked out @@ -1030,12 +1020,6 @@ xlog_cil_push_work( lvhdr.lv_iovecp =3D &lhdr; lvhdr.lv_next =3D ctx->lv_chain; =20 - /* - * Before we format and submit the first iclog, we have to ensure that - * the metadata writeback ordering cache flush is complete. - */ - wait_for_completion(&bdev_flush); - error =3D xlog_cil_write_chain(ctx, &lvhdr); if (error) goto out_abort_free_ticket; @@ -1094,7 +1078,7 @@ xlog_cil_push_work( if (push_commit_stable && ctx->commit_iclog->ic_state =3D=3D XLOG_STATE_ACTIVE) xlog_state_switch_iclogs(log, ctx->commit_iclog, 0); - xlog_state_release_iclog(log, ctx->commit_iclog, preflush_tail_lsn); + xlog_state_release_iclog(log, ctx->commit_iclog); =20 /* Not safe to reference ctx now! */ =20 @@ -1115,7 +1099,7 @@ out_abort_free_ticket: return; } spin_lock(&log->l_icloglock); - xlog_state_release_iclog(log, ctx->commit_iclog, 0); + xlog_state_release_iclog(log, ctx->commit_iclog); /* Not safe to reference ctx now! */ spin_unlock(&log->l_icloglock); } --- a/fs/xfs/xfs_log_priv.h +++ b/fs/xfs/xfs_log_priv.h @@ -524,8 +524,7 @@ void xfs_log_ticket_regrant(struct xlog =20 void xlog_state_switch_iclogs(struct xlog *log, struct xlog_in_core *iclog, int eventual_size); -int xlog_state_release_iclog(struct xlog *log, struct xlog_in_core *iclog, - xfs_lsn_t log_tail_lsn); +int xlog_state_release_iclog(struct xlog *log, struct xlog_in_core *iclog); =20 /* * When we crack an atomic LSN, we sample it first so that the value will = not From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFEF0C433EF for ; Tue, 19 Jul 2022 12:31:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240234AbiGSMbi (ORCPT ); Tue, 19 Jul 2022 08:31:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240642AbiGSM3s (ORCPT ); Tue, 19 Jul 2022 08:29: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 0017E691F9; Tue, 19 Jul 2022 05:11:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DD62BB81B32; Tue, 19 Jul 2022 12:11:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B8E3C341CF; Tue, 19 Jul 2022 12:11:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232685; bh=HpRZwYpGGp11YRHRT9z7MzDiIt7YNlvkO80tr+oVew8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e9qZniKmRC3UzYZlLKzgd4Njv09lWr5yR0eY7ynWvYqcjwG2k1qQhm0rmnIbY9lqY A1+jpwdobmbHyyC91OaLSddQfZOCsUVKVQD+jxu/VmJp03a4USktFJmenaWG9q2l3u gCh9EZh9Zy4gwSmYZVxTrRFcS0IWdP+MqIWUvhRA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Dmitry Osipenko , Philipp Zabel , Sasha Levin Subject: [PATCH 5.15 030/167] reset: Fix devm bulk optional exclusive control getter Date: Tue, 19 Jul 2022 13:52:42 +0200 Message-Id: <20220719114659.674929709@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Serge Semin [ Upstream commit a57f68ddc8865d59a19783080cc52fb4a11dc209 ] Most likely due to copy-paste mistake the device managed version of the denoted reset control getter has been implemented with invalid semantic, which can be immediately spotted by having "WARN_ON(shared && acquired)" warning in the system log as soon as the method is called. Anyway let's fix it by altering the boolean arguments passed to the __devm_reset_control_bulk_get() method from - shared =3D true, optional =3D false, acquired =3D true to + shared =3D false, optional =3D true, acquired =3D true That's what they were supposed to be in the first place (see the non-devm version of the same method: reset_control_bulk_get_optional_exclusive()). Fixes: 48d71395896d ("reset: Add reset_control_bulk API") Signed-off-by: Serge Semin Reviewed-by: Dmitry Osipenko Signed-off-by: Philipp Zabel Link: https://lore.kernel.org/r/20220624141853.7417-2-Sergey.Semin@baikalel= ectronics.ru Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- include/linux/reset.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/reset.h b/include/linux/reset.h index db0e6115a2f6..7bb583737528 100644 --- a/include/linux/reset.h +++ b/include/linux/reset.h @@ -711,7 +711,7 @@ static inline int __must_check devm_reset_control_bulk_get_optional_exclusive(struct device *dev, int num= _rstcs, struct reset_control_bulk_data *rstcs) { - return __devm_reset_control_bulk_get(dev, num_rstcs, rstcs, true, false, = true); + return __devm_reset_control_bulk_get(dev, num_rstcs, rstcs, false, true, = true); } =20 /** --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D6F0C43334 for ; Tue, 19 Jul 2022 12:31:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240242AbiGSMbm (ORCPT ); Tue, 19 Jul 2022 08:31:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240686AbiGSM3v (ORCPT ); Tue, 19 Jul 2022 08:29: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 369CF6C103; Tue, 19 Jul 2022 05:11:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B8189B81B31; Tue, 19 Jul 2022 12:11:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12BF0C341C6; Tue, 19 Jul 2022 12:11:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232688; bh=8HMYi2EllsBRqBevCrSHuIbvxXPKyVJozZ70rU+aggg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lJxycMR6Ie6j2d6AZNRYe3LXA0ptZzF6wWT6WA8KzKxSB7mOzHRk+dKSKbE1G7nEP s8lbH9MJWtbVIe8I4aZGvZ4ibXWtTTuiNOby2DQNBmSFrHRh3ycHNn/TcUsxU6xKGy N/q6c7u5qgI7ot+9uin8PIpGWM4PvUghU0/Cy6qw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kris Bahnsen , Fabio Estevam , Shawn Guo , Sasha Levin Subject: [PATCH 5.15 031/167] ARM: dts: imx6qdl-ts7970: Fix ngpio typo and count Date: Tue, 19 Jul 2022 13:52:43 +0200 Message-Id: <20220719114659.767894782@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kris Bahnsen [ Upstream commit e95ea0f687e679fcb0a3a67d0755b81ee7d60db0 ] Device-tree incorrectly used "ngpio" which caused the driver to fallback to 32 ngpios. This platform has 62 GPIO registers. Fixes: 9ff8e9fccef9 ("ARM: dts: TS-7970: add basic device tree") Signed-off-by: Kris Bahnsen Reviewed-by: Fabio Estevam Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/arm/boot/dts/imx6qdl-ts7970.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/imx6qdl-ts7970.dtsi b/arch/arm/boot/dts/imx6= qdl-ts7970.dtsi index fded07f370b3..d6ba4b2a60f6 100644 --- a/arch/arm/boot/dts/imx6qdl-ts7970.dtsi +++ b/arch/arm/boot/dts/imx6qdl-ts7970.dtsi @@ -226,7 +226,7 @@ gpio8: gpio@28 { reg =3D <0x28>; #gpio-cells =3D <2>; gpio-controller; - ngpio =3D <32>; + ngpios =3D <62>; }; =20 sgtl5000: codec@a { --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF4E0CCA491 for ; Tue, 19 Jul 2022 12:31:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240426AbiGSMbF (ORCPT ); Tue, 19 Jul 2022 08:31:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240866AbiGSMaE (ORCPT ); Tue, 19 Jul 2022 08:30:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBCC46D54C; Tue, 19 Jul 2022 05:11: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 7AEF3B81B37; Tue, 19 Jul 2022 12:11:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DEACCC341C6; Tue, 19 Jul 2022 12:11:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232691; bh=5JisgN0ujQbm7P/KToV789LWlkwNuqdhCX08242VV+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CgdxNaBiY5ped1t05iTuK8AtTPWKmHFiqPG6gYyzh6xKdijwVFzSSJZNT0FB1PUaD TPWcMwD6uRToBLgan7q/lG0qmNF8Ru5/470SjavS0v/IQkovf2z0t5eC2gsW3+AZJd hyOfoQP6ruu1tQ7jr8hPqgG9OqF0uMwuyldzdWOo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anastasios Vacharakis , Cristian Ciocaltea , Mark Brown , Sasha Levin Subject: [PATCH 5.15 032/167] spi: amd: Limit max transfer and message size Date: Tue, 19 Jul 2022 13:52:44 +0200 Message-Id: <20220719114659.861525597@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Cristian Ciocaltea [ Upstream commit 6ece49c56965544262523dae4a071ace3db63507 ] Enabling the SPI CS35L41 audio codec driver for Steam Deck [1] revealed a problem with the current AMD SPI controller driver implementation, consisting of an unrecoverable system hang. The issue can be prevented if we ensure the max transfer size and the max message size do not exceed the FIFO buffer size. According to the implementation of the downstream driver, the AMD SPI controller is not able to handle more than 70 bytes per transfer, which corresponds to the size of the FIFO buffer. Hence, let's fix this by setting the SPI limits mentioned above. [1] https://lore.kernel.org/r/20220621213819.262537-1-cristian.ciocaltea@co= llabora.com Reported-by: Anastasios Vacharakis Fixes: bbb336f39efc ("spi: spi-amd: Add AMD SPI controller driver support") Signed-off-by: Cristian Ciocaltea Link: https://lore.kernel.org/r/20220706100626.1234731-2-cristian.ciocaltea= @collabora.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/spi/spi-amd.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/spi/spi-amd.c b/drivers/spi/spi-amd.c index 3cf76096a76d..39dbe9903da2 100644 --- a/drivers/spi/spi-amd.c +++ b/drivers/spi/spi-amd.c @@ -28,6 +28,7 @@ #define AMD_SPI_RX_COUNT_REG 0x4B #define AMD_SPI_STATUS_REG 0x4C =20 +#define AMD_SPI_FIFO_SIZE 70 #define AMD_SPI_MEM_SIZE 200 =20 /* M_CMD OP codes for SPI */ @@ -245,6 +246,11 @@ static int amd_spi_master_transfer(struct spi_master *= master, return 0; } =20 +static size_t amd_spi_max_transfer_size(struct spi_device *spi) +{ + return AMD_SPI_FIFO_SIZE; +} + static int amd_spi_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; @@ -275,6 +281,8 @@ static int amd_spi_probe(struct platform_device *pdev) master->flags =3D SPI_MASTER_HALF_DUPLEX; master->setup =3D amd_spi_master_setup; master->transfer_one_message =3D amd_spi_master_transfer; + master->max_transfer_size =3D amd_spi_max_transfer_size; + master->max_message_size =3D amd_spi_max_transfer_size; =20 /* Register the controller with SPI framework */ err =3D devm_spi_register_master(dev, master); --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C83BC433EF for ; Tue, 19 Jul 2022 12:31:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240420AbiGSMa7 (ORCPT ); Tue, 19 Jul 2022 08:30:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240789AbiGSM35 (ORCPT ); Tue, 19 Jul 2022 08: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 1D9D76D2DB; Tue, 19 Jul 2022 05:11: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 D2799617BE; Tue, 19 Jul 2022 12:11:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3345C341CB; Tue, 19 Jul 2022 12:11:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232694; bh=fOlF4eY+hzJn4YXVxFeaaXj09DXc9UVTfIYTLEV6CfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0dBa4TvEnIS7YDYRfEhMHcl8aWYT2j3LAdXMjqMSBt5vVayO58uF+3r9JGpXAL2UY /7AT5eH1WUJkZjKIE/HSxfl5skrReNWxHQO81WWqHS670TKSSWWr7O1slEc9Wdaxar X5M+CE8ZOd4gtIyW+lPEZCbo8y+c4mmCuPBBzGuk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jon Hunter , Ard Biesheuvel , "Russell King (Oracle)" , Sasha Levin Subject: [PATCH 5.15 033/167] ARM: 9209/1: Spectre-BHB: avoid pr_info() every time a CPU comes out of idle Date: Tue, 19 Jul 2022 13:52:45 +0200 Message-Id: <20220719114659.952561474@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ard Biesheuvel [ Upstream commit 0609e200246bfd3b7516091c491bec4308349055 ] Jon reports that the Spectre-BHB init code is filling up the kernel log with spurious notifications about which mitigation has been enabled, every time any CPU comes out of a low power state. Given that Spectre-BHB mitigations are system wide, only a single mitigation can be enabled, and we already print an error if two types of CPUs coexist in a single system that require different Spectre-BHB mitigations. This means that the pr_info() that describes the selected mitigation does not need to be emitted for each CPU anyway, and so we can simply emit it only once. In order to clarify the above in the log message, update it to describe that the selected mitigation will be enabled on all CPUs, including ones that are unaffected. If another CPU comes up later that is affected and requires a different mitigation, we report an error as before. Fixes: b9baf5c8c5c3 ("ARM: Spectre-BHB workaround") Tested-by: Jon Hunter Signed-off-by: Ard Biesheuvel Signed-off-by: Russell King (Oracle) Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/arm/mm/proc-v7-bugs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/mm/proc-v7-bugs.c b/arch/arm/mm/proc-v7-bugs.c index f9730eba0632..8bc7a2d6d6c7 100644 --- a/arch/arm/mm/proc-v7-bugs.c +++ b/arch/arm/mm/proc-v7-bugs.c @@ -208,10 +208,10 @@ static int spectre_bhb_install_workaround(int method) return SPECTRE_VULNERABLE; =20 spectre_bhb_method =3D method; - } =20 - pr_info("CPU%u: Spectre BHB: using %s workaround\n", - smp_processor_id(), spectre_bhb_method_name(method)); + pr_info("CPU%u: Spectre BHB: enabling %s workaround for all CPUs\n", + smp_processor_id(), spectre_bhb_method_name(method)); + } =20 return SPECTRE_MITIGATED; } --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 136CAC43334 for ; Tue, 19 Jul 2022 12:31:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239781AbiGSMbD (ORCPT ); Tue, 19 Jul 2022 08:31:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240829AbiGSM37 (ORCPT ); Tue, 19 Jul 2022 08:29:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFC9F6D2F0; Tue, 19 Jul 2022 05:11: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 9DF7261614; Tue, 19 Jul 2022 12:11:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 810DFC341C6; Tue, 19 Jul 2022 12:11:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232696; bh=8EB3mZIPTJPEgtKe/x6D9UDXwwwtQ9arLPzarEMA6fw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pt18X2/ODzdsWbxHnuh+yXrOgvsx8YjDs1jGR/SpAWFtEhZMcBgfafLi097cEfc5U TcNNulHyRZ8lUQRFn2JbHcOTtmZ7AgUYloknCFq9PWCQxBxox6fHpH8/E1avS9QUbT athlqvQJuxJ45d+mhyWy9YiH13rQX2tPCXrIWjXM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ard Biesheuvel , Zhen Lei , Kefeng Wang , "Russell King (Oracle)" , Sasha Levin Subject: [PATCH 5.15 034/167] ARM: 9210/1: Mark the FDT_FIXED sections as shareable Date: Tue, 19 Jul 2022 13:52:46 +0200 Message-Id: <20220719114700.030911649@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhen Lei [ Upstream commit 598f0a99fa8a35be44b27106b43ddc66417af3b1 ] commit 7a1be318f579 ("ARM: 9012/1: move device tree mapping out of linear region") use FDT_FIXED_BASE to map the whole FDT_FIXED_SIZE memory area which contains fdt. But it only reserves the exact physical memory that fdt occupied. Unfortunately, this mapping is non-shareable. An illegal or speculative read access can bring the RAM content from non-fdt zone into cache, PIPT makes it to be hit by subsequently read access through shareable mapping(such as linear mapping), and the cache consistency between cores is lost due to non-shareable property. |<---------FDT_FIXED_SIZE------>| | | ------------------------------- | | | | ------------------------------- 1. CoreA read through MT_ROM mapping, the old data is loaded into the cache. 2. CoreB write to update data through linear mapping. CoreA received the notification to invalid the corresponding cachelines, but the property non-shareable makes it to be ignored. 3. CoreA read through linear mapping, cache hit, the old data is read. To eliminate this risk, add a new memory type MT_MEMORY_RO. Compared to MT_ROM, it is shareable and non-executable. Here's an example: list_del corruption. prev->next should be c0ecbf74, but was c08410dc kernel BUG at lib/list_debug.c:53! ... ... PC is at __list_del_entry_valid+0x58/0x98 LR is at __list_del_entry_valid+0x58/0x98 psr: 60000093 sp : c0ecbf30 ip : 00000000 fp : 00000001 r10: c08410d0 r9 : 00000001 r8 : c0825e0c r7 : 20000013 r6 : c08410d0 r5 : c0ecbf74 r4 : c0ecbf74 r3 : c0825d08 r2 : 00000000 r1 : df7ce6f4 r0 : 00000044 ... ... Stack: (0xc0ecbf30 to 0xc0ecc000) bf20: c0ecbf74 c0164fd0 c0ecbf70 c016= 5170 bf40: c0eca000 c0840c00 c0840c00 c0824500 c0825e0c c0189bbc c088f404 6000= 0013 bf60: 60000013 c0e85100 000004ec 00000000 c0ebcdc0 c0ecbf74 c0ecbf74 c082= 5d08 ... ... < next prev > (__list_del_entry_valid) from (__list_del_entry+0xc/0x20) (__list_del_entry) from (finish_swait+0x60/0x7c) (finish_swait) from (rcu_gp_kthread+0x560/0xa20) (rcu_gp_kthread) from (kthread+0x14c/0x15c) (kthread) from (ret_from_fork+0x14/0x24) The faulty list node to be deleted is a local variable, its address is c0ecbf74. The dumped stack shows that 'prev' =3D c0ecbf74, but its value before lib/list_debug.c:53 is c08410dc. A large amount of printing results in swapping out the cacheline containing the old data(MT_ROM mapping is read only, so the cacheline cannot be dirty), and the subsequent dump operation obtains new data from the DDR. Fixes: 7a1be318f579 ("ARM: 9012/1: move device tree mapping out of linear r= egion") Suggested-by: Ard Biesheuvel Signed-off-by: Zhen Lei Reviewed-by: Ard Biesheuvel Reviewed-by: Kefeng Wang Signed-off-by: Russell King (Oracle) Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/arm/include/asm/mach/map.h | 1 + arch/arm/mm/mmu.c | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/mach/map.h b/arch/arm/include/asm/mach/ma= p.h index 92282558caf7..2b8970d8e5a2 100644 --- a/arch/arm/include/asm/mach/map.h +++ b/arch/arm/include/asm/mach/map.h @@ -27,6 +27,7 @@ enum { MT_HIGH_VECTORS, MT_MEMORY_RWX, MT_MEMORY_RW, + MT_MEMORY_RO, MT_ROM, MT_MEMORY_RWX_NONCACHED, MT_MEMORY_RW_DTCM, diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 5e2be37a198e..cd17e324aa51 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -296,6 +296,13 @@ static struct mem_type mem_types[] __ro_after_init =3D= { .prot_sect =3D PMD_TYPE_SECT | PMD_SECT_AP_WRITE, .domain =3D DOMAIN_KERNEL, }, + [MT_MEMORY_RO] =3D { + .prot_pte =3D L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY | + L_PTE_XN | L_PTE_RDONLY, + .prot_l1 =3D PMD_TYPE_TABLE, + .prot_sect =3D PMD_TYPE_SECT, + .domain =3D DOMAIN_KERNEL, + }, [MT_ROM] =3D { .prot_sect =3D PMD_TYPE_SECT, .domain =3D DOMAIN_KERNEL, @@ -489,6 +496,7 @@ static void __init build_mem_type_table(void) =20 /* Also setup NX memory mapping */ mem_types[MT_MEMORY_RW].prot_sect |=3D PMD_SECT_XN; + mem_types[MT_MEMORY_RO].prot_sect |=3D PMD_SECT_XN; } if (cpu_arch >=3D CPU_ARCH_ARMv7 && (cr & CR_TRE)) { /* @@ -568,6 +576,7 @@ static void __init build_mem_type_table(void) mem_types[MT_ROM].prot_sect |=3D PMD_SECT_APX|PMD_SECT_AP_WRITE; mem_types[MT_MINICLEAN].prot_sect |=3D PMD_SECT_APX|PMD_SECT_AP_WRITE; mem_types[MT_CACHECLEAN].prot_sect |=3D PMD_SECT_APX|PMD_SECT_AP_WRITE; + mem_types[MT_MEMORY_RO].prot_sect |=3D PMD_SECT_APX|PMD_SECT_AP_WRITE; #endif =20 /* @@ -587,6 +596,8 @@ static void __init build_mem_type_table(void) mem_types[MT_MEMORY_RWX].prot_pte |=3D L_PTE_SHARED; mem_types[MT_MEMORY_RW].prot_sect |=3D PMD_SECT_S; mem_types[MT_MEMORY_RW].prot_pte |=3D L_PTE_SHARED; + mem_types[MT_MEMORY_RO].prot_sect |=3D PMD_SECT_S; + mem_types[MT_MEMORY_RO].prot_pte |=3D L_PTE_SHARED; mem_types[MT_MEMORY_DMA_READY].prot_pte |=3D L_PTE_SHARED; mem_types[MT_MEMORY_RWX_NONCACHED].prot_sect |=3D PMD_SECT_S; mem_types[MT_MEMORY_RWX_NONCACHED].prot_pte |=3D L_PTE_SHARED; @@ -647,6 +658,8 @@ static void __init build_mem_type_table(void) mem_types[MT_MEMORY_RWX].prot_pte |=3D kern_pgprot; mem_types[MT_MEMORY_RW].prot_sect |=3D ecc_mask | cp->pmd; mem_types[MT_MEMORY_RW].prot_pte |=3D kern_pgprot; + mem_types[MT_MEMORY_RO].prot_sect |=3D ecc_mask | cp->pmd; + mem_types[MT_MEMORY_RO].prot_pte |=3D kern_pgprot; mem_types[MT_MEMORY_DMA_READY].prot_pte |=3D kern_pgprot; mem_types[MT_MEMORY_RWX_NONCACHED].prot_sect |=3D ecc_mask; mem_types[MT_ROM].prot_sect |=3D cp->pmd; @@ -1360,7 +1373,7 @@ static void __init devicemaps_init(const struct machi= ne_desc *mdesc) map.pfn =3D __phys_to_pfn(__atags_pointer & SECTION_MASK); map.virtual =3D FDT_FIXED_BASE; map.length =3D FDT_FIXED_SIZE; - map.type =3D MT_ROM; + map.type =3D MT_MEMORY_RO; create_mapping(&map); } =20 --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECD10CCA486 for ; Tue, 19 Jul 2022 12:31:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237851AbiGSMbK (ORCPT ); Tue, 19 Jul 2022 08:31:10 -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 S240871AbiGSMaF (ORCPT ); Tue, 19 Jul 2022 08:30:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2EA86D556; Tue, 19 Jul 2022 05:11: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 84663616F8; Tue, 19 Jul 2022 12:11:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67B4CC341C6; Tue, 19 Jul 2022 12:11:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232699; bh=uE271MLnW5X1i/J+uUgC5TM0tctvCfDzZq2l/nPJUQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V/D/P0zAYqAhYvrD9TR45v2wXOEe2zJyp5DgFuJj5QRIQIPHvMaLNdP8j2zG95I9M ELlNhZsivGAHbdBQvnzo7Ygb67dYKr5Jn+zAHzwauLynmaq/G1HPKYNAjs/9/6mc7I 5tCdDMnpKLhGMQhleDQHqZN/1ltPgwS/23eCRlbM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tariq Toukan , Maxim Mikityanskiy , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.15 035/167] net/mlx5e: kTLS, Fix build time constant test in TX Date: Tue, 19 Jul 2022 13:52:47 +0200 Message-Id: <20220719114700.110782274@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tariq Toukan [ Upstream commit 6cc2714e85754a621219693ea8aa3077d6fca0cb ] Use the correct constant (TLS_DRIVER_STATE_SIZE_TX) in the comparison against the size of the private TX TLS driver context. Fixes: df8d866770f9 ("net/mlx5e: kTLS, Use kernel API to extract private of= fload context") Signed-off-by: Tariq Toukan Reviewed-by: Maxim Mikityanskiy Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c b/d= rivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c index 9ad3459fb63a..dadb71081ed0 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c @@ -68,8 +68,7 @@ mlx5e_set_ktls_tx_priv_ctx(struct tls_context *tls_ctx, struct mlx5e_ktls_offload_context_tx **ctx =3D __tls_driver_ctx(tls_ctx, TLS_OFFLOAD_CTX_DIR_TX); =20 - BUILD_BUG_ON(sizeof(struct mlx5e_ktls_offload_context_tx *) > - TLS_OFFLOAD_CONTEXT_SIZE_TX); + BUILD_BUG_ON(sizeof(priv_tx) > TLS_DRIVER_STATE_SIZE_TX); =20 *ctx =3D priv_tx; } --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39793C433EF for ; Tue, 19 Jul 2022 12:31:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240115AbiGSMbt (ORCPT ); Tue, 19 Jul 2022 08:31:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239909AbiGSMaJ (ORCPT ); Tue, 19 Jul 2022 08:30: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 06DCF6C125; Tue, 19 Jul 2022 05:11: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 4D92C615F4; Tue, 19 Jul 2022 12:11:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 343F4C341C6; Tue, 19 Jul 2022 12:11:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232702; bh=pSo7nHyz2Rcd4Tctm5UEPmaFOxR38Pcp/wDMG3bR+dI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S7byWGyDl8u6yXT5mRLWHY/9BWy5fiQhWaG89q2G7nod9MU9yeV5gE6lEAhVZhe9g xWxKpIv8l4qbLgGOmwlYNc04z1GU8E7gYPkXi+4cvpprGeRv2i39432ysaIhVPVNMn Zwva8MfkIpyju7i8x1cO9S2sIh1Nd9lHnmfVe19o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tariq Toukan , Maxim Mikityanskiy , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.15 036/167] net/mlx5e: kTLS, Fix build time constant test in RX Date: Tue, 19 Jul 2022 13:52:48 +0200 Message-Id: <20220719114700.201844031@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tariq Toukan [ Upstream commit 2ec6cf9b742a5c18982861322fa5de6510f8f57e ] Use the correct constant (TLS_DRIVER_STATE_SIZE_RX) in the comparison against the size of the private RX TLS driver context. Fixes: 1182f3659357 ("net/mlx5e: kTLS, Add kTLS RX HW offload support") Signed-off-by: Tariq Toukan Reviewed-by: Maxim Mikityanskiy Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c b/d= rivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c index 15711814d2d2..d92b97c56f4c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c @@ -231,8 +231,7 @@ mlx5e_set_ktls_rx_priv_ctx(struct tls_context *tls_ctx, struct mlx5e_ktls_offload_context_rx **ctx =3D __tls_driver_ctx(tls_ctx, TLS_OFFLOAD_CTX_DIR_RX); =20 - BUILD_BUG_ON(sizeof(struct mlx5e_ktls_offload_context_rx *) > - TLS_OFFLOAD_CONTEXT_SIZE_RX); + BUILD_BUG_ON(sizeof(priv_rx) > TLS_DRIVER_STATE_SIZE_RX); =20 *ctx =3D priv_rx; } --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D7DBC433EF for ; Tue, 19 Jul 2022 12:32:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240448AbiGSMcR (ORCPT ); Tue, 19 Jul 2022 08:32:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240072AbiGSMb1 (ORCPT ); Tue, 19 Jul 2022 08:31:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3808652883; Tue, 19 Jul 2022 05:11:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CC8F7B81B2E; Tue, 19 Jul 2022 12:11:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F3CEC341CB; Tue, 19 Jul 2022 12:11:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232705; bh=xXka3hcQsxFrFK2ApKm8SInwLLCYwCp3TXJmICQEvU8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DnBbOM3CyeK7eBqyFyvMHjN873dY/beM9a6dPR07B6GgWaID2X/GGpxVSEoOYhq+J cCyNk6Af6Ey9kI6yV/eNB8Fxt/ZyrlgryjXEiTADJ29ve3bgsswbHDtyJdEPhY7mOt vIbSW7+du+A7Dh9zxfXDcHI3iHiamwxfqxD0MWIg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Blakey , Roi Dayan , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.15 037/167] net/mlx5e: Fix enabling sriov while tc nic rules are offloaded Date: Tue, 19 Jul 2022 13:52:49 +0200 Message-Id: <20220719114700.290640439@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paul Blakey [ Upstream commit 0c9d876545a56aebed30fa306d0460a4d28d271a ] There is a total of four 4M entries flow tables. In sriov disabled mode, ct, ct_nat and post_act take three of them. When adding the first tc nic rule in this mode, it will take another 4M table for the tc table. If user then enables sriov, the legacy flow table tries to take another 4M and fails, and so enablement fails. To fix that, have legacy fdb take the next available maximum size from the fs ft pool. Fixes: 4a98544d1827 ("net/mlx5: Move chains ft pool to be used by all firmw= are steering") Signed-off-by: Paul Blakey Reviewed-by: Roi Dayan Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c b/drivers= /net/ethernet/mellanox/mlx5/core/esw/legacy.c index 0c4c743ca31e..3a2575dc5355 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c @@ -11,6 +11,7 @@ #include "mlx5_core.h" #include "eswitch.h" #include "fs_core.h" +#include "fs_ft_pool.h" #include "esw/qos.h" =20 enum { @@ -95,8 +96,7 @@ static int esw_create_legacy_fdb_table(struct mlx5_eswitc= h *esw) if (!flow_group_in) return -ENOMEM; =20 - table_size =3D BIT(MLX5_CAP_ESW_FLOWTABLE_FDB(dev, log_max_ft_size)); - ft_attr.max_fte =3D table_size; + ft_attr.max_fte =3D POOL_NEXT_SIZE; ft_attr.prio =3D LEGACY_FDB_PRIO; fdb =3D mlx5_create_flow_table(root_ns, &ft_attr); if (IS_ERR(fdb)) { @@ -105,6 +105,7 @@ static int esw_create_legacy_fdb_table(struct mlx5_eswi= tch *esw) goto out; } esw->fdb_table.legacy.fdb =3D fdb; + table_size =3D fdb->max_fte; =20 /* Addresses group : Full match unicast/multicast addresses */ MLX5_SET(create_flow_group_in, flow_group_in, match_criteria_enable, --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14779C43334 for ; Tue, 19 Jul 2022 12:32:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232908AbiGSMcE (ORCPT ); Tue, 19 Jul 2022 08:32:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239026AbiGSMaS (ORCPT ); Tue, 19 Jul 2022 08:30: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 B350D6D9E4; Tue, 19 Jul 2022 05:11: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 737A3B81B31; Tue, 19 Jul 2022 12:11:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA26DC341C6; Tue, 19 Jul 2022 12:11:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232708; bh=rw7jY2zwDt3Jsu4RiDfcZvwp9AB82wUt80BndqxQa+o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IH0S12Cv38F5XYiTcY+hA1gL7WxUofE2UQwhl1OJ9hDTKfB80iQuhZQH+XZKRCZAa t66timSJWwtNbcm/1yS6nc7/oMDWL3aZ0cNl9OdaFP1X0TrSqDWrSGlGc3CT6Dn6t8 HU2RZT5Hb6nSkVmFMWjTtFPgZeOCDDbjFDVVIFWI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gal Pressman , Tariq Toukan , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.15 038/167] net/mlx5e: Fix capability check for updating vnic env counters Date: Tue, 19 Jul 2022 13:52:50 +0200 Message-Id: <20220719114700.370664064@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Gal Pressman [ Upstream commit 452133dd580811f184e76b1402983182ee425298 ] The existing capability check for vnic env counters only checks for receive steering discards, although we need the counters update for the exposed internal queue oob counter as well. This could result in the latter counter not being updated correctly when the receive steering discards counter is not supported. Fix that by checking whether any counter is supported instead of only the steering counter capability. Fixes: 0cfafd4b4ddf ("net/mlx5e: Add device out of buffer counter") Signed-off-by: Gal Pressman Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/mellanox/mlx5/core/en_stats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c b/drivers/n= et/ethernet/mellanox/mlx5/core/en_stats.c index e1dd17019030..5a5c6eda29d2 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c @@ -614,7 +614,7 @@ static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(vnic_env) u32 in[MLX5_ST_SZ_DW(query_vnic_env_in)] =3D {}; struct mlx5_core_dev *mdev =3D priv->mdev; =20 - if (!MLX5_CAP_GEN(priv->mdev, nic_receive_steering_discard)) + if (!mlx5e_stats_grp_vnic_env_num_stats(priv)) return; =20 MLX5_SET(query_vnic_env_in, in, opcode, MLX5_CMD_OP_QUERY_VNIC_ENV); --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9178AC43334 for ; Tue, 19 Jul 2022 12:32:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239030AbiGSMcI (ORCPT ); Tue, 19 Jul 2022 08:32:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240340AbiGSMa2 (ORCPT ); Tue, 19 Jul 2022 08:30:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D63866D540; Tue, 19 Jul 2022 05:11: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 5D176B81B84; Tue, 19 Jul 2022 12:11:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC697C341CF; Tue, 19 Jul 2022 12:11:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232711; bh=Nb1vW5IQk2Vln6SQhixDVXvDjPnKh1njt1nUAEYqPVA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vFChtpNIa7rzFzO7XhI8lZaGJrTcjXaHhSL/aot+OLuzGRd/Owk7w5dQ12GFwIiU8 vhFVUUyubEnuvMW2XzUi7qLSJA1vtG6R/R3AsIMAr91Ed9oHIUj61W8SSYf6g2A03K jBuvLc73hFprgQM9pSwdr6Sp6pG4msruXc3qPkJ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Mikityanskiy , Tariq Toukan , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.15 039/167] net/mlx5e: Ring the TX doorbell on DMA errors Date: Tue, 19 Jul 2022 13:52:51 +0200 Message-Id: <20220719114700.464089487@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxim Mikityanskiy [ Upstream commit 5b759bf2f9d73db05369aef2344502095c4e5e73 ] TX doorbells may be postponed, because sometimes the driver knows that another packet follows (for example, when xmit_more is true, or when a MPWQE session is closed before transmitting a packet). However, the DMA mapping may fail for the next packet, in which case a new WQE is not posted, the doorbell isn't updated either, and the transmission of the previous packet will be delayed indefinitely. This commit fixes the described rare error flow by posting a NOP and ringing the doorbell on errors to flush all the previous packets. The MPWQE session is closed before that. DMA mapping in the MPWQE flow is moved to the beginning of mlx5e_sq_xmit_mpwqe, because empty sessions are not allowed. Stop room always has enough space for a NOP, because the actual TX WQE is not posted. Fixes: e586b3b0baee ("net/mlx5: Ethernet Datapath files") Signed-off-by: Maxim Mikityanskiy Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- .../net/ethernet/mellanox/mlx5/core/en_tx.c | 39 ++++++++++++++----- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/= ethernet/mellanox/mlx5/core/en_tx.c index 7fd33b356cc8..1544d4c2c636 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c @@ -429,6 +429,26 @@ static void mlx5e_tx_check_stop(struct mlx5e_txqsq *sq) } } =20 +static void mlx5e_tx_flush(struct mlx5e_txqsq *sq) +{ + struct mlx5e_tx_wqe_info *wi; + struct mlx5e_tx_wqe *wqe; + u16 pi; + + /* Must not be called when a MPWQE session is active but empty. */ + mlx5e_tx_mpwqe_ensure_complete(sq); + + pi =3D mlx5_wq_cyc_ctr2ix(&sq->wq, sq->pc); + wi =3D &sq->db.wqe_info[pi]; + + *wi =3D (struct mlx5e_tx_wqe_info) { + .num_wqebbs =3D 1, + }; + + wqe =3D mlx5e_post_nop(&sq->wq, sq->sqn, &sq->pc); + mlx5e_notify_hw(&sq->wq, sq->pc, sq->uar_map, &wqe->ctrl); +} + static inline void mlx5e_txwqe_complete(struct mlx5e_txqsq *sq, struct sk_buff *skb, const struct mlx5e_tx_attr *attr, @@ -521,6 +541,7 @@ mlx5e_sq_xmit_wqe(struct mlx5e_txqsq *sq, struct sk_buf= f *skb, err_drop: stats->dropped++; dev_kfree_skb_any(skb); + mlx5e_tx_flush(sq); } =20 static bool mlx5e_tx_skb_supports_mpwqe(struct sk_buff *skb, struct mlx5e_= tx_attr *attr) @@ -622,6 +643,13 @@ mlx5e_sq_xmit_mpwqe(struct mlx5e_txqsq *sq, struct sk_= buff *skb, struct mlx5_wqe_ctrl_seg *cseg; struct mlx5e_xmit_data txd; =20 + txd.data =3D skb->data; + txd.len =3D skb->len; + + txd.dma_addr =3D dma_map_single(sq->pdev, txd.data, txd.len, DMA_TO_DEVIC= E); + if (unlikely(dma_mapping_error(sq->pdev, txd.dma_addr))) + goto err_unmap; + if (!mlx5e_tx_mpwqe_session_is_active(sq)) { mlx5e_tx_mpwqe_session_start(sq, eseg); } else if (!mlx5e_tx_mpwqe_same_eseg(sq, eseg)) { @@ -631,18 +659,9 @@ mlx5e_sq_xmit_mpwqe(struct mlx5e_txqsq *sq, struct sk_= buff *skb, =20 sq->stats->xmit_more +=3D xmit_more; =20 - txd.data =3D skb->data; - txd.len =3D skb->len; - - txd.dma_addr =3D dma_map_single(sq->pdev, txd.data, txd.len, DMA_TO_DEVIC= E); - if (unlikely(dma_mapping_error(sq->pdev, txd.dma_addr))) - goto err_unmap; mlx5e_dma_push(sq, txd.dma_addr, txd.len, MLX5E_DMA_MAP_SINGLE); - mlx5e_skb_fifo_push(&sq->db.skb_fifo, skb); - mlx5e_tx_mpwqe_add_dseg(sq, &txd); - mlx5e_tx_skb_update_hwts_flags(skb); =20 if (unlikely(mlx5e_tx_mpwqe_is_full(&sq->mpwqe))) { @@ -664,6 +683,7 @@ mlx5e_sq_xmit_mpwqe(struct mlx5e_txqsq *sq, struct sk_b= uff *skb, mlx5e_dma_unmap_wqe_err(sq, 1); sq->stats->dropped++; dev_kfree_skb_any(skb); + mlx5e_tx_flush(sq); } =20 void mlx5e_tx_mpwqe_ensure_complete(struct mlx5e_txqsq *sq) @@ -1033,5 +1053,6 @@ void mlx5i_sq_xmit(struct mlx5e_txqsq *sq, struct sk_= buff *skb, err_drop: stats->dropped++; dev_kfree_skb_any(skb); + mlx5e_tx_flush(sq); } #endif --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6E4DC43334 for ; Tue, 19 Jul 2022 12:32:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240257AbiGSMc2 (ORCPT ); Tue, 19 Jul 2022 08:32:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237781AbiGSMbw (ORCPT ); Tue, 19 Jul 2022 08:31:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11AB16F7D1; Tue, 19 Jul 2022 05:12: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 75C51617B2; Tue, 19 Jul 2022 12:11:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43002C341C6; Tue, 19 Jul 2022 12:11:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232716; bh=X9WuZHRBiz2nho8DCaOdG+r9o02kpV/Q6WT/c4yRdgs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rk0LEn6v7VqF29OqxobqvwnmDupfO3tR8xG5tTbeQwms1j7rj4sKhE9lwzmG2D2Xt +5F0jMuTolx1gNosA/SSgSR13dOrR45H7uZMrG5kgbBdiKpC3mQxKV2kAXiPKURS77 ncl7yRXIeK9DsB8sImWAU5RoJSn3EsrlBq2LFICI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= , Rodrigo Vivi , Sasha Levin Subject: [PATCH 5.15 040/167] drm/i915: fix a possible refcount leak in intel_dp_add_mst_connector() Date: Tue, 19 Jul 2022 13:52:52 +0200 Message-Id: <20220719114700.557060581@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hangyu Hua [ Upstream commit 85144df9ff4652816448369de76897c57cbb1b93 ] If drm_connector_init fails, intel_connector_free will be called to take care of proper free. So it is necessary to drop the refcount of port before intel_connector_free. Fixes: 091a4f91942a ("drm/i915: Handle drm-layer errors in intel_dp_add_mst= _connector") Signed-off-by: Hangyu Hua Reviewed-by: Jos=C3=A9 Roberto de Souza Link: https://patchwork.freedesktop.org/patch/msgid/20220624130406.17996-1-= jose.souza@intel.com Signed-off-by: Jos=C3=A9 Roberto de Souza (cherry picked from commit cea9ed611e85d36a05db52b6457bf584b7d969e2) Signed-off-by: Rodrigo Vivi Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpu/drm/i915/display/intel_dp_mst.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/= i915/display/intel_dp_mst.c index 8d13d7b26a25..2a20487effcc 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -817,6 +817,7 @@ static struct drm_connector *intel_dp_add_mst_connector= (struct drm_dp_mst_topolo ret =3D drm_connector_init(dev, connector, &intel_dp_mst_connector_funcs, DRM_MODE_CONNECTOR_DisplayPort); if (ret) { + drm_dp_mst_put_port_malloc(port); intel_connector_free(intel_connector); return NULL; } --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25026C433EF for ; Tue, 19 Jul 2022 12:32:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240273AbiGSMcS (ORCPT ); Tue, 19 Jul 2022 08:32:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240110AbiGSMbr (ORCPT ); Tue, 19 Jul 2022 08:31: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 00FC06EE9F; Tue, 19 Jul 2022 05:12: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 AECE6B81B88; Tue, 19 Jul 2022 12:12:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1824CC341C6; Tue, 19 Jul 2022 12:11:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232719; bh=/foHS7/bjJySprsx0ogSWiKEnqYEL4JPTOYDgaRIPao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zMpGDTp2+vsFUIIYjc+fPRMxEPtArX/HnIBEv4M/GiXKeM4uuHszBnJ5vkdAMBNWd +lng+PN/zTyf4COZaQyRD6CyDEilso3BUsu0+diAl6Hg53+yKgbQSVfQeq8iyglpOd PvK1QfomU0aCel+FuEeGxxtJlo1So+gDEut2onkQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Huaxin Lu , Mimi Zohar , Sasha Levin Subject: [PATCH 5.15 041/167] ima: Fix a potential integer overflow in ima_appraise_measurement Date: Tue, 19 Jul 2022 13:52:53 +0200 Message-Id: <20220719114700.650088221@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Huaxin Lu [ Upstream commit d2ee2cfc4aa85ff6a2a3b198a3a524ec54e3d999 ] When the ima-modsig is enabled, the rc passed to evm_verifyxattr() may be negative, which may cause the integer overflow problem. Fixes: 39b07096364a ("ima: Implement support for module-style appended sign= atures") Signed-off-by: Huaxin Lu Signed-off-by: Mimi Zohar Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- security/integrity/ima/ima_appraise.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima= /ima_appraise.c index dbba51583e7c..ed04bb7c7512 100644 --- a/security/integrity/ima/ima_appraise.c +++ b/security/integrity/ima/ima_appraise.c @@ -408,7 +408,8 @@ int ima_appraise_measurement(enum ima_hooks func, goto out; } =20 - status =3D evm_verifyxattr(dentry, XATTR_NAME_IMA, xattr_value, rc, iint); + status =3D evm_verifyxattr(dentry, XATTR_NAME_IMA, xattr_value, + rc < 0 ? 0 : rc, iint); switch (status) { case INTEGRITY_PASS: case INTEGRITY_PASS_IMMUTABLE: --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 759CDC433EF for ; Tue, 19 Jul 2022 12:35:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235951AbiGSMft (ORCPT ); Tue, 19 Jul 2022 08:35:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241039AbiGSMej (ORCPT ); Tue, 19 Jul 2022 08:34: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 D671078227; Tue, 19 Jul 2022 05:13: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 4D98C617B2; Tue, 19 Jul 2022 12:13:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 047C3C341CA; Tue, 19 Jul 2022 12:13:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232808; bh=Barx2Y8O2CM+EyE0vQB8fSX0ZclonArxdW2xT3pYrpk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KX26O8RKwhPjVtSaqzuY0WE8vXrKKf3UEdoOhNOgOB/8ScCzjJLovERxEQhHy/5la IDxY3aK8hJLyAg34rjIbHu8S13AhbQX9RiXbEhdqnvzyoqOXIF2B6jyGyUXPI7hjRK 1uRIS3AkOCZLPcaCvbzYT5SswTbeB33DxlmI2ZlI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Francesco Dolcini , Fabio Estevam , Mark Brown , Sasha Levin Subject: [PATCH 5.15 042/167] ASoC: sgtl5000: Fix noise on shutdown/remove Date: Tue, 19 Jul 2022 13:52:54 +0200 Message-Id: <20220719114700.732586706@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Francesco Dolcini [ Upstream commit 040e3360af3736348112d29425bf5d0be5b93115 ] Put the SGTL5000 in a silent/safe state on shutdown/remove, this is required since the SGTL5000 produces a constant noise on its output after it is configured and its clock is removed. Without this change this is happening every time the module is unbound/removed or from reboot till the clock is enabled again. The issue was experienced on both a Toradex Colibri/Apalis iMX6, but can be easily reproduced everywhere just playing something on the codec and after that removing/unbinding the driver. Fixes: 9b34e6cc3bc2 ("ASoC: Add Freescale SGTL5000 codec support") Signed-off-by: Francesco Dolcini Reviewed-by: Fabio Estevam Link: https://lore.kernel.org/r/20220624101301.441314-1-francesco.dolcini@t= oradex.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/sgtl5000.c | 9 +++++++++ sound/soc/codecs/sgtl5000.h | 1 + 2 files changed, 10 insertions(+) diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index 97bf1f222805..dc56e6c6b668 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -1797,6 +1797,9 @@ static int sgtl5000_i2c_remove(struct i2c_client *cli= ent) { struct sgtl5000_priv *sgtl5000 =3D i2c_get_clientdata(client); =20 + regmap_write(sgtl5000->regmap, SGTL5000_CHIP_DIG_POWER, SGTL5000_DIG_POWE= R_DEFAULT); + regmap_write(sgtl5000->regmap, SGTL5000_CHIP_ANA_POWER, SGTL5000_ANA_POWE= R_DEFAULT); + clk_disable_unprepare(sgtl5000->mclk); regulator_bulk_disable(sgtl5000->num_supplies, sgtl5000->supplies); regulator_bulk_free(sgtl5000->num_supplies, sgtl5000->supplies); @@ -1804,6 +1807,11 @@ static int sgtl5000_i2c_remove(struct i2c_client *cl= ient) return 0; } =20 +static void sgtl5000_i2c_shutdown(struct i2c_client *client) +{ + sgtl5000_i2c_remove(client); +} + static const struct i2c_device_id sgtl5000_id[] =3D { {"sgtl5000", 0}, {}, @@ -1824,6 +1832,7 @@ static struct i2c_driver sgtl5000_i2c_driver =3D { }, .probe =3D sgtl5000_i2c_probe, .remove =3D sgtl5000_i2c_remove, + .shutdown =3D sgtl5000_i2c_shutdown, .id_table =3D sgtl5000_id, }; =20 diff --git a/sound/soc/codecs/sgtl5000.h b/sound/soc/codecs/sgtl5000.h index 56ec5863f250..3a808c762299 100644 --- a/sound/soc/codecs/sgtl5000.h +++ b/sound/soc/codecs/sgtl5000.h @@ -80,6 +80,7 @@ /* * SGTL5000_CHIP_DIG_POWER */ +#define SGTL5000_DIG_POWER_DEFAULT 0x0000 #define SGTL5000_ADC_EN 0x0040 #define SGTL5000_DAC_EN 0x0020 #define SGTL5000_DAP_POWERUP 0x0010 --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2882EC433EF for ; Tue, 19 Jul 2022 12:33:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240476AbiGSMdS (ORCPT ); Tue, 19 Jul 2022 08:33:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240423AbiGSMcp (ORCPT ); Tue, 19 Jul 2022 08:32: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 B28CC422E6; Tue, 19 Jul 2022 05:12: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 EB8786177E; Tue, 19 Jul 2022 12:12:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8005C341C6; Tue, 19 Jul 2022 12:12:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232745; bh=112p4IasrsPbPAFxru+Qf08e6ZUpipmetpaKg9UAZAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CoVoKgxix31PE+7rXInzaOMubQnRC17yWXgU3SZISDWDe63qzrfvcGYdyUHQU6jGh bMnbkIEh9Mq7YVy3HWUzCg+R4Ylt/bIlWroucR4WjhIUMZ7UhPe/G0+eLkwYiUOz/4 IQR6lGa+rFWFHOFqxLOAnV9X4mYEGtJhulHc/Eh8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Martin=20Povi=C5=A1er?= , Mark Brown , Sasha Levin Subject: [PATCH 5.15 043/167] ASoC: tas2764: Add post reset delays Date: Tue, 19 Jul 2022 13:52:55 +0200 Message-Id: <20220719114700.826107203@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Martin Povi=C5=A1er [ Upstream commit cd10bb89b0d57bca98eb75e0444854a1c129a14e ] Make sure there is at least 1 ms delay from reset to first command as is specified in the datasheet. This is a fix similar to commit 307f31452078 ("ASoC: tas2770: Insert post reset delay"). Fixes: 827ed8a0fa50 ("ASoC: tas2764: Add the driver for the TAS2764") Signed-off-by: Martin Povi=C5=A1er Link: https://lore.kernel.org/r/20220630075135.2221-1-povik+lin@cutebit.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/tas2764.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index 9265af41c235..edc66ff6dc49 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -42,10 +42,12 @@ static void tas2764_reset(struct tas2764_priv *tas2764) gpiod_set_value_cansleep(tas2764->reset_gpio, 0); msleep(20); gpiod_set_value_cansleep(tas2764->reset_gpio, 1); + usleep_range(1000, 2000); } =20 snd_soc_component_write(tas2764->component, TAS2764_SW_RST, TAS2764_RST); + usleep_range(1000, 2000); } =20 static int tas2764_set_bias_level(struct snd_soc_component *component, @@ -107,8 +109,10 @@ static int tas2764_codec_resume(struct snd_soc_compone= nt *component) struct tas2764_priv *tas2764 =3D snd_soc_component_get_drvdata(component); int ret; =20 - if (tas2764->sdz_gpio) + if (tas2764->sdz_gpio) { gpiod_set_value_cansleep(tas2764->sdz_gpio, 1); + usleep_range(1000, 2000); + } =20 ret =3D snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, TAS2764_PWR_CTRL_MASK, @@ -501,8 +505,10 @@ static int tas2764_codec_probe(struct snd_soc_componen= t *component) =20 tas2764->component =3D component; =20 - if (tas2764->sdz_gpio) + if (tas2764->sdz_gpio) { gpiod_set_value_cansleep(tas2764->sdz_gpio, 1); + usleep_range(1000, 2000); + } =20 tas2764_reset(tas2764); =20 --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8F0CC433EF for ; Tue, 19 Jul 2022 12:35:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240518AbiGSMfS (ORCPT ); Tue, 19 Jul 2022 08:35:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240490AbiGSMdy (ORCPT ); Tue, 19 Jul 2022 08:33: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 C0D0774DE7; Tue, 19 Jul 2022 05:12: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 484C2B81B1A; Tue, 19 Jul 2022 12:12:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6DEAC341C6; Tue, 19 Jul 2022 12:12:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232777; bh=ZG3776QSZuja70voJ1g0ymRaEyAfYER6qQIvzhPcQ40=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H1m2jRhYqx8wlhZjNezYZ0Ts3I/tRgz2WP46jf2NnEgZekW5TkPj6bvUstR+UOXAe atp9FF+c5nzIa28EigrWJNDYzdUS81QUDftqJbCWv77v9Trm2SVfoCWmrJR7Ujdl+3 qVTfmjsqKGBXPHv+w15KDu193msO7a4NWtCK/NSE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Martin=20Povi=C5=A1er?= , Mark Brown , Sasha Levin Subject: [PATCH 5.15 044/167] ASoC: tas2764: Fix and extend FSYNC polarity handling Date: Tue, 19 Jul 2022 13:52:56 +0200 Message-Id: <20220719114700.919550761@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Martin Povi=C5=A1er [ Upstream commit d1a10f1b48202e2d183cce144c218a211e98d906 ] Fix setting of FSYNC polarity in case of LEFT_J and DSP_A/B formats. Do NOT set the SCFG field as was previously done, because that is not correct and is also in conflict with the "ASI1 Source" control which sets the same SCFG field! Also add support for explicit polarity inversion. Fixes: 827ed8a0fa50 ("ASoC: tas2764: Add the driver for the TAS2764") Signed-off-by: Martin Povi=C5=A1er Link: https://lore.kernel.org/r/20220630075135.2221-2-povik+lin@cutebit.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/tas2764.c | 30 +++++++++++++++++------------- sound/soc/codecs/tas2764.h | 6 ++---- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index edc66ff6dc49..46c815650b2c 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -135,7 +135,8 @@ static const char * const tas2764_ASI1_src[] =3D { }; =20 static SOC_ENUM_SINGLE_DECL( - tas2764_ASI1_src_enum, TAS2764_TDM_CFG2, 4, tas2764_ASI1_src); + tas2764_ASI1_src_enum, TAS2764_TDM_CFG2, TAS2764_TDM_CFG2_SCFG_SHIFT, + tas2764_ASI1_src); =20 static const struct snd_kcontrol_new tas2764_asi1_mux =3D SOC_DAPM_ENUM("ASI1 Source", tas2764_ASI1_src_enum); @@ -333,20 +334,22 @@ static int tas2764_set_fmt(struct snd_soc_dai *dai, u= nsigned int fmt) { struct snd_soc_component *component =3D dai->component; struct tas2764_priv *tas2764 =3D snd_soc_component_get_drvdata(component); - u8 tdm_rx_start_slot =3D 0, asi_cfg_1 =3D 0; - int iface; + u8 tdm_rx_start_slot =3D 0, asi_cfg_0 =3D 0, asi_cfg_1 =3D 0; int ret; =20 switch (fmt & SND_SOC_DAIFMT_INV_MASK) { + case SND_SOC_DAIFMT_NB_IF: + asi_cfg_0 ^=3D TAS2764_TDM_CFG0_FRAME_START; + fallthrough; case SND_SOC_DAIFMT_NB_NF: asi_cfg_1 =3D TAS2764_TDM_CFG1_RX_RISING; break; + case SND_SOC_DAIFMT_IB_IF: + asi_cfg_0 ^=3D TAS2764_TDM_CFG0_FRAME_START; + fallthrough; case SND_SOC_DAIFMT_IB_NF: asi_cfg_1 =3D TAS2764_TDM_CFG1_RX_FALLING; break; - default: - dev_err(tas2764->dev, "ASI format Inverse is not found\n"); - return -EINVAL; } =20 ret =3D snd_soc_component_update_bits(component, TAS2764_TDM_CFG1, @@ -357,13 +360,13 @@ static int tas2764_set_fmt(struct snd_soc_dai *dai, u= nsigned int fmt) =20 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_I2S: + asi_cfg_0 ^=3D TAS2764_TDM_CFG0_FRAME_START; + fallthrough; case SND_SOC_DAIFMT_DSP_A: - iface =3D TAS2764_TDM_CFG2_SCFG_I2S; tdm_rx_start_slot =3D 1; break; case SND_SOC_DAIFMT_DSP_B: case SND_SOC_DAIFMT_LEFT_J: - iface =3D TAS2764_TDM_CFG2_SCFG_LEFT_J; tdm_rx_start_slot =3D 0; break; default: @@ -372,14 +375,15 @@ static int tas2764_set_fmt(struct snd_soc_dai *dai, u= nsigned int fmt) return -EINVAL; } =20 - ret =3D snd_soc_component_update_bits(component, TAS2764_TDM_CFG1, - TAS2764_TDM_CFG1_MASK, - (tdm_rx_start_slot << TAS2764_TDM_CFG1_51_SHIFT)); + ret =3D snd_soc_component_update_bits(component, TAS2764_TDM_CFG0, + TAS2764_TDM_CFG0_FRAME_START, + asi_cfg_0); if (ret < 0) return ret; =20 - ret =3D snd_soc_component_update_bits(component, TAS2764_TDM_CFG2, - TAS2764_TDM_CFG2_SCFG_MASK, iface); + ret =3D snd_soc_component_update_bits(component, TAS2764_TDM_CFG1, + TAS2764_TDM_CFG1_MASK, + (tdm_rx_start_slot << TAS2764_TDM_CFG1_51_SHIFT)); if (ret < 0) return ret; =20 diff --git a/sound/soc/codecs/tas2764.h b/sound/soc/codecs/tas2764.h index 67d6fd903c42..f015f22a083b 100644 --- a/sound/soc/codecs/tas2764.h +++ b/sound/soc/codecs/tas2764.h @@ -47,6 +47,7 @@ #define TAS2764_TDM_CFG0_MASK GENMASK(3, 1) #define TAS2764_TDM_CFG0_44_1_48KHZ BIT(3) #define TAS2764_TDM_CFG0_88_2_96KHZ (BIT(3) | BIT(1)) +#define TAS2764_TDM_CFG0_FRAME_START BIT(0) =20 /* TDM Configuration Reg1 */ #define TAS2764_TDM_CFG1 TAS2764_REG(0X0, 0x09) @@ -66,10 +67,7 @@ #define TAS2764_TDM_CFG2_RXS_16BITS 0x0 #define TAS2764_TDM_CFG2_RXS_24BITS BIT(0) #define TAS2764_TDM_CFG2_RXS_32BITS BIT(1) -#define TAS2764_TDM_CFG2_SCFG_MASK GENMASK(5, 4) -#define TAS2764_TDM_CFG2_SCFG_I2S 0x0 -#define TAS2764_TDM_CFG2_SCFG_LEFT_J BIT(4) -#define TAS2764_TDM_CFG2_SCFG_RIGHT_J BIT(5) +#define TAS2764_TDM_CFG2_SCFG_SHIFT 4 =20 /* TDM Configuration Reg3 */ #define TAS2764_TDM_CFG3 TAS2764_REG(0X0, 0x0c) --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3874DC433EF for ; Tue, 19 Jul 2022 12:35:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240588AbiGSMfe (ORCPT ); Tue, 19 Jul 2022 08:35:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240701AbiGSMeR (ORCPT ); Tue, 19 Jul 2022 08:34: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 5955D76EB0; Tue, 19 Jul 2022 05:13: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 BCB79B81B2C; Tue, 19 Jul 2022 12:13:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22CEEC341C6; Tue, 19 Jul 2022 12:13:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232788; bh=wrmeyo29Y2fleQVwAXQJxUKLpQE8RgfOI0r4Ukl5Vbs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zr5XeFcJGHvFXjP9kNXr4Am1XJVt6Y7oNRoKz+ns5xCsppPZ2kunavtVQornYMmrX rNfEnhYIvSZLgCqA809bwDDEJI+8rmczCJq3ztkiuSIleEgzofuHad7pOgHIHyrF0H n4xTNb2U6DPYWr/nY60jhkVb9OoE+lw+ECXRumuE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hector Martin , =?UTF-8?q?Martin=20Povi=C5=A1er?= , Mark Brown , Sasha Levin Subject: [PATCH 5.15 045/167] ASoC: tas2764: Correct playback volume range Date: Tue, 19 Jul 2022 13:52:57 +0200 Message-Id: <20220719114700.997546831@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hector Martin [ Upstream commit 3e99e5697e1f7120b5abc755e8a560b22612d6ed ] DVC value 0xc8 is -100dB and 0xc9 is mute; this needs to map to -100.5dB as far as the dB scale is concerned. Fix that and enable the mute flag, so alsamixer correctly shows the control as <0 dB .. -100 dB, mute>. Signed-off-by: Hector Martin Fixes: 827ed8a0fa50 ("ASoC: tas2764: Add the driver for the TAS2764") Signed-off-by: Martin Povi=C5=A1er Link: https://lore.kernel.org/r/20220630075135.2221-3-povik+lin@cutebit.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- 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 46c815650b2c..bd79bc7ecf6b 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -536,7 +536,7 @@ static int tas2764_codec_probe(struct snd_soc_component= *component) } =20 static DECLARE_TLV_DB_SCALE(tas2764_digital_tlv, 1100, 50, 0); -static DECLARE_TLV_DB_SCALE(tas2764_playback_volume, -10000, 50, 0); +static DECLARE_TLV_DB_SCALE(tas2764_playback_volume, -10050, 50, 1); =20 static const struct snd_kcontrol_new tas2764_snd_controls[] =3D { SOC_SINGLE_TLV("Speaker Volume", TAS2764_DVC, 0, --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9ACFC433EF for ; Tue, 19 Jul 2022 12:36:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240292AbiGSMg2 (ORCPT ); Tue, 19 Jul 2022 08:36:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239792AbiGSMfG (ORCPT ); Tue, 19 Jul 2022 08:35:06 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 184867A520; Tue, 19 Jul 2022 05:13: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 D4025CE1BE3; Tue, 19 Jul 2022 12:13:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E68F0C341C6; Tue, 19 Jul 2022 12:13:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232791; bh=krPBsNYKPzoOFgBFy5vJEFUAPdi761bW4QBFCNBjFy8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EnyMW80ze8IQknBsHDINR3VXIS8HgoVVMXqNhQmNECadVve5vWorA8OdnK3sHXPB5 uSTuTVb1/OqEQVSDlkIt+bVgpTuIXxoWHom1LQCgwhOi3CkFfybK0ue4N3ZvJL8FKZ IdQteQ3ik8biY9BCOLwKIaDDVoz0gKH6crX6oOcI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hector Martin , =?UTF-8?q?Martin=20Povi=C5=A1er?= , Mark Brown , Sasha Levin Subject: [PATCH 5.15 046/167] ASoC: tas2764: Fix amp gain register offset & default Date: Tue, 19 Jul 2022 13:52:58 +0200 Message-Id: <20220719114701.091733980@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hector Martin [ Upstream commit 1c4f29ec878bbf1cc0a1eb54ae7da5ff98e19641 ] The register default is 0x28 per the datasheet, and the amp gain field is supposed to be shifted left by one. With the wrong default, the ALSA controls lie about the power-up state. With the wrong shift, we get only half the gain we expect. Signed-off-by: Hector Martin Fixes: 827ed8a0fa50 ("ASoC: tas2764: Add the driver for the TAS2764") Signed-off-by: Martin Povi=C5=A1er Link: https://lore.kernel.org/r/20220630075135.2221-4-povik+lin@cutebit.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/tas2764.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index bd79bc7ecf6b..ec13ba01e522 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -541,7 +541,7 @@ static DECLARE_TLV_DB_SCALE(tas2764_playback_volume, -1= 0050, 50, 1); static const struct snd_kcontrol_new tas2764_snd_controls[] =3D { SOC_SINGLE_TLV("Speaker Volume", TAS2764_DVC, 0, TAS2764_DVC_MAX, 1, tas2764_playback_volume), - SOC_SINGLE_TLV("Amp Gain Volume", TAS2764_CHNL_0, 0, 0x14, 0, + SOC_SINGLE_TLV("Amp Gain Volume", TAS2764_CHNL_0, 1, 0x14, 0, tas2764_digital_tlv), }; =20 @@ -566,7 +566,7 @@ static const struct reg_default tas2764_reg_defaults[] = =3D { { TAS2764_SW_RST, 0x00 }, { TAS2764_PWR_CTRL, 0x1a }, { TAS2764_DVC, 0x00 }, - { TAS2764_CHNL_0, 0x00 }, + { TAS2764_CHNL_0, 0x28 }, { TAS2764_TDM_CFG0, 0x09 }, { TAS2764_TDM_CFG1, 0x02 }, { TAS2764_TDM_CFG2, 0x0a }, --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFAC5C433EF for ; Tue, 19 Jul 2022 12:35:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240616AbiGSMfn (ORCPT ); Tue, 19 Jul 2022 08:35:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240742AbiGSMeV (ORCPT ); Tue, 19 Jul 2022 08:34: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 5235152DEF; Tue, 19 Jul 2022 05:13: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 E42BB61746; Tue, 19 Jul 2022 12:13:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B286EC341C6; Tue, 19 Jul 2022 12:13:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232794; bh=FkxQq27PzF5NaA6kWWAEUDxOcIyX6K0RCapi1ALIcVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QmradP8PI8FaRCWmXX4KK7KJ3nIYTp2SaLU+M6jOLuwFdZx87Q09bNEQGLAV8GZ99 9OaMXfQDixDAYK9I9QvvCnq+VTCnj8ahBahYPZZXW0INjBX87tvQ3wr+UjGEs0I71k gF1j5Lp8Vol717M9fxgEuW4xLZEDcmlqjMcl4ysE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Ujfalusi , Cezary Rojewski , Mark Brown , Sasha Levin Subject: [PATCH 5.15 047/167] ASoC: Intel: Skylake: Correct the ssp rate discovery in skl_get_ssp_clks() Date: Tue, 19 Jul 2022 13:52:59 +0200 Message-Id: <20220719114701.186456416@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Ujfalusi [ Upstream commit 219af251bd1694bce1f627d238347d2eaf13de61 ] The present flag is only set once when one rate has been found to be saved. This will effectively going to ignore any rate discovered at later time and based on the code, this is not the intention. Fixes: bc2bd45b1f7f3 ("ASoC: Intel: Skylake: Parse nhlt and register clock = device") Signed-off-by: Peter Ujfalusi Reviewed-by: Cezary Rojewski Link: https://lore.kernel.org/r/20220630065638.11183-2-peter.ujfalusi@linux= .intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/intel/skylake/skl-nhlt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/intel/skylake/skl-nhlt.c b/sound/soc/intel/skylake/s= kl-nhlt.c index 64226072f0ee..cb02ec255728 100644 --- a/sound/soc/intel/skylake/skl-nhlt.c +++ b/sound/soc/intel/skylake/skl-nhlt.c @@ -201,7 +201,6 @@ static void skl_get_ssp_clks(struct skl_dev *skl, struc= t skl_ssp_clk *ssp_clks, struct nhlt_fmt_cfg *fmt_cfg; struct wav_fmt_ext *wav_fmt; unsigned long rate; - bool present =3D false; int rate_index =3D 0; u16 channels, bps; u8 clk_src; @@ -215,6 +214,8 @@ static void skl_get_ssp_clks(struct skl_dev *skl, struc= t skl_ssp_clk *ssp_clks, return; =20 for (i =3D 0; i < fmt->fmt_count; i++) { + bool present =3D false; + fmt_cfg =3D &fmt->fmt_config[i]; wav_fmt =3D &fmt_cfg->fmt_ext; =20 --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 651E2C433EF for ; Tue, 19 Jul 2022 12:36:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238176AbiGSMgz (ORCPT ); Tue, 19 Jul 2022 08:36:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240745AbiGSMgV (ORCPT ); Tue, 19 Jul 2022 08:36:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9BE179ECD; Tue, 19 Jul 2022 05:14: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 C8D28616F8; Tue, 19 Jul 2022 12:13:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9475C341C6; Tue, 19 Jul 2022 12:13:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232797; bh=2VpfmzO2i9ibqxokC7JLDiTparlUaunxAFDXgTG+bFM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mYPKU9vYqByVQX8UlyXZMy12GSy9zrp1eAM2CU/aVl2gPZuz1kxhVp6yqRpQ27f6F IQJXKHLyxbqSCGQ2eUG2aWhZ+RVCxmmk+747XIc1D6qoH8eIYE+WP7+Qp0xAPa5M+C w/kN2laDYWBSVzmoGF1h/eg7MuWDFXca/lpGi4To= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Ujfalusi , Cezary Rojewski , Mark Brown , Sasha Levin Subject: [PATCH 5.15 048/167] ASoC: Intel: Skylake: Correct the handling of fmt_config flexible array Date: Tue, 19 Jul 2022 13:53:00 +0200 Message-Id: <20220719114701.269629450@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Ujfalusi [ Upstream commit fc976f5629afb4160ee77798b14a693eac903ffd ] The struct nhlt_format's fmt_config is a flexible array, it must not be used as normal array. When moving to the next nhlt_fmt_cfg we need to take into account the data behind the ->config.caps (indicated by ->config.size). The logic of the code also changed: it is no longer saves the _last_ fmt_cfg for all found rates. Fixes: bc2bd45b1f7f3 ("ASoC: Intel: Skylake: Parse nhlt and register clock = device") Signed-off-by: Peter Ujfalusi Reviewed-by: Cezary Rojewski Link: https://lore.kernel.org/r/20220630065638.11183-3-peter.ujfalusi@linux= .intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/intel/skylake/skl-nhlt.c | 37 ++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/sound/soc/intel/skylake/skl-nhlt.c b/sound/soc/intel/skylake/s= kl-nhlt.c index cb02ec255728..74f60f5dfaef 100644 --- a/sound/soc/intel/skylake/skl-nhlt.c +++ b/sound/soc/intel/skylake/skl-nhlt.c @@ -213,11 +213,12 @@ static void skl_get_ssp_clks(struct skl_dev *skl, str= uct skl_ssp_clk *ssp_clks, if (fmt->fmt_count =3D=3D 0) return; =20 + fmt_cfg =3D (struct nhlt_fmt_cfg *)fmt->fmt_config; for (i =3D 0; i < fmt->fmt_count; i++) { + struct nhlt_fmt_cfg *saved_fmt_cfg =3D fmt_cfg; bool present =3D false; =20 - fmt_cfg =3D &fmt->fmt_config[i]; - wav_fmt =3D &fmt_cfg->fmt_ext; + wav_fmt =3D &saved_fmt_cfg->fmt_ext; =20 channels =3D wav_fmt->fmt.channels; bps =3D wav_fmt->fmt.bits_per_sample; @@ -235,12 +236,18 @@ static void skl_get_ssp_clks(struct skl_dev *skl, str= uct skl_ssp_clk *ssp_clks, * derive the rate. */ for (j =3D i; j < fmt->fmt_count; j++) { - fmt_cfg =3D &fmt->fmt_config[j]; - wav_fmt =3D &fmt_cfg->fmt_ext; + struct nhlt_fmt_cfg *tmp_fmt_cfg =3D fmt_cfg; + + wav_fmt =3D &tmp_fmt_cfg->fmt_ext; if ((fs =3D=3D wav_fmt->fmt.samples_per_sec) && - (bps =3D=3D wav_fmt->fmt.bits_per_sample)) + (bps =3D=3D wav_fmt->fmt.bits_per_sample)) { channels =3D max_t(u16, channels, wav_fmt->fmt.channels); + saved_fmt_cfg =3D tmp_fmt_cfg; + } + /* Move to the next nhlt_fmt_cfg */ + tmp_fmt_cfg =3D (struct nhlt_fmt_cfg *)(tmp_fmt_cfg->config.caps + + tmp_fmt_cfg->config.size); } =20 rate =3D channels * bps * fs; @@ -256,8 +263,11 @@ static void skl_get_ssp_clks(struct skl_dev *skl, stru= ct skl_ssp_clk *ssp_clks, =20 /* Fill rate and parent for sclk/sclkfs */ if (!present) { + struct nhlt_fmt_cfg *first_fmt_cfg; + + first_fmt_cfg =3D (struct nhlt_fmt_cfg *)fmt->fmt_config; i2s_config_ext =3D (struct skl_i2s_config_blob_ext *) - fmt->fmt_config[0].config.caps; + first_fmt_cfg->config.caps; =20 /* MCLK Divider Source Select */ if (is_legacy_blob(i2s_config_ext->hdr.sig)) { @@ -271,6 +281,9 @@ static void skl_get_ssp_clks(struct skl_dev *skl, struc= t skl_ssp_clk *ssp_clks, =20 parent =3D skl_get_parent_clk(clk_src); =20 + /* Move to the next nhlt_fmt_cfg */ + fmt_cfg =3D (struct nhlt_fmt_cfg *)(fmt_cfg->config.caps + + fmt_cfg->config.size); /* * Do not copy the config data if there is no parent * clock available for this clock source select @@ -279,9 +292,9 @@ static void skl_get_ssp_clks(struct skl_dev *skl, struc= t skl_ssp_clk *ssp_clks, continue; =20 sclk[id].rate_cfg[rate_index].rate =3D rate; - sclk[id].rate_cfg[rate_index].config =3D fmt_cfg; + sclk[id].rate_cfg[rate_index].config =3D saved_fmt_cfg; sclkfs[id].rate_cfg[rate_index].rate =3D rate; - sclkfs[id].rate_cfg[rate_index].config =3D fmt_cfg; + sclkfs[id].rate_cfg[rate_index].config =3D saved_fmt_cfg; sclk[id].parent_name =3D parent->name; sclkfs[id].parent_name =3D parent->name; =20 @@ -295,13 +308,13 @@ static void skl_get_mclk(struct skl_dev *skl, struct = skl_ssp_clk *mclk, { struct skl_i2s_config_blob_ext *i2s_config_ext; struct skl_i2s_config_blob_legacy *i2s_config; - struct nhlt_specific_cfg *fmt_cfg; + struct nhlt_fmt_cfg *fmt_cfg; struct skl_clk_parent_src *parent; u32 clkdiv, div_ratio; u8 clk_src; =20 - fmt_cfg =3D &fmt->fmt_config[0].config; - i2s_config_ext =3D (struct skl_i2s_config_blob_ext *)fmt_cfg->caps; + fmt_cfg =3D (struct nhlt_fmt_cfg *)fmt->fmt_config; + i2s_config_ext =3D (struct skl_i2s_config_blob_ext *)fmt_cfg->config.caps; =20 /* MCLK Divider Source Select and divider */ if (is_legacy_blob(i2s_config_ext->hdr.sig)) { @@ -330,7 +343,7 @@ static void skl_get_mclk(struct skl_dev *skl, struct sk= l_ssp_clk *mclk, return; =20 mclk[id].rate_cfg[0].rate =3D parent->rate/div_ratio; - mclk[id].rate_cfg[0].config =3D &fmt->fmt_config[0]; + mclk[id].rate_cfg[0].config =3D fmt_cfg; mclk[id].parent_name =3D parent->name; } =20 --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2FC3C433EF for ; Tue, 19 Jul 2022 12:36:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240605AbiGSMgd (ORCPT ); Tue, 19 Jul 2022 08:36:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240210AbiGSMfM (ORCPT ); Tue, 19 Jul 2022 08:35: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 043E77A52D; Tue, 19 Jul 2022 05:13: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 10F63B81B2E; Tue, 19 Jul 2022 12:13:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 745D8C341C6; Tue, 19 Jul 2022 12:13:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232799; bh=Mkvf0EX9t/n0RX1AyTZNR8hPmODfZOits7KU9Qsew+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WXbocjIN//zUUUeGVBOFjnCHpnaCLolKB3PMwjoP5D+L+zcEGy5M/FiDJ/PSVpCGo 6GT2+Lzhp+oewfyh1CSMCp+nZ9ZNe6GNHB9+0quJ38AR452JJH/Xy5kLEjNTgLvD+F OmsKYyrhCuFIPFPAXPZSsDGHjLPO5TlmLOFXCmfI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jon Hunter , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 049/167] net: stmmac: dwc-qos: Disable split header for Tegra194 Date: Tue, 19 Jul 2022 13:53:01 +0200 Message-Id: <20220719114701.360777010@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jon Hunter [ Upstream commit 029c1c2059e9c4b38f97a06204cdecd10cfbeb8a ] There is a long-standing issue with the Synopsys DWC Ethernet driver for Tegra194 where random system crashes have been observed [0]. The problem occurs when the split header feature is enabled in the stmmac driver. In the bad case, a larger than expected buffer length is received and causes the calculation of the total buffer length to overflow. This results in a very large buffer length that causes the kernel to crash. Why this larger buffer length is received is not clear, however, the feedback from the NVIDIA design team is that the split header feature is not supported for Tegra194. Therefore, disable split header support for Tegra194 to prevent these random crashes from occurring. [0] https://lore.kernel.org/linux-tegra/b0b17697-f23e-8fa5-3757-604a86f3a09= 5@nvidia.com/ Fixes: 67afd6d1cfdf ("net: stmmac: Add Split Header support and enable it i= n XGMAC cores") Signed-off-by: Jon Hunter Link: https://lore.kernel.org/r/20220706083913.13750-1-jonathanh@nvidia.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/driv= ers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c index bc91fd867dcd..358fc26f8d1f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c @@ -361,6 +361,7 @@ static int tegra_eqos_probe(struct platform_device *pde= v, data->fix_mac_speed =3D tegra_eqos_fix_speed; data->init =3D tegra_eqos_init; data->bsp_priv =3D eqos; + data->sph_disable =3D 1; =20 err =3D tegra_eqos_init(pdev, eqos); if (err < 0) --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AE25CCA47F for ; Tue, 19 Jul 2022 12:37:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240570AbiGSMhF (ORCPT ); Tue, 19 Jul 2022 08:37:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238347AbiGSMgW (ORCPT ); Tue, 19 Jul 2022 08:36:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23E3F1EAFB; Tue, 19 Jul 2022 05:14: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 13B6BB81B37; Tue, 19 Jul 2022 12:13:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56BB3C341C6; Tue, 19 Jul 2022 12:13:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232802; bh=EuBfvooEShle36Ymb8/NN7rUAZS38Mpq4oSHSzKHNew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gCn9sPY68SwzIGk+0WUOzNO8wgS6YXgI+A4QR9TX9M/D4liwpChr9gmqS4oqmwqLc SnqKocrZ+jSw/xeBpTQgR9zvkoRB30tkc8s0K2fUePtQXNzxf8barrWRTCM+vkFU6R 5n2VIcbNJdfpOn2ce0IZRsl0xxKxM90cgrcIHOag= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Siddharth Vadapalli , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 050/167] net: ethernet: ti: am65-cpsw: Fix devlink port register sequence Date: Tue, 19 Jul 2022 13:53:02 +0200 Message-Id: <20220719114701.456218440@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Siddharth Vadapalli [ Upstream commit 0680e20af5fbf41df8a11b11bd9a7c25b2ca0746 ] Renaming interfaces using udevd depends on the interface being registered before its netdev is registered. Otherwise, udevd reads an empty phys_port_name value, resulting in the interface not being renamed. Fix this by registering the interface before registering its netdev by invoking am65_cpsw_nuss_register_devlink() before invoking register_netdev() for the interface. Move the function call to devlink_port_type_eth_set(), invoking it after register_netdev() is invoked, to ensure that netlink notification for the port state change is generated after the netdev is completely initialized. Fixes: 58356eb31d60 ("net: ti: am65-cpsw-nuss: Add devlink support") Signed-off-by: Siddharth Vadapalli Link: https://lore.kernel.org/r/20220706070208.12207-1-s-vadapalli@ti.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/etherne= t/ti/am65-cpsw-nuss.c index ea9d073e87fa..901571c2626a 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -2467,7 +2467,6 @@ static int am65_cpsw_nuss_register_devlink(struct am6= 5_cpsw_common *common) port->port_id, ret); goto dl_port_unreg; } - devlink_port_type_eth_set(dl_port, port->ndev); } =20 return ret; @@ -2514,6 +2513,7 @@ static void am65_cpsw_unregister_devlink(struct am65_= cpsw_common *common) static int am65_cpsw_nuss_register_ndevs(struct am65_cpsw_common *common) { struct device *dev =3D common->dev; + struct devlink_port *dl_port; struct am65_cpsw_port *port; int ret =3D 0, i; =20 @@ -2530,6 +2530,10 @@ static int am65_cpsw_nuss_register_ndevs(struct am65= _cpsw_common *common) return ret; } =20 + ret =3D am65_cpsw_nuss_register_devlink(common); + if (ret) + return ret; + for (i =3D 0; i < common->port_num; i++) { port =3D &common->ports[i]; =20 @@ -2542,25 +2546,24 @@ static int am65_cpsw_nuss_register_ndevs(struct am6= 5_cpsw_common *common) i, ret); goto err_cleanup_ndev; } + + dl_port =3D &port->devlink_port; + devlink_port_type_eth_set(dl_port, port->ndev); } =20 ret =3D am65_cpsw_register_notifiers(common); if (ret) goto err_cleanup_ndev; =20 - ret =3D am65_cpsw_nuss_register_devlink(common); - if (ret) - goto clean_unregister_notifiers; - /* can't auto unregister ndev using devm_add_action() due to * devres release sequence in DD core for DMA */ =20 return 0; -clean_unregister_notifiers: - am65_cpsw_unregister_notifiers(common); + err_cleanup_ndev: am65_cpsw_nuss_cleanup_ndev(common); + am65_cpsw_unregister_devlink(common); =20 return ret; } --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5981AC43334 for ; Tue, 19 Jul 2022 12:36:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240857AbiGSMgv (ORCPT ); Tue, 19 Jul 2022 08:36:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240706AbiGSMgI (ORCPT ); Tue, 19 Jul 2022 08:36:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B964D7AC14; Tue, 19 Jul 2022 05:14: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 56F7761772; Tue, 19 Jul 2022 12:13:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34269C341C6; Tue, 19 Jul 2022 12:13:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232805; bh=nZL5sHt4z6CkfvITyzjGV+EKz5h652UKzG19cc6+3GU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jjcwpSkIy4ikk3UsvmxNjHXFy1AR+Xu91RQqtWGWKfM/FJuccMuRK2FK7UfqCEDuW 5byMWaL7jisTcSC6oSQIrNgYlccokjpXFQCqGNyrdLdZFbRr15mT+1i3KSzmUtX3sq bbXanOYyfKgDMN/XATcDswqvgCV/guDAEH/QJFUY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 051/167] sysctl: Fix data races in proc_dointvec(). Date: Tue, 19 Jul 2022 13:53:03 +0200 Message-Id: <20220719114701.539279926@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 1f1be04b4d48a2475ea1aab46a99221bfc5c0968 ] A sysctl variable is accessed concurrently, and there is always a chance of data-race. So, all readers and writers need some basic protection to avoid load/store-tearing. This patch changes proc_dointvec() to use READ_ONCE() and WRITE_ONCE() internally to fix data-races on the sysctl side. For now, proc_dointvec() itself is tolerant to a data-race, but we still need to add annotations on the other subsystem's side. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- kernel/sysctl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 0586047f7323..11f0714273ab 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -566,14 +566,14 @@ static int do_proc_dointvec_conv(bool *negp, unsigned= long *lvalp, if (*negp) { if (*lvalp > (unsigned long) INT_MAX + 1) return -EINVAL; - *valp =3D -*lvalp; + WRITE_ONCE(*valp, -*lvalp); } else { if (*lvalp > (unsigned long) INT_MAX) return -EINVAL; - *valp =3D *lvalp; + WRITE_ONCE(*valp, *lvalp); } } else { - int val =3D *valp; + int val =3D READ_ONCE(*valp); if (val < 0) { *negp =3D true; *lvalp =3D -(unsigned long)val; --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89C42C43334 for ; Tue, 19 Jul 2022 12:33:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240456AbiGSMdX (ORCPT ); Tue, 19 Jul 2022 08:33:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240478AbiGSMcr (ORCPT ); Tue, 19 Jul 2022 08:32: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 25ABC71BED; Tue, 19 Jul 2022 05:12: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 59E80B81B29; Tue, 19 Jul 2022 12:12:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AAE7FC341C6; Tue, 19 Jul 2022 12:12:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232748; bh=vPnNpgGDRGI+DMe2OVtqxPOGDsBg1fdz9d8mtoBzC5Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HrHiKtdplgnWLvllklZbbsUfqpmqlG/VtRwcgZvvYiVhGJrDNoZQ65zhS86DPZy3y 7VaJXjcfv/0+Sc8gaYOQGx6EO0Wgcz6IsiPj9j8q0WKzYMmg3SUZjiatHlCGzFyhds WyMbVIEc0KWdntig3e/+2Ni/zow7r606weWElhu8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 052/167] sysctl: Fix data races in proc_douintvec(). Date: Tue, 19 Jul 2022 13:53:04 +0200 Message-Id: <20220719114701.622278611@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 4762b532ec9539755aab61445d5da6e1926ccb99 ] A sysctl variable is accessed concurrently, and there is always a chance of data-race. So, all readers and writers need some basic protection to avoid load/store-tearing. This patch changes proc_douintvec() to use READ_ONCE() and WRITE_ONCE() internally to fix data-races on the sysctl side. For now, proc_douintvec() itself is tolerant to a data-race, but we still need to add annotations on the other subsystem's side. Fixes: e7d316a02f68 ("sysctl: handle error writing UINT_MAX to u32 fields") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- kernel/sysctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 11f0714273ab..b152e0a30a2b 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -592,9 +592,9 @@ static int do_proc_douintvec_conv(unsigned long *lvalp, if (write) { if (*lvalp > UINT_MAX) return -EINVAL; - *valp =3D *lvalp; + WRITE_ONCE(*valp, *lvalp); } else { - unsigned int val =3D *valp; + unsigned int val =3D READ_ONCE(*valp); *lvalp =3D (unsigned long)val; } return 0; --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 778D8C433EF for ; Tue, 19 Jul 2022 12:35:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240602AbiGSMfk (ORCPT ); Tue, 19 Jul 2022 08:35:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240727AbiGSMeS (ORCPT ); Tue, 19 Jul 2022 08:34:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C70F077485; Tue, 19 Jul 2022 05:13: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 C281361632; Tue, 19 Jul 2022 12:12:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D752C341C6; Tue, 19 Jul 2022 12:12:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232750; bh=+9weaKiei4UsraWdur+ff2fnOPti+6SBDkR3LPIm2S0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fPv6z+jwJqQWOo6Az6sIo49djJKl5F5+FrFCXVK9MG0ua7zWK2mHBnTlmrZwHrATA tntTPQyeVBCm/Ik7V83hBcNEKlzBxXqUj/ASqYfc1ycQUHrGta95+PIpBmg3lKm74F 37Q20S88sVL/+IPZTI4Xo9kChvPXCy5IM+5+B82U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 053/167] sysctl: Fix data races in proc_dointvec_minmax(). Date: Tue, 19 Jul 2022 13:53:05 +0200 Message-Id: <20220719114701.722734928@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit f613d86d014b6375a4085901de39406598121e35 ] A sysctl variable is accessed concurrently, and there is always a chance of data-race. So, all readers and writers need some basic protection to avoid load/store-tearing. This patch changes proc_dointvec_minmax() to use READ_ONCE() and WRITE_ONCE() internally to fix data-races on the sysctl side. For now, proc_dointvec_minmax() itself is tolerant to a data-race, but we still need to add annotations on the other subsystem's side. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- kernel/sysctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index b152e0a30a2b..f5134435fb9c 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -988,7 +988,7 @@ static int do_proc_dointvec_minmax_conv(bool *negp, uns= igned long *lvalp, if ((param->min && *param->min > tmp) || (param->max && *param->max < tmp)) return -EINVAL; - *valp =3D tmp; + WRITE_ONCE(*valp, tmp); } =20 return 0; --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A5C1CCA47F for ; Tue, 19 Jul 2022 12:34:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233786AbiGSMd6 (ORCPT ); Tue, 19 Jul 2022 08:33:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229895AbiGSMdg (ORCPT ); Tue, 19 Jul 2022 08:33: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 12FAD74352; Tue, 19 Jul 2022 05:12: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 F1F39B81B2E; Tue, 19 Jul 2022 12:12:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B2E0C341C6; Tue, 19 Jul 2022 12:12:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232753; bh=hp4iin0PTP+2zTw2MAqvOW+ekXvrgDUOAATJ+9LIhGU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lSKhiI3QQR9+ciljRJXO8iEL274lC+8HEwJwxIBUFSd3FaeClqAXfCDjgZRdlbegE 3ibMuyYut88AXOEQktWDm11GxD+YVh5tBZkphzlApYKSjJC31uL02jckkIKtJVX4+d BG6pgmMvsPJcxbnOGgE6lMr9KG3ejwBU65vhRMPU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 054/167] sysctl: Fix data races in proc_douintvec_minmax(). Date: Tue, 19 Jul 2022 13:53:06 +0200 Message-Id: <20220719114701.818311053@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 2d3b559df3ed39258737789aae2ae7973d205bc1 ] A sysctl variable is accessed concurrently, and there is always a chance of data-race. So, all readers and writers need some basic protection to avoid load/store-tearing. This patch changes proc_douintvec_minmax() to use READ_ONCE() and WRITE_ONCE() internally to fix data-races on the sysctl side. For now, proc_douintvec_minmax() itself is tolerant to a data-race, but we still need to add annotations on the other subsystem's side. Fixes: 61d9b56a8920 ("sysctl: add unsigned int range support") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- kernel/sysctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index f5134435fb9c..bdb2f17b723f 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1054,7 +1054,7 @@ static int do_proc_douintvec_minmax_conv(unsigned lon= g *lvalp, (param->max && *param->max < tmp)) return -ERANGE; =20 - *valp =3D tmp; + WRITE_ONCE(*valp, tmp); } =20 return 0; --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BFE6C433EF for ; Tue, 19 Jul 2022 12:33:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240416AbiGSMdm (ORCPT ); Tue, 19 Jul 2022 08:33:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233786AbiGSMdI (ORCPT ); Tue, 19 Jul 2022 08:33: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 6BEDB7358B; Tue, 19 Jul 2022 05:12: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 C54FFB81B1A; Tue, 19 Jul 2022 12:12:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35156C341CF; Tue, 19 Jul 2022 12:12:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232756; bh=E2/fWrdznifDX8AkHMSJOC4G5mDAciLTGgAmMjUvb4c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nyx8t9VmFbuyJGBbeOO/xOLBqO1wFm3pTC943WfiaZlDnua5/g+1Zx4fcbCNiyBu5 NLx/U3tuiQ+tehUa70yeGHbl3cpPDdZc9PEELpsTmx1eKYpeyP6irz7zI/2Vw8+cID 1bbno/eLdlfCm9VBIL1iFXK5HXyKjMIsYtRoFr7o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 055/167] sysctl: Fix data races in proc_doulongvec_minmax(). Date: Tue, 19 Jul 2022 13:53:07 +0200 Message-Id: <20220719114701.918591935@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit c31bcc8fb89fc2812663900589c6325ba35d9a65 ] A sysctl variable is accessed concurrently, and there is always a chance of data-race. So, all readers and writers need some basic protection to avoid load/store-tearing. This patch changes proc_doulongvec_minmax() to use READ_ONCE() and WRITE_ONCE() internally to fix data-races on the sysctl side. For now, proc_doulongvec_minmax() itself is tolerant to a data-race, but we still need to add annotations on the other subsystem's side. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- kernel/sysctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index bdb2f17b723f..9a68da5e1551 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1281,9 +1281,9 @@ static int __do_proc_doulongvec_minmax(void *data, st= ruct ctl_table *table, err =3D -EINVAL; break; } - *i =3D val; + WRITE_ONCE(*i, val); } else { - val =3D convdiv * (*i) / convmul; + val =3D convdiv * READ_ONCE(*i) / convmul; if (!first) proc_put_char(&buffer, &left, '\t'); proc_put_long(&buffer, &left, val, false); --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0DBDC43334 for ; Tue, 19 Jul 2022 12:35:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240626AbiGSMfq (ORCPT ); Tue, 19 Jul 2022 08:35:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240879AbiGSMe2 (ORCPT ); Tue, 19 Jul 2022 08:34:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B97C052E54; Tue, 19 Jul 2022 05:13: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 B152FB81B29; Tue, 19 Jul 2022 12:12:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20602C341C6; Tue, 19 Jul 2022 12:12:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232759; bh=YOsoEXANQfVJmAisooZnQToiVBtWY4IDvfItt/4IiOg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MKjsg8G/6l9ZuE8bLDgtUrhCBvWKYWvRpLQ/gQIUYcSs+PYQHhzvsW+R6RM5ISVuP VT/aNdgh3kpXez2XLexOFTpBTZXC3myw4L4ZAH1EwSueh0L4C/LlDSy8nLX4pR/25b ROwcME0zLeG36AVnrPitNY+CLjS5CqPSyv2trlsM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 056/167] sysctl: Fix data races in proc_dointvec_jiffies(). Date: Tue, 19 Jul 2022 13:53:08 +0200 Message-Id: <20220719114702.012706315@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit e877820877663fbae8cb9582ea597a7230b94df3 ] A sysctl variable is accessed concurrently, and there is always a chance of data-race. So, all readers and writers need some basic protection to avoid load/store-tearing. This patch changes proc_dointvec_jiffies() to use READ_ONCE() and WRITE_ONCE() internally to fix data-races on the sysctl side. For now, proc_dointvec_jiffies() itself is tolerant to a data-race, but we still need to add annotations on the other subsystem's side. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- kernel/sysctl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 9a68da5e1551..5be8108a9a45 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1364,9 +1364,12 @@ static int do_proc_dointvec_jiffies_conv(bool *negp,= unsigned long *lvalp, if (write) { if (*lvalp > INT_MAX / HZ) return 1; - *valp =3D *negp ? -(*lvalp*HZ) : (*lvalp*HZ); + if (*negp) + WRITE_ONCE(*valp, -*lvalp * HZ); + else + WRITE_ONCE(*valp, *lvalp * HZ); } else { - int val =3D *valp; + int val =3D READ_ONCE(*valp); unsigned long lval; if (val < 0) { *negp =3D true; --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BB9FC433EF for ; Tue, 19 Jul 2022 12:35:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240125AbiGSMeC (ORCPT ); Tue, 19 Jul 2022 08:34:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240528AbiGSMdj (ORCPT ); Tue, 19 Jul 2022 08:33: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 99D327437C; Tue, 19 Jul 2022 05:12:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CC05BB81B37; Tue, 19 Jul 2022 12:12:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 093CFC341CB; Tue, 19 Jul 2022 12:12:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232762; bh=uDVLLxkXPiMhiY0PAVhuAdSMACq0+7ue/cKDjvPRFt0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aeNio9G0ZifNuP3zbFBWeFOBWG6ZdBLKx/2GRwpLQeARFK9hH/vEi0dB/JIY8lgnT uLmmWcqWc3bu71Tfr1k3mQcV2LShXUYjG8UGLFSeSWfUo/8W9ufu+4Nac6jvSi8Vte ys8GHO0MoKQhY2J5qUKYne0+DQoiqFZlg6yKX5fw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 057/167] tcp: Fix a data-race around sysctl_tcp_max_orphans. Date: Tue, 19 Jul 2022 13:53:09 +0200 Message-Id: <20220719114702.095045330@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 47e6ab24e8c6e3ca10ceb5835413f401f90de4bf ] While reading sysctl_tcp_max_orphans, it can be changed concurrently. So, we need to add READ_ONCE() to avoid a data-race. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv4/tcp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index f79b5a98888c..4ac53c8f0583 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -2714,7 +2714,8 @@ static void tcp_orphan_update(struct timer_list *unus= ed) =20 static bool tcp_too_many_orphans(int shift) { - return READ_ONCE(tcp_orphan_cache) << shift > sysctl_tcp_max_orphans; + return READ_ONCE(tcp_orphan_cache) << shift > + READ_ONCE(sysctl_tcp_max_orphans); } =20 bool tcp_check_oom(struct sock *sk, int shift) --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDC61CCA47F for ; Tue, 19 Jul 2022 12:35:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238231AbiGSMfI (ORCPT ); Tue, 19 Jul 2022 08:35:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240435AbiGSMdr (ORCPT ); Tue, 19 Jul 2022 08:33: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 3572952DD6; Tue, 19 Jul 2022 05:12: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 546D3617B2; Tue, 19 Jul 2022 12:12:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 216D3C341C6; Tue, 19 Jul 2022 12:12:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232765; bh=wB6wc6y/Dtx3NEjnGvFvSrVcgCQ3JRyJxsff8TxVPik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GqZG01IG/QqNnmGvT3G5S+qayFGZ2rDHO77Cuv3tCXUaVSLGIibyJdETON+YhRsEX /QkKp3eQF0qCLWPCh8HnkHaxzfIzjgLEXMcRQey9wBDLXe2RpY7DELQswsr1fMz/uV wC08wy2fd8KoepETEWPoqgMvkMxtVbf+NziO96cs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 058/167] inetpeer: Fix data-races around sysctl. Date: Tue, 19 Jul 2022 13:53:10 +0200 Message-Id: <20220719114702.179963698@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 3d32edf1f3c38d3301f6434e56316f293466d7fb ] While reading inetpeer sysctl variables, they can be changed concurrently. So, we need to add READ_ONCE() to avoid data-races. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv4/inetpeer.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c index da21dfce24d7..e9fed83e9b3c 100644 --- a/net/ipv4/inetpeer.c +++ b/net/ipv4/inetpeer.c @@ -141,16 +141,20 @@ static void inet_peer_gc(struct inet_peer_base *base, struct inet_peer *gc_stack[], unsigned int gc_cnt) { + int peer_threshold, peer_maxttl, peer_minttl; struct inet_peer *p; __u32 delta, ttl; int i; =20 - if (base->total >=3D inet_peer_threshold) + peer_threshold =3D READ_ONCE(inet_peer_threshold); + peer_maxttl =3D READ_ONCE(inet_peer_maxttl); + peer_minttl =3D READ_ONCE(inet_peer_minttl); + + if (base->total >=3D peer_threshold) ttl =3D 0; /* be aggressive */ else - ttl =3D inet_peer_maxttl - - (inet_peer_maxttl - inet_peer_minttl) / HZ * - base->total / inet_peer_threshold * HZ; + ttl =3D peer_maxttl - (peer_maxttl - peer_minttl) / HZ * + base->total / peer_threshold * HZ; for (i =3D 0; i < gc_cnt; i++) { p =3D gc_stack[i]; =20 --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4903ECCA47F for ; Tue, 19 Jul 2022 12:35:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240440AbiGSMfP (ORCPT ); Tue, 19 Jul 2022 08:35:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237680AbiGSMdw (ORCPT ); Tue, 19 Jul 2022 08:33: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 D6DD774DCB; Tue, 19 Jul 2022 05:12: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 29E0B617D7; Tue, 19 Jul 2022 12:12:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE751C341C6; Tue, 19 Jul 2022 12:12:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232768; bh=iGY6+4NQhgxeOQ6cZCMCN2ShvVFXM5f2V4BRGzzkiAc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xMTJdSF14IAZmf75tkqFsK2EnnaNTbo/geDJ7ehBWc4/gRVB6s//YwVnGtB4lPSH+ y4iTsDZL5OIX/UxHDNSVmxEjLYeK4WYtkQxIJBRPSNuXCOtoOE6TBsDTGjP4QZXmVK 7XR6cfWIsCQFreHgVm9s/9Jd+8eKj59AjYhdSIQ0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 059/167] net: Fix data-races around sysctl_mem. Date: Tue, 19 Jul 2022 13:53:11 +0200 Message-Id: <20220719114702.270186209@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 310731e2f1611d1d13aae237abcf8e66d33345d5 ] While reading .sysctl_mem, it can be changed concurrently. So, we need to add READ_ONCE() to avoid data-races. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- include/net/sock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/sock.h b/include/net/sock.h index 7d49196a3880..96f51d4b1649 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1484,7 +1484,7 @@ void __sk_mem_reclaim(struct sock *sk, int amount); /* sysctl_mem values are in pages, we convert them in SK_MEM_QUANTUM units= */ static inline long sk_prot_mem_limits(const struct sock *sk, int index) { - long val =3D sk->sk_prot->sysctl_mem[index]; + long val =3D READ_ONCE(sk->sk_prot->sysctl_mem[index]); =20 #if PAGE_SIZE > SK_MEM_QUANTUM val <<=3D PAGE_SHIFT - SK_MEM_QUANTUM_SHIFT; --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01458CCA47F for ; Tue, 19 Jul 2022 12:35:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240546AbiGSMfZ (ORCPT ); Tue, 19 Jul 2022 08:35:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240072AbiGSMeB (ORCPT ); Tue, 19 Jul 2022 08:34: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 77E0B74E23; Tue, 19 Jul 2022 05:13: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 5951EB81B21; Tue, 19 Jul 2022 12:12:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF730C341C6; Tue, 19 Jul 2022 12:12:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232771; bh=vz8b6Y3iJObDY9DmYGskF8gnjkCaz7SxCMYy6u0RLwU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pJkl0OwzsFD9TWlBCRW9g7ODNIdWrbjZLnrB2q1hU2MpiQUzXnaTRZ7CvhLD2tJdH BHvDjckEUinaVpngar1KF6jELV1akmkNL2qVl+LHI8ebaZ3PZqMJ65s18rEM2Rydrr 5060AsY7eCcxSMJdj8SBAXgTPoWCrLU34oV9KWTI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , Paul Moore , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 060/167] cipso: Fix data-races around sysctl. Date: Tue, 19 Jul 2022 13:53:12 +0200 Message-Id: <20220719114702.365938192@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit dd44f04b9214adb68ef5684ae87a81ba03632250 ] While reading cipso sysctl variables, they can be changed concurrently. So, we need to add READ_ONCE() to avoid data-races. Fixes: 446fda4f2682 ("[NetLabel]: CIPSOv4 engine") Signed-off-by: Kuniyuki Iwashima Acked-by: Paul Moore Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- Documentation/networking/ip-sysctl.rst | 2 +- net/ipv4/cipso_ipv4.c | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Documentation/networking/ip-sysctl.rst b/Documentation/network= ing/ip-sysctl.rst index d91ab28718d4..8d772484755a 100644 --- a/Documentation/networking/ip-sysctl.rst +++ b/Documentation/networking/ip-sysctl.rst @@ -1063,7 +1063,7 @@ cipso_cache_enable - BOOLEAN cipso_cache_bucket_size - INTEGER The CIPSO label cache consists of a fixed size hash table with each hash bucket containing a number of cache entries. This variable limits - the number of entries in each hash bucket; the larger the value the + the number of entries in each hash bucket; the larger the value is, the more CIPSO label mappings that can be cached. When the number of entries in a given hash bucket reaches this limit adding new entries causes the oldest entry in the bucket to be removed to make room. diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c index 099259fc826a..75ac14525344 100644 --- a/net/ipv4/cipso_ipv4.c +++ b/net/ipv4/cipso_ipv4.c @@ -239,7 +239,7 @@ static int cipso_v4_cache_check(const unsigned char *ke= y, struct cipso_v4_map_cache_entry *prev_entry =3D NULL; u32 hash; =20 - if (!cipso_v4_cache_enabled) + if (!READ_ONCE(cipso_v4_cache_enabled)) return -ENOENT; =20 hash =3D cipso_v4_map_cache_hash(key, key_len); @@ -296,13 +296,14 @@ static int cipso_v4_cache_check(const unsigned char *= key, int cipso_v4_cache_add(const unsigned char *cipso_ptr, const struct netlbl_lsm_secattr *secattr) { + int bkt_size =3D READ_ONCE(cipso_v4_cache_bucketsize); int ret_val =3D -EPERM; u32 bkt; struct cipso_v4_map_cache_entry *entry =3D NULL; struct cipso_v4_map_cache_entry *old_entry =3D NULL; u32 cipso_ptr_len; =20 - if (!cipso_v4_cache_enabled || cipso_v4_cache_bucketsize <=3D 0) + if (!READ_ONCE(cipso_v4_cache_enabled) || bkt_size <=3D 0) return 0; =20 cipso_ptr_len =3D cipso_ptr[1]; @@ -322,7 +323,7 @@ int cipso_v4_cache_add(const unsigned char *cipso_ptr, =20 bkt =3D entry->hash & (CIPSO_V4_CACHE_BUCKETS - 1); spin_lock_bh(&cipso_v4_cache[bkt].lock); - if (cipso_v4_cache[bkt].size < cipso_v4_cache_bucketsize) { + if (cipso_v4_cache[bkt].size < bkt_size) { list_add(&entry->list, &cipso_v4_cache[bkt].list); cipso_v4_cache[bkt].size +=3D 1; } else { @@ -1199,7 +1200,8 @@ static int cipso_v4_gentag_rbm(const struct cipso_v4_= doi *doi_def, /* This will send packets using the "optimized" format when * possible as specified in section 3.4.2.6 of the * CIPSO draft. */ - if (cipso_v4_rbm_optfmt && ret_val > 0 && ret_val <=3D 10) + if (READ_ONCE(cipso_v4_rbm_optfmt) && ret_val > 0 && + ret_val <=3D 10) tag_len =3D 14; else tag_len =3D 4 + ret_val; @@ -1603,7 +1605,7 @@ int cipso_v4_validate(const struct sk_buff *skb, unsi= gned char **option) * all the CIPSO validations here but it doesn't * really specify _exactly_ what we need to validate * ... so, just make it a sysctl tunable. */ - if (cipso_v4_rbm_strictvalid) { + if (READ_ONCE(cipso_v4_rbm_strictvalid)) { if (cipso_v4_map_lvl_valid(doi_def, tag[3]) < 0) { err_offset =3D opt_iter + 3; --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70A57C43334 for ; Tue, 19 Jul 2022 12:35:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240663AbiGSMf5 (ORCPT ); Tue, 19 Jul 2022 08:35:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241081AbiGSMep (ORCPT ); Tue, 19 Jul 2022 08:34:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 045B578DC2; Tue, 19 Jul 2022 05:13:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E785E61790; Tue, 19 Jul 2022 12:12:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4E56C341C6; Tue, 19 Jul 2022 12:12:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232774; bh=JMzByYwmqt8aRAvGvxSwJj3owa5cmGDyxPmX35MHwYs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fyjutX8H+joDAuQu/+6W59cKKS8Een6MwoxaI1cSR202W4h01+z8cqySyD01HBbvm apL2uBexH3lE5AceCpGi5yd1pgDOandZ6I6lDfAL8xFGZ8cIcLHGJXjOiQTF92QP2c WeGBiHVSYnkoqcNQDENRGc9ziZI6cPgXdAr5qn9M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 061/167] icmp: Fix data-races around sysctl. Date: Tue, 19 Jul 2022 13:53:13 +0200 Message-Id: <20220719114702.459194709@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 48d7ee321ea5182c6a70782aa186422a70e67e22 ] While reading icmp sysctl variables, they can be changed concurrently. So, we need to add READ_ONCE() to avoid data-races. Fixes: 4cdf507d5452 ("icmp: add a global rate limitation") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv4/icmp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index b7e277d8a84d..b5766b62ca97 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -261,11 +261,12 @@ bool icmp_global_allow(void) spin_lock(&icmp_global.lock); delta =3D min_t(u32, now - icmp_global.stamp, HZ); if (delta >=3D HZ / 50) { - incr =3D sysctl_icmp_msgs_per_sec * delta / HZ ; + incr =3D READ_ONCE(sysctl_icmp_msgs_per_sec) * delta / HZ; if (incr) WRITE_ONCE(icmp_global.stamp, now); } - credit =3D min_t(u32, icmp_global.credit + incr, sysctl_icmp_msgs_burst); + credit =3D min_t(u32, icmp_global.credit + incr, + READ_ONCE(sysctl_icmp_msgs_burst)); if (credit) { /* We want to use a credit of one in average, but need to randomize * it for security reasons. --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB3FBC433EF for ; Tue, 19 Jul 2022 12:36:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240685AbiGSMgD (ORCPT ); Tue, 19 Jul 2022 08:36:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241181AbiGSMew (ORCPT ); Tue, 19 Jul 2022 08:34:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 420EC41D30; Tue, 19 Jul 2022 05:13: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 A7716617D4; Tue, 19 Jul 2022 12:13:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86978C341C6; Tue, 19 Jul 2022 12:12:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232779; bh=f9wDmODJ/BHd1ZbKTvLQBAdz9tLg5avMDweuF9WygG0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0HlVj4jKAynBCtNQ93dLi9mUNHAdZuCiAYRNaRR9ztPe65c6ywV9C6kmfzrHlO8G4 yrqpEItyk5OwDahNuLGHddbfmm/s02OZ8gQ8yzbMuGxgYipCaeLgOt+0Ps+VSCYnku NTEOrP3oPOOm+5ZlOSm61tMMPLBYyXU35jYsbF7s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 062/167] ipv4: Fix a data-race around sysctl_fib_sync_mem. Date: Tue, 19 Jul 2022 13:53:14 +0200 Message-Id: <20220719114702.552291994@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 73318c4b7dbd0e781aaababff17376b2894745c0 ] While reading sysctl_fib_sync_mem, it can be changed concurrently. So, we need to add READ_ONCE() to avoid a data-race. Fixes: 9ab948a91b2c ("ipv4: Allow amount of dirty memory from fib resizing = to be controllable") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv4/fib_trie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index f7f74d5c14da..a9cd9c2bd84e 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c @@ -497,7 +497,7 @@ static void tnode_free(struct key_vector *tn) tn =3D container_of(head, struct tnode, rcu)->kv; } =20 - if (tnode_free_size >=3D sysctl_fib_sync_mem) { + if (tnode_free_size >=3D READ_ONCE(sysctl_fib_sync_mem)) { tnode_free_size =3D 0; synchronize_rcu(); } --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2630EC433EF for ; Tue, 19 Jul 2022 12:35:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240558AbiGSMf2 (ORCPT ); Tue, 19 Jul 2022 08:35:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240600AbiGSMeJ (ORCPT ); Tue, 19 Jul 2022 08:34: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 EC02974E34; Tue, 19 Jul 2022 05:13: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 9B9F9617B2; Tue, 19 Jul 2022 12:13:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68C7BC341CB; Tue, 19 Jul 2022 12:13:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232782; bh=nyiV2tkPIYSQkq0L9P1Xt/heiH1x0GRXjbah9mBkCv8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tajLjjGX66oUVwcFSoTQE/uyWPVZRBmj0wRfRpZ1xY7OwRQX0c8tbe3l+l1ZfS6sv ehtMoI/QtQnhTzCZjhFGXEpin8U5KCsnTzBfDNfalPr2dWsHAE7synZW8EzZIc2VdE VNWNbrLhSpEExMAAIHOF+qZB2yRj17x7jdTBZ06I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryan Wanner , Claudiu Beznea , Sasha Levin Subject: [PATCH 5.15 063/167] ARM: dts: at91: sama5d2: Fix typo in i2s1 node Date: Tue, 19 Jul 2022 13:53:15 +0200 Message-Id: <20220719114702.643602659@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ryan Wanner [ Upstream commit 2fdf15b50a46e366740df4cccbe2343269b4ff55 ] Fix typo in i2s1 causing errors in dt binding validation. Change assigned-parrents to assigned-clock-parents to match i2s0 node formatting. Fixes: 1ca81883c557 ("ARM: dts: at91: sama5d2: add nodes for I2S controller= s") Signed-off-by: Ryan Wanner [claudiu.beznea: use imperative addressing in commit description, remove blank line after fixes tag, fix typo in commit message] Signed-off-by: Claudiu Beznea Link: https://lore.kernel.org/r/20220707215812.193008-1-Ryan.Wanner@microch= ip.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/arm/boot/dts/sama5d2.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi index de88eb484718..4c87c2aa8fc8 100644 --- a/arch/arm/boot/dts/sama5d2.dtsi +++ b/arch/arm/boot/dts/sama5d2.dtsi @@ -1125,7 +1125,7 @@ AT91_XDMAC_DT_PERID(33))>, clocks =3D <&pmc PMC_TYPE_PERIPHERAL 55>, <&pmc PMC_TYPE_GCK 55>; clock-names =3D "pclk", "gclk"; assigned-clocks =3D <&pmc PMC_TYPE_CORE PMC_I2S1_MUX>; - assigned-parrents =3D <&pmc PMC_TYPE_GCK 55>; + assigned-clock-parents =3D <&pmc PMC_TYPE_GCK 55>; status =3D "disabled"; }; =20 --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 549F6C433EF for ; Tue, 19 Jul 2022 12:36:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240727AbiGSMgL (ORCPT ); Tue, 19 Jul 2022 08:36:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241200AbiGSMey (ORCPT ); Tue, 19 Jul 2022 08:34:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE83A79686; Tue, 19 Jul 2022 05:13: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 A1D986178A; Tue, 19 Jul 2022 12:13:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F6D1C341CA; Tue, 19 Jul 2022 12:13:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232785; bh=fr9eRr9LYNLPJAml2G3Qm16Rayd/ibjXZQcpvaqCjY4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MUsyAJAVusGc7sRi999Qu0ME5FDCrkfu3X+5gIejf1AfKwuXqNVvsA2i/owVLF86B KLRT2y8L9dtCGTETNtUW7uXroKTgV51KGz7iVHXoXO8LS4Hfy2p1YUxbERo5OK0W2A NNMR6/I9ur/kur13V+LxAPZL06J5xl/wQSfCXPf4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Suchanek , Jernej Skrabec , Sasha Levin Subject: [PATCH 5.15 064/167] ARM: dts: sunxi: Fix SPI NOR campatible on Orange Pi Zero Date: Tue, 19 Jul 2022 13:53:16 +0200 Message-Id: <20220719114702.735759553@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michal Suchanek [ Upstream commit 884b66976a7279ee889ba885fe364244d50b79e7 ] The device tree should include generic "jedec,spi-nor" compatible, and a manufacturer-specific one. The macronix part is what is shipped on the boards that come with a flash chip. Fixes: 45857ae95478 ("ARM: dts: orange-pi-zero: add node for SPI NOR") Signed-off-by: Michal Suchanek Acked-by: Jernej Skrabec Signed-off-by: Jernej Skrabec Link: https://lore.kernel.org/r/20220708174529.3360-1-msuchanek@suse.de Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts b/arch/arm/b= oot/dts/sun8i-h2-plus-orangepi-zero.dts index f19ed981da9d..3706216ffb40 100644 --- a/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts +++ b/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts @@ -169,7 +169,7 @@ &spi0 { flash@0 { #address-cells =3D <1>; #size-cells =3D <1>; - compatible =3D "mxicy,mx25l1606e", "winbond,w25q128"; + compatible =3D "mxicy,mx25l1606e", "jedec,spi-nor"; reg =3D <0>; spi-max-frequency =3D <40000000>; }; --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4052C43334 for ; Tue, 19 Jul 2022 12:38:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240934AbiGSMi0 (ORCPT ); Tue, 19 Jul 2022 08:38:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240779AbiGSMh5 (ORCPT ); Tue, 19 Jul 2022 08:37: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 06A58422DD; Tue, 19 Jul 2022 05:14: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 55D3AB81B21; Tue, 19 Jul 2022 12:14:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC5F3C341C6; Tue, 19 Jul 2022 12:14:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232871; bh=gTAyIIWfVvcGQ/wzA1TZPu6SnMzXCc/djoWkchmhfY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yUv9p1FIxRDxWif2nVysvSCr3ytsW1rHYrHAk6QV4IKuzFGxzgOvomyLIUoaws1RI wPkSB+f5ev2HquSlsjNKIke4QvVDYI04jsDDjkKb+I1XAAxDjaHkJhdMdQW8baz6Co 235E4htzo51AoRaWj4eeza0ajICiWtTrXLLDN6DE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, William Zhang , Florian Fainelli , Sasha Levin Subject: [PATCH 5.15 065/167] arm64: dts: broadcom: bcm4908: Fix timer node for BCM4906 SoC Date: Tue, 19 Jul 2022 13:53:17 +0200 Message-Id: <20220719114702.822782094@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: William Zhang [ Upstream commit b4a544e415e9be33b37d9bfa9d9f9f4d13f553d6 ] The cpu mask value in interrupt property inherits from bcm4908.dtsi which sets to four cpus. Correct the value to two cpus for dual core BCM4906 SoC. Fixes: c8b404fb05dc ("arm64: dts: broadcom: bcm4908: add BCM4906 Netgear R8= 000P DTS files") Signed-off-by: William Zhang Signed-off-by: Florian Fainelli Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/arm64/boot/dts/broadcom/bcm4908/bcm4906.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906.dtsi b/arch/arm64= /boot/dts/broadcom/bcm4908/bcm4906.dtsi index 66023d553524..d084c33d5ca8 100644 --- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906.dtsi +++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906.dtsi @@ -9,6 +9,14 @@ cpus { /delete-node/ cpu@3; }; =20 + timer { + compatible =3D "arm,armv8-timer"; + interrupts =3D , + , + , + ; + }; + pmu { compatible =3D "arm,cortex-a53-pmu"; interrupts =3D , --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D99F0C43334 for ; Tue, 19 Jul 2022 12:37:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240608AbiGSMhP (ORCPT ); Tue, 19 Jul 2022 08:37:15 -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 S240768AbiGSMgX (ORCPT ); Tue, 19 Jul 2022 08:36:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19F9626104; Tue, 19 Jul 2022 05:14:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ACFC4B81B21; Tue, 19 Jul 2022 12:13:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFE48C341C6; Tue, 19 Jul 2022 12:13:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232811; bh=uinYfMvxMPlZBnKki7jUgXVpXy55MFvui2maCfMC+nk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R6Bu21ZpnK/ubCGV46g2V9LsXBeoURjzyg+cUD0a8CMMKcxS1xfXivjFqTUovaCVy 6bjTuMT6Z9aavGN3HQ4BE+ZJNYSBmPzQ8xX+g0rl40GgsG7bQdw2kODUhEVHDAo5kz S4lEO2jiW/168EFPjO0ojAhmhF4DWKyk11GP73pw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, William Zhang , Florian Fainelli , Sasha Levin Subject: [PATCH 5.15 066/167] arm64: dts: broadcom: bcm4908: Fix cpu node for smp boot Date: Tue, 19 Jul 2022 13:53:18 +0200 Message-Id: <20220719114702.911394756@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: William Zhang [ Upstream commit 8bd582ae9a71d7f14c4e0c735b2eacaf7516d626 ] Add spin-table enable-method and cpu-release-addr properties for cpu0 node. This is required by all ARMv8 SoC. Otherwise some bootloader like u-boot can not update cpu-release-addr and linux fails to start up secondary cpus. Fixes: 2961f69f151c ("arm64: dts: broadcom: add BCM4908 and Asus GT-AC5300 = early DTS files") Signed-off-by: William Zhang Signed-off-by: Florian Fainelli Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi b/arch/arm64= /boot/dts/broadcom/bcm4908/bcm4908.dtsi index e8907d3fe2d1..e510a6961cf9 100644 --- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi +++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi @@ -29,6 +29,8 @@ cpu0: cpu@0 { device_type =3D "cpu"; compatible =3D "brcm,brahma-b53"; reg =3D <0x0>; + enable-method =3D "spin-table"; + cpu-release-addr =3D <0x0 0xfff8>; next-level-cache =3D <&l2>; }; =20 --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23BD9C433EF for ; Tue, 19 Jul 2022 12:37:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240921AbiGSMhS (ORCPT ); Tue, 19 Jul 2022 08:37:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240774AbiGSMgY (ORCPT ); Tue, 19 Jul 2022 08:36: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 357CB24944; Tue, 19 Jul 2022 05:14: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 sin.source.kernel.org (Postfix) with ESMTPS id 850AECE1BE5; Tue, 19 Jul 2022 12:14:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A2A1C341C6; Tue, 19 Jul 2022 12:14:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232842; bh=Y5ulbQkpBh1mvGqG++QTnnact+0szAuiE1B9TbrCcZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SO8MlbvvCIYG5mAB/6/mnwab+OXZt0ykPdjID+Yx1LHIQju1wthnXCbmyraPku6Iy 9vJ4AhnJk5WYt34VEoxA1Wi+HTCFQcbqRZw9YdgMl8OVyJTD0pK6YlmZ0lIuhi7zNt RjcTyUOPyy83tLapUYHAEz5NHN04DeWB8gLHWJYQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Yan , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.15 067/167] netfilter: nf_log: incorrect offset to network header Date: Tue, 19 Jul 2022 13:53:19 +0200 Message-Id: <20220719114703.008907738@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pablo Neira Ayuso [ Upstream commit 7a847c00eeba9744353ecdfad253143b9115678a ] NFPROTO_ARP is expecting to find the ARP header at the network offset. In the particular case of ARP, HTYPE=3D field shows the initial bytes of the ethernet header destination MAC address. netdev out: IN=3D OUT=3Dbridge0 MACSRC=3Dc2:76:e5:71:e1:de MACDST=3D36:b0:= 4a:e2:72:ea MACPROTO=3D0806 ARP HTYPE=3D14000 PTYPE=3D0x4ae2 OPCODE=3D49782 NFPROTO_NETDEV egress hook is also expecting to find the IP headers at the network offset. Fixes: 35b9395104d5 ("netfilter: add generic ARP packet logger") Reported-by: Tom Yan Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/netfilter/nf_log_syslog.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/netfilter/nf_log_syslog.c b/net/netfilter/nf_log_syslog.c index 13234641cdb3..7000e069bc07 100644 --- a/net/netfilter/nf_log_syslog.c +++ b/net/netfilter/nf_log_syslog.c @@ -61,7 +61,7 @@ dump_arp_packet(struct nf_log_buf *m, unsigned int logflags; struct arphdr _arph; =20 - ah =3D skb_header_pointer(skb, 0, sizeof(_arph), &_arph); + ah =3D skb_header_pointer(skb, nhoff, sizeof(_arph), &_arph); if (!ah) { nf_log_buf_add(m, "TRUNCATED"); return; @@ -90,7 +90,7 @@ dump_arp_packet(struct nf_log_buf *m, ah->ar_pln !=3D sizeof(__be32)) return; =20 - ap =3D skb_header_pointer(skb, sizeof(_arph), sizeof(_arpp), &_arpp); + ap =3D skb_header_pointer(skb, nhoff + sizeof(_arph), sizeof(_arpp), &_ar= pp); if (!ap) { nf_log_buf_add(m, " INCOMPLETE [%zu bytes]", skb->len - sizeof(_arph)); @@ -144,7 +144,7 @@ static void nf_log_arp_packet(struct net *net, u_int8_t= pf, =20 nf_log_dump_packet_common(m, pf, hooknum, skb, in, out, loginfo, prefix); - dump_arp_packet(m, loginfo, skb, 0); + dump_arp_packet(m, loginfo, skb, skb_network_offset(skb)); =20 nf_log_buf_close(m); } @@ -829,7 +829,7 @@ static void nf_log_ip_packet(struct net *net, u_int8_t = pf, if (in) dump_ipv4_mac_header(m, loginfo, skb); =20 - dump_ipv4_packet(net, m, loginfo, skb, 0); + dump_ipv4_packet(net, m, loginfo, skb, skb_network_offset(skb)); =20 nf_log_buf_close(m); } --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F107C433EF for ; Tue, 19 Jul 2022 12:37:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237870AbiGSMhV (ORCPT ); Tue, 19 Jul 2022 08:37:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240781AbiGSMgY (ORCPT ); Tue, 19 Jul 2022 08:36: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 199157AC37; Tue, 19 Jul 2022 05:14:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 892C6B81B2C; Tue, 19 Jul 2022 12:14:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5884C341C6; Tue, 19 Jul 2022 12:14:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232851; bh=DSOrFJWoemyjMqyL/SN8AkbBosZm+agx+lAnDevKj0A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t17CwURPBeiTX3f4rO0+GU+nsC1i9ZuEBwrNbVL65M6FwUyuJAaQjNL1J6+PJPjxs mcS7N1hBfOzNHGyVsPksQdUwb+im6MyBWVZfvq/KjYsD5lMx+m8an8cI41YdSrS/nC hBkQoCvID1L5OU5sKap2dN1ihUb3BYZ+DQ4WPwOw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.15 068/167] netfilter: nf_tables: replace BUG_ON by element length check Date: Tue, 19 Jul 2022 13:53:20 +0200 Message-Id: <20220719114703.089125101@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pablo Neira Ayuso [ Upstream commit c39ba4de6b0a843bec5d46c2b6f2064428dada5e ] BUG_ON can be triggered from userspace with an element with a large userdata area. Replace it by length check and return EINVAL instead. Over time extensions have been growing in size. Pick a sufficiently old Fixes: tag to propagate this fix. Fixes: 7d7402642eaf ("netfilter: nf_tables: variable sized set element keys= / data") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- include/net/netfilter/nf_tables.h | 14 ++++--- net/netfilter/nf_tables_api.c | 72 ++++++++++++++++++++++++++-------= ----- 2 files changed, 60 insertions(+), 26 deletions(-) --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h @@ -642,18 +642,22 @@ static inline void nft_set_ext_prepare(s tmpl->len =3D sizeof(struct nft_set_ext); } =20 -static inline void nft_set_ext_add_length(struct nft_set_ext_tmpl *tmpl, u= 8 id, - unsigned int len) +static inline int nft_set_ext_add_length(struct nft_set_ext_tmpl *tmpl, u8= id, + unsigned int len) { tmpl->len =3D ALIGN(tmpl->len, nft_set_ext_types[id].align); - BUG_ON(tmpl->len > U8_MAX); + if (tmpl->len > U8_MAX) + return -EINVAL; + tmpl->offset[id] =3D tmpl->len; tmpl->len +=3D nft_set_ext_types[id].len + len; + + return 0; } =20 -static inline void nft_set_ext_add(struct nft_set_ext_tmpl *tmpl, u8 id) +static inline int nft_set_ext_add(struct nft_set_ext_tmpl *tmpl, u8 id) { - nft_set_ext_add_length(tmpl, id, 0); + return nft_set_ext_add_length(tmpl, id, 0); } =20 static inline void nft_set_ext_init(struct nft_set_ext *ext, --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -5736,8 +5736,11 @@ static int nft_add_set_elem(struct nft_c if (!nla[NFTA_SET_ELEM_KEY] && !(flags & NFT_SET_ELEM_CATCHALL)) return -EINVAL; =20 - if (flags !=3D 0) - nft_set_ext_add(&tmpl, NFT_SET_EXT_FLAGS); + if (flags !=3D 0) { + err =3D nft_set_ext_add(&tmpl, NFT_SET_EXT_FLAGS); + if (err < 0) + return err; + } =20 if (set->flags & NFT_SET_MAP) { if (nla[NFTA_SET_ELEM_DATA] =3D=3D NULL && @@ -5846,7 +5849,9 @@ static int nft_add_set_elem(struct nft_c if (err < 0) goto err_set_elem_expr; =20 - nft_set_ext_add_length(&tmpl, NFT_SET_EXT_KEY, set->klen); + err =3D nft_set_ext_add_length(&tmpl, NFT_SET_EXT_KEY, set->klen); + if (err < 0) + goto err_parse_key; } =20 if (nla[NFTA_SET_ELEM_KEY_END]) { @@ -5855,22 +5860,31 @@ static int nft_add_set_elem(struct nft_c if (err < 0) goto err_parse_key; =20 - nft_set_ext_add_length(&tmpl, NFT_SET_EXT_KEY_END, set->klen); + err =3D nft_set_ext_add_length(&tmpl, NFT_SET_EXT_KEY_END, set->klen); + if (err < 0) + goto err_parse_key_end; } =20 if (timeout > 0) { - nft_set_ext_add(&tmpl, NFT_SET_EXT_EXPIRATION); - if (timeout !=3D set->timeout) - nft_set_ext_add(&tmpl, NFT_SET_EXT_TIMEOUT); + err =3D nft_set_ext_add(&tmpl, NFT_SET_EXT_EXPIRATION); + if (err < 0) + goto err_parse_key_end; + + if (timeout !=3D set->timeout) { + err =3D nft_set_ext_add(&tmpl, NFT_SET_EXT_TIMEOUT); + if (err < 0) + goto err_parse_key_end; + } } =20 if (num_exprs) { for (i =3D 0; i < num_exprs; i++) size +=3D expr_array[i]->ops->size; =20 - nft_set_ext_add_length(&tmpl, NFT_SET_EXT_EXPRESSIONS, - sizeof(struct nft_set_elem_expr) + - size); + err =3D nft_set_ext_add_length(&tmpl, NFT_SET_EXT_EXPRESSIONS, + sizeof(struct nft_set_elem_expr) + size); + if (err < 0) + goto err_parse_key_end; } =20 if (nla[NFTA_SET_ELEM_OBJREF] !=3D NULL) { @@ -5885,7 +5899,9 @@ static int nft_add_set_elem(struct nft_c err =3D PTR_ERR(obj); goto err_parse_key_end; } - nft_set_ext_add(&tmpl, NFT_SET_EXT_OBJREF); + err =3D nft_set_ext_add(&tmpl, NFT_SET_EXT_OBJREF); + if (err < 0) + goto err_parse_key_end; } =20 if (nla[NFTA_SET_ELEM_DATA] !=3D NULL) { @@ -5919,7 +5935,9 @@ static int nft_add_set_elem(struct nft_c NFT_VALIDATE_NEED); } =20 - nft_set_ext_add_length(&tmpl, NFT_SET_EXT_DATA, desc.len); + err =3D nft_set_ext_add_length(&tmpl, NFT_SET_EXT_DATA, desc.len); + if (err < 0) + goto err_parse_data; } =20 /* The full maximum length of userdata can exceed the maximum @@ -5929,9 +5947,12 @@ static int nft_add_set_elem(struct nft_c ulen =3D 0; if (nla[NFTA_SET_ELEM_USERDATA] !=3D NULL) { ulen =3D nla_len(nla[NFTA_SET_ELEM_USERDATA]); - if (ulen > 0) - nft_set_ext_add_length(&tmpl, NFT_SET_EXT_USERDATA, - ulen); + if (ulen > 0) { + err =3D nft_set_ext_add_length(&tmpl, NFT_SET_EXT_USERDATA, + ulen); + if (err < 0) + goto err_parse_data; + } } =20 err =3D -ENOMEM; @@ -6157,8 +6178,11 @@ static int nft_del_setelem(struct nft_ct =20 nft_set_ext_prepare(&tmpl); =20 - if (flags !=3D 0) - nft_set_ext_add(&tmpl, NFT_SET_EXT_FLAGS); + if (flags !=3D 0) { + err =3D nft_set_ext_add(&tmpl, NFT_SET_EXT_FLAGS); + if (err < 0) + return err; + } =20 if (nla[NFTA_SET_ELEM_KEY]) { err =3D nft_setelem_parse_key(ctx, set, &elem.key.val, @@ -6166,16 +6190,20 @@ static int nft_del_setelem(struct nft_ct if (err < 0) return err; =20 - nft_set_ext_add_length(&tmpl, NFT_SET_EXT_KEY, set->klen); + err =3D nft_set_ext_add_length(&tmpl, NFT_SET_EXT_KEY, set->klen); + if (err < 0) + goto fail_elem; } =20 if (nla[NFTA_SET_ELEM_KEY_END]) { err =3D nft_setelem_parse_key(ctx, set, &elem.key_end.val, nla[NFTA_SET_ELEM_KEY_END]); if (err < 0) - return err; + goto fail_elem; =20 - nft_set_ext_add_length(&tmpl, NFT_SET_EXT_KEY_END, set->klen); + err =3D nft_set_ext_add_length(&tmpl, NFT_SET_EXT_KEY_END, set->klen); + if (err < 0) + goto fail_elem_key_end; } =20 err =3D -ENOMEM; @@ -6183,7 +6211,7 @@ static int nft_del_setelem(struct nft_ct elem.key_end.val.data, NULL, 0, 0, GFP_KERNEL); if (elem.priv =3D=3D NULL) - goto fail_elem; + goto fail_elem_key_end; =20 ext =3D nft_set_elem_ext(set, elem.priv); if (flags) @@ -6207,6 +6235,8 @@ fail_ops: kfree(trans); fail_trans: kfree(elem.priv); +fail_elem_key_end: + nft_data_release(&elem.key_end.val, NFT_DATA_VALUE); fail_elem: nft_data_release(&elem.key.val, NFT_DATA_VALUE); return err; From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFBFAC43334 for ; Tue, 19 Jul 2022 12:37:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240714AbiGSMh1 (ORCPT ); Tue, 19 Jul 2022 08:37:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240674AbiGSMgr (ORCPT ); Tue, 19 Jul 2022 08:36: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 430AE7B349; Tue, 19 Jul 2022 05:14: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 58C0FB81B08; Tue, 19 Jul 2022 12:14:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0FDEC341C6; Tue, 19 Jul 2022 12:14:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232854; bh=4e+egwhf3Xe6mjeGGX+i1VOLzgqkAJAcedV9UkP5Svs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R3c4hjgcZezgZklTnkPWmfTiahkfz6Cnd7+gIaCkiHWLArw44TrfcAkRHqzVwrbdX 1plAwPfOjXgagJdJPOQa06J7n/bfVY5bZZk7ewiir+ygUDiiiz8tKSIMDW3hAKjDW0 23cMRE60x7McYNUy8kpF6CYSGUu6adCIdgvPrzrs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrzej Hajda , Dan Carpenter , Zhenyu Wang , Sasha Levin Subject: [PATCH 5.15 069/167] drm/i915/gvt: IS_ERR() vs NULL bug in intel_gvt_update_reg_whitelist() Date: Tue, 19 Jul 2022 13:53:21 +0200 Message-Id: <20220719114703.173075778@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit e87197fbd137c888fd6c871c72fe7e89445dd015 ] The shmem_pin_map() function returns NULL, it doesn't return error pointers. Fixes: 97ea656521c8 ("drm/i915/gvt: Parse default state to update reg white= list") Reviewed-by: Andrzej Hajda Signed-off-by: Dan Carpenter Signed-off-by: Zhenyu Wang Link: http://patchwork.freedesktop.org/patch/msgid/Ysftoia2BPUyqVcD@kili Acked-by: Zhenyu Wang Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpu/drm/i915/gvt/cmd_parser.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/gvt/cmd_parser.c b/drivers/gpu/drm/i915/g= vt/cmd_parser.c index c4118b808268..11971ee929f8 100644 --- a/drivers/gpu/drm/i915/gvt/cmd_parser.c +++ b/drivers/gpu/drm/i915/gvt/cmd_parser.c @@ -3115,9 +3115,9 @@ void intel_gvt_update_reg_whitelist(struct intel_vgpu= *vgpu) continue; =20 vaddr =3D shmem_pin_map(engine->default_state); - if (IS_ERR(vaddr)) { - gvt_err("failed to map %s->default state, err:%zd\n", - engine->name, PTR_ERR(vaddr)); + if (!vaddr) { + gvt_err("failed to map %s->default state\n", + engine->name); return; } =20 --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F420C43334 for ; Tue, 19 Jul 2022 12:37:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240855AbiGSMhr (ORCPT ); Tue, 19 Jul 2022 08:37:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240742AbiGSMgv (ORCPT ); Tue, 19 Jul 2022 08:36:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF9AD167F7; Tue, 19 Jul 2022 05:14: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 DB12461772; Tue, 19 Jul 2022 12:14:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB976C341C6; Tue, 19 Jul 2022 12:14:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232857; bh=MbtqvblcDyxVBgmf+7fz/Bb/HJlp2IV/sr6R4VkWY+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bs9UxCyGU+4jtaRpvSu3gw0Nu1l7Q/hpZv9iG0N+a+taBPyAyYxoXZKOpX7pnrx7A Co469P1/evd4Hnsh2qDBBlnVpUK+ulAQyVETsf9D/x6N2PFBcZfEYvIyyifEDambMr bUxnSA1p6G3LRcaYw2ioCaFSEgzdgk7nQ/MFCkcY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juergen Gross , Demi Marie Obenour , Oleksandr Tyshchenko , Sasha Levin Subject: [PATCH 5.15 070/167] xen/gntdev: Ignore failure to unmap INVALID_GRANT_HANDLE Date: Tue, 19 Jul 2022 13:53:22 +0200 Message-Id: <20220719114703.282410840@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Demi Marie Obenour [ Upstream commit 166d3863231667c4f64dee72b77d1102cdfad11f ] The error paths of gntdev_mmap() can call unmap_grant_pages() even though not all of the pages have been successfully mapped. This will trigger the WARN_ON()s in __unmap_grant_pages_done(). The number of warnings can be very large; I have observed thousands of lines of warnings in the systemd journal. Avoid this problem by only warning on unmapping failure if the handle being unmapped is not INVALID_GRANT_HANDLE. The handle field of any page that was not successfully mapped will be INVALID_GRANT_HANDLE, so this catches all cases where unmapping can legitimately fail. Fixes: dbe97cff7dd9 ("xen/gntdev: Avoid blocking in unmap_grant_pages()") Cc: stable@vger.kernel.org Suggested-by: Juergen Gross Signed-off-by: Demi Marie Obenour Reviewed-by: Oleksandr Tyshchenko Reviewed-by: Juergen Gross Link: https://lore.kernel.org/r/20220710230522.1563-1-demi@invisiblethingsl= ab.com Signed-off-by: Juergen Gross Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/xen/gntdev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c index 4b56c39f766d..84b143eef395 100644 --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c @@ -396,13 +396,15 @@ static void __unmap_grant_pages_done(int result, unsigned int offset =3D data->unmap_ops - map->unmap_ops; =20 for (i =3D 0; i < data->count; i++) { - WARN_ON(map->unmap_ops[offset+i].status); + WARN_ON(map->unmap_ops[offset + i].status !=3D GNTST_okay && + map->unmap_ops[offset + i].handle !=3D INVALID_GRANT_HANDLE); pr_debug("unmap handle=3D%d st=3D%d\n", map->unmap_ops[offset+i].handle, map->unmap_ops[offset+i].status); map->unmap_ops[offset+i].handle =3D INVALID_GRANT_HANDLE; if (use_ptemod) { - WARN_ON(map->kunmap_ops[offset+i].status); + WARN_ON(map->kunmap_ops[offset + i].status !=3D GNTST_okay && + map->kunmap_ops[offset + i].handle !=3D INVALID_GRANT_HANDLE); pr_debug("kunmap handle=3D%u st=3D%d\n", map->kunmap_ops[offset+i].handle, map->kunmap_ops[offset+i].status); --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49AD3C43334 for ; Tue, 19 Jul 2022 12:37:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240486AbiGSMh4 (ORCPT ); Tue, 19 Jul 2022 08:37:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240779AbiGSMhH (ORCPT ); Tue, 19 Jul 2022 08:37: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 B6F9127165; Tue, 19 Jul 2022 05:14: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 10A8DB81B21; Tue, 19 Jul 2022 12:14:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 765AAC341C6; Tue, 19 Jul 2022 12:14:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232859; bh=JriZhhJjPKNaYLWd2CCG/ku0GwfO97kleLtUwigctRE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tY2yGBelRiyxMiuhIj1LKjj7Vf2hjbrEtoq6FnnLJIp/yn1phVd/ZEdzvLNqCQa6r OEgSt0I/PLgGOj8SSNJL8hZibnMG+y8NxmyBiSXJ8Rb+0QpambkK4zhlVVurwdMVTK otCY+BiSWl+ll6ZjVpb7RbPeUItnQtMSkTMYZfhY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "J. Bruce Fields" , Jeff Layton , Chuck Lever , Sasha Levin Subject: [PATCH 5.15 071/167] lockd: set fl_owner when unlocking files Date: Tue, 19 Jul 2022 13:53:23 +0200 Message-Id: <20220719114703.370955571@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jeff Layton [ Upstream commit aec158242b87a43d83322e99bc71ab4428e5ab79 ] Unlocking a POSIX lock on an inode with vfs_lock_file only works if the owner matches. Ensure we set it in the request. Cc: J. Bruce Fields Fixes: 7f024fcd5c97 ("Keep read and write fds with each nlm_file") Signed-off-by: Jeff Layton Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- fs/lockd/svcsubs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c index 0a22a2faf552..b2f277727469 100644 --- a/fs/lockd/svcsubs.c +++ b/fs/lockd/svcsubs.c @@ -176,7 +176,7 @@ nlm_delete_file(struct nlm_file *file) } } =20 -static int nlm_unlock_files(struct nlm_file *file) +static int nlm_unlock_files(struct nlm_file *file, fl_owner_t owner) { struct file_lock lock; =20 @@ -184,6 +184,7 @@ static int nlm_unlock_files(struct nlm_file *file) lock.fl_type =3D F_UNLCK; lock.fl_start =3D 0; lock.fl_end =3D OFFSET_MAX; + lock.fl_owner =3D owner; if (file->f_file[O_RDONLY] && vfs_lock_file(file->f_file[O_RDONLY], F_SETLK, &lock, NULL)) goto out_err; @@ -225,7 +226,7 @@ nlm_traverse_locks(struct nlm_host *host, struct nlm_fi= le *file, if (match(lockhost, host)) { =20 spin_unlock(&flctx->flc_lock); - if (nlm_unlock_files(file)) + if (nlm_unlock_files(file, fl->fl_owner)) return 1; goto again; } --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF838C433EF for ; Tue, 19 Jul 2022 12:38:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240904AbiGSMiP (ORCPT ); Tue, 19 Jul 2022 08:38:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240886AbiGSMhy (ORCPT ); Tue, 19 Jul 2022 08:37:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 754D67BE01; Tue, 19 Jul 2022 05:14: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 E651EB81B32; Tue, 19 Jul 2022 12:14:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 466AAC341C6; Tue, 19 Jul 2022 12:14:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232862; bh=Mg3fED1AAvaDbJxZHyGG4Bsb6lTRQRN91wZoWjfGKTo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kaGuXo3YT0D4T2Wlh3az3I3xMV0uSpB0WirYwnRunGDfwcQm2Jh4FaVSsR9D7vDke g6lOFb7hJE1YjSr2SJatCwZ9E1ipeLoeOMhgSuTn7sxn9vVO/BxG6nlD0ZrWvi0q1n fWU2VmhoB5QxXBhAOkxRy3m60ZUidXkqiWcduchc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "J. Bruce Fields" , Jeff Layton , Chuck Lever , Sasha Levin Subject: [PATCH 5.15 072/167] lockd: fix nlm_close_files Date: Tue, 19 Jul 2022 13:53:24 +0200 Message-Id: <20220719114703.467947727@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jeff Layton [ Upstream commit 1197eb5906a5464dbaea24cac296dfc38499cc00 ] This loop condition tries a bit too hard to be clever. Just test for the two indices we care about explicitly. Cc: J. Bruce Fields Fixes: 7f024fcd5c97 ("Keep read and write fds with each nlm_file") Signed-off-by: Jeff Layton Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- fs/lockd/svcsubs.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c index b2f277727469..e1c4617de771 100644 --- a/fs/lockd/svcsubs.c +++ b/fs/lockd/svcsubs.c @@ -283,11 +283,10 @@ nlm_file_inuse(struct nlm_file *file) =20 static void nlm_close_files(struct nlm_file *file) { - struct file *f; - - for (f =3D file->f_file[0]; f <=3D file->f_file[1]; f++) - if (f) - nlmsvc_ops->fclose(f); + if (file->f_file[O_RDONLY]) + nlmsvc_ops->fclose(file->f_file[O_RDONLY]); + if (file->f_file[O_WRONLY]) + nlmsvc_ops->fclose(file->f_file[O_WRONLY]); } =20 /* --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2A4FC433EF for ; Tue, 19 Jul 2022 12:38:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241003AbiGSMiB (ORCPT ); Tue, 19 Jul 2022 08:38:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240934AbiGSMhW (ORCPT ); Tue, 19 Jul 2022 08:37:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 773DA422DE; Tue, 19 Jul 2022 05:14: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 AF361B81B2E; Tue, 19 Jul 2022 12:14:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AABCC341C6; Tue, 19 Jul 2022 12:14:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232865; bh=u0SbYKlT7/xvQuNKsPQFd/qP/O5P8yZ+IpKK3hezbqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=neWANE6/2ADYMVD4TkgnOTfrRv0YbYeMsMyB2rmytOtaSG9fd6VAy5w3mgSLpdoUy PpwXfoHcbBemRJNSik2KYvO6PSdp32iIKpb6KNl0jZdCyI82c7Wdx087u1So5398dq jSR/yZSUYpvldtAdHXGsbvSVo32sDXUv9/P3h0CY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Douglas Anderson , "Steven Rostedt (Google)" , Sasha Levin Subject: [PATCH 5.15 073/167] tracing: Fix sleeping while atomic in kdb ftdump Date: Tue, 19 Jul 2022 13:53:25 +0200 Message-Id: <20220719114703.566844437@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Douglas Anderson [ Upstream commit 495fcec8648cdfb483b5b9ab310f3839f07cb3b8 ] If you drop into kdb and type "ftdump" you'll get a sleeping while atomic warning from memory allocation in trace_find_next_entry(). This appears to have been caused by commit ff895103a84a ("tracing: Save off entry when peeking at next entry"), which added the allocation in that path. The problematic commit was already fixed by commit 8e99cf91b99b ("tracing: Do not allocate buffer in trace_find_next_entry() in atomic") but that fix missed the kdb case. The fix here is easy: just move the assignment of the static buffer to the place where it should have been to begin with: trace_init_global_iter(). That function is called in two places, once is right before the assignment of the static buffer added by the previous fix and once is in kdb. Note that it appears that there's a second static buffer that we need to assign that was added in commit efbbdaa22bb7 ("tracing: Show real address for trace event arguments"), so we'll move that too. Link: https://lkml.kernel.org/r/20220708170919.1.I75844e5038d9425add2ad853a= 608cb44bb39df40@changeid Fixes: ff895103a84a ("tracing: Save off entry when peeking at next entry") Fixes: efbbdaa22bb7 ("tracing: Show real address for trace event arguments") Signed-off-by: Douglas Anderson Signed-off-by: Steven Rostedt (Google) Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- kernel/trace/trace.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 518ce39a878d..f752f2574630 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -9831,6 +9831,12 @@ void trace_init_global_iter(struct trace_iterator *i= ter) /* Output in nanoseconds only if we are using a clock in nanoseconds. */ if (trace_clocks[iter->tr->clock_id].in_ns) iter->iter_flags |=3D TRACE_FILE_TIME_IN_NS; + + /* Can not use kmalloc for iter.temp and iter.fmt */ + iter->temp =3D static_temp_buf; + iter->temp_size =3D STATIC_TEMP_BUF_SIZE; + iter->fmt =3D static_fmt_buf; + iter->fmt_size =3D STATIC_FMT_BUF_SIZE; } =20 void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) @@ -9863,11 +9869,6 @@ void ftrace_dump(enum ftrace_dump_mode oops_dump_mod= e) =20 /* Simulate the iterator */ trace_init_global_iter(&iter); - /* Can not use kmalloc for iter.temp and iter.fmt */ - iter.temp =3D static_temp_buf; - iter.temp_size =3D STATIC_TEMP_BUF_SIZE; - iter.fmt =3D static_fmt_buf; - iter.fmt_size =3D STATIC_FMT_BUF_SIZE; =20 for_each_tracing_cpu(cpu) { atomic_inc(&per_cpu_ptr(iter.array_buffer->data, cpu)->disabled); --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18FB4C43334 for ; Tue, 19 Jul 2022 12:38:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240947AbiGSMia (ORCPT ); Tue, 19 Jul 2022 08:38:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240924AbiGSMh5 (ORCPT ); Tue, 19 Jul 2022 08:37:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7367DF6; Tue, 19 Jul 2022 05:14: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 89C50B81B1A; Tue, 19 Jul 2022 12:14:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB248C341C6; Tue, 19 Jul 2022 12:14:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232868; bh=x0+4UCqMcFvc411OmzWF/tUroj0lfUAwCABl3Uwn5qA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Du64/rxdBkd3X5c5qSFEr6+bMNg7gl8oEu6/Iksw+S6kll2Z8o66y0dw5Gc6E+1YM PrG0+fOIYaUipMRuuijv8Mt836klXKgVNqQWhqicUPZ5xQUGMYMXd8p+43GrTeKZkX TZTpT6vKaclQipCX16a1CaXyA1mjRgOtG4HkLF1g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Matthew Auld , Rodrigo Vivi , Sasha Levin Subject: [PATCH 5.15 074/167] drm/i915/selftests: fix a couple IS_ERR() vs NULL tests Date: Tue, 19 Jul 2022 13:53:26 +0200 Message-Id: <20220719114703.677828621@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit 896dcabd1f8f613c533d948df17408c41f8929f5 ] The shmem_pin_map() function doesn't return error pointers, it returns NULL. Fixes: be1cb55a07bf ("drm/i915/gt: Keep a no-frills swappable copy of the d= efault context state") Signed-off-by: Dan Carpenter Reviewed-by: Matthew Auld Signed-off-by: Matthew Auld Link: https://patchwork.freedesktop.org/patch/msgid/20220708094104.GL2316@k= adam (cherry picked from commit d50f5a109cf4ed50c5b575c1bb5fc3bd17b23308) Signed-off-by: Rodrigo Vivi Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpu/drm/i915/gt/selftest_lrc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/selftest_lrc.c b/drivers/gpu/drm/i915/= gt/selftest_lrc.c index b0977a3b699b..bc2950fbbaf9 100644 --- a/drivers/gpu/drm/i915/gt/selftest_lrc.c +++ b/drivers/gpu/drm/i915/gt/selftest_lrc.c @@ -153,8 +153,8 @@ static int live_lrc_layout(void *arg) continue; =20 hw =3D shmem_pin_map(engine->default_state); - if (IS_ERR(hw)) { - err =3D PTR_ERR(hw); + if (!hw) { + err =3D -ENOMEM; break; } hw +=3D LRC_STATE_OFFSET / sizeof(*hw); @@ -329,8 +329,8 @@ static int live_lrc_fixed(void *arg) continue; =20 hw =3D shmem_pin_map(engine->default_state); - if (IS_ERR(hw)) { - err =3D PTR_ERR(hw); + if (!hw) { + err =3D -ENOMEM; break; } hw +=3D LRC_STATE_OFFSET / sizeof(*hw); --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A19AC433EF for ; Tue, 19 Jul 2022 12:35:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240574AbiGSMfy (ORCPT ); Tue, 19 Jul 2022 08:35:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241041AbiGSMej (ORCPT ); Tue, 19 Jul 2022 08:34:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB7A378233; Tue, 19 Jul 2022 05:13:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 65299B81B2C; Tue, 19 Jul 2022 12:13:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA744C341C6; Tue, 19 Jul 2022 12:13:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232814; bh=fvg2bkj8z5Ppk4ktr8qjTgz1iKiQ/89YzGS0rKplh3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ILihPOfB+TXX7/J+HO9it0Px5wmq/iYb1NUOhJPIcJbwErKmo/THsGk4CGfu3ZdXa 5BbZX8ZMVkn+QMWoQWiWTgfAIHDiR1nnU19LhmRnTtGOIo9UwpXy5gXV9e4yJdcVTh zYUlViyZ3MkgWpfF2gMwneAUFGobj1oxClc05zwc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bruce Chang , Matt Roper , Rodrigo Vivi , Ramalingam C , Matthew Auld , Sasha Levin Subject: [PATCH 5.15 075/167] drm/i915/dg2: Add Wa_22011100796 Date: Tue, 19 Jul 2022 13:53:27 +0200 Message-Id: <20220719114703.791187066@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bruce Chang [ Upstream commit 154cfae6158141b18d65abb0db679bb51a8294e7 ] Whenever Full soft reset is required, reset all individual engines first, and then do a full soft reset. Signed-off-by: Bruce Chang cc: Matt Roper Cc: Rodrigo Vivi Signed-off-by: Ramalingam C Reviewed-by: Matthew Auld Link: https://patchwork.freedesktop.org/patch/msgid/20220128185209.18077-5-= ramalingam.c@intel.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpu/drm/i915/gt/intel_reset.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/gpu/drm/i915/gt/intel_reset.c b/drivers/gpu/drm/i915/g= t/intel_reset.c index 91200c43951f..b6697c1d260a 100644 --- a/drivers/gpu/drm/i915/gt/intel_reset.c +++ b/drivers/gpu/drm/i915/gt/intel_reset.c @@ -623,6 +623,15 @@ static int gen8_reset_engines(struct intel_gt *gt, */ } =20 + /* + * Wa_22011100796:dg2, whenever Full soft reset is required, + * reset all individual engines firstly, and then do a full soft reset. + * + * This is best effort, so ignore any error from the initial reset. + */ + if (IS_DG2(gt->i915) && engine_mask =3D=3D ALL_ENGINES) + gen11_reset_engines(gt, gt->info.engine_mask, 0); + if (GRAPHICS_VER(gt->i915) >=3D 11) ret =3D gen11_reset_engines(gt, engine_mask, retry); else --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50EF6C43334 for ; Tue, 19 Jul 2022 12:37:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240909AbiGSMhI (ORCPT ); Tue, 19 Jul 2022 08:37:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240767AbiGSMgX (ORCPT ); Tue, 19 Jul 2022 08:36:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BEC721247; Tue, 19 Jul 2022 05:14: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 BAA506182C; Tue, 19 Jul 2022 12:13:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E276C341C6; Tue, 19 Jul 2022 12:13:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232817; bh=zB7fBImbL6S5dCvk5R6aCJWY4IS24Bb5+S+GtUzM51w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f3DP9dqa0Ua/M+zdcmEQhx0EDmPQ0BTDZvova+sjipMBhBykAflwE56X1UF2t6H2O uGbw6Q31wmkuL5U62jTnUTgaY9gZIs7Vi7ZyJhUcbPjb+o8xBL0o5OQoz30o2iaBbe fzbAjObYlMT1/qFSLavKOMWg5g8cbD+DP8i9vjuA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mika Kuoppala , Chris Wilson , Andi Shyti , Andrzej Hajda , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , Mauro Carvalho Chehab , Rodrigo Vivi , Sasha Levin Subject: [PATCH 5.15 076/167] drm/i915/gt: Serialize GRDOM access between multiple engine resets Date: Tue, 19 Jul 2022 13:53:28 +0200 Message-Id: <20220719114703.894354538@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chris Wilson [ Upstream commit b24dcf1dc507f69ed3b5c66c2b6a0209ae80d4d4 ] Don't allow two engines to be reset in parallel, as they would both try to select a reset bit (and send requests to common registers) and wait on that register, at the same time. Serialize control of the reset requests/acks using the uncore->lock, which will also ensure that no other GT state changes at the same time as the actual reset. Cc: stable@vger.kernel.org # v4.4 and upper Reported-by: Mika Kuoppala Signed-off-by: Chris Wilson Acked-by: Mika Kuoppala Reviewed-by: Andi Shyti Reviewed-by: Andrzej Hajda Acked-by: Thomas Hellstr=C3=B6m Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Rodrigo Vivi Link: https://patchwork.freedesktop.org/patch/msgid/e0a2d894e77aed7c2e36b0d= 1abdc7dbac3011729.1657639152.git.mchehab@kernel.org (cherry picked from commit 336561a914fc0c6f1218228718f633b31b7af1c3) Signed-off-by: Rodrigo Vivi Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpu/drm/i915/gt/intel_reset.c | 37 ++++++++++++++++++++------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_reset.c b/drivers/gpu/drm/i915/g= t/intel_reset.c index b6697c1d260a..18b0e57c58c1 100644 --- a/drivers/gpu/drm/i915/gt/intel_reset.c +++ b/drivers/gpu/drm/i915/gt/intel_reset.c @@ -293,9 +293,9 @@ static int gen6_hw_domain_reset(struct intel_gt *gt, u3= 2 hw_domain_mask) return err; } =20 -static int gen6_reset_engines(struct intel_gt *gt, - intel_engine_mask_t engine_mask, - unsigned int retry) +static int __gen6_reset_engines(struct intel_gt *gt, + intel_engine_mask_t engine_mask, + unsigned int retry) { static const u32 hw_engine_mask[] =3D { [RCS0] =3D GEN6_GRDOM_RENDER, @@ -322,6 +322,20 @@ static int gen6_reset_engines(struct intel_gt *gt, return gen6_hw_domain_reset(gt, hw_mask); } =20 +static int gen6_reset_engines(struct intel_gt *gt, + intel_engine_mask_t engine_mask, + unsigned int retry) +{ + unsigned long flags; + int ret; + + spin_lock_irqsave(>->uncore->lock, flags); + ret =3D __gen6_reset_engines(gt, engine_mask, retry); + spin_unlock_irqrestore(>->uncore->lock, flags); + + return ret; +} + static struct intel_engine_cs *find_sfc_paired_vecs_engine(struct intel_en= gine_cs *engine) { int vecs_id; @@ -488,9 +502,9 @@ static void gen11_unlock_sfc(struct intel_engine_cs *en= gine) rmw_clear_fw(uncore, sfc_lock.lock_reg, sfc_lock.lock_bit); } =20 -static int gen11_reset_engines(struct intel_gt *gt, - intel_engine_mask_t engine_mask, - unsigned int retry) +static int __gen11_reset_engines(struct intel_gt *gt, + intel_engine_mask_t engine_mask, + unsigned int retry) { static const u32 hw_engine_mask[] =3D { [RCS0] =3D GEN11_GRDOM_RENDER, @@ -601,8 +615,11 @@ static int gen8_reset_engines(struct intel_gt *gt, struct intel_engine_cs *engine; const bool reset_non_ready =3D retry >=3D 1; intel_engine_mask_t tmp; + unsigned long flags; int ret; =20 + spin_lock_irqsave(>->uncore->lock, flags); + for_each_engine_masked(engine, gt, engine_mask, tmp) { ret =3D gen8_engine_reset_prepare(engine); if (ret && !reset_non_ready) @@ -630,17 +647,19 @@ static int gen8_reset_engines(struct intel_gt *gt, * This is best effort, so ignore any error from the initial reset. */ if (IS_DG2(gt->i915) && engine_mask =3D=3D ALL_ENGINES) - gen11_reset_engines(gt, gt->info.engine_mask, 0); + __gen11_reset_engines(gt, gt->info.engine_mask, 0); =20 if (GRAPHICS_VER(gt->i915) >=3D 11) - ret =3D gen11_reset_engines(gt, engine_mask, retry); + ret =3D __gen11_reset_engines(gt, engine_mask, retry); else - ret =3D gen6_reset_engines(gt, engine_mask, retry); + ret =3D __gen6_reset_engines(gt, engine_mask, retry); =20 skip_reset: for_each_engine_masked(engine, gt, engine_mask, tmp) gen8_engine_reset_cancel(engine); =20 + spin_unlock_irqrestore(>->uncore->lock, flags); + return ret; } =20 --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA77DC433EF for ; Tue, 19 Jul 2022 12:36:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240700AbiGSMgI (ORCPT ); Tue, 19 Jul 2022 08:36:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241191AbiGSMex (ORCPT ); Tue, 19 Jul 2022 08:34: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 133764505C; Tue, 19 Jul 2022 05:13: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 A5E6861826; Tue, 19 Jul 2022 12:13:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84860C341CB; Tue, 19 Jul 2022 12:13:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232819; bh=j7YTvMf/MkcVpUjLTGrJIDolAUr7q6yQhHElIIQcXbw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2b3WX7bShEhlCkKQd4JDkoZZNaFFcYq9xv8w5rQo2/fV3gd13hhmzj0Ksg3EkzpvN 23kTaBA4FLvuNM+I943DXBeB4GFNMWgkTBW+IUFpNlPvoWlhWCGwW1NFsqgGN190Fc C8w8wJhoHhy4AnzvyGVtTWNRyQ/41eSv1xdwSKME= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mauro Carvalho Chehab , Chris Wilson , Tvrtko Ursulin , Andi Shyti , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , Rodrigo Vivi , Sasha Levin Subject: [PATCH 5.15 077/167] drm/i915/gt: Serialize TLB invalidates with GT resets Date: Tue, 19 Jul 2022 13:53:29 +0200 Message-Id: <20220719114703.990956888@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chris Wilson [ Upstream commit a1c5a7bf79c1faa5633b918b5c0666545e84c4d1 ] Avoid trying to invalidate the TLB in the middle of performing an engine reset, as this may result in the reset timing out. Currently, the TLB invalidate is only serialised by its own mutex, forgoing the uncore lock, but we can take the uncore->lock as well to serialise the mmio access, thereby serialising with the GDRST. Tested on a NUC5i7RYB, BIOS RYBDWi35.86A.0380.2019.0517.1530 with i915 selftest/hangcheck. Cc: stable@vger.kernel.org # v4.4 and upper Fixes: 7938d61591d3 ("drm/i915: Flush TLBs before releasing backing store") Reported-by: Mauro Carvalho Chehab Tested-by: Mauro Carvalho Chehab Reviewed-by: Mauro Carvalho Chehab Signed-off-by: Chris Wilson Cc: Tvrtko Ursulin Reviewed-by: Andi Shyti Acked-by: Thomas Hellstr=C3=B6m Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Rodrigo Vivi Link: https://patchwork.freedesktop.org/patch/msgid/1e59a7c45dd919a530256b9= ac721ac6ea86c0677.1657639152.git.mchehab@kernel.org (cherry picked from commit 33da97894758737895e90c909f16786052680ef4) Signed-off-by: Rodrigo Vivi Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpu/drm/i915/gt/intel_gt.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/i= ntel_gt.c index e1e1d17d49fd..3a76000d15bf 100644 --- a/drivers/gpu/drm/i915/gt/intel_gt.c +++ b/drivers/gpu/drm/i915/gt/intel_gt.c @@ -970,6 +970,20 @@ void intel_gt_invalidate_tlbs(struct intel_gt *gt) mutex_lock(>->tlb_invalidate_lock); intel_uncore_forcewake_get(uncore, FORCEWAKE_ALL); =20 + spin_lock_irq(&uncore->lock); /* serialise invalidate with GT reset */ + + for_each_engine(engine, gt, id) { + struct reg_and_bit rb; + + rb =3D get_reg_and_bit(engine, regs =3D=3D gen8_regs, regs, num); + if (!i915_mmio_reg_offset(rb.reg)) + continue; + + intel_uncore_write_fw(uncore, rb.reg, rb.bit); + } + + spin_unlock_irq(&uncore->lock); + for_each_engine(engine, gt, id) { /* * HW architecture suggest typical invalidation time at 40us, @@ -984,7 +998,6 @@ void intel_gt_invalidate_tlbs(struct intel_gt *gt) if (!i915_mmio_reg_offset(rb.reg)) continue; =20 - intel_uncore_write_fw(uncore, rb.reg, rb.bit); if (__intel_wait_for_register_fw(uncore, rb.reg, rb.bit, 0, timeout_us, timeout_ms, --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0798FC43334 for ; Tue, 19 Jul 2022 12:37:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240968AbiGSMhf (ORCPT ); Tue, 19 Jul 2022 08:37:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240718AbiGSMgt (ORCPT ); Tue, 19 Jul 2022 08:36:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA98BDFF2; Tue, 19 Jul 2022 05:14: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 EBC9CB81B29; Tue, 19 Jul 2022 12:13:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FE27C341C6; Tue, 19 Jul 2022 12:13:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232822; bh=y9MZsfiKWmE9o7hdDmgnWIaSt3gGlLNSa1w+FAX5XZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ace7C8U114FOe7bb1ZjC9M1GVuRFSqvKswqP2rrWRxm0UAriWJ7untQ0beNdcEtCd 9jHNiO78WjksPE1DBEacQxDL+dOusQFeAeBOkhzJ6tymvFq7vx93q1afpWfg0C7QeU 66lF9RLHP9dJdrTnMh/g4gouaGA4ZY6zYk1IFqVk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniele Ceraolo Spurio , Matthew Brost , Sasha Levin Subject: [PATCH 5.15 078/167] drm/i915/uc: correctly track uc_fw init failure Date: Tue, 19 Jul 2022 13:53:30 +0200 Message-Id: <20220719114704.104835461@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniele Ceraolo Spurio [ Upstream commit 35d4efec103e1afde968cfc9305f00f9aceb19cc ] The FAILURE state of uc_fw currently implies that the fw is loadable (i.e init completed), so we can't use it for init failures and instead need a dedicated error code. Note that this currently does not cause any issues because if we fail to init any of the firmwares we abort the load, but better be accurate anyway in case things change in the future. Signed-off-by: Daniele Ceraolo Spurio Reviewed-by: Matthew Brost Link: https://patchwork.freedesktop.org/patch/msgid/20211211000756.1698923-= 2-daniele.ceraolospurio@intel.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c | 2 +- drivers/gpu/drm/i915/gt/uc/intel_huc.c | 2 +- drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c | 4 ++-- drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h | 17 +++++++++++------ 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c b/drivers/gpu/drm/i9= 15/gt/uc/intel_guc_fw.c index 76fe766ad1bc..bb951b8d5203 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c @@ -159,6 +159,6 @@ int intel_guc_fw_upload(struct intel_guc *guc) return 0; =20 out: - intel_uc_fw_change_status(&guc->fw, INTEL_UC_FIRMWARE_FAIL); + intel_uc_fw_change_status(&guc->fw, INTEL_UC_FIRMWARE_LOAD_FAIL); return ret; } diff --git a/drivers/gpu/drm/i915/gt/uc/intel_huc.c b/drivers/gpu/drm/i915/= gt/uc/intel_huc.c index fc5387b410a2..9ee22ac92540 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_huc.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_huc.c @@ -191,7 +191,7 @@ int intel_huc_auth(struct intel_huc *huc) =20 fail: i915_probe_error(gt->i915, "HuC: Authentication failed %d\n", ret); - intel_uc_fw_change_status(&huc->fw, INTEL_UC_FIRMWARE_FAIL); + intel_uc_fw_change_status(&huc->fw, INTEL_UC_FIRMWARE_LOAD_FAIL); return ret; } =20 diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c b/drivers/gpu/drm/i91= 5/gt/uc/intel_uc_fw.c index 3a16d08608a5..6be7fbf9d18a 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c @@ -526,7 +526,7 @@ int intel_uc_fw_upload(struct intel_uc_fw *uc_fw, u32 d= st_offset, u32 dma_flags) i915_probe_error(gt->i915, "Failed to load %s firmware %s (%d)\n", intel_uc_fw_type_repr(uc_fw->type), uc_fw->path, err); - intel_uc_fw_change_status(uc_fw, INTEL_UC_FIRMWARE_FAIL); + intel_uc_fw_change_status(uc_fw, INTEL_UC_FIRMWARE_LOAD_FAIL); return err; } =20 @@ -544,7 +544,7 @@ int intel_uc_fw_init(struct intel_uc_fw *uc_fw) if (err) { DRM_DEBUG_DRIVER("%s fw pin-pages err=3D%d\n", intel_uc_fw_type_repr(uc_fw->type), err); - intel_uc_fw_change_status(uc_fw, INTEL_UC_FIRMWARE_FAIL); + intel_uc_fw_change_status(uc_fw, INTEL_UC_FIRMWARE_INIT_FAIL); } =20 return err; diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h b/drivers/gpu/drm/i91= 5/gt/uc/intel_uc_fw.h index 99bb1fe1af66..c1a7246fb7d6 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h +++ b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h @@ -31,11 +31,12 @@ struct intel_gt; * | | MISSING <--/ | \--> ERROR | * | fetch | V | * | | AVAILABLE | - * +------------+- | -+ + * +------------+- | \ -+ + * | | | \--> INIT FAIL | * | init | V | * | | /------> LOADABLE <----<-----------\ | * +------------+- \ / \ \ \ -+ - * | | FAIL <--< \--> TRANSFERRED \ | + * | | LOAD FAIL <--< \--> TRANSFERRED \ | * | upload | \ / \ / | * | | \---------/ \--> RUNNING | * +------------+---------------------------------------------------+ @@ -49,8 +50,9 @@ enum intel_uc_fw_status { INTEL_UC_FIRMWARE_MISSING, /* blob not found on the system */ INTEL_UC_FIRMWARE_ERROR, /* invalid format or version */ INTEL_UC_FIRMWARE_AVAILABLE, /* blob found and copied in mem */ + INTEL_UC_FIRMWARE_INIT_FAIL, /* failed to prepare fw objects for load */ INTEL_UC_FIRMWARE_LOADABLE, /* all fw-required objects are ready */ - INTEL_UC_FIRMWARE_FAIL, /* failed to xfer or init/auth the fw */ + INTEL_UC_FIRMWARE_LOAD_FAIL, /* failed to xfer or init/auth the fw */ INTEL_UC_FIRMWARE_TRANSFERRED, /* dma xfer done */ INTEL_UC_FIRMWARE_RUNNING /* init/auth done */ }; @@ -121,10 +123,12 @@ const char *intel_uc_fw_status_repr(enum intel_uc_fw_= status status) return "ERROR"; case INTEL_UC_FIRMWARE_AVAILABLE: return "AVAILABLE"; + case INTEL_UC_FIRMWARE_INIT_FAIL: + return "INIT FAIL"; case INTEL_UC_FIRMWARE_LOADABLE: return "LOADABLE"; - case INTEL_UC_FIRMWARE_FAIL: - return "FAIL"; + case INTEL_UC_FIRMWARE_LOAD_FAIL: + return "LOAD FAIL"; case INTEL_UC_FIRMWARE_TRANSFERRED: return "TRANSFERRED"; case INTEL_UC_FIRMWARE_RUNNING: @@ -146,7 +150,8 @@ static inline int intel_uc_fw_status_to_error(enum inte= l_uc_fw_status status) return -ENOENT; case INTEL_UC_FIRMWARE_ERROR: return -ENOEXEC; - case INTEL_UC_FIRMWARE_FAIL: + case INTEL_UC_FIRMWARE_INIT_FAIL: + case INTEL_UC_FIRMWARE_LOAD_FAIL: return -EIO; case INTEL_UC_FIRMWARE_SELECTED: return -ESTALE; --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42F3CC433EF for ; Tue, 19 Jul 2022 12:36:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240660AbiGSMgQ (ORCPT ); Tue, 19 Jul 2022 08:36:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241273AbiGSMfC (ORCPT ); Tue, 19 Jul 2022 08:35: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 CE2F179EEF; Tue, 19 Jul 2022 05: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 dfw.source.kernel.org (Postfix) with ESMTPS id 46093617B2; Tue, 19 Jul 2022 12:13:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30D46C341C6; Tue, 19 Jul 2022 12:13:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232825; bh=AnosrUVgJ41RCxo39PFuWrg6vyGd0GPpnomtsIo9vic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HXR04hHzbswWJ/Pld4oVo6dfc64UksOdfvBn3Ufggo112BnmwXk2jx09awez5QfjM jHOPonr4adcoHyfOsY2QVlL4CnoPTK94JPRFPWplOJm2B9xUj37/saaMfi45WqjnxO qbeBg7rFbiH1wDDNvtLKZngqDU8mwEeCotFK9ywU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , Matthew Auld , Sasha Levin Subject: [PATCH 5.15 079/167] drm/i915: Require the vm mutex for i915_vma_bind() Date: Tue, 19 Jul 2022 13:53:31 +0200 Message-Id: <20220719114704.209962814@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Hellstr=C3=B6m [ Upstream commit c2ea703dcafccf18d7d77d8b68fb08c2d9842b7a ] Protect updates of struct i915_vma flags and async binding / unbinding with the vm::mutex. This means that i915_vma_bind() needs to assert vm::mutex held. In order to make that possible drop the caching of kmap_atomic() maps around i915_vma_bind(). An alternative would be to use kmap_local() but since we block cpu unplugging during sleeps inside kmap_local() sections this may have unwanted side-effects. Particularly since we might wait for gpu while holding the vm mutex. This change may theoretically increase execbuf cpu-usage on snb, but at least on non-highmem systems that increase should be very small. Signed-off-by: Thomas Hellstr=C3=B6m Reviewed-by: Matthew Auld Link: https://patchwork.freedesktop.org/patch/msgid/20211221200050.436316-5= -thomas.hellstrom@linux.intel.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- .../gpu/drm/i915/gem/i915_gem_execbuffer.c | 50 ++++++++++++++++++- drivers/gpu/drm/i915/i915_vma.c | 1 + 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/d= rm/i915/gem/i915_gem_execbuffer.c index 1aa249908b64..0d480867fc0c 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c @@ -1060,6 +1060,47 @@ static inline struct i915_ggtt *cache_to_ggtt(struct= reloc_cache *cache) return &i915->ggtt; } =20 +static void reloc_cache_unmap(struct reloc_cache *cache) +{ + void *vaddr; + + if (!cache->vaddr) + return; + + vaddr =3D unmask_page(cache->vaddr); + if (cache->vaddr & KMAP) + kunmap_atomic(vaddr); + else + io_mapping_unmap_atomic((void __iomem *)vaddr); +} + +static void reloc_cache_remap(struct reloc_cache *cache, + struct drm_i915_gem_object *obj) +{ + void *vaddr; + + if (!cache->vaddr) + return; + + if (cache->vaddr & KMAP) { + struct page *page =3D i915_gem_object_get_page(obj, cache->page); + + vaddr =3D kmap_atomic(page); + cache->vaddr =3D unmask_flags(cache->vaddr) | + (unsigned long)vaddr; + } else { + struct i915_ggtt *ggtt =3D cache_to_ggtt(cache); + unsigned long offset; + + offset =3D cache->node.start; + if (!drm_mm_node_allocated(&cache->node)) + offset +=3D cache->page << PAGE_SHIFT; + + cache->vaddr =3D (unsigned long) + io_mapping_map_atomic_wc(&ggtt->iomap, offset); + } +} + static void reloc_cache_reset(struct reloc_cache *cache, struct i915_execb= uffer *eb) { void *vaddr; @@ -1324,10 +1365,17 @@ eb_relocate_entry(struct i915_execbuffer *eb, * batchbuffers. */ if (reloc->write_domain =3D=3D I915_GEM_DOMAIN_INSTRUCTION && - GRAPHICS_VER(eb->i915) =3D=3D 6) { + GRAPHICS_VER(eb->i915) =3D=3D 6 && + !i915_vma_is_bound(target->vma, I915_VMA_GLOBAL_BIND)) { + struct i915_vma *vma =3D target->vma; + + reloc_cache_unmap(&eb->reloc_cache); + mutex_lock(&vma->vm->mutex); err =3D i915_vma_bind(target->vma, target->vma->obj->cache_level, PIN_GLOBAL, NULL); + mutex_unlock(&vma->vm->mutex); + reloc_cache_remap(&eb->reloc_cache, ev->vma->obj); if (err) return err; } diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vm= a.c index dfd20060812b..3df304edabc7 100644 --- a/drivers/gpu/drm/i915/i915_vma.c +++ b/drivers/gpu/drm/i915/i915_vma.c @@ -376,6 +376,7 @@ int i915_vma_bind(struct i915_vma *vma, u32 bind_flags; u32 vma_flags; =20 + lockdep_assert_held(&vma->vm->mutex); GEM_BUG_ON(!drm_mm_node_allocated(&vma->node)); GEM_BUG_ON(vma->size > vma->node.size); =20 --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE08DC433EF for ; Tue, 19 Jul 2022 12:36:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240676AbiGSMgb (ORCPT ); Tue, 19 Jul 2022 08:36:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240528AbiGSMfG (ORCPT ); Tue, 19 Jul 2022 08:35: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 D99002ADE; Tue, 19 Jul 2022 05:13: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 BC16DB81B31; Tue, 19 Jul 2022 12:13:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 142F2C341C6; Tue, 19 Jul 2022 12:13:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232828; bh=rpiQO8Sjibs+LwSJCBHBCpxHAgLFPuQs1Ttf3a7TM9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BojNICCq/qnoEsqEsLnrWQJ1yEh6pPjECY8FwDvGfUA62Yi5Olto1FGr2YhUVOWAx AMJbRWuzVj4T+DnYHPx+IeJ0uIrtsTXc+AQF3JhjQi9AvE9zBrqfKxDwF9aGaWjWxs aRdeTiK4RKY1xBkXfGHoyp7s7VKOMLOIB0YGF+64= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavan Chebbi , Michael Chan , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 080/167] bnxt_en: Fix bnxt_reinit_after_abort() code path Date: Tue, 19 Jul 2022 13:53:32 +0200 Message-Id: <20220719114704.316223780@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Chan [ Upstream commit 4279414bff8af9898e8c53ae6c5bc17f68ad67b7 ] bnxt_reinit_after_abort() is called during ifup when a previous FW reset sequence has aborted or a previous ifup has failed after detecting FW reset. In all cases, it is safe to assume that a previous FW reset has completed and the driver may not have fully reinitialized. Prior to this patch, it is assumed that the FUNC_DRV_IF_CHANGE_RESP_FLAGS_HOT_FW_RESET_DONE flag will always be set by the firmware in bnxt_hwrm_if_change(). This may not be true if the driver has already attempted to register with the firmware. The firmware may not set the RESET_DONE flag again after the driver has registered, assuming that the driver has seen the flag already. Fix it to always go through the FW reset initialization path if the BNXT_STATE_FW_RESET_DET flag is set. This flag is always set by the driver after successfully going through bnxt_reinit_after_abort(). Fixes: 6882c36cf82e ("bnxt_en: attempt to reinitialize after aborted reset") Reviewed-by: Pavan Chebbi Signed-off-by: Michael Chan Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethern= et/broadcom/bnxt/bnxt.c index cb5314945589..6962abe2358b 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -9806,7 +9806,8 @@ static int bnxt_hwrm_if_change(struct bnxt *bp, bool = up) =20 if (flags & FUNC_DRV_IF_CHANGE_RESP_FLAGS_RESC_CHANGE) resc_reinit =3D true; - if (flags & FUNC_DRV_IF_CHANGE_RESP_FLAGS_HOT_FW_RESET_DONE) + if (flags & FUNC_DRV_IF_CHANGE_RESP_FLAGS_HOT_FW_RESET_DONE || + test_bit(BNXT_STATE_FW_RESET_DET, &bp->state)) fw_reset =3D true; else if (bp->fw_health && !bp->fw_health->status_reliable) bnxt_try_map_fw_health_reg(bp); --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95C46C433EF for ; Tue, 19 Jul 2022 12:37:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240958AbiGSMha (ORCPT ); Tue, 19 Jul 2022 08:37:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240682AbiGSMgs (ORCPT ); Tue, 19 Jul 2022 08:36:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 160B86464; Tue, 19 Jul 2022 05:14: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 1507861746; Tue, 19 Jul 2022 12:13:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBB04C341C6; Tue, 19 Jul 2022 12:13:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232831; bh=USoxJJmNigTeOjCpA6MsQrQcsLyDaGVfZyfTu4lJXjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fCQ5TWP8OSY0HL8Y6eY2opfFQ2VkoG8w9ICHRuvpztYdBlGXT0sjdqycYNSUqPOtj AQoGWia25V/BJMzJ/RequBmy1Do4JSOnHmXHD1ZgA8pwjlaydf6RHnSaNVkdICjSo1 QSU6qWC7B1WZystVnfBOpp0KtihwJ4d6RMKwl9+A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Cochran , Pavan Chebbi , Michael Chan , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 081/167] bnxt_en: Fix bnxt_refclk_read() Date: Tue, 19 Jul 2022 13:53:33 +0200 Message-Id: <20220719114704.408719777@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pavan Chebbi [ Upstream commit ddde5412fdaa5048bbca31529d46cb8da882870c ] The upper 32-bit PHC register is not latched when reading the lower 32-bit PHC register. Current code leaves a small window where we may not read correct higher order bits if the lower order bits are just about to wrap around. This patch fixes this by reading higher order bits twice and makes sure that final value is correctly paired with its lower 32 bits. Fixes: 30e96f487f64 ("bnxt_en: Do not read the PTP PHC during chip reset") Cc: Richard Cochran Signed-off-by: Pavan Chebbi Signed-off-by: Michael Chan Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c b/drivers/net/et= hernet/broadcom/bnxt/bnxt_ptp.c index 62a931de5b1a..a78cc65a38f2 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c @@ -61,14 +61,23 @@ static int bnxt_refclk_read(struct bnxt *bp, struct ptp= _system_timestamp *sts, u64 *ns) { struct bnxt_ptp_cfg *ptp =3D bp->ptp_cfg; + u32 high_before, high_now, low; =20 if (test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)) return -EIO; =20 + high_before =3D readl(bp->bar0 + ptp->refclk_mapped_regs[1]); ptp_read_system_prets(sts); - *ns =3D readl(bp->bar0 + ptp->refclk_mapped_regs[0]); + low =3D readl(bp->bar0 + ptp->refclk_mapped_regs[0]); ptp_read_system_postts(sts); - *ns |=3D (u64)readl(bp->bar0 + ptp->refclk_mapped_regs[1]) << 32; + high_now =3D readl(bp->bar0 + ptp->refclk_mapped_regs[1]); + if (high_now !=3D high_before) { + ptp_read_system_prets(sts); + low =3D readl(bp->bar0 + ptp->refclk_mapped_regs[0]); + ptp_read_system_postts(sts); + } + *ns =3D ((u64)high_now << 32) | low; + return 0; } =20 --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20CF7C43334 for ; Tue, 19 Jul 2022 12:36:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240609AbiGSMgl (ORCPT ); Tue, 19 Jul 2022 08:36:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240305AbiGSMfN (ORCPT ); Tue, 19 Jul 2022 08:35: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 3DCDD7AB11; Tue, 19 Jul 2022 05:14: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 70CC3B81B32; Tue, 19 Jul 2022 12:13:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF17DC341C6; Tue, 19 Jul 2022 12:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232834; bh=PH0I0FrJz8Iu1ZppSIcZbT/GPSH/t/4UMdyeC++/lI0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uOqY+hTCPcb6HijPlHfB8Kyyzzu5ONRhA68ctXJiHrG83iVG06TiMbcVLxGfMFLDz F57PEERp5B3RPwipsO1Mkp0X4EIwBrjFEy7+ezuwMbFbApI0rprRgy2rco9yXwOvIC Zrgs1lvtqGqtCdHtYAcRa8K/A3XeWaUbNw7Txpyo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 082/167] sysctl: Fix data-races in proc_dou8vec_minmax(). Date: Tue, 19 Jul 2022 13:53:34 +0200 Message-Id: <20220719114704.502067143@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 7dee5d7747a69aa2be41f04c6a7ecfe3ac8cdf18 ] A sysctl variable is accessed concurrently, and there is always a chance of data-race. So, all readers and writers need some basic protection to avoid load/store-tearing. This patch changes proc_dou8vec_minmax() to use READ_ONCE() and WRITE_ONCE() internally to fix data-races on the sysctl side. For now, proc_dou8vec_minmax() itself is tolerant to a data-race, but we still need to add annotations on the other subsystem's side. Fixes: cb9444130662 ("sysctl: add proc_dou8vec_minmax()") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- kernel/sysctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 5be8108a9a45..357900d0cef9 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1138,13 +1138,13 @@ int proc_dou8vec_minmax(struct ctl_table *table, in= t write, =20 tmp.maxlen =3D sizeof(val); tmp.data =3D &val; - val =3D *data; + val =3D READ_ONCE(*data); res =3D do_proc_douintvec(&tmp, write, buffer, lenp, ppos, do_proc_douintvec_minmax_conv, ¶m); if (res) return res; if (write) - *data =3D val; + WRITE_ONCE(*data, val); return 0; } EXPORT_SYMBOL_GPL(proc_dou8vec_minmax); --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17CD4CCA47F for ; Tue, 19 Jul 2022 12:36:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236727AbiGSMgX (ORCPT ); Tue, 19 Jul 2022 08:36:23 -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 S241303AbiGSMfF (ORCPT ); Tue, 19 Jul 2022 08:35:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17F9B7A51C; Tue, 19 Jul 2022 05:13: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 C479861790; Tue, 19 Jul 2022 12:13:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5B35C341C6; Tue, 19 Jul 2022 12:13:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232837; bh=vYI47gbvRwa4D61yUM/4ccDc9QQ84z1qHI8IlgKOg+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xfcybNWt3bdlYB0DRCNjRLlHn8EBH/eMJYF2lwELAwBkiQVYM2rrHpaAtJAaKWrjg iqGkI8+bQm7A2AmV/NEc5FTlQTG1L+Az3Yry7IRp8w63dXsbz9K4I6nuQCq6roBDV8 uAvfkLrhxX/v6s2tQfgILWT4Zalx76P3rsWtcClI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 083/167] sysctl: Fix data-races in proc_dointvec_ms_jiffies(). Date: Tue, 19 Jul 2022 13:53:35 +0200 Message-Id: <20220719114704.606994643@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 7d1025e559782b58824b36cb8ad547a69f2e4b31 ] A sysctl variable is accessed concurrently, and there is always a chance of data-race. So, all readers and writers need some basic protection to avoid load/store-tearing. This patch changes proc_dointvec_ms_jiffies() to use READ_ONCE() and WRITE_ONCE() internally to fix data-races on the sysctl side. For now, proc_dointvec_ms_jiffies() itself is tolerant to a data-race, but we still need to add annotations on the other subsystem's side. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- kernel/sysctl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 357900d0cef9..79cbfd0fa3be 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1415,9 +1415,9 @@ static int do_proc_dointvec_ms_jiffies_conv(bool *neg= p, unsigned long *lvalp, =20 if (jif > INT_MAX) return 1; - *valp =3D (int)jif; + WRITE_ONCE(*valp, (int)jif); } else { - int val =3D *valp; + int val =3D READ_ONCE(*valp); unsigned long lval; if (val < 0) { *negp =3D true; @@ -1485,8 +1485,8 @@ int proc_dointvec_userhz_jiffies(struct ctl_table *ta= ble, int write, * @ppos: the current position in the file * * Reads/writes up to table->maxlen/sizeof(unsigned int) integer - * values from/to the user buffer, treated as an ASCII string.=20 - * The values read are assumed to be in 1/1000 seconds, and=20 + * values from/to the user buffer, treated as an ASCII string. + * The values read are assumed to be in 1/1000 seconds, and * are converted into jiffies. * * Returns 0 on success. --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABDCFCCA47F for ; Tue, 19 Jul 2022 12:36:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240840AbiGSMgt (ORCPT ); Tue, 19 Jul 2022 08:36:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240684AbiGSMgD (ORCPT ); Tue, 19 Jul 2022 08:36: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 AAF5E7AC04; Tue, 19 Jul 2022 05: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 ams.source.kernel.org (Postfix) with ESMTPS id 42189B81B2C; Tue, 19 Jul 2022 12:14:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91B96C341C6; Tue, 19 Jul 2022 12:13:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232840; bh=50bzqRmsuWAfG9RmZyC3M8uiqu58poKkW+EdzcIxw8A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NrzdiAbh5HrBKOSZYR2aqL6o2w3L11VZ6qJqlYnJcQ7qo9Cp83K0+Hg9u8rKl5mZz sCrugJXbfbnfL8N2W9/wiKAPacVBTYyPEyXHYNvlTCE7myzDq49hT6RxMDFWOrEOED PNFebb9tesB4fcjo37SE6mTmrzdxswNGDuvoPmy0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 084/167] icmp: Fix data-races around sysctl_icmp_echo_enable_probe. Date: Tue, 19 Jul 2022 13:53:36 +0200 Message-Id: <20220719114704.709030853@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 4a2f7083cc6cb72dade9a63699ca352fad26d1cd ] While reading sysctl_icmp_echo_enable_probe, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers. Fixes: d329ea5bd884 ("icmp: add response to RFC 8335 PROBE messages") Fixes: 1fd07f33c3ea ("ipv6: ICMPV6: add response to ICMPV6 RFC 8335 PROBE m= essages") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv4/icmp.c | 2 +- net/ipv6/icmp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index b5766b62ca97..91be44180dd5 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -1034,7 +1034,7 @@ bool icmp_build_probe(struct sk_buff *skb, struct icm= phdr *icmphdr) u16 ident_len; u8 status; =20 - if (!net->ipv4.sysctl_icmp_echo_enable_probe) + if (!READ_ONCE(net->ipv4.sysctl_icmp_echo_enable_probe)) return false; =20 /* We currently only support probing interfaces on the proxy node diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index 96c5cc0f30ce..716e7717fe8f 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c @@ -927,7 +927,7 @@ static int icmpv6_rcv(struct sk_buff *skb) break; case ICMPV6_EXT_ECHO_REQUEST: if (!net->ipv6.sysctl.icmpv6_echo_ignore_all && - net->ipv4.sysctl_icmp_echo_enable_probe) + READ_ONCE(net->ipv4.sysctl_icmp_echo_enable_probe)) icmpv6_echo_reply(skb); break; =20 --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EA64C433EF for ; Tue, 19 Jul 2022 12:38:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240986AbiGSMiK (ORCPT ); Tue, 19 Jul 2022 08:38:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238389AbiGSMhj (ORCPT ); Tue, 19 Jul 2022 08:37:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41EE07B371; Tue, 19 Jul 2022 05:14: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 6FB5E617B2; Tue, 19 Jul 2022 12:14:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AD07C341C6; Tue, 19 Jul 2022 12:14:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232845; bh=7M6lv56eSXqjUd7Uyxbls7iULV5IVYc4PzsEmltCBpg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PuJLjMYsVu48M7rHfSVUWX2xM06XF/aJ2wIRa34RhbZb2fm9NkLm1ze4C7QywOxFX ANoWmSEnSy+VWVKHRXFa8ci4+6GK35/7EE+NyfsrIX+2iX3mdhThJEyB9IVC2cadB9 A9yymvFpPF1KRaG2AhrjeUpPgnTXn7A3nGXrFOlc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 085/167] icmp: Fix a data-race around sysctl_icmp_ignore_bogus_error_responses. Date: Tue, 19 Jul 2022 13:53:37 +0200 Message-Id: <20220719114704.803039438@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit b04f9b7e85c7d7aecbada620e8759a662af068d3 ] While reading sysctl_icmp_ignore_bogus_error_responses, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv4/icmp.c | 2 +- net/ipv4/sysctl_net_ipv4.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 91be44180dd5..6f444b2b7d1a 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -939,7 +939,7 @@ static bool icmp_unreach(struct sk_buff *skb) * get the other vendor to fix their kit. */ =20 - if (!net->ipv4.sysctl_icmp_ignore_bogus_error_responses && + if (!READ_ONCE(net->ipv4.sysctl_icmp_ignore_bogus_error_responses) && inet_addr_type_dev_table(net, skb->dev, iph->daddr) =3D=3D RTN_BROADC= AST) { net_warn_ratelimited("%pI4 sent an invalid ICMP type %u, code %u error t= o a broadcast: %pI4 on %s\n", &ip_hdr(skb)->saddr, diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 6f1e64d49232..51863031b178 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -639,6 +639,8 @@ static struct ctl_table ipv4_net_table[] =3D { .maxlen =3D sizeof(u8), .mode =3D 0644, .proc_handler =3D proc_dou8vec_minmax, + .extra1 =3D SYSCTL_ZERO, + .extra2 =3D SYSCTL_ONE }, { .procname =3D "icmp_errors_use_inbound_ifaddr", --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56D84C433EF for ; Tue, 19 Jul 2022 12:37:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240766AbiGSMg7 (ORCPT ); Tue, 19 Jul 2022 08:36:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240744AbiGSMgU (ORCPT ); Tue, 19 Jul 2022 08:36: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 B9AA0796B7; Tue, 19 Jul 2022 05:14: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 3BECD6178A; Tue, 19 Jul 2022 12:14:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08E4BC341C6; Tue, 19 Jul 2022 12:14:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232848; bh=iRdcB/QDuKaxQEa1v+agCnxuXz0oKFDO+q7CXH6ZxRg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zaT9FFf+VAWS9bAhw8Rm7T8U7Pj/iz+MlnjYkrfiVn5na366ejshJqzjbWd4qWJH0 W0OiXDSwAkLDxFB1GLiSl3sAl6W0EU5ONi3ALf9tbiMlYIeYdouDIys7S16FFxfXE9 /ZQXGQS1mGutOA/80vD2Qh6G/BtzBb3XlPnqRpJs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 086/167] icmp: Fix a data-race around sysctl_icmp_errors_use_inbound_ifaddr. Date: Tue, 19 Jul 2022 13:53:38 +0200 Message-Id: <20220719114704.885929079@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit d2efabce81db7eed1c98fa1a3f203f0edd738ac3 ] While reading sysctl_icmp_errors_use_inbound_ifaddr, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 1c2fb7f93cb2 ("[IPV4]: Sysctl configurable icmp error source address= .") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv4/icmp.c | 2 +- net/ipv4/sysctl_net_ipv4.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 6f444b2b7d1a..e40a79bb0a6e 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -702,7 +702,7 @@ void __icmp_send(struct sk_buff *skb_in, int type, int = code, __be32 info, =20 rcu_read_lock(); if (rt_is_input_route(rt) && - net->ipv4.sysctl_icmp_errors_use_inbound_ifaddr) + READ_ONCE(net->ipv4.sysctl_icmp_errors_use_inbound_ifaddr)) dev =3D dev_get_by_index_rcu(net, inet_iif(skb_in)); =20 if (dev) diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 51863031b178..49a8167dda87 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -648,6 +648,8 @@ static struct ctl_table ipv4_net_table[] =3D { .maxlen =3D sizeof(u8), .mode =3D 0644, .proc_handler =3D proc_dou8vec_minmax, + .extra1 =3D SYSCTL_ZERO, + .extra2 =3D SYSCTL_ONE }, { .procname =3D "icmp_ratelimit", --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91D89C43334 for ; Tue, 19 Jul 2022 12:41:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241331AbiGSMl1 (ORCPT ); Tue, 19 Jul 2022 08:41:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241344AbiGSMj2 (ORCPT ); Tue, 19 Jul 2022 08:39:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3B6052FF8; Tue, 19 Jul 2022 05:15: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 6786761632; Tue, 19 Jul 2022 12:15:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09437C341C6; Tue, 19 Jul 2022 12:15:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232947; bh=j9/B3Ca53uDImPSlqd+F+rDzRsmWMPhayQjW/luMp90=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IHMqj1Z+hq1c95Hmy+4y5cMdHhPLFEoTyop/wKz7XNX7kYqmwEp4Ba6y2PzZolSOO N+inUv16C9xgvhCXD7Qd3BJ9PYzgDB/drvjXxVqlceQ8YpWnB7LhMUl2tB/npuMaQ0 xOh+4HQpp1MOX4kKYKRpmrSLMYin1lUOKnzRJtpA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 087/167] icmp: Fix a data-race around sysctl_icmp_ratelimit. Date: Tue, 19 Jul 2022 13:53:39 +0200 Message-Id: <20220719114704.970196382@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 2a4eb714841f288cf51c7d942d98af6a8c6e4b01 ] While reading sysctl_icmp_ratelimit, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv4/icmp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index e40a79bb0a6e..3a36c198965d 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -328,7 +328,8 @@ static bool icmpv4_xrlim_allow(struct net *net, struct = rtable *rt, =20 vif =3D l3mdev_master_ifindex(dst->dev); peer =3D inet_getpeer_v4(net->ipv4.peers, fl4->daddr, vif, 1); - rc =3D inet_peer_xrlim_allow(peer, net->ipv4.sysctl_icmp_ratelimit); + rc =3D inet_peer_xrlim_allow(peer, + READ_ONCE(net->ipv4.sysctl_icmp_ratelimit)); if (peer) inet_putpeer(peer); out: --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59384C433EF for ; Tue, 19 Jul 2022 12:38:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240955AbiGSMid (ORCPT ); Tue, 19 Jul 2022 08:38:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240641AbiGSMh6 (ORCPT ); Tue, 19 Jul 2022 08:37:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2C2D481F9; Tue, 19 Jul 2022 05:14: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 AA72E61632; Tue, 19 Jul 2022 12:14:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B5C2C341C6; Tue, 19 Jul 2022 12:14:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232873; bh=ry4kiKt3UmNYvLsvajw9Uq5ZK43F+VcIgj1XyWLcDoE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lu3SeIwQkCdXUbHzZHt7ywyFFiVIBaqUe/E12SLw/jaPAmef4PzJVzrG4AOyBWKyf U4ololu2ohw2DxaVaVl2VCk7LI24MxgmWsYkxBKpxZoP3fT+D9SsCdbkJBGnYRDMYW lkonxfIORgYUHlwi9msFMeG86AiK+DlRYXSluloE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 088/167] icmp: Fix a data-race around sysctl_icmp_ratemask. Date: Tue, 19 Jul 2022 13:53:40 +0200 Message-Id: <20220719114705.056344606@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 1ebcb25ad6fc3d50fca87350acf451b9a66dd31e ] While reading sysctl_icmp_ratemask, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv4/icmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 3a36c198965d..a5cc89506c1e 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -290,7 +290,7 @@ static bool icmpv4_mask_allow(struct net *net, int type= , int code) return true; =20 /* Limit if icmp type is enabled in ratemask. */ - if (!((1 << type) & net->ipv4.sysctl_icmp_ratemask)) + if (!((1 << type) & READ_ONCE(net->ipv4.sysctl_icmp_ratemask))) return true; =20 return false; --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 686CCC433EF for ; Tue, 19 Jul 2022 12:40:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240641AbiGSMkE (ORCPT ); Tue, 19 Jul 2022 08:40:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241010AbiGSMi0 (ORCPT ); Tue, 19 Jul 2022 08:38: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 5277B10B6; Tue, 19 Jul 2022 05:15: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 DE20260F10; Tue, 19 Jul 2022 12:15:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE0EDC341C6; Tue, 19 Jul 2022 12:15:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232905; bh=cZgTHkVtlok+T5XHfZpzvaVm/8OrIF2Ls//nqAw6xA0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NY3bFtW6zg8XB06LfozKNj5pGh+obLja4qA4Z3jGB1uqeV8qP63N9hfaHSKyiQG5Y sjXphQXsg8uaz2ij/2ps+D34EStmmDgZ8pT23uZ6pujubn2o+5C7u4DfUgLNIMP3TI mQHjyECPdojRf4/XQClusQH6a+7oU+g1JVmeAplQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 089/167] raw: Fix a data-race around sysctl_raw_l3mdev_accept. Date: Tue, 19 Jul 2022 13:53:41 +0200 Message-Id: <20220719114705.148608921@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 1dace014928e6e385363032d359a04dee9158af0 ] While reading sysctl_raw_l3mdev_accept, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 6897445fb194 ("net: provide a sysctl raw_l3mdev_accept for raw socke= t lookup with VRFs") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- include/net/raw.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/raw.h b/include/net/raw.h index 8ad8df594853..c51a635671a7 100644 --- a/include/net/raw.h +++ b/include/net/raw.h @@ -75,7 +75,7 @@ static inline bool raw_sk_bound_dev_eq(struct net *net, i= nt bound_dev_if, int dif, int sdif) { #if IS_ENABLED(CONFIG_NET_L3_MASTER_DEV) - return inet_bound_dev_eq(!!net->ipv4.sysctl_raw_l3mdev_accept, + return inet_bound_dev_eq(READ_ONCE(net->ipv4.sysctl_raw_l3mdev_accept), bound_dev_if, dif, sdif); #else return inet_bound_dev_eq(true, bound_dev_if, dif, sdif); --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E425C43334 for ; Tue, 19 Jul 2022 12:40:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241326AbiGSMkx (ORCPT ); Tue, 19 Jul 2022 08:40:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241115AbiGSMiz (ORCPT ); Tue, 19 Jul 2022 08:38:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9916129C87; Tue, 19 Jul 2022 05:15:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2798F61632; Tue, 19 Jul 2022 12:15:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC670C341C6; Tue, 19 Jul 2022 12:15:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232925; bh=ZJSJzrQ/ud2KmT0rXxvBr/bjJ9OiqqmYvcpZppMlgZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ln5qcJl6xbswf32afhJHoiwk+kJrKVUka0xwfoiFud/b3MU7AEqz14TbLt51PNWa1 0eXKvMHUxw4mAiuQLl3YcURDZssK8kGdr/ZtGR1PGVlblYflbb1RlMTvFpqoUnWUYH kN8ShHt3wZL8WqudDKvsUVZHXtg0xIF3eQupKWNs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 090/167] tcp: Fix a data-race around sysctl_tcp_ecn_fallback. Date: Tue, 19 Jul 2022 13:53:42 +0200 Message-Id: <20220719114705.231101817@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 12b8d9ca7e678abc48195294494f1815b555d658 ] While reading sysctl_tcp_ecn_fallback, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 492135557dc0 ("tcp: add rfc3168, section 6.1.1.1. fallback") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv4/sysctl_net_ipv4.c | 2 ++ net/ipv4/tcp_output.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 49a8167dda87..616658e7c796 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -696,6 +696,8 @@ static struct ctl_table ipv4_net_table[] =3D { .maxlen =3D sizeof(u8), .mode =3D 0644, .proc_handler =3D proc_dou8vec_minmax, + .extra1 =3D SYSCTL_ZERO, + .extra2 =3D SYSCTL_ONE, }, { .procname =3D "ip_dynaddr", diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index dc3b4668fcde..509aab1b7ac9 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -346,7 +346,7 @@ static void tcp_ecn_send_syn(struct sock *sk, struct sk= _buff *skb) =20 static void tcp_ecn_clear_syn(struct sock *sk, struct sk_buff *skb) { - if (sock_net(sk)->ipv4.sysctl_tcp_ecn_fallback) + if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_ecn_fallback)) /* tp->ecn_flags are cleared at a later point in time when * SYN ACK is ultimatively being received. */ --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 150BCC43334 for ; Tue, 19 Jul 2022 12:40:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241347AbiGSMk4 (ORCPT ); Tue, 19 Jul 2022 08:40:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241213AbiGSMjN (ORCPT ); Tue, 19 Jul 2022 08:39:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C15E82DA8D; Tue, 19 Jul 2022 05:15:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1027260F10; Tue, 19 Jul 2022 12:15:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3106C341C6; Tue, 19 Jul 2022 12:15:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232928; bh=ptUMUYbP1ERJCm+DD853lDlnc7j+XBhZnBkNuXt1wDs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KmRxTnF1pRhEhR+P/h6iOArJNJliGnx00+cVGd0uAlkrMjYEtCULlGZnq6hKLWQzO 3d7zD6c4CeCAlSu2rOx7wT+0yn8yLgsbViVs8E9sGH+sHFGxdmaXcachD8HpnPI9EI pk/wqgPfyXM7mn4kbzfvmqjhcoct51YiqzBhj6rg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 091/167] ipv4: Fix data-races around sysctl_ip_dynaddr. Date: Tue, 19 Jul 2022 13:53:43 +0200 Message-Id: <20220719114705.321690924@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit e49e4aff7ec19b2d0d0957ee30e93dade57dab9e ] While reading sysctl_ip_dynaddr, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- Documentation/networking/ip-sysctl.rst | 2 +- net/ipv4/af_inet.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/networking/ip-sysctl.rst b/Documentation/network= ing/ip-sysctl.rst index 8d772484755a..b8b67041f955 100644 --- a/Documentation/networking/ip-sysctl.rst +++ b/Documentation/networking/ip-sysctl.rst @@ -1157,7 +1157,7 @@ ip_autobind_reuse - BOOLEAN option should only be set by experts. Default: 0 =20 -ip_dynaddr - BOOLEAN +ip_dynaddr - INTEGER If set non-zero, enables support for dynamic addresses. If set to a non-zero value larger than 1, a kernel log message will be printed when dynamic address rewriting diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 77534b44b8c7..44f21278003d 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -1251,7 +1251,7 @@ static int inet_sk_reselect_saddr(struct sock *sk) if (new_saddr =3D=3D old_saddr) return 0; =20 - if (sock_net(sk)->ipv4.sysctl_ip_dynaddr > 1) { + if (READ_ONCE(sock_net(sk)->ipv4.sysctl_ip_dynaddr) > 1) { pr_info("%s(): shifting inet->saddr from %pI4 to %pI4\n", __func__, &old_saddr, &new_saddr); } @@ -1306,7 +1306,7 @@ int inet_sk_rebuild_header(struct sock *sk) * Other protocols have to map its equivalent state to TCP_SYN_SENT. * DCCP maps its DCCP_REQUESTING state to TCP_SYN_SENT. -acme */ - if (!sock_net(sk)->ipv4.sysctl_ip_dynaddr || + if (!READ_ONCE(sock_net(sk)->ipv4.sysctl_ip_dynaddr) || sk->sk_state !=3D TCP_SYN_SENT || (sk->sk_userlocks & SOCK_BINDADDR_LOCK) || (err =3D inet_sk_reselect_saddr(sk)) !=3D 0) --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9614C433EF for ; Tue, 19 Jul 2022 12:41:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241356AbiGSMk7 (ORCPT ); Tue, 19 Jul 2022 08:40:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241250AbiGSMjQ (ORCPT ); Tue, 19 Jul 2022 08:39:16 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB2BB4E86B; Tue, 19 Jul 2022 05:15: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 582ACB81B2C; Tue, 19 Jul 2022 12:15:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7E55C341C6; Tue, 19 Jul 2022 12:15:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232931; bh=CEtsbmYi11VwkTcpvylIh79Ne3MbyQX0beNtqeTNKN4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=km0aq/8F5L7cGrKSlOICzvFrC1KS6vCYM1QGNMNH/mjYOVBaISc+lAzMGnnth1qWg HuuJmT7H3QiO6Qey7tD8D3qM42jpndrbl1LK2JJdvaW2fkHNd8OUw5zQbmHtch/ibq zfbX6qYvc1nK1rddLRcZLUxDXLTN1E44qUmUMTEg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 092/167] nexthop: Fix data-races around nexthop_compat_mode. Date: Tue, 19 Jul 2022 13:53:44 +0200 Message-Id: <20220719114705.410986956@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit bdf00bf24bef9be1ca641a6390fd5487873e0d2e ] While reading nexthop_compat_mode, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers. Fixes: 4f80116d3df3 ("net: ipv4: add sysctl for nexthop api compatibility m= ode") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv4/fib_semantics.c | 2 +- net/ipv4/nexthop.c | 5 +++-- net/ipv6/route.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index a98350dacbc3..674694d8ac61 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -1829,7 +1829,7 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u3= 2 seq, int event, goto nla_put_failure; if (nexthop_is_blackhole(fi->nh)) rtm->rtm_type =3D RTN_BLACKHOLE; - if (!fi->fib_net->ipv4.sysctl_nexthop_compat_mode) + if (!READ_ONCE(fi->fib_net->ipv4.sysctl_nexthop_compat_mode)) goto offload; } =20 diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c index 5dbd4b5505eb..cc8f120149f6 100644 --- a/net/ipv4/nexthop.c +++ b/net/ipv4/nexthop.c @@ -1857,7 +1857,7 @@ static void __remove_nexthop_fib(struct net *net, str= uct nexthop *nh) /* __ip6_del_rt does a release, so do a hold here */ fib6_info_hold(f6i); ipv6_stub->ip6_del_rt(net, f6i, - !net->ipv4.sysctl_nexthop_compat_mode); + !READ_ONCE(net->ipv4.sysctl_nexthop_compat_mode)); } } =20 @@ -2362,7 +2362,8 @@ static int insert_nexthop(struct net *net, struct nex= thop *new_nh, if (!rc) { nh_base_seq_inc(net); nexthop_notify(RTM_NEWNEXTHOP, new_nh, &cfg->nlinfo); - if (replace_notify && net->ipv4.sysctl_nexthop_compat_mode) + if (replace_notify && + READ_ONCE(net->ipv4.sysctl_nexthop_compat_mode)) nexthop_replace_notify(net, new_nh, &cfg->nlinfo); } =20 diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 4ca754c360a3..27274fc3619a 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -5756,7 +5756,7 @@ static int rt6_fill_node(struct net *net, struct sk_b= uff *skb, if (nexthop_is_blackhole(rt->nh)) rtm->rtm_type =3D RTN_BLACKHOLE; =20 - if (net->ipv4.sysctl_nexthop_compat_mode && + if (READ_ONCE(net->ipv4.sysctl_nexthop_compat_mode) && rt6_fill_node_nexthop(skb, rt->nh, &nh_flags) < 0) goto nla_put_failure; =20 --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B276C43334 for ; Tue, 19 Jul 2022 12:41:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241366AbiGSMlD (ORCPT ); Tue, 19 Jul 2022 08:41:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241262AbiGSMjR (ORCPT ); Tue, 19 Jul 2022 08:39: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 4D85152E6F; Tue, 19 Jul 2022 05:15: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 A878761632; Tue, 19 Jul 2022 12:15:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B1C8C341C6; Tue, 19 Jul 2022 12:15:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232933; bh=XwdC2Mvu0pmIULv7JlpXj04rrJOeCSe8z2w/gfVikHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KBTjGl3EB5cjSJGtwLB79WuQkundI9+noR1OlStrEVa8F9ggcUHf7+esga7PYLaPp DCBVAUmiBxUO7LU/FUmCK9QPdKaA+dFTuxjuzpoEjbBDBLaGyR2MTw3TF+K76OI2VU fqYzY20ClVIsGdTd3t+x2nApMwpfekJFypymUTXg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 093/167] net: ftgmac100: Hold reference returned by of_get_child_by_name() Date: Tue, 19 Jul 2022 13:53:45 +0200 Message-Id: <20220719114705.512446350@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 49b9f431ff0d845a36be0b3ede35ec324f2e5fee ] In ftgmac100_probe(), we should hold the refernece returned by of_get_child_by_name() and use it to call of_node_put() for reference balance. Fixes: 39bfab8844a0 ("net: ftgmac100: Add support for DT phy-handle propert= y") Signed-off-by: Liang He Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/faraday/ftgmac100.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/etherne= t/faraday/ftgmac100.c index 0b833572205f..4a2dadb91f02 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1746,6 +1746,19 @@ static int ftgmac100_setup_clk(struct ftgmac100 *pri= v) return rc; } =20 +static bool ftgmac100_has_child_node(struct device_node *np, const char *n= ame) +{ + struct device_node *child_np =3D of_get_child_by_name(np, name); + bool ret =3D false; + + if (child_np) { + ret =3D true; + of_node_put(child_np); + } + + return ret; +} + static int ftgmac100_probe(struct platform_device *pdev) { struct resource *res; @@ -1865,7 +1878,7 @@ static int ftgmac100_probe(struct platform_device *pd= ev) =20 /* Display what we found */ phy_attached_info(phy); - } else if (np && !of_get_child_by_name(np, "mdio")) { + } else if (np && !ftgmac100_has_child_node(np, "mdio")) { /* Support legacy ASPEED devicetree descriptions that decribe a * MAC with an embedded MDIO controller but have no "mdio" * child node. Automatically scan the MDIO bus for available --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7697C433EF for ; Tue, 19 Jul 2022 12:41:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241389AbiGSMlL (ORCPT ); Tue, 19 Jul 2022 08:41:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241287AbiGSMjT (ORCPT ); Tue, 19 Jul 2022 08:39:19 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0ED6141D31; Tue, 19 Jul 2022 05:15: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 sin.source.kernel.org (Postfix) with ESMTPS id 60B5BCE1BD6; Tue, 19 Jul 2022 12:15:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53FB6C341C6; Tue, 19 Jul 2022 12:15:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232936; bh=4Ae9WzvhYzV9DqfC1sH5vWDfWr4NdbtZgH8jm50vzHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jAivdXXhZJo9JAj7yIce1PrgInTx0xHt3C310/2aZ1CEfxpvpxgt1hh8JgfB2AMOJ dQIX13KTSexNBwkuIbgQepTfUY1LFWjFidM6s60DqOG5hKdgYQehEQALWlezG+onxh PEChvQpZwFetzYSWb2Ucu3JybYQeTZegF0IatJwc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 094/167] net: stmmac: fix leaks in probe Date: Tue, 19 Jul 2022 13:53:46 +0200 Message-Id: <20220719114705.592488765@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit 23aa6d5088e3bd65de77c5c307237b9937f8b48a ] These two error paths should clean up before returning. Fixes: 2bb4b98b60d7 ("net: stmmac: Add Ingenic SoCs MAC support.") Signed-off-by: Dan Carpenter Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c b/drivers/= net/ethernet/stmicro/stmmac/dwmac-ingenic.c index 9a6d819b84ae..378b4dd826bb 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c @@ -273,7 +273,8 @@ static int ingenic_mac_probe(struct platform_device *pd= ev) mac->tx_delay =3D tx_delay_ps * 1000; } else { dev_err(&pdev->dev, "Invalid TX clock delay: %dps\n", tx_delay_ps); - return -EINVAL; + ret =3D -EINVAL; + goto err_remove_config_dt; } } =20 @@ -283,7 +284,8 @@ static int ingenic_mac_probe(struct platform_device *pd= ev) mac->rx_delay =3D rx_delay_ps * 1000; } else { dev_err(&pdev->dev, "Invalid RX clock delay: %dps\n", rx_delay_ps); - return -EINVAL; + ret =3D -EINVAL; + goto err_remove_config_dt; } } =20 --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1218C433EF for ; Tue, 19 Jul 2022 12:41:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241125AbiGSMlS (ORCPT ); Tue, 19 Jul 2022 08:41:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241313AbiGSMjU (ORCPT ); Tue, 19 Jul 2022 08:39: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 4EC8C52FC8; Tue, 19 Jul 2022 05:15: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 C9C90B81B08; Tue, 19 Jul 2022 12:15:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34B69C341CA; Tue, 19 Jul 2022 12:15:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232939; bh=cG48VpzWujqCH5sdjCd+09tH1Hd3kq6jlJ2Ki0S3mII=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KskVcakUJBWozpQTKT44aXSo36ORgS9Wy1C6775JnsX9IiNMCNO4Ix0E4eETeefKT 6g6e/xsnfldTtmWqHzldhTdnlSpiBTU+nMqVnNGE5wvrCmg72RElmHACzLPnH3+VFQ EDK7zCOfNBdsPfZYWMR5H68tl5i8q1wceQ9xGK04= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Coiby Xu , Mimi Zohar , Sasha Levin Subject: [PATCH 5.15 095/167] ima: force signature verification when CONFIG_KEXEC_SIG is configured Date: Tue, 19 Jul 2022 13:53:47 +0200 Message-Id: <20220719114705.675324341@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Coiby Xu [ Upstream commit af16df54b89dee72df253abc5e7b5e8a6d16c11c ] Currently, an unsigned kernel could be kexec'ed when IMA arch specific policy is configured unless lockdown is enabled. Enforce kernel signature verification check in the kexec_file_load syscall when IMA arch specific policy is configured. Fixes: 99d5cadfde2b ("kexec_file: split KEXEC_VERIFY_SIG into KEXEC_SIG and= KEXEC_SIG_FORCE") Reported-and-suggested-by: Mimi Zohar Signed-off-by: Coiby Xu Signed-off-by: Mimi Zohar Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- include/linux/kexec.h | 6 ++++++ kernel/kexec_file.c | 11 ++++++++++- security/integrity/ima/ima_efi.c | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/include/linux/kexec.h b/include/linux/kexec.h index 33be67c2f7ff..cf042d41c87b 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -452,6 +452,12 @@ static inline int kexec_crash_loaded(void) { return 0;= } #define kexec_in_progress false #endif /* CONFIG_KEXEC_CORE */ =20 +#ifdef CONFIG_KEXEC_SIG +void set_kexec_sig_enforced(void); +#else +static inline void set_kexec_sig_enforced(void) {} +#endif + #endif /* !defined(__ASSEBMLY__) */ =20 #endif /* LINUX_KEXEC_H */ diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index e289e60ba3ad..f7a4fd4d243f 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -29,6 +29,15 @@ #include #include "kexec_internal.h" =20 +#ifdef CONFIG_KEXEC_SIG +static bool sig_enforce =3D IS_ENABLED(CONFIG_KEXEC_SIG_FORCE); + +void set_kexec_sig_enforced(void) +{ + sig_enforce =3D true; +} +#endif + static int kexec_calculate_store_digests(struct kimage *image); =20 /* @@ -159,7 +168,7 @@ kimage_validate_signature(struct kimage *image) image->kernel_buf_len); if (ret) { =20 - if (IS_ENABLED(CONFIG_KEXEC_SIG_FORCE)) { + if (sig_enforce) { pr_notice("Enforced kernel signature verification failed (%d).\n", ret); return ret; } diff --git a/security/integrity/ima/ima_efi.c b/security/integrity/ima/ima_= efi.c index 71786d01946f..9db66fe310d4 100644 --- a/security/integrity/ima/ima_efi.c +++ b/security/integrity/ima/ima_efi.c @@ -67,6 +67,8 @@ const char * const *arch_get_ima_policy(void) if (IS_ENABLED(CONFIG_IMA_ARCH_POLICY) && arch_ima_get_secureboot()) { if (IS_ENABLED(CONFIG_MODULE_SIG)) set_module_sig_enforced(); + if (IS_ENABLED(CONFIG_KEXEC_SIG)) + set_kexec_sig_enforced(); return sb_arch_rules; } return NULL; --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07830C433EF for ; Tue, 19 Jul 2022 12:41:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241308AbiGSMlY (ORCPT ); Tue, 19 Jul 2022 08:41:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241328AbiGSMjW (ORCPT ); Tue, 19 Jul 2022 08:39: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 B247A52FDF; Tue, 19 Jul 2022 05:15:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 48AC56178A; Tue, 19 Jul 2022 12:15:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13A91C341C6; Tue, 19 Jul 2022 12:15:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232944; bh=sXZL6Z37ACoS8mPQ/3ZughF+dsMb+90JYpKbHlk9Vzc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q0oA2wLBCByUtKMd5s7Eb5qjO2jYjiZFhOPoQT2DRw5l3eiVfOWkzg3sol6N1Lh5V 8dw5GPULp6KcifDb305aU0jNZz9Wn3hO2TpnICTOglfi9sG+js4ml0mDiZAEU/0xNE 9tH9Mu94cC/71F8WXji+Mjsp0/6g28HwKM0gxFig= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianglei Nie , Mimi Zohar , Sasha Levin Subject: [PATCH 5.15 096/167] ima: Fix potential memory leak in ima_init_crypto() Date: Tue, 19 Jul 2022 13:53:48 +0200 Message-Id: <20220719114705.765300501@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jianglei Nie [ Upstream commit 067d2521874135267e681c19d42761c601d503d6 ] On failure to allocate the SHA1 tfm, IMA fails to initialize and exits without freeing the ima_algo_array. Add the missing kfree() for ima_algo_array to avoid the potential memory leak. Signed-off-by: Jianglei Nie Fixes: 6d94809af6b0 ("ima: Allocate and initialize tfm for each PCR bank") Signed-off-by: Mimi Zohar Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- security/integrity/ima/ima_crypto.c | 1 + 1 file changed, 1 insertion(+) diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/i= ma_crypto.c index a7206cc1d7d1..64499056648a 100644 --- a/security/integrity/ima/ima_crypto.c +++ b/security/integrity/ima/ima_crypto.c @@ -205,6 +205,7 @@ int __init ima_init_crypto(void) =20 crypto_free_shash(ima_algo_array[i].tfm); } + kfree(ima_algo_array); out: crypto_free_shash(ima_shash_tfm); return rc; --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1AB48C433EF for ; Tue, 19 Jul 2022 12:38:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241072AbiGSMil (ORCPT ); Tue, 19 Jul 2022 08:38:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240868AbiGSMiK (ORCPT ); Tue, 19 Jul 2022 08:38:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2527E48CB9; Tue, 19 Jul 2022 05:14:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 136E8B81B2C; Tue, 19 Jul 2022 12:14:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 698A5C341C6; Tue, 19 Jul 2022 12:14:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232876; bh=56qZbx3cncrVIZ5NxaYEoRlyihlaVBC0ZdifBj4+yXA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OHlrOApUD641ifBdTq/wnpwfQoShjaYVlNve5Foq7x62csQ0B5FqqIhJzLHRa11MK 6AD6QzsF9KrJiVALWyN3Y3jLVz+qbdssVXrQrbV/nhKpmzSG4DGF9zQuksXkIUGN8B 6a/RibTcCbH/dsTxh0vJftf5KWtnD5SM6LtnOeec= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mario Kleiner , Alex Deucher , Harry Wentland , Sasha Levin Subject: [PATCH 5.15 097/167] drm/amd/display: Only use depth 36 bpp linebuffers on DCN display engines. Date: Tue, 19 Jul 2022 13:53:49 +0200 Message-Id: <20220719114705.846071785@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mario Kleiner [ Upstream commit add61d3c31de6a4b5e11a2ab96aaf4c873481568 ] Various DCE versions had trouble with 36 bpp lb depth, requiring fixes, last time in commit 353ca0fa5630 ("drm/amd/display: Fix 10bit 4K display on CIK GPUs") for DCE-8. So far >=3D DCE-11.2 was considered ok, but now I found out that on DCE-11.2 it causes dithering when there shouldn't be any, so identity pixel passthrough with identity gamma LUTs doesn't work when it should. This breaks various important neuroscience applications, as reported to me by scientific users of Polaris cards under Ubuntu 22.04 with Linux 5.15, and confirmed by testing it myself on DCE-11.2. Lets only use depth 36 for DCN engines, where my testing showed that it is both necessary for high color precision output, e.g., RGBA16 fb's, and not harmful, as far as more than one year in real-world use showed. DCE engines seem to work fine for high precision output at 30 bpp, so this ("famous last words") depth 30 should hopefully fix all known problems without introducing new ones. Successfully retested on DCE-11.2 Polaris and DCN-1.0 Raven Ridge on top of Linux 5.19.0-rc2 + drm-next. Fixes: 353ca0fa5630 ("drm/amd/display: Fix 10bit 4K display on CIK GPUs") Signed-off-by: Mario Kleiner Tested-by: Mario Kleiner Cc: stable@vger.kernel.org # 5.14.0 Cc: Alex Deucher Cc: Harry Wentland Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gp= u/drm/amd/display/dc/core/dc_resource.c index 82f1f27baaf3..188556e41b9d 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c @@ -1062,12 +1062,13 @@ bool resource_build_scaling_params(struct pipe_ctx = *pipe_ctx) * on certain displays, such as the Sharp 4k. 36bpp is needed * to support SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616 and * SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616 with actual > 10 bpc - * precision on at least DCN display engines. However, at least - * Carrizo with DCE_VERSION_11_0 does not like 36 bpp lb depth, - * so use only 30 bpp on DCE_VERSION_11_0. Testing with DCE 11.2 and 8.3 - * did not show such problems, so this seems to be the exception. + * precision on DCN display engines, but apparently not for DCE, as + * far as testing on DCE-11.2 and DCE-8 showed. Various DCE parts have + * problems: Carrizo with DCE_VERSION_11_0 does not like 36 bpp lb depth, + * neither do DCE-8 at 4k resolution, or DCE-11.2 (broken identify pixel + * passthrough). Therefore only use 36 bpp on DCN where it is actually ne= eded. */ - if (plane_state->ctx->dce_version > DCE_VERSION_11_0) + if (plane_state->ctx->dce_version > DCE_VERSION_MAX) pipe_ctx->plane_res.scl_data.lb_params.depth =3D LB_PIXEL_DEPTH_36BPP; else pipe_ctx->plane_res.scl_data.lb_params.depth =3D LB_PIXEL_DEPTH_30BPP; --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D968CC433EF for ; Tue, 19 Jul 2022 12:38:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238347AbiGSMio (ORCPT ); Tue, 19 Jul 2022 08:38:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241021AbiGSMiK (ORCPT ); Tue, 19 Jul 2022 08:38:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D18A48E93; Tue, 19 Jul 2022 05:14: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 CC9DEB81B2E; Tue, 19 Jul 2022 12:14:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36AA5C341C6; Tue, 19 Jul 2022 12:14:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232879; bh=O9al60/sdL+jit1M+gf1vVMmjpTVz41snS5/sD9cFeg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sTVqRMrGbc87JV2s2PHydEd8YbDqAI7lZrnVy/L4vi5zd6vX6CStLuIejP9/Am1hk MWMdYY3lrIHPG16nM/4bcXBvWpEm7jPmifjNTNF7zIEPNExVnUeKt75Cs1B4uYQFse IKvI746Kam+efDTLYfd0NGVEX9uebXc9BxZRI13M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Evan Quan , =?UTF-8?q?Andr=C3=A9=20Almeida?= , Yefim Barashkin , Alex Deucher , Sasha Levin Subject: [PATCH 5.15 098/167] drm/amd/pm: Prevent divide by zero Date: Tue, 19 Jul 2022 13:53:50 +0200 Message-Id: <20220719114705.929728889@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yefim Barashkin [ Upstream commit 0638c98c17aa12fe914459c82cd178247e21fb2b ] divide error: 0000 [#1] SMP PTI CPU: 3 PID: 78925 Comm: tee Not tainted 5.15.50-1-lts #1 Hardware name: MSI MS-7A59/Z270 SLI PLUS (MS-7A59), BIOS 1.90 01/30/2018 RIP: 0010:smu_v11_0_set_fan_speed_rpm+0x11/0x110 [amdgpu] Speed is user-configurable through a file. I accidentally set it to zero, and the driver crashed. Reviewed-by: Evan Quan Reviewed-by: Andr=C3=A9 Almeida Signed-off-by: Yefim Barashkin Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/d= rm/amd/pm/swsmu/smu11/smu_v11_0.c index e6c93396434f..614c3d049514 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c @@ -1235,6 +1235,8 @@ int smu_v11_0_set_fan_speed_rpm(struct smu_context *s= mu, uint32_t crystal_clock_freq =3D 2500; uint32_t tach_period; =20 + if (speed =3D=3D 0) + return -EINVAL; /* * To prevent from possible overheat, some ASICs may have requirement * for minimum fan speed: --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78DA3C433EF for ; Tue, 19 Jul 2022 12:38:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241094AbiGSMir (ORCPT ); Tue, 19 Jul 2022 08:38:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241022AbiGSMiM (ORCPT ); Tue, 19 Jul 2022 08:38:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97BEA491DA; Tue, 19 Jul 2022 05:14: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 2E7A160F10; Tue, 19 Jul 2022 12:14:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AB9FC341C6; Tue, 19 Jul 2022 12:14:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232882; bh=pICYGzsPyb3Cr3w3nKiZNi1nfzcrhdKuuanHrSSfq8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZCbhcf2gbPNvfgalW+jWxDQMvXHLtplwUqzv3G1agUanrDTCjWdRwxGElmfmmTNnb FM/xFkxAgumJlF6gSdPQcUP/WiCDnd3IYHQkK4QSkVuGFQThr+h8aXtJ5KBRwq0byd tHcymkHJbky2L/r7N4EIc8T0z9wlTV/1fuo58aas= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yanghang Liu , =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= , Martin Habets , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 099/167] sfc: fix use after free when disabling sriov Date: Tue, 19 Jul 2022 13:53:51 +0200 Message-Id: <20220719114706.019714700@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: =C3=8D=C3=B1igo Huguet [ Upstream commit ebe41da5d47ac0fff877e57bd14c54dccf168827 ] Use after free is detected by kfence when disabling sriov. What was read after being freed was vf->pci_dev: it was freed from pci_disable_sriov and later read in efx_ef10_sriov_free_vf_vports, called from efx_ef10_sriov_free_vf_vswitching. Set the pointer to NULL at release time to not trying to read it later. Reproducer and dmesg log (note that kfence doesn't detect it every time): $ echo 1 > /sys/class/net/enp65s0f0np0/device/sriov_numvfs $ echo 0 > /sys/class/net/enp65s0f0np0/device/sriov_numvfs BUG: KFENCE: use-after-free read in efx_ef10_sriov_free_vf_vswitching+0x82= /0x170 [sfc] Use-after-free read at 0x00000000ff3c1ba5 (in kfence-#224): efx_ef10_sriov_free_vf_vswitching+0x82/0x170 [sfc] efx_ef10_pci_sriov_disable+0x38/0x70 [sfc] efx_pci_sriov_configure+0x24/0x40 [sfc] sriov_numvfs_store+0xfe/0x140 kernfs_fop_write_iter+0x11c/0x1b0 new_sync_write+0x11f/0x1b0 vfs_write+0x1eb/0x280 ksys_write+0x5f/0xe0 do_syscall_64+0x5c/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xae kfence-#224: 0x00000000edb8ef95-0x00000000671f5ce1, size=3D2792, cache=3Dk= malloc-4k allocated by task 6771 on cpu 10 at 3137.860196s: pci_alloc_dev+0x21/0x60 pci_iov_add_virtfn+0x2a2/0x320 sriov_enable+0x212/0x3e0 efx_ef10_sriov_configure+0x67/0x80 [sfc] efx_pci_sriov_configure+0x24/0x40 [sfc] sriov_numvfs_store+0xba/0x140 kernfs_fop_write_iter+0x11c/0x1b0 new_sync_write+0x11f/0x1b0 vfs_write+0x1eb/0x280 ksys_write+0x5f/0xe0 do_syscall_64+0x5c/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xae freed by task 6771 on cpu 12 at 3170.991309s: device_release+0x34/0x90 kobject_cleanup+0x3a/0x130 pci_iov_remove_virtfn+0xd9/0x120 sriov_disable+0x30/0xe0 efx_ef10_pci_sriov_disable+0x57/0x70 [sfc] efx_pci_sriov_configure+0x24/0x40 [sfc] sriov_numvfs_store+0xfe/0x140 kernfs_fop_write_iter+0x11c/0x1b0 new_sync_write+0x11f/0x1b0 vfs_write+0x1eb/0x280 ksys_write+0x5f/0xe0 do_syscall_64+0x5c/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xae Fixes: 3c5eb87605e85 ("sfc: create vports for VFs and assign random MAC add= resses") Reported-by: Yanghang Liu Signed-off-by: =C3=8D=C3=B1igo Huguet Acked-by: Martin Habets Link: https://lore.kernel.org/r/20220712062642.6915-1-ihuguet@redhat.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/sfc/ef10_sriov.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/sfc/ef10_sriov.c b/drivers/net/ethernet/s= fc/ef10_sriov.c index 752d6406f07e..f488461a23d1 100644 --- a/drivers/net/ethernet/sfc/ef10_sriov.c +++ b/drivers/net/ethernet/sfc/ef10_sriov.c @@ -408,8 +408,9 @@ static int efx_ef10_pci_sriov_enable(struct efx_nic *ef= x, int num_vfs) static int efx_ef10_pci_sriov_disable(struct efx_nic *efx, bool force) { struct pci_dev *dev =3D efx->pci_dev; + struct efx_ef10_nic_data *nic_data =3D efx->nic_data; unsigned int vfs_assigned =3D pci_vfs_assigned(dev); - int rc =3D 0; + int i, rc =3D 0; =20 if (vfs_assigned && !force) { netif_info(efx, drv, efx->net_dev, "VFs are assigned to guests; " @@ -417,10 +418,13 @@ static int efx_ef10_pci_sriov_disable(struct efx_nic = *efx, bool force) return -EBUSY; } =20 - if (!vfs_assigned) + if (!vfs_assigned) { + for (i =3D 0; i < efx->vf_count; i++) + nic_data->vf[i].pci_dev =3D NULL; pci_disable_sriov(dev); - else + } else { rc =3D -EBUSY; + } =20 efx_ef10_sriov_free_vf_vswitching(efx); efx->vf_count =3D 0; --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0096C43334 for ; Tue, 19 Jul 2022 12:38:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241105AbiGSMix (ORCPT ); Tue, 19 Jul 2022 08:38:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240990AbiGSMiP (ORCPT ); Tue, 19 Jul 2022 08:38: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 C2FB24BD11; Tue, 19 Jul 2022 05:14:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 81115B81B08; Tue, 19 Jul 2022 12:14:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E03D8C341C6; Tue, 19 Jul 2022 12:14:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232885; bh=aEI8Mf2hTpeqLGJUU72cYnxpvzGp2z0G5ABV6Ey3eJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vqn9smOVQb7dcgmn2ovJuyKaTg8+QlFyWdm8RzTQSYUrhET9dyi5xbovpfywgHjex oHJTZ7+JzXZIBwZsGoXE3S/sZSZUVucI5AnduM+OsCXzxFW9UveA3D1P3F+VjpQf8c VThNJ/db/5GZQzMBNgxzOMg19qK86UD19WN+ylm8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff Layton , Ilya Dryomov , Sasha Levin Subject: [PATCH 5.15 100/167] ceph: switch netfs read ops to use rreq->inode instead of rreq->mapping->host Date: Tue, 19 Jul 2022 13:53:52 +0200 Message-Id: <20220719114706.114166733@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jeff Layton [ Upstream commit a25cedb4313d35e1f2968105678a47ca28e84d3b ] One fewer pointer dereference, and in the future we may not be able to count on the mapping pointer being populated (e.g. in the DIO case). Signed-off-by: Jeff Layton Signed-off-by: Ilya Dryomov Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- fs/ceph/addr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 99b80b5c7a93..b218a26291b8 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -179,7 +179,7 @@ static int ceph_releasepage(struct page *page, gfp_t gf= p) =20 static void ceph_netfs_expand_readahead(struct netfs_read_request *rreq) { - struct inode *inode =3D rreq->mapping->host; + struct inode *inode =3D rreq->inode; struct ceph_inode_info *ci =3D ceph_inode(inode); struct ceph_file_layout *lo =3D &ci->i_layout; u32 blockoff; @@ -196,7 +196,7 @@ static void ceph_netfs_expand_readahead(struct netfs_re= ad_request *rreq) =20 static bool ceph_netfs_clamp_length(struct netfs_read_subrequest *subreq) { - struct inode *inode =3D subreq->rreq->mapping->host; + struct inode *inode =3D subreq->rreq->inode; struct ceph_fs_client *fsc =3D ceph_inode_to_client(inode); struct ceph_inode_info *ci =3D ceph_inode(inode); u64 objno, objoff; @@ -242,7 +242,7 @@ static void finish_netfs_read(struct ceph_osd_request *= req) static void ceph_netfs_issue_op(struct netfs_read_subrequest *subreq) { struct netfs_read_request *rreq =3D subreq->rreq; - struct inode *inode =3D rreq->mapping->host; + struct inode *inode =3D rreq->inode; struct ceph_inode_info *ci =3D ceph_inode(inode); struct ceph_fs_client *fsc =3D ceph_inode_to_client(inode); struct ceph_osd_request *req; --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07BBACCA47F for ; Tue, 19 Jul 2022 12:38:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237904AbiGSMi5 (ORCPT ); Tue, 19 Jul 2022 08:38:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240886AbiGSMiR (ORCPT ); Tue, 19 Jul 2022 08:38:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA19A47BB6; Tue, 19 Jul 2022 05:14:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E195361632; Tue, 19 Jul 2022 12:14:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BECBCC341CB; Tue, 19 Jul 2022 12:14:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232888; bh=T0O0KgkJt/ofJDvterLLW1GOiWLpCRtQ9l7LyqAHt2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=flwQ4okAf2GhaqLW6QDTmzkn3JpQANn6GzY3gcsLk1CuPf7cz8xJsktzX2ZPTW0SS kj0Hb9/vNvj6wODUDz0I9BQuB5lERk2DH8KhamvD388XSjtDXDBr41L3V79YFGuri6 5m3rX7o6dCjn9dWSojoIG85MRYXlyDx7YzS72Elw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paolo Abeni , Andrea Mayer , Sasha Levin Subject: [PATCH 5.15 101/167] seg6: fix skb checksum evaluation in SRH encapsulation/insertion Date: Tue, 19 Jul 2022 13:53:53 +0200 Message-Id: <20220719114706.195980043@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrea Mayer [ Upstream commit df8386d13ea280d55beee1b95f61a59234a3798b ] Support for SRH encapsulation and insertion was introduced with commit 6c8702c60b88 ("ipv6: sr: add support for SRH encapsulation and injection with lwtunnels"), through the seg6_do_srh_encap() and seg6_do_srh_inline() functions, respectively. The former encapsulates the packet in an outer IPv6 header along with the SRH, while the latter inserts the SRH between the IPv6 header and the payload. Then, the headers are initialized/updated according to the operating mode (i.e., encap/inline). Finally, the skb checksum is calculated to reflect the changes applied to the headers. The IPv6 payload length ('payload_len') is not initialized within seg6_do_srh_{inline,encap}() but is deferred in seg6_do_srh(), i.e. the caller of seg6_do_srh_{inline,encap}(). However, this operation invalidates the skb checksum, since the 'payload_len' is updated only after the checksum is evaluated. To solve this issue, the initialization of the IPv6 payload length is moved from seg6_do_srh() directly into the seg6_do_srh_{inline,encap}() functions and before the skb checksum update takes place. Fixes: 6c8702c60b88 ("ipv6: sr: add support for SRH encapsulation and injec= tion with lwtunnels") Reported-by: Paolo Abeni Link: https://lore.kernel.org/all/20220705190727.69d532417be7438b15404ee1@u= niroma2.it Signed-off-by: Andrea Mayer Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv6/seg6_iptunnel.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/ipv6/seg6_iptunnel.c b/net/ipv6/seg6_iptunnel.c index d64855010948..e756ba705fd9 100644 --- a/net/ipv6/seg6_iptunnel.c +++ b/net/ipv6/seg6_iptunnel.c @@ -189,6 +189,8 @@ int seg6_do_srh_encap(struct sk_buff *skb, struct ipv6_= sr_hdr *osrh, int proto) } #endif =20 + hdr->payload_len =3D htons(skb->len - sizeof(struct ipv6hdr)); + skb_postpush_rcsum(skb, hdr, tot_len); =20 return 0; @@ -241,6 +243,8 @@ int seg6_do_srh_inline(struct sk_buff *skb, struct ipv6= _sr_hdr *osrh) } #endif =20 + hdr->payload_len =3D htons(skb->len - sizeof(struct ipv6hdr)); + skb_postpush_rcsum(skb, hdr, sizeof(struct ipv6hdr) + hdrlen); =20 return 0; @@ -302,7 +306,6 @@ static int seg6_do_srh(struct sk_buff *skb) break; } =20 - ipv6_hdr(skb)->payload_len =3D htons(skb->len - sizeof(struct ipv6hdr)); skb_set_transport_header(skb, sizeof(struct ipv6hdr)); nf_reset_ct(skb); =20 --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F3F1C433EF for ; Tue, 19 Jul 2022 12:39:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241128AbiGSMi7 (ORCPT ); Tue, 19 Jul 2022 08:38:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240994AbiGSMiW (ORCPT ); Tue, 19 Jul 2022 08:38:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6AC74D153; Tue, 19 Jul 2022 05:14: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 46C7FB81B29; Tue, 19 Jul 2022 12:14:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1C8AC341C6; Tue, 19 Jul 2022 12:14:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232891; bh=ojkrsQpUyQoW/vEofsOo3BR6BgbWsDcHx097a9IQHAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MBLrm+X2QOH3ez//3wLJim2gDEBPC8ripGebUFtP/GX3f/ixiRXxu06+9Q4DvcV+Z VzTpB/V/bxlIShn2K38ugOeznaqyATdgzBpliHIGr9/QSvdYufP7P9uUHCrrbVy1Dx /gySWqkzDJkJGUjwe5gllsQqXxSxWLRW3peWXv1Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrea Mayer , Paolo Abeni , Sasha Levin Subject: [PATCH 5.15 102/167] seg6: fix skb checksum in SRv6 End.B6 and End.B6.Encaps behaviors Date: Tue, 19 Jul 2022 13:53:54 +0200 Message-Id: <20220719114706.287397374@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrea Mayer [ Upstream commit f048880fc77058d864aff5c674af7918b30f312a ] The SRv6 End.B6 and End.B6.Encaps behaviors rely on functions seg6_do_srh_{encap,inline}() to, respectively: i) encapsulate the packet within an outer IPv6 header with the specified Segment Routing Header (SRH); ii) insert the specified SRH directly after the IPv6 header of the packet. This patch removes the initialization of the IPv6 header payload length from the input_action_end_b6{_encap}() functions, as it is now handled properly by seg6_do_srh_{encap,inline}() to avoid corruption of the skb checksum. Fixes: 140f04c33bbc ("ipv6: sr: implement several seg6local actions") Signed-off-by: Andrea Mayer Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/ipv6/seg6_local.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c index ef88489c71f5..59454285d5c5 100644 --- a/net/ipv6/seg6_local.c +++ b/net/ipv6/seg6_local.c @@ -824,7 +824,6 @@ static int input_action_end_b6(struct sk_buff *skb, str= uct seg6_local_lwt *slwt) if (err) goto drop; =20 - ipv6_hdr(skb)->payload_len =3D htons(skb->len - sizeof(struct ipv6hdr)); skb_set_transport_header(skb, sizeof(struct ipv6hdr)); =20 seg6_lookup_nexthop(skb, NULL, 0); @@ -856,7 +855,6 @@ static int input_action_end_b6_encap(struct sk_buff *sk= b, if (err) goto drop; =20 - ipv6_hdr(skb)->payload_len =3D htons(skb->len - sizeof(struct ipv6hdr)); skb_set_transport_header(skb, sizeof(struct ipv6hdr)); =20 seg6_lookup_nexthop(skb, NULL, 0); --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95159C433EF for ; Tue, 19 Jul 2022 12:39:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241134AbiGSMjC (ORCPT ); Tue, 19 Jul 2022 08:39:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238473AbiGSMiW (ORCPT ); Tue, 19 Jul 2022 08:38:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 376F34BD0D; Tue, 19 Jul 2022 05:14: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 B948E60F10; Tue, 19 Jul 2022 12:14:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8350BC341C6; Tue, 19 Jul 2022 12:14:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232893; bh=+r9ifSNjvcwGWvUxyHGxx4Fuw3pp4Jg0XN08SheBXQk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W28UIuhdsFIOGzD1JA1Gw89tJp5WVBsiYiewS/H+NAnyCaWPkh3j0vIWPTeP6knlM 9D0PJy2E/6dM53d4tjpNQUktOYNpLSjJ2HYv/14z9K0HRVJZ1rDAVCFMUGOltpT3nZ +X30LKNugaiKjsYrpVyt2hXDB/XS1/J/G0Q9vi1w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrea Mayer , Paolo Abeni , Sasha Levin Subject: [PATCH 5.15 103/167] seg6: bpf: fix skb checksum in bpf_push_seg6_encap() Date: Tue, 19 Jul 2022 13:53:55 +0200 Message-Id: <20220719114706.420976964@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrea Mayer [ Upstream commit 4889fbd98deaf243c3baadc54e296d71c6af1eb0 ] Both helper functions bpf_lwt_seg6_action() and bpf_lwt_push_encap() use the bpf_push_seg6_encap() to encapsulate the packet in an IPv6 with Segment Routing Header (SRH) or insert an SRH between the IPv6 header and the payload. To achieve this result, such helper functions rely on bpf_push_seg6_encap() which, in turn, leverages seg6_do_srh_{encap,inline}() to perform the required operation (i.e. encap/inline). This patch removes the initialization of the IPv6 header payload length from bpf_push_seg6_encap(), as it is now handled properly by seg6_do_srh_{encap,inline}() to prevent corruption of the skb checksum. Fixes: fe94cc290f53 ("bpf: Add IPv6 Segment Routing helpers") Signed-off-by: Andrea Mayer Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/core/filter.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/core/filter.c b/net/core/filter.c index d1e2ef77ce4c..8b2bc855714b 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -5851,7 +5851,6 @@ static int bpf_push_seg6_encap(struct sk_buff *skb, u= 32 type, void *hdr, u32 len if (err) return err; =20 - ipv6_hdr(skb)->payload_len =3D htons(skb->len - sizeof(struct ipv6hdr)); skb_set_transport_header(skb, sizeof(struct ipv6hdr)); =20 return seg6_lookup_nexthop(skb, NULL, 0); --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67D7FC43334 for ; Tue, 19 Jul 2022 12:40:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241147AbiGSMjJ (ORCPT ); Tue, 19 Jul 2022 08:39:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240735AbiGSMiX (ORCPT ); Tue, 19 Jul 2022 08:38: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 42EF64BD39; Tue, 19 Jul 2022 05:14:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E2CA2B81B29; Tue, 19 Jul 2022 12:14:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D1FFC341C6; Tue, 19 Jul 2022 12:14:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232896; bh=kfnaK3eA1fRrAQFih72sAk5S126R3DRIMX3bDdMoZiE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MBRNPCk1L1Igygp05lWIlHgsZ0fLJRYsij18MGzrMSQ14s1ziYEyKRBz6sgKp3Pvh G0MrH58ia1gnV6hKVXb3AEZjDY4WMn0MiuXbD4YIf0q/SETi4kJFCdhemiNHl2d0gs ZdAC4QWFxusj/pkrcjpSB8vxvfY0ug960T6BCkOI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ma Yuying , =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= , Edward Cree , Paolo Abeni , Sasha Levin Subject: [PATCH 5.15 104/167] sfc: fix kernel panic when creating VF Date: Tue, 19 Jul 2022 13:53:56 +0200 Message-Id: <20220719114706.509608754@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: =C3=8D=C3=B1igo Huguet [ Upstream commit ada74c5539eba06cf8b47d068f92e0b3963a9a6e ] When creating VFs a kernel panic can happen when calling to efx_ef10_try_update_nic_stats_vf. When releasing a DMA coherent buffer, sometimes, I don't know in what specific circumstances, it has to unmap memory with vunmap. It is disallowed to do that in IRQ context or with BH disabled. Otherwise, we hit this line in vunmap, causing the crash: BUG_ON(in_interrupt()); This patch reenables BH to release the buffer. Log messages when the bug is hit: kernel BUG at mm/vmalloc.c:2727! invalid opcode: 0000 [#1] PREEMPT SMP NOPTI CPU: 6 PID: 1462 Comm: NetworkManager Kdump: loaded Tainted: G I = --------- --- 5.14.0-119.el9.x86_64 #1 Hardware name: Dell Inc. PowerEdge R740/06WXJT, BIOS 2.8.2 08/27/2020 RIP: 0010:vunmap+0x2e/0x30 ...skip... Call Trace: __iommu_dma_free+0x96/0x100 efx_nic_free_buffer+0x2b/0x40 [sfc] efx_ef10_try_update_nic_stats_vf+0x14a/0x1c0 [sfc] efx_ef10_update_stats_vf+0x18/0x40 [sfc] efx_start_all+0x15e/0x1d0 [sfc] efx_net_open+0x5a/0xe0 [sfc] __dev_open+0xe7/0x1a0 __dev_change_flags+0x1d7/0x240 dev_change_flags+0x21/0x60 ...skip... Fixes: d778819609a2 ("sfc: DMA the VF stats only when requested") Reported-by: Ma Yuying Signed-off-by: =C3=8D=C3=B1igo Huguet Acked-by: Edward Cree Link: https://lore.kernel.org/r/20220713092116.21238-1-ihuguet@redhat.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/sfc/ef10.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef1= 0.c index c1cd1c97f09d..056c24ec1249 100644 --- a/drivers/net/ethernet/sfc/ef10.c +++ b/drivers/net/ethernet/sfc/ef10.c @@ -1932,7 +1932,10 @@ static int efx_ef10_try_update_nic_stats_vf(struct e= fx_nic *efx) =20 efx_update_sw_stats(efx, stats); out: + /* releasing a DMA coherent buffer with BH disabled can panic */ + spin_unlock_bh(&efx->stats_lock); efx_nic_free_buffer(efx, &stats_buf); + spin_lock_bh(&efx->stats_lock); return rc; } =20 --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C3D2C433EF for ; Tue, 19 Jul 2022 12:40:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241137AbiGSMjG (ORCPT ); Tue, 19 Jul 2022 08:39:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240916AbiGSMiX (ORCPT ); Tue, 19 Jul 2022 08:38:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C24684D146; Tue, 19 Jul 2022 05:15:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3710C61632; Tue, 19 Jul 2022 12:15:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17562C341C6; Tue, 19 Jul 2022 12:14:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232899; bh=7dVizbUshcZcXEg8DTB9O6088LdUH2iKBxS14dy8z6w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n4saAqF5BnZ5JYSFOb1sAQoaOLhXaOtlq4LPHsFtVXQDSRAt5t/9pb8LoD1cQThPJ KQCNCWJ0RsFFhBRUtccYrUdHefNmmy+REOdw3A9kZwuBbevl21UPPSWGnQgPt2Splx bNNiuLk06U8GeB7O2ure8rV+hZuZTq2xvQI26qJo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Chia-Lin Kao (AceLan)" , Paolo Abeni , Sasha Levin Subject: [PATCH 5.15 105/167] net: atlantic: remove deep parameter on suspend/resume functions Date: Tue, 19 Jul 2022 13:53:57 +0200 Message-Id: <20220719114706.613130474@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chia-Lin Kao (AceLan) [ Upstream commit 0f33250760384e05c36466b0a2f92f3c6007ba92 ] Below commit claims that atlantic NIC requires to reset the device on pm op, and had set the deep to true for all suspend/resume functions. commit 1809c30b6e5a ("net: atlantic: always deep reset on pm op, fixing up = my null deref regression") So, we could remove deep parameter on suspend/resume functions without any functional change. Fixes: 1809c30b6e5a ("net: atlantic: always deep reset on pm op, fixing up = my null deref regression") Signed-off-by: Chia-Lin Kao (AceLan) Link: https://lore.kernel.org/r/20220713111224.1535938-1-acelan.kao@canonic= al.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- .../ethernet/aquantia/atlantic/aq_pci_func.c | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c b/drivers= /net/ethernet/aquantia/atlantic/aq_pci_func.c index 831833911a52..dbd5263130f9 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c @@ -379,7 +379,7 @@ static void aq_pci_shutdown(struct pci_dev *pdev) } } =20 -static int aq_suspend_common(struct device *dev, bool deep) +static int aq_suspend_common(struct device *dev) { struct aq_nic_s *nic =3D pci_get_drvdata(to_pci_dev(dev)); =20 @@ -392,17 +392,15 @@ static int aq_suspend_common(struct device *dev, bool= deep) if (netif_running(nic->ndev)) aq_nic_stop(nic); =20 - if (deep) { - aq_nic_deinit(nic, !nic->aq_hw->aq_nic_cfg->wol); - aq_nic_set_power(nic); - } + aq_nic_deinit(nic, !nic->aq_hw->aq_nic_cfg->wol); + aq_nic_set_power(nic); =20 rtnl_unlock(); =20 return 0; } =20 -static int atl_resume_common(struct device *dev, bool deep) +static int atl_resume_common(struct device *dev) { struct pci_dev *pdev =3D to_pci_dev(dev); struct aq_nic_s *nic; @@ -415,10 +413,8 @@ static int atl_resume_common(struct device *dev, bool = deep) pci_set_power_state(pdev, PCI_D0); pci_restore_state(pdev); =20 - if (deep) { - /* Reinitialize Nic/Vecs objects */ - aq_nic_deinit(nic, !nic->aq_hw->aq_nic_cfg->wol); - } + /* Reinitialize Nic/Vecs objects */ + aq_nic_deinit(nic, !nic->aq_hw->aq_nic_cfg->wol); =20 if (netif_running(nic->ndev)) { ret =3D aq_nic_init(nic); @@ -444,22 +440,22 @@ static int atl_resume_common(struct device *dev, bool= deep) =20 static int aq_pm_freeze(struct device *dev) { - return aq_suspend_common(dev, true); + return aq_suspend_common(dev); } =20 static int aq_pm_suspend_poweroff(struct device *dev) { - return aq_suspend_common(dev, true); + return aq_suspend_common(dev); } =20 static int aq_pm_thaw(struct device *dev) { - return atl_resume_common(dev, true); + return atl_resume_common(dev); } =20 static int aq_pm_resume_restore(struct device *dev) { - return atl_resume_common(dev, true); + return atl_resume_common(dev); } =20 static const struct dev_pm_ops aq_pm_ops =3D { --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F960CCA487 for ; Tue, 19 Jul 2022 12:40:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241170AbiGSMkO (ORCPT ); Tue, 19 Jul 2022 08:40:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239116AbiGSMiZ (ORCPT ); Tue, 19 Jul 2022 08:38:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 969B3C5B; Tue, 19 Jul 2022 05:15: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 26D8B60F10; Tue, 19 Jul 2022 12:15:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECF98C341C6; Tue, 19 Jul 2022 12:15:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232902; bh=FX3acsEqsS0HF4T8PaNc5W2h67o+9MYPSUaaw3v9HPY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Io8NawtgMPP9NtDokkJo3ckr1Vw+w8EsOnQ08v89j0IBJ3lS5F17RpvTr/hmZrHiQ kiw6LjVYkN9s1epzfSAlkXzILH3j3KHmCFtUQEv/uSH6a1EKs7izfSQygcZNFi6LZK tn+4C0U7wQDR0ZX16C9CnHjn+b0clJVXSjvAWyi4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Chia-Lin Kao (AceLan)" , Paolo Abeni , Sasha Levin Subject: [PATCH 5.15 106/167] net: atlantic: remove aq_nic_deinit() when resume Date: Tue, 19 Jul 2022 13:53:58 +0200 Message-Id: <20220719114706.711249419@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chia-Lin Kao (AceLan) [ Upstream commit 2e15c51fefaffaf9f72255eaef4fada05055e4c5 ] aq_nic_deinit() has been called while suspending, so we don't have to call it again on resume. Actually, call it again leads to another hang issue when resuming from S3. Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992345] Call Trace: Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992346] Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992348] aq_nic_deinit+= 0xb4/0xd0 [atlantic] Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992356] aq_pm_thaw+0x7= f/0x100 [atlantic] Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992362] pci_pm_resume+= 0x5c/0x90 Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992366] ? pci_pm_thaw+= 0x80/0x80 Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992368] dpm_run_callba= ck+0x4e/0x120 Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992371] device_resume+= 0xad/0x200 Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992373] async_resume+0= x1e/0x40 Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992374] async_run_entr= y_fn+0x33/0x120 Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992377] process_one_wo= rk+0x220/0x3c0 Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992380] worker_thread+= 0x4d/0x3f0 Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992382] ? process_one_= work+0x3c0/0x3c0 Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992384] kthread+0x12a/= 0x150 Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992386] ? set_kthread_= struct+0x40/0x40 Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992387] ret_from_fork+= 0x22/0x30 Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992391] Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992392] ---[ end trace= 1ec8c79604ed5e0d ]--- Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992394] PM: dpm_run_ca= llback(): pci_pm_resume+0x0/0x90 returns -110 Jul 8 03:09:44 u-Precision-7865-Tower kernel: [ 5910.992397] atlantic 0000:= 02:00.0: PM: failed to resume async: error -110 Fixes: 1809c30b6e5a ("net: atlantic: always deep reset on pm op, fixing up = my null deref regression") Signed-off-by: Chia-Lin Kao (AceLan) Link: https://lore.kernel.org/r/20220713111224.1535938-2-acelan.kao@canonic= al.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c b/drivers= /net/ethernet/aquantia/atlantic/aq_pci_func.c index dbd5263130f9..8647125d60ae 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c @@ -413,9 +413,6 @@ static int atl_resume_common(struct device *dev) pci_set_power_state(pdev, PCI_D0); pci_restore_state(pdev); =20 - /* Reinitialize Nic/Vecs objects */ - aq_nic_deinit(nic, !nic->aq_hw->aq_nic_cfg->wol); - if (netif_running(nic->ndev)) { ret =3D aq_nic_init(nic); if (ret) --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA0D8CCA482 for ; Tue, 19 Jul 2022 12:40:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241208AbiGSMkS (ORCPT ); Tue, 19 Jul 2022 08:40:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240946AbiGSMi2 (ORCPT ); Tue, 19 Jul 2022 08:38:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0B8DF24; Tue, 19 Jul 2022 05:15: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 A315F61632; Tue, 19 Jul 2022 12:15:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86D85C341CB; Tue, 19 Jul 2022 12:15:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232907; bh=WRZFURQp2P4iWzJqKxN+UbfLRSjqwOhOH+3mdvRdMQM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u+cDasTGC8UjB+a5Rht1Ikdbe3bqhrhHAWutiXjno85Q6usYEFaiRcOYFupwHezcW bRZluCbjVdpWB5XA1V0+yhsNDBHcdtHHn0NGV7DQ/9NwnpPcFaNNkOBqLMc/Mrjpcr AzJIY50+udAwPtbM40JgKFL/9fWXNscw54gpiWTU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+d6caa905917d353f0d07@syzkaller.appspotmail.com, Vitaly Kuznetsov , Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.15 107/167] KVM: x86: Fully initialize struct kvm_lapic_irq in kvm_pv_kick_cpu_op() Date: Tue, 19 Jul 2022 13:53:59 +0200 Message-Id: <20220719114706.816459660@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vitaly Kuznetsov [ Upstream commit 8a414f943f8b5f94bbaafdec863d6f3dbef33f8a ] 'vector' and 'trig_mode' fields of 'struct kvm_lapic_irq' are left uninitialized in kvm_pv_kick_cpu_op(). While these fields are normally not needed for APIC_DM_REMRD, they're still referenced by __apic_accept_irq() for trace_kvm_apic_accept_irq(). Fully initialize the structure to avoid consuming random stack memory. Fixes: a183b638b61c ("KVM: x86: make apic_accept_irq tracepoint more generi= c") Reported-by: syzbot+d6caa905917d353f0d07@syzkaller.appspotmail.com Signed-off-by: Vitaly Kuznetsov Reviewed-by: Sean Christopherson Message-Id: <20220708125147.593975-1-vkuznets@redhat.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/x86/kvm/x86.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 8974884ef2ad..732c3f2f8ded 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -8713,15 +8713,17 @@ static int kvm_pv_clock_pairing(struct kvm_vcpu *vc= pu, gpa_t paddr, */ static void kvm_pv_kick_cpu_op(struct kvm *kvm, unsigned long flags, int a= picid) { - struct kvm_lapic_irq lapic_irq; - - lapic_irq.shorthand =3D APIC_DEST_NOSHORT; - lapic_irq.dest_mode =3D APIC_DEST_PHYSICAL; - lapic_irq.level =3D 0; - lapic_irq.dest_id =3D apicid; - lapic_irq.msi_redir_hint =3D false; + /* + * All other fields are unused for APIC_DM_REMRD, but may be consumed by + * common code, e.g. for tracing. Defer initialization to the compiler. + */ + struct kvm_lapic_irq lapic_irq =3D { + .delivery_mode =3D APIC_DM_REMRD, + .dest_mode =3D APIC_DEST_PHYSICAL, + .shorthand =3D APIC_DEST_NOSHORT, + .dest_id =3D apicid, + }; =20 - lapic_irq.delivery_mode =3D APIC_DM_REMRD; kvm_irq_delivery_to_apic(kvm, NULL, &lapic_irq, NULL); } =20 --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF7D7C43334 for ; Tue, 19 Jul 2022 12:42:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241429AbiGSMmG (ORCPT ); Tue, 19 Jul 2022 08:42:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240981AbiGSMif (ORCPT ); Tue, 19 Jul 2022 08:38:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E140F1021; Tue, 19 Jul 2022 05:15: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 997D36178A; Tue, 19 Jul 2022 12:15:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65E65C341C6; Tue, 19 Jul 2022 12:15:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232910; bh=m9gu0DjGRQ96LhVWoEcFTazZwPnxAlfRtFgoOVeM3uo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D8vGCCRIF4knq2asgdjyu6uBlJRIzoBN9VTe0OHiTIPMRaC20R2jO3IZW9IsSRkJr HdoCrw1lGMHAfHXTzuDnBMaFPvTQmS8rQZjx/89rBtxdOftaHff6KPO2WQSTmbz8/e it5HjAQc+7yQdRHrFVFm8XPgZXk1T6wFBbOHfw1w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jakub Kicinski , Maxim Mikityanskiy , Tariq Toukan , Sasha Levin Subject: [PATCH 5.15 108/167] net/tls: Check for errors in tls_device_init Date: Tue, 19 Jul 2022 13:54:00 +0200 Message-Id: <20220719114706.905606070@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tariq Toukan [ Upstream commit 3d8c51b25a235e283e37750943bbf356ef187230 ] Add missing error checks in tls_device_init. Fixes: e8f69799810c ("net/tls: Add generic NIC offload infrastructure") Reported-by: Jakub Kicinski Reviewed-by: Maxim Mikityanskiy Signed-off-by: Tariq Toukan Link: https://lore.kernel.org/r/20220714070754.1428-1-tariqt@nvidia.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- include/net/tls.h | 4 ++-- net/tls/tls_device.c | 4 ++-- net/tls/tls_main.c | 7 ++++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/net/tls.h b/include/net/tls.h index 1fffb206f09f..bf3d63a52788 100644 --- a/include/net/tls.h +++ b/include/net/tls.h @@ -707,7 +707,7 @@ int tls_sw_fallback_init(struct sock *sk, struct tls_crypto_info *crypto_info); =20 #ifdef CONFIG_TLS_DEVICE -void tls_device_init(void); +int tls_device_init(void); void tls_device_cleanup(void); void tls_device_sk_destruct(struct sock *sk); int tls_set_device_offload(struct sock *sk, struct tls_context *ctx); @@ -727,7 +727,7 @@ static inline bool tls_is_sk_rx_device_offloaded(struct= sock *sk) return tls_get_ctx(sk)->rx_conf =3D=3D TLS_HW; } #else -static inline void tls_device_init(void) {} +static inline int tls_device_init(void) { return 0; } static inline void tls_device_cleanup(void) {} =20 static inline int diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c index f3e3d009cf1c..4775431cbd38 100644 --- a/net/tls/tls_device.c +++ b/net/tls/tls_device.c @@ -1394,9 +1394,9 @@ static struct notifier_block tls_dev_notifier =3D { .notifier_call =3D tls_dev_event, }; =20 -void __init tls_device_init(void) +int __init tls_device_init(void) { - register_netdevice_notifier(&tls_dev_notifier); + return register_netdevice_notifier(&tls_dev_notifier); } =20 void __exit tls_device_cleanup(void) diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c index 62b1c5e32bbd..a947cfb100bd 100644 --- a/net/tls/tls_main.c +++ b/net/tls/tls_main.c @@ -910,7 +910,12 @@ static int __init tls_register(void) if (err) return err; =20 - tls_device_init(); + err =3D tls_device_init(); + if (err) { + unregister_pernet_subsys(&tls_proc_ops); + return err; + } + tcp_register_ulp(&tcp_tls_ulp_ops); =20 return 0; --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4ECB0C43334 for ; Tue, 19 Jul 2022 12:40:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241255AbiGSMk2 (ORCPT ); Tue, 19 Jul 2022 08:40:28 -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 S240983AbiGSMih (ORCPT ); Tue, 19 Jul 2022 08:38:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCD1765CF; Tue, 19 Jul 2022 05:15:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EA50AB81B08; Tue, 19 Jul 2022 12:15:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B7B0C341C6; Tue, 19 Jul 2022 12:15:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232913; bh=cYAwYbrCovmlUOXI8ZeD6uGS35GcV0fsOYWzd1PqXrE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hs8gj/bg4xeTQMPwfGRRUaQoVX5ZZbviu1KRVM5L1Z9rJXYMFlDgNUbV8UOXLCDwT QuUbHjhZILZaDyVezu1V0K7tOxvyuks3mO4jMIFkignUkVDhUnGV8DmvowL+TSJcgC Pe1Bzfldb0e14P/Opw3gtR6TrUHVIEMC/Z3XV7Aw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , "Rafael J. Wysocki" , Sasha Levin , Ben Greening Subject: [PATCH 5.15 109/167] ACPI: video: Fix acpi_video_handles_brightness_key_presses() Date: Tue, 19 Jul 2022 13:54:01 +0200 Message-Id: <20220719114706.998852816@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede [ Upstream commit 5ad26161a371e4aa2d2553286f0cac580987a493 ] Commit 3a0cf7ab8df3 ("ACPI: video: Change how we determine if brightness key-presses are handled") made acpi_video_handles_brightness_key_presses() report false when none of the ACPI Video Devices support backlight control. But it turns out that at least on a Dell Inspiron N4010 there is no ACPI backlight control, yet brightness hotkeys are still reported through the ACPI Video Bus; and since acpi_video_handles_brightness_key_presses() now returns false, brightness keypresses are now reported twice. To fix this rename the has_backlight flag to may_report_brightness_keys and also set it the first time a brightness key press event is received. Depending on the delivery of the other ACPI (WMI) event vs the ACPI Video Bus event this means that the first brightness key press might still get reported twice, but all further keypresses will be filtered as before. Note that this relies on other drivers reporting brightness key events calling acpi_video_handles_brightness_key_presses() when delivering the events (rather then once during driver probe). This is already required and documented in include/acpi/video.h: /* * Note: The value returned by acpi_video_handles_brightness_key_presses() * may change over time and should not be cached. */ Fixes: 3a0cf7ab8df3 ("ACPI: video: Change how we determine if brightness ke= y-presses are handled") Link: https://lore.kernel.org/regressions/CALF=3D6jEe5G8+r1Wo0vvz4GjNQQhdkL= T5p8uCHn6ZXhg4nsOWow@mail.gmail.com/ Reported-and-tested-by: Ben Greening Signed-off-by: Hans de Goede Acked-by: Rafael J. Wysocki Link: https://lore.kernel.org/r/20220713211101.85547-2-hdegoede@redhat.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/acpi/acpi_video.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c index 007deb3a8ea3..390af28f6faf 100644 --- a/drivers/acpi/acpi_video.c +++ b/drivers/acpi/acpi_video.c @@ -73,7 +73,7 @@ module_param(device_id_scheme, bool, 0444); static int only_lcd =3D -1; module_param(only_lcd, int, 0444); =20 -static bool has_backlight; +static bool may_report_brightness_keys; static int register_count; static DEFINE_MUTEX(register_count_mutex); static DEFINE_MUTEX(video_list_lock); @@ -1224,7 +1224,7 @@ acpi_video_bus_get_one_device(struct acpi_device *dev= ice, acpi_video_device_find_cap(data); =20 if (data->cap._BCM && data->cap._BCL) - has_backlight =3D true; + may_report_brightness_keys =3D true; =20 mutex_lock(&video->device_list_lock); list_add_tail(&data->entry, &video->video_device_list); @@ -1693,6 +1693,9 @@ static void acpi_video_device_notify(acpi_handle hand= le, u32 event, void *data) break; } =20 + if (keycode) + may_report_brightness_keys =3D true; + acpi_notifier_call_chain(device, event, 0); =20 if (keycode && (report_key_events & REPORT_BRIGHTNESS_KEY_EVENTS)) { @@ -2255,7 +2258,7 @@ void acpi_video_unregister(void) if (register_count) { acpi_bus_unregister_driver(&acpi_video_bus); register_count =3D 0; - has_backlight =3D false; + may_report_brightness_keys =3D false; } mutex_unlock(®ister_count_mutex); } @@ -2277,7 +2280,7 @@ void acpi_video_unregister_backlight(void) =20 bool acpi_video_handles_brightness_key_presses(void) { - return has_backlight && + return may_report_brightness_keys && (report_key_events & REPORT_BRIGHTNESS_KEY_EVENTS); } EXPORT_SYMBOL(acpi_video_handles_brightness_key_presses); --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CAC4C43334 for ; Tue, 19 Jul 2022 12:40:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238297AbiGSMkX (ORCPT ); Tue, 19 Jul 2022 08:40:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240742AbiGSMih (ORCPT ); Tue, 19 Jul 2022 08:38: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 297AE6329; Tue, 19 Jul 2022 05:15: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 3B54060F10; Tue, 19 Jul 2022 12:15:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B9E0C341C6; Tue, 19 Jul 2022 12:15:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232916; bh=UfILADtD6KP90qjyyOsY2ojdd2JlF2rQpGc7WSS6klE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QrLPTwPap/QpuUPDi0k/hs0Ua21yGVdPsvsVf2vnQGh7iOGgVTlvvn86IvWlgGuUM rNIZSP5idnUp4lmG7jY06pe2CxheC02L2T8kw5/2itTDxg56rwbzHyQRR+DBxr2WML V02FaKR8Co0OvJ4q6diqyuxSNeo3nTn++DDffy9A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Muchun Song , Michal Hocko , Mel Gorman , Luis Chamberlain , Sasha Levin Subject: [PATCH 5.15 110/167] mm: sysctl: fix missing numa_stat when !CONFIG_HUGETLB_PAGE Date: Tue, 19 Jul 2022 13:54:02 +0200 Message-Id: <20220719114707.098272627@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Muchun Song [ Upstream commit 43b5240ca6b33108998810593248186b1e3ae34a ] "numa_stat" should not be included in the scope of CONFIG_HUGETLB_PAGE, if CONFIG_HUGETLB_PAGE is not configured even if CONFIG_NUMA is configured, "numa_stat" is missed form /proc. Move it out of CONFIG_HUGETLB_PAGE to fix it. Fixes: 4518085e127d ("mm, sysctl: make NUMA stats configurable") Signed-off-by: Muchun Song Cc: Acked-by: Michal Hocko Acked-by: Mel Gorman Signed-off-by: Luis Chamberlain Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- kernel/sysctl.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 79cbfd0fa3be..25c18b2df684 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2852,6 +2852,17 @@ static struct ctl_table vm_table[] =3D { .extra1 =3D SYSCTL_ZERO, .extra2 =3D &two_hundred, }, +#ifdef CONFIG_NUMA + { + .procname =3D "numa_stat", + .data =3D &sysctl_vm_numa_stat, + .maxlen =3D sizeof(int), + .mode =3D 0644, + .proc_handler =3D sysctl_vm_numa_stat_handler, + .extra1 =3D SYSCTL_ZERO, + .extra2 =3D SYSCTL_ONE, + }, +#endif #ifdef CONFIG_HUGETLB_PAGE { .procname =3D "nr_hugepages", @@ -2868,15 +2879,6 @@ static struct ctl_table vm_table[] =3D { .mode =3D 0644, .proc_handler =3D &hugetlb_mempolicy_sysctl_handler, }, - { - .procname =3D "numa_stat", - .data =3D &sysctl_vm_numa_stat, - .maxlen =3D sizeof(int), - .mode =3D 0644, - .proc_handler =3D sysctl_vm_numa_stat_handler, - .extra1 =3D SYSCTL_ZERO, - .extra2 =3D SYSCTL_ONE, - }, #endif { .procname =3D "hugetlb_shm_group", --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1C35CCA481 for ; Tue, 19 Jul 2022 12:40:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241311AbiGSMks (ORCPT ); Tue, 19 Jul 2022 08:40:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241106AbiGSMix (ORCPT ); Tue, 19 Jul 2022 08:38: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 DC0EAB1FC; Tue, 19 Jul 2022 05:15: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 DBEBDB81B2C; Tue, 19 Jul 2022 12:15:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4CDAC341CA; Tue, 19 Jul 2022 12:15:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232919; bh=MEOMk2XfcwZHySpfhkqD4t0pGybatKRjbRpPCh8A4Og=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j86PGyQzzWPnPBAjytqAxyDw0jZAHGkMQ5YX9ssZF3e/4ElSjEIBy6HnN8VoI3sSL e0wNX8xVcfJluaaN4SgN2L4LzAwV8c+0hCPEi0jvy7usxeOL2SC8ncEXFb2iMIhrEM KLrBJFI9prN7KeBp34Hoj2SvU9T6vDgtq2QEENWs= 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.15 111/167] btrfs: rename btrfs_bio to btrfs_io_context Date: Tue, 19 Jul 2022 13:54:03 +0200 Message-Id: <20220719114707.234135920@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Qu Wenruo [ Upstream commit 4c6646117912397d026d70c04d92ec1599522e9f ] The structure btrfs_bio is used by two different sites: - bio->bi_private for mirror based profiles For those profiles (SINGLE/DUP/RAID1*/RAID10), this structures records how many mirrors are still pending, and save the original endio function of the bio. - RAID56 code In that case, RAID56 only utilize the stripes info, and no long uses that to trace the pending mirrors. So btrfs_bio is not always bind to a bio, and contains more info for IO context, thus renaming it will make the naming less confusing. Signed-off-by: Qu Wenruo Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- fs/btrfs/check-integrity.c | 2=20 fs/btrfs/extent-tree.c | 19 +-- fs/btrfs/extent_io.c | 18 +-- fs/btrfs/extent_map.c | 4=20 fs/btrfs/raid56.c | 127 ++++++++++----------- fs/btrfs/raid56.h | 8 - fs/btrfs/reada.c | 26 ++-- fs/btrfs/scrub.c | 115 +++++++++---------- fs/btrfs/volumes.c | 267 ++++++++++++++++++++++------------------= ----- fs/btrfs/volumes.h | 38 ++++-- fs/btrfs/zoned.c | 16 +- 11 files changed, 325 insertions(+), 315 deletions(-) --- a/fs/btrfs/check-integrity.c +++ b/fs/btrfs/check-integrity.c @@ -1455,7 +1455,7 @@ static int btrfsic_map_block(struct btrf struct btrfs_fs_info *fs_info =3D state->fs_info; int ret; u64 length; - struct btrfs_bio *multi =3D NULL; + struct btrfs_io_context *multi =3D NULL; struct btrfs_device *device; =20 length =3D len; --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -1266,7 +1266,7 @@ static int btrfs_issue_discard(struct bl return ret; } =20 -static int do_discard_extent(struct btrfs_bio_stripe *stripe, u64 *bytes) +static int do_discard_extent(struct btrfs_io_stripe *stripe, u64 *bytes) { struct btrfs_device *dev =3D stripe->dev; struct btrfs_fs_info *fs_info =3D dev->fs_info; @@ -1313,22 +1313,21 @@ int btrfs_discard_extent(struct btrfs_fs u64 discarded_bytes =3D 0; u64 end =3D bytenr + num_bytes; u64 cur =3D bytenr; - struct btrfs_bio *bbio =3D NULL; - + struct btrfs_io_context *bioc =3D NULL; =20 /* - * Avoid races with device replace and make sure our bbio has devices + * Avoid races with device replace and make sure our bioc has devices * associated to its stripes that don't go away while we are discarding. */ btrfs_bio_counter_inc_blocked(fs_info); while (cur < end) { - struct btrfs_bio_stripe *stripe; + struct btrfs_io_stripe *stripe; int i; =20 num_bytes =3D end - cur; /* Tell the block device(s) that the sectors can be discarded */ ret =3D btrfs_map_block(fs_info, BTRFS_MAP_DISCARD, cur, - &num_bytes, &bbio, 0); + &num_bytes, &bioc, 0); /* * Error can be -ENOMEM, -ENOENT (no such chunk mapping) or * -EOPNOTSUPP. For any such error, @num_bytes is not updated, @@ -1337,8 +1336,8 @@ int btrfs_discard_extent(struct btrfs_fs if (ret < 0) goto out; =20 - stripe =3D bbio->stripes; - for (i =3D 0; i < bbio->num_stripes; i++, stripe++) { + stripe =3D bioc->stripes; + for (i =3D 0; i < bioc->num_stripes; i++, stripe++) { u64 bytes; struct btrfs_device *device =3D stripe->dev; =20 @@ -1361,7 +1360,7 @@ int btrfs_discard_extent(struct btrfs_fs * And since there are two loops, explicitly * go to out to avoid confusion. */ - btrfs_put_bbio(bbio); + btrfs_put_bioc(bioc); goto out; } =20 @@ -1372,7 +1371,7 @@ int btrfs_discard_extent(struct btrfs_fs */ ret =3D 0; } - btrfs_put_bbio(bbio); + btrfs_put_bioc(bioc); cur +=3D num_bytes; } out: --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -2290,7 +2290,7 @@ int repair_io_failure(struct btrfs_fs_in struct btrfs_device *dev; u64 map_length =3D 0; u64 sector; - struct btrfs_bio *bbio =3D NULL; + struct btrfs_io_context *bioc =3D NULL; int ret; =20 ASSERT(!(fs_info->sb->s_flags & SB_RDONLY)); @@ -2304,7 +2304,7 @@ int repair_io_failure(struct btrfs_fs_in map_length =3D length; =20 /* - * Avoid races with device replace and make sure our bbio has devices + * Avoid races with device replace and make sure our bioc has devices * associated to its stripes that don't go away while we are doing the * read repair operation. */ @@ -2317,28 +2317,28 @@ int repair_io_failure(struct btrfs_fs_in * stripe's dev and sector. */ ret =3D btrfs_map_block(fs_info, BTRFS_MAP_READ, logical, - &map_length, &bbio, 0); + &map_length, &bioc, 0); if (ret) { btrfs_bio_counter_dec(fs_info); bio_put(bio); return -EIO; } - ASSERT(bbio->mirror_num =3D=3D 1); + ASSERT(bioc->mirror_num =3D=3D 1); } else { ret =3D btrfs_map_block(fs_info, BTRFS_MAP_WRITE, logical, - &map_length, &bbio, mirror_num); + &map_length, &bioc, mirror_num); if (ret) { btrfs_bio_counter_dec(fs_info); bio_put(bio); return -EIO; } - BUG_ON(mirror_num !=3D bbio->mirror_num); + BUG_ON(mirror_num !=3D bioc->mirror_num); } =20 - sector =3D bbio->stripes[bbio->mirror_num - 1].physical >> 9; + sector =3D bioc->stripes[bioc->mirror_num - 1].physical >> 9; bio->bi_iter.bi_sector =3D sector; - dev =3D bbio->stripes[bbio->mirror_num - 1].dev; - btrfs_put_bbio(bbio); + dev =3D bioc->stripes[bioc->mirror_num - 1].dev; + btrfs_put_bioc(bioc); if (!dev || !dev->bdev || !test_bit(BTRFS_DEV_STATE_WRITEABLE, &dev->dev_state)) { btrfs_bio_counter_dec(fs_info); --- a/fs/btrfs/extent_map.c +++ b/fs/btrfs/extent_map.c @@ -360,7 +360,7 @@ static void extent_map_device_set_bits(s int i; =20 for (i =3D 0; i < map->num_stripes; i++) { - struct btrfs_bio_stripe *stripe =3D &map->stripes[i]; + struct btrfs_io_stripe *stripe =3D &map->stripes[i]; struct btrfs_device *device =3D stripe->dev; =20 set_extent_bits_nowait(&device->alloc_state, stripe->physical, @@ -375,7 +375,7 @@ static void extent_map_device_clear_bits int i; =20 for (i =3D 0; i < map->num_stripes; i++) { - struct btrfs_bio_stripe *stripe =3D &map->stripes[i]; + struct btrfs_io_stripe *stripe =3D &map->stripes[i]; struct btrfs_device *device =3D stripe->dev; =20 __clear_extent_bit(&device->alloc_state, stripe->physical, --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c @@ -61,7 +61,7 @@ enum btrfs_rbio_ops { =20 struct btrfs_raid_bio { struct btrfs_fs_info *fs_info; - struct btrfs_bio *bbio; + struct btrfs_io_context *bioc; =20 /* while we're doing rmw on a stripe * we put it into a hash table so we can @@ -271,7 +271,7 @@ static void cache_rbio_pages(struct btrf */ static int rbio_bucket(struct btrfs_raid_bio *rbio) { - u64 num =3D rbio->bbio->raid_map[0]; + u64 num =3D rbio->bioc->raid_map[0]; =20 /* * we shift down quite a bit. We're using byte @@ -559,8 +559,7 @@ static int rbio_can_merge(struct btrfs_r test_bit(RBIO_CACHE_BIT, &cur->flags)) return 0; =20 - if (last->bbio->raid_map[0] !=3D - cur->bbio->raid_map[0]) + if (last->bioc->raid_map[0] !=3D cur->bioc->raid_map[0]) return 0; =20 /* we can't merge with different operations */ @@ -673,7 +672,7 @@ static noinline int lock_stripe_add(stru =20 spin_lock_irqsave(&h->lock, flags); list_for_each_entry(cur, &h->hash_list, hash_list) { - if (cur->bbio->raid_map[0] !=3D rbio->bbio->raid_map[0]) + if (cur->bioc->raid_map[0] !=3D rbio->bioc->raid_map[0]) continue; =20 spin_lock(&cur->bio_list_lock); @@ -838,7 +837,7 @@ static void __free_raid_bio(struct btrfs } } =20 - btrfs_put_bbio(rbio->bbio); + btrfs_put_bioc(rbio->bioc); kfree(rbio); } =20 @@ -906,7 +905,7 @@ static void raid_write_end_io(struct bio =20 /* OK, we have read all the stripes we need to. */ max_errors =3D (rbio->operation =3D=3D BTRFS_RBIO_PARITY_SCRUB) ? - 0 : rbio->bbio->max_errors; + 0 : rbio->bioc->max_errors; if (atomic_read(&rbio->error) > max_errors) err =3D BLK_STS_IOERR; =20 @@ -961,12 +960,12 @@ static unsigned long rbio_nr_pages(unsig * this does not allocate any pages for rbio->pages. */ static struct btrfs_raid_bio *alloc_rbio(struct btrfs_fs_info *fs_info, - struct btrfs_bio *bbio, + struct btrfs_io_context *bioc, u64 stripe_len) { struct btrfs_raid_bio *rbio; int nr_data =3D 0; - int real_stripes =3D bbio->num_stripes - bbio->num_tgtdevs; + int real_stripes =3D bioc->num_stripes - bioc->num_tgtdevs; int num_pages =3D rbio_nr_pages(stripe_len, real_stripes); int stripe_npages =3D DIV_ROUND_UP(stripe_len, PAGE_SIZE); void *p; @@ -987,7 +986,7 @@ static struct btrfs_raid_bio *alloc_rbio spin_lock_init(&rbio->bio_list_lock); INIT_LIST_HEAD(&rbio->stripe_cache); INIT_LIST_HEAD(&rbio->hash_list); - rbio->bbio =3D bbio; + rbio->bioc =3D bioc; rbio->fs_info =3D fs_info; rbio->stripe_len =3D stripe_len; rbio->nr_pages =3D num_pages; @@ -1015,9 +1014,9 @@ static struct btrfs_raid_bio *alloc_rbio CONSUME_ALLOC(rbio->finish_pbitmap, BITS_TO_LONGS(stripe_npages)); #undef CONSUME_ALLOC =20 - if (bbio->map_type & BTRFS_BLOCK_GROUP_RAID5) + if (bioc->map_type & BTRFS_BLOCK_GROUP_RAID5) nr_data =3D real_stripes - 1; - else if (bbio->map_type & BTRFS_BLOCK_GROUP_RAID6) + else if (bioc->map_type & BTRFS_BLOCK_GROUP_RAID6) nr_data =3D real_stripes - 2; else BUG(); @@ -1077,10 +1076,10 @@ static int rbio_add_io_page(struct btrfs struct bio *last =3D bio_list->tail; int ret; struct bio *bio; - struct btrfs_bio_stripe *stripe; + struct btrfs_io_stripe *stripe; u64 disk_start; =20 - stripe =3D &rbio->bbio->stripes[stripe_nr]; + stripe =3D &rbio->bioc->stripes[stripe_nr]; disk_start =3D stripe->physical + (page_index << PAGE_SHIFT); =20 /* if the device is missing, just fail this stripe */ @@ -1155,7 +1154,7 @@ static void index_rbio_pages(struct btrf int i =3D 0; =20 start =3D bio->bi_iter.bi_sector << 9; - stripe_offset =3D start - rbio->bbio->raid_map[0]; + stripe_offset =3D start - rbio->bioc->raid_map[0]; page_index =3D stripe_offset >> PAGE_SHIFT; =20 if (bio_flagged(bio, BIO_CLONED)) @@ -1179,7 +1178,7 @@ static void index_rbio_pages(struct btrf */ static noinline void finish_rmw(struct btrfs_raid_bio *rbio) { - struct btrfs_bio *bbio =3D rbio->bbio; + struct btrfs_io_context *bioc =3D rbio->bioc; void **pointers =3D rbio->finish_pointers; int nr_data =3D rbio->nr_data; int stripe; @@ -1284,11 +1283,11 @@ static noinline void finish_rmw(struct b } } =20 - if (likely(!bbio->num_tgtdevs)) + if (likely(!bioc->num_tgtdevs)) goto write_data; =20 for (stripe =3D 0; stripe < rbio->real_stripes; stripe++) { - if (!bbio->tgtdev_map[stripe]) + if (!bioc->tgtdev_map[stripe]) continue; =20 for (pagenr =3D 0; pagenr < rbio->stripe_npages; pagenr++) { @@ -1302,7 +1301,7 @@ static noinline void finish_rmw(struct b } =20 ret =3D rbio_add_io_page(rbio, &bio_list, page, - rbio->bbio->tgtdev_map[stripe], + rbio->bioc->tgtdev_map[stripe], pagenr, rbio->stripe_len); if (ret) goto cleanup; @@ -1339,12 +1338,12 @@ static int find_bio_stripe(struct btrfs_ { u64 physical =3D bio->bi_iter.bi_sector; int i; - struct btrfs_bio_stripe *stripe; + struct btrfs_io_stripe *stripe; =20 physical <<=3D 9; =20 - for (i =3D 0; i < rbio->bbio->num_stripes; i++) { - stripe =3D &rbio->bbio->stripes[i]; + for (i =3D 0; i < rbio->bioc->num_stripes; i++) { + stripe =3D &rbio->bioc->stripes[i]; if (in_range(physical, stripe->physical, rbio->stripe_len) && stripe->dev->bdev && bio->bi_bdev =3D=3D stripe->dev->bdev) { return i; @@ -1365,7 +1364,7 @@ static int find_logical_bio_stripe(struc int i; =20 for (i =3D 0; i < rbio->nr_data; i++) { - u64 stripe_start =3D rbio->bbio->raid_map[i]; + u64 stripe_start =3D rbio->bioc->raid_map[i]; =20 if (in_range(logical, stripe_start, rbio->stripe_len)) return i; @@ -1456,7 +1455,7 @@ static void raid_rmw_end_io(struct bio * if (!atomic_dec_and_test(&rbio->stripes_pending)) return; =20 - if (atomic_read(&rbio->error) > rbio->bbio->max_errors) + if (atomic_read(&rbio->error) > rbio->bioc->max_errors) goto cleanup; =20 /* @@ -1538,8 +1537,8 @@ static int raid56_rmw_stripe(struct btrf } =20 /* - * the bbio may be freed once we submit the last bio. Make sure - * not to touch it after that + * The bioc may be freed once we submit the last bio. Make sure not to + * touch it after that. */ atomic_set(&rbio->stripes_pending, bios_to_read); while ((bio =3D bio_list_pop(&bio_list))) { @@ -1720,16 +1719,16 @@ static void btrfs_raid_unplug(struct blk * our main entry point for writes from the rest of the FS. */ int raid56_parity_write(struct btrfs_fs_info *fs_info, struct bio *bio, - struct btrfs_bio *bbio, u64 stripe_len) + struct btrfs_io_context *bioc, u64 stripe_len) { struct btrfs_raid_bio *rbio; struct btrfs_plug_cb *plug =3D NULL; struct blk_plug_cb *cb; int ret; =20 - rbio =3D alloc_rbio(fs_info, bbio, stripe_len); + rbio =3D alloc_rbio(fs_info, bioc, stripe_len); if (IS_ERR(rbio)) { - btrfs_put_bbio(bbio); + btrfs_put_bioc(bioc); return PTR_ERR(rbio); } bio_list_add(&rbio->bio_list, bio); @@ -1842,7 +1841,7 @@ static void __raid_recover_end_io(struct } =20 /* all raid6 handling here */ - if (rbio->bbio->map_type & BTRFS_BLOCK_GROUP_RAID6) { + if (rbio->bioc->map_type & BTRFS_BLOCK_GROUP_RAID6) { /* * single failure, rebuild from parity raid5 * style @@ -1874,8 +1873,8 @@ static void __raid_recover_end_io(struct * here due to a crc mismatch and we can't give them the * data they want */ - if (rbio->bbio->raid_map[failb] =3D=3D RAID6_Q_STRIPE) { - if (rbio->bbio->raid_map[faila] =3D=3D + if (rbio->bioc->raid_map[failb] =3D=3D RAID6_Q_STRIPE) { + if (rbio->bioc->raid_map[faila] =3D=3D RAID5_P_STRIPE) { err =3D BLK_STS_IOERR; goto cleanup; @@ -1887,7 +1886,7 @@ static void __raid_recover_end_io(struct goto pstripe; } =20 - if (rbio->bbio->raid_map[failb] =3D=3D RAID5_P_STRIPE) { + if (rbio->bioc->raid_map[failb] =3D=3D RAID5_P_STRIPE) { raid6_datap_recov(rbio->real_stripes, PAGE_SIZE, faila, pointers); } else { @@ -2006,7 +2005,7 @@ static void raid_recover_end_io(struct b if (!atomic_dec_and_test(&rbio->stripes_pending)) return; =20 - if (atomic_read(&rbio->error) > rbio->bbio->max_errors) + if (atomic_read(&rbio->error) > rbio->bioc->max_errors) rbio_orig_end_io(rbio, BLK_STS_IOERR); else __raid_recover_end_io(rbio); @@ -2074,7 +2073,7 @@ static int __raid56_parity_recover(struc * were up to date, or we might have no bios to read because * the devices were gone. */ - if (atomic_read(&rbio->error) <=3D rbio->bbio->max_errors) { + if (atomic_read(&rbio->error) <=3D rbio->bioc->max_errors) { __raid_recover_end_io(rbio); return 0; } else { @@ -2083,8 +2082,8 @@ static int __raid56_parity_recover(struc } =20 /* - * the bbio may be freed once we submit the last bio. Make sure - * not to touch it after that + * The bioc may be freed once we submit the last bio. Make sure not to + * touch it after that. */ atomic_set(&rbio->stripes_pending, bios_to_read); while ((bio =3D bio_list_pop(&bio_list))) { @@ -2117,21 +2116,21 @@ cleanup: * of the drive. */ int raid56_parity_recover(struct btrfs_fs_info *fs_info, struct bio *bio, - struct btrfs_bio *bbio, u64 stripe_len, + struct btrfs_io_context *bioc, u64 stripe_len, int mirror_num, int generic_io) { struct btrfs_raid_bio *rbio; int ret; =20 if (generic_io) { - ASSERT(bbio->mirror_num =3D=3D mirror_num); + ASSERT(bioc->mirror_num =3D=3D mirror_num); btrfs_io_bio(bio)->mirror_num =3D mirror_num; } =20 - rbio =3D alloc_rbio(fs_info, bbio, stripe_len); + rbio =3D alloc_rbio(fs_info, bioc, stripe_len); if (IS_ERR(rbio)) { if (generic_io) - btrfs_put_bbio(bbio); + btrfs_put_bioc(bioc); return PTR_ERR(rbio); } =20 @@ -2142,11 +2141,11 @@ int raid56_parity_recover(struct btrfs_f rbio->faila =3D find_logical_bio_stripe(rbio, bio); if (rbio->faila =3D=3D -1) { btrfs_warn(fs_info, - "%s could not find the bad stripe in raid56 so that we cannot recover any= more (bio has logical %llu len %llu, bbio has map_type %llu)", +"%s could not find the bad stripe in raid56 so that we cannot recover any = more (bio has logical %llu len %llu, bioc has map_type %llu)", __func__, bio->bi_iter.bi_sector << 9, - (u64)bio->bi_iter.bi_size, bbio->map_type); + (u64)bio->bi_iter.bi_size, bioc->map_type); if (generic_io) - btrfs_put_bbio(bbio); + btrfs_put_bioc(bioc); kfree(rbio); return -EIO; } @@ -2155,7 +2154,7 @@ int raid56_parity_recover(struct btrfs_f btrfs_bio_counter_inc_noblocked(fs_info); rbio->generic_bio_cnt =3D 1; } else { - btrfs_get_bbio(bbio); + btrfs_get_bioc(bioc); } =20 /* @@ -2214,7 +2213,7 @@ static void read_rebuild_work(struct btr /* * The following code is used to scrub/replace the parity stripe * - * Caller must have already increased bio_counter for getting @bbio. + * Caller must have already increased bio_counter for getting @bioc. * * Note: We need make sure all the pages that add into the scrub/replace * raid bio are correct and not be changed during the scrub/replace. That @@ -2223,14 +2222,14 @@ static void read_rebuild_work(struct btr =20 struct btrfs_raid_bio * raid56_parity_alloc_scrub_rbio(struct btrfs_fs_info *fs_info, struct bio *= bio, - struct btrfs_bio *bbio, u64 stripe_len, + struct btrfs_io_context *bioc, u64 stripe_len, struct btrfs_device *scrub_dev, unsigned long *dbitmap, int stripe_nsectors) { struct btrfs_raid_bio *rbio; int i; =20 - rbio =3D alloc_rbio(fs_info, bbio, stripe_len); + rbio =3D alloc_rbio(fs_info, bioc, stripe_len); if (IS_ERR(rbio)) return NULL; bio_list_add(&rbio->bio_list, bio); @@ -2242,12 +2241,12 @@ raid56_parity_alloc_scrub_rbio(struct bt rbio->operation =3D BTRFS_RBIO_PARITY_SCRUB; =20 /* - * After mapping bbio with BTRFS_MAP_WRITE, parities have been sorted + * After mapping bioc with BTRFS_MAP_WRITE, parities have been sorted * to the end position, so this search can start from the first parity * stripe. */ for (i =3D rbio->nr_data; i < rbio->real_stripes; i++) { - if (bbio->stripes[i].dev =3D=3D scrub_dev) { + if (bioc->stripes[i].dev =3D=3D scrub_dev) { rbio->scrubp =3D i; break; } @@ -2260,7 +2259,7 @@ raid56_parity_alloc_scrub_rbio(struct bt bitmap_copy(rbio->dbitmap, dbitmap, stripe_nsectors); =20 /* - * We have already increased bio_counter when getting bbio, record it + * We have already increased bio_counter when getting bioc, record it * so we can free it at rbio_orig_end_io(). */ rbio->generic_bio_cnt =3D 1; @@ -2275,10 +2274,10 @@ void raid56_add_scrub_pages(struct btrfs int stripe_offset; int index; =20 - ASSERT(logical >=3D rbio->bbio->raid_map[0]); - ASSERT(logical + PAGE_SIZE <=3D rbio->bbio->raid_map[0] + + ASSERT(logical >=3D rbio->bioc->raid_map[0]); + ASSERT(logical + PAGE_SIZE <=3D rbio->bioc->raid_map[0] + rbio->stripe_len * rbio->nr_data); - stripe_offset =3D (int)(logical - rbio->bbio->raid_map[0]); + stripe_offset =3D (int)(logical - rbio->bioc->raid_map[0]); index =3D stripe_offset >> PAGE_SHIFT; rbio->bio_pages[index] =3D page; } @@ -2312,7 +2311,7 @@ static int alloc_rbio_essential_pages(st static noinline void finish_parity_scrub(struct btrfs_raid_bio *rbio, int need_check) { - struct btrfs_bio *bbio =3D rbio->bbio; + struct btrfs_io_context *bioc =3D rbio->bioc; void **pointers =3D rbio->finish_pointers; unsigned long *pbitmap =3D rbio->finish_pbitmap; int nr_data =3D rbio->nr_data; @@ -2335,7 +2334,7 @@ static noinline void finish_parity_scrub else BUG(); =20 - if (bbio->num_tgtdevs && bbio->tgtdev_map[rbio->scrubp]) { + if (bioc->num_tgtdevs && bioc->tgtdev_map[rbio->scrubp]) { is_replace =3D 1; bitmap_copy(pbitmap, rbio->dbitmap, rbio->stripe_npages); } @@ -2435,7 +2434,7 @@ writeback: =20 page =3D rbio_stripe_page(rbio, rbio->scrubp, pagenr); ret =3D rbio_add_io_page(rbio, &bio_list, page, - bbio->tgtdev_map[rbio->scrubp], + bioc->tgtdev_map[rbio->scrubp], pagenr, rbio->stripe_len); if (ret) goto cleanup; @@ -2483,7 +2482,7 @@ static inline int is_data_stripe(struct */ static void validate_rbio_for_parity_scrub(struct btrfs_raid_bio *rbio) { - if (atomic_read(&rbio->error) > rbio->bbio->max_errors) + if (atomic_read(&rbio->error) > rbio->bioc->max_errors) goto cleanup; =20 if (rbio->faila >=3D 0 || rbio->failb >=3D 0) { @@ -2504,7 +2503,7 @@ static void validate_rbio_for_parity_scr * the data, so the capability of the repair is declined. * (In the case of RAID5, we can not repair anything) */ - if (dfail > rbio->bbio->max_errors - 1) + if (dfail > rbio->bioc->max_errors - 1) goto cleanup; =20 /* @@ -2625,8 +2624,8 @@ static void raid56_parity_scrub_stripe(s } =20 /* - * the bbio may be freed once we submit the last bio. Make sure - * not to touch it after that + * The bioc may be freed once we submit the last bio. Make sure not to + * touch it after that. */ atomic_set(&rbio->stripes_pending, bios_to_read); while ((bio =3D bio_list_pop(&bio_list))) { @@ -2671,11 +2670,11 @@ void raid56_parity_submit_scrub_rbio(str =20 struct btrfs_raid_bio * raid56_alloc_missing_rbio(struct btrfs_fs_info *fs_info, struct bio *bio, - struct btrfs_bio *bbio, u64 length) + struct btrfs_io_context *bioc, u64 length) { struct btrfs_raid_bio *rbio; =20 - rbio =3D alloc_rbio(fs_info, bbio, length); + rbio =3D alloc_rbio(fs_info, bioc, length); if (IS_ERR(rbio)) return NULL; =20 @@ -2695,7 +2694,7 @@ raid56_alloc_missing_rbio(struct btrfs_f } =20 /* - * When we get bbio, we have already increased bio_counter, record it + * When we get bioc, we have already increased bio_counter, record it * so we can free it at rbio_orig_end_io() */ rbio->generic_bio_cnt =3D 1; --- a/fs/btrfs/raid56.h +++ b/fs/btrfs/raid56.h @@ -31,24 +31,24 @@ struct btrfs_raid_bio; struct btrfs_device; =20 int raid56_parity_recover(struct btrfs_fs_info *fs_info, struct bio *bio, - struct btrfs_bio *bbio, u64 stripe_len, + struct btrfs_io_context *bioc, u64 stripe_len, int mirror_num, int generic_io); int raid56_parity_write(struct btrfs_fs_info *fs_info, struct bio *bio, - struct btrfs_bio *bbio, u64 stripe_len); + struct btrfs_io_context *bioc, u64 stripe_len); =20 void raid56_add_scrub_pages(struct btrfs_raid_bio *rbio, struct page *page, u64 logical); =20 struct btrfs_raid_bio * raid56_parity_alloc_scrub_rbio(struct btrfs_fs_info *fs_info, struct bio *= bio, - struct btrfs_bio *bbio, u64 stripe_len, + struct btrfs_io_context *bioc, u64 stripe_len, struct btrfs_device *scrub_dev, unsigned long *dbitmap, int stripe_nsectors); void raid56_parity_submit_scrub_rbio(struct btrfs_raid_bio *rbio); =20 struct btrfs_raid_bio * raid56_alloc_missing_rbio(struct btrfs_fs_info *fs_info, struct bio *bio, - struct btrfs_bio *bbio, u64 length); + struct btrfs_io_context *bioc, u64 length); void raid56_submit_missing_rbio(struct btrfs_raid_bio *rbio); =20 int btrfs_alloc_stripe_hash_table(struct btrfs_fs_info *info); --- a/fs/btrfs/reada.c +++ b/fs/btrfs/reada.c @@ -227,7 +227,7 @@ start_machine: } =20 static struct reada_zone *reada_find_zone(struct btrfs_device *dev, u64 lo= gical, - struct btrfs_bio *bbio) + struct btrfs_io_context *bioc) { struct btrfs_fs_info *fs_info =3D dev->fs_info; int ret; @@ -275,11 +275,11 @@ static struct reada_zone *reada_find_zon kref_init(&zone->refcnt); zone->elems =3D 0; zone->device =3D dev; /* our device always sits at index 0 */ - for (i =3D 0; i < bbio->num_stripes; ++i) { + for (i =3D 0; i < bioc->num_stripes; ++i) { /* bounds have already been checked */ - zone->devs[i] =3D bbio->stripes[i].dev; + zone->devs[i] =3D bioc->stripes[i].dev; } - zone->ndevs =3D bbio->num_stripes; + zone->ndevs =3D bioc->num_stripes; =20 spin_lock(&fs_info->reada_lock); ret =3D radix_tree_insert(&dev->reada_zones, @@ -309,7 +309,7 @@ static struct reada_extent *reada_find_e int ret; struct reada_extent *re =3D NULL; struct reada_extent *re_exist =3D NULL; - struct btrfs_bio *bbio =3D NULL; + struct btrfs_io_context *bioc =3D NULL; struct btrfs_device *dev; struct btrfs_device *prev_dev; u64 length; @@ -345,28 +345,28 @@ static struct reada_extent *reada_find_e */ length =3D fs_info->nodesize; ret =3D btrfs_map_block(fs_info, BTRFS_MAP_GET_READ_MIRRORS, logical, - &length, &bbio, 0); - if (ret || !bbio || length < fs_info->nodesize) + &length, &bioc, 0); + if (ret || !bioc || length < fs_info->nodesize) goto error; =20 - if (bbio->num_stripes > BTRFS_MAX_MIRRORS) { + if (bioc->num_stripes > BTRFS_MAX_MIRRORS) { btrfs_err(fs_info, "readahead: more than %d copies not supported", BTRFS_MAX_MIRRORS); goto error; } =20 - real_stripes =3D bbio->num_stripes - bbio->num_tgtdevs; + real_stripes =3D bioc->num_stripes - bioc->num_tgtdevs; for (nzones =3D 0; nzones < real_stripes; ++nzones) { struct reada_zone *zone; =20 - dev =3D bbio->stripes[nzones].dev; + dev =3D bioc->stripes[nzones].dev; =20 /* cannot read ahead on missing device. */ if (!dev->bdev) continue; =20 - zone =3D reada_find_zone(dev, logical, bbio); + zone =3D reada_find_zone(dev, logical, bioc); if (!zone) continue; =20 @@ -464,7 +464,7 @@ static struct reada_extent *reada_find_e if (!have_zone) goto error; =20 - btrfs_put_bbio(bbio); + btrfs_put_bioc(bioc); return re; =20 error: @@ -488,7 +488,7 @@ error: kref_put(&zone->refcnt, reada_zone_release); spin_unlock(&fs_info->reada_lock); } - btrfs_put_bbio(bbio); + btrfs_put_bioc(bioc); kfree(re); return re_exist; } --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -57,7 +57,7 @@ struct scrub_ctx; =20 struct scrub_recover { refcount_t refs; - struct btrfs_bio *bbio; + struct btrfs_io_context *bioc; u64 map_length; }; =20 @@ -254,7 +254,7 @@ static void scrub_put_ctx(struct scrub_c static inline int scrub_is_page_on_raid56(struct scrub_page *spage) { return spage->recover && - (spage->recover->bbio->map_type & BTRFS_BLOCK_GROUP_RAID56_MASK); + (spage->recover->bioc->map_type & BTRFS_BLOCK_GROUP_RAID56_MASK); } =20 static void scrub_pending_bio_inc(struct scrub_ctx *sctx) @@ -798,7 +798,7 @@ static inline void scrub_put_recover(str { if (refcount_dec_and_test(&recover->refs)) { btrfs_bio_counter_dec(fs_info); - btrfs_put_bbio(recover->bbio); + btrfs_put_bioc(recover->bioc); kfree(recover); } } @@ -1027,8 +1027,7 @@ static int scrub_handle_errored_block(st sblock_other =3D sblocks_for_recheck + mirror_index; } else { struct scrub_recover *r =3D sblock_bad->pagev[0]->recover; - int max_allowed =3D r->bbio->num_stripes - - r->bbio->num_tgtdevs; + int max_allowed =3D r->bioc->num_stripes - r->bioc->num_tgtdevs; =20 if (mirror_index >=3D max_allowed) break; @@ -1218,14 +1217,14 @@ out: return 0; } =20 -static inline int scrub_nr_raid_mirrors(struct btrfs_bio *bbio) +static inline int scrub_nr_raid_mirrors(struct btrfs_io_context *bioc) { - if (bbio->map_type & BTRFS_BLOCK_GROUP_RAID5) + if (bioc->map_type & BTRFS_BLOCK_GROUP_RAID5) return 2; - else if (bbio->map_type & BTRFS_BLOCK_GROUP_RAID6) + else if (bioc->map_type & BTRFS_BLOCK_GROUP_RAID6) return 3; else - return (int)bbio->num_stripes; + return (int)bioc->num_stripes; } =20 static inline void scrub_stripe_index_and_offset(u64 logical, u64 map_type, @@ -1269,7 +1268,7 @@ static int scrub_setup_recheck_block(str u64 flags =3D original_sblock->pagev[0]->flags; u64 have_csum =3D original_sblock->pagev[0]->have_csum; struct scrub_recover *recover; - struct btrfs_bio *bbio; + struct btrfs_io_context *bioc; u64 sublen; u64 mapped_length; u64 stripe_offset; @@ -1288,7 +1287,7 @@ static int scrub_setup_recheck_block(str while (length > 0) { sublen =3D min_t(u64, length, fs_info->sectorsize); mapped_length =3D sublen; - bbio =3D NULL; + bioc =3D NULL; =20 /* * With a length of sectorsize, each returned stripe represents @@ -1296,27 +1295,27 @@ static int scrub_setup_recheck_block(str */ btrfs_bio_counter_inc_blocked(fs_info); ret =3D btrfs_map_sblock(fs_info, BTRFS_MAP_GET_READ_MIRRORS, - logical, &mapped_length, &bbio); - if (ret || !bbio || mapped_length < sublen) { - btrfs_put_bbio(bbio); + logical, &mapped_length, &bioc); + if (ret || !bioc || mapped_length < sublen) { + btrfs_put_bioc(bioc); btrfs_bio_counter_dec(fs_info); return -EIO; } =20 recover =3D kzalloc(sizeof(struct scrub_recover), GFP_NOFS); if (!recover) { - btrfs_put_bbio(bbio); + btrfs_put_bioc(bioc); btrfs_bio_counter_dec(fs_info); return -ENOMEM; } =20 refcount_set(&recover->refs, 1); - recover->bbio =3D bbio; + recover->bioc =3D bioc; recover->map_length =3D mapped_length; =20 BUG_ON(page_index >=3D SCRUB_MAX_PAGES_PER_BLOCK); =20 - nmirrors =3D min(scrub_nr_raid_mirrors(bbio), BTRFS_MAX_MIRRORS); + nmirrors =3D min(scrub_nr_raid_mirrors(bioc), BTRFS_MAX_MIRRORS); =20 for (mirror_index =3D 0; mirror_index < nmirrors; mirror_index++) { @@ -1348,17 +1347,17 @@ leave_nomem: sctx->fs_info->csum_size); =20 scrub_stripe_index_and_offset(logical, - bbio->map_type, - bbio->raid_map, + bioc->map_type, + bioc->raid_map, mapped_length, - bbio->num_stripes - - bbio->num_tgtdevs, + bioc->num_stripes - + bioc->num_tgtdevs, mirror_index, &stripe_index, &stripe_offset); - spage->physical =3D bbio->stripes[stripe_index].physical + + spage->physical =3D bioc->stripes[stripe_index].physical + stripe_offset; - spage->dev =3D bbio->stripes[stripe_index].dev; + spage->dev =3D bioc->stripes[stripe_index].dev; =20 BUG_ON(page_index >=3D original_sblock->page_count); spage->physical_for_dev_replace =3D @@ -1401,7 +1400,7 @@ static int scrub_submit_raid56_bio_wait( bio->bi_end_io =3D scrub_bio_wait_endio; =20 mirror_num =3D spage->sblock->pagev[0]->mirror_num; - ret =3D raid56_parity_recover(fs_info, bio, spage->recover->bbio, + ret =3D raid56_parity_recover(fs_info, bio, spage->recover->bioc, spage->recover->map_length, mirror_num, 0); if (ret) @@ -2203,7 +2202,7 @@ static void scrub_missing_raid56_pages(s struct btrfs_fs_info *fs_info =3D sctx->fs_info; u64 length =3D sblock->page_count * PAGE_SIZE; u64 logical =3D sblock->pagev[0]->logical; - struct btrfs_bio *bbio =3D NULL; + struct btrfs_io_context *bioc =3D NULL; struct bio *bio; struct btrfs_raid_bio *rbio; int ret; @@ -2211,19 +2210,19 @@ static void scrub_missing_raid56_pages(s =20 btrfs_bio_counter_inc_blocked(fs_info); ret =3D btrfs_map_sblock(fs_info, BTRFS_MAP_GET_READ_MIRRORS, logical, - &length, &bbio); - if (ret || !bbio || !bbio->raid_map) - goto bbio_out; + &length, &bioc); + if (ret || !bioc || !bioc->raid_map) + goto bioc_out; =20 if (WARN_ON(!sctx->is_dev_replace || - !(bbio->map_type & BTRFS_BLOCK_GROUP_RAID56_MASK))) { + !(bioc->map_type & BTRFS_BLOCK_GROUP_RAID56_MASK))) { /* * We shouldn't be scrubbing a missing device. Even for dev * replace, we should only get here for RAID 5/6. We either * managed to mount something with no mirrors remaining or * there's a bug in scrub_remap_extent()/btrfs_map_block(). */ - goto bbio_out; + goto bioc_out; } =20 bio =3D btrfs_io_bio_alloc(0); @@ -2231,7 +2230,7 @@ static void scrub_missing_raid56_pages(s bio->bi_private =3D sblock; bio->bi_end_io =3D scrub_missing_raid56_end_io; =20 - rbio =3D raid56_alloc_missing_rbio(fs_info, bio, bbio, length); + rbio =3D raid56_alloc_missing_rbio(fs_info, bio, bioc, length); if (!rbio) goto rbio_out; =20 @@ -2249,9 +2248,9 @@ static void scrub_missing_raid56_pages(s =20 rbio_out: bio_put(bio); -bbio_out: +bioc_out: btrfs_bio_counter_dec(fs_info); - btrfs_put_bbio(bbio); + btrfs_put_bioc(bioc); spin_lock(&sctx->stat_lock); sctx->stat.malloc_errors++; spin_unlock(&sctx->stat_lock); @@ -2826,7 +2825,7 @@ static void scrub_parity_check_and_repai struct btrfs_fs_info *fs_info =3D sctx->fs_info; struct bio *bio; struct btrfs_raid_bio *rbio; - struct btrfs_bio *bbio =3D NULL; + struct btrfs_io_context *bioc =3D NULL; u64 length; int ret; =20 @@ -2838,16 +2837,16 @@ static void scrub_parity_check_and_repai =20 btrfs_bio_counter_inc_blocked(fs_info); ret =3D btrfs_map_sblock(fs_info, BTRFS_MAP_WRITE, sparity->logic_start, - &length, &bbio); - if (ret || !bbio || !bbio->raid_map) - goto bbio_out; + &length, &bioc); + if (ret || !bioc || !bioc->raid_map) + goto bioc_out; =20 bio =3D btrfs_io_bio_alloc(0); bio->bi_iter.bi_sector =3D sparity->logic_start >> 9; bio->bi_private =3D sparity; bio->bi_end_io =3D scrub_parity_bio_endio; =20 - rbio =3D raid56_parity_alloc_scrub_rbio(fs_info, bio, bbio, + rbio =3D raid56_parity_alloc_scrub_rbio(fs_info, bio, bioc, length, sparity->scrub_dev, sparity->dbitmap, sparity->nsectors); @@ -2860,9 +2859,9 @@ static void scrub_parity_check_and_repai =20 rbio_out: bio_put(bio); -bbio_out: +bioc_out: btrfs_bio_counter_dec(fs_info); - btrfs_put_bbio(bbio); + btrfs_put_bioc(bioc); bitmap_or(sparity->ebitmap, sparity->ebitmap, sparity->dbitmap, sparity->nsectors); spin_lock(&sctx->stat_lock); @@ -2901,7 +2900,7 @@ static noinline_for_stack int scrub_raid struct btrfs_root *root =3D fs_info->extent_root; struct btrfs_root *csum_root =3D fs_info->csum_root; struct btrfs_extent_item *extent; - struct btrfs_bio *bbio =3D NULL; + struct btrfs_io_context *bioc =3D NULL; u64 flags; int ret; int slot; @@ -3044,22 +3043,22 @@ again: extent_len); =20 mapped_length =3D extent_len; - bbio =3D NULL; + bioc =3D NULL; ret =3D btrfs_map_block(fs_info, BTRFS_MAP_READ, - extent_logical, &mapped_length, &bbio, + extent_logical, &mapped_length, &bioc, 0); if (!ret) { - if (!bbio || mapped_length < extent_len) + if (!bioc || mapped_length < extent_len) ret =3D -EIO; } if (ret) { - btrfs_put_bbio(bbio); + btrfs_put_bioc(bioc); goto out; } - extent_physical =3D bbio->stripes[0].physical; - extent_mirror_num =3D bbio->mirror_num; - extent_dev =3D bbio->stripes[0].dev; - btrfs_put_bbio(bbio); + extent_physical =3D bioc->stripes[0].physical; + extent_mirror_num =3D bioc->mirror_num; + extent_dev =3D bioc->stripes[0].dev; + btrfs_put_bioc(bioc); =20 ret =3D btrfs_lookup_csums_range(csum_root, extent_logical, @@ -4311,20 +4310,20 @@ static void scrub_remap_extent(struct bt int *extent_mirror_num) { u64 mapped_length; - struct btrfs_bio *bbio =3D NULL; + struct btrfs_io_context *bioc =3D NULL; int ret; =20 mapped_length =3D extent_len; ret =3D btrfs_map_block(fs_info, BTRFS_MAP_READ, extent_logical, - &mapped_length, &bbio, 0); - if (ret || !bbio || mapped_length < extent_len || - !bbio->stripes[0].dev->bdev) { - btrfs_put_bbio(bbio); + &mapped_length, &bioc, 0); + if (ret || !bioc || mapped_length < extent_len || + !bioc->stripes[0].dev->bdev) { + btrfs_put_bioc(bioc); return; } =20 - *extent_physical =3D bbio->stripes[0].physical; - *extent_mirror_num =3D bbio->mirror_num; - *extent_dev =3D bbio->stripes[0].dev; - btrfs_put_bbio(bbio); + *extent_physical =3D bioc->stripes[0].physical; + *extent_mirror_num =3D bioc->mirror_num; + *extent_dev =3D bioc->stripes[0].dev; + btrfs_put_bioc(bioc); } --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -251,7 +251,7 @@ static void btrfs_dev_stat_print_on_load static int __btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op, u64 logical, u64 *length, - struct btrfs_bio **bbio_ret, + struct btrfs_io_context **bioc_ret, int mirror_num, int need_raid_map); =20 /* @@ -5868,7 +5868,7 @@ static int find_live_mirror(struct btrfs } =20 /* Bubble-sort the stripe set to put the parity/syndrome stripes last */ -static void sort_parity_stripes(struct btrfs_bio *bbio, int num_stripes) +static void sort_parity_stripes(struct btrfs_io_context *bioc, int num_str= ipes) { int i; int again =3D 1; @@ -5877,52 +5877,53 @@ static void sort_parity_stripes(struct b again =3D 0; for (i =3D 0; i < num_stripes - 1; i++) { /* Swap if parity is on a smaller index */ - if (bbio->raid_map[i] > bbio->raid_map[i + 1]) { - swap(bbio->stripes[i], bbio->stripes[i + 1]); - swap(bbio->raid_map[i], bbio->raid_map[i + 1]); + if (bioc->raid_map[i] > bioc->raid_map[i + 1]) { + swap(bioc->stripes[i], bioc->stripes[i + 1]); + swap(bioc->raid_map[i], bioc->raid_map[i + 1]); again =3D 1; } } } } =20 -static struct btrfs_bio *alloc_btrfs_bio(int total_stripes, int real_strip= es) +static struct btrfs_io_context *alloc_btrfs_io_context(int total_stripes, + int real_stripes) { - struct btrfs_bio *bbio =3D kzalloc( - /* the size of the btrfs_bio */ - sizeof(struct btrfs_bio) + - /* plus the variable array for the stripes */ - sizeof(struct btrfs_bio_stripe) * (total_stripes) + - /* plus the variable array for the tgt dev */ + struct btrfs_io_context *bioc =3D kzalloc( + /* The size of btrfs_io_context */ + sizeof(struct btrfs_io_context) + + /* Plus the variable array for the stripes */ + sizeof(struct btrfs_io_stripe) * (total_stripes) + + /* Plus the variable array for the tgt dev */ sizeof(int) * (real_stripes) + /* - * plus the raid_map, which includes both the tgt dev - * and the stripes + * Plus the raid_map, which includes both the tgt dev + * and the stripes. */ sizeof(u64) * (total_stripes), GFP_NOFS|__GFP_NOFAIL); =20 - atomic_set(&bbio->error, 0); - refcount_set(&bbio->refs, 1); + atomic_set(&bioc->error, 0); + refcount_set(&bioc->refs, 1); =20 - bbio->tgtdev_map =3D (int *)(bbio->stripes + total_stripes); - bbio->raid_map =3D (u64 *)(bbio->tgtdev_map + real_stripes); + bioc->tgtdev_map =3D (int *)(bioc->stripes + total_stripes); + bioc->raid_map =3D (u64 *)(bioc->tgtdev_map + real_stripes); =20 - return bbio; + return bioc; } =20 -void btrfs_get_bbio(struct btrfs_bio *bbio) +void btrfs_get_bioc(struct btrfs_io_context *bioc) { - WARN_ON(!refcount_read(&bbio->refs)); - refcount_inc(&bbio->refs); + WARN_ON(!refcount_read(&bioc->refs)); + refcount_inc(&bioc->refs); } =20 -void btrfs_put_bbio(struct btrfs_bio *bbio) +void btrfs_put_bioc(struct btrfs_io_context *bioc) { - if (!bbio) + if (!bioc) return; - if (refcount_dec_and_test(&bbio->refs)) - kfree(bbio); + if (refcount_dec_and_test(&bioc->refs)) + kfree(bioc); } =20 /* can REQ_OP_DISCARD be sent with other REQ like REQ_OP_WRITE? */ @@ -5932,11 +5933,11 @@ void btrfs_put_bbio(struct btrfs_bio *bb */ static int __btrfs_map_block_for_discard(struct btrfs_fs_info *fs_info, u64 logical, u64 *length_ret, - struct btrfs_bio **bbio_ret) + struct btrfs_io_context **bioc_ret) { struct extent_map *em; struct map_lookup *map; - struct btrfs_bio *bbio; + struct btrfs_io_context *bioc; u64 length =3D *length_ret; u64 offset; u64 stripe_nr; @@ -5955,8 +5956,8 @@ static int __btrfs_map_block_for_discard int ret =3D 0; int i; =20 - /* discard always return a bbio */ - ASSERT(bbio_ret); + /* Discard always returns a bioc. */ + ASSERT(bioc_ret); =20 em =3D btrfs_get_chunk_map(fs_info, logical, length); if (IS_ERR(em)) @@ -6019,26 +6020,25 @@ static int __btrfs_map_block_for_discard &stripe_index); } =20 - bbio =3D alloc_btrfs_bio(num_stripes, 0); - if (!bbio) { + bioc =3D alloc_btrfs_io_context(num_stripes, 0); + if (!bioc) { ret =3D -ENOMEM; goto out; } =20 for (i =3D 0; i < num_stripes; i++) { - bbio->stripes[i].physical =3D + bioc->stripes[i].physical =3D map->stripes[stripe_index].physical + stripe_offset + stripe_nr * map->stripe_len; - bbio->stripes[i].dev =3D map->stripes[stripe_index].dev; + bioc->stripes[i].dev =3D map->stripes[stripe_index].dev; =20 if (map->type & (BTRFS_BLOCK_GROUP_RAID0 | BTRFS_BLOCK_GROUP_RAID10)) { - bbio->stripes[i].length =3D stripes_per_dev * + bioc->stripes[i].length =3D stripes_per_dev * map->stripe_len; =20 if (i / sub_stripes < remaining_stripes) - bbio->stripes[i].length +=3D - map->stripe_len; + bioc->stripes[i].length +=3D map->stripe_len; =20 /* * Special for the first stripe and @@ -6049,19 +6049,17 @@ static int __btrfs_map_block_for_discard * off end_off */ if (i < sub_stripes) - bbio->stripes[i].length -=3D - stripe_offset; + bioc->stripes[i].length -=3D stripe_offset; =20 if (stripe_index >=3D last_stripe && stripe_index <=3D (last_stripe + sub_stripes - 1)) - bbio->stripes[i].length -=3D - stripe_end_offset; + bioc->stripes[i].length -=3D stripe_end_offset; =20 if (i =3D=3D sub_stripes - 1) stripe_offset =3D 0; } else { - bbio->stripes[i].length =3D length; + bioc->stripes[i].length =3D length; } =20 stripe_index++; @@ -6071,9 +6069,9 @@ static int __btrfs_map_block_for_discard } } =20 - *bbio_ret =3D bbio; - bbio->map_type =3D map->type; - bbio->num_stripes =3D num_stripes; + *bioc_ret =3D bioc; + bioc->map_type =3D map->type; + bioc->num_stripes =3D num_stripes; out: free_extent_map(em); return ret; @@ -6097,7 +6095,7 @@ static int get_extra_mirror_from_replace u64 srcdev_devid, int *mirror_num, u64 *physical) { - struct btrfs_bio *bbio =3D NULL; + struct btrfs_io_context *bioc =3D NULL; int num_stripes; int index_srcdev =3D 0; int found =3D 0; @@ -6106,20 +6104,20 @@ static int get_extra_mirror_from_replace int ret =3D 0; =20 ret =3D __btrfs_map_block(fs_info, BTRFS_MAP_GET_READ_MIRRORS, - logical, &length, &bbio, 0, 0); + logical, &length, &bioc, 0, 0); if (ret) { - ASSERT(bbio =3D=3D NULL); + ASSERT(bioc =3D=3D NULL); return ret; } =20 - num_stripes =3D bbio->num_stripes; + num_stripes =3D bioc->num_stripes; if (*mirror_num > num_stripes) { /* * BTRFS_MAP_GET_READ_MIRRORS does not contain this mirror, * that means that the requested area is not left of the left * cursor */ - btrfs_put_bbio(bbio); + btrfs_put_bioc(bioc); return -EIO; } =20 @@ -6129,7 +6127,7 @@ static int get_extra_mirror_from_replace * pointer to the one of the target drive. */ for (i =3D 0; i < num_stripes; i++) { - if (bbio->stripes[i].dev->devid !=3D srcdev_devid) + if (bioc->stripes[i].dev->devid !=3D srcdev_devid) continue; =20 /* @@ -6137,15 +6135,15 @@ static int get_extra_mirror_from_replace * mirror with the lowest physical address */ if (found && - physical_of_found <=3D bbio->stripes[i].physical) + physical_of_found <=3D bioc->stripes[i].physical) continue; =20 index_srcdev =3D i; found =3D 1; - physical_of_found =3D bbio->stripes[i].physical; + physical_of_found =3D bioc->stripes[i].physical; } =20 - btrfs_put_bbio(bbio); + btrfs_put_bioc(bioc); =20 ASSERT(found); if (!found) @@ -6176,12 +6174,12 @@ static bool is_block_group_to_copy(struc } =20 static void handle_ops_on_dev_replace(enum btrfs_map_op op, - struct btrfs_bio **bbio_ret, + struct btrfs_io_context **bioc_ret, struct btrfs_dev_replace *dev_replace, u64 logical, int *num_stripes_ret, int *max_errors_ret) { - struct btrfs_bio *bbio =3D *bbio_ret; + struct btrfs_io_context *bioc =3D *bioc_ret; u64 srcdev_devid =3D dev_replace->srcdev->devid; int tgtdev_indexes =3D 0; int num_stripes =3D *num_stripes_ret; @@ -6211,17 +6209,17 @@ static void handle_ops_on_dev_replace(en */ index_where_to_add =3D num_stripes; for (i =3D 0; i < num_stripes; i++) { - if (bbio->stripes[i].dev->devid =3D=3D srcdev_devid) { + if (bioc->stripes[i].dev->devid =3D=3D srcdev_devid) { /* write to new disk, too */ - struct btrfs_bio_stripe *new =3D - bbio->stripes + index_where_to_add; - struct btrfs_bio_stripe *old =3D - bbio->stripes + i; + struct btrfs_io_stripe *new =3D + bioc->stripes + index_where_to_add; + struct btrfs_io_stripe *old =3D + bioc->stripes + i; =20 new->physical =3D old->physical; new->length =3D old->length; new->dev =3D dev_replace->tgtdev; - bbio->tgtdev_map[i] =3D index_where_to_add; + bioc->tgtdev_map[i] =3D index_where_to_add; index_where_to_add++; max_errors++; tgtdev_indexes++; @@ -6241,30 +6239,29 @@ static void handle_ops_on_dev_replace(en * full copy of the source drive. */ for (i =3D 0; i < num_stripes; i++) { - if (bbio->stripes[i].dev->devid =3D=3D srcdev_devid) { + if (bioc->stripes[i].dev->devid =3D=3D srcdev_devid) { /* * In case of DUP, in order to keep it simple, * only add the mirror with the lowest physical * address */ if (found && - physical_of_found <=3D - bbio->stripes[i].physical) + physical_of_found <=3D bioc->stripes[i].physical) continue; index_srcdev =3D i; found =3D 1; - physical_of_found =3D bbio->stripes[i].physical; + physical_of_found =3D bioc->stripes[i].physical; } } if (found) { - struct btrfs_bio_stripe *tgtdev_stripe =3D - bbio->stripes + num_stripes; + struct btrfs_io_stripe *tgtdev_stripe =3D + bioc->stripes + num_stripes; =20 tgtdev_stripe->physical =3D physical_of_found; tgtdev_stripe->length =3D - bbio->stripes[index_srcdev].length; + bioc->stripes[index_srcdev].length; tgtdev_stripe->dev =3D dev_replace->tgtdev; - bbio->tgtdev_map[index_srcdev] =3D num_stripes; + bioc->tgtdev_map[index_srcdev] =3D num_stripes; =20 tgtdev_indexes++; num_stripes++; @@ -6273,8 +6270,8 @@ static void handle_ops_on_dev_replace(en =20 *num_stripes_ret =3D num_stripes; *max_errors_ret =3D max_errors; - bbio->num_tgtdevs =3D tgtdev_indexes; - *bbio_ret =3D bbio; + bioc->num_tgtdevs =3D tgtdev_indexes; + *bioc_ret =3D bioc; } =20 static bool need_full_stripe(enum btrfs_map_op op) @@ -6377,7 +6374,7 @@ int btrfs_get_io_geometry(struct btrfs_f static int __btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op, u64 logical, u64 *length, - struct btrfs_bio **bbio_ret, + struct btrfs_io_context **bioc_ret, int mirror_num, int need_raid_map) { struct extent_map *em; @@ -6392,7 +6389,7 @@ static int __btrfs_map_block(struct btrf int num_stripes; int max_errors =3D 0; int tgtdev_indexes =3D 0; - struct btrfs_bio *bbio =3D NULL; + struct btrfs_io_context *bioc =3D NULL; struct btrfs_dev_replace *dev_replace =3D &fs_info->dev_replace; int dev_replace_is_ongoing =3D 0; int num_alloc_stripes; @@ -6401,7 +6398,7 @@ static int __btrfs_map_block(struct btrf u64 raid56_full_stripe_start =3D (u64)-1; struct btrfs_io_geometry geom; =20 - ASSERT(bbio_ret); + ASSERT(bioc_ret); ASSERT(op !=3D BTRFS_MAP_DISCARD); =20 em =3D btrfs_get_chunk_map(fs_info, logical, *length); @@ -6545,20 +6542,20 @@ static int __btrfs_map_block(struct btrf tgtdev_indexes =3D num_stripes; } =20 - bbio =3D alloc_btrfs_bio(num_alloc_stripes, tgtdev_indexes); - if (!bbio) { + bioc =3D alloc_btrfs_io_context(num_alloc_stripes, tgtdev_indexes); + if (!bioc) { ret =3D -ENOMEM; goto out; } =20 for (i =3D 0; i < num_stripes; i++) { - bbio->stripes[i].physical =3D map->stripes[stripe_index].physical + + bioc->stripes[i].physical =3D map->stripes[stripe_index].physical + stripe_offset + stripe_nr * map->stripe_len; - bbio->stripes[i].dev =3D map->stripes[stripe_index].dev; + bioc->stripes[i].dev =3D map->stripes[stripe_index].dev; stripe_index++; } =20 - /* build raid_map */ + /* Build raid_map */ if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK && need_raid_map && (need_full_stripe(op) || mirror_num > 1)) { u64 tmp; @@ -6570,15 +6567,15 @@ static int __btrfs_map_block(struct btrf /* Fill in the logical address of each stripe */ tmp =3D stripe_nr * data_stripes; for (i =3D 0; i < data_stripes; i++) - bbio->raid_map[(i+rot) % num_stripes] =3D + bioc->raid_map[(i + rot) % num_stripes] =3D em->start + (tmp + i) * map->stripe_len; =20 - bbio->raid_map[(i+rot) % map->num_stripes] =3D RAID5_P_STRIPE; + bioc->raid_map[(i + rot) % map->num_stripes] =3D RAID5_P_STRIPE; if (map->type & BTRFS_BLOCK_GROUP_RAID6) - bbio->raid_map[(i+rot+1) % num_stripes] =3D + bioc->raid_map[(i + rot + 1) % num_stripes] =3D RAID6_Q_STRIPE; =20 - sort_parity_stripes(bbio, num_stripes); + sort_parity_stripes(bioc, num_stripes); } =20 if (need_full_stripe(op)) @@ -6586,15 +6583,15 @@ static int __btrfs_map_block(struct btrf =20 if (dev_replace_is_ongoing && dev_replace->tgtdev !=3D NULL && need_full_stripe(op)) { - handle_ops_on_dev_replace(op, &bbio, dev_replace, logical, + handle_ops_on_dev_replace(op, &bioc, dev_replace, logical, &num_stripes, &max_errors); } =20 - *bbio_ret =3D bbio; - bbio->map_type =3D map->type; - bbio->num_stripes =3D num_stripes; - bbio->max_errors =3D max_errors; - bbio->mirror_num =3D mirror_num; + *bioc_ret =3D bioc; + bioc->map_type =3D map->type; + bioc->num_stripes =3D num_stripes; + bioc->max_errors =3D max_errors; + bioc->mirror_num =3D mirror_num; =20 /* * this is the case that REQ_READ && dev_replace_is_ongoing && @@ -6603,9 +6600,9 @@ static int __btrfs_map_block(struct btrf */ if (patch_the_first_stripe_for_dev_replace && num_stripes > 0) { WARN_ON(num_stripes > 1); - bbio->stripes[0].dev =3D dev_replace->tgtdev; - bbio->stripes[0].physical =3D physical_to_patch_in_first_stripe; - bbio->mirror_num =3D map->num_stripes + 1; + bioc->stripes[0].dev =3D dev_replace->tgtdev; + bioc->stripes[0].physical =3D physical_to_patch_in_first_stripe; + bioc->mirror_num =3D map->num_stripes + 1; } out: if (dev_replace_is_ongoing) { @@ -6619,40 +6616,40 @@ out: =20 int btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op, u64 logical, u64 *length, - struct btrfs_bio **bbio_ret, int mirror_num) + struct btrfs_io_context **bioc_ret, int mirror_num) { if (op =3D=3D BTRFS_MAP_DISCARD) return __btrfs_map_block_for_discard(fs_info, logical, - length, bbio_ret); + length, bioc_ret); =20 - return __btrfs_map_block(fs_info, op, logical, length, bbio_ret, + return __btrfs_map_block(fs_info, op, logical, length, bioc_ret, mirror_num, 0); } =20 /* For Scrub/replace */ int btrfs_map_sblock(struct btrfs_fs_info *fs_info, enum btrfs_map_op op, u64 logical, u64 *length, - struct btrfs_bio **bbio_ret) + struct btrfs_io_context **bioc_ret) { - return __btrfs_map_block(fs_info, op, logical, length, bbio_ret, 0, 1); + return __btrfs_map_block(fs_info, op, logical, length, bioc_ret, 0, 1); } =20 -static inline void btrfs_end_bbio(struct btrfs_bio *bbio, struct bio *bio) +static inline void btrfs_end_bioc(struct btrfs_io_context *bioc, struct bi= o *bio) { - bio->bi_private =3D bbio->private; - bio->bi_end_io =3D bbio->end_io; + bio->bi_private =3D bioc->private; + bio->bi_end_io =3D bioc->end_io; bio_endio(bio); =20 - btrfs_put_bbio(bbio); + btrfs_put_bioc(bioc); } =20 static void btrfs_end_bio(struct bio *bio) { - struct btrfs_bio *bbio =3D bio->bi_private; + struct btrfs_io_context *bioc =3D bio->bi_private; int is_orig_bio =3D 0; =20 if (bio->bi_status) { - atomic_inc(&bbio->error); + atomic_inc(&bioc->error); if (bio->bi_status =3D=3D BLK_STS_IOERR || bio->bi_status =3D=3D BLK_STS_TARGET) { struct btrfs_device *dev =3D btrfs_io_bio(bio)->device; @@ -6670,22 +6667,22 @@ static void btrfs_end_bio(struct bio *bi } } =20 - if (bio =3D=3D bbio->orig_bio) + if (bio =3D=3D bioc->orig_bio) is_orig_bio =3D 1; =20 - btrfs_bio_counter_dec(bbio->fs_info); + btrfs_bio_counter_dec(bioc->fs_info); =20 - if (atomic_dec_and_test(&bbio->stripes_pending)) { + if (atomic_dec_and_test(&bioc->stripes_pending)) { if (!is_orig_bio) { bio_put(bio); - bio =3D bbio->orig_bio; + bio =3D bioc->orig_bio; } =20 - btrfs_io_bio(bio)->mirror_num =3D bbio->mirror_num; + btrfs_io_bio(bio)->mirror_num =3D bioc->mirror_num; /* only send an error to the higher layers if it is * beyond the tolerance of the btrfs bio */ - if (atomic_read(&bbio->error) > bbio->max_errors) { + if (atomic_read(&bioc->error) > bioc->max_errors) { bio->bi_status =3D BLK_STS_IOERR; } else { /* @@ -6695,18 +6692,18 @@ static void btrfs_end_bio(struct bio *bi bio->bi_status =3D BLK_STS_OK; } =20 - btrfs_end_bbio(bbio, bio); + btrfs_end_bioc(bioc, bio); } else if (!is_orig_bio) { bio_put(bio); } } =20 -static void submit_stripe_bio(struct btrfs_bio *bbio, struct bio *bio, +static void submit_stripe_bio(struct btrfs_io_context *bioc, struct bio *b= io, u64 physical, struct btrfs_device *dev) { - struct btrfs_fs_info *fs_info =3D bbio->fs_info; + struct btrfs_fs_info *fs_info =3D bioc->fs_info; =20 - bio->bi_private =3D bbio; + bio->bi_private =3D bioc; btrfs_io_bio(bio)->device =3D dev; bio->bi_end_io =3D btrfs_end_bio; bio->bi_iter.bi_sector =3D physical >> 9; @@ -6736,20 +6733,20 @@ static void submit_stripe_bio(struct btr btrfsic_submit_bio(bio); } =20 -static void bbio_error(struct btrfs_bio *bbio, struct bio *bio, u64 logica= l) +static void bioc_error(struct btrfs_io_context *bioc, struct bio *bio, u64= logical) { - atomic_inc(&bbio->error); - if (atomic_dec_and_test(&bbio->stripes_pending)) { + atomic_inc(&bioc->error); + if (atomic_dec_and_test(&bioc->stripes_pending)) { /* Should be the original bio. */ - WARN_ON(bio !=3D bbio->orig_bio); + WARN_ON(bio !=3D bioc->orig_bio); =20 - btrfs_io_bio(bio)->mirror_num =3D bbio->mirror_num; + btrfs_io_bio(bio)->mirror_num =3D bioc->mirror_num; bio->bi_iter.bi_sector =3D logical >> 9; - if (atomic_read(&bbio->error) > bbio->max_errors) + if (atomic_read(&bioc->error) > bioc->max_errors) bio->bi_status =3D BLK_STS_IOERR; else bio->bi_status =3D BLK_STS_OK; - btrfs_end_bbio(bbio, bio); + btrfs_end_bioc(bioc, bio); } } =20 @@ -6764,35 +6761,35 @@ blk_status_t btrfs_map_bio(struct btrfs_ int ret; int dev_nr; int total_devs; - struct btrfs_bio *bbio =3D NULL; + struct btrfs_io_context *bioc =3D NULL; =20 length =3D bio->bi_iter.bi_size; map_length =3D length; =20 btrfs_bio_counter_inc_blocked(fs_info); ret =3D __btrfs_map_block(fs_info, btrfs_op(bio), logical, - &map_length, &bbio, mirror_num, 1); + &map_length, &bioc, mirror_num, 1); if (ret) { btrfs_bio_counter_dec(fs_info); return errno_to_blk_status(ret); } =20 - total_devs =3D bbio->num_stripes; - bbio->orig_bio =3D first_bio; - bbio->private =3D first_bio->bi_private; - bbio->end_io =3D first_bio->bi_end_io; - bbio->fs_info =3D fs_info; - atomic_set(&bbio->stripes_pending, bbio->num_stripes); + total_devs =3D bioc->num_stripes; + bioc->orig_bio =3D first_bio; + bioc->private =3D first_bio->bi_private; + bioc->end_io =3D first_bio->bi_end_io; + bioc->fs_info =3D fs_info; + atomic_set(&bioc->stripes_pending, bioc->num_stripes); =20 - if ((bbio->map_type & BTRFS_BLOCK_GROUP_RAID56_MASK) && + if ((bioc->map_type & BTRFS_BLOCK_GROUP_RAID56_MASK) && ((btrfs_op(bio) =3D=3D BTRFS_MAP_WRITE) || (mirror_num > 1))) { /* In this case, map_length has been set to the length of a single stripe; not the whole write */ if (btrfs_op(bio) =3D=3D BTRFS_MAP_WRITE) { - ret =3D raid56_parity_write(fs_info, bio, bbio, + ret =3D raid56_parity_write(fs_info, bio, bioc, map_length); } else { - ret =3D raid56_parity_recover(fs_info, bio, bbio, + ret =3D raid56_parity_recover(fs_info, bio, bioc, map_length, mirror_num, 1); } =20 @@ -6808,12 +6805,12 @@ blk_status_t btrfs_map_bio(struct btrfs_ } =20 for (dev_nr =3D 0; dev_nr < total_devs; dev_nr++) { - dev =3D bbio->stripes[dev_nr].dev; + dev =3D bioc->stripes[dev_nr].dev; if (!dev || !dev->bdev || test_bit(BTRFS_DEV_STATE_MISSING, &dev->dev_state) || (btrfs_op(first_bio) =3D=3D BTRFS_MAP_WRITE && !test_bit(BTRFS_DEV_STATE_WRITEABLE, &dev->dev_state))) { - bbio_error(bbio, first_bio, logical); + bioc_error(bioc, first_bio, logical); continue; } =20 @@ -6822,7 +6819,7 @@ blk_status_t btrfs_map_bio(struct btrfs_ else bio =3D first_bio; =20 - submit_stripe_bio(bbio, bio, bbio->stripes[dev_nr].physical, dev); + submit_stripe_bio(bioc, bio, bioc->stripes[dev_nr].physical, dev); } btrfs_bio_counter_dec(fs_info); return BLK_STS_OK; --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h @@ -306,11 +306,11 @@ struct btrfs_fs_devices { /* * we need the mirror number and stripe index to be passed around * the call chain while we are processing end_io (especially errors). - * Really, what we need is a btrfs_bio structure that has this info + * Really, what we need is a btrfs_io_context structure that has this info * and is properly sized with its stripe array, but we're not there * quite yet. We have our own btrfs bioset, and all of the bios * we allocate are actually btrfs_io_bios. We'll cram as much of - * struct btrfs_bio as we can into this over time. + * struct btrfs_io_context as we can into this over time. */ struct btrfs_io_bio { unsigned int mirror_num; @@ -339,13 +339,29 @@ static inline void btrfs_io_bio_free_csu } } =20 -struct btrfs_bio_stripe { +struct btrfs_io_stripe { struct btrfs_device *dev; u64 physical; u64 length; /* only used for discard mappings */ }; =20 -struct btrfs_bio { +/* + * Context for IO subsmission for device stripe. + * + * - Track the unfinished mirrors for mirror based profiles + * Mirror based profiles are SINGLE/DUP/RAID1/RAID10. + * + * - Contain the logical -> physical mapping info + * Used by submit_stripe_bio() for mapping logical bio + * into physical device address. + * + * - Contain device replace info + * Used by handle_ops_on_dev_replace() to copy logical bios + * into the new device. + * + * - Contain RAID56 full stripe logical bytenrs + */ +struct btrfs_io_context { refcount_t refs; atomic_t stripes_pending; struct btrfs_fs_info *fs_info; @@ -365,7 +381,7 @@ struct btrfs_bio { * so raid_map[0] is the start of our full stripe */ u64 *raid_map; - struct btrfs_bio_stripe stripes[]; + struct btrfs_io_stripe stripes[]; }; =20 struct btrfs_device_info { @@ -400,11 +416,11 @@ struct map_lookup { int num_stripes; int sub_stripes; int verified_stripes; /* For mount time dev extent verification */ - struct btrfs_bio_stripe stripes[]; + struct btrfs_io_stripe stripes[]; }; =20 #define map_lookup_size(n) (sizeof(struct map_lookup) + \ - (sizeof(struct btrfs_bio_stripe) * (n))) + (sizeof(struct btrfs_io_stripe) * (n))) =20 struct btrfs_balance_args; struct btrfs_balance_progress; @@ -457,14 +473,14 @@ static inline enum btrfs_map_op btrfs_op } } =20 -void btrfs_get_bbio(struct btrfs_bio *bbio); -void btrfs_put_bbio(struct btrfs_bio *bbio); +void btrfs_get_bioc(struct btrfs_io_context *bioc); +void btrfs_put_bioc(struct btrfs_io_context *bioc); int btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op, u64 logical, u64 *length, - struct btrfs_bio **bbio_ret, int mirror_num); + struct btrfs_io_context **bioc_ret, int mirror_num); int btrfs_map_sblock(struct btrfs_fs_info *fs_info, enum btrfs_map_op op, u64 logical, u64 *length, - struct btrfs_bio **bbio_ret); + struct btrfs_io_context **bioc_ret); int btrfs_get_io_geometry(struct btrfs_fs_info *fs_info, struct extent_map= *map, enum btrfs_map_op op, u64 logical, struct btrfs_io_geometry *io_geom); --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -1502,27 +1502,27 @@ int btrfs_zoned_issue_zeroout(struct btr static int read_zone_info(struct btrfs_fs_info *fs_info, u64 logical, struct blk_zone *zone) { - struct btrfs_bio *bbio =3D NULL; + struct btrfs_io_context *bioc =3D NULL; u64 mapped_length =3D PAGE_SIZE; unsigned int nofs_flag; int nmirrors; int i, ret; =20 ret =3D btrfs_map_sblock(fs_info, BTRFS_MAP_GET_READ_MIRRORS, logical, - &mapped_length, &bbio); - if (ret || !bbio || mapped_length < PAGE_SIZE) { - btrfs_put_bbio(bbio); + &mapped_length, &bioc); + if (ret || !bioc || mapped_length < PAGE_SIZE) { + btrfs_put_bioc(bioc); return -EIO; } =20 - if (bbio->map_type & BTRFS_BLOCK_GROUP_RAID56_MASK) + if (bioc->map_type & BTRFS_BLOCK_GROUP_RAID56_MASK) return -EINVAL; =20 nofs_flag =3D memalloc_nofs_save(); - nmirrors =3D (int)bbio->num_stripes; + nmirrors =3D (int)bioc->num_stripes; for (i =3D 0; i < nmirrors; i++) { - u64 physical =3D bbio->stripes[i].physical; - struct btrfs_device *dev =3D bbio->stripes[i].dev; + u64 physical =3D bioc->stripes[i].physical; + struct btrfs_device *dev =3D bioc->stripes[i].dev; =20 /* Missing device */ if (!dev->bdev) From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 305D0C43334 for ; Tue, 19 Jul 2022 12:40:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238093AbiGSMkp (ORCPT ); Tue, 19 Jul 2022 08:40:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241093AbiGSMir (ORCPT ); Tue, 19 Jul 2022 08:38: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 AEAEE24F0B; Tue, 19 Jul 2022 05:15: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 3C58A60F10; Tue, 19 Jul 2022 12:15:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 223F9C341C6; Tue, 19 Jul 2022 12:15:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232922; bh=Fm3LsUhGs+2lwQNvSwWdfXPnG9aC/70429wLcfFpyA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ur1c2C80iftkPF0HjY6SCMmSCjY/Y75myPeq2o8pao9gLQ0VujwD5fgSNbLw01Dlc m7TNms7/BUmy3lGDJlPl5N0gcO3Prqkjt0cZF6hFkcu+uAa+U9WPL0Lkzd8GMXDZMv 1pXIfy0IH9GVm1Io7/Cwr+60J3TecdwdTF79f++Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anand Jain , Christoph Hellwig , David Sterba , Sasha Levin Subject: [PATCH 5.15 112/167] btrfs: zoned: fix a leaked bioc in read_zone_info Date: Tue, 19 Jul 2022 13:54:04 +0200 Message-Id: <20220719114707.350845467@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christoph Hellwig [ Upstream commit 2963457829decf0c824a443238d251151ed18ff5 ] The bioc would leak on the normal completion path and also on the RAID56 check (but that one won't happen in practice due to the invalid combination with zoned mode). Fixes: 7db1c5d14dcd ("btrfs: zoned: support dev-replace in zoned filesystem= s") CC: stable@vger.kernel.org # 5.16+ Reviewed-by: Anand Jain Signed-off-by: Christoph Hellwig [ update changelog ] Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- fs/btrfs/zoned.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index ce4eeffc4f12..574769f921a2 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -1511,12 +1511,14 @@ static int read_zone_info(struct btrfs_fs_info *fs_= info, u64 logical, ret =3D btrfs_map_sblock(fs_info, BTRFS_MAP_GET_READ_MIRRORS, logical, &mapped_length, &bioc); if (ret || !bioc || mapped_length < PAGE_SIZE) { - btrfs_put_bioc(bioc); - return -EIO; + ret =3D -EIO; + goto out_put_bioc; } =20 - if (bioc->map_type & BTRFS_BLOCK_GROUP_RAID56_MASK) - return -EINVAL; + if (bioc->map_type & BTRFS_BLOCK_GROUP_RAID56_MASK) { + ret =3D -EINVAL; + goto out_put_bioc; + } =20 nofs_flag =3D memalloc_nofs_save(); nmirrors =3D (int)bioc->num_stripes; @@ -1535,7 +1537,8 @@ static int read_zone_info(struct btrfs_fs_info *fs_in= fo, u64 logical, break; } memalloc_nofs_restore(nofs_flag); - +out_put_bioc: + btrfs_put_bioc(bioc); return ret; } =20 --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFCDDC433EF for ; Tue, 19 Jul 2022 12:45:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242148AbiGSMpk (ORCPT ); Tue, 19 Jul 2022 08:45:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241669AbiGSMoU (ORCPT ); Tue, 19 Jul 2022 08:44:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECD1485F8D; Tue, 19 Jul 2022 05:17:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7943EB81B2C; Tue, 19 Jul 2022 12:17:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5840C36AE2; Tue, 19 Jul 2022 12:17:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233025; bh=cJ4EpiTnne1jAnseMdkgLxRJnnbD3zSSBr50r+xpmcs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IueIeImOeVSOS+6d92nDxuJirC18GcFwj0v2j9w6b0ii6RflmfPQfb2nh6k+MLZCr VWJ+ke+f6g+SgZQRGTl5hR6SsG1xcJdNRzenTG0oZwYZFAttG3//5sEXail7lspds0 oI3zZAvUL8jiiKCDsFQWScE9Kr1cTnDW1UxDIJEY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Howells , Namjae Jeon , Hyunchul Lee , Steve French , Sasha Levin Subject: [PATCH 5.15 113/167] ksmbd: use SOCK_NONBLOCK type for kernel_accept() Date: Tue, 19 Jul 2022 13:54:05 +0200 Message-Id: <20220719114707.456060283@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Namjae Jeon [ Upstream commit fe0fde09e1cb83effcf8fafa372533f438d93a1a ] I found that normally it is O_NONBLOCK but there are different value for some arch. /include/linux/net.h: #ifndef SOCK_NONBLOCK #define SOCK_NONBLOCK O_NONBLOCK #endif /arch/alpha/include/asm/socket.h: #define SOCK_NONBLOCK 0x40000000 Use SOCK_NONBLOCK instead of O_NONBLOCK for kernel_accept(). Suggested-by: David Howells Signed-off-by: Namjae Jeon Reviewed-by: Hyunchul Lee Signed-off-by: Steve French Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- fs/ksmbd/transport_tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ksmbd/transport_tcp.c b/fs/ksmbd/transport_tcp.c index 82a1429bbe12..755329c295ca 100644 --- a/fs/ksmbd/transport_tcp.c +++ b/fs/ksmbd/transport_tcp.c @@ -230,7 +230,7 @@ static int ksmbd_kthread_fn(void *p) break; } ret =3D kernel_accept(iface->ksmbd_socket, &client_sk, - O_NONBLOCK); + SOCK_NONBLOCK); mutex_unlock(&iface->sock_release_lock); if (ret) { if (ret =3D=3D -EAGAIN) --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23824C433EF for ; Tue, 19 Jul 2022 12:41:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241421AbiGSMll (ORCPT ); Tue, 19 Jul 2022 08:41:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241364AbiGSMja (ORCPT ); Tue, 19 Jul 2022 08:39:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FCEF53D1E; Tue, 19 Jul 2022 05:15: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 B44C8B81B08; Tue, 19 Jul 2022 12:15:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09DF0C341C6; Tue, 19 Jul 2022 12:15:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232950; bh=qxmioDZyujmnpHoNtR0DVNnhK2IOg2mO6CRoNr8v3fg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2TtkmIIaSBpdkNs6WUvT9+UeJBGr+O5w9gQ+pgZwOSTn2RUbUUlEU1vTh9nrTFN2K PC9N7IEk72p4+5wZjE8Tf3guG6j4789dScH687r7/uDz1RDZqUCJ5HUdlL2e09OwMv 0IVZSdVoocWUKJM3EjX5D8URAfNgTyoEI61jbf8o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Lynch , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Michael Ellerman , Sasha Levin Subject: [PATCH 5.15 114/167] powerpc/xive/spapr: correct bitmap allocation size Date: Tue, 19 Jul 2022 13:54:06 +0200 Message-Id: <20220719114707.554183659@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nathan Lynch [ Upstream commit 19fc5bb93c6bbdce8292b4d7eed04e2fa118d2fe ] kasan detects access beyond the end of the xibm->bitmap allocation: BUG: KASAN: slab-out-of-bounds in _find_first_zero_bit+0x40/0x140 Read of size 8 at addr c00000001d1d0118 by task swapper/0/1 CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.19.0-rc2-00001-g90df023b36dd #28 Call Trace: [c00000001d98f770] [c0000000012baab8] dump_stack_lvl+0xac/0x108 (unreliable) [c00000001d98f7b0] [c00000000068faac] print_report+0x37c/0x710 [c00000001d98f880] [c0000000006902c0] kasan_report+0x110/0x354 [c00000001d98f950] [c000000000692324] __asan_load8+0xa4/0xe0 [c00000001d98f970] [c0000000011c6ed0] _find_first_zero_bit+0x40/0x140 [c00000001d98f9b0] [c0000000000dbfbc] xive_spapr_get_ipi+0xcc/0x260 [c00000001d98fa70] [c0000000000d6d28] xive_setup_cpu_ipi+0x1e8/0x450 [c00000001d98fb30] [c000000004032a20] pSeries_smp_probe+0x5c/0x118 [c00000001d98fb60] [c000000004018b44] smp_prepare_cpus+0x944/0x9ac [c00000001d98fc90] [c000000004009f9c] kernel_init_freeable+0x2d4/0x640 [c00000001d98fd90] [c0000000000131e8] kernel_init+0x28/0x1d0 [c00000001d98fe10] [c00000000000cd54] ret_from_kernel_thread+0x5c/0x64 Allocated by task 0: kasan_save_stack+0x34/0x70 __kasan_kmalloc+0xb4/0xf0 __kmalloc+0x268/0x540 xive_spapr_init+0x4d0/0x77c pseries_init_irq+0x40/0x27c init_IRQ+0x44/0x84 start_kernel+0x2a4/0x538 start_here_common+0x1c/0x20 The buggy address belongs to the object at c00000001d1d0118 which belongs to the cache kmalloc-8 of size 8 The buggy address is located 0 bytes inside of 8-byte region [c00000001d1d0118, c00000001d1d0120) The buggy address belongs to the physical page: page:c00c000000074740 refcount:1 mapcount:0 mapping:0000000000000000 index:= 0xc00000001d1d0558 pfn:0x1d1d flags: 0x7ffff000000200(slab|node=3D0|zone=3D0|lastcpupid=3D0x7ffff) raw: 007ffff000000200 c00000001d0003c8 c00000001d0003c8 c00000001d010480 raw: c00000001d1d0558 0000000001e1000a 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: c00000001d1d0000: fc 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc c00000001d1d0080: fc fc 00 fc fc fc fc fc fc fc fc fc fc fc fc fc >c00000001d1d0100: fc fc fc 02 fc fc fc fc fc fc fc fc fc fc fc fc ^ c00000001d1d0180: fc fc fc fc 04 fc fc fc fc fc fc fc fc fc fc fc c00000001d1d0200: fc fc fc fc fc 04 fc fc fc fc fc fc fc fc fc fc This happens because the allocation uses the wrong unit (bits) when it should pass (BITS_TO_LONGS(count) * sizeof(long)) or equivalent. With small numbers of bits, the allocated object can be smaller than sizeof(long), which results in invalid accesses. Use bitmap_zalloc() to allocate and initialize the irq bitmap, paired with bitmap_free() for consistency. Signed-off-by: Nathan Lynch Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220623182509.3985625-1-nathanl@linux.ibm.= com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/powerpc/sysdev/xive/spapr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/sysdev/xive/spapr.c b/arch/powerpc/sysdev/xive/sp= apr.c index a82f32fbe772..583b2c6df390 100644 --- a/arch/powerpc/sysdev/xive/spapr.c +++ b/arch/powerpc/sysdev/xive/spapr.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -55,7 +56,7 @@ static int xive_irq_bitmap_add(int base, int count) spin_lock_init(&xibm->lock); xibm->base =3D base; xibm->count =3D count; - xibm->bitmap =3D kzalloc(xibm->count, GFP_KERNEL); + xibm->bitmap =3D bitmap_zalloc(xibm->count, GFP_KERNEL); if (!xibm->bitmap) { kfree(xibm); return -ENOMEM; @@ -73,7 +74,7 @@ static void xive_irq_bitmap_remove_all(void) =20 list_for_each_entry_safe(xibm, tmp, &xive_irq_bitmaps, list) { list_del(&xibm->list); - kfree(xibm->bitmap); + bitmap_free(xibm->bitmap); kfree(xibm); } } --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5513C43334 for ; Tue, 19 Jul 2022 12:43:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241358AbiGSMnL (ORCPT ); Tue, 19 Jul 2022 08:43:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239439AbiGSMmr (ORCPT ); Tue, 19 Jul 2022 08:42:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C25537FE6C; Tue, 19 Jul 2022 05:16:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ACF656182A; Tue, 19 Jul 2022 12:16:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F01EC341C6; Tue, 19 Jul 2022 12:16:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232981; bh=vaJUynLGbfCplRsDW60OG5aSx//g6F4tBTnT7pWjYiA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1kO+/yim9SL6tEQTpC0A2tXMGCm5RP/lCffGci94TV5FAKK/8iyhz+6EfXyKA7MHJ 5nrT40WFAWvfkb034MDxGkOczRciRiFrOnSUIAraRVIJnj/oXyFGFYcqUdmBEDJQqZ 95da9yVdQQ7mrIrrEai8bbPF7u4xK8qro435roWY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eli Cohen , "Michael S. Tsirkin" , Jason Wang , =?UTF-8?q?Eugenio=20P=C3=A9rez?= , Sasha Levin Subject: [PATCH 5.15 115/167] vdpa/mlx5: Initialize CVQ vringh only once Date: Tue, 19 Jul 2022 13:54:07 +0200 Message-Id: <20220719114707.667896153@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eli Cohen [ Upstream commit ace9252446ec615cd79a5f77d90edb25c0b9d024 ] Currently, CVQ vringh is initialized inside setup_virtqueues() which is called every time a memory update is done. This is undesirable since it resets all the context of the vring, including the available and used indices. Move the initialization to mlx5_vdpa_set_status() when VIRTIO_CONFIG_S_DRIVER_OK is set. Signed-off-by: Eli Cohen Message-Id: <20220613075958.511064-2-elic@nvidia.com> Signed-off-by: Michael S. Tsirkin Acked-by: Jason Wang Acked-by: Eugenio P=C3=A9rez Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5= _vnet.c index 467a349dc26c..e748c00789f0 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -1898,7 +1898,6 @@ static int verify_driver_features(struct mlx5_vdpa_de= v *mvdev, u64 features) static int setup_virtqueues(struct mlx5_vdpa_dev *mvdev) { struct mlx5_vdpa_net *ndev =3D to_mlx5_vdpa_ndev(mvdev); - struct mlx5_control_vq *cvq =3D &mvdev->cvq; int err; int i; =20 @@ -1908,16 +1907,6 @@ static int setup_virtqueues(struct mlx5_vdpa_dev *mv= dev) goto err_vq; } =20 - if (mvdev->actual_features & BIT_ULL(VIRTIO_NET_F_CTRL_VQ)) { - err =3D vringh_init_iotlb(&cvq->vring, mvdev->actual_features, - MLX5_CVQ_MAX_ENT, false, - (struct vring_desc *)(uintptr_t)cvq->desc_addr, - (struct vring_avail *)(uintptr_t)cvq->driver_addr, - (struct vring_used *)(uintptr_t)cvq->device_addr); - if (err) - goto err_vq; - } - return 0; =20 err_vq: @@ -2184,6 +2173,21 @@ static void clear_vqs_ready(struct mlx5_vdpa_net *nd= ev) ndev->mvdev.cvq.ready =3D false; } =20 +static int setup_cvq_vring(struct mlx5_vdpa_dev *mvdev) +{ + struct mlx5_control_vq *cvq =3D &mvdev->cvq; + int err =3D 0; + + if (mvdev->actual_features & BIT_ULL(VIRTIO_NET_F_CTRL_VQ)) + err =3D vringh_init_iotlb(&cvq->vring, mvdev->actual_features, + MLX5_CVQ_MAX_ENT, false, + (struct vring_desc *)(uintptr_t)cvq->desc_addr, + (struct vring_avail *)(uintptr_t)cvq->driver_addr, + (struct vring_used *)(uintptr_t)cvq->device_addr); + + return err; +} + static void mlx5_vdpa_set_status(struct vdpa_device *vdev, u8 status) { struct mlx5_vdpa_dev *mvdev =3D to_mvdev(vdev); @@ -2194,6 +2198,11 @@ static void mlx5_vdpa_set_status(struct vdpa_device = *vdev, u8 status) =20 if ((status ^ ndev->mvdev.status) & VIRTIO_CONFIG_S_DRIVER_OK) { if (status & VIRTIO_CONFIG_S_DRIVER_OK) { + err =3D setup_cvq_vring(mvdev); + if (err) { + mlx5_vdpa_warn(mvdev, "failed to setup control VQ vring\n"); + goto err_setup; + } err =3D setup_driver(mvdev); if (err) { mlx5_vdpa_warn(mvdev, "failed to setup driver\n"); --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B02DDC43334 for ; Tue, 19 Jul 2022 12:46:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241544AbiGSMqI (ORCPT ); Tue, 19 Jul 2022 08:46:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241483AbiGSMn7 (ORCPT ); Tue, 19 Jul 2022 08:43:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EA8682466; Tue, 19 Jul 2022 05:17:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 35C1DB81B2E; Tue, 19 Jul 2022 12:16:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93CF0C341C6; Tue, 19 Jul 2022 12:16:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233005; bh=XuABzMacapUPj02uf/mQtFYuIsg4w+Lm1rTeYvXdPwA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vhtqLyq/EphofoZ6U8GZ9LD8rl5o1JWAom4KBDBYJlDTlvg4EZFyzisHR2431wr1l xro89JyS7BZtKqCLDdw/V8lze3ukOd4uw5iFC/R4X+6WqMK/DYdPSJYfvFCRdhmoRz BO1uEsCOSqVu5DAVEEx30BMU7tPHoZ1IyTkNiIOM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Parav Pandit , "Michael S. Tsirkin" , Xie Yongji , Jason Wang , Sasha Levin Subject: [PATCH 5.15 116/167] vduse: Tie vduse mgmtdev and its device Date: Tue, 19 Jul 2022 13:54:08 +0200 Message-Id: <20220719114707.784885019@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Parav Pandit [ Upstream commit 0e0348ac3f0a6e6606f1aa5acb1803ada913aa3d ] vduse devices are not backed by any real devices such as PCI. Hence it doesn't have any parent device linked to it. Kernel driver model in [1] suggests to avoid an empty device release callback. Hence tie the mgmtdevice object's life cycle to an allocate dummy struct device instead of static one. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree= /Documentation/core-api/kobject.rst?h=3Dv5.18-rc7#n284 Signed-off-by: Parav Pandit Message-Id: <20220613195223.473966-1-parav@nvidia.com> Signed-off-by: Michael S. Tsirkin Reviewed-by: Xie Yongji Acked-by: Jason Wang Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/vdpa/vdpa_user/vduse_dev.c | 60 ++++++++++++++++++------------ 1 file changed, 37 insertions(+), 23 deletions(-) diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vd= use_dev.c index 9270398caf15..73e67fa88972 100644 --- a/drivers/vdpa/vdpa_user/vduse_dev.c +++ b/drivers/vdpa/vdpa_user/vduse_dev.c @@ -1466,16 +1466,12 @@ static char *vduse_devnode(struct device *dev, umod= e_t *mode) return kasprintf(GFP_KERNEL, "vduse/%s", dev_name(dev)); } =20 -static void vduse_mgmtdev_release(struct device *dev) -{ -} - -static struct device vduse_mgmtdev =3D { - .init_name =3D "vduse", - .release =3D vduse_mgmtdev_release, +struct vduse_mgmt_dev { + struct vdpa_mgmt_dev mgmt_dev; + struct device dev; }; =20 -static struct vdpa_mgmt_dev mgmt_dev; +static struct vduse_mgmt_dev *vduse_mgmt; =20 static int vduse_dev_init_vdpa(struct vduse_dev *dev, const char *name) { @@ -1500,7 +1496,7 @@ static int vduse_dev_init_vdpa(struct vduse_dev *dev,= const char *name) } set_dma_ops(&vdev->vdpa.dev, &vduse_dev_dma_ops); vdev->vdpa.dma_dev =3D &vdev->vdpa.dev; - vdev->vdpa.mdev =3D &mgmt_dev; + vdev->vdpa.mdev =3D &vduse_mgmt->mgmt_dev; =20 return 0; } @@ -1545,34 +1541,52 @@ static struct virtio_device_id id_table[] =3D { { 0 }, }; =20 -static struct vdpa_mgmt_dev mgmt_dev =3D { - .device =3D &vduse_mgmtdev, - .id_table =3D id_table, - .ops =3D &vdpa_dev_mgmtdev_ops, -}; +static void vduse_mgmtdev_release(struct device *dev) +{ + struct vduse_mgmt_dev *mgmt_dev; + + mgmt_dev =3D container_of(dev, struct vduse_mgmt_dev, dev); + kfree(mgmt_dev); +} =20 static int vduse_mgmtdev_init(void) { int ret; =20 - ret =3D device_register(&vduse_mgmtdev); - if (ret) + vduse_mgmt =3D kzalloc(sizeof(*vduse_mgmt), GFP_KERNEL); + if (!vduse_mgmt) + return -ENOMEM; + + ret =3D dev_set_name(&vduse_mgmt->dev, "vduse"); + if (ret) { + kfree(vduse_mgmt); return ret; + } =20 - ret =3D vdpa_mgmtdev_register(&mgmt_dev); + vduse_mgmt->dev.release =3D vduse_mgmtdev_release; + + ret =3D device_register(&vduse_mgmt->dev); if (ret) - goto err; + goto dev_reg_err; =20 - return 0; -err: - device_unregister(&vduse_mgmtdev); + vduse_mgmt->mgmt_dev.id_table =3D id_table; + vduse_mgmt->mgmt_dev.ops =3D &vdpa_dev_mgmtdev_ops; + vduse_mgmt->mgmt_dev.device =3D &vduse_mgmt->dev; + ret =3D vdpa_mgmtdev_register(&vduse_mgmt->mgmt_dev); + if (ret) + device_unregister(&vduse_mgmt->dev); + + return ret; + +dev_reg_err: + put_device(&vduse_mgmt->dev); return ret; } =20 static void vduse_mgmtdev_exit(void) { - vdpa_mgmtdev_unregister(&mgmt_dev); - device_unregister(&vduse_mgmtdev); + vdpa_mgmtdev_unregister(&vduse_mgmt->mgmt_dev); + device_unregister(&vduse_mgmt->dev); } =20 static int vduse_init(void) --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4BF7CCA47F for ; Tue, 19 Jul 2022 12:47:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241285AbiGSMpX (ORCPT ); Tue, 19 Jul 2022 08:45:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237992AbiGSMoC (ORCPT ); Tue, 19 Jul 2022 08:44:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B934582F8F; Tue, 19 Jul 2022 05:17: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 3C781B81B31; Tue, 19 Jul 2022 12:16:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 844A3C341C6; Tue, 19 Jul 2022 12:16:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233007; bh=03dBgzcmkR/ZZgI2wyRT32ne7whuWwal3v7bzdM0djc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l2u7l0Jtl7oX9GT8gIckWVSbfCO82A0qiZQtnDULKz302lnpu/5r1Z8tGRRb+CFWK CwBiT3ToYs90wfs8nU2LxdbIh9t2foQhasmDGdyG/59yqZMpp7OcQwoo550cT0+dEr 9iY5a/lbdydnrIG1eIdx3r9EtF1DbH9sZsy6PUAg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephan Gerhold , "Michael S. Tsirkin" , Sasha Levin Subject: [PATCH 5.15 117/167] virtio_mmio: Add missing PM calls to freeze/restore Date: Tue, 19 Jul 2022 13:54:09 +0200 Message-Id: <20220719114707.902453879@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stephan Gerhold [ Upstream commit ed7ac37fde33ccd84e4bd2b9363c191f925364c7 ] Most virtio drivers provide freeze/restore callbacks to finish up device usage before suspend and to reinitialize the virtio device after resume. However, these callbacks are currently only called when using virtio_pci. virtio_mmio does not have any PM ops defined. This causes problems for example after suspend to disk (hibernation), since the virtio devices might lose their state after the VMM is restarted. Calling virtio_device_freeze()/restore() ensures that the virtio devices are re-initialized correctly. Fix this by implementing the dev_pm_ops for virtio_mmio, similar to virtio_pci_common. Signed-off-by: Stephan Gerhold Message-Id: <20220621110621.3638025-2-stephan.gerhold@kernkonzept.com> Signed-off-by: Michael S. Tsirkin Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/virtio/virtio_mmio.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index 1dd396d4bebb..7522832529dd 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -62,6 +62,7 @@ #include #include #include +#include #include #include #include @@ -543,6 +544,25 @@ static const struct virtio_config_ops virtio_mmio_conf= ig_ops =3D { .get_shm_region =3D vm_get_shm_region, }; =20 +#ifdef CONFIG_PM_SLEEP +static int virtio_mmio_freeze(struct device *dev) +{ + struct virtio_mmio_device *vm_dev =3D dev_get_drvdata(dev); + + return virtio_device_freeze(&vm_dev->vdev); +} + +static int virtio_mmio_restore(struct device *dev) +{ + struct virtio_mmio_device *vm_dev =3D dev_get_drvdata(dev); + + return virtio_device_restore(&vm_dev->vdev); +} + +static const struct dev_pm_ops virtio_mmio_pm_ops =3D { + SET_SYSTEM_SLEEP_PM_OPS(virtio_mmio_freeze, virtio_mmio_restore) +}; +#endif =20 static void virtio_mmio_release_dev(struct device *_d) { @@ -786,6 +806,9 @@ static struct platform_driver virtio_mmio_driver =3D { .name =3D "virtio-mmio", .of_match_table =3D virtio_mmio_match, .acpi_match_table =3D ACPI_PTR(virtio_mmio_acpi_match), +#ifdef CONFIG_PM_SLEEP + .pm =3D &virtio_mmio_pm_ops, +#endif }, }; =20 --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0514DC433EF for ; Tue, 19 Jul 2022 12:43:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241472AbiGSMnw (ORCPT ); Tue, 19 Jul 2022 08:43:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241504AbiGSMnU (ORCPT ); Tue, 19 Jul 2022 08:43: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 B1BE3820CF; Tue, 19 Jul 2022 05:16:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 723AD6177F; Tue, 19 Jul 2022 12:16:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 506F8C341C6; Tue, 19 Jul 2022 12:16:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233010; bh=aArpVS4VNheVFDiOhTep3qwKK7+LFJJviBSs/dkrB5s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kQOfxJwcgOAOn4mLWU0nI4RYf8ShUIZd51CEg536nriggji2cJQcUYgPa+CxSroxw 4iojT38HxInoTbDMjAIyGY4wKWIUrDJ0Gc2/15nNibXpftrzWDpzSzautqC/kRyeaz S+nZc0SSAgrgyEjRXMRqMGDjDnS/4mkcF578jRx0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephan Gerhold , "Michael S. Tsirkin" , Sasha Levin Subject: [PATCH 5.15 118/167] virtio_mmio: Restore guest page size on resume Date: Tue, 19 Jul 2022 13:54:10 +0200 Message-Id: <20220719114707.992732444@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stephan Gerhold [ Upstream commit e0c2ce8217955537dd5434baeba061f209797119 ] Virtio devices might lose their state when the VMM is restarted after a suspend to disk (hibernation) cycle. This means that the guest page size register must be restored for the virtio_mmio legacy interface, since otherwise the virtio queues are not functional. This is particularly problematic for QEMU that currently still defaults to using the legacy interface for virtio_mmio. Write the guest page size register again in virtio_mmio_restore() to make legacy virtio_mmio devices work correctly after hibernation. Signed-off-by: Stephan Gerhold Message-Id: <20220621110621.3638025-3-stephan.gerhold@kernkonzept.com> Signed-off-by: Michael S. Tsirkin Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/virtio/virtio_mmio.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index 7522832529dd..fe696aafaed8 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -556,6 +556,9 @@ static int virtio_mmio_restore(struct device *dev) { struct virtio_mmio_device *vm_dev =3D dev_get_drvdata(dev); =20 + if (vm_dev->version =3D=3D 1) + writel(PAGE_SIZE, vm_dev->base + VIRTIO_MMIO_GUEST_PAGE_SIZE); + return virtio_device_restore(&vm_dev->vdev); } =20 --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FB28C433EF for ; Tue, 19 Jul 2022 12:45:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241200AbiGSMoC (ORCPT ); Tue, 19 Jul 2022 08:44:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241119AbiGSMnW (ORCPT ); Tue, 19 Jul 2022 08:43: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 86065820F0; Tue, 19 Jul 2022 05:16: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 E8E36B81B1A; Tue, 19 Jul 2022 12:16:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36091C341CA; Tue, 19 Jul 2022 12:16:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233013; bh=GqYSiyEiYN54B9KbL1CA43tpPPB30YDlNdA9ZXdKhCM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tLXM/2EjNB5IQ6nw+3sNmf0GYUSh5RdHRk9eLqyYIaHSODTHIJfNyQYU8CfRpxD4C duLKiHniluYiFn8R/Yqe8ODv0fUADou+QHn42FiuOGNNbuKxarY8TATduygffOrLa+ 4P15orxl27KYlObAZAKmPMABnqlHe8Ib0drC5liY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Radim Hrazdil , Florian Westphal , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.15 119/167] netfilter: br_netfilter: do not skip all hooks with 0 priority Date: Tue, 19 Jul 2022 13:54:11 +0200 Message-Id: <20220719114708.085973251@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal [ Upstream commit c2577862eeb0be94f151f2f1fff662b028061b00 ] When br_netfilter module is loaded, skbs may be diverted to the ipv4/ipv6 hooks, just like as if we were routing. Unfortunately, bridge filter hooks with priority 0 may be skipped in this case. Example: 1. an nftables bridge ruleset is loaded, with a prerouting hook that has priority 0. 2. interface is added to the bridge. 3. no tcp packet is ever seen by the bridge prerouting hook. 4. flush the ruleset 5. load the bridge ruleset again. 6. tcp packets are processed as expected. After 1) the only registered hook is the bridge prerouting hook, but its not called yet because the bridge hasn't been brought up yet. After 2), hook order is: 0 br_nf_pre_routing // br_netfilter internal hook 0 chain bridge f prerouting // nftables bridge ruleset The packet is diverted to br_nf_pre_routing. If call-iptables is off, the nftables bridge ruleset is called as expected. But if its enabled, br_nf_hook_thresh() will skip it because it assumes that all 0-priority hooks had been called previously in bridge context. To avoid this, check for the br_nf_pre_routing hook itself, we need to resume directly after it, even if this hook has a priority of 0. Unfortunately, this still results in different packet flow. With this fix, the eval order after in 3) is: 1. br_nf_pre_routing 2. ip(6)tables (if enabled) 3. nftables bridge but after 5 its the much saner: 1. nftables bridge 2. br_nf_pre_routing 3. ip(6)tables (if enabled) Unfortunately I don't see a solution here: It would be possible to move br_nf_pre_routing to a higher priority so that it will be called later in the pipeline, but this also impacts ebtables evaluation order, and would still result in this very ordering problem for all nftables-bridge hooks with the same priority as the br_nf_pre_routing one. Searching back through the git history I don't think this has ever behaved in any other way, hence, no fixes-tag. Reported-by: Radim Hrazdil Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/bridge/br_netfilter_hooks.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hook= s.c index 68c0d0f92890..10a2c7bca719 100644 --- a/net/bridge/br_netfilter_hooks.c +++ b/net/bridge/br_netfilter_hooks.c @@ -1012,9 +1012,24 @@ int br_nf_hook_thresh(unsigned int hook, struct net = *net, return okfn(net, sk, skb); =20 ops =3D nf_hook_entries_get_hook_ops(e); - for (i =3D 0; i < e->num_hook_entries && - ops[i]->priority <=3D NF_BR_PRI_BRNF; i++) - ; + for (i =3D 0; i < e->num_hook_entries; i++) { + /* These hooks have already been called */ + if (ops[i]->priority < NF_BR_PRI_BRNF) + continue; + + /* These hooks have not been called yet, run them. */ + if (ops[i]->priority > NF_BR_PRI_BRNF) + break; + + /* take a closer look at NF_BR_PRI_BRNF. */ + if (ops[i]->hook =3D=3D br_nf_pre_routing) { + /* This hook diverted the skb to this function, + * hooks after this have not been run yet. + */ + i++; + break; + } + } =20 nf_hook_state_init(&state, hook, NFPROTO_BRIDGE, indev, outdev, sk, net, okfn); --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 289AEC433EF for ; Tue, 19 Jul 2022 12:47:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238310AbiGSMpK (ORCPT ); Tue, 19 Jul 2022 08:45:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238568AbiGSMnm (ORCPT ); Tue, 19 Jul 2022 08:43:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1FBF54C9E; Tue, 19 Jul 2022 05:17: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 4188861772; Tue, 19 Jul 2022 12:16:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 330E8C341C6; Tue, 19 Jul 2022 12:16:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233016; bh=ftRCXwc4371VseYpxVHNBx88Hlwn+pfvaap8UhlLLAs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CCXD63i1slASWQYDX5IaGbB/Di3eFqKxpqU5r4Tvv0jnypgxWH1k6pKl+REJr3xTY ifySHH6KzLzrTVfoT5s8YwRa6o+t2mD6AS5L9qVrViSx0MK3RKBMscOYKiGdFkCRVN hYu/BgjN63sFhmaMOly9Zlw5iZJTFYvoejTqpIN4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Garry , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.15 120/167] scsi: hisi_sas: Limit max hw sectors for v3 HW Date: Tue, 19 Jul 2022 13:54:12 +0200 Message-Id: <20220719114708.176498383@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: John Garry [ Upstream commit fce54ed027577517df1e74b7d54dc2b1bd536887 ] If the controller is behind an IOMMU then the IOMMU IOVA caching range can affect performance, as discussed in [0]. Limit the max HW sectors to not exceed this limit. We need to hardcode the value until a proper DMA mapping API is available. [0] https://lore.kernel.org/linux-iommu/20210129092120.1482-1-thunder.leizh= en@huawei.com/ Link: https://lore.kernel.org/r/1655988119-223714-1-git-send-email-john.gar= ry@huawei.com Signed-off-by: John Garry Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas= /hisi_sas_v3_hw.c index 1f5e0688c0c8..15c7451fb30f 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -2758,6 +2758,7 @@ static int slave_configure_v3_hw(struct scsi_device *= sdev) struct hisi_hba *hisi_hba =3D shost_priv(shost); struct device *dev =3D hisi_hba->dev; int ret =3D sas_slave_configure(sdev); + unsigned int max_sectors; =20 if (ret) return ret; @@ -2775,6 +2776,12 @@ static int slave_configure_v3_hw(struct scsi_device = *sdev) } } =20 + /* Set according to IOMMU IOVA caching limit */ + max_sectors =3D min_t(size_t, queue_max_hw_sectors(sdev->request_queue), + (PAGE_SIZE * 32) >> SECTOR_SHIFT); + + blk_queue_max_hw_sectors(sdev->request_queue, max_sectors); + return 0; } =20 --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 170ABCCA491 for ; Tue, 19 Jul 2022 12:47:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241649AbiGSMpd (ORCPT ); Tue, 19 Jul 2022 08:45:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241612AbiGSMoO (ORCPT ); Tue, 19 Jul 2022 08:44:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76D7884EED; Tue, 19 Jul 2022 05:17:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 402C661868; Tue, 19 Jul 2022 12:17:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CFE4C341C6; Tue, 19 Jul 2022 12:16:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233019; bh=2tvJ+fipO4VZmFYhZ9As3c1NcfOg4s2bZwVEwvLpA6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K+jStJlUj07UTAWbvfRrYfNctG5ALQwtnRMOdRxubTAkteFjvDnGKzOg3pe8C4Z0+ QkBnvNRHViavmSsSNDLXJgQv/2WYZVLlm+yrQdaVnnuN6oIBtIQm24mdkE316c2P/8 DjW4l5fKX+9ommOEUJwsQfp9mzs3r43onZBxRZ2w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Viresh Kumar , Sasha Levin Subject: [PATCH 5.15 121/167] cpufreq: pmac32-cpufreq: Fix refcount leak bug Date: Tue, 19 Jul 2022 13:54:13 +0200 Message-Id: <20220719114708.275995144@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit ccd7567d4b6cf187fdfa55f003a9e461ee629e36 ] In pmac_cpufreq_init_MacRISC3(), we need to add corresponding of_node_put() for the three node pointers whose refcount have been incremented by of_find_node_by_name(). Signed-off-by: Liang He Signed-off-by: Viresh Kumar Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/cpufreq/pmac32-cpufreq.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/cpufreq/pmac32-cpufreq.c b/drivers/cpufreq/pmac32-cpuf= req.c index 4f20c6a9108d..8e41fe9ee870 100644 --- a/drivers/cpufreq/pmac32-cpufreq.c +++ b/drivers/cpufreq/pmac32-cpufreq.c @@ -470,6 +470,10 @@ static int pmac_cpufreq_init_MacRISC3(struct device_no= de *cpunode) if (slew_done_gpio_np) slew_done_gpio =3D read_gpio(slew_done_gpio_np); =20 + of_node_put(volt_gpio_np); + of_node_put(freq_gpio_np); + of_node_put(slew_done_gpio_np); + /* If we use the frequency GPIOs, calculate the min/max speeds based * on the bus frequencies */ --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4ACC8C43334 for ; Tue, 19 Jul 2022 12:46:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241538AbiGSMqF (ORCPT ); Tue, 19 Jul 2022 08:46:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241489AbiGSMn7 (ORCPT ); Tue, 19 Jul 2022 08:43: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 A3AD6820C5; Tue, 19 Jul 2022 05:17:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9660DB81B21; Tue, 19 Jul 2022 12:17:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 030E2C341C6; Tue, 19 Jul 2022 12:17:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233022; bh=/9U0QyD3NK9GUBDhZqXZ5q1VZdElBR+OKYhYTtvKLUI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1jY+pXw9fHu5m/y42RemmVBZ6lzLfqIOCELkr+s+4FlHKd5b9RWSWxkJ1edCQnzMY 5wJLwtWtpUSc4tdMLEvF3crQm5Sx6TeasUAleLHJ76YnRWl368yMlXz5DCEa0bJ37h lavasITOrc20fUVY7qaBA/fZQR6G3tOOexzQsRaw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jorge Lopez , Kai-Heng Feng , Hans de Goede , Sasha Levin Subject: [PATCH 5.15 122/167] platform/x86: hp-wmi: Ignore Sanitization Mode event Date: Tue, 19 Jul 2022 13:54:14 +0200 Message-Id: <20220719114708.407029125@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kai-Heng Feng [ Upstream commit 9ab762a84b8094540c18a170e5ddd6488632c456 ] After system resume the hp-wmi driver may complain: [ 702.620180] hp_wmi: Unknown event_id - 23 - 0x0 According to HP it means 'Sanitization Mode' and it's harmless to just ignore the event. Cc: Jorge Lopez Signed-off-by: Kai-Heng Feng Link: https://lore.kernel.org/r/20220628123726.250062-1-kai.heng.feng@canon= ical.com Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/platform/x86/hp-wmi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index 027a1467d009..1cd168e32810 100644 --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c @@ -63,6 +63,7 @@ enum hp_wmi_event_ids { HPWMI_BACKLIT_KB_BRIGHTNESS =3D 0x0D, HPWMI_PEAKSHIFT_PERIOD =3D 0x0F, HPWMI_BATTERY_CHARGE_PERIOD =3D 0x10, + HPWMI_SANITIZATION_MODE =3D 0x17, }; =20 struct bios_args { @@ -638,6 +639,8 @@ static void hp_wmi_notify(u32 value, void *context) break; case HPWMI_BATTERY_CHARGE_PERIOD: break; + case HPWMI_SANITIZATION_MODE: + break; default: pr_info("Unknown event_id - %d - 0x%x\n", event_id, event_data); break; --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BEE4C43334 for ; Tue, 19 Jul 2022 12:41:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241368AbiGSMlf (ORCPT ); Tue, 19 Jul 2022 08:41:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241370AbiGSMjb (ORCPT ); Tue, 19 Jul 2022 08:39:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8921C53D27; Tue, 19 Jul 2022 05:15: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 0CD2C61790; Tue, 19 Jul 2022 12:15:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF237C341C6; Tue, 19 Jul 2022 12:15:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232953; bh=bHTgc0qtiNP7x5YW1a2kyD6Vgm8GCCz+ZEiFfZ3F8AY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pknuuY9GId5ywzIIo3Skw3AD41QcD8iuDL7PQDrukN60w+5XQa4KGGE0rCBIUUZZN XYGlwknyqn/bJH9M9qY+Ah7GDWOTJLZMX5KpimMXOYduT7+/QMS8FfF6CK6Ca/g7b2 M3R2eJ52b8+QdbpoUoLBxtzrj8w75f2VRUiaCZn8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Javier Martinez Canillas , Daniel Vetter , Thomas Zimmermann , Sasha Levin Subject: [PATCH 5.15 123/167] firmware: sysfb: Make sysfb_create_simplefb() return a pdev pointer Date: Tue, 19 Jul 2022 13:54:15 +0200 Message-Id: <20220719114708.517968197@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Javier Martinez Canillas [ Upstream commit 9e121040e54abef9ed5542e5fdfa87911cd96204 ] This function just returned 0 on success or an errno code on error, but it could be useful for sysfb_init() callers to have a pointer to the device. Signed-off-by: Javier Martinez Canillas Reviewed-by: Daniel Vetter Reviewed-by: Thomas Zimmermann Link: https://patchwork.freedesktop.org/patch/msgid/20220607182338.344270-2= -javierm@redhat.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/firmware/sysfb.c | 4 ++-- drivers/firmware/sysfb_simplefb.c | 16 ++++++++-------- include/linux/sysfb.h | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c index 2bfbb05f7d89..b032f40a92de 100644 --- a/drivers/firmware/sysfb.c +++ b/drivers/firmware/sysfb.c @@ -46,8 +46,8 @@ static __init int sysfb_init(void) /* try to create a simple-framebuffer device */ compatible =3D sysfb_parse_mode(si, &mode); if (compatible) { - ret =3D sysfb_create_simplefb(si, &mode); - if (!ret) + pd =3D sysfb_create_simplefb(si, &mode); + if (!IS_ERR(pd)) return 0; } =20 diff --git a/drivers/firmware/sysfb_simplefb.c b/drivers/firmware/sysfb_sim= plefb.c index 757cc8b9f3de..eac51c2a27ba 100644 --- a/drivers/firmware/sysfb_simplefb.c +++ b/drivers/firmware/sysfb_simplefb.c @@ -57,8 +57,8 @@ __init bool sysfb_parse_mode(const struct screen_info *si, return false; } =20 -__init int sysfb_create_simplefb(const struct screen_info *si, - const struct simplefb_platform_data *mode) +__init struct platform_device *sysfb_create_simplefb(const struct screen_i= nfo *si, + const struct simplefb_platform_data *mode) { struct platform_device *pd; struct resource res; @@ -76,7 +76,7 @@ __init int sysfb_create_simplefb(const struct screen_info= *si, base |=3D (u64)si->ext_lfb_base << 32; if (!base || (u64)(resource_size_t)base !=3D base) { printk(KERN_DEBUG "sysfb: inaccessible VRAM base\n"); - return -EINVAL; + return ERR_PTR(-EINVAL); } =20 /* @@ -93,7 +93,7 @@ __init int sysfb_create_simplefb(const struct screen_info= *si, length =3D mode->height * mode->stride; if (length > size) { printk(KERN_WARNING "sysfb: VRAM smaller than advertised\n"); - return -EINVAL; + return ERR_PTR(-EINVAL); } length =3D PAGE_ALIGN(length); =20 @@ -104,11 +104,11 @@ __init int sysfb_create_simplefb(const struct screen_= info *si, res.start =3D base; res.end =3D res.start + length - 1; if (res.end <=3D res.start) - return -EINVAL; + return ERR_PTR(-EINVAL); =20 pd =3D platform_device_alloc("simple-framebuffer", 0); if (!pd) - return -ENOMEM; + return ERR_PTR(-ENOMEM); =20 sysfb_apply_efi_quirks(pd); =20 @@ -124,10 +124,10 @@ __init int sysfb_create_simplefb(const struct screen_= info *si, if (ret) goto err_put_device; =20 - return 0; + return pd; =20 err_put_device: platform_device_put(pd); =20 - return ret; + return ERR_PTR(ret); } diff --git a/include/linux/sysfb.h b/include/linux/sysfb.h index b0dcfa26d07b..708152e9037b 100644 --- a/include/linux/sysfb.h +++ b/include/linux/sysfb.h @@ -72,8 +72,8 @@ static inline void sysfb_apply_efi_quirks(struct platform= _device *pd) =20 bool sysfb_parse_mode(const struct screen_info *si, struct simplefb_platform_data *mode); -int sysfb_create_simplefb(const struct screen_info *si, - const struct simplefb_platform_data *mode); +struct platform_device *sysfb_create_simplefb(const struct screen_info *si, + const struct simplefb_platform_data *mode); =20 #else /* CONFIG_SYSFB_SIMPLE */ =20 @@ -83,10 +83,10 @@ static inline bool sysfb_parse_mode(const struct screen= _info *si, return false; } =20 -static inline int sysfb_create_simplefb(const struct screen_info *si, - const struct simplefb_platform_data *mode) +static inline struct platform_device *sysfb_create_simplefb(const struct s= creen_info *si, + const struct simplefb_platform_data *mode) { - return -EINVAL; + return ERR_PTR(-EINVAL); } =20 #endif /* CONFIG_SYSFB_SIMPLE */ --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB756C433EF for ; Tue, 19 Jul 2022 12:41:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241258AbiGSMlr (ORCPT ); Tue, 19 Jul 2022 08:41:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241382AbiGSMjc (ORCPT ); Tue, 19 Jul 2022 08:39:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7510F545D9; Tue, 19 Jul 2022 05:15:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F3B9A6177F; Tue, 19 Jul 2022 12:15:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C034DC341CA; Tue, 19 Jul 2022 12:15:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232956; bh=SuF4v3Uz5uTNz8Vjlm3/PnuewX3rlJ5M1kikWnOZ87c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z8cB3LE8xUlpXTSSUiFi5y43sS6R3DaiS1jSq29pTBJZuXKyP6uck9lTwhw9IHyHE U6uEQsZBC+FF5GyZ/afJN4k8dSaDbNcLuDcVV/qqSq37hgqk71H6ICatIf/+F1lxlx Qf+sK2MpFAbqONgKNQrfVjj26xthug8JtNhUYzvc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Vetter , Javier Martinez Canillas , Sasha Levin Subject: [PATCH 5.15 124/167] firmware: sysfb: Add sysfb_disable() helper function Date: Tue, 19 Jul 2022 13:54:16 +0200 Message-Id: <20220719114708.604084714@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Javier Martinez Canillas [ Upstream commit bde376e9de3c0bc55eedc8956b0f114c05531595 ] This can be used by subsystems to unregister a platform device registered by sysfb and also to disable future platform device registration in sysfb. Suggested-by: Daniel Vetter Signed-off-by: Javier Martinez Canillas Reviewed-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20220607182338.344270-3= -javierm@redhat.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- .../driver-api/firmware/other_interfaces.rst | 6 +++ drivers/firmware/sysfb.c | 54 ++++++++++++++++--- include/linux/sysfb.h | 12 +++++ 3 files changed, 66 insertions(+), 6 deletions(-) diff --git a/Documentation/driver-api/firmware/other_interfaces.rst b/Docum= entation/driver-api/firmware/other_interfaces.rst index b81794e0cfbb..06ac89adaafb 100644 --- a/Documentation/driver-api/firmware/other_interfaces.rst +++ b/Documentation/driver-api/firmware/other_interfaces.rst @@ -13,6 +13,12 @@ EDD Interfaces .. kernel-doc:: drivers/firmware/edd.c :internal: =20 +Generic System Framebuffers Interface +------------------------------------- + +.. kernel-doc:: drivers/firmware/sysfb.c + :export: + Intel Stratix10 SoC Service Layer --------------------------------- Some features of the Intel Stratix10 SoC require a level of privilege diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c index b032f40a92de..1f276f108cc9 100644 --- a/drivers/firmware/sysfb.c +++ b/drivers/firmware/sysfb.c @@ -34,21 +34,59 @@ #include #include =20 +static struct platform_device *pd; +static DEFINE_MUTEX(disable_lock); +static bool disabled; + +static bool sysfb_unregister(void) +{ + if (IS_ERR_OR_NULL(pd)) + return false; + + platform_device_unregister(pd); + pd =3D NULL; + + return true; +} + +/** + * sysfb_disable() - disable the Generic System Framebuffers support + * + * This disables the registration of system framebuffer devices that match= the + * generic drivers that make use of the system framebuffer set up by firmw= are. + * + * It also unregisters a device if this was already registered by sysfb_in= it(). + * + * Context: The function can sleep. A @disable_lock mutex is acquired to s= erialize + * against sysfb_init(), that registers a system framebuffer devi= ce. + */ +void sysfb_disable(void) +{ + mutex_lock(&disable_lock); + sysfb_unregister(); + disabled =3D true; + mutex_unlock(&disable_lock); +} +EXPORT_SYMBOL_GPL(sysfb_disable); + static __init int sysfb_init(void) { struct screen_info *si =3D &screen_info; struct simplefb_platform_data mode; - struct platform_device *pd; const char *name; bool compatible; - int ret; + int ret =3D 0; + + mutex_lock(&disable_lock); + if (disabled) + goto unlock_mutex; =20 /* try to create a simple-framebuffer device */ compatible =3D sysfb_parse_mode(si, &mode); if (compatible) { pd =3D sysfb_create_simplefb(si, &mode); if (!IS_ERR(pd)) - return 0; + goto unlock_mutex; } =20 /* if the FB is incompatible, create a legacy framebuffer device */ @@ -60,8 +98,10 @@ static __init int sysfb_init(void) name =3D "platform-framebuffer"; =20 pd =3D platform_device_alloc(name, 0); - if (!pd) - return -ENOMEM; + if (!pd) { + ret =3D -ENOMEM; + goto unlock_mutex; + } =20 sysfb_apply_efi_quirks(pd); =20 @@ -73,9 +113,11 @@ static __init int sysfb_init(void) if (ret) goto err; =20 - return 0; + goto unlock_mutex; err: platform_device_put(pd); +unlock_mutex: + mutex_unlock(&disable_lock); return ret; } =20 diff --git a/include/linux/sysfb.h b/include/linux/sysfb.h index 708152e9037b..8ba8b5be5567 100644 --- a/include/linux/sysfb.h +++ b/include/linux/sysfb.h @@ -55,6 +55,18 @@ struct efifb_dmi_info { int flags; }; =20 +#ifdef CONFIG_SYSFB + +void sysfb_disable(void); + +#else /* CONFIG_SYSFB */ + +static inline void sysfb_disable(void) +{ +} + +#endif /* CONFIG_SYSFB */ + #ifdef CONFIG_EFI =20 extern struct efifb_dmi_info efifb_dmi_list[]; --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1E8AC43334 for ; Tue, 19 Jul 2022 12:41:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238072AbiGSMlv (ORCPT ); Tue, 19 Jul 2022 08:41:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241447AbiGSMjk (ORCPT ); Tue, 19 Jul 2022 08:39:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A36754678; Tue, 19 Jul 2022 05:16: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 48EABB81B2C; Tue, 19 Jul 2022 12:16:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AD2BC341C6; Tue, 19 Jul 2022 12:15:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232959; bh=8O3ZQuy9J4xSUIsyBruFrghnBpeTv8Iso0xD86jU81w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z1hW1NUco6fH8yVAJdRiZowlEqmqupn5FBvJCVNcfdOhYIwDJ8/4eZvujCKT1F0Rm QBQOFodulWTuokggHS4omklHNTegv6ROn3tgYs0f4waEvp7J4SV300At0uO56FnRQr mz1RJEZy2gXXAFVKaOn8o6zzad/wpfKN0bAZ9/8w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Vetter , Javier Martinez Canillas , Sasha Levin Subject: [PATCH 5.15 125/167] fbdev: Disable sysfb device registration when removing conflicting FBs Date: Tue, 19 Jul 2022 13:54:17 +0200 Message-Id: <20220719114708.699232278@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Javier Martinez Canillas [ Upstream commit ee7a69aa38d87a3bbced7b8245c732c05ed0c6ec ] The platform devices registered by sysfb match with firmware-based DRM or fbdev drivers, that are used to have early graphics using a framebuffer provided by the system firmware. DRM or fbdev drivers later are probed and remove conflicting framebuffers, leading to these platform devices for generic drivers to be unregistered. But the current solution has a race, since the sysfb_init() function could be called after a DRM or fbdev driver is probed and request to unregister the devices for drivers with conflicting framebuffes. To prevent this, disable any future sysfb platform device registration by calling sysfb_disable(), if a driver requests to remove the conflicting framebuffers. Suggested-by: Daniel Vetter Signed-off-by: Javier Martinez Canillas Reviewed-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20220607182338.344270-4= -javierm@redhat.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/video/fbdev/core/fbmem.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -1786,6 +1787,17 @@ int remove_conflicting_framebuffers(stru do_free =3D true; } =20 + /* + * If a driver asked to unregister a platform device registered by + * sysfb, then can be assumed that this is a driver for a display + * that is set up by the system firmware and has a generic driver. + * + * Drivers for devices that don't have a generic driver will never + * ask for this, so let's assume that a real driver for the display + * was already probed and prevent sysfb to register devices later. + */ + sysfb_disable(); + mutex_lock(®istration_lock); do_remove_conflicting_framebuffers(a, name, primary); mutex_unlock(®istration_lock); From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48E33C433EF for ; Tue, 19 Jul 2022 12:41:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241353AbiGSMl5 (ORCPT ); Tue, 19 Jul 2022 08:41:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241484AbiGSMjn (ORCPT ); Tue, 19 Jul 2022 08:39: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 9A1F054CAF; Tue, 19 Jul 2022 05:16: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 8F9B861632; Tue, 19 Jul 2022 12:16:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E29EC341C6; Tue, 19 Jul 2022 12:16:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232961; bh=tHbmYTk29C+tyConO9otde+kD25xesrNCWFelZW3mIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LEOpchFjggvX7aenx1PAcZmx1TqKu9zlJ6+muGWmcZKxeUzdLFfZeMjiSzW9yqmhZ V97gPgmTYaihreg8/hxFfcRxUU60YANs5Bqumij/H0ZctpJWSrb4G0jqf3QriSq/4U UxEZLbQ4FbEE8AlUXHCBbgo0JVmiphCUizX9cXrc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , Tung Nguyen , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 126/167] net: tipc: fix possible refcount leak in tipc_sk_create() Date: Tue, 19 Jul 2022 13:54:18 +0200 Message-Id: <20220719114708.795466119@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hangyu Hua [ Upstream commit 00aff3590fc0a73bddd3b743863c14e76fd35c0c ] Free sk in case tipc_sk_insert() fails. Signed-off-by: Hangyu Hua Reviewed-by: Tung Nguyen Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- net/tipc/socket.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 17f8c523e33b..43509c7e90fc 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -502,6 +502,7 @@ static int tipc_sk_create(struct net *net, struct socke= t *sock, sock_init_data(sock, sk); tipc_set_sk_state(sk, TIPC_OPEN); if (tipc_sk_insert(tsk)) { + sk_free(sk); pr_warn("Socket create failed; port number exhausted\n"); return -EINVAL; } --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73FCCC43334 for ; Tue, 19 Jul 2022 12:42:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241451AbiGSMmK (ORCPT ); Tue, 19 Jul 2022 08:42:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241559AbiGSMjw (ORCPT ); Tue, 19 Jul 2022 08:39:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E4567CB6C; Tue, 19 Jul 2022 05:16:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0B368B81B2E; Tue, 19 Jul 2022 12:16:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 528FAC341C6; Tue, 19 Jul 2022 12:16:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232964; bh=h4G0ZMwejUgQBnTsSAswijUdua2pXdP0jPXgjlc/ETc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GJ9K5mSAENPwUAG6b7GvyrCZM6N1WqOi4puwZLmX91DajeJLjrDRmKAUK2orNloWG sAFRY7hiJ31IYGHslSMZmB9JdK1ZhDoMZ9eHiFNv9dmSUxCwqErZEQMzE/S1ZbQqxw oedmr0SarM7uVK/z4Diet9ylcY/JqkOfJqs0NkOQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Walle , Krzysztof Kozlowski , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 127/167] NFC: nxp-nci: dont print header length mismatch on i2c error Date: Tue, 19 Jul 2022 13:54:19 +0200 Message-Id: <20220719114708.888107610@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Walle [ Upstream commit 9577fc5fdc8b07b891709af6453545db405e24ad ] Don't print a misleading header length mismatch error if the i2c call returns an error. Instead just return the error code without any error message. Signed-off-by: Michael Walle Reviewed-by: Krzysztof Kozlowski Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/nfc/nxp-nci/i2c.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c index e8f3b35afbee..ae2ba08d8ac3 100644 --- a/drivers/nfc/nxp-nci/i2c.c +++ b/drivers/nfc/nxp-nci/i2c.c @@ -122,7 +122,9 @@ static int nxp_nci_i2c_fw_read(struct nxp_nci_i2c_phy *= phy, skb_put_data(*skb, &header, NXP_NCI_FW_HDR_LEN); =20 r =3D i2c_master_recv(client, skb_put(*skb, frame_len), frame_len); - if (r !=3D frame_len) { + if (r < 0) { + goto fw_read_exit_free_skb; + } else if (r !=3D frame_len) { nfc_err(&client->dev, "Invalid frame length: %u (expected %zu)\n", r, frame_len); @@ -166,7 +168,9 @@ static int nxp_nci_i2c_nci_read(struct nxp_nci_i2c_phy = *phy, return 0; =20 r =3D i2c_master_recv(client, skb_put(*skb, header.plen), header.plen); - if (r !=3D header.plen) { + if (r < 0) { + goto nci_read_exit_free_skb; + } else if (r !=3D header.plen) { nfc_err(&client->dev, "Invalid frame payload length: %u (expected %u)\n", r, header.plen); --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27D9ACCA47F for ; Tue, 19 Jul 2022 12:42:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241462AbiGSMmM (ORCPT ); Tue, 19 Jul 2022 08:42:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241604AbiGSMkA (ORCPT ); Tue, 19 Jul 2022 08:40:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A2E77D1C7; Tue, 19 Jul 2022 05:16:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 60EA96182F; Tue, 19 Jul 2022 12:16:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E7EFC341D1; Tue, 19 Jul 2022 12:16:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232967; bh=J/EuGZdmSepc7xcdlMXsN1KoG6+RToJa/DgYPisABGo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gDXc1O9XYVgpZpAHrk88Wd1vtzKdNw9E+LDmQnBTen37Hm2UXX+gnn/0DUBUfYBMP O3dNolWggrmL418vCU7Z5xW3ImloTy1iRsotz0q0D4Vi6QKYjwRp+sz8U8Jg+DNbwu YcQVYtw+MCm42BwnNoWnYPhld08xJ8pEBXzjPVuY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Wagner , Sagi Grimberg , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.15 128/167] nvme-tcp: always fail a request when sending it failed Date: Tue, 19 Jul 2022 13:54:20 +0200 Message-Id: <20220719114708.982499639@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sagi Grimberg [ Upstream commit 41d07df7de841bfbc32725ce21d933ad358f2844 ] queue stoppage and inflight requests cancellation is fully fenced from io_work and thus failing a request from this context. Hence we don't need to try to guess from the socket retcode if this failure is because the queue is about to be torn down or not. We are perfectly safe to just fail it, the request will not be cancelled later on. This solves possible very long shutdown delays when the users issues a 'nvme disconnect-all' Reported-by: Daniel Wagner Signed-off-by: Sagi Grimberg Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/nvme/host/tcp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index 10882d3d554c..1821d38e620e 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -1162,8 +1162,7 @@ static int nvme_tcp_try_send(struct nvme_tcp_queue *q= ueue) } else if (ret < 0) { dev_err(queue->ctrl->ctrl.device, "failed to send request %d\n", ret); - if (ret !=3D -EPIPE && ret !=3D -ECONNRESET) - nvme_tcp_fail_request(queue->request); + nvme_tcp_fail_request(queue->request); nvme_tcp_done_send_req(queue); } return ret; --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BBB20CCA486 for ; Tue, 19 Jul 2022 12:42:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241470AbiGSMmO (ORCPT ); Tue, 19 Jul 2022 08:42:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241030AbiGSMkG (ORCPT ); Tue, 19 Jul 2022 08:40: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 35CA27D1EF; Tue, 19 Jul 2022 05:16:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C6FB0B81B84; Tue, 19 Jul 2022 12:16:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06F00C341C6; Tue, 19 Jul 2022 12:16:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232970; bh=9mbzvjLbLLILSJPUT6/t8HLb6lxmwvL77vuZWExpcNw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O9nytDDxww0hThFMreEMpKErgEaCUy92LdJa3+DqPPhP2qOjBmf5RxvN9AvLsmvyd OL90aKznslHbJXMbi/7fAfDbtAuMZRpMn5JEbN0YwBLRvWKhaslVietCQZtaFCb00Y 8lvxm2cLi+jGFltPUFtWLVr+wAXnOmGogxAT9DHE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ruozhu Li , Sagi Grimberg , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.15 129/167] nvme: fix regression when disconnect a recovering ctrl Date: Tue, 19 Jul 2022 13:54:21 +0200 Message-Id: <20220719114709.063554380@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ruozhu Li [ Upstream commit f7f70f4aa09dc43d7455c060143e86a017c30548 ] We encountered a problem that the disconnect command hangs. After analyzing the log and stack, we found that the triggering process is as follows: CPU0 CPU1 nvme_rdma_error_recovery_work nvme_rdma_teardown_io_queues nvme_do_delete_ctrl nvme_stop_queues nvme_remove_namespaces --clear ctrl->namespaces nvme_start_queues --no ns in ctrl->namespaces nvme_ns_remove return(because ctrl is deleting) blk_freeze_queue blk_mq_freeze_queue_wait --wait for ns to unquiesce to clean infligt IO, hang forever This problem was not found in older kernels because we will flush err work in nvme_stop_ctrl before nvme_remove_namespaces.It does not seem to be modified for functional reasons, the patch can be revert to solve the problem. Revert commit 794a4cb3d2f7 ("nvme: remove the .stop_ctrl callout") Signed-off-by: Ruozhu Li Reviewed-by: Sagi Grimberg Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/nvme/host/core.c | 2 ++ drivers/nvme/host/nvme.h | 1 + drivers/nvme/host/rdma.c | 12 +++++++++--- drivers/nvme/host/tcp.c | 10 +++++++--- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 19054b791c67..29b56ea01132 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -4385,6 +4385,8 @@ void nvme_stop_ctrl(struct nvme_ctrl *ctrl) nvme_stop_failfast_work(ctrl); flush_work(&ctrl->async_event_work); cancel_work_sync(&ctrl->fw_act_work); + if (ctrl->ops->stop_ctrl) + ctrl->ops->stop_ctrl(ctrl); } EXPORT_SYMBOL_GPL(nvme_stop_ctrl); =20 diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index 72bcd7e5716e..75a7e7baa1fc 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -495,6 +495,7 @@ struct nvme_ctrl_ops { void (*free_ctrl)(struct nvme_ctrl *ctrl); void (*submit_async_event)(struct nvme_ctrl *ctrl); void (*delete_ctrl)(struct nvme_ctrl *ctrl); + void (*stop_ctrl)(struct nvme_ctrl *ctrl); int (*get_address)(struct nvme_ctrl *ctrl, char *buf, int size); }; =20 diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index d51f52e296f5..2db9c166a1b7 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -1049,6 +1049,14 @@ static void nvme_rdma_teardown_io_queues(struct nvme= _rdma_ctrl *ctrl, } } =20 +static void nvme_rdma_stop_ctrl(struct nvme_ctrl *nctrl) +{ + struct nvme_rdma_ctrl *ctrl =3D to_rdma_ctrl(nctrl); + + cancel_work_sync(&ctrl->err_work); + cancel_delayed_work_sync(&ctrl->reconnect_work); +} + static void nvme_rdma_free_ctrl(struct nvme_ctrl *nctrl) { struct nvme_rdma_ctrl *ctrl =3D to_rdma_ctrl(nctrl); @@ -2230,9 +2238,6 @@ static const struct blk_mq_ops nvme_rdma_admin_mq_ops= =3D { =20 static void nvme_rdma_shutdown_ctrl(struct nvme_rdma_ctrl *ctrl, bool shut= down) { - cancel_work_sync(&ctrl->err_work); - cancel_delayed_work_sync(&ctrl->reconnect_work); - nvme_rdma_teardown_io_queues(ctrl, shutdown); blk_mq_quiesce_queue(ctrl->ctrl.admin_q); if (shutdown) @@ -2282,6 +2287,7 @@ static const struct nvme_ctrl_ops nvme_rdma_ctrl_ops = =3D { .submit_async_event =3D nvme_rdma_submit_async_event, .delete_ctrl =3D nvme_rdma_delete_ctrl, .get_address =3D nvmf_get_address, + .stop_ctrl =3D nvme_rdma_stop_ctrl, }; =20 /* diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index 1821d38e620e..20138e132558 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -2163,9 +2163,6 @@ static void nvme_tcp_error_recovery_work(struct work_= struct *work) =20 static void nvme_tcp_teardown_ctrl(struct nvme_ctrl *ctrl, bool shutdown) { - cancel_work_sync(&to_tcp_ctrl(ctrl)->err_work); - cancel_delayed_work_sync(&to_tcp_ctrl(ctrl)->connect_work); - nvme_tcp_teardown_io_queues(ctrl, shutdown); blk_mq_quiesce_queue(ctrl->admin_q); if (shutdown) @@ -2205,6 +2202,12 @@ static void nvme_reset_ctrl_work(struct work_struct = *work) nvme_tcp_reconnect_or_remove(ctrl); } =20 +static void nvme_tcp_stop_ctrl(struct nvme_ctrl *ctrl) +{ + cancel_work_sync(&to_tcp_ctrl(ctrl)->err_work); + cancel_delayed_work_sync(&to_tcp_ctrl(ctrl)->connect_work); +} + static void nvme_tcp_free_ctrl(struct nvme_ctrl *nctrl) { struct nvme_tcp_ctrl *ctrl =3D to_tcp_ctrl(nctrl); @@ -2528,6 +2531,7 @@ static const struct nvme_ctrl_ops nvme_tcp_ctrl_ops = =3D { .submit_async_event =3D nvme_tcp_submit_async_event, .delete_ctrl =3D nvme_tcp_delete_ctrl, .get_address =3D nvmf_get_address, + .stop_ctrl =3D nvme_tcp_stop_ctrl, }; =20 static bool --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1277BC43334 for ; Tue, 19 Jul 2022 12:42:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241480AbiGSMmV (ORCPT ); Tue, 19 Jul 2022 08:42:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241025AbiGSMkG (ORCPT ); Tue, 19 Jul 2022 08:40: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 087B97D1F7; Tue, 19 Jul 2022 05:16: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 3DBD8617B2; Tue, 19 Jul 2022 12:16:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AB95C341C6; Tue, 19 Jul 2022 12:16:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232973; bh=QcGtGtCYqtma3sZUNavLiHZxpdlk17kScyhaXBAROMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GZJJh6NZVguZVzjSQ/r2CetKMDh/6a2BVphfTkpoh1bvQxIsqiPPc8lVshMLt5+xN QP/ZqAzIqvPwCCC2gQp7uB6CfQ3GcGMHzVyIN7HMycztnPS6/cscfbEX/idLDouHO3 vhyNr286kyzgYDVib5VYWbX4ExzshaTVHtcSaqq8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianglei Nie , "Russell King (Oracle)" , Paolo Abeni , Sasha Levin Subject: [PATCH 5.15 130/167] net: sfp: fix memory leak in sfp_probe() Date: Tue, 19 Jul 2022 13:54:22 +0200 Message-Id: <20220719114709.149050662@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jianglei Nie [ Upstream commit 0a18d802d65cf662644fd1d369c86d84a5630652 ] sfp_probe() allocates a memory chunk from sfp with sfp_alloc(). When devm_add_action() fails, sfp is not freed, which leads to a memory leak. We should use devm_add_action_or_reset() instead of devm_add_action(). Signed-off-by: Jianglei Nie Reviewed-by: Russell King (Oracle) Link: https://lore.kernel.org/r/20220629075550.2152003-1-niejianglei2021@16= 3.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/phy/sfp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c index 90dfefc1f5f8..028a5df5c538 100644 --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c @@ -2504,7 +2504,7 @@ static int sfp_probe(struct platform_device *pdev) =20 platform_set_drvdata(pdev, sfp); =20 - err =3D devm_add_action(sfp->dev, sfp_cleanup, sfp); + err =3D devm_add_action_or_reset(sfp->dev, sfp_cleanup, sfp); if (err < 0) return err; =20 --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05774C43334 for ; Tue, 19 Jul 2022 12:43:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241481AbiGSMnD (ORCPT ); Tue, 19 Jul 2022 08:43:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241476AbiGSMmR (ORCPT ); Tue, 19 Jul 2022 08:42:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F74C7E01B; Tue, 19 Jul 2022 05:16: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 8F63CB81B89; Tue, 19 Jul 2022 12:16:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBCEEC341C6; Tue, 19 Jul 2022 12:16:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232976; bh=08m7YkgMf00+tBrPAp/k1bxRwMkOC+fQBhyogyRaGSI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zs4PxdjoxGy1FFxqUMJeg/gIkPhuFYkeW549/xtZdBqvYnA6DA5edhb6/ogmXwqF3 c24XTr1bI5Rv9t8bsEUyPDRolV2JO+vGuImK94xonboCKXDXAgzlrIfVbX6V7xxrrT uD6dxT8J1O5WcP+5JvsR306Dwjfbpx8fqZKiBXTo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Brown , Sasha Levin Subject: [PATCH 5.15 131/167] ASoC: ops: Fix off by one in range control validation Date: Tue, 19 Jul 2022 13:54:23 +0200 Message-Id: <20220719114709.244406088@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mark Brown [ Upstream commit 5871321fb4558c55bf9567052b618ff0be6b975e ] We currently report that range controls accept a range of 0..(max-min) but accept writes in the range 0..(max-min+1). Remove that extra +1. Signed-off-by: Mark Brown Link: https://lore.kernel.org/r/20220604105246.4055214-1-broonie@kernel.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/soc-ops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c index f32ba64c5dda..e73360e9de8f 100644 --- a/sound/soc/soc-ops.c +++ b/sound/soc/soc-ops.c @@ -526,7 +526,7 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontr= ol, return -EINVAL; if (mc->platform_max && tmp > mc->platform_max) return -EINVAL; - if (tmp > mc->max - mc->min + 1) + if (tmp > mc->max - mc->min) return -EINVAL; =20 if (invert) @@ -547,7 +547,7 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontr= ol, return -EINVAL; if (mc->platform_max && tmp > mc->platform_max) return -EINVAL; - if (tmp > mc->max - mc->min + 1) + if (tmp > mc->max - mc->min) return -EINVAL; =20 if (invert) --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 224D0CCA47F for ; Tue, 19 Jul 2022 12:42:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241430AbiGSMmz (ORCPT ); Tue, 19 Jul 2022 08:42:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241266AbiGSMlp (ORCPT ); Tue, 19 Jul 2022 08:41: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 5DD4C7E00C; Tue, 19 Jul 2022 05:16: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 5AC63B81B2E; Tue, 19 Jul 2022 12:16:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B47E0C341C6; Tue, 19 Jul 2022 12:16:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232979; bh=I/S6MXKj+pJExOorvIiThOlDOL37GW0RHtgnBej/vcs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AZcpssql5OSZoMR13WRaYkPCtQfDCgkvA25JPJJl3HC8l+o2J04Y8tUaOhQ9Z2CL0 5SIYglFqAZ6CSPo6FFJm4YrkkhKoMN6bWRg0UAca7Hs2sdWLNEalx40Y2gvD8ZSQnS AwK+W9220v1Eoer5ZQHios/2ctqhYeB6e6MiVXNI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Haowen Bai , Linus Walleij , Sasha Levin Subject: [PATCH 5.15 132/167] pinctrl: aspeed: Fix potential NULL dereference in aspeed_pinmux_set_mux() Date: Tue, 19 Jul 2022 13:54:24 +0200 Message-Id: <20220719114709.337233262@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Haowen Bai [ Upstream commit 84a85d3fef2e75b1fe9fc2af6f5267122555a1ed ] pdesc could be null but still dereference pdesc->name and it will lead to a null pointer access. So we move a null check before dereference. Signed-off-by: Haowen Bai Link: https://lore.kernel.org/r/1650508019-22554-1-git-send-email-baihaowen= @meizu.com Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/pinctrl/aspeed/pinctrl-aspeed.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed.c b/drivers/pinctrl/aspe= ed/pinctrl-aspeed.c index c94e24aadf92..83d47ff1cea8 100644 --- a/drivers/pinctrl/aspeed/pinctrl-aspeed.c +++ b/drivers/pinctrl/aspeed/pinctrl-aspeed.c @@ -236,11 +236,11 @@ int aspeed_pinmux_set_mux(struct pinctrl_dev *pctldev= , unsigned int function, const struct aspeed_sig_expr **funcs; const struct aspeed_sig_expr ***prios; =20 - pr_debug("Muxing pin %s for %s\n", pdesc->name, pfunc->name); - if (!pdesc) return -EINVAL; =20 + pr_debug("Muxing pin %s for %s\n", pdesc->name, pfunc->name); + prios =3D pdesc->prios; =20 if (!prios) --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9AA3C43334 for ; Tue, 19 Jul 2022 12:43:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241348AbiGSMnb (ORCPT ); Tue, 19 Jul 2022 08:43:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238537AbiGSMnE (ORCPT ); Tue, 19 Jul 2022 08:43:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD6BC8050E; Tue, 19 Jul 2022 05:16: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 2FEEDB81B37; Tue, 19 Jul 2022 12:16:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88ABAC341C6; Tue, 19 Jul 2022 12:16:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232984; bh=xWX9/0nFqISsHnmbDCJ6Ba1Ycf4LV6efRFEkOL3T5U0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zsgy6omJhKy2P/bhFw3oJ/dLOx3Ew1fRMSaPlOWwk8N4fe8mge8w09kvmhzxD3s3R Avovwa2Nq3fSc1LFORFecUNCfh9zTDW7ZW4js/JzKrWPksotXELUr/nqnmYsARHVDq Ak3T84PId81Y/eTX/kR63ndi5nCt/VtmLVr2d3T0= 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 , Mark Brown , Sasha Levin Subject: [PATCH 5.15 133/167] ASoC: Realtek/Maxim SoundWire codecs: disable pm_runtime on remove Date: Tue, 19 Jul 2022 13:54:25 +0200 Message-Id: <20220719114709.426114761@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart [ Upstream commit ac63716da3070f8cb6baaba3a058a0c7f22aeb5b ] When binding/unbinding codec drivers, the following warnings are thrown: [ 107.266879] rt715-sdca sdw:3:025d:0714:01: Unbalanced pm_runtime_enable! [ 306.879700] rt711-sdca sdw:0:025d:0711:01: Unbalanced pm_runtime_enable! Add a remove callback for all Realtek/Maxim SoundWire codecs and remove this warning. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Bard Liao Link: https://lore.kernel.org/r/20220606203752.144159-2-pierre-louis.bossar= t@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/max98373-sdw.c | 12 +++++++++++- sound/soc/codecs/rt1308-sdw.c | 11 +++++++++++ sound/soc/codecs/rt1316-sdw.c | 11 +++++++++++ sound/soc/codecs/rt5682-sdw.c | 5 ++++- sound/soc/codecs/rt700-sdw.c | 6 +++++- sound/soc/codecs/rt711-sdca-sdw.c | 6 +++++- sound/soc/codecs/rt711-sdw.c | 6 +++++- sound/soc/codecs/rt715-sdca-sdw.c | 12 ++++++++++++ sound/soc/codecs/rt715-sdw.c | 12 ++++++++++++ 9 files changed, 76 insertions(+), 5 deletions(-) diff --git a/sound/soc/codecs/max98373-sdw.c b/sound/soc/codecs/max98373-sd= w.c index dc520effc61c..12323d4b5bfa 100644 --- a/sound/soc/codecs/max98373-sdw.c +++ b/sound/soc/codecs/max98373-sdw.c @@ -862,6 +862,16 @@ static int max98373_sdw_probe(struct sdw_slave *slave, return max98373_init(slave, regmap); } =20 +static int max98373_sdw_remove(struct sdw_slave *slave) +{ + struct max98373_priv *max98373 =3D dev_get_drvdata(&slave->dev); + + if (max98373->first_hw_init) + pm_runtime_disable(&slave->dev); + + return 0; +} + #if defined(CONFIG_OF) static const struct of_device_id max98373_of_match[] =3D { { .compatible =3D "maxim,max98373", }, @@ -893,7 +903,7 @@ static struct sdw_driver max98373_sdw_driver =3D { .pm =3D &max98373_pm, }, .probe =3D max98373_sdw_probe, - .remove =3D NULL, + .remove =3D max98373_sdw_remove, .ops =3D &max98373_slave_ops, .id_table =3D max98373_id, }; diff --git a/sound/soc/codecs/rt1308-sdw.c b/sound/soc/codecs/rt1308-sdw.c index f716668de640..8472d855c325 100644 --- a/sound/soc/codecs/rt1308-sdw.c +++ b/sound/soc/codecs/rt1308-sdw.c @@ -683,6 +683,16 @@ static int rt1308_sdw_probe(struct sdw_slave *slave, return 0; } =20 +static int rt1308_sdw_remove(struct sdw_slave *slave) +{ + struct rt1308_sdw_priv *rt1308 =3D dev_get_drvdata(&slave->dev); + + if (rt1308->first_hw_init) + pm_runtime_disable(&slave->dev); + + return 0; +} + static const struct sdw_device_id rt1308_id[] =3D { SDW_SLAVE_ENTRY_EXT(0x025d, 0x1308, 0x2, 0, 0), {}, @@ -742,6 +752,7 @@ static struct sdw_driver rt1308_sdw_driver =3D { .pm =3D &rt1308_pm, }, .probe =3D rt1308_sdw_probe, + .remove =3D rt1308_sdw_remove, .ops =3D &rt1308_slave_ops, .id_table =3D rt1308_id, }; diff --git a/sound/soc/codecs/rt1316-sdw.c b/sound/soc/codecs/rt1316-sdw.c index 09b4914bba1b..09cf3ca86fa4 100644 --- a/sound/soc/codecs/rt1316-sdw.c +++ b/sound/soc/codecs/rt1316-sdw.c @@ -675,6 +675,16 @@ static int rt1316_sdw_probe(struct sdw_slave *slave, return rt1316_sdw_init(&slave->dev, regmap, slave); } =20 +static int rt1316_sdw_remove(struct sdw_slave *slave) +{ + struct rt1316_sdw_priv *rt1316 =3D dev_get_drvdata(&slave->dev); + + if (rt1316->first_hw_init) + pm_runtime_disable(&slave->dev); + + return 0; +} + static const struct sdw_device_id rt1316_id[] =3D { SDW_SLAVE_ENTRY_EXT(0x025d, 0x1316, 0x3, 0x1, 0), {}, @@ -734,6 +744,7 @@ static struct sdw_driver rt1316_sdw_driver =3D { .pm =3D &rt1316_pm, }, .probe =3D rt1316_sdw_probe, + .remove =3D rt1316_sdw_remove, .ops =3D &rt1316_slave_ops, .id_table =3D rt1316_id, }; diff --git a/sound/soc/codecs/rt5682-sdw.c b/sound/soc/codecs/rt5682-sdw.c index 31a4f286043e..a030c9987b92 100644 --- a/sound/soc/codecs/rt5682-sdw.c +++ b/sound/soc/codecs/rt5682-sdw.c @@ -719,9 +719,12 @@ static int rt5682_sdw_remove(struct sdw_slave *slave) { struct rt5682_priv *rt5682 =3D dev_get_drvdata(&slave->dev); =20 - if (rt5682 && rt5682->hw_init) + if (rt5682->hw_init) cancel_delayed_work_sync(&rt5682->jack_detect_work); =20 + if (rt5682->first_hw_init) + pm_runtime_disable(&slave->dev); + return 0; } =20 diff --git a/sound/soc/codecs/rt700-sdw.c b/sound/soc/codecs/rt700-sdw.c index bda594899664..f7439e40ca8b 100644 --- a/sound/soc/codecs/rt700-sdw.c +++ b/sound/soc/codecs/rt700-sdw.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include "rt700.h" @@ -463,11 +464,14 @@ static int rt700_sdw_remove(struct sdw_slave *slave) { struct rt700_priv *rt700 =3D dev_get_drvdata(&slave->dev); =20 - if (rt700 && rt700->hw_init) { + if (rt700->hw_init) { cancel_delayed_work_sync(&rt700->jack_detect_work); cancel_delayed_work_sync(&rt700->jack_btn_check_work); } =20 + if (rt700->first_hw_init) + pm_runtime_disable(&slave->dev); + return 0; } =20 diff --git a/sound/soc/codecs/rt711-sdca-sdw.c b/sound/soc/codecs/rt711-sdc= a-sdw.c index aaf5af153d3f..c722a2b0041f 100644 --- a/sound/soc/codecs/rt711-sdca-sdw.c +++ b/sound/soc/codecs/rt711-sdca-sdw.c @@ -11,6 +11,7 @@ #include #include #include +#include =20 #include "rt711-sdca.h" #include "rt711-sdca-sdw.h" @@ -364,11 +365,14 @@ static int rt711_sdca_sdw_remove(struct sdw_slave *sl= ave) { struct rt711_sdca_priv *rt711 =3D dev_get_drvdata(&slave->dev); =20 - if (rt711 && rt711->hw_init) { + if (rt711->hw_init) { cancel_delayed_work_sync(&rt711->jack_detect_work); cancel_delayed_work_sync(&rt711->jack_btn_check_work); } =20 + if (rt711->first_hw_init) + pm_runtime_disable(&slave->dev); + return 0; } =20 diff --git a/sound/soc/codecs/rt711-sdw.c b/sound/soc/codecs/rt711-sdw.c index bda2cc9439c9..f49c94baa37c 100644 --- a/sound/soc/codecs/rt711-sdw.c +++ b/sound/soc/codecs/rt711-sdw.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include "rt711.h" @@ -464,12 +465,15 @@ static int rt711_sdw_remove(struct sdw_slave *slave) { struct rt711_priv *rt711 =3D dev_get_drvdata(&slave->dev); =20 - if (rt711 && rt711->hw_init) { + if (rt711->hw_init) { cancel_delayed_work_sync(&rt711->jack_detect_work); cancel_delayed_work_sync(&rt711->jack_btn_check_work); cancel_work_sync(&rt711->calibration_work); } =20 + if (rt711->first_hw_init) + pm_runtime_disable(&slave->dev); + return 0; } =20 diff --git a/sound/soc/codecs/rt715-sdca-sdw.c b/sound/soc/codecs/rt715-sdc= a-sdw.c index a5c673f43d82..0f4354eafef2 100644 --- a/sound/soc/codecs/rt715-sdca-sdw.c +++ b/sound/soc/codecs/rt715-sdca-sdw.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include "rt715-sdca.h" @@ -195,6 +196,16 @@ static int rt715_sdca_sdw_probe(struct sdw_slave *slav= e, return rt715_sdca_init(&slave->dev, mbq_regmap, regmap, slave); } =20 +static int rt715_sdca_sdw_remove(struct sdw_slave *slave) +{ + struct rt715_sdca_priv *rt715 =3D dev_get_drvdata(&slave->dev); + + if (rt715->first_hw_init) + pm_runtime_disable(&slave->dev); + + return 0; +} + static const struct sdw_device_id rt715_sdca_id[] =3D { SDW_SLAVE_ENTRY_EXT(0x025d, 0x715, 0x3, 0x1, 0), SDW_SLAVE_ENTRY_EXT(0x025d, 0x714, 0x3, 0x1, 0), @@ -269,6 +280,7 @@ static struct sdw_driver rt715_sdw_driver =3D { .pm =3D &rt715_pm, }, .probe =3D rt715_sdca_sdw_probe, + .remove =3D rt715_sdca_sdw_remove, .ops =3D &rt715_sdca_slave_ops, .id_table =3D rt715_sdca_id, }; diff --git a/sound/soc/codecs/rt715-sdw.c b/sound/soc/codecs/rt715-sdw.c index a7b21b03c08b..b047bf87a100 100644 --- a/sound/soc/codecs/rt715-sdw.c +++ b/sound/soc/codecs/rt715-sdw.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -514,6 +515,16 @@ static int rt715_sdw_probe(struct sdw_slave *slave, return 0; } =20 +static int rt715_sdw_remove(struct sdw_slave *slave) +{ + struct rt715_priv *rt715 =3D dev_get_drvdata(&slave->dev); + + if (rt715->first_hw_init) + pm_runtime_disable(&slave->dev); + + return 0; +} + static const struct sdw_device_id rt715_id[] =3D { SDW_SLAVE_ENTRY_EXT(0x025d, 0x714, 0x2, 0, 0), SDW_SLAVE_ENTRY_EXT(0x025d, 0x715, 0x2, 0, 0), @@ -575,6 +586,7 @@ static struct sdw_driver rt715_sdw_driver =3D { .pm =3D &rt715_pm, }, .probe =3D rt715_sdw_probe, + .remove =3D rt715_sdw_remove, .ops =3D &rt715_slave_ops, .id_table =3D rt715_id, }; --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4740CCA47F for ; Tue, 19 Jul 2022 12:43:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241434AbiGSMnu (ORCPT ); Tue, 19 Jul 2022 08:43:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241398AbiGSMnM (ORCPT ); Tue, 19 Jul 2022 08:43:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08FE880535; Tue, 19 Jul 2022 05:16: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 6F5CE61772; Tue, 19 Jul 2022 12:16:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54E16C341C6; Tue, 19 Jul 2022 12:16:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232987; bh=DX8GnNXoZmg5Xm54obL/bmHPMlMYP2TaYkBJHhzBO74=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c4nwaMN4MsFQQnnX6PrAiJ2MUJnrDNLcZhluMJgiZbe/ATpDu5iKN1HtVUYYs04AO W56Z8Yimhgvf86RcEmg80HMLVQiWecjlvEH1F2/ZASib/ool82bifG0fm6J1QOWgAi Z5eb5S+rzKyGLH3GMp/exLjx6CXVpCSOFpdobzt8= 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 , Mark Brown , Sasha Levin Subject: [PATCH 5.15 134/167] ASoC: rt711-sdca-sdw: fix calibrate mutex initialization Date: Tue, 19 Jul 2022 13:54:26 +0200 Message-Id: <20220719114709.516587635@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart [ Upstream commit ed0a7fb29c9fd4f53eeb37d1fe2354df7a038047 ] In codec driver bind/unbind test, the following warning is thrown: DEBUG_LOCKS_WARN_ON(lock->magic !=3D lock) ... [ 699.182495] rt711_sdca_jack_init+0x1b/0x1d0 [snd_soc_rt711_sdca] [ 699.182498] rt711_sdca_set_jack_detect+0x3b/0x90 [snd_soc_rt711_sdca] [ 699.182500] snd_soc_component_set_jack+0x24/0x50 [snd_soc_core] A quick check in the code shows that the 'calibrate_mutex' used by this driver are not initialized at probe time. Moving the initialization to the probe removes the issue. BugLink: https://github.com/thesofproject/linux/issues/3644 Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Bard Liao Link: https://lore.kernel.org/r/20220606203752.144159-3-pierre-louis.bossar= t@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/rt711-sdca-sdw.c | 3 +++ sound/soc/codecs/rt711-sdca.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) --- a/sound/soc/codecs/rt711-sdca-sdw.c +++ b/sound/soc/codecs/rt711-sdca-sdw.c @@ -373,6 +373,9 @@ static int rt711_sdca_sdw_remove(struct if (rt711->first_hw_init) pm_runtime_disable(&slave->dev); =20 + mutex_destroy(&rt711->calibrate_mutex); + mutex_destroy(&rt711->disable_irq_lock); + return 0; } =20 --- a/sound/soc/codecs/rt711-sdca.c +++ b/sound/soc/codecs/rt711-sdca.c @@ -1414,6 +1414,7 @@ int rt711_sdca_init(struct device *dev, rt711->regmap =3D regmap; rt711->mbq_regmap =3D mbq_regmap; =20 + mutex_init(&rt711->calibrate_mutex); mutex_init(&rt711->disable_irq_lock); =20 /* @@ -1552,7 +1553,6 @@ int rt711_sdca_io_init(struct device *de rt711_sdca_jack_detect_handler); INIT_DELAYED_WORK(&rt711->jack_btn_check_work, rt711_sdca_btn_check_handler); - mutex_init(&rt711->calibrate_mutex); } =20 /* calibration */ From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D98FFC43334 for ; Tue, 19 Jul 2022 12:43:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241187AbiGSMnV (ORCPT ); Tue, 19 Jul 2022 08:43:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241437AbiGSMm5 (ORCPT ); Tue, 19 Jul 2022 08:42: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 315A3804AC; Tue, 19 Jul 2022 05:16: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 40F7C617B2; Tue, 19 Jul 2022 12:16:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32102C341C6; Tue, 19 Jul 2022 12:16:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232990; bh=MThhBE+OgevlSZDjVIJEd6z5DpIYHMc9RCE/7PEP6cQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=geVeeJNLspaEuvImreTmiQbqCJj3OsPoC3vo9bkrElBCd+hX186LQlvQVV5uxlj95 46CN70uaOf19TH3LKAeS9mXRa5TcdTLMxGdF9B4V1FKYjUF2KlLbSQLKPcIas0PYy4 GnoN6q+53jiFwwJuYgrOeKU/SnERuG/ACnTqWl4o= 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 , Mark Brown , Sasha Levin Subject: [PATCH 5.15 135/167] ASoC: Intel: sof_sdw: handle errors on card registration Date: Tue, 19 Jul 2022 13:54:27 +0200 Message-Id: <20220719114709.604033699@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart [ Upstream commit fe154c4ff376bc31041c6441958a08243df09c99 ] If the card registration fails, typically because of deferred probes, the device properties added for headset codecs are not removed, which leads to kernel oopses in driver bind/unbind tests. We already clean-up the device properties when the card is removed, this code can be moved as a helper and called upon card registration errors. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Bard Liao Link: https://lore.kernel.org/r/20220606203752.144159-4-pierre-louis.bossar= t@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/intel/boards/sof_sdw.c | 51 ++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_= sdw.c index 0bf3e56e1d58..abe39a0ef14b 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1323,6 +1323,33 @@ static struct snd_soc_card card_sof_sdw =3D { .late_probe =3D sof_sdw_card_late_probe, }; =20 +static void mc_dailink_exit_loop(struct snd_soc_card *card) +{ + struct snd_soc_dai_link *link; + int ret; + int i, j; + + for (i =3D 0; i < ARRAY_SIZE(codec_info_list); i++) { + if (!codec_info_list[i].exit) + continue; + /* + * We don't need to call .exit function if there is no matched + * dai link found. + */ + for_each_card_prelinks(card, j, link) { + if (!strcmp(link->codecs[0].dai_name, + codec_info_list[i].dai_name)) { + ret =3D codec_info_list[i].exit(card, link); + if (ret) + dev_warn(card->dev, + "codec exit failed %d\n", + ret); + break; + } + } + } +} + static int mc_probe(struct platform_device *pdev) { struct snd_soc_card *card =3D &card_sof_sdw; @@ -1387,6 +1414,7 @@ static int mc_probe(struct platform_device *pdev) ret =3D devm_snd_soc_register_card(&pdev->dev, card); if (ret) { dev_err(card->dev, "snd_soc_register_card failed %d\n", ret); + mc_dailink_exit_loop(card); return ret; } =20 @@ -1398,29 +1426,8 @@ static int mc_probe(struct platform_device *pdev) static int mc_remove(struct platform_device *pdev) { struct snd_soc_card *card =3D platform_get_drvdata(pdev); - struct snd_soc_dai_link *link; - int ret; - int i, j; =20 - for (i =3D 0; i < ARRAY_SIZE(codec_info_list); i++) { - if (!codec_info_list[i].exit) - continue; - /* - * We don't need to call .exit function if there is no matched - * dai link found. - */ - for_each_card_prelinks(card, j, link) { - if (!strcmp(link->codecs[0].dai_name, - codec_info_list[i].dai_name)) { - ret =3D codec_info_list[i].exit(card, link); - if (ret) - dev_warn(&pdev->dev, - "codec exit failed %d\n", - ret); - break; - } - } - } + mc_dailink_exit_loop(card); =20 return 0; } --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49E36CCA47F for ; Tue, 19 Jul 2022 12:43:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241515AbiGSMn0 (ORCPT ); Tue, 19 Jul 2022 08:43:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241482AbiGSMnC (ORCPT ); Tue, 19 Jul 2022 08:43: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 C4EFF80501; Tue, 19 Jul 2022 05:16: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 3469D6182F; Tue, 19 Jul 2022 12:16:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17B5EC341C6; Tue, 19 Jul 2022 12:16:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232993; bh=1mtxs395ZlU+Q1Yog4IOyC9wgbTJnqJ3X7rz6XpMosY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HWIoM2RjeHV4y2y7kT8wpEOzxdG30ug2o4pkxkbmiTALsQ01nZ73hzbBg3Y39OKUL hGNrCwLy8iEwXBWZ9xR/1NMGKLxpQNUoVskGhYex15B+FOOzyVkpODFfIsiLCBrJuO E8JySEGi6pND9b9bJKl0rvCshiBhVQ1WTx/mYdOs= 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 , Mark Brown , Sasha Levin Subject: [PATCH 5.15 136/167] ASoC: rt711: fix calibrate mutex initialization Date: Tue, 19 Jul 2022 13:54:28 +0200 Message-Id: <20220719114709.689028379@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart [ Upstream commit 08bb5dc6ce02374169213cea772b1c297eaf32d5 ] Follow the same flow as rt711-sdca and initialize all mutexes at probe time. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Bard Liao Link: https://lore.kernel.org/r/20220606203752.144159-5-pierre-louis.bossar= t@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/rt711-sdw.c | 3 +++ sound/soc/codecs/rt711.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) --- a/sound/soc/codecs/rt711-sdw.c +++ b/sound/soc/codecs/rt711-sdw.c @@ -474,6 +474,9 @@ static int rt711_sdw_remove(struct sdw_s if (rt711->first_hw_init) pm_runtime_disable(&slave->dev); =20 + mutex_destroy(&rt711->calibrate_mutex); + mutex_destroy(&rt711->disable_irq_lock); + return 0; } =20 --- a/sound/soc/codecs/rt711.c +++ b/sound/soc/codecs/rt711.c @@ -1199,6 +1199,7 @@ int rt711_init(struct device *dev, struc rt711->sdw_regmap =3D sdw_regmap; rt711->regmap =3D regmap; =20 + mutex_init(&rt711->calibrate_mutex); mutex_init(&rt711->disable_irq_lock); =20 /* @@ -1313,7 +1314,6 @@ int rt711_io_init(struct device *dev, st rt711_jack_detect_handler); INIT_DELAYED_WORK(&rt711->jack_btn_check_work, rt711_btn_check_handler); - mutex_init(&rt711->calibrate_mutex); INIT_WORK(&rt711->calibration_work, rt711_calibration_work); schedule_work(&rt711->calibration_work); } From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E528C433EF for ; Tue, 19 Jul 2022 12:43:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241519AbiGSMnh (ORCPT ); Tue, 19 Jul 2022 08:43:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241285AbiGSMnG (ORCPT ); Tue, 19 Jul 2022 08:43: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 1214880515; Tue, 19 Jul 2022 05:16: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 90E9DB81B1A; Tue, 19 Jul 2022 12:16:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA38DC341C6; Tue, 19 Jul 2022 12:16:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232996; bh=0N/hoijFdzvwhqEgcwFM/mHqoHJkBI+g+D5gj5j8tWs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yS33C/wy/Uvq1VB5P2vSbS/GKXZdS9w2qziQkqbHsJVG0cHTTulstPqFdqPhrVI7n /aBBcJuvRC2tMnAn03osuJlsmNwLKEUS8YWB7j87RWf/vNml/ZiXaR5esB3gLYe7kZ /VoOBByMivnXextZhZUyhVkOmY6DH9C+AJJ7i764= 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 , Mark Brown , Sasha Levin Subject: [PATCH 5.15 137/167] ASoC: rt7*-sdw: harden jack_detect_handler Date: Tue, 19 Jul 2022 13:54:29 +0200 Message-Id: <20220719114709.773722083@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart [ Upstream commit 0484271ab0ce50649329fa9dc23c50853c5b26a4 ] Realtek headset codec drivers typically check if the card is instantiated before proceeding with the jack detection. The rt700, rt711 and rt711-sdca are however missing a check on the card pointer, which can lead to NULL dereferences encountered in driver bind/unbind tests. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Bard Liao Link: https://lore.kernel.org/r/20220606203752.144159-6-pierre-louis.bossar= t@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/rt700.c | 2 +- sound/soc/codecs/rt711-sdca.c | 2 +- sound/soc/codecs/rt711.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/rt700.c b/sound/soc/codecs/rt700.c index 614a40247679..c70fe8b06e6d 100644 --- a/sound/soc/codecs/rt700.c +++ b/sound/soc/codecs/rt700.c @@ -162,7 +162,7 @@ static void rt700_jack_detect_handler(struct work_struc= t *work) if (!rt700->hs_jack) return; =20 - if (!rt700->component->card->instantiated) + if (!rt700->component->card || !rt700->component->card->instantiated) return; =20 reg =3D RT700_VERB_GET_PIN_SENSE | RT700_HP_OUT; diff --git a/sound/soc/codecs/rt711-sdca.c b/sound/soc/codecs/rt711-sdca.c index 66555cb5d1e4..2950cde029f7 100644 --- a/sound/soc/codecs/rt711-sdca.c +++ b/sound/soc/codecs/rt711-sdca.c @@ -294,7 +294,7 @@ static void rt711_sdca_jack_detect_handler(struct work_= struct *work) if (!rt711->hs_jack) return; =20 - if (!rt711->component->card->instantiated) + if (!rt711->component->card || !rt711->component->card->instantiated) return; =20 /* SDW_SCP_SDCA_INT_SDCA_0 is used for jack detection */ diff --git a/sound/soc/codecs/rt711.c b/sound/soc/codecs/rt711.c index 6e9b532a6271..344bfbc5683d 100644 --- a/sound/soc/codecs/rt711.c +++ b/sound/soc/codecs/rt711.c @@ -242,7 +242,7 @@ static void rt711_jack_detect_handler(struct work_struc= t *work) if (!rt711->hs_jack) return; =20 - if (!rt711->component->card->instantiated) + if (!rt711->component->card || !rt711->component->card->instantiated) return; =20 reg =3D RT711_VERB_GET_PIN_SENSE | RT711_HP_OUT; --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9AAD9C43334 for ; Tue, 19 Jul 2022 12:43:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241525AbiGSMnj (ORCPT ); Tue, 19 Jul 2022 08:43:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237992AbiGSMnI (ORCPT ); Tue, 19 Jul 2022 08:43: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 4D3248051F; Tue, 19 Jul 2022 05:16:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EB07461835; Tue, 19 Jul 2022 12:16:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CDAAEC341C6; Tue, 19 Jul 2022 12:16:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232999; bh=xBPwjux9Bz7aWd1/UgILLOUdNPSQvAaFFU4PMe+ej7g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x33v2dY3sYQ3yznBNoGNkYZYD+iQ2Td+paARRlPvSrOZhm0kXT8aFjjZFv9vcOqGM qL7l24v5b/1xJpO0BGvqJ2ZptcaUb6lzYWoO4ADNl/4YY9SheuEc1/Kablqp2Yaray RTcdKNf72Yw0W/IxzneE5g/egHH8EmmSIxL6pRgA= 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 , Mark Brown , Sasha Levin Subject: [PATCH 5.15 138/167] ASoC: codecs: rt700/rt711/rt711-sdca: initialize workqueues in probe Date: Tue, 19 Jul 2022 13:54:30 +0200 Message-Id: <20220719114709.860475784@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart [ Upstream commit ba98d7d8b60ba410aa03834f6aa48fd3b2e68478 ] The workqueues are initialized in the io_init functions, which isn't quite right. In some tests, this leads to warnings throw from __queue_delayed_work() WARN_ON_FUNCTION_MISMATCH(timer->function, delayed_work_timer_fn); Move all the initializations to the probe functions. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Bard Liao Link: https://lore.kernel.org/r/20220606203752.144159-7-pierre-louis.bossar= t@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/rt700.c | 12 +++++------- sound/soc/codecs/rt711-sdca.c | 10 +++------- sound/soc/codecs/rt711.c | 12 +++++------- 3 files changed, 13 insertions(+), 21 deletions(-) --- a/sound/soc/codecs/rt700.c +++ b/sound/soc/codecs/rt700.c @@ -1124,6 +1124,11 @@ int rt700_init(struct device *dev, struc =20 mutex_init(&rt700->disable_irq_lock); =20 + INIT_DELAYED_WORK(&rt700->jack_detect_work, + rt700_jack_detect_handler); + INIT_DELAYED_WORK(&rt700->jack_btn_check_work, + rt700_btn_check_handler); + /* * Mark hw_init to false * HW init will be performed when device reports present @@ -1218,13 +1223,6 @@ int rt700_io_init(struct device *dev, st /* Finish Initial Settings, set power to D3 */ regmap_write(rt700->regmap, RT700_SET_AUDIO_POWER_STATE, AC_PWRST_D3); =20 - if (!rt700->first_hw_init) { - INIT_DELAYED_WORK(&rt700->jack_detect_work, - rt700_jack_detect_handler); - INIT_DELAYED_WORK(&rt700->jack_btn_check_work, - rt700_btn_check_handler); - } - /* * if set_jack callback occurred early than io_init, * we set up the jack detection function now --- a/sound/soc/codecs/rt711-sdca.c +++ b/sound/soc/codecs/rt711-sdca.c @@ -1417,6 +1417,9 @@ int rt711_sdca_init(struct device *dev, mutex_init(&rt711->calibrate_mutex); mutex_init(&rt711->disable_irq_lock); =20 + INIT_DELAYED_WORK(&rt711->jack_detect_work, rt711_sdca_jack_detect_handle= r); + INIT_DELAYED_WORK(&rt711->jack_btn_check_work, rt711_sdca_btn_check_handl= er); + /* * Mark hw_init to false * HW init will be performed when device reports present @@ -1548,13 +1551,6 @@ int rt711_sdca_io_init(struct device *de rt711_sdca_index_update_bits(rt711, RT711_VENDOR_HDA_CTL, RT711_PUSH_BTN_INT_CTL0, 0x20, 0x00); =20 - if (!rt711->first_hw_init) { - INIT_DELAYED_WORK(&rt711->jack_detect_work, - rt711_sdca_jack_detect_handler); - INIT_DELAYED_WORK(&rt711->jack_btn_check_work, - rt711_sdca_btn_check_handler); - } - /* calibration */ ret =3D rt711_sdca_calibration(rt711); if (ret < 0) --- a/sound/soc/codecs/rt711.c +++ b/sound/soc/codecs/rt711.c @@ -1202,6 +1202,10 @@ int rt711_init(struct device *dev, struc mutex_init(&rt711->calibrate_mutex); mutex_init(&rt711->disable_irq_lock); =20 + INIT_DELAYED_WORK(&rt711->jack_detect_work, rt711_jack_detect_handler); + INIT_DELAYED_WORK(&rt711->jack_btn_check_work, rt711_btn_check_handler); + INIT_WORK(&rt711->calibration_work, rt711_calibration_work); + /* * Mark hw_init to false * HW init will be performed when device reports present @@ -1309,14 +1313,8 @@ int rt711_io_init(struct device *dev, st =20 if (rt711->first_hw_init) rt711_calibration(rt711); - else { - INIT_DELAYED_WORK(&rt711->jack_detect_work, - rt711_jack_detect_handler); - INIT_DELAYED_WORK(&rt711->jack_btn_check_work, - rt711_btn_check_handler); - INIT_WORK(&rt711->calibration_work, rt711_calibration_work); + else schedule_work(&rt711->calibration_work); - } =20 /* * if set_jack callback occurred early than io_init, From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D80C3C43334 for ; Tue, 19 Jul 2022 12:43:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241251AbiGSMnp (ORCPT ); Tue, 19 Jul 2022 08:43:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241148AbiGSMnJ (ORCPT ); Tue, 19 Jul 2022 08:43:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BDE78052D; Tue, 19 Jul 2022 05:16: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 737DAB81B34; Tue, 19 Jul 2022 12:16:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B76A5C341CA; Tue, 19 Jul 2022 12:16:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233002; bh=lcLO34MoPCLKVA/bKtAqWCoHH3fr4L1nHGwf+6hf4KU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SaqOjyYk/PTaeVTfWopdMPhjwg/Sgs53GdynIZnZqE27N/LX/+yTWxJN2OWLZqk70 2MtaxtmXtlLZV0851JBirU27BeUOA2zpK5WlFtogxbpvsBoqf7oFywm7YjRuOluqTZ wUz3r5wvE8vJ9ULIMCLbe52ZJwHYcJdkkn5lNc3o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Ujfalusi , Pierre-Louis Bossart , Bard Liao , Ranjani Sridharan , Mark Brown , Sasha Levin Subject: [PATCH 5.15 139/167] ASoC: SOF: Intel: hda-loader: Clarify the cl_dsp_init() flow Date: Tue, 19 Jul 2022 13:54:31 +0200 Message-Id: <20220719114709.946573895@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Ujfalusi [ Upstream commit bbfef046c6613404c01aeb9e9928bebb78dd327a ] Update the comment for the cl_dsp_init() to clarify what is done by the function and use the chip->init_core_mask instead of BIT(0) when unstalling/running the init core. Complements: 2a68ff846164 ("ASoC: SOF: Intel: hda: Revisit IMR boot sequenc= e") Signed-off-by: Peter Ujfalusi Reviewed-by: Pierre-Louis Bossart Reviewed-by: Bard Liao Reviewed-by: Ranjani Sridharan Link: https://lore.kernel.org/r/20220609085949.29062-4-peter.ujfalusi@linux= .intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/sof/intel/hda-loader.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/soc/sof/intel/hda-loader.c b/sound/soc/sof/intel/hda-loa= der.c index 14469e087b00..ee09393d42cb 100644 --- a/sound/soc/sof/intel/hda-loader.c +++ b/sound/soc/sof/intel/hda-loader.c @@ -80,9 +80,9 @@ static struct hdac_ext_stream *cl_stream_prepare(struct s= nd_sof_dev *sdev, unsig } =20 /* - * first boot sequence has some extra steps. core 0 waits for power - * status on core 1, so power up core 1 also momentarily, keep it in - * reset/stall and then turn it off + * first boot sequence has some extra steps. + * power on all host managed cores and only unstall/run the boot core to b= oot the + * DSP then turn off all non boot cores (if any) is powered on. */ static int cl_dsp_init(struct snd_sof_dev *sdev, int stream_tag) { @@ -117,7 +117,7 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, int st= ream_tag) ((stream_tag - 1) << 9))); =20 /* step 3: unset core 0 reset state & unstall/run core 0 */ - ret =3D hda_dsp_core_run(sdev, BIT(0)); + ret =3D hda_dsp_core_run(sdev, chip->init_core_mask); if (ret < 0) { if (hda->boot_iteration =3D=3D HDA_FW_BOOT_ATTEMPTS) dev_err(sdev->dev, --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90296C433EF for ; Tue, 19 Jul 2022 12:47:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241606AbiGSMrc (ORCPT ); Tue, 19 Jul 2022 08:47:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239317AbiGSMqm (ORCPT ); Tue, 19 Jul 2022 08:46:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26A9E8BA85; Tue, 19 Jul 2022 05:18: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 5398861746; Tue, 19 Jul 2022 12:18:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44502C341C6; Tue, 19 Jul 2022 12:18:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233105; bh=RUUKpFFgLZU5wPepFLY7h5IaUmNL/AXE1xUV7qaneFM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qzXDM5lZjA8/wxh/dsVhHcoubTpAH+nY/PiksvhnOqF0MLeWJ7EFWheUUTdUG6oE9 MZacW5BgZr/CpXQm9wKt9pZU2BvsXkZtR1nqNEt9eFpHSJK3jcremhxRvnRl76jmvY A4ZEruvS7fAaTcnk16aISYwBo7/ZHpmbHE9PEuPc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Brown , kernel test robot , Sasha Levin Subject: [PATCH 5.15 140/167] ASoC: wcd938x: Fix event generation for some controls Date: Tue, 19 Jul 2022 13:54:32 +0200 Message-Id: <20220719114710.032619335@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mark Brown [ Upstream commit 10e7ff0047921e32b919ecee7be706dd33c107f8 ] Currently wcd938x_*_put() unconditionally report that the value of the control changed, resulting in spurious events being generated. Return 0 in that case instead as we should. There is still an issue in the compander control which is a bit more complex. Signed-off-by: Mark Brown Reported-by: kernel test robot Link: https://lore.kernel.org/r/20220603122526.3914942-1-broonie@kernel.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/wcd938x.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c index 4480c118ed5d..8cdc45e669f2 100644 --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -2517,6 +2517,9 @@ static int wcd938x_tx_mode_put(struct snd_kcontrol *k= control, struct soc_enum *e =3D (struct soc_enum *)kcontrol->private_value; int path =3D e->shift_l; =20 + if (wcd938x->tx_mode[path] =3D=3D ucontrol->value.enumerated.item[0]) + return 0; + wcd938x->tx_mode[path] =3D ucontrol->value.enumerated.item[0]; =20 return 1; @@ -2539,6 +2542,9 @@ static int wcd938x_rx_hph_mode_put(struct snd_kcontro= l *kcontrol, struct snd_soc_component *component =3D snd_soc_kcontrol_component(kcontr= ol); struct wcd938x_priv *wcd938x =3D snd_soc_component_get_drvdata(component); =20 + if (wcd938x->hph_mode =3D=3D ucontrol->value.enumerated.item[0]) + return 0; + wcd938x->hph_mode =3D ucontrol->value.enumerated.item[0]; =20 return 1; @@ -2630,6 +2636,9 @@ static int wcd938x_ldoh_put(struct snd_kcontrol *kcon= trol, struct snd_soc_component *component =3D snd_soc_kcontrol_component(kcontr= ol); struct wcd938x_priv *wcd938x =3D snd_soc_component_get_drvdata(component); =20 + if (wcd938x->ldoh =3D=3D ucontrol->value.integer.value[0]) + return 0; + wcd938x->ldoh =3D ucontrol->value.integer.value[0]; =20 return 1; @@ -2652,6 +2661,9 @@ static int wcd938x_bcs_put(struct snd_kcontrol *kcont= rol, struct snd_soc_component *component =3D snd_soc_kcontrol_component(kcontr= ol); struct wcd938x_priv *wcd938x =3D snd_soc_component_get_drvdata(component); =20 + if (wcd938x->bcs_dis =3D=3D ucontrol->value.integer.value[0]) + return 0; + wcd938x->bcs_dis =3D ucontrol->value.integer.value[0]; =20 return 1; --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09718C43334 for ; Tue, 19 Jul 2022 12:45:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239938AbiGSMps (ORCPT ); Tue, 19 Jul 2022 08:45:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241698AbiGSMoY (ORCPT ); Tue, 19 Jul 2022 08:44:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E5F486884; Tue, 19 Jul 2022 05:17: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 68289B81B95; Tue, 19 Jul 2022 12:17:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0888C341CA; Tue, 19 Jul 2022 12:17:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233028; bh=/sX5PM90a21Ru7lX9KW7DDa/MPScR0rwjAmahjAtP5g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y+xkz8iVgJuw7H4eEhd7jwvyBEiB00m93eXN4w1J9UgipLTgp7ZtRrlXRsoRUS5lZ ysUOG1yAK026E+LtgEzsP/WoijujzhqqaE1GMMnb/tuwOfLr9IgXq+Nz/gdAYVGlk8 3CWIIz9C78Nq/Y4lACdM7/qQkBfhOjwTEfDGdeds= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 5.15 141/167] ASoC: Intel: bytcr_wm5102: Fix GPIO related probe-ordering problem Date: Tue, 19 Jul 2022 13:54:33 +0200 Message-Id: <20220719114710.122445444@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede [ Upstream commit 4e07479eab8a044cc9542414ccb4aeb8eb033bde ] The "wlf,spkvdd-ena" GPIO needed by the bytcr_wm5102 driver is made available through a gpio-lookup table. This gpio-lookup table is registered by drivers/mfd/arizona-spi.c, which may get probed after the bytcr_wm5102 driver. If the gpio-lookup table has not registered yet then the gpiod_get() will return -ENOENT. Treat -ENOENT as -EPROBE_DEFER to still keep things working in this case. Signed-off-by: Hans de Goede Acked-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20220612155652.107310-1-hdegoede@redhat.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/intel/boards/bytcr_wm5102.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sound/soc/intel/boards/bytcr_wm5102.c b/sound/soc/intel/boards= /bytcr_wm5102.c index 580d5fddae5a..bb669d58eb8b 100644 --- a/sound/soc/intel/boards/bytcr_wm5102.c +++ b/sound/soc/intel/boards/bytcr_wm5102.c @@ -421,8 +421,17 @@ static int snd_byt_wm5102_mc_probe(struct platform_dev= ice *pdev) priv->spkvdd_en_gpio =3D gpiod_get(codec_dev, "wlf,spkvdd-ena", GPIOD_OUT= _LOW); put_device(codec_dev); =20 - if (IS_ERR(priv->spkvdd_en_gpio)) - return dev_err_probe(dev, PTR_ERR(priv->spkvdd_en_gpio), "getting spkvdd= -GPIO\n"); + if (IS_ERR(priv->spkvdd_en_gpio)) { + ret =3D PTR_ERR(priv->spkvdd_en_gpio); + /* + * The spkvdd gpio-lookup is registered by: drivers/mfd/arizona-spi.c, + * so -ENOENT means that arizona-spi hasn't probed yet. + */ + if (ret =3D=3D -ENOENT) + ret =3D -EPROBE_DEFER; + + return dev_err_probe(dev, ret, "getting spkvdd-GPIO\n"); + } =20 /* override platform name, if required */ byt_wm5102_card.dev =3D dev; --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18D40C433EF for ; Tue, 19 Jul 2022 12:47:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241561AbiGSMrV (ORCPT ); Tue, 19 Jul 2022 08:47:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239414AbiGSMpW (ORCPT ); Tue, 19 Jul 2022 08:45:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CC3F558FF; Tue, 19 Jul 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 ams.source.kernel.org (Postfix) with ESMTPS id CEF78B81B1C; Tue, 19 Jul 2022 12:17:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1547C341C6; Tue, 19 Jul 2022 12:17:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233059; bh=JG031+SIFPqD7zsmkiMMSaalhVUkd4njI1+DibBd8D0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TaJ2u9yEUbNg1SQTRAg2vjtu/kfKecrpVZt4Sn5eKbZMJ/5OKQg77y2tQ8h1VcRd5 QX3QTtQPdsUflbKaIEHDbfwKihcqeBTny6J/QI4v4Yxd8+Dih1ki4YyN39Lmg0pzv1 Invhp7stNSWXO7qH0TYQI+hs++ohl9UgXPxL2/B4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charles Keepax , Mark Brown , Sasha Levin Subject: [PATCH 5.15 142/167] ASoC: wm5110: Fix DRE control Date: Tue, 19 Jul 2022 13:54:34 +0200 Message-Id: <20220719114710.231987100@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Charles Keepax [ Upstream commit 0bc0ae9a5938d512fd5d44f11c9c04892dcf4961 ] The DRE controls on wm5110 should return a value of 1 if the DRE state is actually changed, update to fix this. Signed-off-by: Charles Keepax Link: https://lore.kernel.org/r/20220621102041.1713504-2-ckeepax@opensource= .cirrus.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/wm5110.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c index 5c2d45d05c97..7c6e01720d65 100644 --- a/sound/soc/codecs/wm5110.c +++ b/sound/soc/codecs/wm5110.c @@ -413,6 +413,7 @@ static int wm5110_put_dre(struct snd_kcontrol *kcontrol, unsigned int rnew =3D (!!ucontrol->value.integer.value[1]) << mc->rshift; unsigned int lold, rold; unsigned int lena, rena; + bool change =3D false; int ret; =20 snd_soc_dapm_mutex_lock(dapm); @@ -440,8 +441,8 @@ static int wm5110_put_dre(struct snd_kcontrol *kcontrol, goto err; } =20 - ret =3D regmap_update_bits(arizona->regmap, ARIZONA_DRE_ENABLE, - mask, lnew | rnew); + ret =3D regmap_update_bits_check(arizona->regmap, ARIZONA_DRE_ENABLE, + mask, lnew | rnew, &change); if (ret) { dev_err(arizona->dev, "Failed to set DRE: %d\n", ret); goto err; @@ -454,6 +455,9 @@ static int wm5110_put_dre(struct snd_kcontrol *kcontrol, if (!rnew && rold) wm5110_clear_pga_volume(arizona, mc->rshift); =20 + if (change) + ret =3D 1; + err: snd_soc_dapm_mutex_unlock(dapm); =20 --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7069C433EF for ; Tue, 19 Jul 2022 12:47:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239685AbiGSMrQ (ORCPT ); Tue, 19 Jul 2022 08:47:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242107AbiGSMpT (ORCPT ); Tue, 19 Jul 2022 08:45:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08E2E88CC9; Tue, 19 Jul 2022 05:18: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 7A5E5B81B13; Tue, 19 Jul 2022 12:18:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0BDFC341C6; Tue, 19 Jul 2022 12:18:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233085; bh=oXmiPHef9sNQdd78/D5gyH14NvZuBXfGyDVPUHBBn3o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ag+s/q/s4OwuXZOY8hVYHqhcavOh3pSbQbqe1pYZdTOb+xlN6Cryb5cjQsR9Mjl9T QWX0jQhTaYddKGp+BTjG+kmWc48zEVEqCTemwyQSe49OgO3zaLNzxWb+A9OnGp7MXr Z9hnsK1uEfqfkcAhTb331frW6HJQxMC2un2LFL1k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shuming Fan , Mark Brown , Sasha Levin Subject: [PATCH 5.15 143/167] ASoC: rt711-sdca: fix kernel NULL pointer dereference when IO error Date: Tue, 19 Jul 2022 13:54:35 +0200 Message-Id: <20220719114710.325178974@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shuming Fan [ Upstream commit 1df793d479bef546569fc2e409ff8bb3f0fb8e99 ] The initial settings will be written before the codec probe function. But, the rt711->component doesn't be assigned yet. If IO error happened during initial settings operations, it will cause the = kernel panic. This patch changed component->dev to slave->dev to fix this issue. Signed-off-by: Shuming Fan Link: https://lore.kernel.org/r/20220621090719.30558-1-shumingf@realtek.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/rt711-sdca.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/rt711-sdca.c b/sound/soc/codecs/rt711-sdca.c index 60aef52b3fe4..3b5df3ea2f60 100644 --- a/sound/soc/codecs/rt711-sdca.c +++ b/sound/soc/codecs/rt711-sdca.c @@ -34,7 +34,7 @@ static int rt711_sdca_index_write(struct rt711_sdca_priv = *rt711, =20 ret =3D regmap_write(regmap, addr, value); if (ret < 0) - dev_err(rt711->component->dev, + dev_err(&rt711->slave->dev, "Failed to set private value: %06x <=3D %04x ret=3D%d\n", addr, value, ret); =20 @@ -50,7 +50,7 @@ static int rt711_sdca_index_read(struct rt711_sdca_priv *= rt711, =20 ret =3D regmap_read(regmap, addr, value); if (ret < 0) - dev_err(rt711->component->dev, + dev_err(&rt711->slave->dev, "Failed to get private value: %06x =3D> %04x ret=3D%d\n", addr, *value, ret); =20 --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B162AC43334 for ; Tue, 19 Jul 2022 12:48:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241503AbiGSMsE (ORCPT ); Tue, 19 Jul 2022 08:48:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241676AbiGSMqq (ORCPT ); Tue, 19 Jul 2022 08:46:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C25268BAA8; Tue, 19 Jul 2022 05:18: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 5B319B81B31; Tue, 19 Jul 2022 12:18:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACFEAC341C6; Tue, 19 Jul 2022 12:18:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233088; bh=ejnKotZB6Y2TMNzJtjiQwLLGKsKmTL1udkyokr7DcUk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SVDJj7zF/mjKPaUK4XzqJmDYNVOh8S1zXQid1fnHjzEGqJFB/DUHqHw7dURPTNGAS UODGnDKTqtR8cZw5zm2FbujFzzJxxd2XSzxnIj897uo5q8ELTH56ISCDdyk6fSaSgk QR8XBqDvrkJEHh8ySKb7q40u42xG6SQ4N/7EVHbM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charles Keepax , Mark Brown , Sasha Levin Subject: [PATCH 5.15 144/167] ASoC: dapm: Initialise kcontrol data for mux/demux controls Date: Tue, 19 Jul 2022 13:54:36 +0200 Message-Id: <20220719114710.415049137@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Charles Keepax [ Upstream commit 11d7a12f7f50baa5af9090b131c9b03af59503e7 ] DAPM keeps a copy of the current value of mux/demux controls, however this value is only initialised in the case of autodisable controls. This leads to false notification events when first modifying a DAPM kcontrol that has a non-zero default. Autodisable controls are left as they are, since they already initialise the value, and there would be more work required to support autodisable muxes where the first option isn't disabled and/or that isn't the default. Technically this issue could affect mixer/switch elements as well, although not on any of the devices I am currently running. There is also a little more work to do to address the issue there due to that side supporting stereo controls, so that has not been tackled in this patch. Signed-off-by: Charles Keepax Link: https://lore.kernel.org/r/20220623105120.1981154-1-ckeepax@opensource= .cirrus.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/soc-dapm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 47b85ba5b7d6..b957049bae33 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -62,6 +62,8 @@ struct snd_soc_dapm_widget * snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm, const struct snd_soc_dapm_widget *widget); =20 +static unsigned int soc_dapm_read(struct snd_soc_dapm_context *dapm, int r= eg); + /* dapm power sequences - make this per codec in the future */ static int dapm_up_seq[] =3D { [snd_soc_dapm_pre] =3D 1, @@ -442,6 +444,9 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm= _widget *widget, =20 snd_soc_dapm_add_path(widget->dapm, data->widget, widget, NULL, NULL); + } else if (e->reg !=3D SND_SOC_NOPM) { + data->value =3D soc_dapm_read(widget->dapm, e->reg) & + (e->mask << e->shift_l); } break; default: --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C114C43334 for ; Tue, 19 Jul 2022 12:47:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241698AbiGSMru (ORCPT ); Tue, 19 Jul 2022 08:47:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241707AbiGSMqo (ORCPT ); Tue, 19 Jul 2022 08:46:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C2BC8BA9F; Tue, 19 Jul 2022 05:18: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 AE19961839; Tue, 19 Jul 2022 12:18:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77F73C341C6; Tue, 19 Jul 2022 12:18:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233090; bh=gb/czhMg4fVob1ttITgWIuTsBA07eCazqwFw3vqBK4Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nl/sOQr4UMfllrwmWkTpvpKOBjYTxPK4DYw/iaj8BNuM49KqhkshwtxtU5HLPuPtj Tnlr0ULgIKo5bBwNcY3p8W/2u8nclTZwWYEP+jCLe0doV9o9D08MaaBl1waIAmo9qh hFvQYz/ZPQjSLrAo8UAPXT5jjoB5t0DxamPvcxg8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charles Keepax , Mark Brown , Sasha Levin Subject: [PATCH 5.15 145/167] ASoC: cs47l15: Fix event generation for low power mux control Date: Tue, 19 Jul 2022 13:54:37 +0200 Message-Id: <20220719114710.508413989@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Charles Keepax [ Upstream commit 7f103af4a10f375b9b346b4d0b730f6a66b8c451 ] cs47l15_in1_adc_put always returns zero regardless of if the control value was updated. This results in missing notifications to user-space of the control change. Update the handling to return 1 when the value is changed. Signed-off-by: Charles Keepax Link: https://lore.kernel.org/r/20220623105120.1981154-3-ckeepax@opensource= .cirrus.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/cs47l15.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/cs47l15.c b/sound/soc/codecs/cs47l15.c index 1ee83160b83f..ac9ccdea15b5 100644 --- a/sound/soc/codecs/cs47l15.c +++ b/sound/soc/codecs/cs47l15.c @@ -122,6 +122,9 @@ static int cs47l15_in1_adc_put(struct snd_kcontrol *kco= ntrol, snd_soc_kcontrol_component(kcontrol); struct cs47l15 *cs47l15 =3D snd_soc_component_get_drvdata(component); =20 + if (!!ucontrol->value.integer.value[0] =3D=3D cs47l15->in1_lp_mode) + return 0; + switch (ucontrol->value.integer.value[0]) { case 0: /* Set IN1 to normal mode */ @@ -150,7 +153,7 @@ static int cs47l15_in1_adc_put(struct snd_kcontrol *kco= ntrol, break; } =20 - return 0; + return 1; } =20 static const struct snd_kcontrol_new cs47l15_snd_controls[] =3D { --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 562F6CCA492 for ; Tue, 19 Jul 2022 12:47:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241719AbiGSMrE (ORCPT ); Tue, 19 Jul 2022 08:47:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241645AbiGSMq0 (ORCPT ); Tue, 19 Jul 2022 08:46: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 10BB28B48E; Tue, 19 Jul 2022 05:18: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 A51E46187F; Tue, 19 Jul 2022 12:18:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53AD2C341C6; Tue, 19 Jul 2022 12:18:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233093; bh=O8tlw0dNGRaykhtvOszk9r/8Y1NGnYjj0OZ9LrffeaM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VhXXT9GNP1XqDWczod8wdjZJEdU3mcDUGlTwCu8jh/ClZ0PWQHzmbHO/AWMgolvRk XfWuSo4sOwke8MVSxF7u20TIlmhKIe/6M+bMDLsYxL6iPbvP9/R//V9y/JQ7ywvYSJ CvGTolEqZiR/kEA3ibFXJgYDH0xbJt9wvECoXnYk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charles Keepax , Mark Brown , Sasha Levin Subject: [PATCH 5.15 146/167] ASoC: madera: Fix event generation for OUT1 demux Date: Tue, 19 Jul 2022 13:54:38 +0200 Message-Id: <20220719114710.598030121@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Charles Keepax [ Upstream commit e3cabbef3db8269207a6b8808f510137669f8deb ] madera_out1_demux_put returns the value of snd_soc_dapm_mux_update_power, which returns a 1 if a path was found for the kcontrol. This is obviously different to the expected return a 1 if the control was updated value. This results in spurious notifications to user-space. Update the handling to only return a 1 when the value is changed. Signed-off-by: Charles Keepax Link: https://lore.kernel.org/r/20220623105120.1981154-4-ckeepax@opensource= .cirrus.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/madera.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/madera.c b/sound/soc/codecs/madera.c index f4ed7e04673f..d3e7a591b5a8 100644 --- a/sound/soc/codecs/madera.c +++ b/sound/soc/codecs/madera.c @@ -618,7 +618,13 @@ int madera_out1_demux_put(struct snd_kcontrol *kcontro= l, end: snd_soc_dapm_mutex_unlock(dapm); =20 - return snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL); + ret =3D snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL); + if (ret < 0) { + dev_err(madera->dev, "Failed to update demux power state: %d\n", ret); + return ret; + } + + return change; } EXPORT_SYMBOL_GPL(madera_out1_demux_put); =20 --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D25DDC433EF for ; Tue, 19 Jul 2022 12:47:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241686AbiGSMrp (ORCPT ); Tue, 19 Jul 2022 08:47:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241652AbiGSMqo (ORCPT ); Tue, 19 Jul 2022 08:46:44 -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 C32368BA98; Tue, 19 Jul 2022 05:18: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 sin.source.kernel.org (Postfix) with ESMTPS id 48E1CCE1BE4; Tue, 19 Jul 2022 12:18:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54958C341C6; Tue, 19 Jul 2022 12:18:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233096; bh=uJxQ5zkiSZVte2k7O6ftC2Aguzs3PGSDlpQSoHM8pms=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z2WgugxxvObZnqWJWp/PM84W6KXTnVYN0UKx/61Vx6q0nf3GKSJGB3bSPWXcVu6lA xFaYHEjjNM7VvQ7Fy+cKiEXKc+9fbUUuJhgNsq/UE2/pnVzt837zJGpwyF9FEhCHK7 Xxl/6HsnrA/Xrqvoe285vukicZjJM5dR6Nws+bT0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charles Keepax , Mark Brown , Sasha Levin Subject: [PATCH 5.15 147/167] ASoC: madera: Fix event generation for rate controls Date: Tue, 19 Jul 2022 13:54:39 +0200 Message-Id: <20220719114710.688359822@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Charles Keepax [ Upstream commit 980555e95f7cabdc9c80a07107622b097ba23703 ] madera_adsp_rate_put always returns zero regardless of if the control value was updated. This results in missing notifications to user-space of the control change. Update the handling to return 1 when the value is changed. Signed-off-by: Charles Keepax Link: https://lore.kernel.org/r/20220623105120.1981154-5-ckeepax@opensource= .cirrus.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/soc/codecs/madera.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/madera.c b/sound/soc/codecs/madera.c index d3e7a591b5a8..fd4fa1d5d2d1 100644 --- a/sound/soc/codecs/madera.c +++ b/sound/soc/codecs/madera.c @@ -899,7 +899,7 @@ static int madera_adsp_rate_put(struct snd_kcontrol *kc= ontrol, struct soc_enum *e =3D (struct soc_enum *)kcontrol->private_value; const int adsp_num =3D e->shift_l; const unsigned int item =3D ucontrol->value.enumerated.item[0]; - int ret; + int ret =3D 0; =20 if (item >=3D e->items) return -EINVAL; @@ -916,10 +916,10 @@ static int madera_adsp_rate_put(struct snd_kcontrol *= kcontrol, "Cannot change '%s' while in use by active audio paths\n", kcontrol->id.name); ret =3D -EBUSY; - } else { + } else if (priv->adsp_rate_cache[adsp_num] !=3D e->values[item]) { /* Volatile register so defer until the codec is powered up */ priv->adsp_rate_cache[adsp_num] =3D e->values[item]; - ret =3D 0; + ret =3D 1; } =20 mutex_unlock(&priv->rate_lock); --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 229A2C433EF for ; Tue, 19 Jul 2022 12:46:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241674AbiGSMqq (ORCPT ); Tue, 19 Jul 2022 08:46:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242152AbiGSMpl (ORCPT ); Tue, 19 Jul 2022 08:45: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 6EB7E8AEC5; Tue, 19 Jul 2022 05:18: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 D7A96B81B21; Tue, 19 Jul 2022 12:18:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F672C341C6; Tue, 19 Jul 2022 12:18:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233099; bh=2qjO8+odQ7oxEl1fALycalDewY6Q0DjTfZWWlCdvWKE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vyx1uIq/aWvbyhGgR4zIGqRcqkdd6XTwj1OFtmLwxRNtBHtUo0RwWtQnUgdJrGs+d oNDXbawYOYzrOSwoBeQj6U4GHh/XMxUUdfuk6b72zcsLE3MM2ND43uanr0NVSKfqr3 mTsfut5GQWSrMsezxdyw9O+SWXGhLpzT/DTHIAuI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Zyngier , Stafford Horne , Sasha Levin Subject: [PATCH 5.15 148/167] irqchip: or1k-pic: Undefine mask_ack for level triggered hardware Date: Tue, 19 Jul 2022 13:54:40 +0200 Message-Id: <20220719114710.776418439@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stafford Horne [ Upstream commit 8520501346ed8d1c4a6dfa751cb57328a9c843f1 ] The mask_ack operation clears the interrupt by writing to the PICSR register. This we don't want for level triggered interrupt because it does not actually clear the interrupt on the source hardware. This was causing issues in qemu with multi core setups where interrupts would continue to fire even though they had been cleared in PICSR. Just remove the mask_ack operation. Acked-by: Marc Zyngier Signed-off-by: Stafford Horne Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/irqchip/irq-or1k-pic.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/irqchip/irq-or1k-pic.c b/drivers/irqchip/irq-or1k-pic.c index 03d2366118dd..d5f1fabc45d7 100644 --- a/drivers/irqchip/irq-or1k-pic.c +++ b/drivers/irqchip/irq-or1k-pic.c @@ -66,7 +66,6 @@ static struct or1k_pic_dev or1k_pic_level =3D { .name =3D "or1k-PIC-level", .irq_unmask =3D or1k_pic_unmask, .irq_mask =3D or1k_pic_mask, - .irq_mask_ack =3D or1k_pic_mask_ack, }, .handle =3D handle_level_irq, .flags =3D IRQ_LEVEL | IRQ_NOPROBE, --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 466B2C43334 for ; Tue, 19 Jul 2022 12:47:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241595AbiGSMra (ORCPT ); Tue, 19 Jul 2022 08:47:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241584AbiGSMqj (ORCPT ); Tue, 19 Jul 2022 08:46: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 BD7D78B4BA; Tue, 19 Jul 2022 05:18: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 990216183D; Tue, 19 Jul 2022 12:18:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D8F5C341C6; Tue, 19 Jul 2022 12:18:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233102; bh=GfEQxJNjjHPalvfvVNCj9R5BmsifevUz1PfOtOY//7E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IDVrPObOmA3cgOCm0z7d60SFTQZsJY5Ie2qig7M7tcD6xtiI4XDzag7aj5i7fSsbl ebSw08jQPmf4VanLoQplXR7Da8fSds+0a5X3l7RQehlMiHElS5/UVIW0jSYBv3eqBc mmSz9Urd7gvFeww7pkTf+yWJQSjjGviHVnEy6lAQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juergen Gross , Borislav Petkov , Sasha Levin Subject: [PATCH 5.15 149/167] x86: Clear .brk area at early boot Date: Tue, 19 Jul 2022 13:54:41 +0200 Message-Id: <20220719114710.861804071@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Juergen Gross [ Upstream commit 38fa5479b41376dc9d7f57e71c83514285a25ca0 ] The .brk section has the same properties as .bss: it is an alloc-only section and should be cleared before being used. Not doing so is especially a problem for Xen PV guests, as the hypervisor will validate page tables (check for writable page tables and hypervisor private bits) before accepting them to be used. Make sure .brk is initially zero by letting clear_bss() clear the brk area, too. Signed-off-by: Juergen Gross Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/r/20220630071441.28576-3-jgross@suse.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/x86/kernel/head64.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index de01903c3735..5036104d5470 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c @@ -418,6 +418,8 @@ static void __init clear_bss(void) { memset(__bss_start, 0, (unsigned long) __bss_stop - (unsigned long) __bss_start); + memset(__brk_base, 0, + (unsigned long) __brk_limit - (unsigned long) __brk_base); } =20 static unsigned long get_cmd_line_ptr(void) --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94A78CCA48B for ; Tue, 19 Jul 2022 12:47:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241588AbiGSMp1 (ORCPT ); Tue, 19 Jul 2022 08:45:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241572AbiGSMoI (ORCPT ); Tue, 19 Jul 2022 08:44: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 086E383F08; Tue, 19 Jul 2022 05:17:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3CC39B81B37; Tue, 19 Jul 2022 12:17:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B3DCC36AE5; Tue, 19 Jul 2022 12:17:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233031; bh=V8Bnn0Qdmea87DKi19dp6Ps/3Mkn7B5N1/5lffCMd6U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lGy3EjwPWLuH2L9p7LuvZiVZzL+FdeNv8eXLq6pHeBF+zYR5AfZl/BUX04hEYygp2 g1wOMrTmWdEaVcsxnub/a4PRmkpYxkBse8hiIreE0GC9oJdDPDi+RhvmfPIgbrUTaA QQxz3S8WNhn32iRgAcV6qPGRmSG1uLXm86P95G/A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Walleij , Arnd Bergmann , Sasha Levin Subject: [PATCH 5.15 150/167] soc: ixp4xx/npe: Fix unused match warning Date: Tue, 19 Jul 2022 13:54:42 +0200 Message-Id: <20220719114710.954356208@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linus Walleij [ Upstream commit 620f83b8326ce9706b1118334f0257ae028ce045 ] The kernel test robot found this inconsistency: drivers/soc/ixp4xx/ixp4xx-npe.c:737:34: warning: 'ixp4xx_npe_of_match' defined but not used [-Wunused-const-variable=3D] 737 | static const struct of_device_id ixp4xx_npe_of_match[] =3D { This is because the match is enclosed in the of_match_ptr() which compiles into NULL when OF is disabled and this is unnecessary. Fix it by dropping of_match_ptr() around the match. Signed-off-by: Linus Walleij Link: https://lore.kernel.org/r/20220626074315.61209-1-linus.walleij@linaro= .org' Signed-off-by: Arnd Bergmann Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/soc/ixp4xx/ixp4xx-npe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/ixp4xx/ixp4xx-npe.c b/drivers/soc/ixp4xx/ixp4xx-np= e.c index f490c4ca51f5..a0159805d061 100644 --- a/drivers/soc/ixp4xx/ixp4xx-npe.c +++ b/drivers/soc/ixp4xx/ixp4xx-npe.c @@ -743,7 +743,7 @@ static const struct of_device_id ixp4xx_npe_of_match[] = =3D { static struct platform_driver ixp4xx_npe_driver =3D { .driver =3D { .name =3D "ixp4xx-npe", - .of_match_table =3D of_match_ptr(ixp4xx_npe_of_match), + .of_match_table =3D ixp4xx_npe_of_match, }, .probe =3D ixp4xx_npe_probe, .remove =3D ixp4xx_npe_remove, --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1381CCA48D for ; Tue, 19 Jul 2022 12:47:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241626AbiGSMpb (ORCPT ); Tue, 19 Jul 2022 08:45:31 -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 S241603AbiGSMoN (ORCPT ); Tue, 19 Jul 2022 08:44:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7587A84ED3; Tue, 19 Jul 2022 05:17:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 243A5B81B1A; Tue, 19 Jul 2022 12:17:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69C0DC341C6; Tue, 19 Jul 2022 12:17:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233033; bh=Z0MLB5sErD4u7jQkthnxO4/0hpaebS009ioAE/xLd9w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h/qvezOH6iZdT+qzwEreSEJE44u9dwQpaDnpqIihaJ2Ckp/X2tb6IWRB0teenmFcp FxmU33BrcRZz+EDtobndl6ZHaZhsp8O6hdItReVeg/jtfM8+Ab15/EAgFMvvl/jnI3 UIXkHGppRReeRtoRHa7WTm+seepQKeKAtDmKVMn4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gabriel Fernandez , Alexandre Torgue , Sasha Levin Subject: [PATCH 5.15 151/167] ARM: dts: stm32: use the correct clock source for CEC on stm32mp151 Date: Tue, 19 Jul 2022 13:54:43 +0200 Message-Id: <20220719114711.071166055@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Gabriel Fernandez [ Upstream commit 78ece8cce1ba0c3f3e5a7c6c1b914b3794f04c44 ] The peripheral clock of CEC is not LSE but CEC. Signed-off-by: Gabriel Fernandez Signed-off-by: Alexandre Torgue Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/arm/boot/dts/stm32mp151.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/stm32mp151.dtsi b/arch/arm/boot/dts/stm32mp1= 51.dtsi index a9b65b3bfda5..e0d483318798 100644 --- a/arch/arm/boot/dts/stm32mp151.dtsi +++ b/arch/arm/boot/dts/stm32mp151.dtsi @@ -553,7 +553,7 @@ compatible =3D "st,stm32-cec"; reg =3D <0x40016000 0x400>; interrupts =3D ; - clocks =3D <&rcc CEC_K>, <&clk_lse>; + clocks =3D <&rcc CEC_K>, <&rcc CEC>; clock-names =3D "cec", "hdmi-cec"; status =3D "disabled"; }; --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4273DC43334 for ; Tue, 19 Jul 2022 12:45:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241300AbiGSMpz (ORCPT ); Tue, 19 Jul 2022 08:45:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241809AbiGSMol (ORCPT ); Tue, 19 Jul 2022 08:44:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 990E487353; Tue, 19 Jul 2022 05:17: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 D0E9BB81B21; Tue, 19 Jul 2022 12:17:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36B4BC341C6; Tue, 19 Jul 2022 12:17:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233036; bh=Gf0LKqlKu1/jTIdxolSfG0iMtIyumwv6zYWKDbpiuJ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dc/aJ5zzu2SAtfZDC/iC+9UgBwpdrYq9CC1H9m5OJoff9GPShGaqHUiJuIBUkIlKA RfwzRQItcldqjznysVcDAtiJTysJTBdrbTeIWfDlh0+3SfxMVdPmvEr7S+m8lUrXrU 2bPpEy7jUpIFg+tbGuHHsyJDuvYOIEfpeomBUcJU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivas Neeli , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.15 152/167] Revert "can: xilinx_can: Limit CANFD brp to 2" Date: Tue, 19 Jul 2022 13:54:44 +0200 Message-Id: <20220719114711.181717609@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Srinivas Neeli [ Upstream commit c6da4590fe819dfe28a4f8037a8dc1e056542fb4 ] This reverts commit 05ca14fdb6fe65614e0652d03e44b02748d25af7. On early silicon engineering samples observed bit shrinking issue when we use brp as 1. Hence updated brp_min as 2. As in production silicon this issue is fixed, so reverting the patch. Link: https://lore.kernel.org/all/20220609082433.1191060-2-srinivas.neeli@x= ilinx.com Signed-off-by: Srinivas Neeli Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/net/can/xilinx_can.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c index 262b783d1df8..a2e751f0ae0b 100644 --- a/drivers/net/can/xilinx_can.c +++ b/drivers/net/can/xilinx_can.c @@ -259,7 +259,7 @@ static const struct can_bittiming_const xcan_bittiming_= const_canfd2 =3D { .tseg2_min =3D 1, .tseg2_max =3D 128, .sjw_max =3D 128, - .brp_min =3D 2, + .brp_min =3D 1, .brp_max =3D 256, .brp_inc =3D 1, }; @@ -272,7 +272,7 @@ static const struct can_bittiming_const xcan_data_bitti= ming_const_canfd2 =3D { .tseg2_min =3D 1, .tseg2_max =3D 16, .sjw_max =3D 16, - .brp_min =3D 2, + .brp_min =3D 1, .brp_max =3D 256, .brp_inc =3D 1, }; --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80C10C433EF for ; Tue, 19 Jul 2022 12:45:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242127AbiGSMph (ORCPT ); Tue, 19 Jul 2022 08:45:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241652AbiGSMoT (ORCPT ); Tue, 19 Jul 2022 08:44: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 8E8F185D77; Tue, 19 Jul 2022 05: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 A1F4AB81B2E; Tue, 19 Jul 2022 12:17:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02FA6C341C6; Tue, 19 Jul 2022 12:17:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233039; bh=o97yyzqXtkAi9dD3IykIm+0aHWiYI1dIxHa/BFEbvjI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wk2kxn9wvoP4wRhnSOVTGyHcsHOV9f6yQBSAphRR8ux0y6zq0yjFGPYb8nIjWMgdQ NoPJT2oNdMRGZEcy8MRNfUQFzU6zp8ZObtBa1h9LFaPgezHw5UiyKCpnd/tv6LcT5u lfPn5Ab6HYHhS7GvFMCu9P5qqcmmsJJ2MlQdbcVI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Veness , Takashi Iwai , Sasha Levin Subject: [PATCH 5.15 153/167] ALSA: usb-audio: Add quirks for MacroSilicon MS2100/MS2106 devices Date: Tue, 19 Jul 2022 13:54:45 +0200 Message-Id: <20220719114711.277508845@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: John Veness [ Upstream commit 6e2c9105e0b743c92a157389d40f00b81bdd09fe ] Treat the claimed 96kHz 1ch in the descriptors as 48kHz 2ch, so that the audio stream doesn't sound mono. Also fix initial stream alignment, so that left and right channels are in the correct order. Signed-off-by: John Veness Link: https://lore.kernel.org/r/20220624140757.28758-1-john-linux@pelago.or= g.uk Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/usb/quirks-table.h | 48 ++++++++++++++++++++++++++++++++++++++++++= +++++ sound/usb/quirks.c | 3 ++ 2 files changed, 51 insertions(+) --- a/sound/usb/quirks-table.h +++ b/sound/usb/quirks-table.h @@ -3803,6 +3803,54 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, =20 /* + * MacroSilicon MS2100/MS2106 based AV capture cards + * + * These claim 96kHz 1ch in the descriptors, but are actually 48kHz 2ch. + * They also need QUIRK_FLAG_ALIGN_TRANSFER, which makes one wonder if + * they pretend to be 96kHz mono as a workaround for stereo being broken + * by that... + * + * They also have an issue with initial stream alignment that causes the + * channels to be swapped and out of phase, which is dealt with in quirks.= c. + */ +{ + USB_AUDIO_DEVICE(0x534d, 0x0021), + .driver_info =3D (unsigned long) &(const struct snd_usb_audio_quirk) { + .vendor_name =3D "MacroSilicon", + .product_name =3D "MS210x", + .ifnum =3D QUIRK_ANY_INTERFACE, + .type =3D QUIRK_COMPOSITE, + .data =3D &(const struct snd_usb_audio_quirk[]) { + { + .ifnum =3D 2, + .type =3D QUIRK_AUDIO_STANDARD_MIXER, + }, + { + .ifnum =3D 3, + .type =3D QUIRK_AUDIO_FIXED_ENDPOINT, + .data =3D &(const struct audioformat) { + .formats =3D SNDRV_PCM_FMTBIT_S16_LE, + .channels =3D 2, + .iface =3D 3, + .altsetting =3D 1, + .altset_idx =3D 1, + .attributes =3D 0, + .endpoint =3D 0x82, + .ep_attr =3D USB_ENDPOINT_XFER_ISOC | + USB_ENDPOINT_SYNC_ASYNC, + .rates =3D SNDRV_PCM_RATE_CONTINUOUS, + .rate_min =3D 48000, + .rate_max =3D 48000, + } + }, + { + .ifnum =3D -1 + } + } + } +}, + +/* * MacroSilicon MS2109 based HDMI capture cards * * These claim 96kHz 1ch in the descriptors, but are actually 48kHz 2ch. --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -1478,6 +1478,7 @@ void snd_usb_set_format_quirk(struct snd case USB_ID(0x041e, 0x3f19): /* E-Mu 0204 USB */ set_format_emu_quirk(subs, fmt); break; + case USB_ID(0x534d, 0x0021): /* MacroSilicon MS2100/MS2106 */ case USB_ID(0x534d, 0x2109): /* MacroSilicon MS2109 */ subs->stream_offset_adj =3D 2; break; @@ -1908,6 +1909,8 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_IGNORE_CTL_ERROR), DEVICE_FLG(0x413c, 0xa506, /* Dell AE515 sound bar */ QUIRK_FLAG_GET_SAMPLE_RATE), + DEVICE_FLG(0x534d, 0x0021, /* MacroSilicon MS2100/MS2106 */ + QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x534d, 0x2109, /* MacroSilicon MS2109 */ QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x1224, 0x2a25, /* Jieli Technology USB PHY 2.0 */ From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 991E6C43334 for ; Tue, 19 Jul 2022 12:46:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241379AbiGSMp6 (ORCPT ); Tue, 19 Jul 2022 08:45:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241863AbiGSMop (ORCPT ); Tue, 19 Jul 2022 08:44:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5396887F4A; Tue, 19 Jul 2022 05:17: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 E6CFB617DF; Tue, 19 Jul 2022 12:17:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C874BC341C6; Tue, 19 Jul 2022 12:17:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233042; bh=RErdYp/saWbXBtDS7TGY/5ALVxq4blsMtCQT7X3SQkc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RtN+zoX3GiUnJXHhDMMBqO18j0FY2jOywRh4AMnPLsLUWZb3Xai7S8p+qfli8Nyf8 HqgGhpJMmV0m3cvpuxF11zJ4eANNdJV/GH6pUKPg6kpq2aN1sT19lQkKJ+oc+F8yBW JGiSEtTapw6TN1FPbUZOMoKtSJmiaTdu2bM/QXJY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Egor Vorontsov , Takashi Iwai , Sasha Levin Subject: [PATCH 5.15 154/167] ALSA: usb-audio: Add quirk for Fiero SC-01 Date: Tue, 19 Jul 2022 13:54:46 +0200 Message-Id: <20220719114711.388636038@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Egor Vorontsov [ Upstream commit 4fb7c24f69c48fdc02ea7858dbd5a60ff08bf7e5 ] Fiero SC-01 is a USB sound card with two mono inputs and a single stereo output. The inputs are composed into a single stereo stream. The device uses a vendor-provided driver on Windows and does not work at all without it. The driver mostly provides ASIO functionality, but also alters the way the sound card is queried for sample rates and clocks. ALSA queries those failing with an EPIPE (same as Windows 10 does). Presumably, the vendor-provided driver does not query it at all, simply matching by VID:PID. Thus, I consider this a buggy firmware and adhere to a set of fixed endpoint quirks instead. The soundcard has an internal clock. Implicit feedback mode is required for the playback. I have updated my device to v1.1.0 from a Windows 10 VM using a vendor- provided binary prior to the development, hoping for it to just begin working. The device provides no obvious way to downgrade the firmware, and regardless, there's no binary available for v1.0.0 anyway. Thus, I will be getting another unit to extend the patch with support for that. Expected to be a simple copy-paste of the existing one, though. There were no previous reports of that device in context of Linux anywhere. Other issues have been reported though, but that's out of the scope. Signed-off-by: Egor Vorontsov Link: https://lore.kernel.org/r/20220627100041.2861494-1-sdoregor@sdore.me Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/usb/quirks-table.h | 68 ++++++++++++++++++++++++++++++++++++++++++= +++++ sound/usb/quirks.c | 2 + 2 files changed, 70 insertions(+) --- a/sound/usb/quirks-table.h +++ b/sound/usb/quirks-table.h @@ -4167,6 +4167,74 @@ YAMAHA_DEVICE(0x7010, "UB99"), } } }, +{ + /* + * Fiero SC-01 (firmware v1.1.0) + */ + USB_DEVICE(0x2b53, 0x0031), + .driver_info =3D (unsigned long) &(const struct snd_usb_audio_quirk) { + .vendor_name =3D "Fiero", + .product_name =3D "SC-01", + .ifnum =3D QUIRK_ANY_INTERFACE, + .type =3D QUIRK_COMPOSITE, + .data =3D &(const struct snd_usb_audio_quirk[]) { + { + .ifnum =3D 0, + .type =3D QUIRK_AUDIO_STANDARD_INTERFACE + }, + /* Playback */ + { + .ifnum =3D 1, + .type =3D QUIRK_AUDIO_FIXED_ENDPOINT, + .data =3D &(const struct audioformat) { + .formats =3D SNDRV_PCM_FMTBIT_S32_LE, + .channels =3D 2, + .fmt_bits =3D 24, + .iface =3D 1, + .altsetting =3D 1, + .altset_idx =3D 1, + .endpoint =3D 0x01, + .ep_attr =3D USB_ENDPOINT_XFER_ISOC | + USB_ENDPOINT_SYNC_ASYNC, + .rates =3D SNDRV_PCM_RATE_48000 | + SNDRV_PCM_RATE_96000, + .rate_min =3D 48000, + .rate_max =3D 96000, + .nr_rates =3D 2, + .rate_table =3D (unsigned int[]) { 48000, 96000 }, + .clock =3D 0x29 + } + }, + /* Capture */ + { + .ifnum =3D 2, + .type =3D QUIRK_AUDIO_FIXED_ENDPOINT, + .data =3D &(const struct audioformat) { + .formats =3D SNDRV_PCM_FMTBIT_S32_LE, + .channels =3D 2, + .fmt_bits =3D 24, + .iface =3D 2, + .altsetting =3D 1, + .altset_idx =3D 1, + .endpoint =3D 0x82, + .ep_attr =3D USB_ENDPOINT_XFER_ISOC | + USB_ENDPOINT_SYNC_ASYNC | + USB_ENDPOINT_USAGE_IMPLICIT_FB, + .rates =3D SNDRV_PCM_RATE_48000 | + SNDRV_PCM_RATE_96000, + .rate_min =3D 48000, + .rate_max =3D 96000, + .nr_rates =3D 2, + .rate_table =3D (unsigned int[]) { 48000, 96000 }, + .clock =3D 0x29 + } + }, + { + .ifnum =3D -1 + } + } + } +}, =20 #undef USB_DEVICE_VENDOR_SPEC #undef USB_AUDIO_DEVICE --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -1915,6 +1915,8 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x1224, 0x2a25, /* Jieli Technology USB PHY 2.0 */ QUIRK_FLAG_GET_SAMPLE_RATE), + DEVICE_FLG(0x2b53, 0x0031, /* Fiero SC-01 (firmware v1.1.0) */ + QUIRK_FLAG_GENERIC_IMPLICIT_FB), =20 /* Vendor matches */ VENDOR_FLG(0x045e, /* MS Lifecam */ From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57D60CCA481 for ; Tue, 19 Jul 2022 12:45:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238504AbiGSMpq (ORCPT ); Tue, 19 Jul 2022 08:45:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241680AbiGSMoV (ORCPT ); Tue, 19 Jul 2022 08:44:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EB8285FA9; Tue, 19 Jul 2022 05:17:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 42B68B81B84; Tue, 19 Jul 2022 12:17:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A23D0C341C6; Tue, 19 Jul 2022 12:17:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233045; bh=r+Pn/SmVZvoZW00fOdHXa1Z9ZhleyKI8tYjwvnl8F/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sSfq/b4Au0UdKl084HChoBi0/pu7aZUSofjpIN98OleU1jwOZmaoiTObM6zZYtcb2 lwI8jNQucQB1a9az1mcqMKOm57LMgfKnVx4ix+NNKrO1kFg8p8nCJ13tMc8DN3W8vj c27WCPIH1LIccibxNAzlrN2l5kYDJ/cjF5TdK3CY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Egor Vorontsov , Takashi Iwai , Sasha Levin Subject: [PATCH 5.15 155/167] ALSA: usb-audio: Add quirk for Fiero SC-01 (fw v1.0.0) Date: Tue, 19 Jul 2022 13:54:47 +0200 Message-Id: <20220719114711.504753713@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Egor Vorontsov [ Upstream commit 2307a0e1ca0b5c1337b37ac6302f96e017ebac3c ] The patch applies the same quirks used for SC-01 at firmware v1.1.0 to the ones running v1.0.0, with respect to hard-coded sample rates. I got two more units and successfully tested the patch series with both firmwares. The support is now complete (not accounting ASIO). Signed-off-by: Egor Vorontsov Link: https://lore.kernel.org/r/20220627100041.2861494-2-sdoregor@sdore.me Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- sound/usb/quirks-table.h | 132 ++++++++++++++++++++++++++++++++++++++++++= +++++ sound/usb/quirks.c | 4 + 2 files changed, 136 insertions(+) --- a/sound/usb/quirks-table.h +++ b/sound/usb/quirks-table.h @@ -4169,6 +4169,138 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { /* + * Fiero SC-01 (firmware v1.0.0 @ 48 kHz) + */ + USB_DEVICE(0x2b53, 0x0023), + .driver_info =3D (unsigned long) &(const struct snd_usb_audio_quirk) { + .vendor_name =3D "Fiero", + .product_name =3D "SC-01", + .ifnum =3D QUIRK_ANY_INTERFACE, + .type =3D QUIRK_COMPOSITE, + .data =3D &(const struct snd_usb_audio_quirk[]) { + { + .ifnum =3D 0, + .type =3D QUIRK_AUDIO_STANDARD_INTERFACE + }, + /* Playback */ + { + .ifnum =3D 1, + .type =3D QUIRK_AUDIO_FIXED_ENDPOINT, + .data =3D &(const struct audioformat) { + .formats =3D SNDRV_PCM_FMTBIT_S32_LE, + .channels =3D 2, + .fmt_bits =3D 24, + .iface =3D 1, + .altsetting =3D 1, + .altset_idx =3D 1, + .endpoint =3D 0x01, + .ep_attr =3D USB_ENDPOINT_XFER_ISOC | + USB_ENDPOINT_SYNC_ASYNC, + .rates =3D SNDRV_PCM_RATE_48000, + .rate_min =3D 48000, + .rate_max =3D 48000, + .nr_rates =3D 1, + .rate_table =3D (unsigned int[]) { 48000 }, + .clock =3D 0x29 + } + }, + /* Capture */ + { + .ifnum =3D 2, + .type =3D QUIRK_AUDIO_FIXED_ENDPOINT, + .data =3D &(const struct audioformat) { + .formats =3D SNDRV_PCM_FMTBIT_S32_LE, + .channels =3D 2, + .fmt_bits =3D 24, + .iface =3D 2, + .altsetting =3D 1, + .altset_idx =3D 1, + .endpoint =3D 0x82, + .ep_attr =3D USB_ENDPOINT_XFER_ISOC | + USB_ENDPOINT_SYNC_ASYNC | + USB_ENDPOINT_USAGE_IMPLICIT_FB, + .rates =3D SNDRV_PCM_RATE_48000, + .rate_min =3D 48000, + .rate_max =3D 48000, + .nr_rates =3D 1, + .rate_table =3D (unsigned int[]) { 48000 }, + .clock =3D 0x29 + } + }, + { + .ifnum =3D -1 + } + } + } +}, +{ + /* + * Fiero SC-01 (firmware v1.0.0 @ 96 kHz) + */ + USB_DEVICE(0x2b53, 0x0024), + .driver_info =3D (unsigned long) &(const struct snd_usb_audio_quirk) { + .vendor_name =3D "Fiero", + .product_name =3D "SC-01", + .ifnum =3D QUIRK_ANY_INTERFACE, + .type =3D QUIRK_COMPOSITE, + .data =3D &(const struct snd_usb_audio_quirk[]) { + { + .ifnum =3D 0, + .type =3D QUIRK_AUDIO_STANDARD_INTERFACE + }, + /* Playback */ + { + .ifnum =3D 1, + .type =3D QUIRK_AUDIO_FIXED_ENDPOINT, + .data =3D &(const struct audioformat) { + .formats =3D SNDRV_PCM_FMTBIT_S32_LE, + .channels =3D 2, + .fmt_bits =3D 24, + .iface =3D 1, + .altsetting =3D 1, + .altset_idx =3D 1, + .endpoint =3D 0x01, + .ep_attr =3D USB_ENDPOINT_XFER_ISOC | + USB_ENDPOINT_SYNC_ASYNC, + .rates =3D SNDRV_PCM_RATE_96000, + .rate_min =3D 96000, + .rate_max =3D 96000, + .nr_rates =3D 1, + .rate_table =3D (unsigned int[]) { 96000 }, + .clock =3D 0x29 + } + }, + /* Capture */ + { + .ifnum =3D 2, + .type =3D QUIRK_AUDIO_FIXED_ENDPOINT, + .data =3D &(const struct audioformat) { + .formats =3D SNDRV_PCM_FMTBIT_S32_LE, + .channels =3D 2, + .fmt_bits =3D 24, + .iface =3D 2, + .altsetting =3D 1, + .altset_idx =3D 1, + .endpoint =3D 0x82, + .ep_attr =3D USB_ENDPOINT_XFER_ISOC | + USB_ENDPOINT_SYNC_ASYNC | + USB_ENDPOINT_USAGE_IMPLICIT_FB, + .rates =3D SNDRV_PCM_RATE_96000, + .rate_min =3D 96000, + .rate_max =3D 96000, + .nr_rates =3D 1, + .rate_table =3D (unsigned int[]) { 96000 }, + .clock =3D 0x29 + } + }, + { + .ifnum =3D -1 + } + } + } +}, +{ + /* * Fiero SC-01 (firmware v1.1.0) */ USB_DEVICE(0x2b53, 0x0031), --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -1915,6 +1915,10 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x1224, 0x2a25, /* Jieli Technology USB PHY 2.0 */ QUIRK_FLAG_GET_SAMPLE_RATE), + DEVICE_FLG(0x2b53, 0x0023, /* Fiero SC-01 (firmware v1.0.0 @ 48 kHz) */ + QUIRK_FLAG_GENERIC_IMPLICIT_FB), + DEVICE_FLG(0x2b53, 0x0024, /* Fiero SC-01 (firmware v1.0.0 @ 96 kHz) */ + QUIRK_FLAG_GENERIC_IMPLICIT_FB), DEVICE_FLG(0x2b53, 0x0031, /* Fiero SC-01 (firmware v1.1.0) */ QUIRK_FLAG_GENERIC_IMPLICIT_FB), From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62E1DC433EF for ; Tue, 19 Jul 2022 12:46:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241476AbiGSMqC (ORCPT ); Tue, 19 Jul 2022 08:46:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241914AbiGSMot (ORCPT ); Tue, 19 Jul 2022 08:44:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCFC587F73; Tue, 19 Jul 2022 05:17:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9CE4C61746; Tue, 19 Jul 2022 12:17:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82444C341CA; Tue, 19 Jul 2022 12:17:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233047; bh=BmG0AIFw+eljF42VL9fIOkV9TDiDb49cHlNYb29j45k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W91Q1x3BaRhLru1GsQhVOWWi2c/UhcANbPxXGSWmpRhXGsaMNicrT4XixbVvuo+Rp IjM1CYO3BmzYx2s8Iid02tkynGwC7pHXnyXKzb1uPhFDME6qMGBgcwjyXIgvzncupe NX/OV2lqU2Xtccr4wWLRQ9DisLdMdEuchqWLrXEM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Egolf , Keith Busch , Chaitanya Kulkarni , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.15 156/167] nvme-pci: phison e16 has bogus namespace ids Date: Tue, 19 Jul 2022 13:54:48 +0200 Message-Id: <20220719114711.598252118@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Keith Busch [ Upstream commit 73029c9b23cf1213e5f54c2b59efce08665199e7 ] Add the quirk. Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D216049 Reported-by: Chris Egolf Signed-off-by: Keith Busch Reviewed-by: Chaitanya Kulkarni Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/nvme/host/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index c3db9f12dac3..d820131d39b2 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -3337,7 +3337,8 @@ static const struct pci_device_id nvme_id_table[] =3D= { NVME_QUIRK_DISABLE_WRITE_ZEROES| NVME_QUIRK_IGNORE_DEV_SUBNQN, }, { PCI_DEVICE(0x1987, 0x5016), /* Phison E16 */ - .driver_data =3D NVME_QUIRK_IGNORE_DEV_SUBNQN, }, + .driver_data =3D NVME_QUIRK_IGNORE_DEV_SUBNQN | + NVME_QUIRK_BOGUS_NID, }, { PCI_DEVICE(0x1b4b, 0x1092), /* Lexar 256 GB SSD */ .driver_data =3D NVME_QUIRK_NO_NS_DESC_LIST | NVME_QUIRK_IGNORE_DEV_SUBNQN, }, --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F1E8CCA486 for ; Tue, 19 Jul 2022 12:47:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239084AbiGSMrI (ORCPT ); Tue, 19 Jul 2022 08:47:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242013AbiGSMo7 (ORCPT ); Tue, 19 Jul 2022 08:44:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62C6A87C1A; Tue, 19 Jul 2022 05:17: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 035F7B81B82; Tue, 19 Jul 2022 12:17:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EFBEC341C6; Tue, 19 Jul 2022 12:17:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233050; bh=fHBYmqcIiLMomw61JKDjJgzcDQQWoa5ofC83PhIIq4k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZSIJTHUCpEMqPKTBqDs+lTiNSLEr9NnLVcSVNrlQg9n/0ONjaY85IEB6efW79witK ydzsUblNxHFAfG0LS3JmJGB8HbCgtCKmcZe4JjgeurdWpGYSQZ8whDTVuKUS1VmxV6 BmVAwPDGupboOO3/H+/vw9muAIk3/CLvzRsnItnA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Torvalds , Sasha Levin Subject: [PATCH 5.15 157/167] signal handling: dont use BUG_ON() for debugging Date: Tue, 19 Jul 2022 13:54:49 +0200 Message-Id: <20220719114711.690583853@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linus Torvalds [ Upstream commit a382f8fee42ca10c9bfce0d2352d4153f931f5dc ] These are indeed "should not happen" situations, but it turns out recent changes made the 'task_is_stopped_or_trace()' case trigger (fix for that exists, is pending more testing), and the BUG_ON() makes it unnecessarily hard to actually debug for no good reason. It's been that way for a long time, but let's make it clear: BUG_ON() is not good for debugging, and should never be used in situations where you could just say "this shouldn't happen, but we can continue". Use WARN_ON_ONCE() instead to make sure it gets logged, and then just continue running. Instead of making the system basically unusuable because you crashed the machine while potentially holding some very core locks (eg this function is commonly called while holding 'tasklist_lock' for writing). Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- kernel/signal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/signal.c b/kernel/signal.c index d831f0aec56e..c7dbb19219b9 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -2027,12 +2027,12 @@ bool do_notify_parent(struct task_struct *tsk, int = sig) bool autoreap =3D false; u64 utime, stime; =20 - BUG_ON(sig =3D=3D -1); + WARN_ON_ONCE(sig =3D=3D -1); =20 - /* do_notify_parent_cldstop should have been called instead. */ - BUG_ON(task_is_stopped_or_traced(tsk)); + /* do_notify_parent_cldstop should have been called instead. */ + WARN_ON_ONCE(task_is_stopped_or_traced(tsk)); =20 - BUG_ON(!tsk->ptrace && + WARN_ON_ONCE(!tsk->ptrace && (tsk->group_leader !=3D tsk || !thread_group_empty(tsk))); =20 /* Wake up all pidfd waiters */ --=20 2.35.1 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F0A7C43334 for ; Tue, 19 Jul 2022 12:45:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230040AbiGSMpy (ORCPT ); Tue, 19 Jul 2022 08:45:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241778AbiGSMof (ORCPT ); Tue, 19 Jul 2022 08:44: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 5DDE38721E; Tue, 19 Jul 2022 05:17: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 7C33561830; Tue, 19 Jul 2022 12:17:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47688C341C6; Tue, 19 Jul 2022 12:17:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233053; bh=ZHDS7axaqv3eoGXc0bA8B+TANT3b2ltotVfUt2qyR04=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cn/IanRQIYF4VsGr2VFkjIG34ll8BY4qzSmdD9tyuCVF2j3omuTraF9mAtFEglc/2 jVqhjGOt02or39RJ41mM+fzEDrGk8NwMpo1IYPZh/1KJD2fH56MOYw+Qu80qRI0Z4L lw/ohGpG7B95mObmUYoADf+a2Q6NryjQDYPohnGc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lucien Buchmann , Johan Hovold Subject: [PATCH 5.15 158/167] USB: serial: ftdi_sio: add Belimo device ids Date: Tue, 19 Jul 2022 13:54:50 +0200 Message-Id: <20220719114711.784220801@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lucien Buchmann commit 7c239a071d1f04b7137789810807b4108d475c72 upstream. Those two product ids are known. Signed-off-by: Lucien Buchmann Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/usb/serial/ftdi_sio.c | 3 +++ drivers/usb/serial/ftdi_sio_ids.h | 6 ++++++ 2 files changed, 9 insertions(+) --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -1023,6 +1023,9 @@ static const struct usb_device_id id_tab { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_DISPLAY_PID) }, { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_LITE_PID) }, { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_ANALOG_PID) }, + /* Belimo Automation devices */ + { USB_DEVICE(FTDI_VID, BELIMO_ZTH_PID) }, + { USB_DEVICE(FTDI_VID, BELIMO_ZIP_PID) }, /* ICP DAS I-756xU devices */ { USB_DEVICE(ICPDAS_VID, ICPDAS_I7560U_PID) }, { USB_DEVICE(ICPDAS_VID, ICPDAS_I7561U_PID) }, --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h @@ -1569,6 +1569,12 @@ #define CHETCO_SEASMART_ANALOG_PID 0xA5AF /* SeaSmart Analog Adapter */ =20 /* + * Belimo Automation + */ +#define BELIMO_ZTH_PID 0x8050 +#define BELIMO_ZIP_PID 0xC811 + +/* * Unjo AB */ #define UNJO_VID 0x22B7 From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E02A5C43334 for ; Tue, 19 Jul 2022 12:46:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241550AbiGSMqM (ORCPT ); Tue, 19 Jul 2022 08:46:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241798AbiGSMoi (ORCPT ); Tue, 19 Jul 2022 08:44:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17FA687348; Tue, 19 Jul 2022 05:17: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 AE6C9B81B13; Tue, 19 Jul 2022 12:17:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10B96C341C6; Tue, 19 Jul 2022 12:17:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233056; bh=rcwtNqc+GPYqJXpwkFe1nLuwgUVQoC9tmju2aIdG9LU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iAuu/Mfi+7OVrr23RUYyo3E+VhvvaUWmqg0LSWs9XX/n+j2Y0dc58EDu9HqMc9cZv dfc8H/Lodkuy8TsTmj0UvYxEORnh3CJ+y+yZDbvG1A03Bs9xD9rwYlQ04c3x2yDaj2 Wx7iPQI5Ay9VVJa6Edbre3/0QsnqWwF7mvjujI1s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linyu Yuan Subject: [PATCH 5.15 159/167] usb: typec: add missing uevent when partner support PD Date: Tue, 19 Jul 2022 13:54:51 +0200 Message-Id: <20220719114711.876486032@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linyu Yuan commit 6fb9e1d94789e8ee5a258a23bc588693f743fd6c upstream. System like Android allow user control power role from UI, it is possible to implement application base on typec uevent to refresh UI, but found there is chance that UI show different state from typec attribute file. In typec_set_pwr_opmode(), when partner support PD, there is no uevent send to user space which cause the problem. Fix it by sending uevent notification when change power mode to PD. Fixes: bdecb33af34f ("usb: typec: API for controlling USB Type-C Multiplexe= rs") Cc: stable@vger.kernel.org Signed-off-by: Linyu Yuan Link: https://lore.kernel.org/r/1656662934-10226-1-git-send-email-quic_liny= yuan@quicinc.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/usb/typec/class.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/usb/typec/class.c +++ b/drivers/usb/typec/class.c @@ -1718,6 +1718,7 @@ void typec_set_pwr_opmode(struct typec_p partner->usb_pd =3D 1; sysfs_notify(&partner_dev->kobj, NULL, "supports_usb_power_delivery"); + kobject_uevent(&partner_dev->kobj, KOBJ_CHANGE); } put_device(partner_dev); } From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01CA4C433EF for ; Tue, 19 Jul 2022 12:47:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241534AbiGSMr1 (ORCPT ); Tue, 19 Jul 2022 08:47:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241567AbiGSMp0 (ORCPT ); Tue, 19 Jul 2022 08:45:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 437C389E8D; Tue, 19 Jul 2022 05:18: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 1DBB661826; Tue, 19 Jul 2022 12:17:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5959C341D0; Tue, 19 Jul 2022 12:17:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233062; bh=2gp7DdC32qpng2GORGOCcMiwSXXYzxqNPUfp1HwzPBY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F5KyIUYsQGrFf5xGMpMvzeixgDmBdIhvSCuflI8bZFd0yPrNd4xj/bQK2DAhpWVK0 l/Hdp2Y1w8kujBeT0XqvK9A9vidfkEbv15QNHrS5ZcVOlF054/38pFwjmaczcNcU6c yYcNQcazLLtl2angb62mMdtvGsq2FHCzGd7HA9EM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thinh Nguyen Subject: [PATCH 5.15 160/167] usb: dwc3: gadget: Fix event pending check Date: Tue, 19 Jul 2022 13:54:52 +0200 Message-Id: <20220719114711.966066385@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thinh Nguyen commit 7441b273388b9a59d8387a03ffbbca9d5af6348c upstream. The DWC3_EVENT_PENDING flag is used to protect against invalid call to top-half interrupt handler, which can occur when there's a delay in software detection of the interrupt line deassertion. However, the clearing of this flag was done prior to unmasking the interrupt line, creating opportunity where the top-half handler can come. This breaks the serialization and creates a race between the top-half and bottom-half handler, resulting in losing synchronization between the controller and the driver when processing events. To fix this, make sure the clearing of the DWC3_EVENT_PENDING is done at the end of the bottom-half handler. Fixes: d325a1de49d6 ("usb: dwc3: gadget: Prevent losing events in event cac= he") Cc: stable@vger.kernel.org Signed-off-by: Thinh Nguyen Link: https://lore.kernel.org/r/8670aaf1cf52e7d1e6df2a827af2d77263b93b75.16= 56380429.git.Thinh.Nguyen@synopsys.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/usb/dwc3/gadget.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -4149,7 +4149,6 @@ static irqreturn_t dwc3_process_event_bu } =20 evt->count =3D 0; - evt->flags &=3D ~DWC3_EVENT_PENDING; ret =3D IRQ_HANDLED; =20 /* Unmask interrupt */ @@ -4162,6 +4161,9 @@ static irqreturn_t dwc3_process_event_bu dwc3_writel(dwc->regs, DWC3_DEV_IMOD(0), dwc->imod_interval); } =20 + /* Keep the clearing of DWC3_EVENT_PENDING at the end */ + evt->flags &=3D ~DWC3_EVENT_PENDING; + return ret; } From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 046F1C43334 for ; Tue, 19 Jul 2022 12:46:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238555AbiGSMqZ (ORCPT ); Tue, 19 Jul 2022 08:46:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241640AbiGSMpc (ORCPT ); Tue, 19 Jul 2022 08:45:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36FC48AB05; Tue, 19 Jul 2022 05:18: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 E6C9B61812; Tue, 19 Jul 2022 12:17:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C981DC341C6; Tue, 19 Jul 2022 12:17:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233065; bh=qMqGTcyTV1zKuzj9JV7oWfW0roSzsFgkuVU8ppy6/Sk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ji9g+fETgz9dvxm9hDevjvghDdE5hpDNjBnpphyy6xaDTagzQ2ejwciQKOzrDYVmf K5cQl+LeQX70GzPE1/z0AczzVRmutEgBYI3R7HRsbWLGN8DKh4tH2QJSEjX4MvQm2T Tv5gL+B/YBPWaZHmXZDke+4F7WN8fGNTG6jUCTwg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Marek Szyprowski , Krzysztof Kozlowski , Chanho Park Subject: [PATCH 5.15 161/167] tty: serial: samsung_tty: set dma burst_size to 1 Date: Tue, 19 Jul 2022 13:54:53 +0200 Message-Id: <20220719114712.069259484@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chanho Park commit f7e35e4bf1e8dc2c8cbd5e0955dc1bd58558dae0 upstream. The src_maxburst and dst_maxburst have been changed to 1 but the settings of the UCON register aren't changed yet. They should be changed as well according to the dmaengine slave config. Fixes: aa2f80e752c7 ("serial: samsung: fix maxburst parameter for DMA trans= actions") Cc: stable Cc: Marek Szyprowski Reviewed-by: Krzysztof Kozlowski Signed-off-by: Chanho Park Link: https://lore.kernel.org/r/20220627065113.139520-1-chanho61.park@samsu= ng.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/tty/serial/samsung_tty.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/drivers/tty/serial/samsung_tty.c +++ b/drivers/tty/serial/samsung_tty.c @@ -378,8 +378,7 @@ static void enable_tx_dma(struct s3c24xx /* Enable tx dma mode */ ucon =3D rd_regl(port, S3C2410_UCON); ucon &=3D ~(S3C64XX_UCON_TXBURST_MASK | S3C64XX_UCON_TXMODE_MASK); - ucon |=3D (dma_get_cache_alignment() >=3D 16) ? - S3C64XX_UCON_TXBURST_16 : S3C64XX_UCON_TXBURST_1; + ucon |=3D S3C64XX_UCON_TXBURST_1; ucon |=3D S3C64XX_UCON_TXMODE_DMA; wr_regl(port, S3C2410_UCON, ucon); =20 @@ -675,7 +674,7 @@ static void enable_rx_dma(struct s3c24xx S3C64XX_UCON_DMASUS_EN | S3C64XX_UCON_TIMEOUT_EN | S3C64XX_UCON_RXMODE_MASK); - ucon |=3D S3C64XX_UCON_RXBURST_16 | + ucon |=3D S3C64XX_UCON_RXBURST_1 | 0xf << S3C64XX_UCON_TIMEOUT_SHIFT | S3C64XX_UCON_EMPTYINT_EN | S3C64XX_UCON_TIMEOUT_EN | From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E576C433EF for ; Tue, 19 Jul 2022 12:46:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241420AbiGSMqu (ORCPT ); Tue, 19 Jul 2022 08:46:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239404AbiGSMpm (ORCPT ); Tue, 19 Jul 2022 08:45:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56F188AEC4; Tue, 19 Jul 2022 05:18: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 685D5B81B2C; Tue, 19 Jul 2022 12:17:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9EB7C341CB; Tue, 19 Jul 2022 12:17:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233068; bh=uWP81HW1luT6RyI7hLaOnr6CpVhKPPiiN3KFfDvXEsQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QRVecvAj5Q2KS5sIiNg3NcPJn3L+SGgWnLIny9g/5p8N7Z/NEBUQ2DbwPx0HtBzOV Q8o+RBZfr8fQMsRzT6XAOcRfIPXFIQesrHx8YoMripcsS7ut0oLMAVwg9TxDyX6MCN Q0Um0rExSpS/GFsiNSs/hmURdlIzyJ6irL9rCgPc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Yangxi Xiang Subject: [PATCH 5.15 162/167] vt: fix memory overlapping when deleting chars in the buffer Date: Tue, 19 Jul 2022 13:54:54 +0200 Message-Id: <20220719114712.152890944@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yangxi Xiang commit 39cdb68c64d84e71a4a717000b6e5de208ee60cc upstream. A memory overlapping copy occurs when deleting a long line. This memory overlapping copy can cause data corruption when scr_memcpyw is optimized to memcpy because memcpy does not ensure its behavior if the destination buffer overlaps with the source buffer. The line buffer is not always broken, because the memcpy utilizes the hardware acceleration, whose result is not deterministic. Fix this problem by using replacing the scr_memcpyw with scr_memmovew. Fixes: 81732c3b2fed ("tty vt: Fix line garbage in virtual console on comman= d line edition") Cc: stable Signed-off-by: Yangxi Xiang Link: https://lore.kernel.org/r/20220628093322.5688-1-xyangxi5@gmail.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/tty/vt/vt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -855,7 +855,7 @@ static void delete_char(struct vc_data * unsigned short *p =3D (unsigned short *) vc->vc_pos; =20 vc_uniscr_delete(vc, nr); - scr_memcpyw(p, p + nr, (vc->vc_cols - vc->state.x - nr) * 2); + scr_memmovew(p, p + nr, (vc->vc_cols - vc->state.x - nr) * 2); scr_memsetw(p + vc->vc_cols - vc->state.x - nr, vc->vc_video_erase_char, nr * 2); vc->vc_need_wrap =3D 0; From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10D30C433EF for ; Tue, 19 Jul 2022 12:46:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241716AbiGSMqx (ORCPT ); Tue, 19 Jul 2022 08:46:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241679AbiGSMpp (ORCPT ); Tue, 19 Jul 2022 08:45:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46A988AED4; Tue, 19 Jul 2022 05:18: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 9941061772; Tue, 19 Jul 2022 12:17:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BE47C341C6; Tue, 19 Jul 2022 12:17:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233070; bh=WIQF5vxdOZ2KF4yk/EEVlLDaVI0fgt+mpRIAAVOSRjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y7ssVWdy9qVZPk3+DkpHBQ7qUa/iqUSsUoPNP9LFdryTOUm9LPePJH9PlWYkgaT0j o7bzIXlXyFriiFfm0jIN1RI97eEs3klBNP1cHT3602pGZFeDqXTcb+Rjw29IgzJVP8 R+E/L7wsjzEqlcuRX1U7CISUdeDJNSwoZmgkPNAg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yi Yang , stable Subject: [PATCH 5.15 163/167] serial: 8250: fix return error code in serial8250_request_std_resource() Date: Tue, 19 Jul 2022 13:54:55 +0200 Message-Id: <20220719114712.236443969@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yi Yang commit 6e690d54cfa802f939cefbd2fa2c91bd0b8bd1b6 upstream. If port->mapbase =3D NULL in serial8250_request_std_resource() , it need return a error code instead of 0. If uart_set_info() fail to request new regions by serial8250_request_std_resource() but the return value of serial8250_request_std_resource() is 0, The system incorrectly considers that the resource application is successful and does not attempt to restore the old setting. A null pointer reference is triggered when the port resource is later invoked. Signed-off-by: Yi Yang Cc: stable Link: https://lore.kernel.org/r/20220628083515.64138-1-yiyang13@huawei.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/tty/serial/8250/8250_port.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -2982,8 +2982,10 @@ static int serial8250_request_std_resour case UPIO_MEM32BE: case UPIO_MEM16: case UPIO_MEM: - if (!port->mapbase) + if (!port->mapbase) { + ret =3D -EINVAL; break; + } =20 if (!request_mem_region(port->mapbase, size, "serial")) { ret =3D -EBUSY; From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64765C43334 for ; Tue, 19 Jul 2022 12:47:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241578AbiGSMrZ (ORCPT ); Tue, 19 Jul 2022 08:47:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241604AbiGSMp3 (ORCPT ); Tue, 19 Jul 2022 08:45:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8FDA89EAD; Tue, 19 Jul 2022 05:18:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F0DCAB81B10; Tue, 19 Jul 2022 12:17:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EEA4C341C6; Tue, 19 Jul 2022 12:17:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233073; bh=9KEe7eaXtbhE+qjwrjNHYCHBExGftwM90ceOhxQI7wc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lO98hW9h8gag0+VblyDSJY0Doj5b/80sh1QBoAzNmea7uTmiC6y9cOkVKmlBNmKjL oBhpza/5PgIy/SBd34/G1Z7vgn7aieGK1eTmvXXXtrSxNIJitoY1YCtXKGsl/sVp7x YGH19LhyVVfTd9+0agAKVnR3Wvdk3atag6KD9Gaw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 5.15 164/167] serial: stm32: Clear prev values before setting RTS delays Date: Tue, 19 Jul 2022 13:54:56 +0200 Message-Id: <20220719114712.324153913@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ilpo J=C3=A4rvinen commit 5c5f44e36217de5ead789ff25da71c31c2331c96 upstream. The code lacks clearing of previous DEAT/DEDT values. Thus, changing values on the fly results in garbage delays tending towards the maximum value as more and more bits are ORed together. (Leaving RS485 mode would have cleared the old values though). Fixes: 1bcda09d2910 ("serial: stm32: add support for RS485 hardware control= mode") Cc: stable Signed-off-by: Ilpo J=C3=A4rvinen Link: https://lore.kernel.org/r/20220627150753.34510-1-ilpo.jarvinen@linux.= intel.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/tty/serial/stm32-usart.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -71,6 +71,8 @@ static void stm32_usart_config_reg_rs485 *cr3 |=3D USART_CR3_DEM; over8 =3D *cr1 & USART_CR1_OVER8; =20 + *cr1 &=3D ~(USART_CR1_DEDT_MASK | USART_CR1_DEAT_MASK); + if (over8) rs485_deat_dedt =3D delay_ADE * baud * 8; else From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD1A9C43334 for ; Tue, 19 Jul 2022 12:46:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241577AbiGSMqR (ORCPT ); Tue, 19 Jul 2022 08:46:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237992AbiGSMpb (ORCPT ); Tue, 19 Jul 2022 08:45: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 B0E0489EBE; Tue, 19 Jul 2022 05:18: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 C0FA0B81B2E; Tue, 19 Jul 2022 12:17:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30334C341CB; Tue, 19 Jul 2022 12:17:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233076; bh=fiqJJ6hZ9FCITfrrBxYut31Mjo0ILzdqWz2Hzu6o0XY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0v9B/Whyk2RJ2huNYzmDIdw/4fv9V5N+iXa2FU5WbGRivVs7ux19ajbM85QWUj49p XZHmTCcdi8hcXHyP/oae8scBiIFzlrP3Pi4cPURCzLNwcqy0hyER2F8QqJwXbKBDac hp0UoTECmKRHsHx75QxphXgtvjjXfySZKEzgEiIs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Lukas Wunner , =?UTF-8?q?Nuno=20Gon=C3=A7alves?= , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 5.15 165/167] serial: pl011: UPSTAT_AUTORTS requires .throttle/unthrottle Date: Tue, 19 Jul 2022 13:54:57 +0200 Message-Id: <20220719114712.417632516@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ilpo J=C3=A4rvinen commit 211565b100993c90b53bf40851eacaefc830cfe0 upstream. The driver must provide throttle and unthrottle in uart_ops when it sets UPSTAT_AUTORTS. Add them using existing stop_rx & enable_interrupts functions. Fixes: 2a76fa283098 (serial: pl011: Adopt generic flag to store auto RTS st= atus) Cc: stable Cc: Lukas Wunner Reported-by: Nuno Gon=C3=A7alves Tested-by: Nuno Gon=C3=A7alves Signed-off-by: Ilpo J=C3=A4rvinen Link: https://lore.kernel.org/r/20220614075637.8558-1-ilpo.jarvinen@linux.i= ntel.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/tty/serial/amba-pl011.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -1372,6 +1372,15 @@ static void pl011_stop_rx(struct uart_po pl011_dma_rx_stop(uap); } =20 +static void pl011_throttle_rx(struct uart_port *port) +{ + unsigned long flags; + + spin_lock_irqsave(&port->lock, flags); + pl011_stop_rx(port); + spin_unlock_irqrestore(&port->lock, flags); +} + static void pl011_enable_ms(struct uart_port *port) { struct uart_amba_port *uap =3D @@ -1793,9 +1802,10 @@ static int pl011_allocate_irq(struct uar */ static void pl011_enable_interrupts(struct uart_amba_port *uap) { + unsigned long flags; unsigned int i; =20 - spin_lock_irq(&uap->port.lock); + spin_lock_irqsave(&uap->port.lock, flags); =20 /* Clear out any spuriously appearing RX interrupts */ pl011_write(UART011_RTIS | UART011_RXIS, uap, REG_ICR); @@ -1817,7 +1827,14 @@ static void pl011_enable_interrupts(stru if (!pl011_dma_rx_running(uap)) uap->im |=3D UART011_RXIM; pl011_write(uap->im, uap, REG_IMSC); - spin_unlock_irq(&uap->port.lock); + spin_unlock_irqrestore(&uap->port.lock, flags); +} + +static void pl011_unthrottle_rx(struct uart_port *port) +{ + struct uart_amba_port *uap =3D container_of(port, struct uart_amba_port, = port); + + pl011_enable_interrupts(uap); } =20 static int pl011_startup(struct uart_port *port) @@ -2245,6 +2262,8 @@ static const struct uart_ops amba_pl011_ .stop_tx =3D pl011_stop_tx, .start_tx =3D pl011_start_tx, .stop_rx =3D pl011_stop_rx, + .throttle =3D pl011_throttle_rx, + .unthrottle =3D pl011_unthrottle_rx, .enable_ms =3D pl011_enable_ms, .break_ctl =3D pl011_break_ctl, .startup =3D pl011_startup, From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81696C43334 for ; Tue, 19 Jul 2022 12:46:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241625AbiGSMqV (ORCPT ); Tue, 19 Jul 2022 08:46:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241629AbiGSMpb (ORCPT ); Tue, 19 Jul 2022 08:45: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 EB3A58AB04; Tue, 19 Jul 2022 05:18: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 3984061746; Tue, 19 Jul 2022 12:18:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B03FC341CE; Tue, 19 Jul 2022 12:17:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233079; bh=EzMbJ/79Gfem+Qi5Q99AdsP/OjJm7cgbuH+Ln4CrI84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W09wMSeJg9gK2fXsG88iE71N6C2mODGtqOqL7jkLxceD5hbf8l2ZMUp+wEwUqvziD Oa+4G3gaMC/y7m1c/Fy4/gR7KrX4giLWM4Dh7QOPN74HOfbDpH6VRAWaemJc3ciQQ2 H3DARJS1/18WUMd/9NAy0wQ5xg8o4Szul5xHh/bc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Tony Lindgren , Andy Shevchenko , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 5.15 166/167] serial: 8250: Fix PM usage_count for console handover Date: Tue, 19 Jul 2022 13:54:58 +0200 Message-Id: <20220719114712.518528832@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ilpo J=C3=A4rvinen commit f9b11229b79c0fb2100b5bb4628a101b1d37fbf6 upstream. When console is enabled, univ8250_console_setup() calls serial8250_console_setup() before .dev is set to uart_port. Therefore, it will not call pm_runtime_get_sync(). Later, when the actual driver is going to take over univ8250_console_exit() is called. As .dev is already set, serial8250_console_exit() makes pm_runtime_put_sync() call with usage count being zero triggering PM usage count warning (extra debug for univ8250_console_setup(), univ8250_console_exit(), and serial8250_register_ports()): [ 0.068987] univ8250_console_setup ttyS0 nodev [ 0.499670] printk: console [ttyS0] enabled [ 0.717955] printk: console [ttyS0] printing thread started [ 1.960163] serial8250_register_ports assigned dev for ttyS0 [ 1.976830] printk: console [ttyS0] disabled [ 1.976888] printk: console [ttyS0] printing thread stopped [ 1.977073] univ8250_console_exit ttyS0 usage:0 [ 1.977075] serial8250 serial8250: Runtime PM usage count underflow! [ 1.977429] dw-apb-uart.6: ttyS0 at MMIO 0x4010006000 (irq =3D 33, base_= baud =3D 115200) is a 16550A [ 1.977812] univ8250_console_setup ttyS0 usage:2 [ 1.978167] printk: console [ttyS0] printing thread started [ 1.978203] printk: console [ttyS0] enabled To fix the issue, call pm_runtime_get_sync() in serial8250_register_ports() as soon as .dev is set for an uart_port if it has console enabled. This problem became apparent only recently because 82586a721595 ("PM: runtime: Avoid device usage count underflows") added the warning printout. I confirmed this problem also occurs with v5.18 (w/o the warning printout, obviously). Fixes: bedb404e91bb ("serial: 8250_port: Don't use power management for ker= nel console") Cc: stable Tested-by: Tony Lindgren Reviewed-by: Andy Shevchenko Reviewed-by: Tony Lindgren Signed-off-by: Ilpo J=C3=A4rvinen Link: https://lore.kernel.org/r/b4f428e9-491f-daf2-2232-819928dc276e@linux.= intel.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- drivers/tty/serial/8250/8250_core.c | 4 ++++ drivers/tty/serial/serial_core.c | 5 ----- include/linux/serial_core.h | 5 +++++ 3 files changed, 9 insertions(+), 5 deletions(-) --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -561,6 +562,9 @@ serial8250_register_ports(struct uart_dr =20 up->port.dev =3D dev; =20 + if (uart_console_enabled(&up->port)) + pm_runtime_get_sync(up->port.dev); + serial8250_apply_quirks(up); uart_add_one_port(drv, &up->port); } --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -1912,11 +1912,6 @@ static int uart_proc_show(struct seq_fil } #endif =20 -static inline bool uart_console_enabled(struct uart_port *port) -{ - return uart_console(port) && (port->cons->flags & CON_ENABLED); -} - static void uart_port_spin_lock_init(struct uart_port *port) { spin_lock_init(&port->lock); --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -388,6 +388,11 @@ static const bool earlycon_acpi_spcr_ena static inline int setup_earlycon(char *buf) { return 0; } #endif =20 +static inline bool uart_console_enabled(struct uart_port *port) +{ + return uart_console(port) && (port->cons->flags & CON_ENABLED); +} + struct uart_port *uart_get_console(struct uart_port *ports, int nr, struct console *c); int uart_parse_earlycon(char *p, unsigned char *iotype, resource_size_t *a= ddr, From nobody Sat Apr 18 04:19:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5F92CCA481 for ; Tue, 19 Jul 2022 12:47:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241653AbiGSMrm (ORCPT ); Tue, 19 Jul 2022 08:47:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241701AbiGSMqn (ORCPT ); Tue, 19 Jul 2022 08:46:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDB188AB02; Tue, 19 Jul 2022 05:18:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2C3E06182A; Tue, 19 Jul 2022 12:18:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBF2FC341CA; Tue, 19 Jul 2022 12:18:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233082; bh=B5R6E+ddq8m5/lQLkLjA5+soKj5kmq3p6rjJ4fQbuHU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x/PweP/JoFVLgoeBmOhS744n19CQIjgrti/wD+kzCJTup5mckjpH6yLkoYQOd1WCl ID7CSOGyEbNLa5P5IYLWMCfQ+yamHp+Aal6/dRr+IH5axDUxA2ylYxApmYiit00R89 01OvUzrjxrkq7PibKtjjLy9+wiL2MR5x//y5PhYM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juergen Gross , Borislav Petkov Subject: [PATCH 5.15 167/167] x86/pat: Fix x86_has_pat_wp() Date: Tue, 19 Jul 2022 13:54:59 +0200 Message-Id: <20220719114712.619651806@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Juergen Gross commit 230ec83d4299b30c51a1c133b4f2a669972cc08a upstream. x86_has_pat_wp() is using a wrong test, as it relies on the normal PAT configuration used by the kernel. In case the PAT MSR has been setup by another entity (e.g. Xen hypervisor) it might return false even if the PAT configuration is allowing WP mappings. This due to the fact that when running as Xen PV guest the PAT MSR is setup by the hypervisor and cannot be changed by the guest. This results in the WP related entry to be at a different position when running as Xen PV guest compared to the bare metal or fully virtualized case. The correct way to test for WP support is: 1. Get the PTE protection bits needed to select WP mode by reading __cachemode2pte_tbl[_PAGE_CACHE_MODE_WP] (depending on the PAT MSR setting this might return protection bits for a stronger mode, e.g. UC-) 2. Translate those bits back into the real cache mode selected by those PTE bits by reading __pte2cachemode_tbl[__pte2cm_idx(prot)] 3. Test for the cache mode to be _PAGE_CACHE_MODE_WP Fixes: f88a68facd9a ("x86/mm: Extend early_memremap() support with addition= al attrs") Signed-off-by: Juergen Gross Signed-off-by: Borislav Petkov Cc: # 4.14 Link: https://lore.kernel.org/r/20220503132207.17234-1-jgross@suse.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Sudip Mukherjee --- arch/x86/mm/init.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c @@ -78,10 +78,20 @@ static uint8_t __pte2cachemode_tbl[8] =3D [__pte2cm_idx(_PAGE_PWT | _PAGE_PCD | _PAGE_PAT)] =3D _PAGE_CACHE_MODE_UC, }; =20 -/* Check that the write-protect PAT entry is set for write-protect */ +/* + * Check that the write-protect PAT entry is set for write-protect. + * To do this without making assumptions how PAT has been set up (Xen has + * another layout than the kernel), translate the _PAGE_CACHE_MODE_WP cache + * mode via the __cachemode2pte_tbl[] into protection bits (those protecti= on + * bits will select a cache mode of WP or better), and then translate the + * protection bits back into the cache mode using __pte2cm_idx() and the + * __pte2cachemode_tbl[] array. This will return the really used cache mod= e. + */ bool x86_has_pat_wp(void) { - return __pte2cachemode_tbl[_PAGE_CACHE_MODE_WP] =3D=3D _PAGE_CACHE_MODE_W= P; + uint16_t prot =3D __cachemode2pte_tbl[_PAGE_CACHE_MODE_WP]; + + return __pte2cachemode_tbl[__pte2cm_idx(prot)] =3D=3D _PAGE_CACHE_MODE_WP; } =20 enum page_cache_mode pgprot2cachemode(pgprot_t pgprot)