mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-24 21:54:34 -04:00
msm: kgsl: Fix invalid pointer reference at a few places
kgsl_allocate_global can fail for global buffer profile_desc. Hence make sure that an invalid access to the pointer is not made in set_user_profiling. Similarly allocations for global buffers setstate and alwayson can also fail. Make sure we don't access an invalid pointer in adreno_snapshot_global and kgsl_gpuaddr_in_memdesc. Change-Id: Ia2f314575c5f4357ac8f7a2a72e869e3c648837d Signed-off-by: Puranam V G Tejaswi <pvgtejas@codeaurora.org>
This commit is contained in:
parent
bb168a0f46
commit
d6b6d0a284
3 changed files with 6 additions and 6 deletions
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2002,2007-2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2002,2007-2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/interconnect.h>
|
||||
|
|
@ -837,7 +837,7 @@ static int set_user_profiling(struct adreno_device *adreno_dev,
|
|||
u64 ib_gpuaddr;
|
||||
u32 *ib;
|
||||
|
||||
if (!rb->profile_desc->hostptr)
|
||||
if (IS_ERR(rb->profile_desc))
|
||||
return 0;
|
||||
|
||||
ib = ((u32 *) rb->profile_desc->hostptr) +
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "adreno.h"
|
||||
|
|
@ -746,7 +746,7 @@ size_t adreno_snapshot_global(struct kgsl_device *device, u8 *buf,
|
|||
|
||||
u8 *ptr = buf + sizeof(*header);
|
||||
|
||||
if (!memdesc || memdesc->size == 0)
|
||||
if (IS_ERR_OR_NULL(memdesc) || memdesc->size == 0)
|
||||
return 0;
|
||||
|
||||
if (remain < (memdesc->size + sizeof(*header))) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2008-2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2008-2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
#ifndef __KGSL_H
|
||||
#define __KGSL_H
|
||||
|
|
@ -479,7 +479,7 @@ void kgsl_core_exit(void);
|
|||
static inline bool kgsl_gpuaddr_in_memdesc(const struct kgsl_memdesc *memdesc,
|
||||
uint64_t gpuaddr, uint64_t size)
|
||||
{
|
||||
if (!memdesc)
|
||||
if (IS_ERR_OR_NULL(memdesc))
|
||||
return false;
|
||||
|
||||
/* set a minimum size to search for */
|
||||
|
|
|
|||
Loading…
Reference in a new issue