]> git.baikalelectronics.ru Git - kernel.git/commit
virtio: console: Don't access vqs if device was unplugged
authorAmit Shah <amit.shah@redhat.com>
Fri, 4 Mar 2011 03:34:33 +0000 (14:04 +1030)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 6 Mar 2011 18:44:13 +0000 (10:44 -0800)
commita25c3cabecdcd7deeae95b0705c414e41a0ef6a8
treeced474d2ff1959576ac55f760bbafbe1073af11a
parente0bd7a54dbec57a99834fac1616ffba83a6f21b7
virtio: console: Don't access vqs if device was unplugged

If a virtio-console device gets unplugged while a port is open, a
subsequent close() call on the port accesses vqs to free up buffers.
This can lead to a crash.

The buffers are already freed up as a result of the call to
unplug_ports() from virtcons_remove().  The fix is to simply not access
vq information if port->portdev is NULL.

Reported-by: juzhang <juzhang@redhat.com>
CC: stable@kernel.org
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/char/virtio_console.c