Remove the debugfs path before freeing port->name, to prevent a possible use-after-free.
CC: <[email protected]> Reported-by: Jason Wang <[email protected]> Signed-off-by: Amit Shah <[email protected]> --- drivers/char/virtio_console.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 89ef748..f18e960 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -1578,9 +1578,8 @@ static void unplug_port(struct port *port) device_destroy(pdrvdata.class, port->dev->devt); cdev_del(port->cdev); - kfree(port->name); - debugfs_remove(port->debugfs_file); + kfree(port->name); /* * Locks around here are not necessary - a port can't be -- 1.8.1.4 _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
