mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 03:10:12 +00:00
drm/v3d: Fix null pointer dereference of pointer perfmon
[ Upstream commitce7a1ecf3f
] In the unlikely event that pointer perfmon is null the WARN_ON return path occurs after the pointer has already been deferenced. Fix this by only dereferencing perfmon after it has been null checked. Fixes:26a4dc29b7
("drm/v3d: Expose performance counters to userspace") Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Reviewed-by: Juan A. Suarez <jasuarez@igalia.com> Signed-off-by: Melissa Wen <melissa.srw@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20220424183512.1365683-1-colin.i.king@gmail.com Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
dc682f50d2
commit
1df8f8901b
1 changed files with 2 additions and 1 deletions
|
@ -25,11 +25,12 @@ void v3d_perfmon_start(struct v3d_dev *v3d, struct v3d_perfmon *perfmon)
|
|||
{
|
||||
unsigned int i;
|
||||
u32 mask;
|
||||
u8 ncounters = perfmon->ncounters;
|
||||
u8 ncounters;
|
||||
|
||||
if (WARN_ON_ONCE(!perfmon || v3d->active_perfmon))
|
||||
return;
|
||||
|
||||
ncounters = perfmon->ncounters;
|
||||
mask = GENMASK(ncounters - 1, 0);
|
||||
|
||||
for (i = 0; i < ncounters; i++) {
|
||||
|
|
Loading…
Reference in a new issue