From 621979b49f7417d5c483e322630db45c0ad69038 Mon Sep 17 00:00:00 2001 From: Gabor Juhos Date: Wed, 25 Mar 2015 08:59:12 +0000 Subject: [PATCH] kernel: yaffs: use new_sync_{read,write} for 3.18+ Using the do_sync_{read,write} functions in conjunction with the generic_file_{read,write}_iter causes a kernel panic like this: root@OpenWrt:/# mount -t yaffs /dev/mtdblock5 /mnt [ 2884.110000] yaffs: dev is 32505861 name is "mtdblock5" rw [ 2884.120000] yaffs: passed flags "" root@OpenWrt:/# hexdump -vC -n 64 /mnt/kernel [ 2902.700000] CPU 0 Unable to handle kernel paging request at virtual \ address 00000000, epc == 00000000, ra == 80129414 [ 2902.710000] Oops[#1]: [ 2902.710000] CPU: 0 PID: 1030 Comm: hexdump Not tainted 3.18.9 #2 [ 2902.710000] task: 878e7a20 ti: 868c6000 task.ti: 868c6000 [ 2902.710000] $ 0 : 00000000 fffffff8 00000000 00000000 [ 2902.710000] $ 4 : 868c7e70 868c7ea8 00000001 868c7f08 [ 2902.710000] $ 8 : 00000038 80064f18 80072280 00000000 [ 2902.710000] $12 : 7fa152b8 7709e3a0 00c42008 7709e3a0 [ 2902.710000] $16 : 868c7f08 86a46000 00000010 878e7a20 [ 2902.710000] $20 : 7705c4b0 00000010 00000000 00000000 [ 2902.710000] $24 : 770960bc 7707dd78 [ 2902.710000] $28 : 868c6000 868c7e58 7f8e7030 80129414 [ 2902.710000] Hi : 00000000 [ 2902.710000] Lo : ffffffff [ 2902.710000] epc : 00000000 (null) [ 2902.710000] Not tainted [ 2902.710000] ra : 80129414 do_sync_read+0x7c/0xb4 [ 2902.710000] Status: 1900dc03 KERNEL EXL IE [ 2902.710000] Cause : 00800008 [ 2902.710000] BadVA : 00000000 [ 2902.710000] PrId : 00019750 (MIPS 74Kc) Change the yaffs code to use the new_sync_{read,write} functions instead. Signed-off-by: Gabor Juhos SVN-Revision: 44974 --- .../generic/patches-3.18/505-yaffs-3.16-new-fops.patch | 10 +++++++--- .../generic/patches-3.19/505-yaffs-3.16-new-fops.patch | 10 +++++++--- .../generic/patches-4.0/505-yaffs-3.16-new-fops.patch | 10 +++++++--- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/target/linux/generic/patches-3.18/505-yaffs-3.16-new-fops.patch b/target/linux/generic/patches-3.18/505-yaffs-3.16-new-fops.patch index 1ef630f844..be88ab9525 100644 --- a/target/linux/generic/patches-3.18/505-yaffs-3.16-new-fops.patch +++ b/target/linux/generic/patches-3.18/505-yaffs-3.16-new-fops.patch @@ -1,11 +1,15 @@ --- a/fs/yaffs2/yaffs_vfs.c +++ b/fs/yaffs2/yaffs_vfs.c -@@ -796,13 +796,13 @@ static int yaffs_sync_object(struct file +@@ -794,15 +794,15 @@ static int yaffs_sync_object(struct file + + #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22)) static const struct file_operations yaffs_file_operations = { - .read = do_sync_read, - .write = do_sync_write, +- .read = do_sync_read, +- .write = do_sync_write, - .aio_read = generic_file_aio_read, - .aio_write = generic_file_aio_write, ++ .read = new_sync_read, ++ .write = new_sync_write, + .read_iter = generic_file_read_iter, + .write_iter = generic_file_write_iter, .mmap = generic_file_mmap, diff --git a/target/linux/generic/patches-3.19/505-yaffs-3.16-new-fops.patch b/target/linux/generic/patches-3.19/505-yaffs-3.16-new-fops.patch index 1ef630f844..be88ab9525 100644 --- a/target/linux/generic/patches-3.19/505-yaffs-3.16-new-fops.patch +++ b/target/linux/generic/patches-3.19/505-yaffs-3.16-new-fops.patch @@ -1,11 +1,15 @@ --- a/fs/yaffs2/yaffs_vfs.c +++ b/fs/yaffs2/yaffs_vfs.c -@@ -796,13 +796,13 @@ static int yaffs_sync_object(struct file +@@ -794,15 +794,15 @@ static int yaffs_sync_object(struct file + + #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22)) static const struct file_operations yaffs_file_operations = { - .read = do_sync_read, - .write = do_sync_write, +- .read = do_sync_read, +- .write = do_sync_write, - .aio_read = generic_file_aio_read, - .aio_write = generic_file_aio_write, ++ .read = new_sync_read, ++ .write = new_sync_write, + .read_iter = generic_file_read_iter, + .write_iter = generic_file_write_iter, .mmap = generic_file_mmap, diff --git a/target/linux/generic/patches-4.0/505-yaffs-3.16-new-fops.patch b/target/linux/generic/patches-4.0/505-yaffs-3.16-new-fops.patch index 1ef630f844..be88ab9525 100644 --- a/target/linux/generic/patches-4.0/505-yaffs-3.16-new-fops.patch +++ b/target/linux/generic/patches-4.0/505-yaffs-3.16-new-fops.patch @@ -1,11 +1,15 @@ --- a/fs/yaffs2/yaffs_vfs.c +++ b/fs/yaffs2/yaffs_vfs.c -@@ -796,13 +796,13 @@ static int yaffs_sync_object(struct file +@@ -794,15 +794,15 @@ static int yaffs_sync_object(struct file + + #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22)) static const struct file_operations yaffs_file_operations = { - .read = do_sync_read, - .write = do_sync_write, +- .read = do_sync_read, +- .write = do_sync_write, - .aio_read = generic_file_aio_read, - .aio_write = generic_file_aio_write, ++ .read = new_sync_read, ++ .write = new_sync_write, + .read_iter = generic_file_read_iter, + .write_iter = generic_file_write_iter, .mmap = generic_file_mmap, -- 2.30.2