mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-08 14:13:53 +00:00
virtio: console: Fix crash when port is unplugged and blocked for write
When a program that has a virtio port opened and blocked for a write operation, a port hot-unplug event will later led to a crash when SIGTERM was sent to the program. Fix that. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
0047634d3d
commit
60e5e0b840
@ -529,6 +529,10 @@ static bool will_write_block(struct port *port)
|
|||||||
{
|
{
|
||||||
bool ret;
|
bool ret;
|
||||||
|
|
||||||
|
if (!port->guest_connected) {
|
||||||
|
/* Port got hot-unplugged. Let's exit. */
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!port->host_connected)
|
if (!port->host_connected)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user