Commit 9699f7a7 authored by Stefano Stabellini's avatar Stefano Stabellini Committed by Greg Kroah-Hartman

pvcalls-front: read all data before closing the connection

[ Upstream commit b79470b6 ]

When a connection is closing in_error is set to ENOTCONN. There could
still be outstanding data on the ring left by the backend. Before
closing the connection on the frontend side, drain the ring.
Signed-off-by: default avatarStefano Stabellini <stefanos@xilinx.com>
Reviewed-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 6bdf535f
......@@ -560,15 +560,13 @@ static int __read_ring(struct pvcalls_data_intf *intf,
error = intf->in_error;
/* get pointers before reading from the ring */
virt_rmb();
if (error < 0)
return error;
size = pvcalls_queued(prod, cons, array_size);
masked_prod = pvcalls_mask(prod, array_size);
masked_cons = pvcalls_mask(cons, array_size);
if (size == 0)
return 0;
return error ?: size;
if (len > size)
len = size;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment