From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Yao Liu <yotta.liu@ucloud.cn>,
Anna Schumaker <Anna.Schumaker@Netapp.com>,
Sasha Levin <sashal@kernel.org>,
linux-nfs@vger.kernel.org
Subject: [PATCH AUTOSEL 3.18 11/18] nfs: Fix NULL pointer dereference of dev_name
Date: Sat, 23 Feb 2019 16:11:28 -0500 [thread overview]
Message-ID: <20190223211135.203082-11-sashal@kernel.org> (raw)
In-Reply-To: <20190223211135.203082-1-sashal@kernel.org>
From: Yao Liu <yotta.liu@ucloud.cn>
[ 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 <yotta.liu@ucloud.cn>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/super.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index dbdc2d2f91cf5..1a81613dd0996 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1876,6 +1876,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
next prev parent reply other threads:[~2019-02-23 21:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-23 21:11 [PATCH AUTOSEL 3.18 01/18] vti4: Fix a ipip packet processing bug in 'IPCOMP' virtual tunnel Sasha Levin
2019-02-23 21:11 ` [PATCH AUTOSEL 3.18 02/18] xfrm: refine validation of template and selector families Sasha Levin
2019-02-23 21:11 ` [PATCH AUTOSEL 3.18 03/18] perf tools: Handle TOPOLOGY headers with no CPU Sasha Levin
2019-02-23 21:11 ` [PATCH AUTOSEL 3.18 04/18] ipvs: Fix signed integer overflow when setsockopt timeout Sasha Levin
2019-02-23 21:11 ` [PATCH AUTOSEL 3.18 05/18] iommu/amd: Fix IOMMU page flush when detach device from a domain Sasha Levin
2019-02-23 21:11 ` [PATCH AUTOSEL 3.18 06/18] xtensa: SMP: fix secondary CPU initialization Sasha Levin
2019-02-23 21:11 ` [PATCH AUTOSEL 3.18 07/18] xtensa: smp_lx200_defconfig: fix vectors clash Sasha Levin
2019-02-23 21:11 ` [PATCH AUTOSEL 3.18 08/18] xtensa: SMP: mark each possible CPU as present Sasha Levin
2019-02-23 21:11 ` [PATCH AUTOSEL 3.18 09/18] xtensa: SMP: limit number of possible CPUs by NR_CPUS Sasha Levin
2019-02-23 21:11 ` [PATCH AUTOSEL 3.18 10/18] net: altera_tse: fix msgdma_tx_completion on non-zero fill_level case Sasha Levin
2019-02-23 21:11 ` Sasha Levin [this message]
2019-02-23 21:11 ` [PATCH AUTOSEL 3.18 12/18] scsi: libfc: free skb when receiving invalid flogi resp Sasha Levin
2019-02-23 21:11 ` [PATCH AUTOSEL 3.18 13/18] platform/x86: Fix unmet dependency warning for SAMSUNG_Q10 Sasha Levin
2019-02-23 21:11 ` [PATCH AUTOSEL 3.18 14/18] cifs: fix computation for MAX_SMB2_HDR_SIZE Sasha Levin
2019-02-23 21:11 ` [PATCH AUTOSEL 3.18 15/18] x86/kexec: Don't setup EFI info if EFI runtime is not enabled Sasha Levin
2019-02-23 21:11 ` [PATCH AUTOSEL 3.18 16/18] mm, memory_hotplug: is_mem_section_removable do not pass the end of a zone Sasha Levin
2019-02-23 21:11 ` [PATCH AUTOSEL 3.18 17/18] autofs: drop dentry reference only when it is never used Sasha Levin
2019-02-23 21:11 ` [PATCH AUTOSEL 3.18 18/18] autofs: fix error return in autofs_fill_super() Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190223211135.203082-11-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=Anna.Schumaker@Netapp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=yotta.liu@ucloud.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome