Commit 5879a5e8 authored by Tomas Bortoli's avatar Tomas Bortoli Committed by Kleber Sacilotto de Souza

9p: fix multiple NULL-pointer-dereferences

BugLink: https://bugs.launchpad.net/bugs/1792419

commit 10aa1452 upstream.

Added checks to prevent GPFs from raising.

Link: http://lkml.kernel.org/r/20180727110558.5479-1-tomasbortoli@gmail.comSigned-off-by: default avatarTomas Bortoli <tomasbortoli@gmail.com>
Reported-by: syzbot+1a262da37d3bead15c39@syzkaller.appspotmail.com
Cc: stable@vger.kernel.org
Signed-off-by: default avatarDominique Martinet <dominique.martinet@cea.fr>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent a60ea418
...@@ -935,7 +935,7 @@ p9_fd_create_tcp(struct p9_client *client, const char *addr, char *args) ...@@ -935,7 +935,7 @@ p9_fd_create_tcp(struct p9_client *client, const char *addr, char *args)
if (err < 0) if (err < 0)
return err; return err;
if (valid_ipaddr4(addr) < 0) if (addr == NULL || valid_ipaddr4(addr) < 0)
return -EINVAL; return -EINVAL;
csocket = NULL; csocket = NULL;
...@@ -983,6 +983,9 @@ p9_fd_create_unix(struct p9_client *client, const char *addr, char *args) ...@@ -983,6 +983,9 @@ p9_fd_create_unix(struct p9_client *client, const char *addr, char *args)
csocket = NULL; csocket = NULL;
if (addr == NULL)
return -EINVAL;
if (strlen(addr) >= UNIX_PATH_MAX) { if (strlen(addr) >= UNIX_PATH_MAX) {
pr_err("%s (%d): address too long: %s\n", pr_err("%s (%d): address too long: %s\n",
__func__, task_pid_nr(current), addr); __func__, task_pid_nr(current), addr);
......
...@@ -644,6 +644,9 @@ rdma_create_trans(struct p9_client *client, const char *addr, char *args) ...@@ -644,6 +644,9 @@ rdma_create_trans(struct p9_client *client, const char *addr, char *args)
struct ib_qp_init_attr qp_attr; struct ib_qp_init_attr qp_attr;
struct ib_cq_init_attr cq_attr = {}; struct ib_cq_init_attr cq_attr = {};
if (addr == NULL)
return -EINVAL;
/* Parse the transport specific mount options */ /* Parse the transport specific mount options */
err = parse_opts(args, &opts); err = parse_opts(args, &opts);
if (err < 0) if (err < 0)
......
...@@ -654,6 +654,9 @@ p9_virtio_create(struct p9_client *client, const char *devname, char *args) ...@@ -654,6 +654,9 @@ p9_virtio_create(struct p9_client *client, const char *devname, char *args)
int ret = -ENOENT; int ret = -ENOENT;
int found = 0; int found = 0;
if (devname == NULL)
return -EINVAL;
mutex_lock(&virtio_9p_lock); mutex_lock(&virtio_9p_lock);
list_for_each_entry(chan, &virtio_chan_list, chan_list) { list_for_each_entry(chan, &virtio_chan_list, chan_list) {
if (!strncmp(devname, chan->tag, chan->tag_len) && if (!strncmp(devname, chan->tag, chan->tag_len) &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment