diff --git a/net/9p/mux.c b/net/9p/mux.c
index c3aa87bc8b973c724e207a41ce54e9244620ad0d..acb038810f3995c2b5c4b7e742d91e34c33d83bc 100644
--- a/net/9p/mux.c
+++ b/net/9p/mux.c
@@ -505,8 +505,12 @@ again:
 		return;
 	}
 
-	if (err <= 0)
+	if (err < 0)
+		goto error;
+	else if (err == 0) {
+		err = -EREMOTEIO;
 		goto error;
+	}
 
 	m->wpos += err;
 	if (m->wpos == m->wsize)