diff mbox

[V9fs-developer] 9pnet_rdma: check token type before int conversion

Message ID 1394529255-14870-1-git-send-email-simon.derr@bull.net (mailing list archive)
State Accepted, archived
Delegated to: Eric Van Hensbergen
Headers show

Commit Message

Simon Derr March 11, 2014, 9:14 a.m. UTC
When parsing options, make sure we have found a proper token before
doing a numeric conversion.

Without this check, the current code will end up following random
pointers that just happened to be on the stack when this function was
called, because match_token() will not touch the 'args' list unless a
valid token is found.

Signed-off-by: Simon Derr <simon.derr@bull.net>
---
 net/9p/trans_rdma.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Comments

Dominique Martinet March 11, 2014, 4:13 p.m. UTC | #1
Hi,

Not qualified to talk about the trans_fd patches, but the RDMA-specific
and common ones look good (cancel, remove conn from client.h, and this)

Big thanks for the token check, this has been annoying me for a while
and I never took the time to fix it.
diff mbox

Patch

diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c
index 8f5e4f7..14ad43b 100644
--- a/net/9p/trans_rdma.c
+++ b/net/9p/trans_rdma.c
@@ -193,6 +193,8 @@  static int parse_opts(char *params, struct p9_rdma_opts *opts)
 		if (!*p)
 			continue;
 		token = match_token(p, tokens, args);
+		if (token == Opt_err)
+			continue;
 		r = match_int(&args[0], &option);
 		if (r < 0) {
 			p9_debug(P9_DEBUG_ERROR,