aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/9p/client.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/net/9p/client.c b/net/9p/client.c
index 8260f132b32e..34d417670935 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -76,6 +76,20 @@ inline int p9_is_proto_dotu(struct p9_client *clnt)
76} 76}
77EXPORT_SYMBOL(p9_is_proto_dotu); 77EXPORT_SYMBOL(p9_is_proto_dotu);
78 78
79/*
80 * Some error codes are taken directly from the server replies,
81 * make sure they are valid.
82 */
83static int safe_errno(int err)
84{
85 if ((err > 0) || (err < -MAX_ERRNO)) {
86 p9_debug(P9_DEBUG_ERROR, "Invalid error code %d\n", err);
87 return -EPROTO;
88 }
89 return err;
90}
91
92
79/* Interpret mount option for protocol version */ 93/* Interpret mount option for protocol version */
80static int get_protocol_version(char *s) 94static int get_protocol_version(char *s)
81{ 95{
@@ -782,7 +796,7 @@ again:
782 return req; 796 return req;
783reterr: 797reterr:
784 p9_free_req(c, req); 798 p9_free_req(c, req);
785 return ERR_PTR(err); 799 return ERR_PTR(safe_errno(err));
786} 800}
787 801
788/** 802/**
@@ -865,7 +879,7 @@ static struct p9_req_t *p9_client_zc_rpc(struct p9_client *c, int8_t type,
865 return req; 879 return req;
866reterr: 880reterr:
867 p9_free_req(c, req); 881 p9_free_req(c, req);
868 return ERR_PTR(err); 882 return ERR_PTR(safe_errno(err));
869} 883}
870 884
871static struct p9_fid *p9_fid_create(struct p9_client *clnt) 885static struct p9_fid *p9_fid_create(struct p9_client *clnt)