diff options
| author | Andrew Morton <akpm@linux-foundation.org> | 2026-07-21 16:30:41 -0700 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-07-22 21:14:24 -0700 |
| commit | a63f849b2883bbc288768651961eb56f6605542a (patch) | |
| tree | bce82b413fd82cc6d163a197a1d1b6ca99761ae5 /kernel/taskstats.c | |
| parent | 70bc6c37c7802179d1179e763af8adda5635eb47 (diff) | |
| download | linux-next-a63f849b2883bbc288768651961eb56f6605542a.tar.gz linux-next-a63f849b2883bbc288768651961eb56f6605542a.zip | |
kernel/taskstats.c:parse(): fix buffer allocation size
parse() is failing to allow for the nla_strscpy()'s null termination of
the cpumask string. This can result in the cpumask string being
truncated.
This can result in an inappropriate -EINVAL failure or in reporting for an
incorrect span of CPUs.
Fixes: f9fd8914c1ac ("[PATCH] per-task delay accounting taskstats interface: control exit data through cpumasks")
Reported-by: Oleg Deomi <oleg.deomi@gmail.com>
Closes: https://lore.kernel.org/CAByWkfZ6b1=3H9pwkz-dDQOs9cZaF-HYQ6b9Yb0=Hq2r1Vv_Pw@mail.gmail.com
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'kernel/taskstats.c')
| -rw-r--r-- | kernel/taskstats.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/taskstats.c b/kernel/taskstats.c index 8d115670a3ca..bca91c394793 100644 --- a/kernel/taskstats.c +++ b/kernel/taskstats.c @@ -368,7 +368,7 @@ static int parse(struct nlattr *na, struct cpumask *mask) return -E2BIG; if (len < 1) return -EINVAL; - data = kmalloc(len, GFP_KERNEL); + data = kmalloc(len + 1, GFP_KERNEL); if (!data) return -ENOMEM; nla_strscpy(data, na, len); |
