]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.18.14/ubifs-check-for-name-being-null-while-mounting.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.18.14 / ubifs-check-for-name-being-null-while-mounting.patch
CommitLineData
54545ec3
GKH
1From 37f31b6ca4311b94d985fb398a72e5399ad57925 Mon Sep 17 00:00:00 2001
2From: Richard Weinberger <richard@nod.at>
3Date: Mon, 3 Sep 2018 23:06:23 +0200
4Subject: ubifs: Check for name being NULL while mounting
5
6From: Richard Weinberger <richard@nod.at>
7
8commit 37f31b6ca4311b94d985fb398a72e5399ad57925 upstream.
9
10The requested device name can be NULL or an empty string.
11Check for that and refuse to continue. UBIFS has to do this manually
12since we cannot use mount_bdev(), which checks for this condition.
13
14Fixes: 1e51764a3c2ac ("UBIFS: add new flash file system")
15Reported-by: syzbot+38bd0f7865e5c6379280@syzkaller.appspotmail.com
16Signed-off-by: Richard Weinberger <richard@nod.at>
17Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
18
19---
20 fs/ubifs/super.c | 3 +++
21 1 file changed, 3 insertions(+)
22
23--- a/fs/ubifs/super.c
24+++ b/fs/ubifs/super.c
25@@ -1929,6 +1929,9 @@ static struct ubi_volume_desc *open_ubi(
26 int dev, vol;
27 char *endptr;
28
29+ if (!name || !*name)
30+ return ERR_PTR(-EINVAL);
31+
32 /* First, try to open using the device node path method */
33 ubi = ubi_open_volume_path(name, mode);
34 if (!IS_ERR(ubi))