From: Greg Kroah-Hartman Date: Sat, 7 Oct 2023 09:56:14 +0000 (+0200) Subject: 6.1-stable patches X-Git-Tag: v4.14.327~80 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1bc15a373489944bfb0598e2711552a47b6d77f8;p=thirdparty%2Fkernel%2Fstable-queue.git 6.1-stable patches added patches: arm64-cpufeature-fix-clrbhb-and-bc-detection.patch drm-amd-display-adjust-the-mst-resume-flow.patch net-add-sysctl-accept_ra_min_rtr_lft.patch net-change-accept_ra_min_rtr_lft-to-affect-all-ra-lifetimes.patch net-release-reference-to-inet6_dev-pointer.patch --- diff --git a/queue-6.1/arm64-cpufeature-fix-clrbhb-and-bc-detection.patch b/queue-6.1/arm64-cpufeature-fix-clrbhb-and-bc-detection.patch new file mode 100644 index 00000000000..a18c24f208e --- /dev/null +++ b/queue-6.1/arm64-cpufeature-fix-clrbhb-and-bc-detection.patch @@ -0,0 +1,71 @@ +From 479965a2b7ec481737df0cadf553331063b9c343 Mon Sep 17 00:00:00 2001 +From: Kristina Martsenko +Date: Tue, 12 Sep 2023 14:34:29 +0100 +Subject: arm64: cpufeature: Fix CLRBHB and BC detection + +From: Kristina Martsenko + +commit 479965a2b7ec481737df0cadf553331063b9c343 upstream. + +ClearBHB support is indicated by the CLRBHB field in ID_AA64ISAR2_EL1. +Following some refactoring the kernel incorrectly checks the BC field +instead. Fix the detection to use the right field. + +(Note: The original ClearBHB support had it as FTR_HIGHER_SAFE, but this +patch uses FTR_LOWER_SAFE, which seems more correct.) + +Also fix the detection of BC (hinted conditional branches) to use +FTR_LOWER_SAFE, so that it is not reported on mismatched systems. + +Fixes: 356137e68a9f ("arm64/sysreg: Make BHB clear feature defines match the architecture") +Fixes: 8fcc8285c0e3 ("arm64/sysreg: Convert ID_AA64ISAR2_EL1 to automatic generation") +Cc: stable@vger.kernel.org +Signed-off-by: Kristina Martsenko +Reviewed-by: Mark Brown +Link: https://lore.kernel.org/r/20230912133429.2606875-1-kristina.martsenko@arm.com +Signed-off-by: Will Deacon +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm64/include/asm/cpufeature.h | 2 +- + arch/arm64/kernel/cpufeature.c | 3 ++- + arch/arm64/tools/sysreg | 6 +++++- + 3 files changed, 8 insertions(+), 3 deletions(-) + +--- a/arch/arm64/include/asm/cpufeature.h ++++ b/arch/arm64/include/asm/cpufeature.h +@@ -670,7 +670,7 @@ static inline bool supports_clearbhb(int + isar2 = read_sanitised_ftr_reg(SYS_ID_AA64ISAR2_EL1); + + return cpuid_feature_extract_unsigned_field(isar2, +- ID_AA64ISAR2_EL1_BC_SHIFT); ++ ID_AA64ISAR2_EL1_CLRBHB_SHIFT); + } + + const struct cpumask *system_32bit_el0_cpumask(void); +--- a/arch/arm64/kernel/cpufeature.c ++++ b/arch/arm64/kernel/cpufeature.c +@@ -212,7 +212,8 @@ static const struct arm64_ftr_bits ftr_i + }; + + static const struct arm64_ftr_bits ftr_id_aa64isar2[] = { +- ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_HIGHER_SAFE, ID_AA64ISAR2_EL1_BC_SHIFT, 4, 0), ++ ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ISAR2_EL1_CLRBHB_SHIFT, 4, 0), ++ ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ISAR2_EL1_BC_SHIFT, 4, 0), + ARM64_FTR_BITS(FTR_VISIBLE_IF_IS_ENABLED(CONFIG_ARM64_PTR_AUTH), + FTR_STRICT, FTR_EXACT, ID_AA64ISAR2_EL1_APA3_SHIFT, 4, 0), + ARM64_FTR_BITS(FTR_VISIBLE_IF_IS_ENABLED(CONFIG_ARM64_PTR_AUTH), +--- a/arch/arm64/tools/sysreg ++++ b/arch/arm64/tools/sysreg +@@ -484,7 +484,11 @@ EndEnum + EndSysreg + + Sysreg ID_AA64ISAR2_EL1 3 0 0 6 2 +-Res0 63:28 ++Res0 63:32 ++Enum 31:28 CLRBHB ++ 0b0000 NI ++ 0b0001 IMP ++EndEnum + Enum 27:24 PAC_frac + 0b0000 NI + 0b0001 IMP diff --git a/queue-6.1/drm-amd-display-adjust-the-mst-resume-flow.patch b/queue-6.1/drm-amd-display-adjust-the-mst-resume-flow.patch new file mode 100644 index 00000000000..e2cbeed734f --- /dev/null +++ b/queue-6.1/drm-amd-display-adjust-the-mst-resume-flow.patch @@ -0,0 +1,181 @@ +From ec5fa9fcdeca69edf7dab5ca3b2e0ceb1c08fe9a Mon Sep 17 00:00:00 2001 +From: Wayne Lin +Date: Tue, 22 Aug 2023 16:03:17 +0800 +Subject: drm/amd/display: Adjust the MST resume flow + +From: Wayne Lin + +commit ec5fa9fcdeca69edf7dab5ca3b2e0ceb1c08fe9a upstream. + +[Why] +In drm_dp_mst_topology_mgr_resume() today, it will resume the +mst branch to be ready handling mst mode and also consecutively do +the mst topology probing. Which will cause the dirver have chance +to fire hotplug event before restoring the old state. Then Userspace +will react to the hotplug event based on a wrong state. + +[How] +Adjust the mst resume flow as: +1. set dpcd to resume mst branch status +2. restore source old state +3. Do mst resume topology probing + +For drm_dp_mst_topology_mgr_resume(), it's better to adjust it to +pull out topology probing work into a 2nd part procedure of the mst +resume. Will have a follow up patch in drm. + +Reviewed-by: Chao-kai Wang +Cc: Mario Limonciello +Cc: Alex Deucher +Cc: stable@vger.kernel.org +Acked-by: Stylon Wang +Signed-off-by: Wayne Lin +Tested-by: Daniel Wheeler +Signed-off-by: Alex Deucher +[ Adjust for missing variable rename in + f0127cb11299 ("drm/amdgpu/display/mst: adjust the naming of mst_port and port of aconnector") ] +Signed-off-by: Mario Limonciello +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 93 ++++++++++++++++++---- + 1 file changed, 80 insertions(+), 13 deletions(-) + +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +@@ -2344,14 +2344,62 @@ static int dm_late_init(void *handle) + return detect_mst_link_for_all_connectors(adev_to_drm(adev)); + } + ++static void resume_mst_branch_status(struct drm_dp_mst_topology_mgr *mgr) ++{ ++ int ret; ++ u8 guid[16]; ++ u64 tmp64; ++ ++ mutex_lock(&mgr->lock); ++ if (!mgr->mst_primary) ++ goto out_fail; ++ ++ if (drm_dp_read_dpcd_caps(mgr->aux, mgr->dpcd) < 0) { ++ drm_dbg_kms(mgr->dev, "dpcd read failed - undocked during suspend?\n"); ++ goto out_fail; ++ } ++ ++ ret = drm_dp_dpcd_writeb(mgr->aux, DP_MSTM_CTRL, ++ DP_MST_EN | ++ DP_UP_REQ_EN | ++ DP_UPSTREAM_IS_SRC); ++ if (ret < 0) { ++ drm_dbg_kms(mgr->dev, "mst write failed - undocked during suspend?\n"); ++ goto out_fail; ++ } ++ ++ /* Some hubs forget their guids after they resume */ ++ ret = drm_dp_dpcd_read(mgr->aux, DP_GUID, guid, 16); ++ if (ret != 16) { ++ drm_dbg_kms(mgr->dev, "dpcd read failed - undocked during suspend?\n"); ++ goto out_fail; ++ } ++ ++ if (memchr_inv(guid, 0, 16) == NULL) { ++ tmp64 = get_jiffies_64(); ++ memcpy(&guid[0], &tmp64, sizeof(u64)); ++ memcpy(&guid[8], &tmp64, sizeof(u64)); ++ ++ ret = drm_dp_dpcd_write(mgr->aux, DP_GUID, guid, 16); ++ ++ if (ret != 16) { ++ drm_dbg_kms(mgr->dev, "check mstb guid failed - undocked during suspend?\n"); ++ goto out_fail; ++ } ++ } ++ ++ memcpy(mgr->mst_primary->guid, guid, 16); ++ ++out_fail: ++ mutex_unlock(&mgr->lock); ++} ++ + static void s3_handle_mst(struct drm_device *dev, bool suspend) + { + struct amdgpu_dm_connector *aconnector; + struct drm_connector *connector; + struct drm_connector_list_iter iter; + struct drm_dp_mst_topology_mgr *mgr; +- int ret; +- bool need_hotplug = false; + + drm_connector_list_iter_begin(dev, &iter); + drm_for_each_connector_iter(connector, &iter) { +@@ -2373,18 +2421,15 @@ static void s3_handle_mst(struct drm_dev + if (!dp_is_lttpr_present(aconnector->dc_link)) + dc_link_aux_try_to_configure_timeout(aconnector->dc_link->ddc, LINK_AUX_DEFAULT_TIMEOUT_PERIOD); + +- ret = drm_dp_mst_topology_mgr_resume(mgr, true); +- if (ret < 0) { +- dm_helpers_dp_mst_stop_top_mgr(aconnector->dc_link->ctx, +- aconnector->dc_link); +- need_hotplug = true; +- } ++ /* TODO: move resume_mst_branch_status() into drm mst resume again ++ * once topology probing work is pulled out from mst resume into mst ++ * resume 2nd step. mst resume 2nd step should be called after old ++ * state getting restored (i.e. drm_atomic_helper_resume()). ++ */ ++ resume_mst_branch_status(mgr); + } + } + drm_connector_list_iter_end(&iter); +- +- if (need_hotplug) +- drm_kms_helper_hotplug_event(dev); + } + + static int amdgpu_dm_smu_write_watermarks_table(struct amdgpu_device *adev) +@@ -2773,7 +2818,8 @@ static int dm_resume(void *handle) + struct dm_atomic_state *dm_state = to_dm_atomic_state(dm->atomic_obj.state); + enum dc_connection_type new_connection_type = dc_connection_none; + struct dc_state *dc_state; +- int i, r, j; ++ int i, r, j, ret; ++ bool need_hotplug = false; + + if (amdgpu_in_reset(adev)) { + dc_state = dm->cached_dc_state; +@@ -2871,7 +2917,7 @@ static int dm_resume(void *handle) + continue; + + /* +- * this is the case when traversing through already created ++ * this is the case when traversing through already created end sink + * MST connectors, should be skipped + */ + if (aconnector && aconnector->mst_port) +@@ -2931,6 +2977,27 @@ static int dm_resume(void *handle) + + dm->cached_state = NULL; + ++ /* Do mst topology probing after resuming cached state*/ ++ drm_connector_list_iter_begin(ddev, &iter); ++ drm_for_each_connector_iter(connector, &iter) { ++ aconnector = to_amdgpu_dm_connector(connector); ++ if (aconnector->dc_link->type != dc_connection_mst_branch || ++ aconnector->mst_port) ++ continue; ++ ++ ret = drm_dp_mst_topology_mgr_resume(&aconnector->mst_mgr, true); ++ ++ if (ret < 0) { ++ dm_helpers_dp_mst_stop_top_mgr(aconnector->dc_link->ctx, ++ aconnector->dc_link); ++ need_hotplug = true; ++ } ++ } ++ drm_connector_list_iter_end(&iter); ++ ++ if (need_hotplug) ++ drm_kms_helper_hotplug_event(ddev); ++ + amdgpu_dm_irq_resume_late(adev); + + amdgpu_dm_smu_write_watermarks_table(adev); diff --git a/queue-6.1/net-add-sysctl-accept_ra_min_rtr_lft.patch b/queue-6.1/net-add-sysctl-accept_ra_min_rtr_lft.patch new file mode 100644 index 00000000000..b121f5ae6b8 --- /dev/null +++ b/queue-6.1/net-add-sysctl-accept_ra_min_rtr_lft.patch @@ -0,0 +1,159 @@ +From 1671bcfd76fdc0b9e65153cf759153083755fe4c Mon Sep 17 00:00:00 2001 +From: Patrick Rohr +Date: Wed, 19 Jul 2023 07:52:13 -0700 +Subject: net: add sysctl accept_ra_min_rtr_lft +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Patrick Rohr + +commit 1671bcfd76fdc0b9e65153cf759153083755fe4c upstream. + +This change adds a new sysctl accept_ra_min_rtr_lft to specify the +minimum acceptable router lifetime in an RA. If the received RA router +lifetime is less than the configured value (and not 0), the RA is +ignored. +This is useful for mobile devices, whose battery life can be impacted +by networks that configure RAs with a short lifetime. On such networks, +the device should never gain IPv6 provisioning and should attempt to +drop RAs via hardware offload, if available. + +Signed-off-by: Patrick Rohr +Cc: Maciej Żenczykowski +Cc: Lorenzo Colitti +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + Documentation/networking/ip-sysctl.rst | 8 ++++++++ + include/linux/ipv6.h | 1 + + include/uapi/linux/ipv6.h | 1 + + net/ipv6/addrconf.c | 10 ++++++++++ + net/ipv6/ndisc.c | 18 ++++++++++++++++-- + 5 files changed, 36 insertions(+), 2 deletions(-) + +--- a/Documentation/networking/ip-sysctl.rst ++++ b/Documentation/networking/ip-sysctl.rst +@@ -2148,6 +2148,14 @@ accept_ra_min_hop_limit - INTEGER + + Default: 1 + ++accept_ra_min_rtr_lft - INTEGER ++ Minimum acceptable router lifetime in Router Advertisement. ++ ++ RAs with a router lifetime less than this value shall be ++ ignored. RAs with a router lifetime of 0 are unaffected. ++ ++ Default: 0 ++ + accept_ra_pinfo - BOOLEAN + Learn Prefix Information in Router Advertisement. + +--- a/include/linux/ipv6.h ++++ b/include/linux/ipv6.h +@@ -33,6 +33,7 @@ struct ipv6_devconf { + __s32 accept_ra_defrtr; + __u32 ra_defrtr_metric; + __s32 accept_ra_min_hop_limit; ++ __s32 accept_ra_min_rtr_lft; + __s32 accept_ra_pinfo; + __s32 ignore_routes_with_linkdown; + #ifdef CONFIG_IPV6_ROUTER_PREF +--- a/include/uapi/linux/ipv6.h ++++ b/include/uapi/linux/ipv6.h +@@ -198,6 +198,7 @@ enum { + DEVCONF_IOAM6_ID_WIDE, + DEVCONF_NDISC_EVICT_NOCARRIER, + DEVCONF_ACCEPT_UNTRACKED_NA, ++ DEVCONF_ACCEPT_RA_MIN_RTR_LFT, + DEVCONF_MAX + }; + +--- a/net/ipv6/addrconf.c ++++ b/net/ipv6/addrconf.c +@@ -202,6 +202,7 @@ static struct ipv6_devconf ipv6_devconf + .ra_defrtr_metric = IP6_RT_PRIO_USER, + .accept_ra_from_local = 0, + .accept_ra_min_hop_limit= 1, ++ .accept_ra_min_rtr_lft = 0, + .accept_ra_pinfo = 1, + #ifdef CONFIG_IPV6_ROUTER_PREF + .accept_ra_rtr_pref = 1, +@@ -262,6 +263,7 @@ static struct ipv6_devconf ipv6_devconf_ + .ra_defrtr_metric = IP6_RT_PRIO_USER, + .accept_ra_from_local = 0, + .accept_ra_min_hop_limit= 1, ++ .accept_ra_min_rtr_lft = 0, + .accept_ra_pinfo = 1, + #ifdef CONFIG_IPV6_ROUTER_PREF + .accept_ra_rtr_pref = 1, +@@ -5601,6 +5603,7 @@ static inline void ipv6_store_devconf(st + array[DEVCONF_IOAM6_ID_WIDE] = cnf->ioam6_id_wide; + array[DEVCONF_NDISC_EVICT_NOCARRIER] = cnf->ndisc_evict_nocarrier; + array[DEVCONF_ACCEPT_UNTRACKED_NA] = cnf->accept_untracked_na; ++ array[DEVCONF_ACCEPT_RA_MIN_RTR_LFT] = cnf->accept_ra_min_rtr_lft; + } + + static inline size_t inet6_ifla6_size(void) +@@ -6793,6 +6796,13 @@ static const struct ctl_table addrconf_s + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec, ++ }, ++ { ++ .procname = "accept_ra_min_rtr_lft", ++ .data = &ipv6_devconf.accept_ra_min_rtr_lft, ++ .maxlen = sizeof(int), ++ .mode = 0644, ++ .proc_handler = proc_dointvec, + }, + { + .procname = "accept_ra_pinfo", +--- a/net/ipv6/ndisc.c ++++ b/net/ipv6/ndisc.c +@@ -1284,6 +1284,8 @@ static void ndisc_router_discovery(struc + return; + } + ++ lifetime = ntohs(ra_msg->icmph.icmp6_rt_lifetime); ++ + if (!ipv6_accept_ra(in6_dev)) { + ND_PRINTK(2, info, + "RA: %s, did not accept ra for dev: %s\n", +@@ -1291,6 +1293,13 @@ static void ndisc_router_discovery(struc + goto skip_linkparms; + } + ++ if (lifetime != 0 && lifetime < in6_dev->cnf.accept_ra_min_rtr_lft) { ++ ND_PRINTK(2, info, ++ "RA: router lifetime (%ds) is too short: %s\n", ++ lifetime, skb->dev->name); ++ goto skip_linkparms; ++ } ++ + #ifdef CONFIG_IPV6_NDISC_NODETYPE + /* skip link-specific parameters from interior routers */ + if (skb->ndisc_nodetype == NDISC_NODETYPE_NODEFAULT) { +@@ -1343,8 +1352,6 @@ static void ndisc_router_discovery(struc + goto skip_defrtr; + } + +- lifetime = ntohs(ra_msg->icmph.icmp6_rt_lifetime); +- + #ifdef CONFIG_IPV6_ROUTER_PREF + pref = ra_msg->icmph.icmp6_router_pref; + /* 10b is handled as if it were 00b (medium) */ +@@ -1495,6 +1502,13 @@ skip_linkparms: + goto out; + } + ++ if (lifetime != 0 && lifetime < in6_dev->cnf.accept_ra_min_rtr_lft) { ++ ND_PRINTK(2, info, ++ "RA: router lifetime (%ds) is too short: %s\n", ++ lifetime, skb->dev->name); ++ goto out; ++ } ++ + #ifdef CONFIG_IPV6_ROUTE_INFO + if (!in6_dev->cnf.accept_ra_from_local && + ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr, diff --git a/queue-6.1/net-change-accept_ra_min_rtr_lft-to-affect-all-ra-lifetimes.patch b/queue-6.1/net-change-accept_ra_min_rtr_lft-to-affect-all-ra-lifetimes.patch new file mode 100644 index 00000000000..001b229330d --- /dev/null +++ b/queue-6.1/net-change-accept_ra_min_rtr_lft-to-affect-all-ra-lifetimes.patch @@ -0,0 +1,209 @@ +From 5027d54a9c30bc7ec808360378e2b4753f053f25 Mon Sep 17 00:00:00 2001 +From: Patrick Rohr +Date: Wed, 26 Jul 2023 16:07:01 -0700 +Subject: net: change accept_ra_min_rtr_lft to affect all RA lifetimes +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Patrick Rohr + +commit 5027d54a9c30bc7ec808360378e2b4753f053f25 upstream. + +accept_ra_min_rtr_lft only considered the lifetime of the default route +and discarded entire RAs accordingly. + +This change renames accept_ra_min_rtr_lft to accept_ra_min_lft, and +applies the value to individual RA sections; in particular, router +lifetime, PIO preferred lifetime, and RIO lifetime. If any of those +lifetimes are lower than the configured value, the specific RA section +is ignored. + +In order for the sysctl to be useful to Android, it should really apply +to all lifetimes in the RA, since that is what determines the minimum +frequency at which RAs must be processed by the kernel. Android uses +hardware offloads to drop RAs for a fraction of the minimum of all +lifetimes present in the RA (some networks have very frequent RAs (5s) +with high lifetimes (2h)). Despite this, we have encountered networks +that set the router lifetime to 30s which results in very frequent CPU +wakeups. Instead of disabling IPv6 (and dropping IPv6 ethertype in the +WiFi firmware) entirely on such networks, it seems better to ignore the +misconfigured routers while still processing RAs from other IPv6 routers +on the same network (i.e. to support IoT applications). + +The previous implementation dropped the entire RA based on router +lifetime. This turned out to be hard to expand to the other lifetimes +present in the RA in a consistent manner; dropping the entire RA based +on RIO/PIO lifetimes would essentially require parsing the whole thing +twice. + +Fixes: 1671bcfd76fd ("net: add sysctl accept_ra_min_rtr_lft") +Cc: Lorenzo Colitti +Signed-off-by: Patrick Rohr +Reviewed-by: Maciej Żenczykowski +Reviewed-by: David Ahern +Link: https://lore.kernel.org/r/20230726230701.919212-1-prohr@google.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + Documentation/networking/ip-sysctl.rst | 8 ++++---- + include/linux/ipv6.h | 2 +- + include/uapi/linux/ipv6.h | 2 +- + net/ipv6/addrconf.c | 13 ++++++++----- + net/ipv6/ndisc.c | 27 +++++++++++---------------- + 5 files changed, 25 insertions(+), 27 deletions(-) + +--- a/Documentation/networking/ip-sysctl.rst ++++ b/Documentation/networking/ip-sysctl.rst +@@ -2148,11 +2148,11 @@ accept_ra_min_hop_limit - INTEGER + + Default: 1 + +-accept_ra_min_rtr_lft - INTEGER +- Minimum acceptable router lifetime in Router Advertisement. ++accept_ra_min_lft - INTEGER ++ Minimum acceptable lifetime value in Router Advertisement. + +- RAs with a router lifetime less than this value shall be +- ignored. RAs with a router lifetime of 0 are unaffected. ++ RA sections with a lifetime less than this value shall be ++ ignored. Zero lifetimes stay unaffected. + + Default: 0 + +--- a/include/linux/ipv6.h ++++ b/include/linux/ipv6.h +@@ -33,7 +33,7 @@ struct ipv6_devconf { + __s32 accept_ra_defrtr; + __u32 ra_defrtr_metric; + __s32 accept_ra_min_hop_limit; +- __s32 accept_ra_min_rtr_lft; ++ __s32 accept_ra_min_lft; + __s32 accept_ra_pinfo; + __s32 ignore_routes_with_linkdown; + #ifdef CONFIG_IPV6_ROUTER_PREF +--- a/include/uapi/linux/ipv6.h ++++ b/include/uapi/linux/ipv6.h +@@ -198,7 +198,7 @@ enum { + DEVCONF_IOAM6_ID_WIDE, + DEVCONF_NDISC_EVICT_NOCARRIER, + DEVCONF_ACCEPT_UNTRACKED_NA, +- DEVCONF_ACCEPT_RA_MIN_RTR_LFT, ++ DEVCONF_ACCEPT_RA_MIN_LFT, + DEVCONF_MAX + }; + +--- a/net/ipv6/addrconf.c ++++ b/net/ipv6/addrconf.c +@@ -202,7 +202,7 @@ static struct ipv6_devconf ipv6_devconf + .ra_defrtr_metric = IP6_RT_PRIO_USER, + .accept_ra_from_local = 0, + .accept_ra_min_hop_limit= 1, +- .accept_ra_min_rtr_lft = 0, ++ .accept_ra_min_lft = 0, + .accept_ra_pinfo = 1, + #ifdef CONFIG_IPV6_ROUTER_PREF + .accept_ra_rtr_pref = 1, +@@ -263,7 +263,7 @@ static struct ipv6_devconf ipv6_devconf_ + .ra_defrtr_metric = IP6_RT_PRIO_USER, + .accept_ra_from_local = 0, + .accept_ra_min_hop_limit= 1, +- .accept_ra_min_rtr_lft = 0, ++ .accept_ra_min_lft = 0, + .accept_ra_pinfo = 1, + #ifdef CONFIG_IPV6_ROUTER_PREF + .accept_ra_rtr_pref = 1, +@@ -2733,6 +2733,9 @@ void addrconf_prefix_rcv(struct net_devi + return; + } + ++ if (valid_lft != 0 && valid_lft < in6_dev->cnf.accept_ra_min_lft) ++ return; ++ + /* + * Two things going on here: + * 1) Add routes for on-link prefixes +@@ -5603,7 +5606,7 @@ static inline void ipv6_store_devconf(st + array[DEVCONF_IOAM6_ID_WIDE] = cnf->ioam6_id_wide; + array[DEVCONF_NDISC_EVICT_NOCARRIER] = cnf->ndisc_evict_nocarrier; + array[DEVCONF_ACCEPT_UNTRACKED_NA] = cnf->accept_untracked_na; +- array[DEVCONF_ACCEPT_RA_MIN_RTR_LFT] = cnf->accept_ra_min_rtr_lft; ++ array[DEVCONF_ACCEPT_RA_MIN_LFT] = cnf->accept_ra_min_lft; + } + + static inline size_t inet6_ifla6_size(void) +@@ -6798,8 +6801,8 @@ static const struct ctl_table addrconf_s + .proc_handler = proc_dointvec, + }, + { +- .procname = "accept_ra_min_rtr_lft", +- .data = &ipv6_devconf.accept_ra_min_rtr_lft, ++ .procname = "accept_ra_min_lft", ++ .data = &ipv6_devconf.accept_ra_min_lft, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec, +--- a/net/ipv6/ndisc.c ++++ b/net/ipv6/ndisc.c +@@ -1284,8 +1284,6 @@ static void ndisc_router_discovery(struc + return; + } + +- lifetime = ntohs(ra_msg->icmph.icmp6_rt_lifetime); +- + if (!ipv6_accept_ra(in6_dev)) { + ND_PRINTK(2, info, + "RA: %s, did not accept ra for dev: %s\n", +@@ -1293,13 +1291,6 @@ static void ndisc_router_discovery(struc + goto skip_linkparms; + } + +- if (lifetime != 0 && lifetime < in6_dev->cnf.accept_ra_min_rtr_lft) { +- ND_PRINTK(2, info, +- "RA: router lifetime (%ds) is too short: %s\n", +- lifetime, skb->dev->name); +- goto skip_linkparms; +- } +- + #ifdef CONFIG_IPV6_NDISC_NODETYPE + /* skip link-specific parameters from interior routers */ + if (skb->ndisc_nodetype == NDISC_NODETYPE_NODEFAULT) { +@@ -1340,6 +1331,14 @@ static void ndisc_router_discovery(struc + goto skip_defrtr; + } + ++ lifetime = ntohs(ra_msg->icmph.icmp6_rt_lifetime); ++ if (lifetime != 0 && lifetime < in6_dev->cnf.accept_ra_min_lft) { ++ ND_PRINTK(2, info, ++ "RA: router lifetime (%ds) is too short: %s\n", ++ lifetime, skb->dev->name); ++ goto skip_defrtr; ++ } ++ + /* Do not accept RA with source-addr found on local machine unless + * accept_ra_from_local is set to true. + */ +@@ -1502,13 +1501,6 @@ skip_linkparms: + goto out; + } + +- if (lifetime != 0 && lifetime < in6_dev->cnf.accept_ra_min_rtr_lft) { +- ND_PRINTK(2, info, +- "RA: router lifetime (%ds) is too short: %s\n", +- lifetime, skb->dev->name); +- goto out; +- } +- + #ifdef CONFIG_IPV6_ROUTE_INFO + if (!in6_dev->cnf.accept_ra_from_local && + ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr, +@@ -1533,6 +1525,9 @@ skip_linkparms: + if (ri->prefix_len == 0 && + !in6_dev->cnf.accept_ra_defrtr) + continue; ++ if (ri->lifetime != 0 && ++ ntohl(ri->lifetime) < in6_dev->cnf.accept_ra_min_lft) ++ continue; + if (ri->prefix_len < in6_dev->cnf.accept_ra_rt_info_min_plen) + continue; + if (ri->prefix_len > in6_dev->cnf.accept_ra_rt_info_max_plen) diff --git a/queue-6.1/net-release-reference-to-inet6_dev-pointer.patch b/queue-6.1/net-release-reference-to-inet6_dev-pointer.patch new file mode 100644 index 00000000000..e511060f5d5 --- /dev/null +++ b/queue-6.1/net-release-reference-to-inet6_dev-pointer.patch @@ -0,0 +1,41 @@ +From 5cb249686e67dbef3ffe53887fa725eefc5a7144 Mon Sep 17 00:00:00 2001 +From: Patrick Rohr +Date: Fri, 18 Aug 2023 11:22:49 -0700 +Subject: net: release reference to inet6_dev pointer +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Patrick Rohr + +commit 5cb249686e67dbef3ffe53887fa725eefc5a7144 upstream. + +addrconf_prefix_rcv returned early without releasing the inet6_dev +pointer when the PIO lifetime is less than accept_ra_min_lft. + +Fixes: 5027d54a9c30 ("net: change accept_ra_min_rtr_lft to affect all RA lifetimes") +Cc: Maciej Żenczykowski +Cc: Lorenzo Colitti +Cc: David Ahern +Cc: Simon Horman +Reviewed-by: Simon Horman +Reviewed-by: Maciej Żenczykowski +Signed-off-by: Patrick Rohr +Reviewed-by: Leon Romanovsky +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + net/ipv6/addrconf.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/net/ipv6/addrconf.c ++++ b/net/ipv6/addrconf.c +@@ -2734,7 +2734,7 @@ void addrconf_prefix_rcv(struct net_devi + } + + if (valid_lft != 0 && valid_lft < in6_dev->cnf.accept_ra_min_lft) +- return; ++ goto put; + + /* + * Two things going on here: diff --git a/queue-6.1/series b/queue-6.1/series index 90d14a01ecf..4d40ff2ffbe 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -39,6 +39,11 @@ btrfs-setup-qstr-from-dentrys-using-fscrypt-helper.patch btrfs-use-struct-fscrypt_str-instead-of-struct-qstr.patch revert-nfsv4-retry-lock-on-old_stateid-during-delega.patch arm64-avoid-repeated-aa64mmfr1_el1-register-read-on-.patch +net-add-sysctl-accept_ra_min_rtr_lft.patch +net-change-accept_ra_min_rtr_lft-to-affect-all-ra-lifetimes.patch +net-release-reference-to-inet6_dev-pointer.patch +arm64-cpufeature-fix-clrbhb-and-bc-detection.patch +drm-amd-display-adjust-the-mst-resume-flow.patch iommu-arm-smmu-v3-set-ttl-invalidation-hint-better.patch iommu-arm-smmu-v3-avoid-constructing-invalid-range-c.patch rbd-move-rbd_dev_refresh-definition.patch