Commit 46625b8a authored by Stefano Stabellini's avatar Stefano Stabellini Committed by Greg Kroah-Hartman
Browse files

pvcalls-back: set -ENOTCONN in pvcalls_conn_back_read

[ Upstream commit e6587cdb


When a connection is closing we receive on pvcalls_sk_state_change
notification. Instead of setting the connection as closed immediately
(-ENOTCONN), let's read one more time from it: pvcalls_conn_back_read
will set the connection as closed when necessary.

That way, we avoid races between pvcalls_sk_state_change and
Signed-off-by: default avatarStefano Stabellini <>
Reviewed-by: default avatarBoris Ostrovsky <>
Signed-off-by: default avatarBoris Ostrovsky <>
Signed-off-by: default avatarSasha Levin <>
parent 368a5c8b
......@@ -164,9 +164,10 @@ static void pvcalls_conn_back_read(void *opaque)
/* write the data, then modify the indexes */
if (ret < 0)
if (ret < 0) {
atomic_set(&map->read, 0);
intf->in_error = ret;
} else
intf->in_prod = prod + ret;
/* update the indexes, then notify the other end */
......@@ -296,7 +297,7 @@ static void pvcalls_sk_state_change(struct sock *sock)
intf = map->ring;
intf->in_error = -ENOTCONN;
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