Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2280210imc; Tue, 12 Mar 2019 10:29:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqziDV8KZb3bI/cBGwcGpY9VGmwQ5TT7GsrUSxu5YM2wkNVMLnWXCJg/K2Bw00xUj3lOhC1k X-Received: by 2002:a17:902:e113:: with SMTP id cc19mr41728148plb.179.1552411749036; Tue, 12 Mar 2019 10:29:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552411749; cv=none; d=google.com; s=arc-20160816; b=qlOxTM6kDxhy67WSNhhtBcdXagbgaF+Iezxpaw+07MD5JCszvaSYdZt/Rf9xhcP24n bk04pKUO6GHrSwyb4zA5Sg0Lcq6rXdNgWbYdwMewdP07YLXwY8+r8dfduAHhd2RHQkI1 u4jZCG+8lBtO9X4rAsFgDvVSbcl9piOWmWoSUInby7E/hS+QqrbKmaLzxM7XRRqm3nsz 5VPMO1QkSrPYGy5mYLy/vIWHuubMLUsEY3U3ZFnrYIqRFr1mHtxE9s5Uih4qSr0Yxs02 juNvEcMWnQzdx1Ly5DTK3XhW0DoErpL9Uz+t07RcKg9amrPY7UIjDrOOjr/e3dB4EVjs QE4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Gn9GIOm/qdlKRvoGrDVrGwzi+Mnouj4KSRFX6hp5kCU=; b=jC7rKFyMTYPmcs9CrjtzANPqNk3hVgXrAIUQE7hzlk3AoXqfSpTbiYWVy4z9nuSAZ1 uQglgOd43YV0nMWUctlxKF2IFFSLVobyeO9HPlHOL5UHwa+jgWT4xuViOhXnxlv6jbmp UIqLS9RkYvQaIebtd8gkOMgWMucc7HpfxkaQqb1PlaDK9wUlA4BlH6Z+G1fLwlkQUCiQ kkzgq9CnKttOi46byYAHjHIMB4wP95VKYsbIUA68uPMvg3tctPWv64RDhgsTwrndRcoy 66LMvALRMko9ohkmMYf+2fGVENL0ICsRsO+S5bht92JLhVO3g5bihCf/y5Dc6wH5zcYr KH0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="AZ1V/OPT"; 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 s14si7898386pgh.4.2019.03.12.10.28.53; Tue, 12 Mar 2019 10:29:09 -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; dkim=pass header.i=@kernel.org header.s=default header.b="AZ1V/OPT"; 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 S1728206AbfCLR0W (ORCPT + 99 others); Tue, 12 Mar 2019 13:26:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:34032 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728824AbfCLRRn (ORCPT ); Tue, 12 Mar 2019 13:17:43 -0400 Received: from localhost (unknown [104.133.8.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3155621873; Tue, 12 Mar 2019 17:17:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552411063; bh=2eEkeFv3Ijkx82mAt4FetS16ZxTvUki2475efXUyd+s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AZ1V/OPTnUO54LEEE4JO7GiOezHu556+VRIVYbJPPGEV2WfJlpT674I9sVCP/PlV3 hf1uOgBwvSN0l6ziWnw9TYlgGouTa96yBSpdd+LejkxncZKYw8eVmzpMs2ge65/zei HOBM6fMvVI6UTiC7TdD5VyK1Gt+cah58lUhOPUNY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yao Liu , Anna Schumaker , Sasha Levin Subject: [PATCH 4.9 52/96] nfs: Fix NULL pointer dereference of dev_name Date: Tue, 12 Mar 2019 10:10:10 -0700 Message-Id: <20190312171038.464069407@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190312171034.530434962@linuxfoundation.org> References: <20190312171034.530434962@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 80ff00172407e0aad4b10b94ef0816fc3e7813cb ] There is a NULL pointer dereference of dev_name in nfs_parse_devname() The oops looks something like: BUG: unable to handle kernel NULL pointer dereference at 0000000000000000 ... RIP: 0010:nfs_fs_mount+0x3b6/0xc20 [nfs] ... Call Trace: ? ida_alloc_range+0x34b/0x3d0 ? nfs_clone_super+0x80/0x80 [nfs] ? nfs_free_parsed_mount_data+0x60/0x60 [nfs] mount_fs+0x52/0x170 ? __init_waitqueue_head+0x3b/0x50 vfs_kern_mount+0x6b/0x170 do_mount+0x216/0xdc0 ksys_mount+0x83/0xd0 __x64_sys_mount+0x25/0x30 do_syscall_64+0x65/0x220 entry_SYSCALL_64_after_hwframe+0x49/0xbe Fix this by adding a NULL check on dev_name Signed-off-by: Yao Liu Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin --- fs/nfs/super.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 35aef192a13f..659ad12e33ba 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -1904,6 +1904,11 @@ static int nfs_parse_devname(const char *dev_name, size_t len; char *end; + if (unlikely(!dev_name || !*dev_name)) { + dfprintk(MOUNT, "NFS: device name not specified\n"); + return -EINVAL; + } + /* Is the host name protected with square brakcets? */ if (*dev_name == '[') { end = strchr(++dev_name, ']'); -- 2.19.1