All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v2] net/9p/trans_fd: check the return value of parse_opts
@ 2022-09-22 20:23 Li Zhong
  0 siblings, 0 replies; only message in thread
From: Li Zhong @ 2022-09-22 20:23 UTC (permalink / raw)
  To: netdev, v9fs-developer
  Cc: pabeni, kuba, edumazet, davem, linux_oss, asmadeus, lucho,
	ericvh, Li Zhong

parse_opts() could fail when there is error parsing mount options into
p9_fd_opts structure due to allocation failure. In that case opts will
contain invalid data. Though the value check on opts will prevent
invalid data from being used, we still add the check and return the
error code to avoid confusions for developers.

Signed-off-by: Li Zhong <floridsleeves@gmail.com>
---
 net/9p/trans_fd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index e758978b44be..11ae64c1a24b 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -1061,7 +1061,9 @@ p9_fd_create(struct p9_client *client, const char *addr, char *args)
 	int err;
 	struct p9_fd_opts opts;
 
-	parse_opts(args, &opts);
+	err = parse_opts(args, &opts);
+	if (err < 0)
+		return err;
 	client->trans_opts.fd.rfd = opts.rfd;
 	client->trans_opts.fd.wfd = opts.wfd;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-22 20:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-22 20:23 [PATCH net-next v2] net/9p/trans_fd: check the return value of parse_opts Li Zhong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.