diff options
author | Tomas Bortoli <tomasbortoli@gmail.com> | 2018-07-27 13:05:58 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-09-09 20:01:22 +0200 |
commit | 3ac733eb641d974b6072c9817bd382838139979d (patch) | |
tree | 981f23f20182c8e79be4bf4ebd8f1993617bce59 | |
parent | 262f38faadc43e844d849b65337c535023ccd388 (diff) |
9p: fix multiple NULL-pointer-dereferences
commit 10aa14527f458e9867cf3d2cc6b8cb0f6704448b upstream.
Added checks to prevent GPFs from raising.
Link: http://lkml.kernel.org/r/20180727110558.5479-1-tomasbortoli@gmail.com
Signed-off-by: Tomas Bortoli <tomasbortoli@gmail.com>
Reported-by: syzbot+1a262da37d3bead15c39@syzkaller.appspotmail.com
Cc: stable@vger.kernel.org
Signed-off-by: Dominique Martinet <dominique.martinet@cea.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | net/9p/trans_fd.c | 5 | ||||
-rw-r--r-- | net/9p/trans_rdma.c | 3 | ||||
-rw-r--r-- | net/9p/trans_virtio.c | 3 |
3 files changed, 10 insertions, 1 deletions
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c index f8dafa8fa70b..2b543532e2f1 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c @@ -939,7 +939,7 @@ p9_fd_create_tcp(struct p9_client *client, const char *addr, char *args) if (err < 0) return err; - if (valid_ipaddr4(addr) < 0) + if (addr == NULL || valid_ipaddr4(addr) < 0) return -EINVAL; csocket = NULL; @@ -987,6 +987,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); diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c index 553ed4ecb6a0..5a2ad4707463 100644 --- a/net/9p/trans_rdma.c +++ b/net/9p/trans_rdma.c @@ -622,6 +622,9 @@ rdma_create_trans(struct p9_client *client, const char *addr, char *args) struct rdma_conn_param conn_param; struct ib_qp_init_attr qp_attr; + if (addr == NULL) + return -EINVAL; + /* Parse the transport specific mount options */ err = parse_opts(args, &opts); if (err < 0) diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index 73c700a55f02..da0d3b257459 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c @@ -651,6 +651,9 @@ p9_virtio_create(struct p9_client *client, const char *devname, char *args) int ret = -ENOENT; int found = 0; + if (devname == NULL) + return -EINVAL; + mutex_lock(&virtio_9p_lock); list_for_each_entry(chan, &virtio_chan_list, chan_list) { if (!strncmp(devname, chan->tag, chan->tag_len) && |