Age | Commit message (Collapse) | Author |
|
When run below command to mount a yaffs2 FS to nor flash, there
is kernel panic as below:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000020
......
Internal error: Oops: 96000004 [#1] PREEMPT SMP
Modules linked in:
CPU: 1 PID: 335 Comm: mount Not tainted 5.10.73-yocto-standard #1
......
Call trace:
yaffs_internal_read_super.constprop.0+0x24c/0x6fc
yaffs2_internal_read_super_mtd+0x28/0x40
mount_bdev+0x1cc/0x200
......
el0_sync_handler+0x1a4/0x1b0
el0_sync+0x180/0x1c0
Because in function yaffs_get_mtd_device(), it check the type of
mtd device. If it is not NAND flash, NULL will be returned. This
causes kernel panic if the ret value is not checked whether it
is NULL or not. So, replace IS_ERR with IS_ERR_OR_NULL to check
both ERR and NULL.
Signed-off-by: Meng Li <Meng.Li@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
|
|
In yaffs_fix_null_name, "if (strnlen(name, YAFFS_MAX_NAME_LENGTH) == 0)"
is used to judge if the "name" string is zero length. But this is wrong
when the "name" char array size is less than YAFFS_MAX_NAME_LENGTH and
this will trigger compile warnig as below:
fs/yaffs2/yaffs_guts.c:4501:13: warning: ‘strnlen’ specified bound 255 exceeds source size 16 [-Wstringop-overread]
4501 | if (strnlen(name, YAFFS_MAX_NAME_LENGTH) == 0) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Let's use buffer_size to do this instead of YAFFS_MAX_NAME_LENGTH
because buffer_size is passed to yaffs_fix_null_name by caller with
appropriate value which is fixed to the size of "name" char array.
Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
|
|
The definition of BDEVNAME_SIZE has moved, so we add the new .h
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
|
|
A variable declaration landed one function higher than intended,
leading to an unused variable warning for configurations with
YAFFS_USE_DIR_ITERATE=y and a build failure for configurations
with the same being unset.
Fixes: "yaffs: Fix build failure by handling inode i_version with proper atomic API"
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
|
|
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
|
|
commit 27f18203551940abf35826a66978daf1b8124c6b from
git://www.aleph1.co.uk/yaffs2
Thanks to Jisheng Zhang <Jisheng.Zhang@synaptics.com> for supplying this patch
There is a kernel memory leak observed when the proc file /proc/yaffs
is read. This reason is that in yaffs_proc_open, single_open is called
and the respective release function is not called during release.
Fix with correct release function - single_release().
Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
|
|
When kernel booting, mount_block_root will be called to judge
the filesystem type of root device. Then .mount function in file_system_type
structure will do the check operation. But yaffs filesystem has a
relaxed examination because as a filesystem for NAND Flash, it doesn't
examinate whether the root device is the MTD NAND device. This results
that yaffs filesystem will do mount operation even though the root device
is a MMC card with a btrfs filesystem, and will crash kernel after
mounting failed. The crash log is as below:
md: Waiting for all devices to be available before autodetect
md: If you don't use raid, use raid=noautodetect
md: Autodetecting RAID arrays.
md: autorun ...
md: ... autorun DONE.
yaffs: dev is 187695107 name is "mmcblk0p3" rw
yaffs: passed flags ""
yaffs: dev is 187695107 name is "mmcblk0p3" rw
yaffs: passed flags ""
------------[ cut here ]------------
kernel BUG at fs/yaffs2/yaffs_getblockinfo.h:30!
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
Modules linked in:
CPU: 3 PID: 1 Comm: swapper/0 Not tainted 5.2.24-yocto-standard+ #250
Hardware name: ZynqMP ZCU102 Rev1.0 (DT)
pstate: 80000005 (Nzcv daif -PAN -UAO)
pc : yaffs_rd_chunk_tags_nand+0xf0/0x110
lr : yaffs_rd_chunk_tags_nand+0x108/0x110
sp : ffffff801003b770
x29: ffffff801003b770 x28: ffffffc876fe8000
x27: 00000000000c0000 x26: 0000000000000000
x25: 00000000ffffffe1 x24: 0000000000010000
x23: 0000000000000000 x22: ffffff8011228000
x21: 000000000000005f x20: ffffff801003b890
x19: ffffffc876fe8000 x18: ffffffffffffffff
x17: 0000000000000000 x16: 0000000000000000
x15: ffffff80112285c8 x14: ffffff801137d228
x13: ffffff801137ce74 x12: ffffff8011246000
x11: 0000000000000000 x10: ffffff801137c000
x9 : 0000000000000000 x8 : 0000000000000007
x7 : 000000000000015c x6 : ffffff801137c490
x5 : 0000000000000000 x4 : 0000000000000000
x3 : 00000000ffffffff x2 : 50c80792e0663400
x1 : 0000000000000000 x0 : 0000000000000037
Call trace:
yaffs_rd_chunk_tags_nand+0xf0/0x110
yaffs_summary_read+0x10c/0x2e0
yaffs2_scan_backwards+0x28c/0xf58
yaffs_guts_initialise+0x71c/0x7a0
yaffs_internal_read_super.isra.20+0x4ec/0x838
yaffs2_internal_read_super_mtd+0x2c/0x48
mount_bdev+0x1a4/0x1e0
yaffs2_mount+0x44/0x58
legacy_get_tree+0x34/0x60
vfs_get_tree+0x34/0x120
do_mount+0x708/0x980
ksys_mount+0x9c/0x110
mount_block_root+0x128/0x29c
mount_root+0x148/0x17c
prepare_namespace+0x178/0x1c0
kernel_init_freeable+0x370/0x390
kernel_init+0x18/0x110
ret_from_fork+0x10/0x1c
Code: d65f03c0 f00069c0 b9440400 37f00060 (d4210000)
---[ end trace 68aa0995bdf59f76 ]---
BUG: sleeping function called from invalid context at ./include/linux/percpu-rwsem.h:34
in_atomic(): 1, irqs_disabled(): 128, pid: 1, name: swapper/0
Preemption disabled at:
[<ffffff80100a4598>] debug_exception_enter+0x30/0x40
CPU: 3 PID: 1 Comm: swapper/0 Tainted: G D 5.2.24-yocto-standard+ #250
Hardware name: ZynqMP ZCU102 Rev1.0 (DT)
Call trace:
dump_backtrace+0x0/0x148
show_stack+0x24/0x30
dump_stack+0x98/0xbc
___might_sleep+0x130/0x188
__might_sleep+0x58/0x90
exit_signals+0x44/0x258
do_exit+0xb4/0xa38
die+0x1bc/0x1e0
bug_handler+0x48/0x98
call_break_hook+0x7c/0xa8
brk_handler+0x28/0x68
do_debug_exception+0xc4/0x188
el1_dbg+0x18/0x8c
yaffs_rd_chunk_tags_nand+0xf0/0x110
yaffs_summary_read+0x10c/0x2e0
yaffs2_scan_backwards+0x28c/0xf58
yaffs_guts_initialise+0x71c/0x7a0
yaffs_internal_read_super.isra.20+0x4ec/0x838
yaffs2_internal_read_super_mtd+0x2c/0x48
mount_bdev+0x1a4/0x1e0
yaffs2_mount+0x44/0x58
legacy_get_tree+0x34/0x60
vfs_get_tree+0x34/0x120
do_mount+0x708/0x980
ksys_mount+0x9c/0x110
mount_block_root+0x128/0x29c
mount_root+0x148/0x17c
prepare_namespace+0x178/0x1c0
kernel_init_freeable+0x370/0x390
kernel_init+0x18/0x110
ret_from_fork+0x10/0x1c
note: swapper/0[1] exited with preempt_count 1
Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
SMP: stopping secondary CPUs
Kernel Offset: disabled
CPU features: 0x0002,20002004
Memory Limit: none
---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]---
Use yaffs_get_mtd_device to add strict check.
Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
|
|
The function yaffs_get_mtd_device use wrong function to retrieve
mtd_info structure (using yaffs_get_mtd_device itself will cause
dead loop).
Use get_mtd_device to do this.
Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
|
|
i_version in struct inode has changed to atomic64_t in mainline kernel.
This patch handles i_version with proper atomic API.
Signed-off-by: He Zhe <zhe.he@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
|
|
when using yaffs2 filesystem, after umounting, yaffs_put_super
function doesn't free the context_os memory, it is malloced in
yaffs_internal_read_super.
unreferenced object 0xd9103980 (size 64):
comm "mount", pid 5694, jiffies 159571 (age 45.150s)
hex dump (first 32 bytes):
80 39 10 d9 80 39 10 d9 00 b0 83 dc 00 b0 07 d9 .9...9..........
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<c0131b20>] kmem_cache_alloc_trace+0x188/0x350
[<c0386720>] yaffs_internal_read_super.isra.18+0x1d0/0x7e4
[<c0386d58>] yaffs2_internal_read_super_mtd+0x24/0x34
[<c0147110>] mount_bdev+0x178/0x1a0
[<c03835c8>] yaffs2_mount+0x28/0x30
[<c0147a74>] mount_fs+0x54/0x194
[<c01620e0>] vfs_kern_mount+0x58/0xf0
[<c0164b18>] do_mount+0x210/0xa48
[<c01656a4>] SyS_mount+0x94/0xc8
[<c000ec80>] ret_fast_syscall+0x0/0x30
[<ffffffff>] 0xffffffff
Signed-off-by: czou <cao.zou@windriver.com>
|
|
YAFFS doesn't sopport ACL yet, it must refuse any related settings.
Signed-off-by: Zhang Xiao <xiao.zhang@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
|
|
Yaffs will select Yaffs1 for deives with 512 byte writing size.
Moreover, it will enable inband_tags automatically for devices with
small oob.
However, Yaffs1 can not work with inband_tags. So move the
oob size checking before auto selecting Yaffs1.
Signed-off-by: Jiang Lu <lu.jiang@windriver.com>
|
|
The macro CURRENT_TIME has already been deleted by commit bfe1c566453a
("time: delete CURRENT_TIME_SEC and CURRENT_TIME"). So we need to
replace all the uses of CURRENT_TIME by current_time() for filesystem
times, and ktime_get_* function for others.
Signed-off-by: Kevin Hao <kexin.hao@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
|
|
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
|
|
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
|