hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8Y7PX CVE: NA
--------------------------------
The following error is reported when the kernel is compiled with CONFIG_SYSCTL disabled: aarch64-linux-ld: net/ipv4/inet_hashtables.o: in function `__inet_hash_connect': inet_hashtables.c:(.text+0x3564): undefined reference to `sysctl_local_port_allocation' aarch64-linux-ld: net/ipv4/inet_hashtables.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `sysctl_local_port_allocation' which may bind externally can not be used when making a shared object; recompile with -fPIC
inet_hashtables.c:(.text+0x3564): dangerous relocation: unsupported relocation
aarch64-linux-ld: inet_hashtables.c:(.text+0x3568): undefined reference to `sysctl_local_port_allocation' aarch64-linux-ld: inet_hashtables.c:(.text+0x3580): undefined reference to `sysctl_local_port_allocation' When CONFIG_SYSCTL is disabled, sysctl_local_port_allocation is undefined.
Fixes: 208a72041292 ("tcp/dccp: Add another way to allocate local ports in connect()") Reported-by: kernel test robot lkp@intel.com Closes: https://lore.kernel.org/oe-kbuild-all/202401180939.2N529UUe-lkp@intel.com/ Signed-off-by: Zhengchao Shao shaozhengchao@huawei.com --- v2: move sysctl_local_port_allocation to inet_hashtables.c --- net/ipv4/inet_hashtables.c | 2 ++ net/ipv4/sysctl_net_ipv4.c | 1 - 2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index a24dcf39e9ae..6fb12a4d86af 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c @@ -28,6 +28,8 @@ #include <net/tcp.h> #include <net/sock_reuseport.h>
+int sysctl_local_port_allocation = 0; + u32 inet_ehashfn(const struct net *net, const __be32 laddr, const __u16 lport, const __be32 faddr, const __be16 fport) diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index f212133b05e9..64b3bfcbfa25 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -39,7 +39,6 @@ static unsigned long ip_ping_group_range_min[] = { 0, 0 }; static unsigned long ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX }; static u32 u32_max_div_HZ = UINT_MAX / HZ; static int one_day_secs = 24 * 3600; -int sysctl_local_port_allocation; static u32 fib_multipath_hash_fields_all_mask __maybe_unused = FIB_MULTIPATH_HASH_FIELD_ALL_MASK; static unsigned int tcp_child_ehash_entries_max = 16 * 1024 * 1024;