mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-28 07:13:34 +00:00
kdb: do a sanity check on the cpu in kdb_per_cpu()
[ Upstream commitb586627e10
] The "whichcpu" comes from argv[3]. The cpu_online() macro looks up the cpu in a bitmap of online cpus, but if the value is too high then it could read beyond the end of the bitmap and possibly Oops. Fixes:5d5314d679
("kdb: core for kgdb back end (1 of 2)") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
1229ccad53
commit
67b69c426a
1 changed files with 1 additions and 1 deletions
|
@ -2634,7 +2634,7 @@ static int kdb_per_cpu(int argc, const char **argv)
|
|||
diag = kdbgetularg(argv[3], &whichcpu);
|
||||
if (diag)
|
||||
return diag;
|
||||
if (!cpu_online(whichcpu)) {
|
||||
if (whichcpu >= nr_cpu_ids || !cpu_online(whichcpu)) {
|
||||
kdb_printf("cpu %ld is not online\n", whichcpu);
|
||||
return KDB_BADCPUNUM;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue