Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 333409
b: refs/heads/master
c: 43def35
h: refs/heads/master
i:
  333407: bd7ca22
v: v3
  • Loading branch information
Simon Derr authored and Eric Van Hensbergen committed Sep 6, 2012
1 parent 60a9230 commit 630d440
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ba413ab2ccc49e6aa1ebc3523a75635b5e4a0494
refs/heads/master: 43def35c1030d91a7414936c7c1b416828b20afb
18 changes: 16 additions & 2 deletions trunk/net/9p/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,20 @@ inline int p9_is_proto_dotu(struct p9_client *clnt)
}
EXPORT_SYMBOL(p9_is_proto_dotu);

/*
* Some error codes are taken directly from the server replies,
* make sure they are valid.
*/
static int safe_errno(int err)
{
if ((err > 0) || (err < -MAX_ERRNO)) {
p9_debug(P9_DEBUG_ERROR, "Invalid error code %d\n", err);
return -EPROTO;
}
return err;
}


/* Interpret mount option for protocol version */
static int get_protocol_version(char *s)
{
Expand Down Expand Up @@ -782,7 +796,7 @@ p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...)
return req;
reterr:
p9_free_req(c, req);
return ERR_PTR(err);
return ERR_PTR(safe_errno(err));
}

/**
Expand Down Expand Up @@ -865,7 +879,7 @@ static struct p9_req_t *p9_client_zc_rpc(struct p9_client *c, int8_t type,
return req;
reterr:
p9_free_req(c, req);
return ERR_PTR(err);
return ERR_PTR(safe_errno(err));
}

static struct p9_fid *p9_fid_create(struct p9_client *clnt)
Expand Down

0 comments on commit 630d440

Please sign in to comment.