gpu: nvgpu: Add gr.ops NULL-ptr check

This fix add NULL-ptr checks for some of the user-accessible
ioctl.

Bug 3240771
Bug 200696704

Change-Id: Ibe7f75b31b2521a530883253a93ba832f010dc80
Signed-off-by: Thomas Steinle <tsteinle@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2483635
(cherry picked from commit cc717e3145)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2490126
Tested-by: Dinesh T <dt@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Rajesh Devaraj <rdevaraj@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Thomas Steinle
2021-02-11 13:59:33 +01:00
committed by mobile promotions
parent 53cc5be723
commit 1b5a9b28ea
2 changed files with 22 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2020, NVIDIA Corporation. All rights reserved.
* Copyright (c) 2011-2021, NVIDIA Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -949,6 +949,10 @@ static int nvgpu_gpu_ioctl_has_any_exception(
{
u64 tpc_exception_en;
if (g->ops.gr.intr.tpc_enabled_exceptions == NULL) {
return -ENOSYS;
}
nvgpu_mutex_acquire(&g->dbg_sessions_lock);
tpc_exception_en = g->ops.gr.intr.tpc_enabled_exceptions(g);
nvgpu_mutex_release(&g->dbg_sessions_lock);