From nobody Thu May 14 08:55:39 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 EB8F7C4167B for ; Mon, 18 Apr 2022 13:28:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242632AbiDRN2W (ORCPT ); Mon, 18 Apr 2022 09:28:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241190AbiDRNFJ (ORCPT ); Mon, 18 Apr 2022 09:05:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5282913E2E; Mon, 18 Apr 2022 05:45:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0FD10B80D9C; Mon, 18 Apr 2022 12:45:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5946CC385A7; Mon, 18 Apr 2022 12:45:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650285932; bh=1e+kMqmuq0XgPzihm05kZ+rHyIgwe3Ceg9otdTGMBhY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PSl/SBRGfFBiSYuqgw53M7ttXamNgQpDeJfDx9Jk1BYeeyF3jmGCH8OEatbmxlsN9 jc8lLxlmLDgbs68xNJqErhuYzk8WuIp8Fxdv/KdBP+R9LxKOvwR1S5tD8C+O51VGf2 7BwBTAU6v+CU+ccitwB8MCpDSUftoNqSPbIhOkvY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Claudiu Beznea , Krzysztof Kozlowski , Sasha Levin Subject: [PATCH 4.19 01/32] memory: atmel-ebi: Fix missing of_node_put in atmel_ebi_probe Date: Mon, 18 Apr 2022 14:13:41 +0200 Message-Id: <20220418121127.172096762@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: Miaoqian Lin [ Upstream commit 6f296a9665ba5ac68937bf11f96214eb9de81baa ] The device_node pointer is returned by of_parse_phandle() with refcount incremented. We should use of_node_put() on it when done. Fixes: 87108dc78eb8 ("memory: atmel-ebi: Enable the SMC clock if specified") Signed-off-by: Miaoqian Lin Reviewed-by: Claudiu Beznea Link: https://lore.kernel.org/r/20220309110144.22412-1-linmq006@gmail.com Signed-off-by: Krzysztof Kozlowski Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/memory/atmel-ebi.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c index 2b9283d4fcb1..8e7b5a1d2983 100644 --- a/drivers/memory/atmel-ebi.c +++ b/drivers/memory/atmel-ebi.c @@ -524,20 +524,27 @@ static int atmel_ebi_probe(struct platform_device *pd= ev) smc_np =3D of_parse_phandle(dev->of_node, "atmel,smc", 0); =20 ebi->smc.regmap =3D syscon_node_to_regmap(smc_np); - if (IS_ERR(ebi->smc.regmap)) - return PTR_ERR(ebi->smc.regmap); + if (IS_ERR(ebi->smc.regmap)) { + ret =3D PTR_ERR(ebi->smc.regmap); + goto put_node; + } =20 ebi->smc.layout =3D atmel_hsmc_get_reg_layout(smc_np); - if (IS_ERR(ebi->smc.layout)) - return PTR_ERR(ebi->smc.layout); + if (IS_ERR(ebi->smc.layout)) { + ret =3D PTR_ERR(ebi->smc.layout); + goto put_node; + } =20 ebi->smc.clk =3D of_clk_get(smc_np, 0); if (IS_ERR(ebi->smc.clk)) { - if (PTR_ERR(ebi->smc.clk) !=3D -ENOENT) - return PTR_ERR(ebi->smc.clk); + if (PTR_ERR(ebi->smc.clk) !=3D -ENOENT) { + ret =3D PTR_ERR(ebi->smc.clk); + goto put_node; + } =20 ebi->smc.clk =3D NULL; } + of_node_put(smc_np); ret =3D clk_prepare_enable(ebi->smc.clk); if (ret) return ret; @@ -587,6 +594,10 @@ static int atmel_ebi_probe(struct platform_device *pde= v) } =20 return of_platform_populate(np, NULL, NULL, dev); + +put_node: + of_node_put(smc_np); + return ret; } =20 static __maybe_unused int atmel_ebi_resume(struct device *dev) --=20 2.35.1 From nobody Thu May 14 08:55:39 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 243DAC3527D for ; Mon, 18 Apr 2022 13:28:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243894AbiDRN3O (ORCPT ); Mon, 18 Apr 2022 09:29:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241039AbiDRNF2 (ORCPT ); Mon, 18 Apr 2022 09:05:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 144CC340DF; Mon, 18 Apr 2022 05:46: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 C3C8CB80D9C; Mon, 18 Apr 2022 12:46:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FDB1C385A1; Mon, 18 Apr 2022 12:46:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650285966; bh=WCzbYXy4QZE2nwEmpkErlYrqjEZkOGv7yFIJP1eHRAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eTn6U4/TUa46/S82Z4iO/iUpeEmzQRwIhttD6wI2G0aVo8bAtFYYaTpfrgVfXPCom PyLLTiNaL6JQUpMgU9ueY1IaAB9cEg4a1rQKSZRbeff5IVBrhmFA2WomIVbWpCT9Ok 2kuwrQRwOyzlP94I5gDYWwuIWXUfkDhpqD0Dt/nU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vlad Buslov , Jiri Pirko , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 02/32] net/sched: flower: fix parsing of ethertype following VLAN header Date: Mon, 18 Apr 2022 14:13:42 +0200 Message-Id: <20220418121127.200329057@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: Vlad Buslov [ Upstream commit 2105f700b53c24aa48b65c15652acc386044d26a ] A tc flower filter matching TCA_FLOWER_KEY_VLAN_ETH_TYPE is expected to match the L2 ethertype following the first VLAN header, as confirmed by linked discussion with the maintainer. However, such rule also matches packets that have additional second VLAN header, even though filter has both eth_type and vlan_ethtype set to "ipv4". Looking at the code this seems to be mostly an artifact of the way flower uses flow dissector. First, even though looking at the uAPI eth_type and vlan_ethtype appear like a distinct fields, in flower they are all mapped to the same key->basic.n_proto. Second, flow dissector skips following VLAN header as no keys for FLOW_DISSECTOR_KEY_CVLAN are set and eventually assigns the value of n_proto to last parsed header. With these, such filters ignore any headers present between first VLAN header and first "non magic" header (ipv4 in this case) that doesn't result FLOW_DISSECT_RET_PROTO_AGAIN. Fix the issue by extending flow dissector VLAN key structure with new 'vlan_eth_type' field that matches first ethertype following previously parsed VLAN header. Modify flower classifier to set the new flow_dissector_key_vlan->vlan_eth_type with value obtained from TCA_FLOWER_KEY_VLAN_ETH_TYPE/TCA_FLOWER_KEY_CVLAN_ETH_TYPE uAPIs. Link: https://lore.kernel.org/all/Yjhgi48BpTGh6dig@nanopsycho/ Fixes: 9399ae9a6cb2 ("net_sched: flower: Add vlan support") Fixes: d64efd0926ba ("net/sched: flower: Add supprt for matching on QinQ vl= an headers") Signed-off-by: Vlad Buslov Reviewed-by: Jiri Pirko Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- include/net/flow_dissector.h | 2 ++ net/core/flow_dissector.c | 1 + net/sched/cls_flower.c | 18 +++++++++++++----- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h index 99f8580344d0..01229084b3ed 100644 --- a/include/net/flow_dissector.h +++ b/include/net/flow_dissector.h @@ -50,6 +50,8 @@ struct flow_dissector_key_vlan { u16 vlan_id:12, vlan_priority:3; __be16 vlan_tpid; + __be16 vlan_eth_type; + u16 padding; }; =20 struct flow_dissector_key_mpls { diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 949694c70cbc..da860a680256 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -827,6 +827,7 @@ bool __skb_flow_dissect(const struct sk_buff *skb, VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT; } key_vlan->vlan_tpid =3D saved_vlan_tpid; + key_vlan->vlan_eth_type =3D proto; } =20 fdret =3D FLOW_DISSECT_RET_PROTO_AGAIN; diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index 208436eb107c..6163648145c1 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c @@ -554,6 +554,7 @@ static int fl_set_key_mpls(struct nlattr **tb, static void fl_set_key_vlan(struct nlattr **tb, __be16 ethertype, int vlan_id_key, int vlan_prio_key, + int vlan_next_eth_type_key, struct flow_dissector_key_vlan *key_val, struct flow_dissector_key_vlan *key_mask) { @@ -572,6 +573,11 @@ static void fl_set_key_vlan(struct nlattr **tb, } key_val->vlan_tpid =3D ethertype; key_mask->vlan_tpid =3D cpu_to_be16(~0); + if (tb[vlan_next_eth_type_key]) { + key_val->vlan_eth_type =3D + nla_get_be16(tb[vlan_next_eth_type_key]); + key_mask->vlan_eth_type =3D cpu_to_be16(~0); + } } =20 static void fl_set_key_flag(u32 flower_key, u32 flower_mask, @@ -801,8 +807,9 @@ static int fl_set_key(struct net *net, struct nlattr **= tb, =20 if (eth_type_vlan(ethertype)) { fl_set_key_vlan(tb, ethertype, TCA_FLOWER_KEY_VLAN_ID, - TCA_FLOWER_KEY_VLAN_PRIO, &key->vlan, - &mask->vlan); + TCA_FLOWER_KEY_VLAN_PRIO, + TCA_FLOWER_KEY_VLAN_ETH_TYPE, + &key->vlan, &mask->vlan); =20 if (tb[TCA_FLOWER_KEY_VLAN_ETH_TYPE]) { ethertype =3D nla_get_be16(tb[TCA_FLOWER_KEY_VLAN_ETH_TYPE]); @@ -810,6 +817,7 @@ static int fl_set_key(struct net *net, struct nlattr **= tb, fl_set_key_vlan(tb, ethertype, TCA_FLOWER_KEY_CVLAN_ID, TCA_FLOWER_KEY_CVLAN_PRIO, + TCA_FLOWER_KEY_CVLAN_ETH_TYPE, &key->cvlan, &mask->cvlan); fl_set_key_val(tb, &key->basic.n_proto, TCA_FLOWER_KEY_CVLAN_ETH_TYPE, @@ -1717,13 +1725,13 @@ static int fl_dump_key(struct sk_buff *skb, struct = net *net, goto nla_put_failure; =20 if (mask->basic.n_proto) { - if (mask->cvlan.vlan_tpid) { + if (mask->cvlan.vlan_eth_type) { if (nla_put_be16(skb, TCA_FLOWER_KEY_CVLAN_ETH_TYPE, key->basic.n_proto)) goto nla_put_failure; - } else if (mask->vlan.vlan_tpid) { + } else if (mask->vlan.vlan_eth_type) { if (nla_put_be16(skb, TCA_FLOWER_KEY_VLAN_ETH_TYPE, - key->basic.n_proto)) + key->vlan.vlan_eth_type)) goto nla_put_failure; } } --=20 2.35.1 From nobody Thu May 14 08:55:39 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 79866C3527E for ; Mon, 18 Apr 2022 13:28:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244039AbiDRN3z (ORCPT ); Mon, 18 Apr 2022 09:29:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241069AbiDRNF2 (ORCPT ); Mon, 18 Apr 2022 09:05:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E641340E6; Mon, 18 Apr 2022 05:46:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1E697B80E44; Mon, 18 Apr 2022 12:46:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EDD6C385A1; Mon, 18 Apr 2022 12:46:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650285981; bh=GEUZwU1+OofwnIqaqCFJ4mK78qVbnAHx4M3E9BKheew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LSbOdhr/wEJaaZtpAY+oX3QkR1OMZJTGJ8zgOd1RaY0ju4dwKkTS7nK7fqWWB4c7C vOozQkmQfp9yN0G9+2uVGlEuDcOscZ81puMlFJrtCQXeBq66cGTP+yicmVIp21SoWo O6PtmCAfMQPxJVmoSP9CihgOBE+ksHJUysdofAFc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guillaume Nault , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 03/32] veth: Ensure eth header is in skbs linear part Date: Mon, 18 Apr 2022 14:13:43 +0200 Message-Id: <20220418121127.228153394@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: Guillaume Nault [ Upstream commit 726e2c5929de841fdcef4e2bf995680688ae1b87 ] After feeding a decapsulated packet to a veth device with act_mirred, skb_headlen() may be 0. But veth_xmit() calls __dev_forward_skb(), which expects at least ETH_HLEN byte of linear data (as __dev_forward_skb2() calls eth_type_trans(), which pulls ETH_HLEN bytes unconditionally). Use pskb_may_pull() to ensure veth_xmit() respects this constraint. kernel BUG at include/linux/skbuff.h:2328! RIP: 0010:eth_type_trans+0xcf/0x140 Call Trace: __dev_forward_skb2+0xe3/0x160 veth_xmit+0x6e/0x250 [veth] dev_hard_start_xmit+0xc7/0x200 __dev_queue_xmit+0x47f/0x520 ? skb_ensure_writable+0x85/0xa0 ? skb_mpls_pop+0x98/0x1c0 tcf_mirred_act+0x442/0x47e [act_mirred] tcf_action_exec+0x86/0x140 fl_classify+0x1d8/0x1e0 [cls_flower] ? dma_pte_clear_level+0x129/0x1a0 ? dma_pte_clear_level+0x129/0x1a0 ? prb_fill_curr_block+0x2f/0xc0 ? skb_copy_bits+0x11a/0x220 __tcf_classify+0x58/0x110 tcf_classify_ingress+0x6b/0x140 __netif_receive_skb_core.constprop.0+0x47d/0xfd0 ? __iommu_dma_unmap_swiotlb+0x44/0x90 __netif_receive_skb_one_core+0x3d/0xa0 netif_receive_skb+0x116/0x170 be_process_rx+0x22f/0x330 [be2net] be_poll+0x13c/0x370 [be2net] __napi_poll+0x2a/0x170 net_rx_action+0x22f/0x2f0 __do_softirq+0xca/0x2a8 __irq_exit_rcu+0xc1/0xe0 common_interrupt+0x83/0xa0 Fixes: e314dbdc1c0d ("[NET]: Virtual ethernet device driver.") Signed-off-by: Guillaume Nault Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/veth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/veth.c b/drivers/net/veth.c index 76e834ca54e7..ea999a663933 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c @@ -188,7 +188,7 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struc= t net_device *dev) =20 rcu_read_lock(); rcv =3D rcu_dereference(priv->peer); - if (unlikely(!rcv)) { + if (unlikely(!rcv) || !pskb_may_pull(skb, ETH_HLEN)) { kfree_skb(skb); goto drop; } --=20 2.35.1 From nobody Thu May 14 08:55:39 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 AC0F2C433FE for ; Mon, 18 Apr 2022 13:28:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240744AbiDRNbO (ORCPT ); Mon, 18 Apr 2022 09:31:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241071AbiDRNF2 (ORCPT ); Mon, 18 Apr 2022 09:05:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61042340E8; Mon, 18 Apr 2022 05:46:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 258F0B80E44; Mon, 18 Apr 2022 12:46:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 867D5C385A1; Mon, 18 Apr 2022 12:46:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650285985; bh=9XKXzyrtWXOZdWGEu+wkDPOgdSs9WB4Lo30G4Sm5GvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=moeM2Fyzl3nrbNC/4sLqYySnmI+AdtgsSuJTjfYvh50Ks7rIfAPfeY6gYK4ZHCfzN kbUVB4m4MOfW+JwV/4/72NoOJS7BZ5UE3CZj50slA+4eLP4IQslggPulzoetlrxh1f ozHcKldOCydbie9inrDAnS8Zq0WNJXQgV/XDQ/3g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Torvalds , Andy Shevchenko , Sasha Levin Subject: [PATCH 4.19 04/32] gpiolib: acpi: use correct format characters Date: Mon, 18 Apr 2022 14:13:44 +0200 Message-Id: <20220418121127.256386009@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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 213d266ebfb1621aab79cfe63388facc520a1381 ] When compiling with -Wformat, clang emits the following warning: gpiolib-acpi.c:393:4: warning: format specifies type 'unsigned char' but = the argument has type 'int' [-Wformat] pin); ^~~ So warning that '%hhX' is paired with an 'int' is all just completely mindless and wrong. Sadly, I can see a different bogus warning reason why people would want to use '%02hhX'. Again, the *sane* thing from a human perspective is to use '%02X. But if the compiler doesn't do any range analysis at all, it could decide that "Oh, that print format could need up to 8 bytes of space in the result". Using '%02hhX' would cut that down to two. And since we use char ev_name[5]; and currently use "_%c%02hhX" as the format string, even a compiler that doesn't notice that "pin <=3D 255" test that guards this all will go "OK, that's at most 4 bytes and the final NUL termination, so it's fine". While a compiler - like gcc - that only sees that the original source of the 'pin' value is a 'unsigned short' array, and then doesn't take the "pin <=3D 255" into account, will warn like this: gpiolib-acpi.c: In function 'acpi_gpiochip_request_interrupt': gpiolib-acpi.c:206:24: warning: '%02X' directive writing between 2 and 4 = bytes into a region of size 3 [-Wformat-overflow=3D] sprintf(ev_name, "_%c%02X", ^~~~ gpiolib-acpi.c:206:20: note: directive argument in the range [0, 65535] because gcc isn't being very good at that argument range analysis either. In other words, the original use of 'hhx' was bogus to begin with, and due to *another* compiler warning being bad, and we had that bad code being written back in 2016 to work around _that_ compiler warning (commit e40a3ae1f794: "gpio: acpi: work around false-positive -Wstring-overflow warning"). Sadly, two different bad compiler warnings together does not make for one good one. It just makes for even more pain. End result: I think the simplest and cleanest option is simply the proposed change which undoes that '%hhX' change for gcc, and replaces it with just using a slightly bigger stack allocation. It's not like a 5-byte allocation is in any way likely to have saved any actual stack, since all the other variables in that function are 'int' or bigger. False-positive compiler warnings really do make people write worse code, and that's a problem. But on a scale of bad code, I feel that extending the buffer trivially is better than adding a pointless cast that literally makes no sense. At least in this case the end result isn't unreadable or buggy. We've had several cases of bad compiler warnings that caused changes that were actually horrendously wrong. Fixes: e40a3ae1f794 ("gpio: acpi: work around false-positive -Wstring-overf= low warning") Signed-off-by: Linus Torvalds Signed-off-by: Andy Shevchenko Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/gpio/gpiolib-acpi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 47cdc1f89e3f..6afe833031e3 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -278,8 +278,8 @@ static acpi_status acpi_gpiochip_alloc_event(struct acp= i_resource *ares, pin =3D agpio->pin_table[0]; =20 if (pin <=3D 255) { - char ev_name[5]; - sprintf(ev_name, "_%c%02hhX", + char ev_name[8]; + sprintf(ev_name, "_%c%02X", agpio->triggering =3D=3D ACPI_EDGE_SENSITIVE ? 'E' : 'L', pin); if (ACPI_SUCCESS(acpi_get_handle(handle, ev_name, &evt_handle))) --=20 2.35.1 From nobody Thu May 14 08:55:39 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 D7895C4332F for ; Mon, 18 Apr 2022 13:28:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240582AbiDRNb1 (ORCPT ); Mon, 18 Apr 2022 09:31:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240591AbiDRNFh (ORCPT ); Mon, 18 Apr 2022 09:05:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9618629CB9; Mon, 18 Apr 2022 05:46: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 53A13B80E4B; Mon, 18 Apr 2022 12:46:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D19BC385A1; Mon, 18 Apr 2022 12:46:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650285988; bh=YYLuu5NjY4uaMIVTDNevuujgq4FvzW1hDJ2d+Dha7H4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VZHrH9++yFcpQA9lhQRkyDOtDEd/1JhJdHOxv3YGkqVG+62xgWSarTUeyKCEnZYir x64EsL+CunRtSKUzbhhNTGfVRcpCpWee2sWXehI2A82Yu/1yomHawrHmqXVRELvxea IbuDtREPVDIiCatRZmSAtG9Ct3AmIAr9JgDgsnB0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vadim Pasternak , Ido Schimmel , Jakub Kicinski , Sasha Levin Subject: [PATCH 4.19 05/32] mlxsw: i2c: Fix initialization error flow Date: Mon, 18 Apr 2022 14:13:45 +0200 Message-Id: <20220418121127.284611032@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: Vadim Pasternak [ Upstream commit d452088cdfd5a4ad9d96d847d2273fe958d6339b ] Add mutex_destroy() call in driver initialization error flow. Fixes: 6882b0aee180f ("mlxsw: Introduce support for I2C bus") Signed-off-by: Vadim Pasternak Signed-off-by: Ido Schimmel Link: https://lore.kernel.org/r/20220407070703.2421076-1-idosch@nvidia.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/ethernet/mellanox/mlxsw/i2c.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/i2c.c b/drivers/net/ethern= et/mellanox/mlxsw/i2c.c index 798bd5aca384..1d1025fd2d88 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/i2c.c +++ b/drivers/net/ethernet/mellanox/mlxsw/i2c.c @@ -516,6 +516,7 @@ static int mlxsw_i2c_probe(struct i2c_client *client, return 0; =20 errout: + mutex_destroy(&mlxsw_i2c->cmd.lock); i2c_set_clientdata(client, NULL); =20 return err; --=20 2.35.1 From nobody Thu May 14 08:55:39 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 BA767C433EF for ; Mon, 18 Apr 2022 13:29:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241908AbiDRNbp (ORCPT ); Mon, 18 Apr 2022 09:31:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240949AbiDRNFj (ORCPT ); Mon, 18 Apr 2022 09:05:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CCD529CBB; Mon, 18 Apr 2022 05:46:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2019CB80E44; Mon, 18 Apr 2022 12:46:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EFBCC385A7; Mon, 18 Apr 2022 12:46:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650285990; bh=PIKSrYrmqMtZ8E664NQk1+Mn3l/xkzBH+ARjWDPYrzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZMJ62DDQsPJztoZ5KpUl5fe/NpDmrqa80Gq8ixXkGRys6PIb/2PSHtfSatb5Bp8dE 7EN+Wpm53Jd24ZLX0xmx1UhgVn+0qIGPIufcXWmZD4U/qtxJqykzMZOKsRpnsRdfco o/CESniF7XedclwPkKC7Bgm6NC6vhypwQeK4o9Oc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinh Nguyen , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 06/32] net: ethernet: stmmac: fix altr_tse_pcs function when using a fixed-link Date: Mon, 18 Apr 2022 14:13:46 +0200 Message-Id: <20220418121127.313985949@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: Dinh Nguyen [ Upstream commit a6aaa00324240967272b451bfa772547bd576ee6 ] When using a fixed-link, the altr_tse_pcs driver crashes due to null-pointer dereference as no phy_device is provided to tse_pcs_fix_mac_speed function. Fix this by adding a check for phy_dev before calling the tse_pcs_fix_mac_speed() function. Also clean up the tse_pcs_fix_mac_speed function a bit. There is no need to check for splitter_base and sgmii_adapter_base because the driver will fail if these 2 variables are not derived from the device tree. Fixes: fb3bbdb85989 ("net: ethernet: Add TSE PCS support to dwmac-socfpga") Signed-off-by: Dinh Nguyen Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.c | 8 -------- drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.h | 4 ++++ drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 13 +++++-------- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.c b/drivers/n= et/ethernet/stmicro/stmmac/altr_tse_pcs.c index 8b50afcdb52d..729df169faa2 100644 --- a/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.c +++ b/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.c @@ -68,10 +68,6 @@ #define TSE_PCS_USE_SGMII_ENA BIT(0) #define TSE_PCS_IF_USE_SGMII 0x03 =20 -#define SGMII_ADAPTER_CTRL_REG 0x00 -#define SGMII_ADAPTER_DISABLE 0x0001 -#define SGMII_ADAPTER_ENABLE 0x0000 - #define AUTONEGO_LINK_TIMER 20 =20 static int tse_pcs_reset(void __iomem *base, struct tse_pcs *pcs) @@ -213,12 +209,8 @@ void tse_pcs_fix_mac_speed(struct tse_pcs *pcs, struct= phy_device *phy_dev, unsigned int speed) { void __iomem *tse_pcs_base =3D pcs->tse_pcs_base; - void __iomem *sgmii_adapter_base =3D pcs->sgmii_adapter_base; u32 val; =20 - writew(SGMII_ADAPTER_ENABLE, - sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG); - pcs->autoneg =3D phy_dev->autoneg; =20 if (phy_dev->autoneg =3D=3D AUTONEG_ENABLE) { diff --git a/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.h b/drivers/n= et/ethernet/stmicro/stmmac/altr_tse_pcs.h index 2f5882450b06..254199f2efdb 100644 --- a/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.h +++ b/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.h @@ -21,6 +21,10 @@ #include #include =20 +#define SGMII_ADAPTER_CTRL_REG 0x00 +#define SGMII_ADAPTER_ENABLE 0x0000 +#define SGMII_ADAPTER_DISABLE 0x0001 + struct tse_pcs { struct device *dev; void __iomem *tse_pcs_base; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/= net/ethernet/stmicro/stmmac/dwmac-socfpga.c index 33407df6bea6..32ead4a4b460 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c @@ -29,9 +29,6 @@ =20 #include "altr_tse_pcs.h" =20 -#define SGMII_ADAPTER_CTRL_REG 0x00 -#define SGMII_ADAPTER_DISABLE 0x0001 - #define SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII 0x0 #define SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_RGMII 0x1 #define SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_RMII 0x2 @@ -65,16 +62,14 @@ static void socfpga_dwmac_fix_mac_speed(void *priv, uns= igned int speed) { struct socfpga_dwmac *dwmac =3D (struct socfpga_dwmac *)priv; void __iomem *splitter_base =3D dwmac->splitter_base; - void __iomem *tse_pcs_base =3D dwmac->pcs.tse_pcs_base; void __iomem *sgmii_adapter_base =3D dwmac->pcs.sgmii_adapter_base; struct device *dev =3D dwmac->dev; struct net_device *ndev =3D dev_get_drvdata(dev); struct phy_device *phy_dev =3D ndev->phydev; u32 val; =20 - if ((tse_pcs_base) && (sgmii_adapter_base)) - writew(SGMII_ADAPTER_DISABLE, - sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG); + writew(SGMII_ADAPTER_DISABLE, + sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG); =20 if (splitter_base) { val =3D readl(splitter_base + EMAC_SPLITTER_CTRL_REG); @@ -96,7 +91,9 @@ static void socfpga_dwmac_fix_mac_speed(void *priv, unsig= ned int speed) writel(val, splitter_base + EMAC_SPLITTER_CTRL_REG); } =20 - if (tse_pcs_base && sgmii_adapter_base) + writew(SGMII_ADAPTER_ENABLE, + sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG); + if (phy_dev) tse_pcs_fix_mac_speed(&dwmac->pcs, phy_dev, speed); } =20 --=20 2.35.1 From nobody Thu May 14 08:55:39 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 9FAC1C433F5 for ; Mon, 18 Apr 2022 13:29:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241698AbiDRNbd (ORCPT ); Mon, 18 Apr 2022 09:31:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239002AbiDRNFm (ORCPT ); Mon, 18 Apr 2022 09:05:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B38F829CBF; Mon, 18 Apr 2022 05:46:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4E28F60FB6; Mon, 18 Apr 2022 12:46:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DFE7C385A7; Mon, 18 Apr 2022 12:46:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650285993; bh=olGAV6P3/bdfp4ZsB1dE9ZnWfbk+IEVsCX5kp+ufGzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VzOUlG60u7Ot0u6pnAKe8f1OnMLMpdIC/QUfzX2t3XngKdTiH8x8sTcCpBy6otHBu 0ryFqfYU9IJm8z15FZpqcoRdlu3i4yEb5NX2bnC2ta5tfwokmUPRj7W1rkC/HtYaak w+7t2WdEV/4wyaAK+owjU6J4XHDRp9YxGKZE04p4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Petr Malat , Marcelo Ricardo Leitner , Jakub Kicinski , Sasha Levin Subject: [PATCH 4.19 07/32] sctp: Initialize daddr on peeled off socket Date: Mon, 18 Apr 2022 14:13:47 +0200 Message-Id: <20220418121127.343178003@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: Petr Malat [ Upstream commit 8467dda0c26583547731e7f3ea73fc3856bae3bf ] Function sctp_do_peeloff() wrongly initializes daddr of the original socket instead of the peeled off socket, which makes getpeername() return zeroes instead of the primary address. Initialize the new socket instead. Fixes: d570ee490fb1 ("[SCTP]: Correctly set daddr for IPv6 sockets during p= eeloff") Signed-off-by: Petr Malat Acked-by: Marcelo Ricardo Leitner Link: https://lore.kernel.org/r/20220409063611.673193-1-oss@malat.biz Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- net/sctp/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sctp/socket.c b/net/sctp/socket.c index d429d5922804..8901bb7afa2b 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -5333,7 +5333,7 @@ int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id,= struct socket **sockp) * Set the daddr and initialize id to something more random and also * copy over any ip options. */ - sp->pf->to_sk_daddr(&asoc->peer.primary_addr, sk); + sp->pf->to_sk_daddr(&asoc->peer.primary_addr, sock->sk); sp->pf->copy_ip_options(sk, sock->sk); =20 /* Populate the fields of the newsk from the oldsk and migrate the --=20 2.35.1 From nobody Thu May 14 08:55:39 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 8749CC43217 for ; Mon, 18 Apr 2022 13:32:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242116AbiDRNcb (ORCPT ); Mon, 18 Apr 2022 09:32:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238742AbiDRNFp (ORCPT ); Mon, 18 Apr 2022 09:05:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D7922A240; Mon, 18 Apr 2022 05:46:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 395806124A; Mon, 18 Apr 2022 12:46:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49677C385A7; Mon, 18 Apr 2022 12:46:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650285996; bh=xb0hS4BrdUP+xSIwy3hBDuYk5Yqiydpc9Eeeprbd1yE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FRa1FF2+8ERyePHg250v1YPFfQqy69lbyJkDejfXo+3XHbaRPft6fTH7fNp/k9Tjq Pdgd8QQDXe7xRU+QA3GcrghwJqlGDVc5XbYCNIcz9L//jDVCxm3x3kq/cZRbcAogDR gkrKTouIWQe0zYQijlshOSByUzxcoHWzNL3h3cSQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Athira Rajeev , Shuah Khan , Sasha Levin Subject: [PATCH 4.19 08/32] testing/selftests/mqueue: Fix mq_perf_tests to free the allocated cpu set Date: Mon, 18 Apr 2022 14:13:48 +0200 Message-Id: <20220418121127.371185312@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: Athira Rajeev [ Upstream commit ce64763c63854b4079f2e036638aa881a1fb3fbc ] The selftest "mqueue/mq_perf_tests.c" use CPU_ALLOC to allocate CPU set. This cpu set is used further in pthread_attr_setaffinity_np and by pthread_create in the code. But in current code, allocated cpu set is not freed. Fix this issue by adding CPU_FREE in the "shutdown" function which is called in most of the error/exit path for the cleanup. There are few error paths which exit without using shutdown. Add a common goto error path with CPU_FREE for these cases. Fixes: 7820b0715b6f ("tools/selftests: add mq_perf_tests") Signed-off-by: Athira Rajeev Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- .../testing/selftests/mqueue/mq_perf_tests.c | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/mqueue/mq_perf_tests.c b/tools/testing= /selftests/mqueue/mq_perf_tests.c index b019e0b8221c..84fda3b49073 100644 --- a/tools/testing/selftests/mqueue/mq_perf_tests.c +++ b/tools/testing/selftests/mqueue/mq_perf_tests.c @@ -180,6 +180,9 @@ void shutdown(int exit_val, char *err_cause, int line_n= o) if (in_shutdown++) return; =20 + /* Free the cpu_set allocated using CPU_ALLOC in main function */ + CPU_FREE(cpu_set); + for (i =3D 0; i < num_cpus_to_pin; i++) if (cpu_threads[i]) { pthread_kill(cpu_threads[i], SIGUSR1); @@ -551,6 +554,12 @@ int main(int argc, char *argv[]) perror("sysconf(_SC_NPROCESSORS_ONLN)"); exit(1); } + + if (getuid() !=3D 0) + ksft_exit_skip("Not running as root, but almost all tests " + "require root in order to modify\nsystem settings. " + "Exiting.\n"); + cpus_online =3D min(MAX_CPUS, sysconf(_SC_NPROCESSORS_ONLN)); cpu_set =3D CPU_ALLOC(cpus_online); if (cpu_set =3D=3D NULL) { @@ -589,7 +598,7 @@ int main(int argc, char *argv[]) cpu_set)) { fprintf(stderr, "Any given CPU may " "only be given once.\n"); - exit(1); + goto err_code; } else CPU_SET_S(cpus_to_pin[cpu], cpu_set_size, cpu_set); @@ -607,7 +616,7 @@ int main(int argc, char *argv[]) queue_path =3D malloc(strlen(option) + 2); if (!queue_path) { perror("malloc()"); - exit(1); + goto err_code; } queue_path[0] =3D '/'; queue_path[1] =3D 0; @@ -622,17 +631,12 @@ int main(int argc, char *argv[]) fprintf(stderr, "Must pass at least one CPU to continuous " "mode.\n"); poptPrintUsage(popt_context, stderr, 0); - exit(1); + goto err_code; } else if (!continuous_mode) { num_cpus_to_pin =3D 1; cpus_to_pin[0] =3D cpus_online - 1; } =20 - if (getuid() !=3D 0) - ksft_exit_skip("Not running as root, but almost all tests " - "require root in order to modify\nsystem settings. " - "Exiting.\n"); - max_msgs =3D fopen(MAX_MSGS, "r+"); max_msgsize =3D fopen(MAX_MSGSIZE, "r+"); if (!max_msgs) @@ -740,4 +744,9 @@ int main(int argc, char *argv[]) sleep(1); } shutdown(0, "", 0); + +err_code: + CPU_FREE(cpu_set); + exit(1); + } --=20 2.35.1 From nobody Thu May 14 08:55:39 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 2F970C433EF for ; Mon, 18 Apr 2022 13:29:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242082AbiDRNcR (ORCPT ); Mon, 18 Apr 2022 09:32:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239507AbiDRNFp (ORCPT ); Mon, 18 Apr 2022 09:05:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3CE729CB5; Mon, 18 Apr 2022 05:46:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5EC9660FB6; Mon, 18 Apr 2022 12:46:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51E01C385A7; Mon, 18 Apr 2022 12:46:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650285999; bh=gEhd9SIx2dQ77qkb2YCf5p7Rcp+rG4I7/rBY2UZDcgA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=icok8PLV7IjmEjwIGAgnBIZwF+QOAwq0EGlUk65BlIjSc/7pQHF0k/anbTr4iWIuG J0PG2x7IwgV8/XFaTiaSxM5Tf5SrZuz0l0uz4ZPBsdcQnnxBUoony5poKwSDKM79MO Uu+3m8DQGEL/9i4oTBXy12w3xYy4NG4OZqU0ZWSs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lin Ma , Krzysztof Kozlowski , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 09/32] nfc: nci: add flush_workqueue to prevent uaf Date: Mon, 18 Apr 2022 14:13:49 +0200 Message-Id: <20220418121127.399707232@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: Lin Ma [ Upstream commit ef27324e2cb7bb24542d6cb2571740eefe6b00dc ] Our detector found a concurrent use-after-free bug when detaching an NCI device. The main reason for this bug is the unexpected scheduling between the used delayed mechanism (timer and workqueue). The race can be demonstrated below: Thread-1 Thread-2 | nci_dev_up() | nci_open_device() | __nci_request(nci_reset_req) | nci_send_cmd | queue_work(cmd_work) nci_unregister_device() | nci_close_device() | ... del_timer_sync(cmd_timer)[1] | ... | Worker nci_free_device() | nci_cmd_work() kfree(ndev)[3] | mod_timer(cmd_timer)[2] In short, the cleanup routine thought that the cmd_timer has already been detached by [1] but the mod_timer can re-attach the timer [2], even it is already released [3], resulting in UAF. This UAF is easy to trigger, crash trace by POC is like below [ 66.703713] =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D [ 66.703974] BUG: KASAN: use-after-free in enqueue_timer+0x448/0x490 [ 66.703974] Write of size 8 at addr ffff888009fb7058 by task kworker/u4:= 1/33 [ 66.703974] [ 66.703974] CPU: 1 PID: 33 Comm: kworker/u4:1 Not tainted 5.18.0-rc2 #5 [ 66.703974] Workqueue: nfc2_nci_cmd_wq nci_cmd_work [ 66.703974] Call Trace: [ 66.703974] [ 66.703974] dump_stack_lvl+0x57/0x7d [ 66.703974] print_report.cold+0x5e/0x5db [ 66.703974] ? enqueue_timer+0x448/0x490 [ 66.703974] kasan_report+0xbe/0x1c0 [ 66.703974] ? enqueue_timer+0x448/0x490 [ 66.703974] enqueue_timer+0x448/0x490 [ 66.703974] __mod_timer+0x5e6/0xb80 [ 66.703974] ? mark_held_locks+0x9e/0xe0 [ 66.703974] ? try_to_del_timer_sync+0xf0/0xf0 [ 66.703974] ? lockdep_hardirqs_on_prepare+0x17b/0x410 [ 66.703974] ? queue_work_on+0x61/0x80 [ 66.703974] ? lockdep_hardirqs_on+0xbf/0x130 [ 66.703974] process_one_work+0x8bb/0x1510 [ 66.703974] ? lockdep_hardirqs_on_prepare+0x410/0x410 [ 66.703974] ? pwq_dec_nr_in_flight+0x230/0x230 [ 66.703974] ? rwlock_bug.part.0+0x90/0x90 [ 66.703974] ? _raw_spin_lock_irq+0x41/0x50 [ 66.703974] worker_thread+0x575/0x1190 [ 66.703974] ? process_one_work+0x1510/0x1510 [ 66.703974] kthread+0x2a0/0x340 [ 66.703974] ? kthread_complete_and_exit+0x20/0x20 [ 66.703974] ret_from_fork+0x22/0x30 [ 66.703974] [ 66.703974] [ 66.703974] Allocated by task 267: [ 66.703974] kasan_save_stack+0x1e/0x40 [ 66.703974] __kasan_kmalloc+0x81/0xa0 [ 66.703974] nci_allocate_device+0xd3/0x390 [ 66.703974] nfcmrvl_nci_register_dev+0x183/0x2c0 [ 66.703974] nfcmrvl_nci_uart_open+0xf2/0x1dd [ 66.703974] nci_uart_tty_ioctl+0x2c3/0x4a0 [ 66.703974] tty_ioctl+0x764/0x1310 [ 66.703974] __x64_sys_ioctl+0x122/0x190 [ 66.703974] do_syscall_64+0x3b/0x90 [ 66.703974] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 66.703974] [ 66.703974] Freed by task 406: [ 66.703974] kasan_save_stack+0x1e/0x40 [ 66.703974] kasan_set_track+0x21/0x30 [ 66.703974] kasan_set_free_info+0x20/0x30 [ 66.703974] __kasan_slab_free+0x108/0x170 [ 66.703974] kfree+0xb0/0x330 [ 66.703974] nfcmrvl_nci_unregister_dev+0x90/0xd0 [ 66.703974] nci_uart_tty_close+0xdf/0x180 [ 66.703974] tty_ldisc_kill+0x73/0x110 [ 66.703974] tty_ldisc_hangup+0x281/0x5b0 [ 66.703974] __tty_hangup.part.0+0x431/0x890 [ 66.703974] tty_release+0x3a8/0xc80 [ 66.703974] __fput+0x1f0/0x8c0 [ 66.703974] task_work_run+0xc9/0x170 [ 66.703974] exit_to_user_mode_prepare+0x194/0x1a0 [ 66.703974] syscall_exit_to_user_mode+0x19/0x50 [ 66.703974] do_syscall_64+0x48/0x90 [ 66.703974] entry_SYSCALL_64_after_hwframe+0x44/0xae To fix the UAF, this patch adds flush_workqueue() to ensure the nci_cmd_work is finished before the following del_timer_sync. This combination will promise the timer is actually detached. Fixes: 6a2968aaf50c ("NFC: basic NCI protocol implementation") Signed-off-by: Lin Ma Reviewed-by: Krzysztof Kozlowski Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- net/nfc/nci/core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c index 0e0dff72a9e4..0580e5326641 100644 --- a/net/nfc/nci/core.c +++ b/net/nfc/nci/core.c @@ -560,6 +560,10 @@ static int nci_close_device(struct nci_dev *ndev) mutex_lock(&ndev->req_lock); =20 if (!test_and_clear_bit(NCI_UP, &ndev->flags)) { + /* Need to flush the cmd wq in case + * there is a queued/running cmd_work + */ + flush_workqueue(ndev->cmd_wq); del_timer_sync(&ndev->cmd_timer); del_timer_sync(&ndev->data_timer); mutex_unlock(&ndev->req_lock); --=20 2.35.1 From nobody Thu May 14 08:55:39 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 0C998C4321E for ; Mon, 18 Apr 2022 13:28:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242685AbiDRN2b (ORCPT ); Mon, 18 Apr 2022 09:28:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241212AbiDRNFJ (ORCPT ); Mon, 18 Apr 2022 09:05:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B4F313F9F; Mon, 18 Apr 2022 05:45: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 26E26B80D9C; Mon, 18 Apr 2022 12:45:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84511C385A8; Mon, 18 Apr 2022 12:45:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650285935; bh=SKyYCMb0REIggMLEr92cYRgTEY/QtKz6kO9mArygnEc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=op0g1GIqzq0emYrPYebearEGzbRvuFqCwRa7blOZqhSka6ubCAAqKSDbN1rMzgHYL oGV5R2GnNYWnA+CSAWDg0WU1pu+FMMOav6T+i5eX9F+InAhApf1Hu5dJIA5mHwgrI7 74SVuqVKPYCV96rEoMhOt4KDpn4xeTy+g4JEGixU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Harshit Mogalapalli , Ronnie Sahlberg , Steve French , Sasha Levin Subject: [PATCH 4.19 10/32] cifs: potential buffer overflow in handling symlinks Date: Mon, 18 Apr 2022 14:13:50 +0200 Message-Id: <20220418121127.428713512@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: Harshit Mogalapalli [ Upstream commit 64c4a37ac04eeb43c42d272f6e6c8c12bfcf4304 ] Smatch printed a warning: arch/x86/crypto/poly1305_glue.c:198 poly1305_update_arch() error: __memcpy() 'dctx->buf' too small (16 vs u32max) It's caused because Smatch marks 'link_len' as untrusted since it comes from sscanf(). Add a check to ensure that 'link_len' is not larger than the size of the 'link_str' buffer. Fixes: c69c1b6eaea1 ("cifs: implement CIFSParseMFSymlink()") Signed-off-by: Harshit Mogalapalli Reviewed-by: Ronnie Sahlberg Signed-off-by: Steve French Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- fs/cifs/link.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/cifs/link.c b/fs/cifs/link.c index 2148b0f60e5e..5b1c33d9283a 100644 --- a/fs/cifs/link.c +++ b/fs/cifs/link.c @@ -97,6 +97,9 @@ parse_mf_symlink(const u8 *buf, unsigned int buf_len, uns= igned int *_link_len, if (rc !=3D 1) return -EINVAL; =20 + if (link_len > CIFS_MF_SYMLINK_LINK_MAXLEN) + return -EINVAL; + rc =3D symlink_hash(link_len, link_str, md5_hash); if (rc) { cifs_dbg(FYI, "%s: MD5 hash failure: %d\n", __func__, rc); --=20 2.35.1 From nobody Thu May 14 08:55:39 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 2B70DC4167E for ; Mon, 18 Apr 2022 13:28:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242762AbiDRN2k (ORCPT ); Mon, 18 Apr 2022 09:28:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241153AbiDRNFR (ORCPT ); Mon, 18 Apr 2022 09:05:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CBB220F57; Mon, 18 Apr 2022 05:45:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 49E80B80E44; Mon, 18 Apr 2022 12:45:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6E62C385A7; Mon, 18 Apr 2022 12:45:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650285939; bh=tGzXzQhqgL+alx1Q6zWeqj7q4zL1AuwH2it+jAec/5w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nTxCUhhB2KJxdjt0ZQLb/A1eYvIUn3BdrqxOSU/Cno2yPe3vU1f+seFbztk97JgWy fR5zz/NvIJyPROniSnhXiJdb9vwp+9OUOGxsIiaqbjsoWMPYR5Qj4kSAp7vmRXDlEy Z/yYBY5km2chPRCMaZ2njq0uyTYMWIS+vYQHL8uo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aurabindo Pillai , Alex Deucher , Sasha Levin Subject: [PATCH 4.19 11/32] drm/amd: Add USBC connector ID Date: Mon, 18 Apr 2022 14:13:51 +0200 Message-Id: <20220418121127.457909506@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: Aurabindo Pillai [ Upstream commit c5c948aa894a831f96fccd025e47186b1ee41615 ] [Why&How] Add a dedicated AMDGPU specific ID for use with newer ASICs that support USB-C output Signed-off-by: Aurabindo Pillai Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/gpu/drm/amd/amdgpu/ObjectID.h | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/amd/amdgpu/ObjectID.h b/drivers/gpu/drm/amd/am= dgpu/ObjectID.h index 5b393622f592..a0f0a17e224f 100644 --- a/drivers/gpu/drm/amd/amdgpu/ObjectID.h +++ b/drivers/gpu/drm/amd/amdgpu/ObjectID.h @@ -119,6 +119,7 @@ #define CONNECTOR_OBJECT_ID_eDP 0x14 #define CONNECTOR_OBJECT_ID_MXM 0x15 #define CONNECTOR_OBJECT_ID_LVDS_eDP 0x16 +#define CONNECTOR_OBJECT_ID_USBC 0x17 =20 /* deleted */ =20 --=20 2.35.1 From nobody Thu May 14 08:55:39 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 4A9EBC4167D for ; Mon, 18 Apr 2022 13:28:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242847AbiDRN2q (ORCPT ); Mon, 18 Apr 2022 09:28:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240744AbiDRNFR (ORCPT ); Mon, 18 Apr 2022 09:05:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3592340C5; Mon, 18 Apr 2022 05:45:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6EC61B80D9C; Mon, 18 Apr 2022 12:45:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0B03C385A1; Mon, 18 Apr 2022 12:45:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650285942; bh=tmI8DtT+P3Q0cz3cFyD1ov7gqSYR/gsjP5W2IKO1sgc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=spzAozREkbCEKar7rdk8kRFlBMz3RUFTf8hEL9PBR5nVnE5kD9cM9ncLYcvAvOt8x 45+kCl7kDolLotSC8Uyns1HEYrysS1oNapWIq37XwqLKziKnkjV3QjOZtyVT80WD2g 0IE5t2hJ62OsWHKXsmOMFGSr7KtnNB+JXu3aRgr0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, QintaoShen , Alex Deucher , Sasha Levin Subject: [PATCH 4.19 12/32] drm/amdkfd: Check for potential null return of kmalloc_array() Date: Mon, 18 Apr 2022 14:13:52 +0200 Message-Id: <20220418121127.486269842@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: QintaoShen [ Upstream commit ebbb7bb9e80305820dc2328a371c1b35679f2667 ] As the kmalloc_array() may return null, the 'event_waiters[i].wait' would l= ead to null-pointer dereference. Therefore, it is better to check the return value of kmalloc_array() to avo= id this confusion. Signed-off-by: QintaoShen Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/gpu/drm/amd/amdkfd/kfd_events.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_events.c b/drivers/gpu/drm/amd/= amdkfd/kfd_events.c index e9f0e0a1b41c..892077377339 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_events.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_events.c @@ -532,6 +532,8 @@ static struct kfd_event_waiter *alloc_event_waiters(uin= t32_t num_events) event_waiters =3D kmalloc_array(num_events, sizeof(struct kfd_event_waiter), GFP_KERNEL); + if (!event_waiters) + return NULL; =20 for (i =3D 0; (event_waiters) && (i < num_events) ; i++) { init_wait(&event_waiters[i].wait); --=20 2.35.1 From nobody Thu May 14 08:55:39 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 8E0ABC3525B for ; Mon, 18 Apr 2022 13:28:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243320AbiDRN2z (ORCPT ); Mon, 18 Apr 2022 09:28:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239762AbiDRNFS (ORCPT ); Mon, 18 Apr 2022 09:05:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BEE819017; Mon, 18 Apr 2022 05:45:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0671E6124D; Mon, 18 Apr 2022 12:45:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB30FC385A7; Mon, 18 Apr 2022 12:45:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650285945; bh=h7wCG4XjaYle+ieR3ESj44+7lHbRR0+fYce5PBuCF8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PVvEEHRY7u5ChLhf2rBwoBdhhBeikv3quzMxFrjGsbOOjuVYIfVVD437yrGIU/egK Us4NudR38hsoinGrc5dJVGecG5I55xwLDUHpOUWfPV/RiWM4/gSMJTpuw1ICgulZjk Qc16j5LEzeRxJ0AJUOrKC6+pUO08+Bbd/1NsrC1M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Kelley , "Andrea Parri (Microsoft)" , Wei Liu , Sasha Levin Subject: [PATCH 4.19 13/32] Drivers: hv: vmbus: Prevent load re-ordering when reading ring buffer Date: Mon, 18 Apr 2022 14:13:53 +0200 Message-Id: <20220418121127.515948805@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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 Kelley [ Upstream commit b6cae15b5710c8097aad26a2e5e752c323ee5348 ] When reading a packet from a host-to-guest ring buffer, there is no memory barrier between reading the write index (to see if there is a packet to read) and reading the contents of the packet. The Hyper-V host uses store-release when updating the write index to ensure that writes of the packet data are completed first. On the guest side, the processor can reorder and read the packet data before the write index, and sometimes get stale packet data. Getting such stale packet data has been observed in a reproducible case in a VM on ARM64. Fix this by using virt_load_acquire() to read the write index, ensuring that reads of the packet data cannot be reordered before it. Preventing such reordering is logically correct, and with this change, getting stale data can no longer be reproduced. Signed-off-by: Michael Kelley Reviewed-by: Andrea Parri (Microsoft) Link: https://lore.kernel.org/r/1648394710-33480-1-git-send-email-mikelley@= microsoft.com Signed-off-by: Wei Liu Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/hv/ring_buffer.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c index 6cb45f256107..d97b30af9e03 100644 --- a/drivers/hv/ring_buffer.c +++ b/drivers/hv/ring_buffer.c @@ -365,7 +365,16 @@ int hv_ringbuffer_read(struct vmbus_channel *channel, static u32 hv_pkt_iter_avail(const struct hv_ring_buffer_info *rbi) { u32 priv_read_loc =3D rbi->priv_read_index; - u32 write_loc =3D READ_ONCE(rbi->ring_buffer->write_index); + u32 write_loc; + + /* + * The Hyper-V host writes the packet data, then uses + * store_release() to update the write_index. Use load_acquire() + * here to prevent loads of the packet data from being re-ordered + * before the read of the write_index and potentially getting + * stale data. + */ + write_loc =3D virt_load_acquire(&rbi->ring_buffer->write_index); =20 if (write_loc >=3D priv_read_loc) return write_loc - priv_read_loc; --=20 2.35.1 From nobody Thu May 14 08:55:39 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 C3B5FC4321E for ; Mon, 18 Apr 2022 13:28:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243052AbiDRN2t (ORCPT ); Mon, 18 Apr 2022 09:28:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240938AbiDRNFT (ORCPT ); Mon, 18 Apr 2022 09:05:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 057FE340CE; Mon, 18 Apr 2022 05:45:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ACD28B80E44; Mon, 18 Apr 2022 12:45:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BCD6C385A1; Mon, 18 Apr 2022 12:45:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650285948; bh=o7YxnEC1EUE/sxcXqD6+pc915/hcy+Zkz6Z/qMlcCKE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=An3v5mY2Wx2IDqh0/+OSM+zaRBhTht+KjoHfYJf1DgHNr8Ck+4u5nYAfx7wmptmbI 4lXVOu/+tTje6QzCpSxAJq8ure8C15lYlc39p7ODtN50f3nRspkQJy1qvVxinBd6hR 9ZFOKIeV4SatBTNPtbNXTdHC7MUgItat5xjUm2uw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bodo Stroesser , Xiaoguang Wang , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.19 14/32] scsi: target: tcmu: Fix possible page UAF Date: Mon, 18 Apr 2022 14:13:54 +0200 Message-Id: <20220418121127.544542097@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: Xiaoguang Wang [ Upstream commit a6968f7a367f128d120447360734344d5a3d5336 ] tcmu_try_get_data_page() looks up pages under cmdr_lock, but it does not take refcount properly and just returns page pointer. When tcmu_try_get_data_page() returns, the returned page may have been freed by tcmu_blocks_release(). We need to get_page() under cmdr_lock to avoid concurrent tcmu_blocks_release(). Link: https://lore.kernel.org/r/20220311132206.24515-1-xiaoguang.wang@linux= .alibaba.com Reviewed-by: Bodo Stroesser Signed-off-by: Xiaoguang Wang Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/target/target_core_user.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core= _user.c index dd7307375504..f29d600357f3 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c @@ -1499,6 +1499,7 @@ static struct page *tcmu_try_get_block_page(struct tc= mu_dev *udev, uint32_t dbi) mutex_lock(&udev->cmdr_lock); page =3D tcmu_get_block_page(udev, dbi); if (likely(page)) { + get_page(page); mutex_unlock(&udev->cmdr_lock); return page; } @@ -1537,6 +1538,7 @@ static vm_fault_t tcmu_vma_fault(struct vm_fault *vmf) /* For the vmalloc()ed cmd area pages */ addr =3D (void *)(unsigned long)info->mem[mi].addr + offset; page =3D vmalloc_to_page(addr); + get_page(page); } else { uint32_t dbi; =20 @@ -1547,7 +1549,6 @@ static vm_fault_t tcmu_vma_fault(struct vm_fault *vmf) return VM_FAULT_SIGBUS; } =20 - get_page(page); vmf->page =3D page; return 0; } --=20 2.35.1 From nobody Thu May 14 08:55:39 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 69700C41535 for ; Mon, 18 Apr 2022 13:28:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243159AbiDRN2w (ORCPT ); Mon, 18 Apr 2022 09:28:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240964AbiDRNFU (ORCPT ); Mon, 18 Apr 2022 09:05:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83A0E340CF; Mon, 18 Apr 2022 05:45:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2273B6101A; Mon, 18 Apr 2022 12:45:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B3A0C385A7; Mon, 18 Apr 2022 12:45:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650285951; bh=pJ2M5/+qEwvfUYmQmLNTCFIGmh9gFKayrlgbg4eF8lo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tegn9rZei41rXMEGFzs9DSo0y4fYGSyVbR5o0i0oUFRk6VewVQCQIDt0H4MQrGgzh TjVxpG4vMjqbfHYWS5KZ8MxmLd56KWfj9ulXaHSQBBTgqlCRHGH3aVT4RqOBg+ZjeN YS+lap8FgK4XJlfVEzuvKEVeIx/kUNIqA2zVx48s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tyrel Datwyler , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.19 15/32] scsi: ibmvscsis: Increase INITIAL_SRP_LIMIT to 1024 Date: Mon, 18 Apr 2022 14:13:55 +0200 Message-Id: <20220418121127.572901104@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: Tyrel Datwyler [ Upstream commit 0bade8e53279157c7cc9dd95d573b7e82223d78a ] The adapter request_limit is hardcoded to be INITIAL_SRP_LIMIT which is currently an arbitrary value of 800. Increase this value to 1024 which better matches the characteristics of the typical IBMi Initiator that supports 32 LUNs and a queue depth of 32. This change also has the secondary benefit of being a power of two as required by the kfifo API. Since, Commit ab9bb6318b09 ("Partially revert "kfifo: fix kfifo_alloc() and kfifo_init()"") the size of IU pool for each target has been rounded down to 512 when attempting to kfifo_init() those pools with the current request_limit size of 800. Link: https://lore.kernel.org/r/20220322194443.678433-1-tyreld@linux.ibm.com Signed-off-by: Tyrel Datwyler Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvsc= si_tgt/ibmvscsi_tgt.c index f42a619198c4..79bc6c3bfa6e 100644 --- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c @@ -44,7 +44,7 @@ =20 #define IBMVSCSIS_VERSION "v0.2" =20 -#define INITIAL_SRP_LIMIT 800 +#define INITIAL_SRP_LIMIT 1024 #define DEFAULT_MAX_SECTORS 256 #define MAX_TXU 1024 * 1024 =20 --=20 2.35.1 From nobody Thu May 14 08:55:39 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 DCC36C35280 for ; Mon, 18 Apr 2022 13:28:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243563AbiDRN3C (ORCPT ); Mon, 18 Apr 2022 09:29:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240987AbiDRNFX (ORCPT ); Mon, 18 Apr 2022 09:05:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C848340D9; Mon, 18 Apr 2022 05:45:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EEA40B80E44; Mon, 18 Apr 2022 12:45:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44704C385A8; Mon, 18 Apr 2022 12:45:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650285954; bh=cYzXXg1Vy1q7vvQEVY1rET2xsZpGFJS5PCjsVVvLFiQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gnYDa95tyqeimFxmucWAB2redUxgG+/JnewToGUUk0b8ZGYfgckCwC9LXU6w+m1A3 FKY6zZ/Z5Gc0AzQ9hXnu0KOizVmHGCPdCRKIYQv5s1xYoInHaAP+MrAIHg0iAPl2Eb RWvCcIUZMW7Vdh4w2i4vQ/ar76dzxz8xIdptYUvc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Sasha Levin Subject: [PATCH 4.19 16/32] net: micrel: fix KS8851_MLL Kconfig Date: Mon, 18 Apr 2022 14:13:56 +0200 Message-Id: <20220418121127.601803311@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: Randy Dunlap [ Upstream commit c3efcedd272aa6dd5929e20cf902a52ddaa1197a ] KS8851_MLL selects MICREL_PHY, which depends on PTP_1588_CLOCK_OPTIONAL, so make KS8851_MLL also depend on PTP_1588_CLOCK_OPTIONAL since 'select' does not follow any dependency chains. Fixes kconfig warning and build errors: WARNING: unmet direct dependencies detected for MICREL_PHY Depends on [m]: NETDEVICES [=3Dy] && PHYLIB [=3Dy] && PTP_1588_CLOCK_OPTI= ONAL [=3Dm] Selected by [y]: - KS8851_MLL [=3Dy] && NETDEVICES [=3Dy] && ETHERNET [=3Dy] && NET_VENDOR= _MICREL [=3Dy] && HAS_IOMEM [=3Dy] ld: drivers/net/phy/micrel.o: in function `lan8814_ts_info': micrel.c:(.text+0xb35): undefined reference to `ptp_clock_index' ld: drivers/net/phy/micrel.o: in function `lan8814_probe': micrel.c:(.text+0x2586): undefined reference to `ptp_clock_register' Signed-off-by: Randy Dunlap Cc: "David S. Miller" Cc: Jakub Kicinski Cc: Paolo Abeni Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/ethernet/micrel/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/micrel/Kconfig b/drivers/net/ethernet/mic= rel/Kconfig index b7e2f49696b7..aa12bace8673 100644 --- a/drivers/net/ethernet/micrel/Kconfig +++ b/drivers/net/ethernet/micrel/Kconfig @@ -45,6 +45,7 @@ config KS8851 config KS8851_MLL tristate "Micrel KS8851 MLL" depends on HAS_IOMEM + depends on PTP_1588_CLOCK_OPTIONAL select MII ---help--- This platform driver is for Micrel KS8851 Address/data bus --=20 2.35.1 From nobody Thu May 14 08:55:39 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 E20FFC433F5 for ; Mon, 18 Apr 2022 13:28:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243465AbiDRN3A (ORCPT ); Mon, 18 Apr 2022 09:29:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240983AbiDRNFX (ORCPT ); Mon, 18 Apr 2022 09:05:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2CF4340DA; Mon, 18 Apr 2022 05:45:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5EA5660FB6; Mon, 18 Apr 2022 12:45:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F97EC385A1; Mon, 18 Apr 2022 12:45:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650285957; bh=Ro/CPlPrB2+4gFbWWaN9lTICA1APWeL2RMTpJRBah8s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xn92+hcy9+NTb+DYG857wQHhNWrzJGTb7Nzwz6HFUWdk4m8zv+gOyXOd+6wuskMx7 pXcuPgpGjdC+q52iZgOFjuNIrvuZGzeq6nF/W4ieCOlMuhdYiuj+XfQGgpidKkC2ZZ B7pOwLjYIig2Zib6W8kZ/QFn2OKCrV3/nLxpvnGE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Lamparter , Damien Le Moal , Sasha Levin Subject: [PATCH 4.19 17/32] ata: libata-core: Disable READ LOG DMA EXT for Samsung 840 EVOs Date: Mon, 18 Apr 2022 14:13:57 +0200 Message-Id: <20220418121127.630064036@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: Christian Lamparter [ Upstream commit 5399752299396a3c9df6617f4b3c907d7aa4ded8 ] Samsung' 840 EVO with the latest firmware (EXT0DB6Q) locks up with the a message: "READ LOG DMA EXT failed, trying PIO" during boot. Initially this was discovered because it caused a crash with the sata_dwc_460ex controller on a WD MyBook Live DUO. The reporter "Tice Rex" which has the unique opportunity that he has two Samsung 840 EVO SSD! One with the older firmware "EXT0BB0Q" which booted fine and didn't expose "READ LOG DMA EXT". But the newer/latest firmware "EXT0DB6Q" caused the headaches. BugLink: https://github.com/openwrt/openwrt/issues/9505 Signed-off-by: Christian Lamparter Signed-off-by: Damien Le Moal Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/ata/libata-core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 33d3728f3622..0c10d9557754 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -4598,6 +4598,9 @@ static const struct ata_blacklist_entry ata_device_bl= acklist [] =3D { ATA_HORKAGE_ZERO_AFTER_TRIM, }, { "Crucial_CT*MX100*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | ATA_HORKAGE_ZERO_AFTER_TRIM, }, + { "Samsung SSD 840 EVO*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | + ATA_HORKAGE_NO_DMA_LOG | + ATA_HORKAGE_ZERO_AFTER_TRIM, }, { "Samsung SSD 840*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | ATA_HORKAGE_ZERO_AFTER_TRIM, }, { "Samsung SSD 850*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | --=20 2.35.1 From nobody Thu May 14 08:55:39 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 0385DC433FE for ; Mon, 18 Apr 2022 13:28:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243743AbiDRN3F (ORCPT ); Mon, 18 Apr 2022 09:29:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239374AbiDRNF2 (ORCPT ); Mon, 18 Apr 2022 09:05:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91853340DE; Mon, 18 Apr 2022 05:46:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2D88E6124F; Mon, 18 Apr 2022 12:46:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EAF1C385A1; Mon, 18 Apr 2022 12:46:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650285960; bh=rHmNXuzeV8iJKUzH6+x3ln2ySZEFmVKkG1uO2fuHIks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XwrszLyjtTIGc56s8LrwtnCl4FY0eBde2xGy1KociSaeC8yAkRIujHjqU43cslK2y InwI2KoKNCewma5x+LvJw4AyS2P6z0N+M53vQe4K8pPE+FlAciKPFFBIOSsZAD+x6A 0eoTwO6IshQlz7kH6wVlIWurDDoEMALhONizzpfA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leo Ruan , Mark Jonas , Philipp Zabel , Sasha Levin Subject: [PATCH 4.19 18/32] gpu: ipu-v3: Fix dev_dbg frequency output Date: Mon, 18 Apr 2022 14:13:58 +0200 Message-Id: <20220418121127.659107387@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: Leo Ruan [ Upstream commit 070a88fd4a03f921b73a2059e97d55faaa447dab ] This commit corrects the printing of the IPU clock error percentage if it is between -0.1% to -0.9%. For example, if the pixel clock requested is 27.2 MHz but only 27.0 MHz can be achieved the deviation is -0.8%. But the fixed point math had a flaw and calculated error of 0.2%. Before: Clocks: IPU 270000000Hz DI 24716667Hz Needed 27200000Hz IPU clock can give 27000000 with divider 10, error 0.2% Want 27200000Hz IPU 270000000Hz DI 24716667Hz using IPU, 27000000Hz After: Clocks: IPU 270000000Hz DI 24716667Hz Needed 27200000Hz IPU clock can give 27000000 with divider 10, error -0.8% Want 27200000Hz IPU 270000000Hz DI 24716667Hz using IPU, 27000000Hz Signed-off-by: Leo Ruan Signed-off-by: Mark Jonas Reviewed-by: Philipp Zabel Signed-off-by: Philipp Zabel Link: https://lore.kernel.org/r/20220207151411.5009-1-mark.jonas@de.bosch.c= om Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/gpu/ipu-v3/ipu-di.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/ipu-v3/ipu-di.c b/drivers/gpu/ipu-v3/ipu-di.c index d2f1bd9d3deb..c498dc7d8838 100644 --- a/drivers/gpu/ipu-v3/ipu-di.c +++ b/drivers/gpu/ipu-v3/ipu-di.c @@ -460,8 +460,9 @@ static void ipu_di_config_clock(struct ipu_di *di, =20 error =3D rate / (sig->mode.pixelclock / 1000); =20 - dev_dbg(di->ipu->dev, " IPU clock can give %lu with divider %u, error %= d.%u%%\n", - rate, div, (signed)(error - 1000) / 10, error % 10); + dev_dbg(di->ipu->dev, " IPU clock can give %lu with divider %u, error %= c%d.%d%%\n", + rate, div, error < 1000 ? '-' : '+', + abs(error - 1000) / 10, abs(error - 1000) % 10); =20 /* Allow a 1% error */ if (error < 1010 && error >=3D 990) { --=20 2.35.1 From nobody Thu May 14 08:55:39 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 13110C3527A for ; Mon, 18 Apr 2022 13:28:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243818AbiDRN3I (ORCPT ); Mon, 18 Apr 2022 09:29:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241051AbiDRNF2 (ORCPT ); Mon, 18 Apr 2022 09:05:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 053F429828; Mon, 18 Apr 2022 05:46:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B5A80B80E4B; Mon, 18 Apr 2022 12:46:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CF8BC385A7; Mon, 18 Apr 2022 12:46:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650285963; bh=h9/5KSj6OJA2aQ/9/6+/e4MfRq0HbHkAqRzBeWOfW0Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KjU+LTz4eLWgfy59wHFLaBhJHYK0R8RR0RQ7lrgu3SB6TG/31+qk3hXoX0avZM+6z L2FvokOe4OI7lz8v83N1NMMBx2fsbj07CPC5pU21p7S1W8t9mDrtSi22sdKSetVebB 4pu6c9sIj8o5i/vcoONrc8yGx59QaNWLB3kq0SXY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joey Gouly , Mark Rutland , Catalin Marinas , Will Deacon , Sasha Levin Subject: [PATCH 4.19 19/32] arm64: alternatives: mark patch_alternative() as `noinstr` Date: Mon, 18 Apr 2022 14:13:59 +0200 Message-Id: <20220418121127.688055795@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: Joey Gouly [ Upstream commit a2c0b0fbe01419f8f5d1c0b9c581631f34ffce8b ] The alternatives code must be `noinstr` such that it does not patch itself, as the cache invalidation is only performed after all the alternatives have been applied. Mark patch_alternative() as `noinstr`. Mark branch_insn_requires_update() and get_alt_insn() with `__always_inline` since they are both only called through patch_alternative(). Booting a kernel in QEMU TCG with KCSAN=3Dy and ARM64_USE_LSE_ATOMICS=3Dy c= aused a boot hang: [ 0.241121] CPU: All CPU(s) started at EL2 The alternatives code was patching the atomics in __tsan_read4() from LL/SC atomics to LSE atomics. The following fragment is using LL/SC atomics in the .text section: | <__tsan_unaligned_read4+304>: ldxr x6, [x2] | <__tsan_unaligned_read4+308>: add x6, x6, x5 | <__tsan_unaligned_read4+312>: stxr w7, x6, [x2] | <__tsan_unaligned_read4+316>: cbnz w7, <__tsan_unaligned_read4+3= 04> This LL/SC atomic sequence was to be replaced with LSE atomics. However sin= ce the alternatives code was instrumentable, __tsan_read4() was being called a= fter only the first instruction was replaced, which led to the following code in= memory: | <__tsan_unaligned_read4+304>: ldadd x5, x6, [x2] | <__tsan_unaligned_read4+308>: add x6, x6, x5 | <__tsan_unaligned_read4+312>: stxr w7, x6, [x2] | <__tsan_unaligned_read4+316>: cbnz w7, <__tsan_unaligned_read4+3= 04> This caused an infinite loop as the `stxr` instruction never completed succ= essfully, so `w7` was always 0. Signed-off-by: Joey Gouly Cc: Mark Rutland Cc: Catalin Marinas Cc: Will Deacon Link: https://lore.kernel.org/r/20220405104733.11476-1-joey.gouly@arm.com Signed-off-by: Will Deacon Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/arm64/kernel/alternative.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kernel/alternative.c b/arch/arm64/kernel/alternativ= e.c index 0d345622bbba..3747c8d87bdb 100644 --- a/arch/arm64/kernel/alternative.c +++ b/arch/arm64/kernel/alternative.c @@ -42,7 +42,7 @@ struct alt_region { /* * Check if the target PC is within an alternative block. */ -static bool branch_insn_requires_update(struct alt_instr *alt, unsigned lo= ng pc) +static __always_inline bool branch_insn_requires_update(struct alt_instr *= alt, unsigned long pc) { unsigned long replptr =3D (unsigned long)ALT_REPL_PTR(alt); return !(pc >=3D replptr && pc <=3D (replptr + alt->alt_len)); @@ -50,7 +50,7 @@ static bool branch_insn_requires_update(struct alt_instr = *alt, unsigned long pc) =20 #define align_down(x, a) ((unsigned long)(x) & ~(((unsigned long)(a)) - 1)) =20 -static u32 get_alt_insn(struct alt_instr *alt, __le32 *insnptr, __le32 *al= tinsnptr) +static __always_inline u32 get_alt_insn(struct alt_instr *alt, __le32 *ins= nptr, __le32 *altinsnptr) { u32 insn; =20 @@ -95,7 +95,7 @@ static u32 get_alt_insn(struct alt_instr *alt, __le32 *in= snptr, __le32 *altinsnp return insn; } =20 -static void patch_alternative(struct alt_instr *alt, +static noinstr void patch_alternative(struct alt_instr *alt, __le32 *origptr, __le32 *updptr, int nr_inst) { __le32 *replptr; --=20 2.35.1 From nobody Thu May 14 08:55:39 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 6801CC4707A for ; Mon, 18 Apr 2022 13:28:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244010AbiDRN3t (ORCPT ); Mon, 18 Apr 2022 09:29:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241062AbiDRNF2 (ORCPT ); Mon, 18 Apr 2022 09:05:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F56D340E3; Mon, 18 Apr 2022 05:46:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C8245B80E44; Mon, 18 Apr 2022 12:46:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F3BAC385A7; Mon, 18 Apr 2022 12:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650285969; bh=fBiJyIkwIGXT7bYdXeNj91aQs0MwIyY2qcwRtMPl48s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r/J6u/Y6cg0X6AzWisPQRZP7KTvM9kjfyUmuNlpbsQWPzXPcoqvwNpXn3HFDsQR+/ dI07pp9MQBFvtf4EDy6b+BV6k1owOKzfhTW/V4XFZbsvQ6tnpkDIfZovBJwbekpUmq BnpGqC5D/OI2UfhWTLsKh1FG3+r+HVEmkOJMnak8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wayne Lin , Alex Hung , Roman Li , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 4.19 20/32] drm/amd/display: Fix allocate_mst_payload assert on resume Date: Mon, 18 Apr 2022 14:14:00 +0200 Message-Id: <20220418121127.717387020@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: Roman Li [ Upstream commit f4346fb3edf7720db3f7f5e1cab1f667cd024280 ] [Why] On resume we do link detection for all non-MST connectors. MST is handled separately. However the condition for telling if connector is on mst branch is not enough for mst hub case. Link detection for mst branch link leads to mst topology reset. That causes assert in dc_link_allocate_mst_payload() [How] Use link type as indicator for mst link. Reviewed-by: Wayne Lin Acked-by: Alex Hung Signed-off-by: Roman Li Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gp= u/drm/amd/display/amdgpu_dm/amdgpu_dm.c index b2835cd41d3e..57678e6dcdc4 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -777,7 +777,8 @@ static int dm_resume(void *handle) * this is the case when traversing through already created * MST connectors, should be skipped */ - if (aconnector->mst_port) + if (aconnector->dc_link && + aconnector->dc_link->type =3D=3D dc_connection_mst_branch) continue; =20 mutex_lock(&aconnector->hpd_lock); --=20 2.35.1 From nobody Thu May 14 08:55:39 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 33432C46467 for ; Mon, 18 Apr 2022 13:28:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243956AbiDRN3Z (ORCPT ); Mon, 18 Apr 2022 09:29:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241065AbiDRNF2 (ORCPT ); Mon, 18 Apr 2022 09:05:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A205529CAD; Mon, 18 Apr 2022 05:46:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3DD7B6124D; Mon, 18 Apr 2022 12:46:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31A33C385A7; Mon, 18 Apr 2022 12:46:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650285972; bh=u/7lITaYAOTkChZVgdxdyw8XcSBd4xRG2AbCWa4+V9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HSNG+HZHWcAhwOJyeM2DX2wNvK6bQ3mhk4YTM3HwJ+ziX8rKnuJmbWp4f6xDfEAzo 8Y3XP/1V9dWNdfXUmfCYsHyNtclMEHph/RjtdaGXCqrZdWwbuTHXQ/7GXxNZeLtWUP lyxr8AOx25Ut4T1SyVdYHSkT2Z+SDStbqOXBRYdo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Galakhov , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.19 21/32] scsi: mvsas: Add PCI ID of RocketRaid 2640 Date: Mon, 18 Apr 2022 14:14:01 +0200 Message-Id: <20220418121127.746740777@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: Alexey Galakhov [ Upstream commit 5f2bce1e222028dc1c15f130109a17aa654ae6e8 ] The HighPoint RocketRaid 2640 is a low-cost SAS controller based on Marvell chip. The chip in question was already supported by the kernel, just the PCI ID of this particular board was missing. Link: https://lore.kernel.org/r/20220309212535.402987-1-agalakhov@gmail.com Signed-off-by: Alexey Galakhov Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/scsi/mvsas/mv_init.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c index 9c48394ac68a..f2fed5eeefe3 100644 --- a/drivers/scsi/mvsas/mv_init.c +++ b/drivers/scsi/mvsas/mv_init.c @@ -678,6 +678,7 @@ static struct pci_device_id mvs_pci_table[] =3D { { PCI_VDEVICE(ARECA, PCI_DEVICE_ID_ARECA_1300), chip_1300 }, { PCI_VDEVICE(ARECA, PCI_DEVICE_ID_ARECA_1320), chip_1320 }, { PCI_VDEVICE(ADAPTEC2, 0x0450), chip_6440 }, + { PCI_VDEVICE(TTI, 0x2640), chip_6440 }, { PCI_VDEVICE(TTI, 0x2710), chip_9480 }, { PCI_VDEVICE(TTI, 0x2720), chip_9480 }, { PCI_VDEVICE(TTI, 0x2721), chip_9480 }, --=20 2.35.1 From nobody Thu May 14 08:55:39 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 53154C3527C for ; Mon, 18 Apr 2022 13:28:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243982AbiDRN3i (ORCPT ); Mon, 18 Apr 2022 09:29:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241060AbiDRNF2 (ORCPT ); Mon, 18 Apr 2022 09:05:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB8A1340E4; Mon, 18 Apr 2022 05:46:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6892D6101A; Mon, 18 Apr 2022 12:46:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BE21C385A1; Mon, 18 Apr 2022 12:46:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650285975; bh=ftfRvsqoajCyKutSd0dv98JYYA4Uww2asayNWgdSWZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Oc7S5eQC2WBLKs8WMD+64wny0QnaopR0HVa7/rigkvZITJu1zOr9C2TZBsTSoYg+t x403Jx/UuhVVWuRzA4utpg59aAgGgibSG1vtDXU6qOmdQfvlkzGF+AYtyF+7NVcWe/ AWahcMmpoUyanUblYguJFK8LGOP5NhB7def9oqhE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Duoming Zhou , Jiri Slaby , Jakub Kicinski , Sasha Levin Subject: [PATCH 4.19 22/32] drivers: net: slip: fix NPD bug in sl_tx_timeout() Date: Mon, 18 Apr 2022 14:14:02 +0200 Message-Id: <20220418121127.774958311@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: Duoming Zhou [ Upstream commit ec4eb8a86ade4d22633e1da2a7d85a846b7d1798 ] When a slip driver is detaching, the slip_close() will act to cleanup necessary resources and sl->tty is set to NULL in slip_close(). Meanwhile, the packet we transmit is blocked, sl_tx_timeout() will be called. Although slip_close() and sl_tx_timeout() use sl->lock to synchronize, we don`t judge whether sl->tty equals to NULL in sl_tx_timeout() and the null pointer dereference bug will happen. (Thread 1) | (Thread 2) | slip_close() | spin_lock_bh(&sl->lock) | ... ... | sl->tty =3D NULL //(1) sl_tx_timeout() | spin_unlock_bh(&sl->lock) spin_lock(&sl->lock); | ... | ... tty_chars_in_buffer(sl->tty)| if (tty->ops->..) //(2) | ... | synchronize_rcu() We set NULL to sl->tty in position (1) and dereference sl->tty in position (2). This patch adds check in sl_tx_timeout(). If sl->tty equals to NULL, sl_tx_timeout() will goto out. Signed-off-by: Duoming Zhou Reviewed-by: Jiri Slaby Link: https://lore.kernel.org/r/20220405132206.55291-1-duoming@zju.edu.cn Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/slip/slip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c index 5d864f812955..3ec8d16a4633 100644 --- a/drivers/net/slip/slip.c +++ b/drivers/net/slip/slip.c @@ -471,7 +471,7 @@ static void sl_tx_timeout(struct net_device *dev) spin_lock(&sl->lock); =20 if (netif_queue_stopped(dev)) { - if (!netif_running(dev)) + if (!netif_running(dev) || !sl->tty) goto out; =20 /* May be we must check transmitter timeout here ? --=20 2.35.1 From nobody Thu May 14 08:55:39 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 1295CC433FE for ; Mon, 18 Apr 2022 13:28:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236150AbiDRNbU (ORCPT ); Mon, 18 Apr 2022 09:31:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241073AbiDRNF2 (ORCPT ); Mon, 18 Apr 2022 09:05:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C241829CBE; Mon, 18 Apr 2022 05:46: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 5D0AF6101A; Mon, 18 Apr 2022 12:46:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EBC3C385A7; Mon, 18 Apr 2022 12:46:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650285978; bh=wsagDQ7SkGETtshHChyp71f71NeF0jC7jKoo5xGRCSs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Oyba9eerVku2Ww91i7XvGV0wgSTT22VcNDvPpLxOB2ApwZP09v4LWr0/XSHjXilPP oORyIm+1ukygBp4LS+Da7sF0obFLnRm/X5x8btsgkbSdYIvlX8QIv85uAtFpMgh++W hQWz9h6Q9J+MTw6Z7LSsNJ/i8oWES/1W91Xh8Y10= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juergen Gross , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Michal Hocko , David Hildenbrand , Wei Yang , Andrew Morton , Linus Torvalds Subject: [PATCH 4.19 23/32] mm, page_alloc: fix build_zonerefs_node() Date: Mon, 18 Apr 2022 14:14:03 +0200 Message-Id: <20220418121127.802858339@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: Juergen Gross commit e553f62f10d93551eb883eca227ac54d1a4fad84 upstream. Since commit 6aa303defb74 ("mm, vmscan: only allocate and reclaim from zones with pages managed by the buddy allocator") only zones with free memory are included in a built zonelist. This is problematic when e.g. all memory of a zone has been ballooned out when zonelists are being rebuilt. The decision whether to rebuild the zonelists when onlining new memory is done based on populated_zone() returning 0 for the zone the memory will be added to. The new zone is added to the zonelists only, if it has free memory pages (managed_zone() returns a non-zero value) after the memory has been onlined. This implies, that onlining memory will always free the added pages to the allocator immediately, but this is not true in all cases: when e.g. running as a Xen guest the onlined new memory will be added only to the ballooned memory list, it will be freed only when the guest is being ballooned up afterwards. Another problem with using managed_zone() for the decision whether a zone is being added to the zonelists is, that a zone with all memory used will in fact be removed from all zonelists in case the zonelists happen to be rebuilt. Use populated_zone() when building a zonelist as it has been done before that commit. There was a report that QubesOS (based on Xen) is hitting this problem. Xen has switched to use the zone device functionality in kernel 5.9 and QubesOS wants to use memory hotplugging for guests in order to be able to start a guest with minimal memory and expand it as needed. This was the report leading to the patch. Link: https://lkml.kernel.org/r/20220407120637.9035-1-jgross@suse.com Fixes: 6aa303defb74 ("mm, vmscan: only allocate and reclaim from zones with= pages managed by the buddy allocator") Signed-off-by: Juergen Gross Reported-by: Marek Marczykowski-G=C3=B3recki Acked-by: Michal Hocko Acked-by: David Hildenbrand Cc: Marek Marczykowski-G=C3=B3recki Reviewed-by: Wei Yang Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5091,7 +5091,7 @@ static int build_zonerefs_node(pg_data_t do { zone_type--; zone =3D pgdat->node_zones + zone_type; - if (managed_zone(zone)) { + if (populated_zone(zone)) { zoneref_set_zone(zone, &zonerefs[nr_zones++]); check_highest_zone(zone_type); } From nobody Thu May 14 08:55:39 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 C54ABC352AA for ; Mon, 18 Apr 2022 13:32:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242603AbiDRNdB (ORCPT ); Mon, 18 Apr 2022 09:33:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241152AbiDRNGk (ORCPT ); Mon, 18 Apr 2022 09:06:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBAF721813; Mon, 18 Apr 2022 05:47:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6B8F7B80E4E; Mon, 18 Apr 2022 12:47:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C2D1C385B6; Mon, 18 Apr 2022 12:47:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286031; bh=H1+yQLL6OhhIyDlau1xZ2MGXryRURtiiukbTE+KlCgg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ypfFNau/w7mQ1wHUQcEXB/F1yA9yMOfU1mPR6vr2Ho6HnvIvJmaAJ4vecgDwLEogq TjhvY7b63Np2t4Gh5hdKNYF/aHabUQBOoOWT9ujGoLSavaS4boQuAIfhdOB48fFxpK YKtZf1U4zZo9ofTlac6yZ9cQTrttmCNUah8RmyFM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Patrick Wang , Catalin Marinas , Andrew Morton , Linus Torvalds Subject: [PATCH 4.19 24/32] mm: kmemleak: take a full lowmem check in kmemleak_*_phys() Date: Mon, 18 Apr 2022 14:14:04 +0200 Message-Id: <20220418121127.831972311@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: Patrick Wang commit 23c2d497de21f25898fbea70aeb292ab8acc8c94 upstream. The kmemleak_*_phys() apis do not check the address for lowmem's min boundary, while the caller may pass an address below lowmem, which will trigger an oops: # echo scan > /sys/kernel/debug/kmemleak Unable to handle kernel paging request at virtual address ff5fffffffe00000 Oops [#1] Modules linked in: CPU: 2 PID: 134 Comm: bash Not tainted 5.18.0-rc1-next-20220407 #33 Hardware name: riscv-virtio,qemu (DT) epc : scan_block+0x74/0x15c ra : scan_block+0x72/0x15c epc : ffffffff801e5806 ra : ffffffff801e5804 sp : ff200000104abc30 gp : ffffffff815cd4e8 tp : ff60000004cfa340 t0 : 0000000000000200 t1 : 00aaaaaac23954cc t2 : 00000000000003ff s0 : ff200000104abc90 s1 : ffffffff81b0ff28 a0 : 0000000000000000 a1 : ff5fffffffe01000 a2 : ffffffff81b0ff28 a3 : 0000000000000002 a4 : 0000000000000001 a5 : 0000000000000000 a6 : ff200000104abd7c a7 : 0000000000000005 s2 : ff5fffffffe00ff9 s3 : ffffffff815cd998 s4 : ffffffff815d0e90 s5 : ffffffff81b0ff28 s6 : 0000000000000020 s7 : ffffffff815d0eb0 s8 : ffffffffffffffff s9 : ff5fffffffe00000 s10: ff5fffffffe01000 s11: 0000000000000022 t3 : 00ffffffaa17db4c t4 : 000000000000000f t5 : 0000000000000001 t6 : 0000000000000000 status: 0000000000000100 badaddr: ff5fffffffe00000 cause: 000000000000000d scan_gray_list+0x12e/0x1a6 kmemleak_scan+0x2aa/0x57e kmemleak_write+0x32a/0x40c full_proxy_write+0x56/0x82 vfs_write+0xa6/0x2a6 ksys_write+0x6c/0xe2 sys_write+0x22/0x2a ret_from_syscall+0x0/0x2 The callers may not quite know the actual address they pass(e.g. from devicetree). So the kmemleak_*_phys() apis should guarantee the address they finally use is in lowmem range, so check the address for lowmem's min boundary. Link: https://lkml.kernel.org/r/20220413122925.33856-1-patrick.wang.shcn@gm= ail.com Signed-off-by: Patrick Wang Acked-by: Catalin Marinas Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- mm/kmemleak.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/mm/kmemleak.c +++ b/mm/kmemleak.c @@ -1196,7 +1196,7 @@ EXPORT_SYMBOL(kmemleak_no_scan); void __ref kmemleak_alloc_phys(phys_addr_t phys, size_t size, int min_coun= t, gfp_t gfp) { - if (!IS_ENABLED(CONFIG_HIGHMEM) || PHYS_PFN(phys) < max_low_pfn) + if (PHYS_PFN(phys) >=3D min_low_pfn && PHYS_PFN(phys) < max_low_pfn) kmemleak_alloc(__va(phys), size, min_count, gfp); } EXPORT_SYMBOL(kmemleak_alloc_phys); @@ -1210,7 +1210,7 @@ EXPORT_SYMBOL(kmemleak_alloc_phys); */ void __ref kmemleak_free_part_phys(phys_addr_t phys, size_t size) { - if (!IS_ENABLED(CONFIG_HIGHMEM) || PHYS_PFN(phys) < max_low_pfn) + if (PHYS_PFN(phys) >=3D min_low_pfn && PHYS_PFN(phys) < max_low_pfn) kmemleak_free_part(__va(phys), size); } EXPORT_SYMBOL(kmemleak_free_part_phys); @@ -1222,7 +1222,7 @@ EXPORT_SYMBOL(kmemleak_free_part_phys); */ void __ref kmemleak_not_leak_phys(phys_addr_t phys) { - if (!IS_ENABLED(CONFIG_HIGHMEM) || PHYS_PFN(phys) < max_low_pfn) + if (PHYS_PFN(phys) >=3D min_low_pfn && PHYS_PFN(phys) < max_low_pfn) kmemleak_not_leak(__va(phys)); } EXPORT_SYMBOL(kmemleak_not_leak_phys); @@ -1234,7 +1234,7 @@ EXPORT_SYMBOL(kmemleak_not_leak_phys); */ void __ref kmemleak_ignore_phys(phys_addr_t phys) { - if (!IS_ENABLED(CONFIG_HIGHMEM) || PHYS_PFN(phys) < max_low_pfn) + if (PHYS_PFN(phys) >=3D min_low_pfn && PHYS_PFN(phys) < max_low_pfn) kmemleak_ignore(__va(phys)); } EXPORT_SYMBOL(kmemleak_ignore_phys); From nobody Thu May 14 08:55:39 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 B9F25C3527E for ; Mon, 18 Apr 2022 13:32:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242271AbiDRNcs (ORCPT ); Mon, 18 Apr 2022 09:32:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240259AbiDRNGG (ORCPT ); Mon, 18 Apr 2022 09:06:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BFB12A243; Mon, 18 Apr 2022 05:46:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CD06F6101A; Mon, 18 Apr 2022 12:46:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C22A4C385A1; Mon, 18 Apr 2022 12:46:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286006; bh=ObuRGH4U8Y0QJAW/k3Ut0SeeASlOCKV0F3wi0/hb/es=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YhbZlUwAgy/XwnrkV/25nDGG4tCqUq/TTRl+qzuHyUfQHsZLCvF6ZS3l8z69uSkCB cQ+WZPiMlRMV03sWyr8GS5L7iei9YT6X8kOz1Ww/DKROC3Yrp3oTN49N5y19XgWFAp VlPvCMKWf68DUphM5x+bf/+syJ/61anekOX/V/Xo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Oliver Upton , Marc Zyngier Subject: [PATCH 4.19 25/32] KVM: Dont create VM debugfs files outside of the VM directory Date: Mon, 18 Apr 2022 14:14:05 +0200 Message-Id: <20220418121127.860908139@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: Oliver Upton commit a44a4cc1c969afec97dbb2aedaf6f38eaa6253bb upstream. Unfortunately, there is no guarantee that KVM was able to instantiate a debugfs directory for a particular VM. To that end, KVM shouldn't even attempt to create new debugfs files in this case. If the specified parent dentry is NULL, debugfs_create_file() will instantiate files at the root of debugfs. For arm64, it is possible to create the vgic-state file outside of a VM directory, the file is not cleaned up when a VM is destroyed. Nonetheless, the corresponding struct kvm is freed when the VM is destroyed. Nip the problem in the bud for all possible errant debugfs file creations by initializing kvm->debugfs_dentry to -ENOENT. In so doing, debugfs_create_file() will fail instead of creating the file in the root directory. Cc: stable@kernel.org Fixes: 929f45e32499 ("kvm: no need to check return value of debugfs_create = functions") Signed-off-by: Oliver Upton Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220406235615.1447180-2-oupton@google.com Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- virt/kvm/kvm_main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -610,7 +610,7 @@ static void kvm_destroy_vm_debugfs(struc { int i; =20 - if (!kvm->debugfs_dentry) + if (IS_ERR(kvm->debugfs_dentry)) return; =20 debugfs_remove_recursive(kvm->debugfs_dentry); @@ -628,6 +628,12 @@ static int kvm_create_vm_debugfs(struct struct kvm_stat_data *stat_data; struct kvm_stats_debugfs_item *p; =20 + /* + * Force subsequent debugfs file creations to fail if the VM directory + * is not created. + */ + kvm->debugfs_dentry =3D ERR_PTR(-ENOENT); + if (!debugfs_initialized()) return 0; From nobody Thu May 14 08:55:39 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 EAD77C4167D for ; Mon, 18 Apr 2022 13:32:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242208AbiDRNch (ORCPT ); Mon, 18 Apr 2022 09:32:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240912AbiDRNGH (ORCPT ); Mon, 18 Apr 2022 09:06:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DDE52A244; Mon, 18 Apr 2022 05:46:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1C77660FB6; Mon, 18 Apr 2022 12:46:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EF99C385A7; Mon, 18 Apr 2022 12:46:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286009; bh=dJzCn9cIQspghMBiSeA+o7H9D+g3/toGnQtHulXDBOU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a269XnCEG8+AfGXXqi+3wHkyY2hUsb7hlUxHN5RD6dSp8KoCQ53l2houBKq7SUyUp C9egdPvUP96a6cr6hMxf7HYjFbWYXWcNvAt8YxiVnSvlYg5p3R1HCcjFiXICHvELCI HhFI3LV8k97gGkWrt/HLS6iPexfKpNEWgqxYMxUQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, PaX Team , "Jason A. Donenfeld" , Kees Cook Subject: [PATCH 4.19 26/32] gcc-plugins: latent_entropy: use /dev/urandom Date: Mon, 18 Apr 2022 14:14:06 +0200 Message-Id: <20220418121127.888590983@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: Jason A. Donenfeld commit c40160f2998c897231f8454bf797558d30a20375 upstream. While the latent entropy plugin mostly doesn't derive entropy from get_random_const() for measuring the call graph, when __latent_entropy is applied to a constant, then it's initialized statically to output from get_random_const(). In that case, this data is derived from a 64-bit seed, which means a buffer of 512 bits doesn't really have that amount of compile-time entropy. This patch fixes that shortcoming by just buffering chunks of /dev/urandom output and doling it out as requested. At the same time, it's important that we don't break the use of -frandom-seed, for people who want the runtime benefits of the latent entropy plugin, while still having compile-time determinism. In that case, we detect whether gcc's set_random_seed() has been called by making a call to get_random_seed(noinit=3Dtrue) in the plugin init function, which is called after set_random_seed() is called but before anything that calls get_random_seed(noinit=3Dfalse), and seeing if it's zero or not. If it's not zero, we're in deterministic mode, and so we just generate numbers with a basic xorshift prng. Note that we don't detect if -frandom-seed is being used using the documented local_tick variable, because it's assigned via: local_tick =3D (unsigned) tv.tv_sec * 1000 + tv.tv_usec / 1000; which may well overflow and become -1 on its own, and so isn't reliable: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105171 [kees: The 256 byte rnd_buf size was chosen based on average (250), median (64), and std deviation (575) bytes of used entropy for a defconfig x86_64 build] Fixes: 38addce8b600 ("gcc-plugins: Add latent_entropy plugin") Cc: stable@vger.kernel.org Cc: PaX Team Signed-off-by: Jason A. Donenfeld Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20220405222815.21155-1-Jason@zx2c4.com Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- scripts/gcc-plugins/latent_entropy_plugin.c | 44 +++++++++++++++++------= ----- 1 file changed, 27 insertions(+), 17 deletions(-) --- a/scripts/gcc-plugins/latent_entropy_plugin.c +++ b/scripts/gcc-plugins/latent_entropy_plugin.c @@ -86,25 +86,31 @@ static struct plugin_info latent_entropy .help =3D "disable\tturn off latent entropy instrumentation\n", }; =20 -static unsigned HOST_WIDE_INT seed; -/* - * get_random_seed() (this is a GCC function) generates the seed. - * This is a simple random generator without any cryptographic security be= cause - * the entropy doesn't come from here. - */ +static unsigned HOST_WIDE_INT deterministic_seed; +static unsigned HOST_WIDE_INT rnd_buf[32]; +static size_t rnd_idx =3D ARRAY_SIZE(rnd_buf); +static int urandom_fd =3D -1; + static unsigned HOST_WIDE_INT get_random_const(void) { - unsigned int i; - unsigned HOST_WIDE_INT ret =3D 0; - - for (i =3D 0; i < 8 * sizeof(ret); i++) { - ret =3D (ret << 1) | (seed & 1); - seed >>=3D 1; - if (ret & 1) - seed ^=3D 0xD800000000000000ULL; + if (deterministic_seed) { + unsigned HOST_WIDE_INT w =3D deterministic_seed; + w ^=3D w << 13; + w ^=3D w >> 7; + w ^=3D w << 17; + deterministic_seed =3D w; + return deterministic_seed; } =20 - return ret; + if (urandom_fd < 0) { + urandom_fd =3D open("/dev/urandom", O_RDONLY); + gcc_assert(urandom_fd >=3D 0); + } + if (rnd_idx >=3D ARRAY_SIZE(rnd_buf)) { + gcc_assert(read(urandom_fd, rnd_buf, sizeof(rnd_buf)) =3D=3D sizeof(rnd_= buf)); + rnd_idx =3D 0; + } + return rnd_buf[rnd_idx++]; } =20 static tree tree_get_random_const(tree type) @@ -549,8 +555,6 @@ static void latent_entropy_start_unit(vo tree type, id; int quals; =20 - seed =3D get_random_seed(false); - if (in_lto_p) return; =20 @@ -585,6 +589,12 @@ __visible int plugin_init(struct plugin_ const struct plugin_argument * const argv =3D plugin_info->argv; int i; =20 + /* + * Call get_random_seed() with noinit=3Dtrue, so that this returns + * 0 in the case where no seed has been passed via -frandom-seed. + */ + deterministic_seed =3D get_random_seed(true); + static const struct ggc_root_tab gt_ggc_r_gt_latent_entropy[] =3D { { .base =3D &latent_entropy_decl, From nobody Thu May 14 08:55:39 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 3FB0EC352A1 for ; Mon, 18 Apr 2022 13:32:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242480AbiDRNcx (ORCPT ); Mon, 18 Apr 2022 09:32:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240922AbiDRNGI (ORCPT ); Mon, 18 Apr 2022 09:06:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DA422A248; Mon, 18 Apr 2022 05:46:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DE028B80E4B; Mon, 18 Apr 2022 12:46:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A80BC385A8; Mon, 18 Apr 2022 12:46:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286012; bh=ebi2poixp33S572jMWkGPuaSEFRwfhtfz+49UaSKZrE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZeL6O/qYKldtuwxo/hx/v5UDG4+0EjapfS0nmcZLyENGqFNJPUad/edzu5hPgOkFo lx0U+FFeiPQU79GljTGJiLOnKq/9/ZTdb9vUg8PR0FvkxMb7UWU8oG1mwySR3lXQV5 uDX0chYMjFPB8u6wSyrbzYn+Lqiq1JU+S+fFntks= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tim Crawford , Takashi Iwai Subject: [PATCH 4.19 27/32] ALSA: hda/realtek: Add quirk for Clevo PD50PNT Date: Mon, 18 Apr 2022 14:14:07 +0200 Message-Id: <20220418121127.917655493@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: Tim Crawford commit 9eb6f5c388060d8cef3c8b616cc31b765e022359 upstream. Fixes speaker output and headset detection on Clevo PD50PNT. Signed-off-by: Tim Crawford Cc: Link: https://lore.kernel.org/r/20220405182029.27431-1-tcrawford@system76.c= om Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -2552,6 +2552,7 @@ static const struct snd_pci_quirk alc882 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_P= B51ED_PINS), SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP= _CLEVO_PB51ED_PINS), SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_= PINS), + SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB= 51ED_PINS), SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_= PB51ED_PINS), SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_= PB51ED_PINS), SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP= _CLEVO_PB51ED_PINS), From nobody Thu May 14 08:55:39 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 11000C4167B for ; Mon, 18 Apr 2022 13:32:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243327AbiDRNdl (ORCPT ); Mon, 18 Apr 2022 09:33:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240929AbiDRNGI (ORCPT ); Mon, 18 Apr 2022 09:06:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 654071FCD8; Mon, 18 Apr 2022 05:46:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1C9D6B80E44; Mon, 18 Apr 2022 12:46:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B4B7C385A7; Mon, 18 Apr 2022 12:46:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286015; bh=nhuYi2qs/CaPg8GzQnbJsdSZjxr490PHpKyhumTNwRA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2CRtpQBmnNderTeelGOYHoWqWru2/PzwJU1T7/LDKp8LIPVLqfQePewGKUP/wzh6A o0DJec65GUnBoYK2FfUkRk05U3YlndVFCf6l+56qE2zAY7P9qeyRb/kTSKUlpPhlCg 5E95hn3UDhEUp0WdqCmMhuuXbyTxGb8bgNE6Ei9Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Fabio M. De Francesco" , Takashi Iwai , syzbot+205eb15961852c2c5974@syzkaller.appspotmail.com Subject: [PATCH 4.19 28/32] ALSA: pcm: Test for "silence" field in struct "pcm_format_data" Date: Mon, 18 Apr 2022 14:14:08 +0200 Message-Id: <20220418121127.946751845@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: Fabio M. De Francesco commit 2f7a26abb8241a0208c68d22815aa247c5ddacab upstream. Syzbot reports "KASAN: null-ptr-deref Write in snd_pcm_format_set_silence".[1] It is due to missing validation of the "silence" field of struct "pcm_format_data" in "pcm_formats" array. Add a test for valid "pat" and, if it is not so, return -EINVAL. [1] https://lore.kernel.org/lkml/000000000000d188ef05dc2c7279@google.com/ Reported-and-tested-by: syzbot+205eb15961852c2c5974@syzkaller.appspotmail.c= om Signed-off-by: Fabio M. De Francesco Cc: Link: https://lore.kernel.org/r/20220409012655.9399-1-fmdefrancesco@gmail.c= om Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- sound/core/pcm_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/sound/core/pcm_misc.c +++ b/sound/core/pcm_misc.c @@ -423,7 +423,7 @@ int snd_pcm_format_set_silence(snd_pcm_f return 0; width =3D pcm_formats[(INT)format].phys; /* physical width */ pat =3D pcm_formats[(INT)format].silence; - if (! width) + if (!width || !pat) return -EINVAL; /* signed or 1 byte data */ if (pcm_formats[(INT)format].signd =3D=3D 1 || width <=3D 8) { From nobody Thu May 14 08:55:39 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 6C57FC47082 for ; Mon, 18 Apr 2022 13:32:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242884AbiDRNdM (ORCPT ); Mon, 18 Apr 2022 09:33:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241033AbiDRNG1 (ORCPT ); Mon, 18 Apr 2022 09:06:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B472F205EA; Mon, 18 Apr 2022 05:46:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5292160FB6; Mon, 18 Apr 2022 12:46:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E148C385A7; Mon, 18 Apr 2022 12:46:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286018; bh=zBJNy/Kf5/ebqjjWgmhv1exfCehm8Yb1pAzLqAw/ax4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cG+RDOg2nm7uF3OPp9Duil3RkFRmqiWoL90yCHj1II0/0VJ84Yvyi8otgVaqOfvM8 lEwFlgCQMX6T54Sjg8SeWdYMkJNqxOjMEcKm20mCBI7K+lFqNilc2EgUJvv0WgNbqb F++7yBHmOR7ksjxITRjcK09zsGk3DTRlzRYszFEU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kongweibin , Nicolas Dichtel , David Ahern , "David S. Miller" Subject: [PATCH 4.19 29/32] ipv6: fix panic when forwarding a pkt with no in6 dev Date: Mon, 18 Apr 2022 14:14:09 +0200 Message-Id: <20220418121127.975944518@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nicolas Dichtel commit e3fa461d8b0e185b7da8a101fe94dfe6dd500ac0 upstream. kongweibin reported a kernel panic in ip6_forward() when input interface has no in6 dev associated. The following tc commands were used to reproduce this panic: tc qdisc del dev vxlan100 root tc qdisc add dev vxlan100 root netem corrupt 5% CC: stable@vger.kernel.org Fixes: ccd27f05ae7b ("ipv6: fix 'disable_policy' for fwd packets") Reported-by: kongweibin Signed-off-by: Nicolas Dichtel Reviewed-by: David Ahern Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- net/ipv6/ip6_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -460,7 +460,7 @@ int ip6_forward(struct sk_buff *skb) goto drop; =20 if (!net->ipv6.devconf_all->disable_policy && - !idev->cnf.disable_policy && + (!idev || !idev->cnf.disable_policy) && !xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) { __IP6_INC_STATS(net, idev, IPSTATS_MIB_INDISCARDS); goto drop; From nobody Thu May 14 08:55:39 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 2E1DFC4332F for ; Mon, 18 Apr 2022 13:32:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243408AbiDRNdq (ORCPT ); Mon, 18 Apr 2022 09:33:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241083AbiDRNG2 (ORCPT ); Mon, 18 Apr 2022 09:06:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF6452126A; Mon, 18 Apr 2022 05:47:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7B2FE60FB6; Mon, 18 Apr 2022 12:47:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69881C385A7; Mon, 18 Apr 2022 12:47:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286021; bh=UrRosSDML4N48/YHmcAhpS5NtgtMPnHUWSOftae3klw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KxQyNm/PQFPK2Oa9NKfQZzaghzkrE57SzIJdEb02lb+NNg0/EcaZKz+U0q7AEXr1y Mk0sTfRIBXxc5nMtfzOdYzW90l8eIAiPfqi6oV1ZpSlE7LPnygVB3xKgm6Lu6tGjlU QZQ8VVDrx3mINms0XIVNt+BsVa3OUB7VYesozX5I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Arnd Bergmann , Bartosz Golaszewski Subject: [PATCH 4.19 30/32] ARM: davinci: da850-evm: Avoid NULL pointer dereference Date: Mon, 18 Apr 2022 14:14:10 +0200 Message-Id: <20220418121128.004736264@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: Nathan Chancellor commit 83a1cde5c74bfb44b49cb2a940d044bb2380f4ea upstream. With newer versions of GCC, there is a panic in da850_evm_config_emac() when booting multi_v5_defconfig in QEMU under the palmetto-bmc machine: Unable to handle kernel NULL pointer dereference at virtual address 00000020 pgd =3D (ptrval) [00000020] *pgd=3D00000000 Internal error: Oops: 5 [#1] PREEMPT ARM Modules linked in: CPU: 0 PID: 1 Comm: swapper Not tainted 5.15.0 #1 Hardware name: Generic DT based system PC is at da850_evm_config_emac+0x1c/0x120 LR is at do_one_initcall+0x50/0x1e0 The emac_pdata pointer in soc_info is NULL because davinci_soc_info only gets populated on davinci machines but da850_evm_config_emac() is called on all machines via device_initcall(). Move the rmii_en assignment below the machine check so that it is only dereferenced when running on a supported SoC. Fixes: bae105879f2f ("davinci: DA850/OMAP-L138 EVM: implement autodetect of= RMII PHY") Signed-off-by: Nathan Chancellor Reviewed-by: Arnd Bergmann Reviewed-by: Bartosz Golaszewski Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/YcS4xVWs6bQlQSPC@archlinux-ax161/ Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/arm/mach-davinci/board-da850-evm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c @@ -1045,11 +1045,13 @@ static int __init da850_evm_config_emac( int ret; u32 val; struct davinci_soc_info *soc_info =3D &davinci_soc_info; - u8 rmii_en =3D soc_info->emac_pdata->rmii_en; + u8 rmii_en; =20 if (!machine_is_davinci_da850_evm()) return 0; =20 + rmii_en =3D soc_info->emac_pdata->rmii_en; + cfg_chip3_base =3D DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG); =20 val =3D __raw_readl(cfg_chip3_base); From nobody Thu May 14 08:55:39 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 4BCA4C38A06 for ; Mon, 18 Apr 2022 13:32:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243447AbiDRNdu (ORCPT ); Mon, 18 Apr 2022 09:33:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241103AbiDRNGf (ORCPT ); Mon, 18 Apr 2022 09:06:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 625E120BCD; Mon, 18 Apr 2022 05:47: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 12617B80E4E; Mon, 18 Apr 2022 12:47:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60619C385A7; Mon, 18 Apr 2022 12:47:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286024; bh=GWct4j8vHMTNJlD+w0aPeGQoSvV2bVI6BpkNRMBq7SU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zvCdEZbo3WsjFCllwvMxPbLWO33A4SEh4azkqdsFMgLloBAOfDXDDCiqd/qjh29Vk DqPLoh+SBu/ZHCP77+95gGDQSBSmFVXIvYmquZRtD/ygfjjry7kILy/G0S+F3La3hI PrOC7SMUwhX+qKjYtuu+YnfmgnbJSdZnihjeHypk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nadav Amit , Thomas Gleixner Subject: [PATCH 4.19 31/32] smp: Fix offline cpu check in flush_smp_call_function_queue() Date: Mon, 18 Apr 2022 14:14:11 +0200 Message-Id: <20220418121128.032949764@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@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: Nadav Amit commit 9e949a3886356fe9112c6f6f34a6e23d1d35407f upstream. The check in flush_smp_call_function_queue() for callbacks that are sent to offline CPUs currently checks whether the queue is empty. However, flush_smp_call_function_queue() has just deleted all the callbacks from the queue and moved all the entries into a local list. This checks would only be positive if some callbacks were added in the short time after llist_del_all() was called. This does not seem to be the intention of this check. Change the check to look at the local list to which the entries were moved instead of the queue from which all the callbacks were just removed. Fixes: 8d056c48e4862 ("CPU hotplug, smp: flush any pending IPI callbacks be= fore CPU offline") Signed-off-by: Nadav Amit Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20220319072015.1495036-1-namit@vmware.com Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- kernel/smp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/smp.c +++ b/kernel/smp.c @@ -221,7 +221,7 @@ static void flush_smp_call_function_queu =20 /* There shouldn't be any pending callbacks on an offline CPU. */ if (unlikely(warn_cpu_offline && !cpu_online(smp_processor_id()) && - !warned && !llist_empty(head))) { + !warned && entry !=3D NULL)) { warned =3D true; WARN(1, "IPI on offline CPU %d\n", smp_processor_id()); From nobody Thu May 14 08:55:39 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 B0B62C38A04 for ; Mon, 18 Apr 2022 13:32:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243082AbiDRNdY (ORCPT ); Mon, 18 Apr 2022 09:33:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241120AbiDRNGi (ORCPT ); Mon, 18 Apr 2022 09:06:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C52D21276; Mon, 18 Apr 2022 05:47:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2A7D7B80E44; Mon, 18 Apr 2022 12:47:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7AF4AC385A7; Mon, 18 Apr 2022 12:47:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286027; bh=qt6zVlScKlgp/UWRwAPjnLop5XpVwyg8xY7P3/aVvDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y5e4f/3PnPuE3HfsGsCDaTtydfPYJPUZ43DbRTZpdHFI8BmXOFdZoKEAdTKLuVLyO 3d21fe42vHJkWzq1oGF2g9bTiOoKINYP9zE4VeMlk8VvsdLO3J4YGWEXIDnfD1wbKG flmRY9fnRcYF/ob2Pr9UsI/e5WvA41Yl4ZuGvIQY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Martin=20Povi=C5=A1er?= , Sven Peter , Wolfram Sang Subject: [PATCH 4.19 32/32] i2c: pasemi: Wait for write xfers to finish Date: Mon, 18 Apr 2022 14:14:12 +0200 Message-Id: <20220418121128.061258659@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121127.127656835@linuxfoundation.org> References: <20220418121127.127656835@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Martin Povi=C5=A1er commit bd8963e602c77adc76dbbbfc3417c3cf14fed76b upstream. Wait for completion of write transfers before returning from the driver. At first sight it may seem advantageous to leave write transfers queued for the controller to carry out on its own time, but there's a couple of issues with it: * Driver doesn't check for FIFO space. * The queued writes can complete while the driver is in its I2C read transfer path which means it will get confused by the raising of XEN (the 'transaction ended' signal). This can cause a spurious ENODATA error due to premature reading of the MRXFIFO register. Adding the wait fixes some unreliability issues with the driver. There's some efficiency cost to it (especially with pasemi_smb_waitready doing its polling), but that will be alleviated once the driver receives interrupt support. Fixes: beb58aa39e6e ("i2c: PA Semi SMBus driver") Signed-off-by: Martin Povi=C5=A1er Reviewed-by: Sven Peter Signed-off-by: Wolfram Sang Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/i2c/busses/i2c-pasemi.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/i2c/busses/i2c-pasemi.c +++ b/drivers/i2c/busses/i2c-pasemi.c @@ -145,6 +145,12 @@ static int pasemi_i2c_xfer_msg(struct i2 =20 TXFIFO_WR(smbus, msg->buf[msg->len-1] | (stop ? MTXFIFO_STOP : 0)); + + if (stop) { + err =3D pasemi_smb_waitready(smbus); + if (err) + goto reset_out; + } } =20 return 0;