Skip to content

Commit fd75aff

Browse files
Naman Jainnamancse
authored andcommitted
Drivers: hv: mshv_vtl: remove duplicate misc_deregister() in module exit
mshv_vtl_exit() calls misc_deregister(&mshv_vtl_sint_dev) and misc_deregister(&mshv_vtl_low) twice. The first pair (added when the TDX APIC handling code was introduced) is redundant: the same deregistrations are performed again a few lines below, in the order that mirrors the registration sequence in mshv_vtl_init(). Calling misc_deregister() twice on the same struct miscdevice is not safe -- it ends up doing list_del() twice on the device's misc_list node, corrupting the global list and yielding 'list_del corruption' splats on rmmod (or any module exit path). Drop the redundant calls so each device is deregistered exactly once, in the reverse order of registration. Fixes: 06eb1e3 ("mshv_vtl/tdx: Handle some APIC functionality in kernel") Signed-off-by: Naman Jain <namjain@linux.microsoft.com>
1 parent 6b58552 commit fd75aff

1 file changed

Lines changed: 0 additions & 2 deletions

File tree

drivers/hv/mshv_vtl_main.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4098,8 +4098,6 @@ static void __exit mshv_vtl_exit(void)
40984098

40994099
ms_hyperv_free_redirected_intr();
41004100
mshv_free_apicid_to_cpuid_mapping();
4101-
misc_deregister(&mshv_vtl_sint_dev);
4102-
misc_deregister(&mshv_vtl_low);
41034101
device_del(mem_dev);
41044102
kfree(mem_dev);
41054103
mshv_vtl_sidecar_exit();

0 commit comments

Comments
 (0)