From: Amit Shah Date: Wed, 7 Aug 2013 06:24:17 +0000 (+0930) Subject: virtio: console: prevent use-after-free of port name in port unplug X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=3b868a4073cdedf395f26d843874414e0e0e9cfd;p=deliverable%2Flinux.git virtio: console: prevent use-after-free of port name in port unplug Remove the debugfs path before freeing port->name, to prevent a possible use-after-free. Reported-by: Jason Wang Signed-off-by: Amit Shah Signed-off-by: Rusty Russell --- diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index d0e75aa904ac..b79cf3e1b793 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -1591,9 +1591,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