Commit 3b868a4073cdedf395f26d843874414e0e0e9cfd
Committed by
Rusty Russell
1 parent
1148973617
Exists in
smarc-imx_3.14.28_1.0.0_ga
and in
1 other branch
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 <jasowang@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Showing 1 changed file with 1 additions and 2 deletions Side-by-side Diff
drivers/char/virtio_console.c
... | ... | @@ -1591,9 +1591,8 @@ |
1591 | 1591 | device_destroy(pdrvdata.class, port->dev->devt); |
1592 | 1592 | cdev_del(port->cdev); |
1593 | 1593 | |
1594 | - kfree(port->name); | |
1595 | - | |
1596 | 1594 | debugfs_remove(port->debugfs_file); |
1595 | + kfree(port->name); | |
1597 | 1596 | |
1598 | 1597 | /* |
1599 | 1598 | * Locks around here are not necessary - a port can't be |