diff options
author | Eric Dumazet <edumazet@google.com> | 2024-02-14 08:48:28 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-02-17 16:20:41 +0100 |
commit | 2444a80c1cc2c4240f60f2162abef3797c1803de (patch) | |
tree | 2a977ffce3acb403fba8704d50edacb7681dcf3e /kernel/ksysfs.c | |
parent | 5df9197edd731a44682444631d68c2384f381bf1 (diff) |
kobject: make uevent_seqnum atomic
We will soon no longer acquire uevent_sock_mutex
for most kobject_uevent_net_broadcast() calls,
and also while calling uevent_net_broadcast().
Make uevent_seqnum an atomic64_t to get its own protection.
This fixes a race while reading /sys/kernel/uevent_seqnum.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Christian Brauner <brauner@kernel.org>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Link: https://lore.kernel.org/r/20240214084829.684541-2-edumazet@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel/ksysfs.c')
-rw-r--r-- | kernel/ksysfs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c index 1d4bc493b2f4..32ae7fa74a9c 100644 --- a/kernel/ksysfs.c +++ b/kernel/ksysfs.c @@ -39,7 +39,7 @@ static struct kobj_attribute _name##_attr = __ATTR_RW(_name) static ssize_t uevent_seqnum_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - return sysfs_emit(buf, "%llu\n", (unsigned long long)uevent_seqnum); + return sysfs_emit(buf, "%llu\n", (u64)atomic64_read(&uevent_seqnum)); } KERNEL_ATTR_RO(uevent_seqnum); |