Skip to content

Commit 80ff001

Browse files
Yao Liuamschuma-ntap
authored andcommitted
nfs: Fix NULL pointer dereference of dev_name
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>
1 parent deaa5c9 commit 80ff001

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fs/nfs/super.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1895,6 +1895,11 @@ static int nfs_parse_devname(const char *dev_name,
18951895
size_t len;
18961896
char *end;
18971897

1898+
if (unlikely(!dev_name || !*dev_name)) {
1899+
dfprintk(MOUNT, "NFS: device name not specified\n");
1900+
return -EINVAL;
1901+
}
1902+
18981903
/* Is the host name protected with square brakcets? */
18991904
if (*dev_name == '[') {
19001905
end = strchr(++dev_name, ']');

0 commit comments

Comments
 (0)