* [PATCH] 9p: fix multiple NULL-pointer-dereferences
@ 2018-07-27 10:19 Tomas Bortoli
2018-07-27 10:56 ` Dmitry Vyukov
0 siblings, 1 reply; 4+ messages in thread
From: Tomas Bortoli @ 2018-07-27 10:19 UTC (permalink / raw)
To: ericvh, rminnich, lucho
Cc: asmadeus, davem, v9fs-developer, netdev, linux-kernel, syzkaller,
Tomas Bortoli
Added checks to prevent GPFs from raising.
Signed-off-by: Tomas Bortoli <tomasbortoli@gmail.com>
---
net/9p/trans_fd.c | 5 ++++-
net/9p/trans_rdma.c | 3 +++
net/9p/trans_virtio.c | 3 +++
net/9p/trans_xen.c | 3 +++
4 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index 964260265b13..e2ef3c782c53 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -945,7 +945,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;
@@ -995,6 +995,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 2649b2ebf961..2ab4574183c9 100644
--- a/net/9p/trans_rdma.c
+++ b/net/9p/trans_rdma.c
@@ -645,6 +645,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 06dcd3cc6a29..8ca356eb66bb 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -654,6 +654,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) &&
diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c
index 2e2b8bca54f3..c2d54ac76bfd 100644
--- a/net/9p/trans_xen.c
+++ b/net/9p/trans_xen.c
@@ -94,6 +94,9 @@ static int p9_xen_create(struct p9_client *client, const char *addr, char *args)
{
struct xen_9pfs_front_priv *priv;
+ if (addr == NULL)
+ return -EINVAL;
+
read_lock(&xen_9pfs_lock);
list_for_each_entry(priv, &xen_9pfs_devs, list) {
if (!strcmp(priv->tag, addr)) {
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] 9p: fix multiple NULL-pointer-dereferences
2018-07-27 10:19 [PATCH] 9p: fix multiple NULL-pointer-dereferences Tomas Bortoli
@ 2018-07-27 10:56 ` Dmitry Vyukov
0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Vyukov @ 2018-07-27 10:56 UTC (permalink / raw)
To: Tomas Bortoli
Cc: Eric Van Hensbergen, Ron Minnich, Latchesar Ionkov,
Dominique Martinet, David Miller, v9fs-developer, netdev, LKML,
syzkaller
On Fri, Jul 27, 2018 at 12:19 PM, Tomas Bortoli <tomasbortoli@gmail.com> wrote:
> Added checks to prevent GPFs from raising.
This supersedes the previous patch, right? If so please add:
Reported-by: syzbot+1a262da37d3bead15c39@syzkaller.appspotmail.com
so that the bug will be auto-closed.
> Signed-off-by: Tomas Bortoli <tomasbortoli@gmail.com>
> ---
> net/9p/trans_fd.c | 5 ++++-
> net/9p/trans_rdma.c | 3 +++
> net/9p/trans_virtio.c | 3 +++
> net/9p/trans_xen.c | 3 +++
> 4 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
> index 964260265b13..e2ef3c782c53 100644
> --- a/net/9p/trans_fd.c
> +++ b/net/9p/trans_fd.c
> @@ -945,7 +945,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;
> @@ -995,6 +995,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 2649b2ebf961..2ab4574183c9 100644
> --- a/net/9p/trans_rdma.c
> +++ b/net/9p/trans_rdma.c
> @@ -645,6 +645,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 06dcd3cc6a29..8ca356eb66bb 100644
> --- a/net/9p/trans_virtio.c
> +++ b/net/9p/trans_virtio.c
> @@ -654,6 +654,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) &&
> diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c
> index 2e2b8bca54f3..c2d54ac76bfd 100644
> --- a/net/9p/trans_xen.c
> +++ b/net/9p/trans_xen.c
> @@ -94,6 +94,9 @@ static int p9_xen_create(struct p9_client *client, const char *addr, char *args)
> {
> struct xen_9pfs_front_priv *priv;
>
> + if (addr == NULL)
> + return -EINVAL;
> +
> read_lock(&xen_9pfs_lock);
> list_for_each_entry(priv, &xen_9pfs_devs, list) {
> if (!strcmp(priv->tag, addr)) {
> --
> 2.11.0
>
> --
> You received this message because you are subscribed to the Google Groups "syzkaller" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] 9p: fix multiple NULL-pointer-dereferences
@ 2018-07-27 11:05 Tomas Bortoli
2018-07-27 15:39 ` Dominique Martinet
0 siblings, 1 reply; 4+ messages in thread
From: Tomas Bortoli @ 2018-07-27 11:05 UTC (permalink / raw)
To: ericvh, rminnich, lucho
Cc: asmadeus, davem, v9fs-developer, netdev, linux-kernel, syzkaller,
Tomas Bortoli
Added checks to prevent GPFs from raising.
Signed-off-by: Tomas Bortoli <tomasbortoli@gmail.com>
Reported-by: syzbot+1a262da37d3bead15c39@syzkaller.appspotmail.com
---
net/9p/trans_fd.c | 5 ++++-
net/9p/trans_rdma.c | 3 +++
net/9p/trans_virtio.c | 3 +++
net/9p/trans_xen.c | 3 +++
4 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index 964260265b13..e2ef3c782c53 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -945,7 +945,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;
@@ -995,6 +995,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 2649b2ebf961..2ab4574183c9 100644
--- a/net/9p/trans_rdma.c
+++ b/net/9p/trans_rdma.c
@@ -645,6 +645,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 06dcd3cc6a29..8ca356eb66bb 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -654,6 +654,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) &&
diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c
index 2e2b8bca54f3..c2d54ac76bfd 100644
--- a/net/9p/trans_xen.c
+++ b/net/9p/trans_xen.c
@@ -94,6 +94,9 @@ static int p9_xen_create(struct p9_client *client, const char *addr, char *args)
{
struct xen_9pfs_front_priv *priv;
+ if (addr == NULL)
+ return -EINVAL;
+
read_lock(&xen_9pfs_lock);
list_for_each_entry(priv, &xen_9pfs_devs, list) {
if (!strcmp(priv->tag, addr)) {
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] 9p: fix multiple NULL-pointer-dereferences
2018-07-27 11:05 Tomas Bortoli
@ 2018-07-27 15:39 ` Dominique Martinet
0 siblings, 0 replies; 4+ messages in thread
From: Dominique Martinet @ 2018-07-27 15:39 UTC (permalink / raw)
To: Tomas Bortoli; +Cc: davem, v9fs-developer, netdev, linux-kernel, syzkaller
Tomas Bortoli wrote on Fri, Jul 27, 2018:
> Added checks to prevent GPFs from raising.
>
> Signed-off-by: Tomas Bortoli <tomasbortoli@gmail.com>
> Reported-by: syzbot+1a262da37d3bead15c39@syzkaller.appspotmail.com
LGTM, I'll take this. Thanks!
Just a note for future patchs that have multiple versions, it's usually
good to write in the subject [PATCH v2] (then v3 etc) so we can easily
tell it's a new version.
If the thread isn't too long I'd also recommend considering setting a
reply-to to the previous patch so we can easily compare versions/write
off old patches.
> ---
> net/9p/trans_fd.c | 5 ++++-
> net/9p/trans_rdma.c | 3 +++
> net/9p/trans_virtio.c | 3 +++
> net/9p/trans_xen.c | 3 +++
> 4 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
> index 964260265b13..e2ef3c782c53 100644
> --- a/net/9p/trans_fd.c
> +++ b/net/9p/trans_fd.c
> @@ -945,7 +945,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;
> @@ -995,6 +995,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 2649b2ebf961..2ab4574183c9 100644
> --- a/net/9p/trans_rdma.c
> +++ b/net/9p/trans_rdma.c
> @@ -645,6 +645,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 06dcd3cc6a29..8ca356eb66bb 100644
> --- a/net/9p/trans_virtio.c
> +++ b/net/9p/trans_virtio.c
> @@ -654,6 +654,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) &&
> diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c
> index 2e2b8bca54f3..c2d54ac76bfd 100644
> --- a/net/9p/trans_xen.c
> +++ b/net/9p/trans_xen.c
> @@ -94,6 +94,9 @@ static int p9_xen_create(struct p9_client *client, const char *addr, char *args)
> {
> struct xen_9pfs_front_priv *priv;
>
> + if (addr == NULL)
> + return -EINVAL;
> +
> read_lock(&xen_9pfs_lock);
> list_for_each_entry(priv, &xen_9pfs_devs, list) {
> if (!strcmp(priv->tag, addr)) {
--
Dominique Martinet
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-07-27 15:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-27 10:19 [PATCH] 9p: fix multiple NULL-pointer-dereferences Tomas Bortoli
2018-07-27 10:56 ` Dmitry Vyukov
2018-07-27 11:05 Tomas Bortoli
2018-07-27 15:39 ` Dominique Martinet
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.