netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomas Bortoli <tomasbortoli@gmail.com>
To: ericvh@gmail.com, rminnich@sandia.gov, lucho@ionkov.net
Cc: asmadeus@codewreck.org, davem@davemloft.net,
	v9fs-developer@lists.sourceforge.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, syzkaller@googlegroups.com,
	Tomas Bortoli <tomasbortoli@gmail.com>
Subject: [PATCH] 9p: fix NULL pointer dereferences
Date: Thu, 26 Jul 2018 10:10:49 +0200	[thread overview]
Message-ID: <20180726081049.10527-1-tomasbortoli@gmail.com> (raw)

In p9_fd_create_tcp() and p9_fd_create_unix() it is possible to get
a NULL value in the addr parameter. Return -EINVAL in such cases.

Signed-off-by: Tomas Bortoli <tomasbortoli@gmail.com>
Reported-by: syzbot+1a262da37d3bead15c39@syzkaller.appspotmail.com
---
 net/9p/trans_fd.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index 964260265b13..ecfceb659d0c 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -941,6 +941,9 @@ p9_fd_create_tcp(struct p9_client *client, const char *addr, char *args)
 	struct sockaddr_in sin_server;
 	struct p9_fd_opts opts;
 
+	if (addr == NULL)
+		return -EINVAL;
+
 	err = parse_opts(args, &opts);
 	if (err < 0)
 		return err;
@@ -995,6 +998,9 @@ p9_fd_create_unix(struct p9_client *client, const char *addr, char *args)
 
 	csocket = NULL;
 
+	if (addr == NULL)
+		return -EINVAL;
+
 	if (strlen(addr) >= UNIX_PATH_MAX) {
 		pr_err("%s (%d): address too long: %s\n",
 		       __func__, task_pid_nr(current), addr);
-- 
2.11.0

             reply	other threads:[~2018-07-26  8:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-26  8:10 Tomas Bortoli [this message]
2018-07-26  8:17 ` [PATCH] 9p: fix NULL pointer dereferences Dominique Martinet
2018-07-26  9:27   ` Dmitry Vyukov
2018-07-26  9:48     ` Dominique Martinet
2018-07-26  9:54       ` Dmitry Vyukov
2018-07-26 10:25         ` Dominique Martinet
2018-07-26 14:13       ` Tomas Bortoli
2018-07-26 14:21         ` Dominique Martinet
2018-07-26 14:32           ` Tomas Bortoli
2018-07-26 22:15             ` Dominique Martinet
2018-08-08 15:51               ` Dmitry Vyukov
2018-08-08 22:41                 ` Dominique Martinet
2018-07-26 14:48       ` [V9fs-developer] " sqweek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180726081049.10527-1-tomasbortoli@gmail.com \
    --to=tomasbortoli@gmail.com \
    --cc=asmadeus@codewreck.org \
    --cc=davem@davemloft.net \
    --cc=ericvh@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucho@ionkov.net \
    --cc=netdev@vger.kernel.org \
    --cc=rminnich@sandia.gov \
    --cc=syzkaller@googlegroups.com \
    --cc=v9fs-developer@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).