OSDN Git Service

kdb: do a sanity check on the cpu in kdb_per_cpu()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 6 May 2019 12:50:18 +0000 (15:50 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Jan 2020 09:21:43 +0000 (10:21 +0100)
commitbfe9388e57f525d10a556ac476f55a4143f68413
tree55eedcff2af3413fd92b2418020152dab6c83501
parent15e94dd34af65b4a16857a572bab54893df5321d
kdb: do a sanity check on the cpu in kdb_per_cpu()

[ Upstream commit b586627e10f57ee3aa8f0cfab0d6f7dc4ae63760 ]

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: 5d5314d6795f ("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>
kernel/debug/kdb/kdb_main.c