]> git.baikalelectronics.ru Git - kernel.git/commitdiff
kernel/utsname_sysctl.c: Fix hostname polling
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 23 Oct 2022 19:01:01 +0000 (12:01 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 23 Oct 2022 19:01:01 +0000 (12:01 -0700)
Commit 78f1610ca0b3 ("kernel/utsname_sysctl.c: print kernel arch") added
a new entry to the uts_kern_table[] array, but didn't update the
UTS_PROC_xyz enumerators of older entries, breaking anything that used
them.

Which is admittedly not many cases: it's really just the two uses of
uts_proc_notify() in kernel/sys.c.  But apparently journald-systemd
actually uses this to detect hostname changes.

Reported-by: Torsten Hilbrich <torsten.hilbrich@secunet.com>
Fixes: 78f1610ca0b3 ("kernel/utsname_sysctl.c: print kernel arch")
Link: https://lore.kernel.org/lkml/0c2b92a6-0f25-9538-178f-eee3b06da23f@secunet.com/
Link: https://linux-regtracking.leemhuis.info/regzbot/regression/0c2b92a6-0f25-9538-178f-eee3b06da23f@secunet.com/
Cc: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/utsname.h
kernel/utsname_sysctl.c

index 2b1737c9b244dd77047b82de3ebda83d6a6310f0..bf7613ba412bfe2dae6ced334952e97cddee65cd 100644 (file)
@@ -10,6 +10,7 @@
 #include <uapi/linux/utsname.h>
 
 enum uts_proc {
+       UTS_PROC_ARCH,
        UTS_PROC_OSTYPE,
        UTS_PROC_OSRELEASE,
        UTS_PROC_VERSION,
index 064072c16e3d918f352fc2948696c42fe8c0b550..f50398cb790d736c28d10fd03b70c5786ed07693 100644 (file)
@@ -74,6 +74,7 @@ static int proc_do_uts_string(struct ctl_table *table, int write,
 static DEFINE_CTL_TABLE_POLL(hostname_poll);
 static DEFINE_CTL_TABLE_POLL(domainname_poll);
 
+// Note: update 'enum uts_proc' to match any changes to this table
 static struct ctl_table uts_kern_table[] = {
        {
                .procname       = "arch",