diff options
author | Leon Romanovsky <leonro@nvidia.com> | 2021-09-14 11:12:10 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2021-09-20 04:24:52 +0200 |
commit | 40c8ee67cfc49d00a13ccbf542e307b6b5421ad3 (patch) | |
tree | 0654fa630cf715972701f86bdbf87381a5d6e108 /drivers | |
parent | init/do_mounts.c: Harden split_fs_names() against buffer overflow (diff) | |
download | linux-40c8ee67cfc49d00a13ccbf542e307b6b5421ad3.tar.xz linux-40c8ee67cfc49d00a13ccbf542e307b6b5421ad3.zip |
init: don't panic if mount_nodev_root failed
Attempt to mount 9p file system as root gives the following kernel panic:
9pnet_virtio: no channels available for device root
Kernel panic - not syncing: VFS: Unable to mount root "root" (9p), err=-2
CPU: 2 PID: 1 Comm: swapper/0 Not tainted 5.15.0-rc1+ #127
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
Call Trace:
dump_stack_lvl+0x45/0x59
panic+0x1e2/0x44b
? __warn_printk+0xf3/0xf3
? free_unref_page+0x2d4/0x4a0
? trace_hardirqs_on+0x32/0x120
? free_unref_page+0x2d4/0x4a0
mount_root+0x189/0x1e0
prepare_namespace+0x136/0x165
kernel_init_freeable+0x3b8/0x3cb
? rest_init+0x2e0/0x2e0
kernel_init+0x19/0x130
ret_from_fork+0x1f/0x30
Kernel Offset: disabled
---[ end Kernel panic - not syncing: VFS: Unable to mount root "root" (9p), err=-2 ]---
QEMU command line:
"qemu-system-x86_64 -append root=/dev/root rw rootfstype=9p rootflags=trans=virtio ..."
This error is because root_device_name is truncated in prepare_namespace() from
being "/dev/root" to be "root" prior to call to mount_nodev_root().
As a solution, don't treat errors in mount_nodev_root() as errors that
require panics and allow failback to the mount flow that existed before
patch citied in Fixes tag.
Fixes: f9259be6a9e7 ("init: allow mounting arbitrary non-blockdevice filesystems as root")
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers')
0 files changed, 0 insertions, 0 deletions