aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2013-07-19 12:55:11 +0530
committerAmit Shah <amit.shah@redhat.com>2013-07-25 19:05:30 +0530
commit83c058bc32c4e377a75235120885aec7dfd223c7 (patch)
treed61c0d791c11df8503ea5bed57cddf47f893a767
parent757aac3a03423986825852680496f69db0f6c7de (diff)
downloadvirtio-console-master.tar.gz
virtio: console: prevent use-after-free of port name in port unplugHEADmaster
Remove the debugfs path before freeing port->name, to prevent a possible use-after-free. Reported-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
-rw-r--r--drivers/char/virtio_console.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 4e380c1ff3109..e910bec97bbae 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -1574,9 +1574,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