Skip to content

Commit ed843d6

Browse files
Rong Wangmstsirkin
authored andcommitted
vdpa/vp_vdpa: fix kfree a wrong pointer in vp_vdpa_remove
In vp_vdpa_remove(), the code kfree(&vp_vdpa_mgtdev->mgtdev.id_table) uses a reference of pointer as the argument of kfree, which is the wrong pointer and then may hit crash like this: Unable to handle kernel paging request at virtual address 00ffff003363e30c Internal error: Oops: 96000004 [#1] SMP Call trace: rb_next+0x20/0x5c ext4_readdir+0x494/0x5c4 [ext4] iterate_dir+0x168/0x1b4 __se_sys_getdents64+0x68/0x170 __arm64_sys_getdents64+0x24/0x30 el0_svc_common.constprop.0+0x7c/0x1bc do_el0_svc+0x2c/0x94 el0_svc+0x20/0x30 el0_sync_handler+0xb0/0xb4 el0_sync+0x160/0x180 Code: 54000220 f9400441 b4000161 aa0103e0 (f9400821) SMP: stopping secondary CPUs Starting crashdump kernel... Fixes: ffbda8e ("vdpa/vp_vdpa : add vdpa tool support in vp_vdpa") Signed-off-by: Rong Wang <[email protected]> Signed-off-by: Nanyong Sun <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Reviewed-by: Cindy Lu <[email protected]> Acked-by: Jason Wang <[email protected]>
1 parent 937c783 commit ed843d6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/vdpa/virtio_pci/vp_vdpa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ static void vp_vdpa_remove(struct pci_dev *pdev)
647647
mdev = vp_vdpa_mgtdev->mdev;
648648
vp_modern_remove(mdev);
649649
vdpa_mgmtdev_unregister(&vp_vdpa_mgtdev->mgtdev);
650-
kfree(&vp_vdpa_mgtdev->mgtdev.id_table);
650+
kfree(vp_vdpa_mgtdev->mgtdev.id_table);
651651
kfree(mdev);
652652
kfree(vp_vdpa_mgtdev);
653653
}

0 commit comments

Comments
 (0)