]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - 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
1 From 37f31b6ca4311b94d985fb398a72e5399ad57925 Mon Sep 17 00:00:00 2001
2 From: Richard Weinberger <richard@nod.at>
3 Date: Mon, 3 Sep 2018 23:06:23 +0200
4 Subject: ubifs: Check for name being NULL while mounting
5
6 From: Richard Weinberger <richard@nod.at>
7
8 commit 37f31b6ca4311b94d985fb398a72e5399ad57925 upstream.
9
10 The requested device name can be NULL or an empty string.
11 Check for that and refuse to continue. UBIFS has to do this manually
12 since we cannot use mount_bdev(), which checks for this condition.
13
14 Fixes: 1e51764a3c2ac ("UBIFS: add new flash file system")
15 Reported-by: syzbot+38bd0f7865e5c6379280@syzkaller.appspotmail.com
16 Signed-off-by: Richard Weinberger <richard@nod.at>
17 Signed-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))