]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
workqueue.c: Increase workqueue name length
authorAudra Mitchell <audra@redhat.com>
Mon, 15 Jan 2024 17:08:22 +0000 (12:08 -0500)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:19:16 +0000 (18:19 -0400)
[ Upstream commit 31c89007285d365aa36f71d8fb0701581c770a27 ]

Currently we limit the size of the workqueue name to 24 characters due to
commit ecf6881ff349 ("workqueue: make workqueue->name[] fixed len")
Increase the size to 32 characters and print a warning in the event
the requested name is larger than the limit of 32 characters.

Signed-off-by: Audra Mitchell <audra@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Stable-dep-of: 5797b1c18919 ("workqueue: Implement system-wide nr_active enforcement for unbound workqueues")
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/workqueue.c

index fd7b84b06d9265f3b30c1a9ee05b2aa5b11e0d26..e004e65ae987e3c6c2c26a1d8b6d6b19eb4c1de0 100644 (file)
@@ -108,7 +108,7 @@ enum {
        RESCUER_NICE_LEVEL      = MIN_NICE,
        HIGHPRI_NICE_LEVEL      = MIN_NICE,
 
-       WQ_NAME_LEN             = 24,
+       WQ_NAME_LEN             = 32,
 };
 
 /*
@@ -4673,6 +4673,7 @@ struct workqueue_struct *alloc_workqueue(const char *fmt,
        va_list args;
        struct workqueue_struct *wq;
        struct pool_workqueue *pwq;
+       int len;
 
        /*
         * Unbound && max_active == 1 used to imply ordered, which is no longer
@@ -4699,9 +4700,12 @@ struct workqueue_struct *alloc_workqueue(const char *fmt,
        }
 
        va_start(args, max_active);
-       vsnprintf(wq->name, sizeof(wq->name), fmt, args);
+       len = vsnprintf(wq->name, sizeof(wq->name), fmt, args);
        va_end(args);
 
+       if (len >= WQ_NAME_LEN)
+               pr_warn_once("workqueue: name exceeds WQ_NAME_LEN. Truncating to: %s\n", wq->name);
+
        max_active = max_active ?: WQ_DFL_ACTIVE;
        max_active = wq_clamp_max_active(max_active, flags, wq->name);