From 770b91a6bb172a7a755f71093f2a3c67b07ee1a5 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 22 Sep 2025 07:51:14 +0200 Subject: [PATCH] 5.15-stable patches added patches: mptcp-propagate-shutdown-to-subflows-when-possible.patch net-rfkill-gpio-add-dt-support.patch net-rfkill-gpio-fix-crash-due-to-dereferencering-uninitialized-pointer.patch --- ...e-shutdown-to-subflows-when-possible.patch | 83 +++++++++++++++++++ .../net-rfkill-gpio-add-dt-support.patch | 77 +++++++++++++++++ ...ereferencering-uninitialized-pointer.patch | 60 ++++++++++++++ queue-5.15/series | 3 + 4 files changed, 223 insertions(+) create mode 100644 queue-5.15/mptcp-propagate-shutdown-to-subflows-when-possible.patch create mode 100644 queue-5.15/net-rfkill-gpio-add-dt-support.patch create mode 100644 queue-5.15/net-rfkill-gpio-fix-crash-due-to-dereferencering-uninitialized-pointer.patch diff --git a/queue-5.15/mptcp-propagate-shutdown-to-subflows-when-possible.patch b/queue-5.15/mptcp-propagate-shutdown-to-subflows-when-possible.patch new file mode 100644 index 0000000000..176917eba5 --- /dev/null +++ b/queue-5.15/mptcp-propagate-shutdown-to-subflows-when-possible.patch @@ -0,0 +1,83 @@ +From stable+bounces-180866-greg=kroah.com@vger.kernel.org Mon Sep 22 02:56:21 2025 +From: Sasha Levin +Date: Sun, 21 Sep 2025 20:56:12 -0400 +Subject: mptcp: propagate shutdown to subflows when possible +To: stable@vger.kernel.org +Cc: "Matthieu Baerts (NGI0)" , Mat Martineau , Geliang Tang , Jakub Kicinski , Sasha Levin +Message-ID: <20250922005613.3111681-1-sashal@kernel.org> + +From: "Matthieu Baerts (NGI0)" + +[ Upstream commit f755be0b1ff429a2ecf709beeb1bcd7abc111c2b ] + +When the MPTCP DATA FIN have been ACKed, there is no more MPTCP related +metadata to exchange, and all subflows can be safely shutdown. + +Before this patch, the subflows were actually terminated at 'close()' +time. That's certainly fine most of the time, but not when the userspace +'shutdown()' a connection, without close()ing it. When doing so, the +subflows were staying in LAST_ACK state on one side -- and consequently +in FIN_WAIT2 on the other side -- until the 'close()' of the MPTCP +socket. + +Now, when the DATA FIN have been ACKed, all subflows are shutdown. A +consequence of this is that the TCP 'FIN' flag can be set earlier now, +but the end result is the same. This affects the packetdrill tests +looking at the end of the MPTCP connections, but for a good reason. + +Note that tcp_shutdown() will check the subflow state, so no need to do +that again before calling it. + +Fixes: 3721b9b64676 ("mptcp: Track received DATA_FIN sequence number and add related helpers") +Cc: stable@vger.kernel.org +Fixes: 16a9a9da1723 ("mptcp: Add helper to process acks of DATA_FIN") +Reviewed-by: Mat Martineau +Reviewed-by: Geliang Tang +Signed-off-by: Matthieu Baerts (NGI0) +Link: https://patch.msgid.link/20250912-net-mptcp-fix-sft-connect-v1-1-d40e77cbbf02@kernel.org +Signed-off-by: Jakub Kicinski +[ Adjust context ] +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + net/mptcp/protocol.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +--- a/net/mptcp/protocol.c ++++ b/net/mptcp/protocol.c +@@ -354,6 +354,19 @@ static void mptcp_close_wake_up(struct s + sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN); + } + ++static void mptcp_shutdown_subflows(struct mptcp_sock *msk) ++{ ++ struct mptcp_subflow_context *subflow; ++ ++ mptcp_for_each_subflow(msk, subflow) { ++ struct sock *ssk = mptcp_subflow_tcp_sock(subflow); ++ bool slow; ++ ++ slow = lock_sock_fast(ssk); ++ tcp_shutdown(ssk, SEND_SHUTDOWN); ++ unlock_sock_fast(ssk, slow); ++ } ++} + static bool mptcp_pending_data_fin_ack(struct sock *sk) + { + struct mptcp_sock *msk = mptcp_sk(sk); +@@ -377,6 +390,7 @@ static void mptcp_check_data_fin_ack(str + break; + case TCP_CLOSING: + case TCP_LAST_ACK: ++ mptcp_shutdown_subflows(msk); + inet_sk_state_store(sk, TCP_CLOSE); + break; + } +@@ -539,6 +553,7 @@ static bool mptcp_check_data_fin(struct + inet_sk_state_store(sk, TCP_CLOSING); + break; + case TCP_FIN_WAIT2: ++ mptcp_shutdown_subflows(msk); + inet_sk_state_store(sk, TCP_CLOSE); + break; + default: diff --git a/queue-5.15/net-rfkill-gpio-add-dt-support.patch b/queue-5.15/net-rfkill-gpio-add-dt-support.patch new file mode 100644 index 0000000000..0559308771 --- /dev/null +++ b/queue-5.15/net-rfkill-gpio-add-dt-support.patch @@ -0,0 +1,77 @@ +From stable+bounces-180853-greg=kroah.com@vger.kernel.org Mon Sep 22 01:37:16 2025 +From: Sasha Levin +Date: Sun, 21 Sep 2025 19:37:08 -0400 +Subject: net: rfkill: gpio: add DT support +To: stable@vger.kernel.org +Cc: Philipp Zabel , Johannes Berg , Sasha Levin +Message-ID: <20250921233709.3086047-1-sashal@kernel.org> + +From: Philipp Zabel + +[ Upstream commit d64c732dfc9edcd57feb693c23162117737e426b ] + +Allow probing rfkill-gpio via device tree. This hooks up the already +existing support that was started in commit 262c91ee5e52 ("net: +rfkill: gpio: prepare for DT and ACPI support") via the "rfkill-gpio" +compatible, with the "name" and "type" properties renamed to "label" +and "radio-type", respectively, in the device tree case. + +Signed-off-by: Philipp Zabel +Link: https://lore.kernel.org/r/20230102-rfkill-gpio-dt-v2-2-d1b83758c16d@pengutronix.de +Signed-off-by: Johannes Berg +Stable-dep-of: b6f56a44e4c1 ("net: rfkill: gpio: Fix crash due to dereferencering uninitialized pointer") +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + net/rfkill/rfkill-gpio.c | 20 ++++++++++++++++++-- + 1 file changed, 18 insertions(+), 2 deletions(-) + +--- a/net/rfkill/rfkill-gpio.c ++++ b/net/rfkill/rfkill-gpio.c +@@ -79,6 +79,8 @@ static int rfkill_gpio_probe(struct plat + { + struct rfkill_gpio_data *rfkill; + struct gpio_desc *gpio; ++ const char *name_property; ++ const char *type_property; + const char *type_name; + int ret; + +@@ -86,8 +88,15 @@ static int rfkill_gpio_probe(struct plat + if (!rfkill) + return -ENOMEM; + +- device_property_read_string(&pdev->dev, "name", &rfkill->name); +- device_property_read_string(&pdev->dev, "type", &type_name); ++ if (dev_of_node(&pdev->dev)) { ++ name_property = "label"; ++ type_property = "radio-type"; ++ } else { ++ name_property = "name"; ++ type_property = "type"; ++ } ++ device_property_read_string(&pdev->dev, name_property, &rfkill->name); ++ device_property_read_string(&pdev->dev, type_property, &type_name); + + if (!rfkill->name) + rfkill->name = dev_name(&pdev->dev); +@@ -169,12 +178,19 @@ static const struct acpi_device_id rfkil + MODULE_DEVICE_TABLE(acpi, rfkill_acpi_match); + #endif + ++static const struct of_device_id rfkill_of_match[] __maybe_unused = { ++ { .compatible = "rfkill-gpio", }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, rfkill_of_match); ++ + static struct platform_driver rfkill_gpio_driver = { + .probe = rfkill_gpio_probe, + .remove = rfkill_gpio_remove, + .driver = { + .name = "rfkill_gpio", + .acpi_match_table = ACPI_PTR(rfkill_acpi_match), ++ .of_match_table = of_match_ptr(rfkill_of_match), + }, + }; + diff --git a/queue-5.15/net-rfkill-gpio-fix-crash-due-to-dereferencering-uninitialized-pointer.patch b/queue-5.15/net-rfkill-gpio-fix-crash-due-to-dereferencering-uninitialized-pointer.patch new file mode 100644 index 0000000000..b9df018481 --- /dev/null +++ b/queue-5.15/net-rfkill-gpio-fix-crash-due-to-dereferencering-uninitialized-pointer.patch @@ -0,0 +1,60 @@ +From stable+bounces-180854-greg=kroah.com@vger.kernel.org Mon Sep 22 01:37:18 2025 +From: Sasha Levin +Date: Sun, 21 Sep 2025 19:37:09 -0400 +Subject: net: rfkill: gpio: Fix crash due to dereferencering uninitialized pointer +To: stable@vger.kernel.org +Cc: Hans de Goede , Heikki Krogerus , Johannes Berg , Sasha Levin +Message-ID: <20250921233709.3086047-2-sashal@kernel.org> + +From: Hans de Goede + +[ Upstream commit b6f56a44e4c1014b08859dcf04ed246500e310e5 ] + +Since commit 7d5e9737efda ("net: rfkill: gpio: get the name and type from +device property") rfkill_find_type() gets called with the possibly +uninitialized "const char *type_name;" local variable. + +On x86 systems when rfkill-gpio binds to a "BCM4752" or "LNV4752" +acpi_device, the rfkill->type is set based on the ACPI acpi_device_id: + + rfkill->type = (unsigned)id->driver_data; + +and there is no "type" property so device_property_read_string() will fail +and leave type_name uninitialized, leading to a potential crash. + +rfkill_find_type() does accept a NULL pointer, fix the potential crash +by initializing type_name to NULL. + +Note likely sofar this has not been caught because: + +1. Not many x86 machines actually have a "BCM4752"/"LNV4752" acpi_device +2. The stack happened to contain NULL where type_name is stored + +Fixes: 7d5e9737efda ("net: rfkill: gpio: get the name and type from device property") +Cc: stable@vger.kernel.org +Cc: Heikki Krogerus +Signed-off-by: Hans de Goede +Reviewed-by: Heikki Krogerus +Link: https://patch.msgid.link/20250913113515.21698-1-hansg@kernel.org +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + net/rfkill/rfkill-gpio.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/net/rfkill/rfkill-gpio.c ++++ b/net/rfkill/rfkill-gpio.c +@@ -78,10 +78,10 @@ static int rfkill_gpio_acpi_probe(struct + static int rfkill_gpio_probe(struct platform_device *pdev) + { + struct rfkill_gpio_data *rfkill; +- struct gpio_desc *gpio; ++ const char *type_name = NULL; + const char *name_property; + const char *type_property; +- const char *type_name; ++ struct gpio_desc *gpio; + int ret; + + rfkill = devm_kzalloc(&pdev->dev, sizeof(*rfkill), GFP_KERNEL); diff --git a/queue-5.15/series b/queue-5.15/series index 65daeac641..8c89d1d5be 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -97,3 +97,6 @@ phy-use-device_get_match_data.patch phy-ti-omap-usb2-fix-device-leak-at-unbind.patch mptcp-set-remote_deny_join_id0-on-syn-recv.patch ksmbd-smbdirect-validate-data_offset-and-data_length-field-of-smb_direct_data_transfer.patch +mptcp-propagate-shutdown-to-subflows-when-possible.patch +net-rfkill-gpio-add-dt-support.patch +net-rfkill-gpio-fix-crash-due-to-dereferencering-uninitialized-pointer.patch -- 2.47.3