Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp944062imm; Fri, 27 Jul 2018 08:40:33 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdF/WT4JVf8MXfojPJ36QGmp63yrxl/l14OmMcxtTVer4qjF/AesD0og3UEP6ter7BCsyI5 X-Received: by 2002:a17:902:a989:: with SMTP id bh9-v6mr6599282plb.245.1532706033885; Fri, 27 Jul 2018 08:40:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532706033; cv=none; d=google.com; s=arc-20160816; b=MmjN9sHVR+uslldxEBPETGysbbXKCn5TnpxfCbM7AsOKnW+vHZKwph9qrtqtNlDbtG 732wrFywgzDlhaleDuPt/+4qP5qJZYHPszzPQL3MibmD3xIKjrnhKzElCc2Q6hrwGrz8 Y2wZ+SSOJ/HZrTN5gFFpX70e++st6+5lHzNoNgHBpSM5l0LKCVBvXVsMq0W3G0DGhKag 2c/S5+ZvKI+UsoEfZeQpw6XND2VbOmWrex/cyOZkAOsqaHJWUGKaw/tSnO4Ov4qzFhAr ojX8Ko5xctgnkrhsLSBJocjbkTtgMOHwNIYXziJY3AelGHOgxJsfaBmv6+PHQrttXTKg TIyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=V6oCRMBpwRyIoP7jMEGCRil3GM0sNbsEPaArXIhWAks=; b=yiTbmI2/RkeZQYN12s5pgxy7RxbwGaKhHhhtPvj6Rj2/wkWgi/jKd/T0dbLDc21Vg7 9sDDeOIHU9uW6iMD6q0OHdGWpgJriFu2zx6Q3YYo44xy0bBziLf2En6rGYjjcJQbujjg TvX11fP05/APKIdMx/H5Vc29JigDm1RJZRzjAR/9qS3k/zK1TBk/FTxwNY4F6tzkwi0S LF9Pqd2F/DNfrl3SjA2+CKObor7IbdZT30fyVQ/Lh9zPN052MbmhcWjl3TE9vCQqohAw 7C++AmCJvP+jl2AHIgnOb8727Ks84jd+20iNDHTYNMSKwCRqDtFQzlb98E/ddNnPXjXu sPfg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l8-v6si3638130pgq.432.2018.07.27.08.40.18; Fri, 27 Jul 2018 08:40:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388727AbeG0RBt (ORCPT + 99 others); Fri, 27 Jul 2018 13:01:49 -0400 Received: from nautica.notk.org ([91.121.71.147]:35086 "EHLO nautica.notk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731160AbeG0RBt (ORCPT ); Fri, 27 Jul 2018 13:01:49 -0400 Received: by nautica.notk.org (Postfix, from userid 1001) id A468FC01B; Fri, 27 Jul 2018 17:39:19 +0200 (CEST) Date: Fri, 27 Jul 2018 17:39:04 +0200 From: Dominique Martinet To: Tomas Bortoli Cc: davem@davemloft.net, v9fs-developer@lists.sourceforge.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller@googlegroups.com Subject: Re: [PATCH] 9p: fix multiple NULL-pointer-dereferences Message-ID: <20180727153904.GA500@nautica> References: <20180727110558.5479-1-tomasbortoli@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180727110558.5479-1-tomasbortoli@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tomas Bortoli wrote on Fri, Jul 27, 2018: > Added checks to prevent GPFs from raising. > > Signed-off-by: Tomas Bortoli > 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