mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: exit early in cbc debugfs under hv
This patch updates the logic for the cbc debugfs node to fail early if running under HV. The reason is that the CBC region is maintained by HV and cannot be accessed by nvgpu. This avoids a subsequent null-ptr deref for Linux + HV. Bug 4131079 Change-Id: I1ac1919efc1c05fb679f19a189184ca00908856f Signed-off-by: Martin Radev <mradev@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2913160 Reviewed-by: Sagar Kamble <skamble@nvidia.com> Reviewed-by: Ankur Kishore <ankkishore@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
943eb77b20
commit
a55491015c
@@ -17,6 +17,7 @@
|
||||
#include <nvgpu/gk20a.h>
|
||||
#include <nvgpu/gr/ctx.h>
|
||||
#include <nvgpu/nvgpu_init.h>
|
||||
#include <nvgpu/soc.h>
|
||||
|
||||
#include "common/gr/ctx_priv.h"
|
||||
#include "common/gr/gr_priv.h"
|
||||
@@ -84,6 +85,9 @@ static int cbc_status_debug_open(struct inode *inode, struct file *file)
|
||||
if (!capable(CAP_SYS_ADMIN)) {
|
||||
return -EPERM;
|
||||
}
|
||||
if (nvgpu_is_hypervisor_mode(g)) {
|
||||
return -EPERM;
|
||||
}
|
||||
g = nvgpu_get(g);
|
||||
if (!g) {
|
||||
return -ENODEV;
|
||||
|
||||
Reference in New Issue
Block a user