From nobody Sat Apr 18 04:19:29 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 71367C433EF for ; Tue, 19 Jul 2022 12:02:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237997AbiGSMCW (ORCPT ); Tue, 19 Jul 2022 08:02:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237846AbiGSMBh (ORCPT ); Tue, 19 Jul 2022 08:01:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2822746DAC; Tue, 19 Jul 2022 04:58:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9A184616BD; Tue, 19 Jul 2022 11:58:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67C7BC341CB; Tue, 19 Jul 2022 11:58:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231921; bh=jPrV2ssqpgYv8NXMoyxLN/kSPRHxf39gNtUiHpl+A7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fkoAIrZUSX0Ecf5Tc6HWS/5B+oCCdFEgaKSlsijrlh/Ncj3gQbp6dZNSjzwTVsphb zYzUDn9mvZSmwacTX0ut7ypJFCiE2RtaXBTaUkjJqc3L2djGgu2BrRuN53PeGASAhW oHikSfrIZKpWWMcnhyb0gjzuxI3G00AvWIrEBglQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meng Tang , Takashi Iwai Subject: [PATCH 4.14 01/43] ALSA: hda - Add fixup for Dell Latitidue E5430 Date: Tue, 19 Jul 2022 13:53:32 +0200 Message-Id: <20220719114522.218198606@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 @@ -6480,6 +6480,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_= V5_PINS), SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BO= OK), 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:29 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 AEF88C43334 for ; Tue, 19 Jul 2022 11:58:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237673AbiGSL6u (ORCPT ); Tue, 19 Jul 2022 07:58:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237674AbiGSL6J (ORCPT ); Tue, 19 Jul 2022 07:58: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 7733145F7A; Tue, 19 Jul 2022 04:57: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 8ADA3B81B2B; Tue, 19 Jul 2022 11:57:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB64DC341C6; Tue, 19 Jul 2022 11:57:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231823; bh=y2MUa4hYjd4kfO9nVvx/5IKEi7k5fS8Un8XECkhEGUk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EHkaVWn35k7Mg6f6uZ+1eoiKejvdxLNLSNe31o3ofjfabO180USeaE34nxt8A81Ep MP5g9kBeBfwOsvDqN9giAvbopZsS0nBdZyNsnHKUUBQXRET4+AjntxddXtG1dM0GoO s8Hbc4VJqNfc05qkb1CXBn9ohD+2y7EzpiGG7nk8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meng Tang , Takashi Iwai Subject: [PATCH 4.14 02/43] ALSA: hda/conexant: Apply quirk for another HP ProDesk 600 G3 model Date: Tue, 19 Jul 2022 13:53:33 +0200 Message-Id: <20220719114522.300084491@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 @@ -955,6 +955,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:29 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 97490C433EF for ; Tue, 19 Jul 2022 11:59:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237772AbiGSL7w (ORCPT ); Tue, 19 Jul 2022 07:59:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237793AbiGSL7S (ORCPT ); Tue, 19 Jul 2022 07:59:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 845C645045; Tue, 19 Jul 2022 04:57: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 0BFBB61614; Tue, 19 Jul 2022 11:57:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFA0BC36AE2; Tue, 19 Jul 2022 11:57:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231855; bh=5K400RCghF5zqReCilMHPXz2UVxcHIGAjqGAIynvirY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YZ6grASJJRBVye4xz+IuemrDalGOCwRYeqYvr7xV+gXcNVC5641CGQisciSRWA3Ke 3Y0J3i3hzltqGjIV5+c+yaXGcMd2JN+O2tUlyxRcgHyqVfMU6HGFSKhVbKqw2FmJt9 7nfT0Ud0SKQqZPy7aEUPE7gfRcqmnxfhyAE4QHyM= 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 4.14 03/43] xen/netback: avoid entering xenvif_rx_next_skb() with an empty rx queue Date: Tue, 19 Jul 2022 13:53:34 +0200 Message-Id: <20220719114522.395925562@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 @@ -482,6 +482,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:29 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 6F253C43334 for ; Tue, 19 Jul 2022 12:01:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237786AbiGSMBY (ORCPT ); Tue, 19 Jul 2022 08:01:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237776AbiGSMAn (ORCPT ); Tue, 19 Jul 2022 08:00:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70DF742AFF; Tue, 19 Jul 2022 04:58:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 50F31B81B37; Tue, 19 Jul 2022 11:58:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEEA1C341C6; Tue, 19 Jul 2022 11:58:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231887; bh=bOsNpp6N3Df+FDWvLk3adxnKLC0ehHvYO0Dvha6IROI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kBxEaEOrP76so6gezDezS33HC8BJBtU9T9SX5Ymk5gzRDy9UfY0lanwtwAlCiafYx f0jrTnwooh4rKHyWpO1tPSy3EvPoRaiATQ8Dv9o4mgw622Z1Cza+Rq1ZOvl2uvpCwA 7mREuid6tarFYDX2XECBkUqWWtXzVBF/K4TEBxLk= 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 4.14 04/43] net: sock: tracing: Fix sock_exceed_buf_limit not to dereference stale pointer Date: Tue, 19 Jul 2022 13:53:35 +0200 Message-Id: <20220719114522.481594231@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 @@ -38,7 +38,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) @@ -46,7 +46,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 prot->sysctl_rmem[0]; __entry->rmem_alloc =3D atomic_read(&sk->sk_rmem_alloc); From nobody Sat Apr 18 04:19:29 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 DBF84C43334 for ; Tue, 19 Jul 2022 12:01:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237948AbiGSMBu (ORCPT ); Tue, 19 Jul 2022 08:01:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237759AbiGSMBR (ORCPT ); Tue, 19 Jul 2022 08:01:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2F5F45F5C; Tue, 19 Jul 2022 04:58:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9182EB81A2E; Tue, 19 Jul 2022 11:58:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06790C341CB; Tue, 19 Jul 2022 11:58:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231904; bh=TU9v5a2oWC0O5pMZvZGTI08WLnI0FifRCJYCMF7RG18=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kjz+HMm8RqatOybJukJhTs8fD5goHwGm8iaZNKcSk0gVqwZ6KfvQsPH9ep5wHgQxZ C6oANVsazJzklNqWu60hNzLz8ACIVQfY4h9W99bdHBQWVxyIify6XcuoCO0ed+QWYk 6a47T+W1PtDGmFp3wFzCzJzF1xq0vN9XDG4EdTY0= 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 4.14 05/43] ARM: 9213/1: Print message about disabled Spectre workarounds only once Date: Tue, 19 Jul 2022 13:53:36 +0200 Message-Id: <20220719114522.562593265@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 @@ -110,8 +110,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:29 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 629DEC433EF for ; Tue, 19 Jul 2022 12:01:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237956AbiGSMBz (ORCPT ); Tue, 19 Jul 2022 08:01:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237817AbiGSMBS (ORCPT ); Tue, 19 Jul 2022 08:01:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 261434A803; Tue, 19 Jul 2022 04:58:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 98F3EB81B2C; Tue, 19 Jul 2022 11:58:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3E66C341C6; Tue, 19 Jul 2022 11:58:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231907; bh=p1p6gOChjy5Orh7Wm6A8qEeo5ehxKGLyGDSGixMUTL4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x7B0QDazKip98YSbDKhmLA0m2D3WuNUEBWTL+s1Q6MfKf52KEtHDm4t2qO2bgFf+s x+rRvzKr9Z7ShPcEzOlNzZxYVHbu+65by+0U2RAGZrAYVJeAU3bmBIoB1aNPCRdYbM rNqotlX+WDjzRhmBwrlu4fguiqh1V0pmFgGrWpmU= 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 4.14 06/43] ARM: 9214/1: alignment: advance IT state after emulating Thumb instruction Date: Tue, 19 Jul 2022 13:53:37 +0200 Message-Id: <20220719114522.649656788@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 @@ -167,5 +167,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 @@ -936,6 +936,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 @@ -22,6 +22,7 @@ #include #include #include +#include #include =20 void __init arm_probes_decode_init(void); @@ -43,31 +44,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:29 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 187CEC433EF for ; Tue, 19 Jul 2022 12:02:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237862AbiGSMCF (ORCPT ); Tue, 19 Jul 2022 08:02:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237891AbiGSMBU (ORCPT ); Tue, 19 Jul 2022 08:01:20 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4674045F51; Tue, 19 Jul 2022 04:58:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id DBB9ECE1BDE; Tue, 19 Jul 2022 11:58:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C03C4C341C6; Tue, 19 Jul 2022 11:58:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231910; bh=YppTL7lZyK/8Xub0dvfH2aOxcuSTkXtqCNfpV++wGP0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N9uuSSM8LjuRnRGbHBxm7WR51BZl5MDOCyG1vyrF2cJlMME0e/4+ZrJOm5YLoUGAy 0wjgNCW+Dn52PHKrLAyPonGqlYwRR3sbCdYjE6v+6SrlpGpSO1yBhTKyVMSGO8ofDI UCRu/OlnQZiNlrNYLPvwSmat03j6tO3j09MsUOMs= 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 4.14 07/43] cgroup: Use separate src/dst nodes when preloading css_sets for migration Date: Tue, 19 Jul 2022 13:53:38 +0200 Message-Id: <20220719114522.727899896@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 @@ -235,7 +235,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 @@ -647,7 +647,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 @@ -1113,7 +1114,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 @@ -2399,21 +2401,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 @@ -2455,7 +2463,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); @@ -2466,7 +2474,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 /** @@ -2491,7 +2499,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; @@ -2510,7 +2518,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; @@ -2518,8 +2526,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); @@ -2753,7 +2761,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:29 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 56267C433EF for ; Tue, 19 Jul 2022 12:02:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237978AbiGSMCK (ORCPT ); Tue, 19 Jul 2022 08:02:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237861AbiGSMBV (ORCPT ); Tue, 19 Jul 2022 08:01:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2CF446D97; Tue, 19 Jul 2022 04:58: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 70AEAB81A2E; Tue, 19 Jul 2022 11:58:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D29A1C341C6; Tue, 19 Jul 2022 11:58:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231913; bh=n0mhtTbRmKMrtDsxbt0+8JC74G0b+EOPSqVSehfbq3U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fH9THlhCxG37iDr4iMEXgvHHjimas5UlWzSrynFrTUJAqHKrWi8qPjKUJCagej/Y5 NSQT7lqq79DYajuuIR6eS3kT5tvKDiDJk+RN514B9w9jtGS2tKqE6IKWrQVkCMUPqW x535AycSkUqmhsfM7s+cuCJQOPqkwJ4PEGncNAk0= 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 4.14 08/43] nilfs2: fix incorrect masking of permission flags for symlinks Date: Tue, 19 Jul 2022 13:53:39 +0200 Message-Id: <20220719114522.795353601@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- fs/nilfs2/nilfs.h | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/nilfs2/nilfs.h +++ b/fs/nilfs2/nilfs.h @@ -212,6 +212,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:29 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 10E12CCA47F for ; Tue, 19 Jul 2022 12:02:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237377AbiGSMCR (ORCPT ); Tue, 19 Jul 2022 08:02:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237868AbiGSMBd (ORCPT ); Tue, 19 Jul 2022 08:01:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D82A44A80F; Tue, 19 Jul 2022 04:58: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 614DCB81A2E; Tue, 19 Jul 2022 11:58:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4CC6C341CA; Tue, 19 Jul 2022 11:58:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231916; bh=VkbUFaDmG9Xa9DmLLAlbDfm/hVHUrMmPVbAO0A7Ct6M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lfIAeuZyKJ9Uzc/IRXGjSegS67f9Om2Y75St7WaDkV7axfmbKoxkDRO4G60LGEfi8 kITgKFcZplfElbmUnhYelrMm0OaRK3wQFfvuupiJPs9s4sXJRubi2smY5BE54QqOV+ B0N7ldXzzA19DutXToY+j3sdT7ZFUZZxgBY4e+uk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Doug Berger , Florian Fainelli , Jakub Kicinski Subject: [PATCH 4.14 09/43] net: dsa: bcm_sf2: force pause link settings Date: Tue, 19 Jul 2022 13:53:40 +0200 Message-Id: <20220719114522.863731509@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Doug Berger commit 7c97bc0128b2eecc703106112679a69d446d1a12 upstream. The pause settings reported by the PHY should also be applied to the GMII p= ort status override otherwise the switch will not generate pause frames towards= the link partner despite the advertisement saying otherwise. Fixes: 246d7f773c13 ("net: dsa: add Broadcom SF2 switch driver") Signed-off-by: Doug Berger Signed-off-by: Florian Fainelli Link: https://lore.kernel.org/r/20220623030204.1966851-1-f.fainelli@gmail.c= om Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- drivers/net/dsa/bcm_sf2.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c @@ -625,7 +625,9 @@ static void bcm_sf2_sw_adjust_link(struc struct bcm_sf2_priv *priv =3D bcm_sf2_to_priv(ds); struct ethtool_eee *p =3D &priv->port_sts[port].eee; u32 id_mode_dis =3D 0, port_mode; + u16 lcl_adv =3D 0, rmt_adv =3D 0; const char *str =3D NULL; + u8 flowctrl =3D 0; u32 reg, offset; =20 if (priv->type =3D=3D BCM7445_DEVICE_ID) @@ -697,10 +699,27 @@ force_link: break; } =20 + if (phydev->duplex =3D=3D DUPLEX_FULL && + phydev->autoneg =3D=3D AUTONEG_ENABLE) { + if (phydev->pause) + rmt_adv =3D LPA_PAUSE_CAP; + if (phydev->asym_pause) + rmt_adv |=3D LPA_PAUSE_ASYM; + if (phydev->advertising & ADVERTISED_Pause) + lcl_adv =3D ADVERTISE_PAUSE_CAP; + if (phydev->advertising & ADVERTISED_Asym_Pause) + lcl_adv |=3D ADVERTISE_PAUSE_ASYM; + flowctrl =3D mii_resolve_flowctrl_fdx(lcl_adv, rmt_adv); + } + if (phydev->link) reg |=3D LINK_STS; if (phydev->duplex =3D=3D DUPLEX_FULL) reg |=3D DUPLX_MODE; + if (flowctrl & FLOW_CTRL_TX) + reg |=3D TXFLOW_CNTL; + if (flowctrl & FLOW_CTRL_RX) + reg |=3D RXFLOW_CNTL; =20 core_writel(priv, reg, offset); From nobody Sat Apr 18 04:19:29 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 0F330C43334 for ; Tue, 19 Jul 2022 12:02:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237930AbiGSMCV (ORCPT ); Tue, 19 Jul 2022 08:02:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237920AbiGSMBe (ORCPT ); Tue, 19 Jul 2022 08:01:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 494064331A; Tue, 19 Jul 2022 04:58: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 BEDAA61640; Tue, 19 Jul 2022 11:58:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DC96C341CA; Tue, 19 Jul 2022 11:58:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231918; bh=yO7cXLAxMONxPcse2MF3SOWUyJi9k0jjmONBy+J6g8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f9sH05ZnIcALOeZpweIeq3wBfQH677LvddXuvqx+ZhubMVQVfnEYcGTgvqj2aJycJ rxAnS7mjtNvEmlAB3gE4r5vWQCGDlz0RzsFshrjyCUvoRvk/OzwFAQAna9ueC6qXWt RuWS3XYvpuD30lUxkXaKSLvmkW3B6lH4oKX47/wc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathias Nyman , Sudip Mukherjee Subject: [PATCH 4.14 10/43] xhci: bail out early if driver cant accress host in resume Date: Tue, 19 Jul 2022 13:53:41 +0200 Message-Id: <20220719114522.949172508@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Mathias Nyman commit 72ae194704da212e2ec312ab182a96799d070755 upstream. Bail out early if the xHC host needs to be reset at resume but driver can't access xHC PCI registers. If xhci driver already fails to reset the controller then there is no point in attempting to free, re-initialize, re-allocate and re-start the host. If failure to access the host is detected later, failing the resume, xhci interrupts will be double freed when remove is called. Signed-off-by: Mathias Nyman Link: https://lore.kernel.org/r/20200312144517.1593-2-mathias.nyman@linux.i= ntel.com Signed-off-by: Greg Kroah-Hartman [sudip: adjust context] Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- drivers/usb/host/xhci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -1111,8 +1111,10 @@ int xhci_resume(struct xhci_hcd *xhci, b =20 xhci_dbg(xhci, "Stop HCD\n"); xhci_halt(xhci); - xhci_reset(xhci); + retval =3D xhci_reset(xhci); spin_unlock_irq(&xhci->lock); + if (retval) + return retval; xhci_cleanup_msix(xhci); =20 xhci_dbg(xhci, "// Disabling event ring interrupts\n"); From nobody Sat Apr 18 04:19:29 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 4A7E2C43334 for ; Tue, 19 Jul 2022 11:58:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237705AbiGSL6z (ORCPT ); Tue, 19 Jul 2022 07:58:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237530AbiGSL6K (ORCPT ); Tue, 19 Jul 2022 07:58:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 864EE4333B; Tue, 19 Jul 2022 04:57:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D1CC5615AC; Tue, 19 Jul 2022 11:57:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2AA3C341C6; Tue, 19 Jul 2022 11:57:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231826; bh=Ngq6XT5KILSGZYCIKyZdb2wfHQ37stdoyQM51xzmYZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zg8xMDGZfX6vkIj6Ez3KURf1IjVuXHph8Lq9GBkBX/zXWgshdedYF1T9EHnK5KgLi MM8bHoepjUPBl5CA2F3/yqQurqoP1IXzA1A9AqWPiMFovDl4Bj3rnmLy5dwKJrWIc5 WOBOvr//1lbXwix/8JejgD7kk8eBOhVQW0BPYwyY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Shtylyov , Pavan Kondeti , Mathias Nyman , Sudip Mukherjee Subject: [PATCH 4.14 11/43] xhci: make xhci_handshake timeout for xhci_reset() adjustable Date: Tue, 19 Jul 2022 13:53:42 +0200 Message-Id: <20220719114523.024157797@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Mathias Nyman commit 14073ce951b5919da450022c050772902f24f054 upstream. xhci_reset() timeout was increased from 250ms to 10 seconds in order to give Renesas 720201 xHC enough time to get ready in probe. xhci_reset() is called with interrupts disabled in other places, and waiting for 10 seconds there is not acceptable. Add a timeout parameter to xhci_reset(), and adjust it back to 250ms when called from xhci_stop() or xhci_shutdown() where interrupts are disabled, and successful reset isn't that critical. This solves issues when deactivating host mode on platforms like SM8450. For now don't change the timeout if xHC is reset in xhci_resume(). No issues are reported for it, and we need the reset to succeed. Locking around that reset needs to be revisited later. Additionally change the signed integer timeout parameter in xhci_handshake() to a u64 to match the timeout value we pass to readl_poll_timeout_atomic() Fixes: 22ceac191211 ("xhci: Increase reset timeout for Renesas 720201 host.= ") Cc: stable@vger.kernel.org Reported-by: Sergey Shtylyov Reported-by: Pavan Kondeti Tested-by: Pavan Kondeti Signed-off-by: Mathias Nyman Link: https://lore.kernel.org/r/20220303110903.1662404-2-mathias.nyman@linu= x.intel.com Signed-off-by: Greg Kroah-Hartman [sudip: adjust context] Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- drivers/usb/host/xhci-hub.c | 2 +- drivers/usb/host/xhci-mem.c | 2 +- drivers/usb/host/xhci.c | 20 +++++++++----------- drivers/usb/host/xhci.h | 7 +++++-- 4 files changed, 16 insertions(+), 15 deletions(-) --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c @@ -683,7 +683,7 @@ static int xhci_exit_test_mode(struct xh } pm_runtime_allow(xhci_to_hcd(xhci)->self.controller); xhci->test_mode =3D 0; - return xhci_reset(xhci); + return xhci_reset(xhci, XHCI_RESET_SHORT_USEC); } =20 void xhci_set_link_state(struct xhci_hcd *xhci, __le32 __iomem **port_arra= y, --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -2574,7 +2574,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, =20 fail: xhci_halt(xhci); - xhci_reset(xhci); + xhci_reset(xhci, XHCI_RESET_SHORT_USEC); xhci_mem_cleanup(xhci); return -ENOMEM; } --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -76,7 +76,7 @@ static bool td_on_ring(struct xhci_td *t * handshake done). There are two failure modes: "usec" have passed (maj= or * hardware flakeout), or the register reads as all-ones (hardware removed= ). */ -int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, int usec) +int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, u64 timeout_us) { u32 result; int ret; @@ -84,7 +84,7 @@ int xhci_handshake(void __iomem *ptr, u3 ret =3D readl_poll_timeout_atomic(ptr, result, (result & mask) =3D=3D done || result =3D=3D U32_MAX, - 1, usec); + 1, timeout_us); if (result =3D=3D U32_MAX) /* card removed */ return -ENODEV; =20 @@ -173,7 +173,7 @@ int xhci_start(struct xhci_hcd *xhci) * Transactions will be terminated immediately, and operational registers * will be set to their defaults. */ -int xhci_reset(struct xhci_hcd *xhci) +int xhci_reset(struct xhci_hcd *xhci, u64 timeout_us) { u32 command; u32 state; @@ -206,8 +206,7 @@ int xhci_reset(struct xhci_hcd *xhci) if (xhci->quirks & XHCI_INTEL_HOST) udelay(1000); =20 - ret =3D xhci_handshake(&xhci->op_regs->command, - CMD_RESET, 0, 10 * 1000 * 1000); + ret =3D xhci_handshake(&xhci->op_regs->command, CMD_RESET, 0, timeout_us); if (ret) return ret; =20 @@ -220,8 +219,7 @@ int xhci_reset(struct xhci_hcd *xhci) * xHCI cannot write to any doorbells or operational registers other * than status until the "Controller Not Ready" flag is cleared. */ - ret =3D xhci_handshake(&xhci->op_regs->status, - STS_CNR, 0, 10 * 1000 * 1000); + ret =3D xhci_handshake(&xhci->op_regs->status, STS_CNR, 0, timeout_us); =20 for (i =3D 0; i < 2; i++) { xhci->bus_state[i].port_c_suspend =3D 0; @@ -675,7 +673,7 @@ static void xhci_stop(struct usb_hcd *hc xhci->xhc_state |=3D XHCI_STATE_HALTED; xhci->cmd_ring_state =3D CMD_RING_STATE_STOPPED; xhci_halt(xhci); - xhci_reset(xhci); + xhci_reset(xhci, XHCI_RESET_SHORT_USEC); spin_unlock_irq(&xhci->lock); =20 xhci_cleanup_msix(xhci); @@ -739,7 +737,7 @@ void xhci_shutdown(struct usb_hcd *hcd) xhci_halt(xhci); /* Workaround for spurious wakeups at shutdown with HSW */ if (xhci->quirks & XHCI_SPURIOUS_WAKEUP) - xhci_reset(xhci); + xhci_reset(xhci, XHCI_RESET_SHORT_USEC); spin_unlock_irq(&xhci->lock); =20 xhci_cleanup_msix(xhci); @@ -1111,7 +1109,7 @@ int xhci_resume(struct xhci_hcd *xhci, b =20 xhci_dbg(xhci, "Stop HCD\n"); xhci_halt(xhci); - retval =3D xhci_reset(xhci); + retval =3D xhci_reset(xhci, XHCI_RESET_LONG_USEC); spin_unlock_irq(&xhci->lock); if (retval) return retval; @@ -4990,7 +4988,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, =20 xhci_dbg(xhci, "Resetting HCD\n"); /* Reset the internal HC memory state and registers. */ - retval =3D xhci_reset(xhci); + retval =3D xhci_reset(xhci, XHCI_RESET_LONG_USEC); if (retval) return retval; xhci_dbg(xhci, "Reset complete\n"); --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -236,6 +236,9 @@ struct xhci_op_regs { #define CMD_ETE (1 << 14) /* bits 15:31 are reserved (and should be preserved on writes). */ =20 +#define XHCI_RESET_LONG_USEC (10 * 1000 * 1000) +#define XHCI_RESET_SHORT_USEC (250 * 1000) + /* IMAN - Interrupt Management Register */ #define IMAN_IE (1 << 1) #define IMAN_IP (1 << 0) @@ -2016,11 +2019,11 @@ void xhci_free_command(struct xhci_hcd * =20 /* xHCI host controller glue */ typedef void (*xhci_get_quirks_t)(struct device *, struct xhci_hcd *); -int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, int usec); +int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, u64 timeout_us); void xhci_quiesce(struct xhci_hcd *xhci); int xhci_halt(struct xhci_hcd *xhci); int xhci_start(struct xhci_hcd *xhci); -int xhci_reset(struct xhci_hcd *xhci); +int xhci_reset(struct xhci_hcd *xhci, u64 timeout_us); int xhci_run(struct usb_hcd *hcd); int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks); void xhci_shutdown(struct usb_hcd *hcd); From nobody Sat Apr 18 04:19:29 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 20E8DC433EF for ; Tue, 19 Jul 2022 11:59:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237602AbiGSL67 (ORCPT ); Tue, 19 Jul 2022 07:58:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237529AbiGSL6T (ORCPT ); Tue, 19 Jul 2022 07:58:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46B5C45F7C; Tue, 19 Jul 2022 04:57:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C9E6261659; Tue, 19 Jul 2022 11:57:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DFFEC341C6; Tue, 19 Jul 2022 11:57:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231829; bh=+8CzF90KkgZMMGOcGho4vUISVftHoe5+9nZIO+iktok=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mX10wzbjPlC8zaa0/8c4BQCUC8q3lg3+78D2GnhP4iPaRzXXpXuhYEgLhUOrbzlBd WEOUz7uI4vj5gFuGKVHyOpgxxECwzA8SDkPBm0p1xztpFfX+AhVMU9nfHJ3aU72ODS IpoVhkWUkP3kotvBx62noFbVaa8yNwaVPkoDu2xY= 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 4.14 12/43] ARM: 9209/1: Spectre-BHB: avoid pr_info() every time a CPU comes out of idle Date: Tue, 19 Jul 2022 13:53:43 +0200 Message-Id: <20220719114523.103022644@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 35c4660e638a..4af4195eed76 100644 --- a/arch/arm/mm/proc-v7-bugs.c +++ b/arch/arm/mm/proc-v7-bugs.c @@ -217,10 +217,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:29 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 B83DFC43334 for ; Tue, 19 Jul 2022 12:01:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237625AbiGSMBG (ORCPT ); Tue, 19 Jul 2022 08:01:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234007AbiGSL6e (ORCPT ); Tue, 19 Jul 2022 07:58:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0646641D34; Tue, 19 Jul 2022 04:57:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6A5ADB81B29; Tue, 19 Jul 2022 11:57:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D0EFC341C6; Tue, 19 Jul 2022 11:57:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231832; bh=293nDsLBI5wIDjolYkBpOgTABQn8j1dT7sOO1QDWn5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z6KFspEwzkOhy4JO4KHneVXQ6kzfA/bP8LTUo+YjW9Ma16apVxm4oLYULaHxEtjJc gYkMejFIE48P1Lk8oY7v/oZEsUT9wgOBNkoo5xXrnbT4ZwoCl2K+vmVbpfpAHY3Gwk Ap1Fq+iLXi96pgSBbYWn5X8ETyrStedMAoE40YEw= 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 4.14 13/43] inetpeer: Fix data-races around sysctl. Date: Tue, 19 Jul 2022 13:53:44 +0200 Message-Id: <20220719114523.199265132@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 f94881412d5b..fcccc2f6fa9a 100644 --- a/net/ipv4/inetpeer.c +++ b/net/ipv4/inetpeer.c @@ -147,16 +147,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:29 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 25307C43334 for ; Tue, 19 Jul 2022 12:01:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237641AbiGSMBJ (ORCPT ); Tue, 19 Jul 2022 08:01:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237686AbiGSL6g (ORCPT ); Tue, 19 Jul 2022 07:58:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B995C422E9; Tue, 19 Jul 2022 04:57: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 779D8B81B2B; Tue, 19 Jul 2022 11:57:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACCDFC341C6; Tue, 19 Jul 2022 11:57:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231835; bh=Mks+Xm8o2vp8NRXfZWPWNfWitehtpVo26NqiYS4TcX4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FDq/m/A5WsTwBrSPxFz+sFwjHnwocl2ErrmRFsIzRNN5v+Mthts2ogVk5/j/L+Yge hMXV7GH14DXLKx7BnKqEN6hiQOp6TSWQ3gsUEM8G4Foo/xisCDtyHXgvHIUvr+qtEQ BGLqBqUHoqy6bWtEoQbAlfmtmEUbn81oDTL/K/J0= 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 4.14 14/43] net: Fix data-races around sysctl_mem. Date: Tue, 19 Jul 2022 13:53:45 +0200 Message-Id: <20220719114523.268104601@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 f729ccfe756a..dfeaa8deba96 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1340,7 +1340,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:29 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 687C8C433EF for ; Tue, 19 Jul 2022 11:59:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237840AbiGSL7Y (ORCPT ); Tue, 19 Jul 2022 07:59:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237674AbiGSL6x (ORCPT ); Tue, 19 Jul 2022 07:58: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 0071A474E2; Tue, 19 Jul 2022 04:57:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 76D59B81A8F; Tue, 19 Jul 2022 11:57:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCA63C341C6; Tue, 19 Jul 2022 11:57:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231838; bh=apWjY8WVYNFOiJAFKjsh1sUHoKAzWbOYkW1POaZJlH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=glhH9vQe3POB5sb7+loOeybW5vpVOku5GKSn+8p6O/wYS9r6IzaWnpTlrMFx8YDpr M2xe3ZYJYAgKioHK5O4L31Eo7FEMHfRMvCKHfWtKepm8e4MIxwPN6ZHU6qkmMphAkA F68d+6COqgXxzdwvUMf5SuJWJzlBcJg7jXJfn6eE= 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 4.14 15/43] cipso: Fix data-races around sysctl. Date: Tue, 19 Jul 2022 13:53:46 +0200 Message-Id: <20220719114523.334238277@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- Documentation/networking/ip-sysctl.txt | 2 +- net/ipv4/cipso_ipv4.c | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/network= ing/ip-sysctl.txt index 5f1e3dc567f1..0278b6d1bc71 100644 --- a/Documentation/networking/ip-sysctl.txt +++ b/Documentation/networking/ip-sysctl.txt @@ -781,7 +781,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 e8b8dd1cb157..8dcf9aec7b77 100644 --- a/net/ipv4/cipso_ipv4.c +++ b/net/ipv4/cipso_ipv4.c @@ -254,7 +254,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); @@ -311,13 +311,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]; @@ -337,7 +338,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 { @@ -1214,7 +1215,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; @@ -1617,7 +1619,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:29 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 3F402C433EF for ; Tue, 19 Jul 2022 11:59:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237678AbiGSL72 (ORCPT ); Tue, 19 Jul 2022 07:59:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237711AbiGSL67 (ORCPT ); Tue, 19 Jul 2022 07:58:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77025474CD; Tue, 19 Jul 2022 04:57:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5015AB81B2B; Tue, 19 Jul 2022 11:57:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B06B1C341C6; Tue, 19 Jul 2022 11:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231841; bh=AzRlieUkclj7gi4E5wojnkkpexi+Q29DQ8w02BI9ZpQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zwfm/sO6lH6Bzjj9quZpFL+cZAt0oh76j4W0cL7L+OYYA4NL3vkn/WeYXoQL1DptT F6AXNtPdlHWunembA9lABQbVfNSTsnISJM77X+x0ps3DrgqGh/eb6U2y3Lx4Mj25Re FZM7ns+R0RxiD+mpI+ylhLVXFmVYDQCp+ZqupiJw= 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 4.14 16/43] icmp: Fix data-races around sysctl. Date: Tue, 19 Jul 2022 13:53:47 +0200 Message-Id: <20220719114523.412478839@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 dc99b40da48d..74847996139d 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -266,11 +266,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:29 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 A98E3CCA482 for ; Tue, 19 Jul 2022 11:59:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237729AbiGSL7g (ORCPT ); Tue, 19 Jul 2022 07:59:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237725AbiGSL7L (ORCPT ); Tue, 19 Jul 2022 07:59:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E54947BA1; Tue, 19 Jul 2022 04:57: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 44459B81B29; Tue, 19 Jul 2022 11:57:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C479C341C6; Tue, 19 Jul 2022 11:57:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231843; bh=lxMsAemLB7Vh9U5nxqsIFnrUohgeb86zETMCnysLRaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ol892Ep8wnhAUQYqvLrOrtukS51gZOvH5tTHH+r+o9cSLo982qt14BUPfp4QxiROR dEWcA87YdDwXMqpz7HmFq50xDo7xt0odeGE3fSAr6icbjd+sO+BLEGJZLwZa9TV6IJ ObPvfE6MC6FhWPSDE6t8OeDzVRTqJNEC4YFkEHK8= 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 4.14 17/43] ARM: dts: sunxi: Fix SPI NOR campatible on Orange Pi Zero Date: Tue, 19 Jul 2022 13:53:48 +0200 Message-Id: <20220719114523.501811172@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 b1502df7b509..0368b73b2501 100644 --- a/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts +++ b/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts @@ -149,7 +149,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:29 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 A2615C433EF for ; Tue, 19 Jul 2022 11:59:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237701AbiGSL7b (ORCPT ); Tue, 19 Jul 2022 07:59:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237730AbiGSL7M (ORCPT ); Tue, 19 Jul 2022 07:59:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1160442AC9; Tue, 19 Jul 2022 04:57: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 8ADF961614; Tue, 19 Jul 2022 11:57:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A192C341C6; Tue, 19 Jul 2022 11:57:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231846; bh=bl+wPdldNjUrpJ1jfliUWeOq9nwIuzdGzvaUo00nT/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rz6kq8NGq9hAlURcjVXQjZtY98VD1zc0PvWCttdfyvwOdo00a3wlQ3S3c4m4qzDan Hz0tX2fzWOTOEAMenUi1yrLbv+OGh/CaxYn7kw55vtwPQAXk/JOaSqiXuYUEE2X7KL nUj3DCBILJq1f5PZZ9CNWUcqvdUMgHOZwcGf1g2M= 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 4.14 18/43] icmp: Fix a data-race around sysctl_icmp_ratelimit. Date: Tue, 19 Jul 2022 13:53:49 +0200 Message-Id: <20220719114523.600651403@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 74847996139d..e384926de46f 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -333,7 +333,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:29 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 C59AAC433EF for ; Tue, 19 Jul 2022 11:59:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230425AbiGSL7i (ORCPT ); Tue, 19 Jul 2022 07:59:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237769AbiGSL7Q (ORCPT ); Tue, 19 Jul 2022 07:59:16 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54FAA45047; Tue, 19 Jul 2022 04:57: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 E3721B81A8F; Tue, 19 Jul 2022 11:57:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DA34C341C6; Tue, 19 Jul 2022 11:57:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231849; bh=/gDLDlXvG0A+CVxpLY6kJCQo+4kacG2z3uvsdV4i29E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K7PP1XWxVsxTS+knG5xQDIdgj5mQOuZyXYKDjA3k2TCDb2SONoGPvnilnw84pVHsB EaSiSe6Co7bGhg9aQ31e4QMAZLxBW/kiplKrJq0ZvEN39trK9m03tHAQgi1+0ypyF8 S9FDqFRMkrk6BZNUwRZEKTF3vY/2HUihnoU+F9zA= 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 4.14 19/43] icmp: Fix a data-race around sysctl_icmp_ratemask. Date: Tue, 19 Jul 2022 13:53:50 +0200 Message-Id: <20220719114523.702739183@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 e384926de46f..1748dfb1dc0a 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -295,7 +295,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:29 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 E9D79C43334 for ; Tue, 19 Jul 2022 11:59:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237742AbiGSL7l (ORCPT ); Tue, 19 Jul 2022 07:59:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237778AbiGSL7R (ORCPT ); Tue, 19 Jul 2022 07:59:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3089A422FF; Tue, 19 Jul 2022 04:57:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CD23CB81B1C; Tue, 19 Jul 2022 11:57:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 299D0C341C6; Tue, 19 Jul 2022 11:57:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231852; bh=hDYxTrmhxg2oXocl7+kJNSoaNXsxGhvVaUgtHU2TV7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NHss98e22jvDz1DEFW+LJEvVatJlXqPju5miZ0+Yo/OnVUFPzo+goMMZeS6JqS0Mt KqojP0aqySwenocDOdcrP73m4eFkJ5VqRetrObvLPOBvNTG5+2Llnxi30EYq216IwB K8PAJ4fulMW63/a6lcPH/BWwoAZNwO1LnesfmVfs= 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 4.14 20/43] ipv4: Fix data-races around sysctl_ip_dynaddr. Date: Tue, 19 Jul 2022 13:53:51 +0200 Message-Id: <20220719114523.783441466@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- Documentation/networking/ip-sysctl.txt | 2 +- net/ipv4/af_inet.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/network= ing/ip-sysctl.txt index 0278b6d1bc71..5849c119e0ef 100644 --- a/Documentation/networking/ip-sysctl.txt +++ b/Documentation/networking/ip-sysctl.txt @@ -858,7 +858,7 @@ ip_nonlocal_bind - BOOLEAN which can be quite useful - but may break some applications. 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 ee42907f4827..93dea10ef9a6 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -1152,7 +1152,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); } @@ -1207,7 +1207,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:29 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 1D37ACCA47F for ; Tue, 19 Jul 2022 12:00:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237663AbiGSMAB (ORCPT ); Tue, 19 Jul 2022 08:00:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237556AbiGSL70 (ORCPT ); Tue, 19 Jul 2022 07:59: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 557A0481C4; Tue, 19 Jul 2022 04:57: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 78316B81A8F; Tue, 19 Jul 2022 11:57:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C31B5C341C6; Tue, 19 Jul 2022 11:57:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231858; bh=gMraHGEBscKzTSrXLqSw5A7FHMLDmKYcFm61FezMPSA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t2vmkT6Jq6zE1NN5QPjk5BdNW9DrGbPX5CNRc4mWE3Ql9ujQQm2C2MhuviRXpjsMH 8C7RM1uix3w3Xi7lZld7p7jy0apS50y2tdL631TI6peLxRUZJD5VqO8ekCgQbg6inG mkK/So7AfyM67iNv5He5mruEZRIzpbmW7Z9LR/GM= 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 4.14 21/43] sfc: fix use after free when disabling sriov Date: Tue, 19 Jul 2022 13:53:52 +0200 Message-Id: <20220719114523.862711671@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 2f36b18fd109..93fac5fde093 100644 --- a/drivers/net/ethernet/sfc/ef10_sriov.c +++ b/drivers/net/ethernet/sfc/ef10_sriov.c @@ -415,8 +415,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; " @@ -424,10 +425,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:29 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 786F2C433EF for ; Tue, 19 Jul 2022 12:00:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237723AbiGSMAF (ORCPT ); Tue, 19 Jul 2022 08:00:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237674AbiGSL72 (ORCPT ); Tue, 19 Jul 2022 07:59:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0C7B45077; Tue, 19 Jul 2022 04:57:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 59B28B81B29; Tue, 19 Jul 2022 11:57:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F5E1C341C6; Tue, 19 Jul 2022 11:57:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231861; bh=AEjRY8Z/6UqJYMXdaNDbjO4FfX6+wnbZE1T5tQK1gyA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BVaInKxZrPVujxP0sxxgzcYcEgMjnzNEKJQ21Ph6npkfhvjI3Jlj77aHPQUlOzN0+ 6GgdnIRxk0C8tov+1EsVMkFCHe9O7T7VfBl2xzzwj5c2iAjtiQGic+kpGeo+Wl/8vO O0ilPfiNuHZK5BlxyLpM/GDQdqdZ0A5rYI4TtHpQ= 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 4.14 22/43] seg6: fix skb checksum evaluation in SRH encapsulation/insertion Date: Tue, 19 Jul 2022 13:53:53 +0200 Message-Id: <20220719114523.938172623@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 1d641e21f23f..3f43a4688602 100644 --- a/net/ipv6/seg6_iptunnel.c +++ b/net/ipv6/seg6_iptunnel.c @@ -156,6 +156,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; @@ -208,6 +210,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; @@ -269,7 +273,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)); =20 return 0; --=20 2.35.1 From nobody Sat Apr 18 04:19:29 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 343ECC433EF for ; Tue, 19 Jul 2022 12:00:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237748AbiGSMAJ (ORCPT ); Tue, 19 Jul 2022 08:00:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237700AbiGSL7b (ORCPT ); Tue, 19 Jul 2022 07:59:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 349134507F; Tue, 19 Jul 2022 04:57:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9C0CB615AC; Tue, 19 Jul 2022 11:57:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78D98C341C6; Tue, 19 Jul 2022 11:57:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231863; bh=YWGmD7EOXOZMv1GFRNn3KAWHs8vkGobCT8D4A5x8278=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XNiXMkzmlcnUIfMs/SB7I5rBF1VEBnxydxWdhm0WWSCMhi5uXRzeI8+YbpvEMRjq7 x+icfpCj1fLUtx3JbtDGZhP+5rLAfDkQI6JidX1/xAscfh5l6y5ffJV4+FyfUVLVWv eogghyRUZFXDdIt62q1ZQbHqm9F8TZPQoMB/tMbw= 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 4.14 23/43] seg6: fix skb checksum in SRv6 End.B6 and End.B6.Encaps behaviors Date: Tue, 19 Jul 2022 13:53:54 +0200 Message-Id: <20220719114524.009871092@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 9a01f72d907f..8f8ea7a76b99 100644 --- a/net/ipv6/seg6_local.c +++ b/net/ipv6/seg6_local.c @@ -405,7 +405,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 lookup_nexthop(skb, NULL, 0); @@ -437,7 +436,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 lookup_nexthop(skb, NULL, 0); --=20 2.35.1 From nobody Sat Apr 18 04:19:29 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 DB235C433EF for ; Tue, 19 Jul 2022 12:00:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237795AbiGSMAW (ORCPT ); Tue, 19 Jul 2022 08:00:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237794AbiGSL7y (ORCPT ); Tue, 19 Jul 2022 07:59:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F04C62F672; Tue, 19 Jul 2022 04:57:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DE7FEB81B2E; Tue, 19 Jul 2022 11:57:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51C70C341C6; Tue, 19 Jul 2022 11:57:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231866; bh=jF5alRkszrWGyOrFSlTJbFMU72SJN99KjO7GoaANxsI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AfmM66IdX0M9fgQZrE9nesIS5PCNRuHTmESY1b/gBWAy9BCXkgHf4A13z+kG0tqJp qxj1aNEgOPzRLVx/3D+cKFRRysM7rqp0tS6+tv4P2SB3qXQ7eTRFKbs84gO4RqzOh5 Qe7JktMwfASHv5xNRJ4LAnkDwp9fPeA6YAhipfXU= 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 4.14 24/43] sfc: fix kernel panic when creating VF Date: Tue, 19 Jul 2022 13:53:55 +0200 Message-Id: <20220719114524.102627942@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 4f0da3963b01..1dfb14a035f9 100644 --- a/drivers/net/ethernet/sfc/ef10.c +++ b/drivers/net/ethernet/sfc/ef10.c @@ -1896,7 +1896,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:29 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 3F304C43334 for ; Tue, 19 Jul 2022 12:00:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237667AbiGSMA2 (ORCPT ); Tue, 19 Jul 2022 08:00:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237802AbiGSMAA (ORCPT ); Tue, 19 Jul 2022 08:00:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3D3148E8D; Tue, 19 Jul 2022 04:57:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1F757B81B29; Tue, 19 Jul 2022 11:57:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3841AC341C6; Tue, 19 Jul 2022 11:57:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231869; bh=Jh87tjDMw8NWd++8ckUVxmtj3zAcSZTShiVA8LEMt1Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oojlX5S/P3OwKjYE8vJbrx9HtpBROHjHEtyI6Tl456ns8HF6koyvVXUUmW3rrNEFn hJEGlO8oWa5PVm5+nbBvHL/l+5SAsDqNgRLRyW6An94pagsMbL5DsZIQBahVxGKHd6 IPYAmlFpK/Oxnv1j76NILTMGlJrEiENnbNVg08s0= 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 4.14 25/43] virtio_mmio: Add missing PM calls to freeze/restore Date: Tue, 19 Jul 2022 13:53:56 +0200 Message-Id: <20220719114524.168401754@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 181386e06cb7..d0a7f69782a4 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -66,6 +66,7 @@ #include #include #include +#include #include #include #include @@ -492,6 +493,25 @@ static const struct virtio_config_ops virtio_mmio_conf= ig_ops =3D { .bus_name =3D vm_bus_name, }; =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_empty(struct device *_d) {} =20 @@ -735,6 +755,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:29 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 95AE0C433EF for ; Tue, 19 Jul 2022 12:00:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237848AbiGSMAd (ORCPT ); Tue, 19 Jul 2022 08:00:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237811AbiGSMAE (ORCPT ); Tue, 19 Jul 2022 08:00:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88B8A48CAB; Tue, 19 Jul 2022 04:57: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 83CC061614; Tue, 19 Jul 2022 11:57:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66B0CC341C6; Tue, 19 Jul 2022 11:57:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231872; bh=OIuKUBGfxMYrNRKeC8frjvY4jfnAQXLVBGFFzZsMc6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gAgmlcwa/pu6vD9iQOz3iXiQiwPDel8FgBvMEIBaVETDZlBOx5BI5t9qG3GL9Sn2V Xkkq3tCGPjDIgj6EAuzXctHHXY91TEABbQe/5XdcyrTHT/YpYJ84eGkJJMIaLoa+v+ hoQ2wSznTTjJlN2owfH8VBCdTZkopQTT5N1HsFb8= 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 4.14 26/43] virtio_mmio: Restore guest page size on resume Date: Tue, 19 Jul 2022 13:53:57 +0200 Message-Id: <20220719114524.236990612@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 d0a7f69782a4..0cd9e29d7f98 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -505,6 +505,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:29 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 A433EC433EF for ; Tue, 19 Jul 2022 12:00:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231491AbiGSMAq (ORCPT ); Tue, 19 Jul 2022 08:00:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237769AbiGSMAR (ORCPT ); Tue, 19 Jul 2022 08:00: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 80FD548EBA; Tue, 19 Jul 2022 04:57:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DEEC5B81B2C; Tue, 19 Jul 2022 11:57:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 448B9C341C6; Tue, 19 Jul 2022 11:57:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231875; bh=Yn/jMuAgDhaAo8EvuAzql3ECAH8cMmvlm8r3h/A/msY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hi+4VSbC+drBjd8KlbqHDEFRo6B78R2w4iKHqHu9YGIIrRERC2J7gHG2G2lB8F/Jn c5JEJtul+gmsZ2l9n3KqEHxLxDnXC3lqERE4CKKI2tkcoZR3poVZ6GHR2xdguqXXWh 3yqu7SqKbMoTniVmvSAfGIKWEBhaZl/jv1On1QSU= 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 4.14 27/43] netfilter: br_netfilter: do not skip all hooks with 0 priority Date: Tue, 19 Jul 2022 13:53:58 +0200 Message-Id: <20220719114524.359047916@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 7e50bd9f3611..ee7a03ff89f3 100644 --- a/net/bridge/br_netfilter_hooks.c +++ b/net/bridge/br_netfilter_hooks.c @@ -998,9 +998,24 @@ int br_nf_hook_thresh(unsigned int hook, struct net *n= et, 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:29 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 57719C43334 for ; Tue, 19 Jul 2022 12:00:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237793AbiGSMAx (ORCPT ); Tue, 19 Jul 2022 08:00:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237786AbiGSMAT (ORCPT ); Tue, 19 Jul 2022 08:00:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E42E42AE7; Tue, 19 Jul 2022 04:58:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4905B61655; Tue, 19 Jul 2022 11:57:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28639C341C6; Tue, 19 Jul 2022 11:57:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231878; bh=86GZffUJNDdRz1Q8/xH57X1zgjufQMhaT9F2jEs4Lh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JqSF+BTOfCcgtudVk3XO44MXtrWeJHTlM9TXdKaQbMi0Lgb7w8L0PpP4EesJ7Goq1 noF0G5zEZcpQn4YZpSAHVTbCjyzcwDG5ndS46TlNLvxlfpD6COgYXUjBZWMPkJ3Kol FuOcyYGPTsaYDNWJY66s/AtxAWe3jBvzH+6hWuv0= 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 4.14 28/43] cpufreq: pmac32-cpufreq: Fix refcount leak bug Date: Tue, 19 Jul 2022 13:53:59 +0200 Message-Id: <20220719114524.439064356@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 e225edb5c359..ce0dda1a4241 100644 --- a/drivers/cpufreq/pmac32-cpufreq.c +++ b/drivers/cpufreq/pmac32-cpufreq.c @@ -474,6 +474,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:29 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 174D0C43334 for ; Tue, 19 Jul 2022 12:01:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237871AbiGSMA6 (ORCPT ); Tue, 19 Jul 2022 08:00:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237806AbiGSMA3 (ORCPT ); Tue, 19 Jul 2022 08:00:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31934491E4; Tue, 19 Jul 2022 04:58:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 36D8361640; Tue, 19 Jul 2022 11:58:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 074F8C341C6; Tue, 19 Jul 2022 11:58:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231881; bh=3wNf9MU5nkqkVJi/QAPuv9CYhltkS5PKt+M/rdroE8Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WEhiueuaRMnszV40KeheSJw33+9QCSwWDPuxFFeb+kSkDSaEeGTT68UMXoUnRpJrY 8+Bykv5AHuJMBpZ3vnVGvQpyBDJz/riAlRwtATqJw0AiwtaiexExca67UHkohZN+hD 2Oks6HDx5OQomuI0YRASWzPm1eOYyATUXEEFxcBA= 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 4.14 29/43] platform/x86: hp-wmi: Ignore Sanitization Mode event Date: Tue, 19 Jul 2022 13:54:00 +0200 Message-Id: <20220719114524.509447144@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 93fadd4abf14..f911410bb4c7 100644 --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c @@ -75,6 +75,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 { @@ -631,6 +632,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:29 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 350B7C433EF for ; Tue, 19 Jul 2022 12:01:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237480AbiGSMBM (ORCPT ); Tue, 19 Jul 2022 08:01:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237751AbiGSMAl (ORCPT ); Tue, 19 Jul 2022 08:00:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 230A8491F8; Tue, 19 Jul 2022 04:58:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7F69FB81B2C; Tue, 19 Jul 2022 11:58:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3F9BC341C6; Tue, 19 Jul 2022 11:58:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231884; bh=cU6nBfCYAO3xE0Q6iDSFyGdhFqzQSt1LLUiGXyLzMZo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zq1FSfx0j/13Vp93etevwAgb0uL6jBoM1Iqi44zYpu/kX7zEMdGpNSdUzzApins94 xkA1cti96+f2r9OxStrYLUOpirNA5Xf7NSGWd6K2RTNwpNMHAtZvb31H0DW4QScoTp fcBoAAcRZukTy192ICL3zfSlI6BgJshuowEA088w= 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 4.14 30/43] net: tipc: fix possible refcount leak in tipc_sk_create() Date: Tue, 19 Jul 2022 13:54:01 +0200 Message-Id: <20220719114524.582386180@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- net/tipc/socket.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 94e74987fe65..40002d2afb8a 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -440,6 +440,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:29 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 BD6BCC43334 for ; Tue, 19 Jul 2022 12:01:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237900AbiGSMB3 (ORCPT ); Tue, 19 Jul 2022 08:01:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237785AbiGSMAq (ORCPT ); Tue, 19 Jul 2022 08:00:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7201345F40; Tue, 19 Jul 2022 04:58: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 28633B81B29; Tue, 19 Jul 2022 11:58:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80ED6C341CB; Tue, 19 Jul 2022 11:58:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231889; bh=iOryIuztZtcKAP5hvukVe7Zk0bwpXnU3KwdWuJ63QAQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rC6CbuPUpE9Cmam7S5iMX9CBec7E02fKFWcfqK87IqCp0TWoFQJR5+O7Up0SHohkx ocCehwl+McXWhvLvowBV1yIIkJFzNPqdqe8ynAZtaXsIAHSX1nDl1Im55mRD/cXXDc Yb+GKmaC22aQnn1IkGJr6nrTO3SM4SwIBjdrQpmU= 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 4.14 31/43] NFC: nxp-nci: dont print header length mismatch on i2c error Date: Tue, 19 Jul 2022 13:54:02 +0200 Message-Id: <20220719114524.685458603@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 871ad23d05c0..f93571d776a8 100644 --- a/drivers/nfc/nxp-nci/i2c.c +++ b/drivers/nfc/nxp-nci/i2c.c @@ -138,7 +138,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); @@ -182,7 +184,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:29 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 603EBC43334 for ; Tue, 19 Jul 2022 12:01:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237908AbiGSMBc (ORCPT ); Tue, 19 Jul 2022 08:01:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237794AbiGSMAx (ORCPT ); Tue, 19 Jul 2022 08:00: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 5D6B245F5F; Tue, 19 Jul 2022 04:58:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0ED5CB81B2C; Tue, 19 Jul 2022 11:58:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C2BFC385A5; Tue, 19 Jul 2022 11:58:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231892; bh=SIc6DlfuX0l6uonIbPt33V4X9eiPE/u2ceNGgrYJ224=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vW4eiqYDwm6OWaVdWoalpLJbLUuwp0zx+4o3TAMalwzRWFXfwkwETbDneFq8/CWp0 4jOeyYWbu6JK+nZnBe4XVO7SA/4pY4Rs1cKyIO0mXSavIoSQoeGi0qOj252MR1a8tc My4Z52tq84YolGyIvDxE/gtyAFpr1KXuhVxjDkvk= 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 4.14 32/43] net: sfp: fix memory leak in sfp_probe() Date: Tue, 19 Jul 2022 13:54:03 +0200 Message-Id: <20220719114524.759310436@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 9f6e737d9fc9..c0f9de3be217 100644 --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c @@ -830,7 +830,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:29 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 89993C43334 for ; Tue, 19 Jul 2022 12:01:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237805AbiGSMBg (ORCPT ); Tue, 19 Jul 2022 08:01:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237832AbiGSMAz (ORCPT ); Tue, 19 Jul 2022 08:00:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB53C49B4B; Tue, 19 Jul 2022 04:58:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4654961654; Tue, 19 Jul 2022 11:58:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39833C36AF2; Tue, 19 Jul 2022 11:58:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231895; bh=sN7vWqDvnCjutFF1izI4mZX9UdD/N9GNfdT2bXLPyGo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d7v/1bm6YvAe0AhbfT0bSixR4Bw7meN3Oqi4yh9dyFG8evPrFUByjiLgJck5ZkQT+ YcwAm7KlVMXW/B8u8Y3TATMkZzg+4n7qUkU6M0FNB+oE4t3hamwSR5fbS77klz2ql6 bGOoY1T82KLrfy+yQQ6JgteTj2WPWsoJrAtt4+8k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Brown , Sasha Levin Subject: [PATCH 4.14 33/43] ASoC: ops: Fix off by one in range control validation Date: Tue, 19 Jul 2022 13:54:04 +0200 Message-Id: <20220719114524.880999953@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 0848aec1bd24..81c9ecfa7c7f 100644 --- a/sound/soc/soc-ops.c +++ b/sound/soc/soc-ops.c @@ -535,7 +535,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) @@ -556,7 +556,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:29 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 0962FCCA47F for ; Tue, 19 Jul 2022 12:01:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237872AbiGSMBn (ORCPT ); Tue, 19 Jul 2022 08:01:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237879AbiGSMBA (ORCPT ); Tue, 19 Jul 2022 08:01:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8B0F43322; Tue, 19 Jul 2022 04:58:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 542B3616C1; Tue, 19 Jul 2022 11:58:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FCA4C341CE; Tue, 19 Jul 2022 11:58:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231898; bh=bOkeFcRvEJXwqCdMD4VM9co/zqhkv616K5F1BysyWvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yUui3IxM5YSc6Z3nqLfzw0sWHV3168ouzofme41T14JnY8q0lvAL5GImykCZfG/vt 7bXWe2g0+XB4DVXiAUsbrVbPnqtDNlmbLsD/VB7c6RD/spWdU9nFfLVrSZ0MF18zw7 mrDwBxKvc4rs8A9PB0UuV276evzrgjYxbQcB4PPg= 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 4.14 34/43] ASoC: wm5110: Fix DRE control Date: Tue, 19 Jul 2022 13:54:05 +0200 Message-Id: <20220719114524.959978500@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 858a24fc28e8..9d099d75021c 100644 --- a/sound/soc/codecs/wm5110.c +++ b/sound/soc/codecs/wm5110.c @@ -406,6 +406,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); @@ -433,8 +434,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; @@ -447,6 +448,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:29 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 A1917C43334 for ; Tue, 19 Jul 2022 12:01:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237940AbiGSMBq (ORCPT ); Tue, 19 Jul 2022 08:01:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237684AbiGSMBL (ORCPT ); Tue, 19 Jul 2022 08:01:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8D4249B6F; Tue, 19 Jul 2022 04:58: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 41FC461697; Tue, 19 Jul 2022 11:58:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4976C341C6; Tue, 19 Jul 2022 11:58:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231901; bh=5IEYN5foefB4K0Dyg0jaz4/QY7YbSg5VpEmxben9s0s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N0stSm6dyGRH6EaJP79YwJjm9P7QN3GzCyeI4F7Kze4fEflBJKDab83upQA3dwf9Y QRYrYHsGlu7BMnKqyf55b3fvZSPnupe4N7MFra3GwwMPJ2WWOdP2GtGQJ2tbwWyOnK 2cWWH95vAGYsDZxHLZGrR2o/+hY/KZfkojMkFqZo= 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 4.14 35/43] irqchip: or1k-pic: Undefine mask_ack for level triggered hardware Date: Tue, 19 Jul 2022 13:54:06 +0200 Message-Id: <20220719114525.024621042@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 dd9d5d12fea2..05931fdedbb9 100644 --- a/drivers/irqchip/irq-or1k-pic.c +++ b/drivers/irqchip/irq-or1k-pic.c @@ -70,7 +70,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:29 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 B22BBC43334 for ; Tue, 19 Jul 2022 12:03:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238064AbiGSMDK (ORCPT ); Tue, 19 Jul 2022 08:03:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238029AbiGSMCf (ORCPT ); Tue, 19 Jul 2022 08:02:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 850494B494; Tue, 19 Jul 2022 04:59:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BD14261642; Tue, 19 Jul 2022 11:59:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A005BC341C6; Tue, 19 Jul 2022 11:59:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231947; bh=4fuDo9GyeOb4vTdduQvEyIq7rIyMwxLnhvLNqWOmU98=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nVvF9EdpVwtnHneEIpv4tlcmnKaLV95jEIO5LYV6ppCwJoQaSSQBbKMCcoC2BN5Du hpjC2H7rbamUkIfj8Y+6FD7mZGco3qrCSduVUJQf8A6E2cR18R/IrWzCu8BuEHfjt5 2MY7Qfe9KmDjeYDI5g/HVFFNIC2M6hU6rLK7DseQ= 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 4.14 36/43] x86: Clear .brk area at early boot Date: Tue, 19 Jul 2022 13:54:07 +0200 Message-Id: <20220719114525.082613964@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 e00ccbcc2913..59aa1d0646e4 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c @@ -292,6 +292,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:29 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 89A7BC433EF for ; Tue, 19 Jul 2022 12:02:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237954AbiGSMCa (ORCPT ); Tue, 19 Jul 2022 08:02:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237683AbiGSMBl (ORCPT ); Tue, 19 Jul 2022 08:01:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F001E4331C; Tue, 19 Jul 2022 04:58:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5E78161654; Tue, 19 Jul 2022 11:58:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3ECA4C341C6; Tue, 19 Jul 2022 11:58:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231924; bh=Bm9v9px20qjhnfPeUXRRvzIaEVzRnS3kuvbqmkLM0rU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i+5riCLc1fSo3ZSbLS1+TUrJ0Sv70VqyQf401rjOmgbjmRPHOTUajfdN4djOO4DaH 2fEBa4fb5mZuVgvILpRgNZD/GV6s86F+b/YrARrDLYn3mvIWz7PIfUikwyLNd3CqHJ mTpUtfLc4aE3Wv1O2KoBmRExZDcICQ3fli9BsXdM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Torvalds , Sasha Levin Subject: [PATCH 4.14 37/43] signal handling: dont use BUG_ON() for debugging Date: Tue, 19 Jul 2022 13:54:08 +0200 Message-Id: <20220719114525.140079922@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- kernel/signal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/signal.c b/kernel/signal.c index 3619ab24644f..7c3fe8e0230a 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -1662,12 +1662,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 if (sig !=3D SIGCHLD) { --=20 2.35.1 From nobody Sat Apr 18 04:19:29 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 B0278C433EF for ; Tue, 19 Jul 2022 12:02:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237967AbiGSMCe (ORCPT ); Tue, 19 Jul 2022 08:02:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237957AbiGSMBz (ORCPT ); Tue, 19 Jul 2022 08:01:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3784C4AD55; Tue, 19 Jul 2022 04:58:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A414BB81A2E; Tue, 19 Jul 2022 11:58:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 197A9C341C6; Tue, 19 Jul 2022 11:58:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231927; bh=EiDmLPB+gZpuU9TL1DwhdArXNQS73PEzYil+dpzTUig=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AZOlCFtn5HRA8x9lBOxVKhGvODvZQ6ULYH6T59en2d7VIt7WDtAOwySljmIWSe3vD MwIl7Rod+m+bwQhiaxq2BMsA3FXP/83hrRp9mET5tl+LHVLJYwH0ZO5V2J9kuVsEkk JBOhjZIcnwUBSuS1VoCZJAvFRkfUvIzsQYmQQ9U0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lucien Buchmann , Johan Hovold Subject: [PATCH 4.14 38/43] USB: serial: ftdi_sio: add Belimo device ids Date: Tue, 19 Jul 2022 13:54:09 +0200 Message-Id: <20220719114525.215685208@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 @@ -1018,6 +1018,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:29 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 CB84DC43334 for ; Tue, 19 Jul 2022 12:02:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237970AbiGSMCh (ORCPT ); Tue, 19 Jul 2022 08:02:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237853AbiGSMB6 (ORCPT ); Tue, 19 Jul 2022 08:01:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB6854AD71; Tue, 19 Jul 2022 04:58: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 89BCDB81A2E; Tue, 19 Jul 2022 11:58:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDA26C341C6; Tue, 19 Jul 2022 11:58:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231930; bh=AuBuzGhApDy8fArqUJwljo8Tnm+BNRAQ/o6uRm5qtt0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SDJgLnniGSz/Tcmv9j0rhpQsHFcTl+4Jz4R71zqg9OxG0pIFLCDoR9kw5+vDiPwi6 2ZC9cnxvCsWqa2f8JQ8w/zh6yvdVCp8BWMhPcpg4sXQxbk8dbfASkR5M8rWu0IVx/e th4Ha5AQm/u1i5oCffmmqDrvbSPWzBQlc7WYNucA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thinh Nguyen Subject: [PATCH 4.14 39/43] usb: dwc3: gadget: Fix event pending check Date: Tue, 19 Jul 2022 13:54:10 +0200 Message-Id: <20220719114525.278681956@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 @@ -3130,7 +3130,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 */ @@ -3143,6 +3142,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:29 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 1D0B0C433EF for ; Tue, 19 Jul 2022 12:02:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238033AbiGSMCl (ORCPT ); Tue, 19 Jul 2022 08:02:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237782AbiGSMCD (ORCPT ); Tue, 19 Jul 2022 08:02:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9DE543E4E; Tue, 19 Jul 2022 04:58:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 79CBFB81A8F; Tue, 19 Jul 2022 11:58:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3344C341CA; Tue, 19 Jul 2022 11:58:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231933; bh=pneqByNjx/sGoWroweySELz1T991Ow00L40BUVLYOUY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g9DM7mDLl1cSUgNVgQMgo+od79KLuQfVdjNzgLmyH6pljingi5u3sYYRgtDZyXTWs KzYpP1n3pdEirjhgLIu68vwp7Za9pyWha/NQH+jVdJE9VGuWCwvh6SPwE85XNxMGa/ iwu123Tj1ohxrqn2h8iBXWXXkxCud2zLoICA2xG8= 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 4.14 40/43] tty: serial: samsung_tty: set dma burst_size to 1 Date: Tue, 19 Jul 2022 13:54:11 +0200 Message-Id: <20220719114525.359838402@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- drivers/tty/serial/samsung.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/drivers/tty/serial/samsung.c +++ b/drivers/tty/serial/samsung.c @@ -241,8 +241,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 @@ -515,7 +514,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:29 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 6B5BDC433EF for ; Tue, 19 Jul 2022 12:02:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238040AbiGSMCn (ORCPT ); Tue, 19 Jul 2022 08:02:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237869AbiGSMCH (ORCPT ); Tue, 19 Jul 2022 08:02: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 C54D44AD7B; Tue, 19 Jul 2022 04:59:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 56E3EB81A2E; Tue, 19 Jul 2022 11:58:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91758C341C6; Tue, 19 Jul 2022 11:58:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231938; bh=dOUWYPQpNVpVhyXsakkkUnXoaoLoLPfPeUTtmZN9UfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y5CWTBHoFIy8ZZn6Ik/hZ6HeHvHXVriNZQmPxyeGGN3/eQNCfOsCxoiemyoS8vjGf BkjFmRGqyoQy9ZAJMYenpeVi7glaS0wjxONykF/DFKhYuzh+d42M99kxsHLcwE3jBx G6r8MpiIlPWJnRn0R8KTbwZDxoayNwKtCkyboaSE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yi Yang , stable Subject: [PATCH 4.14 41/43] serial: 8250: fix return error code in serial8250_request_std_resource() Date: Tue, 19 Jul 2022 13:54:12 +0200 Message-Id: <20220719114525.443477034@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- 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 @@ -2884,8 +2884,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:29 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 CB03ACCA47F for ; Tue, 19 Jul 2022 12:03:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238022AbiGSMDB (ORCPT ); Tue, 19 Jul 2022 08:03:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237683AbiGSMCb (ORCPT ); Tue, 19 Jul 2022 08:02:31 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A8644B0EC; Tue, 19 Jul 2022 04:59:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 10A53CE1BDE; Tue, 19 Jul 2022 11:59:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C706FC341C6; Tue, 19 Jul 2022 11:59:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231941; bh=8HYYKt81U3yopv59wRFpeEcTzqA00jt5nUVMcNaANm0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1RxgzMnan1ZeM1bt93st5z31kMPT8vXl/gsgc+7Jwkcy00EF2qqo8MTgNdfRMueKi EfvENAzIMW4SvsgwGpcTpo7cTLFuUglpTZvHIXa7YbxrZMAypvW9on9Zb2hZotww5d shFfXBuytJTkV8Gm/C1xNESrQHbdU3Ob5YwnXwLQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rik van Riel , Miaohe Lin , Naoya Horiguchi , Oscar Salvador , John Hubbard , Mel Gorman , Johannes Weiner , Matthew Wilcox , Andrew Morton , Linus Torvalds , Sudip Mukherjee Subject: [PATCH 4.14 42/43] mm: invalidate hwpoison page cache page in fault path Date: Tue, 19 Jul 2022 13:54:13 +0200 Message-Id: <20220719114525.516672930@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Rik van Riel commit e53ac7374e64dede04d745ff0e70ff5048378d1f upstream. Sometimes the page offlining code can leave behind a hwpoisoned clean page cache page. This can lead to programs being killed over and over and over again as they fault in the hwpoisoned page, get killed, and then get re-spawned by whatever wanted to run them. This is particularly embarrassing when the page was offlined due to having too many corrected memory errors. Now we are killing tasks due to them trying to access memory that probably isn't even corrupted. This problem can be avoided by invalidating the page from the page fault handler, which already has a branch for dealing with these kinds of pages. With this patch we simply pretend the page fault was successful if the page was invalidated, return to userspace, incur another page fault, read in the file from disk (to a new memory page), and then everything works again. Link: https://lkml.kernel.org/r/20220212213740.423efcea@imladris.surriel.com Signed-off-by: Rik van Riel Reviewed-by: Miaohe Lin Acked-by: Naoya Horiguchi Reviewed-by: Oscar Salvador Cc: John Hubbard Cc: Mel Gorman Cc: Johannes Weiner Cc: Matthew Wilcox Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds [sudip: use int instead of vm_fault_t] Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- mm/memory.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- a/mm/memory.c +++ b/mm/memory.c @@ -3342,11 +3342,16 @@ static int __do_fault(struct vm_fault *v return ret; =20 if (unlikely(PageHWPoison(vmf->page))) { - if (ret & VM_FAULT_LOCKED) + int poisonret =3D VM_FAULT_HWPOISON; + if (ret & VM_FAULT_LOCKED) { + /* Retry if a clean page was removed from the cache. */ + if (invalidate_inode_page(vmf->page)) + poisonret =3D 0; unlock_page(vmf->page); + } put_page(vmf->page); vmf->page =3D NULL; - return VM_FAULT_HWPOISON; + return poisonret; } =20 if (unlikely(!(ret & VM_FAULT_LOCKED))) From nobody Sat Apr 18 04:19:29 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 BEB7CC43334 for ; Tue, 19 Jul 2022 12:03:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237894AbiGSMDE (ORCPT ); Tue, 19 Jul 2022 08:03:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238021AbiGSMCd (ORCPT ); Tue, 19 Jul 2022 08:02:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CED64B0F8; Tue, 19 Jul 2022 04:59:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0456661647; Tue, 19 Jul 2022 11:59:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C516FC341C6; Tue, 19 Jul 2022 11:59:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231944; bh=UcDZ58eCiejyh3LpsXs/Q/VB86xvoENvhAWfgMJHGLc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TiFbUVY6gOc+UxsaF5gJiZwOFL/phgnpSav2iDVZugfDBOI+O/bF5XigyMQM48Ch0 tTZFdU51FwqRr8gBR5s9tUF7Kz6wP2+nU83sQRXBFB6ozlyFq8AkpswkOEJdCxeH7V SyqVjpOoFskCnHaPcQ5BDnx0k9aIHlMPlhV02/Ks= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , Marc Kleine-Budde , Sudip Mukherjee Subject: [PATCH 4.14 43/43] can: m_can: m_can_tx_handler(): fix use after free of skb Date: Tue, 19 Jul 2022 13:54:14 +0200 Message-Id: <20220719114525.587310460@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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: Marc Kleine-Budde commit 2e8e79c416aae1de224c0f1860f2e3350fa171f8 upstream. can_put_echo_skb() will clone skb then free the skb. Move the can_put_echo_skb() for the m_can version 3.0.x directly before the start of the xmit in hardware, similar to the 3.1.x branch. Fixes: 80646733f11c ("can: m_can: update to support CAN FD features") Link: https://lore.kernel.org/all/20220317081305.739554-1-mkl@pengutronix.de Cc: stable@vger.kernel.org Reported-by: Hangyu Hua Signed-off-by: Marc Kleine-Budde [sudip: adjust context] Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing --- drivers/net/can/m_can/m_can.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c @@ -1420,8 +1420,6 @@ static netdev_tx_t m_can_start_xmit(stru M_CAN_FIFO_DATA(i / 4), *(u32 *)(cf->data + i)); =20 - can_put_echo_skb(skb, dev, 0); - if (priv->can.ctrlmode & CAN_CTRLMODE_FD) { cccr =3D m_can_read(priv, M_CAN_CCCR); cccr &=3D ~(CCCR_CMR_MASK << CCCR_CMR_SHIFT); @@ -1438,6 +1436,9 @@ static netdev_tx_t m_can_start_xmit(stru m_can_write(priv, M_CAN_CCCR, cccr); } m_can_write(priv, M_CAN_TXBTIE, 0x1); + + can_put_echo_skb(skb, dev, 0); + m_can_write(priv, M_CAN_TXBAR, 0x1); /* End of xmit function for version 3.0.x */ } else {