Skip to contentSkip to conversation

9p: reject RERROR/RLERROR with zero errcode

PATCH New Dominique Martinet 2 participants 2 messages Oct 29 9P file system

lore
Share & tools
lore

Dominique Martinet

author maintainer
#0 lore raw

PATCH 1/1 9p: reject RERROR/RLERROR with zero errcode

From: Hui Peng <[email protected]>

In p9_check_errors() (net/9p/client.c), a malicious or buggy 9p server returning P9_RERROR or P9_RLERROR with ecode == 0 causes p9_check_errors() to return 0 (success) while leaving the unparsed response payload as if the expected reply message type succeeded.

Map ecode == 0 on RERROR / RLERROR to -EPROTO.

---
This is a resend of the other half of that commit, since the original author never bothered to do it.
It's valid enough to be worth the 5 minutes to resend it...

I kept their commit message & code verbatim so kept them author

 net/9p/client.c | 3 +++
 1 file changed, 3 insertions(+)
net/9p/client.c +3 -0
index ef64546c6d52..e63e8c2a853d 100644
@@ -448,6 +448,9 @@ static int p9_check_errors(struct p9_client *c, struct p9_req_t *req)
 		p9_debug(P9_DEBUG_9P, "<<< RLERROR (%d)\n", -ecode);
 	}
 
+	if (!err)
+		err = -EPROTO;
+
 	return err;
 
 out_err:
Signature · 1 line
2.56.0
#1 lore raw
Sashiko has reviewed this patch and found no issues.
Quoted 11 lines

From: Hui Peng <[email protected]>

In p9_check_errors() (net/9p/client.c), a malicious or buggy 9p server returning P9_RERROR or P9_RLERROR with ecode == 0 causes p9_check_errors() to return 0 (success) while leaving the unparsed response payload as if the expected reply message type succeeded.

Map ecode == 0 on RERROR / RLERROR to -EPROTO.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1