aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Bakita <bakitajoshua@gmail.com>2023-10-29 13:31:00 -0400
committerJoshua Bakita <bakitajoshua@gmail.com>2023-10-29 13:31:00 -0400
commit39f7f4047e57fc7e7e275e52657f47d3d4bb6e2a (patch)
tree06368943ff8e913140c7872bfa385ece9152a88e
parente718d7228983a3d033523fbf0d5fc06f37bca603 (diff)
Zero-out unused/invalid fields in g_nvdebug_device on Tegra devices
Previously, unloading the module could cause a segfault on Tegra, as pcid would be unitilized and possibly non-zero, causing us to attempt PCIe-device-style deinitialization on a non-PCEe device.
-rw-r--r--nvdebug_entry.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/nvdebug_entry.c b/nvdebug_entry.c
index 4eb44a2..c362209 100644
--- a/nvdebug_entry.c
+++ b/nvdebug_entry.c
@@ -99,6 +99,8 @@ int probe_and_cache_device(void) {
99 if (ids.raw == -1) 99 if (ids.raw == -1)
100 return -EADDRNOTAVAIL; 100 return -EADDRNOTAVAIL;
101 g_nvdebug_state[i].chip_id = ids.chip_id; 101 g_nvdebug_state[i].chip_id = ids.chip_id;
102 g_nvdebug_state[i].pcid = NULL;
103 g_nvdebug_state[i].bar3 = NULL;
102 printk(KERN_INFO "[nvdebug] Chip ID %x (architecture %s) detected on platform bus and initialized.", 104 printk(KERN_INFO "[nvdebug] Chip ID %x (architecture %s) detected on platform bus and initialized.",
103 ids.chip_id, ARCH2NAME(ids.architecture)); 105 ids.chip_id, ARCH2NAME(ids.architecture));
104 i++; 106 i++;