aboutsummaryrefslogtreecommitdiffstats
path: root/features/yaffs2
diff options
context:
space:
mode:
Diffstat (limited to 'features/yaffs2')
-rw-r--r--features/yaffs2/0001-yaffs2-convert-read_page-readfolio.patch76
-rw-r--r--features/yaffs2/0001-yaffs2-replace-bdevname-call-with-sprintf.patch34
-rw-r--r--features/yaffs2/0001-yaffs2-update-VFS-ctime-operations-to-6.6.patch64
-rw-r--r--features/yaffs2/0001-yaffs2-v5.12-build-fixups-not-runtime-tested.patch105
-rw-r--r--features/yaffs2/yaffs-fix-Wstringop-overread-compile-warning-in-yaff.patch44
-rw-r--r--features/yaffs2/yaffs-fix-misplaced-variable-declaration.patch40
-rw-r--r--features/yaffs2/yaffs-fix-mtime-itime-field-access.patch65
-rw-r--r--features/yaffs2/yaffs-include-blkdev.h.patch28
-rw-r--r--features/yaffs2/yaffs-replace-IS_ERR-with-IS_ERR_OR_NULL-to-check-bo.patch49
-rw-r--r--features/yaffs2/yaffs2-Fix-miscalculation-of-devname-buffer-length.patch65
-rw-r--r--features/yaffs2/yaffs2-convert-user_namespace-to-mnt_idmap.patch96
-rw-r--r--features/yaffs2/yaffs2-fix-memory-leak-when-proc-yaffs-is-read.patch38
-rw-r--r--features/yaffs2/yaffs2-import-git-revision-b4ce1bb-jan-2020.patch491
-rw-r--r--features/yaffs2/yaffs2-v5.6-build-fixups.patch50
-rw-r--r--features/yaffs2/yaffs2-v6.5-fixups.patch26
-rw-r--r--features/yaffs2/yaffs2.scc14
16 files changed, 802 insertions, 483 deletions
diff --git a/features/yaffs2/0001-yaffs2-convert-read_page-readfolio.patch b/features/yaffs2/0001-yaffs2-convert-read_page-readfolio.patch
new file mode 100644
index 00000000..78a5c311
--- /dev/null
+++ b/features/yaffs2/0001-yaffs2-convert-read_page-readfolio.patch
@@ -0,0 +1,76 @@
+From a10fa57649a96e7cd87ec4b93badc2b441b06ec5 Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <bruce.ashfield@gmail.com>
+Date: Wed, 29 Jun 2022 10:51:56 -0400
+Subject: [PATCH] yaffs2: convert read_page -> readfolio
+
+This is a first pass of changing yaffs2 to use the new read_folio,
+versus readpage routines. We also adjust writepage to no longer use
+flags, which have been dropped in 5.19+
+
+Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
+---
+ fs/yaffs2/yaffs_vfs.c | 21 +++++++++++++++------
+ 1 file changed, 15 insertions(+), 6 deletions(-)
+
+diff --git a/fs/yaffs2/yaffs_vfs.c b/fs/yaffs2/yaffs_vfs.c
+index 8ceb66c0d070..52f2d13c7126 100644
+--- a/fs/yaffs2/yaffs_vfs.c
++++ b/fs/yaffs2/yaffs_vfs.c
+@@ -367,13 +367,13 @@ static int yaffs_readpage_unlock(struct file *f, struct page *pg)
+ return ret;
+ }
+
+-static int yaffs_readpage(struct file *f, struct page *pg)
++static int yaffs_read_folio(struct file *f, struct folio *folio)
+ {
+ int ret;
+
+- yaffs_trace(YAFFS_TRACE_OS, "yaffs_readpage");
+- ret = yaffs_readpage_unlock(f, pg);
+- yaffs_trace(YAFFS_TRACE_OS, "yaffs_readpage done");
++ yaffs_trace(YAFFS_TRACE_OS, "yaffs_read_folio");
++ ret = yaffs_readpage_unlock(f, &folio->page);
++ yaffs_trace(YAFFS_TRACE_OS, "yaffs_read_folio done");
+ return ret;
+ }
+
+@@ -548,9 +548,16 @@ static void yaffs_release_space(struct file *f)
+ }
+
+ #if (YAFFS_USE_WRITE_BEGIN_END > 0)
++
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
++static int yaffs_write_begin(struct file *filp, struct address_space *mapping,
++ loff_t pos, unsigned len,
++ struct page **pagep, void **fsdata)
++#else
+ static int yaffs_write_begin(struct file *filp, struct address_space *mapping,
+ loff_t pos, unsigned len, unsigned flags,
+ struct page **pagep, void **fsdata)
++#endif
+ {
+ struct page *pg = NULL;
+ pgoff_t index = pos >> PAGE_CACHE_SHIFT;
+@@ -559,7 +566,9 @@ static int yaffs_write_begin(struct file *filp, struct address_space *mapping,
+ int space_held = 0;
+
+ /* Get a page */
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
++ pg = grab_cache_page_write_begin(mapping, index);
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)
+ pg = grab_cache_page_write_begin(mapping, index, flags);
+ #else
+ pg = __grab_cache_page(mapping, index);
+@@ -748,7 +757,7 @@ static int yaffs_commit_write(struct file *f, struct page *pg, unsigned offset,
+ #endif
+
+ static struct address_space_operations yaffs_file_address_operations = {
+- .readpage = yaffs_readpage,
++ .read_folio = yaffs_read_folio,
+ .writepage = yaffs_writepage,
+ #if (YAFFS_USE_WRITE_BEGIN_END > 0)
+ .write_begin = yaffs_write_begin,
+--
+2.19.1
+
diff --git a/features/yaffs2/0001-yaffs2-replace-bdevname-call-with-sprintf.patch b/features/yaffs2/0001-yaffs2-replace-bdevname-call-with-sprintf.patch
new file mode 100644
index 00000000..b3c829ab
--- /dev/null
+++ b/features/yaffs2/0001-yaffs2-replace-bdevname-call-with-sprintf.patch
@@ -0,0 +1,34 @@
+From ae1445c1cc1cec47fa51f7831cd9110ecd5b2a55 Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <bruce.ashfield@gmail.com>
+Date: Mon, 3 Oct 2022 15:16:27 -0400
+Subject: [PATCH] yaffs2: replace bdevname call with sprintf
+
+commit 900d156bac2bc474cf7c7bee4efbc6c83ec5ae58 [block: remove bdevname]
+removed this function, we follow the pattern and use sprintf as a
+replacement.
+
+Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
+---
+ fs/yaffs2/yaffs_vfs.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/fs/yaffs2/yaffs_vfs.c b/fs/yaffs2/yaffs_vfs.c
+index 52f2d13c7126..140f7aa7a1a1 100644
+--- a/fs/yaffs2/yaffs_vfs.c
++++ b/fs/yaffs2/yaffs_vfs.c
+@@ -117,7 +117,11 @@
+ #define Page_Uptodate(page) test_bit(PG_uptodate, &(page)->flags)
+
+ /* FIXME: use sb->s_id instead ? */
+-#define yaffs_devname(sb, buf) bdevname(sb->s_bdev, buf)
++//#define yaffs_devname(sb, buf) bdevname(sb->s_bdev, buf)
++static inline char* yaffs_devname(struct super_block *sb, char *buf) {
++ snprintf(buf, sizeof(buf), "%pg", sb->s_bdev);
++ return buf;
++}
+
+ #else
+
+--
+2.19.1
+
diff --git a/features/yaffs2/0001-yaffs2-update-VFS-ctime-operations-to-6.6.patch b/features/yaffs2/0001-yaffs2-update-VFS-ctime-operations-to-6.6.patch
new file mode 100644
index 00000000..9ea1aa07
--- /dev/null
+++ b/features/yaffs2/0001-yaffs2-update-VFS-ctime-operations-to-6.6.patch
@@ -0,0 +1,64 @@
+From 70f40841c195a81a8ef8290862adeb86fe264b24 Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <bruce.ashfield@gmail.com>
+Date: Thu, 21 Sep 2023 17:04:31 -0400
+Subject: [PATCH] yaffs2: update VFS ctime operations to 6.6+
+
+In 6.6+ kernels the inode ctime is hidden, and should only
+be accessed through accesor routines. We convert one of our
+calls to the accesor, but the other, we use the new "hidden"
+__ctime.
+
+We also convert the interator to use the shared iterator and
+iterator wrap routines.
+
+Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
+---
+ fs/yaffs2/yaffs_vfs.c | 11 ++++++-----
+ 1 file changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/fs/yaffs2/yaffs_vfs.c b/fs/yaffs2/yaffs_vfs.c
+index 04abeee99ff5..8a9738de8906 100644
+--- a/fs/yaffs2/yaffs_vfs.c
++++ b/fs/yaffs2/yaffs_vfs.c
+@@ -282,7 +282,7 @@ MODULE_PARM(yaffs_gc_control, "i");
+ } while (0)
+ #else
+ #define update_dir_time(dir) do {\
+- (dir)->i_ctime = (dir)->i_mtime = current_time(dir); \
++ (dir)->i_mtime = inode_set_ctime_to_ts( dir, current_time(dir) ); \
+ } while (0)
+ #endif
+
+@@ -1901,7 +1901,7 @@ static int yaffs_iterate(struct file *f, struct dir_context *dc)
+
+ return ret_val;
+ }
+-
++WRAP_DIR_ITER(yaffs_iterate)
+ #else
+
+ static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir)
+@@ -2018,7 +2018,7 @@ static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir)
+ static const struct file_operations yaffs_dir_operations = {
+ .read = generic_read_dir,
+ #ifdef YAFFS_USE_DIR_ITERATE
+- .iterate = yaffs_iterate,
++ .iterate_shared = shared_yaffs_iterate,
+ #else
+ .readdir = yaffs_readdir,
+ #endif
+@@ -2079,8 +2079,9 @@ static void yaffs_fill_inode_from_obj(struct inode *inode,
+ inode->i_atime.tv_nsec = 0;
+ inode->i_mtime.tv_sec = (time64_t) obj->yst_mtime;
+ inode->i_mtime.tv_nsec = 0;
+- inode->i_ctime.tv_sec = (time64_t) obj->yst_ctime;
+- inode->i_ctime.tv_nsec = 0;
++ //inode->i_ctime.tv_sec = (time64_t) obj->yst_ctime;
++ inode->__i_ctime.tv_sec = (time64_t) obj->yst_ctime;
++ inode->__i_ctime.tv_nsec = 0;
+ #else
+ inode->i_rdev = obj->yst_rdev;
+ inode->i_atime = obj->yst_atime;
+--
+2.34.1
+
diff --git a/features/yaffs2/0001-yaffs2-v5.12-build-fixups-not-runtime-tested.patch b/features/yaffs2/0001-yaffs2-v5.12-build-fixups-not-runtime-tested.patch
new file mode 100644
index 00000000..13bbba8a
--- /dev/null
+++ b/features/yaffs2/0001-yaffs2-v5.12-build-fixups-not-runtime-tested.patch
@@ -0,0 +1,105 @@
+From d16f6eab238d58479a7140507a2eb32573c1a106 Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <bruce.ashfield@gmail.com>
+Date: Fri, 19 Mar 2021 12:13:36 -0400
+Subject: [PATCH] yaffs2: v5.12+ build fixups (not runtime tested)
+
+Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
+---
+ fs/yaffs2/yaffs_vfs.c | 21 +++++++++++----------
+ 1 file changed, 11 insertions(+), 10 deletions(-)
+
+diff --git a/fs/yaffs2/yaffs_vfs.c b/fs/yaffs2/yaffs_vfs.c
+index a9cf8edc2245..ee9d6955ed79 100644
+--- a/fs/yaffs2/yaffs_vfs.c
++++ b/fs/yaffs2/yaffs_vfs.c
+@@ -897,7 +897,7 @@ static int yaffs_vfs_setsize(struct inode *inode, loff_t newsize)
+ static int yaffs_vfs_setattr(struct inode *inode, struct iattr *attr)
+ {
+ #ifdef YAFFS_USE_SETATTR_COPY
+- setattr_copy(inode, attr);
++ setattr_copy(&init_user_ns,inode, attr);
+ return 0;
+ #else
+ return inode_setattr(inode, attr);
+@@ -905,7 +905,7 @@ static int yaffs_vfs_setattr(struct inode *inode, struct iattr *attr)
+
+ }
+
+-static int yaffs_setattr(struct dentry *dentry, struct iattr *attr)
++static int yaffs_setattr(struct user_namespace *ns, struct dentry *dentry, struct iattr *attr)
+ {
+ struct inode *inode = dentry->d_inode;
+ int error = 0;
+@@ -921,7 +921,7 @@ static int yaffs_setattr(struct dentry *dentry, struct iattr *attr)
+ #endif
+
+ if (error == 0)
+- error = setattr_prepare(dentry, attr);
++ error = setattr_prepare(&init_user_ns,dentry, attr);
+ if (error == 0) {
+ int result;
+ if (!error) {
+@@ -1339,7 +1339,7 @@ struct inode *yaffs_get_inode(struct super_block *sb, int mode, int dev,
+
+
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0))
+-static int yaffs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
++static int yaffs_mknod(struct user_namespace *ns, struct inode *dir, struct dentry *dentry, umode_t mode,
+ dev_t rdev)
+ #elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
+ static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode,
+@@ -1433,20 +1433,20 @@ static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode,
+ }
+
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0))
+-static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
++static int yaffs_mkdir(struct user_namespace *ns, struct inode *dir, struct dentry *dentry, umode_t mode)
+ #else
+ static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
+ #endif
+ {
+ int ret_val;
+ yaffs_trace(YAFFS_TRACE_OS, "yaffs_mkdir");
+- ret_val = yaffs_mknod(dir, dentry, mode | S_IFDIR, 0);
++ ret_val = yaffs_mknod(ns, dir, dentry, mode | S_IFDIR, 0);
+ return ret_val;
+ }
+
+
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
+-static int yaffs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
++static int yaffs_create(struct user_namespace *ns, struct inode *dir, struct dentry *dentry, umode_t mode,
+ bool dummy)
+ #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0))
+ static int yaffs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
+@@ -1459,7 +1459,7 @@ static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode)
+ #endif
+ {
+ yaffs_trace(YAFFS_TRACE_OS, "yaffs_create");
+- return yaffs_mknod(dir, dentry, mode | S_IFREG, 0);
++ return yaffs_mknod(ns, dir, dentry, mode | S_IFREG, 0);
+ }
+
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
+@@ -1551,7 +1551,8 @@ static int yaffs_link(struct dentry *old_dentry, struct inode *dir,
+ return -EPERM;
+ }
+
+-static int yaffs_symlink(struct inode *dir, struct dentry *dentry,
++static int yaffs_symlink(struct user_namespace *ns,
++ struct inode *dir, struct dentry *dentry,
+ const char *symname)
+ {
+ struct yaffs_obj *obj;
+@@ -1597,7 +1598,7 @@ static int yaffs_symlink(struct inode *dir, struct dentry *dentry,
+ * NB: POSIX says you can rename an object over an old object of the same name
+ */
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0))
+-static int yaffs_rename(struct inode *old_dir, struct dentry *old_dentry,
++static int yaffs_rename(struct user_namespace *ns, struct inode *old_dir, struct dentry *old_dentry,
+ struct inode *new_dir, struct dentry *new_dentry, unsigned int unused)
+ #else
+ static int yaffs_rename(struct inode *old_dir, struct dentry *old_dentry,
+--
+2.19.1
+
diff --git a/features/yaffs2/yaffs-fix-Wstringop-overread-compile-warning-in-yaff.patch b/features/yaffs2/yaffs-fix-Wstringop-overread-compile-warning-in-yaff.patch
new file mode 100644
index 00000000..7a47c4a5
--- /dev/null
+++ b/features/yaffs2/yaffs-fix-Wstringop-overread-compile-warning-in-yaff.patch
@@ -0,0 +1,44 @@
+From ea777841e8ea883bfa160693e650882f86e75167 Mon Sep 17 00:00:00 2001
+From: Quanyang Wang <quanyang.wang@windriver.com>
+Date: Sun, 13 Jun 2021 12:08:21 +0800
+Subject: [PATCH] yaffs: fix -Wstringop-overread compile warning in
+ yaffs_fix_null_name
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+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>
+---
+ fs/yaffs2/yaffs_guts.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/fs/yaffs2/yaffs_guts.c b/fs/yaffs2/yaffs_guts.c
+index 40a5b46cf6ca..0cc794ebc347 100644
+--- a/fs/yaffs2/yaffs_guts.c
++++ b/fs/yaffs2/yaffs_guts.c
+@@ -4498,7 +4498,7 @@ static void yaffs_fix_null_name(struct yaffs_obj *obj, YCHAR *name,
+ int buffer_size)
+ {
+ /* Create an object name if we could not find one. */
+- if (strnlen(name, YAFFS_MAX_NAME_LENGTH) == 0) {
++ if (strnlen(name, buffer_size) == 0) {
+ YCHAR local_name[20];
+ YCHAR num_string[20];
+ YCHAR *x = &num_string[19];
+--
+2.19.1
+
diff --git a/features/yaffs2/yaffs-fix-misplaced-variable-declaration.patch b/features/yaffs2/yaffs-fix-misplaced-variable-declaration.patch
new file mode 100644
index 00000000..b7da6b82
--- /dev/null
+++ b/features/yaffs2/yaffs-fix-misplaced-variable-declaration.patch
@@ -0,0 +1,40 @@
+From f28b801ca5c4853b60f16eaf5525b05b5174ab43 Mon Sep 17 00:00:00 2001
+From: Paul Gortmaker <paul.gortmaker@windriver.com>
+Date: Thu, 30 Apr 2020 12:59:46 -0400
+Subject: [PATCH] yaffs: fix misplaced variable declaration
+
+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>
+---
+ fs/yaffs2/yaffs_vfs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/fs/yaffs2/yaffs_vfs.c b/fs/yaffs2/yaffs_vfs.c
+index 598ecd57a0ed..3ffdc0129637 100644
+--- a/fs/yaffs2/yaffs_vfs.c
++++ b/fs/yaffs2/yaffs_vfs.c
+@@ -1826,7 +1826,6 @@ static int yaffs_iterate(struct file *f, struct dir_context *dc)
+ int ret_val = 0;
+
+ char name[YAFFS_MAX_NAME_LENGTH + 1];
+- u64 i_version;
+
+ obj = yaffs_dentry_to_obj(Y_GET_DENTRY(f));
+ dev = obj->my_dev;
+@@ -1898,6 +1897,7 @@ static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir)
+ unsigned long offset, curoffs;
+ struct yaffs_obj *l;
+ int ret_val = 0;
++ u64 i_version;
+
+ char name[YAFFS_MAX_NAME_LENGTH + 1];
+
+--
+2.19.1
+
diff --git a/features/yaffs2/yaffs-fix-mtime-itime-field-access.patch b/features/yaffs2/yaffs-fix-mtime-itime-field-access.patch
new file mode 100644
index 00000000..482312a0
--- /dev/null
+++ b/features/yaffs2/yaffs-fix-mtime-itime-field-access.patch
@@ -0,0 +1,65 @@
+From 7614fa80bc6abefd1450b5c4c3839386ac2b92cc Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <bruce.ashfield@gmail.com>
+Date: Wed, 22 Nov 2023 12:04:28 -0500
+Subject: [PATCH] yaffs: fix mtime/itime field access
+
+Adapting our inode field access to the following upstream
+commit:
+
+ commit 12cd44023651666bd44baa36a5c999698890debb
+ Author: Jeff Layton <jlayton@kernel.org>
+ Date: Fri Sep 29 09:05:52 2023 -0400
+
+ fs: rename inode i_atime and i_mtime fields
+
+ Rename these two fields to discourage direct access (and to help ensure
+ that we mop up any leftover direct accesses).
+
+ Signed-off-by: Jeff Layton <jlayton@kernel.org>
+ Signed-off-by: Christian Brauner <brauner@kernel.org>
+
+Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
+---
+ fs/yaffs2/yaffs_vfs.c | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/fs/yaffs2/yaffs_vfs.c b/fs/yaffs2/yaffs_vfs.c
+index 8a9738de8906..ec4016cfeedf 100644
+--- a/fs/yaffs2/yaffs_vfs.c
++++ b/fs/yaffs2/yaffs_vfs.c
+@@ -282,7 +282,7 @@ MODULE_PARM(yaffs_gc_control, "i");
+ } while (0)
+ #else
+ #define update_dir_time(dir) do {\
+- (dir)->i_mtime = inode_set_ctime_to_ts( dir, current_time(dir) ); \
++ (dir)->__i_mtime = inode_set_ctime_to_ts( dir, current_time(dir) ); \
+ } while (0)
+ #endif
+
+@@ -2075,17 +2075,17 @@ static void yaffs_fill_inode_from_obj(struct inode *inode,
+ #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
+
+ inode->i_rdev = old_decode_dev(obj->yst_rdev);
+- inode->i_atime.tv_sec = (time64_t) (obj->yst_atime);
+- inode->i_atime.tv_nsec = 0;
+- inode->i_mtime.tv_sec = (time64_t) obj->yst_mtime;
+- inode->i_mtime.tv_nsec = 0;
++ inode->__i_atime.tv_sec = (time64_t) (obj->yst_atime);
++ inode->__i_atime.tv_nsec = 0;
++ inode->__i_mtime.tv_sec = (time64_t) obj->yst_mtime;
++ inode->__i_mtime.tv_nsec = 0;
+ //inode->i_ctime.tv_sec = (time64_t) obj->yst_ctime;
+ inode->__i_ctime.tv_sec = (time64_t) obj->yst_ctime;
+ inode->__i_ctime.tv_nsec = 0;
+ #else
+ inode->i_rdev = obj->yst_rdev;
+- inode->i_atime = obj->yst_atime;
+- inode->i_mtime = obj->yst_mtime;
++ inode->__i_atime = obj->yst_atime;
++ inode->__i_mtime = obj->yst_mtime;
+ inode->i_ctime = obj->yst_ctime;
+ #endif
+ inode->i_size = yaffs_get_obj_length(obj);
+--
+2.34.1
+
diff --git a/features/yaffs2/yaffs-include-blkdev.h.patch b/features/yaffs2/yaffs-include-blkdev.h.patch
new file mode 100644
index 00000000..e75911de
--- /dev/null
+++ b/features/yaffs2/yaffs-include-blkdev.h.patch
@@ -0,0 +1,28 @@
+From a07a378f2bbfc640c6b76abfa3ef2a32a86cbfa2 Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <bruce.ashfield@gmail.com>
+Date: Sat, 29 Aug 2020 10:25:04 -0400
+Subject: [PATCH] yaffs: include blkdev.h
+
+The definition of BDEVNAME_SIZE has moved, so we add the new .h
+
+Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
+---
+ fs/yaffs2/yaffs_vfs.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/fs/yaffs2/yaffs_vfs.c b/fs/yaffs2/yaffs_vfs.c
+index 3ffdc0129637..a9cf8edc2245 100644
+--- a/fs/yaffs2/yaffs_vfs.c
++++ b/fs/yaffs2/yaffs_vfs.c
+@@ -74,6 +74,8 @@
+ #include <linux/config.h>
+ #endif
+
++#include <linux/blkdev.h>
++
+ #include <linux/kernel.h>
+ #include <linux/module.h>
+ #include <linux/slab.h>
+--
+2.19.1
+
diff --git a/features/yaffs2/yaffs-replace-IS_ERR-with-IS_ERR_OR_NULL-to-check-bo.patch b/features/yaffs2/yaffs-replace-IS_ERR-with-IS_ERR_OR_NULL-to-check-bo.patch
new file mode 100644
index 00000000..4956ff5e
--- /dev/null
+++ b/features/yaffs2/yaffs-replace-IS_ERR-with-IS_ERR_OR_NULL-to-check-bo.patch
@@ -0,0 +1,49 @@
+From f3ffb6a61225aa0a89d0edfeb7cdd99b9963faa0 Mon Sep 17 00:00:00 2001
+From: Meng Li <Meng.Li@windriver.com>
+Date: Thu, 21 Oct 2021 09:27:20 +0800
+Subject: [PATCH] yaffs: replace IS_ERR with IS_ERR_OR_NULL to check both ERR
+ and NULL
+
+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>
+---
+ fs/yaffs2/yaffs_vfs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/fs/yaffs2/yaffs_vfs.c b/fs/yaffs2/yaffs_vfs.c
+index ee9d6955ed79..8ceb66c0d070 100644
+--- a/fs/yaffs2/yaffs_vfs.c
++++ b/fs/yaffs2/yaffs_vfs.c
+@@ -2965,7 +2965,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
+
+
+ mtd = yaffs_get_mtd_device(sb->s_dev);
+- if (IS_ERR(mtd)) {
++ if (IS_ERR_OR_NULL(mtd)) {
+ return NULL;
+ }
+
+--
+2.19.1
+
diff --git a/features/yaffs2/yaffs2-Fix-miscalculation-of-devname-buffer-length.patch b/features/yaffs2/yaffs2-Fix-miscalculation-of-devname-buffer-length.patch
new file mode 100644
index 00000000..79deb483
--- /dev/null
+++ b/features/yaffs2/yaffs2-Fix-miscalculation-of-devname-buffer-length.patch
@@ -0,0 +1,65 @@
+From dded404c66bb87f08216afd1e3c9d84359e80012 Mon Sep 17 00:00:00 2001
+From: He Zhe <zhe.he@windriver.com>
+Date: Wed, 31 May 2023 14:01:07 +0800
+Subject: [PATCH] yaffs2: Fix miscalculation of devname buffer length
+
+The following build warning helps us find a real mishandling of array length.
+
+fs/yaffs2/yaffs_vfs.c:122:29: warning: argument to 'sizeof' in 'snprintf' call
+is the same expression as the destination; did you mean to provide an explicit
+length? [-Wsizeof-pointer-memaccess]
+
+If an array is passed as a function parameter it'll be treated as a simple
+pointer and thus sizeof will return the length of a pointer rather than the
+length of the array.
+
+Add and pass the buffer length to make it work correctly.
+
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
+---
+ fs/yaffs2/yaffs_vfs.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/fs/yaffs2/yaffs_vfs.c b/fs/yaffs2/yaffs_vfs.c
+index 140f7aa7a1a1..e9e29a41a680 100644
+--- a/fs/yaffs2/yaffs_vfs.c
++++ b/fs/yaffs2/yaffs_vfs.c
+@@ -118,8 +118,8 @@
+
+ /* FIXME: use sb->s_id instead ? */
+ //#define yaffs_devname(sb, buf) bdevname(sb->s_bdev, buf)
+-static inline char* yaffs_devname(struct super_block *sb, char *buf) {
+- snprintf(buf, sizeof(buf), "%pg", sb->s_bdev);
++static inline char* yaffs_devname(struct super_block *sb, char *buf, unsigned long len) {
++ snprintf(buf, len, "%pg", sb->s_bdev);
+ return buf;
+ }
+
+@@ -2944,12 +2944,12 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
+
+ if (!sb->s_dev)
+ printk(KERN_INFO "yaffs: sb->s_dev is NULL\n");
+- else if (!yaffs_devname(sb, devname_buf))
++ else if (!yaffs_devname(sb, devname_buf, sizeof(devname_buf)))
+ printk(KERN_INFO "yaffs: devname is NULL\n");
+ else
+ printk(KERN_INFO "yaffs: dev is %d name is \"%s\" %s\n",
+ sb->s_dev,
+- yaffs_devname(sb, devname_buf), read_only ? "ro" : "rw");
++ yaffs_devname(sb, devname_buf, sizeof(devname_buf)), read_only ? "ro" : "rw");
+
+ if (!data_str)
+ data_str = "";
+@@ -2974,7 +2974,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
+ yaffs_trace(YAFFS_TRACE_ALWAYS,
+ "yaffs: Attempting MTD mount of %u.%u,\"%s\"",
+ MAJOR(sb->s_dev), MINOR(sb->s_dev),
+- yaffs_devname(sb, devname_buf));
++ yaffs_devname(sb, devname_buf, sizeof(devname_buf)));
+
+
+ mtd = yaffs_get_mtd_device(sb->s_dev);
+--
+2.34.1
+
diff --git a/features/yaffs2/yaffs2-convert-user_namespace-to-mnt_idmap.patch b/features/yaffs2/yaffs2-convert-user_namespace-to-mnt_idmap.patch
new file mode 100644
index 00000000..1a67540b
--- /dev/null
+++ b/features/yaffs2/yaffs2-convert-user_namespace-to-mnt_idmap.patch
@@ -0,0 +1,96 @@
+From 5440769b1bbff51e64557c2a981a6cdfece8adec Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <bruce.ashfield@gmail.com>
+Date: Fri, 17 Mar 2023 22:31:42 -0400
+Subject: [PATCH] yaffs2: convert user_namespace to mnt_idmap
+
+commit c1632a0f11209338fc300c66252bcc4686e609e8 [fs: port ->setattr() to
+pass mnt_idmap] changes the parameters to attr operations to a
+mnt_idmap.
+
+yaffs2 isn't using the user namespace directly, so we switch to the
+default map.
+
+Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
+---
+ fs/yaffs2/yaffs_vfs.c | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/fs/yaffs2/yaffs_vfs.c b/fs/yaffs2/yaffs_vfs.c
+index 140f7aa7a1a1..3844d542608e 100644
+--- a/fs/yaffs2/yaffs_vfs.c
++++ b/fs/yaffs2/yaffs_vfs.c
+@@ -910,7 +910,7 @@ static int yaffs_vfs_setsize(struct inode *inode, loff_t newsize)
+ static int yaffs_vfs_setattr(struct inode *inode, struct iattr *attr)
+ {
+ #ifdef YAFFS_USE_SETATTR_COPY
+- setattr_copy(&init_user_ns,inode, attr);
++ setattr_copy(&nop_mnt_idmap,inode, attr);
+ return 0;
+ #else
+ return inode_setattr(inode, attr);
+@@ -918,7 +918,7 @@ static int yaffs_vfs_setattr(struct inode *inode, struct iattr *attr)
+
+ }
+
+-static int yaffs_setattr(struct user_namespace *ns, struct dentry *dentry, struct iattr *attr)
++static int yaffs_setattr(struct mnt_idmap *ns, struct dentry *dentry, struct iattr *attr)
+ {
+ struct inode *inode = dentry->d_inode;
+ int error = 0;
+@@ -934,7 +934,7 @@ static int yaffs_setattr(struct user_namespace *ns, struct dentry *dentry, struc
+ #endif
+
+ if (error == 0)
+- error = setattr_prepare(&init_user_ns,dentry, attr);
++ error = setattr_prepare(&nop_mnt_idmap,dentry, attr);
+ if (error == 0) {
+ int result;
+ if (!error) {
+@@ -1352,7 +1352,7 @@ struct inode *yaffs_get_inode(struct super_block *sb, int mode, int dev,
+
+
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0))
+-static int yaffs_mknod(struct user_namespace *ns, struct inode *dir, struct dentry *dentry, umode_t mode,
++static int yaffs_mknod(struct mnt_idmap *ns, struct inode *dir, struct dentry *dentry, umode_t mode,
+ dev_t rdev)
+ #elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
+ static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode,
+@@ -1446,7 +1446,7 @@ static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode,
+ }
+
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0))
+-static int yaffs_mkdir(struct user_namespace *ns, struct inode *dir, struct dentry *dentry, umode_t mode)
++static int yaffs_mkdir(struct mnt_idmap *ns, struct inode *dir, struct dentry *dentry, umode_t mode)
+ #else
+ static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
+ #endif
+@@ -1459,7 +1459,7 @@ static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
+
+
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
+-static int yaffs_create(struct user_namespace *ns, struct inode *dir, struct dentry *dentry, umode_t mode,
++static int yaffs_create(struct mnt_idmap *ns, struct inode *dir, struct dentry *dentry, umode_t mode,
+ bool dummy)
+ #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0))
+ static int yaffs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
+@@ -1564,7 +1564,7 @@ static int yaffs_link(struct dentry *old_dentry, struct inode *dir,
+ return -EPERM;
+ }
+
+-static int yaffs_symlink(struct user_namespace *ns,
++static int yaffs_symlink(struct mnt_idmap *ns,
+ struct inode *dir, struct dentry *dentry,
+ const char *symname)
+ {
+@@ -1611,7 +1611,7 @@ static int yaffs_symlink(struct user_namespace *ns,
+ * NB: POSIX says you can rename an object over an old object of the same name
+ */
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0))
+-static int yaffs_rename(struct user_namespace *ns, struct inode *old_dir, struct dentry *old_dentry,
++static int yaffs_rename(struct mnt_idmap *ns, struct inode *old_dir, struct dentry *old_dentry,
+ struct inode *new_dir, struct dentry *new_dentry, unsigned int unused)
+ #else
+ static int yaffs_rename(struct inode *old_dir, struct dentry *old_dentry,
+--
+2.34.1
+
diff --git a/features/yaffs2/yaffs2-fix-memory-leak-when-proc-yaffs-is-read.patch b/features/yaffs2/yaffs2-fix-memory-leak-when-proc-yaffs-is-read.patch
new file mode 100644
index 00000000..23c0ee48
--- /dev/null
+++ b/features/yaffs2/yaffs2-fix-memory-leak-when-proc-yaffs-is-read.patch
@@ -0,0 +1,38 @@
+From e64f1a1d9447f4def5e36c9278b433b19eec1798 Mon Sep 17 00:00:00 2001
+From: Charles Manning <cdhmanning@gmail.com>
+Date: Mon, 16 Mar 2020 16:52:51 +0800
+Subject: [PATCH] yaffs2: fix memory leak when /proc/yaffs is read
+
+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>
+---
+ fs/yaffs2/yaffs_vfs.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/fs/yaffs2/yaffs_vfs.c b/fs/yaffs2/yaffs_vfs.c
+index d3f89e07401b..4fbd0a42ff3d 100644
+--- a/fs/yaffs2/yaffs_vfs.c
++++ b/fs/yaffs2/yaffs_vfs.c
+@@ -3697,6 +3697,7 @@ static struct file_operations procfs_ops = {
+ .open = yaffs_proc_open,
+ .read = seq_read,
+ .write = yaffs_proc_write,
++ .release = single_release,
+ };
+
+ static int yaffs_procfs_init(void)
+--
+2.19.1
+
diff --git a/features/yaffs2/yaffs2-import-git-revision-b4ce1bb-jan-2020.patch b/features/yaffs2/yaffs2-import-git-revision-b4ce1bb-jan-2020.patch
index 53673b8a..ef8109c8 100644
--- a/features/yaffs2/yaffs2-import-git-revision-b4ce1bb-jan-2020.patch
+++ b/features/yaffs2/yaffs2-import-git-revision-b4ce1bb-jan-2020.patch
@@ -1,4 +1,4 @@
-From 8c6f9b2baa402d8c9269fc08ccb26c1126e28f62 Mon Sep 17 00:00:00 2001
+From 5fd0c1a67df759fe4d214f645c6bbdfb72e95518 Mon Sep 17 00:00:00 2001
From: Bruce Ashfield <bruce.ashfield@gmail.com>
Date: Mon, 13 Jan 2020 12:19:30 -0500
Subject: [PATCH] yaffs2: import git revision b4ce1bb (jan, 2020)
@@ -6,9 +6,7 @@ Subject: [PATCH] yaffs2: import git revision b4ce1bb (jan, 2020)
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
---
fs/Kconfig | 1 +
- fs/Kconfig.pre.yaffs | 325 ++
fs/Makefile | 1 +
- fs/Makefile.pre.yaffs | 134 +
fs/yaffs2/Kconfig | 171 ++
fs/yaffs2/Makefile | 19 +
fs/yaffs2/yaffs_allocator.c | 356 +++
@@ -52,9 +50,7 @@ Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
fs/yaffs2/yaffs_yaffs2.c | 1711 +++++++++++
fs/yaffs2/yaffs_yaffs2.h | 38 +
fs/yaffs2/yportenv.h | 92 +
- 47 files changed, 17522 insertions(+)
- create mode 100644 fs/Kconfig.pre.yaffs
- create mode 100644 fs/Makefile.pre.yaffs
+ 45 files changed, 17063 insertions(+)
create mode 100644 fs/yaffs2/Kconfig
create mode 100644 fs/yaffs2/Makefile
create mode 100644 fs/yaffs2/yaffs_allocator.c
@@ -100,10 +96,10 @@ Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
create mode 100644 fs/yaffs2/yportenv.h
diff --git a/fs/Kconfig b/fs/Kconfig
-index 2501e6f1f965..9bdef69b0358 100644
+index 708ba336e689..fe77c48345ac 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
-@@ -248,6 +248,7 @@ source "fs/hfsplus/Kconfig"
+@@ -249,6 +249,7 @@ source "fs/hfsplus/Kconfig"
source "fs/befs/Kconfig"
source "fs/bfs/Kconfig"
source "fs/efs/Kconfig"
@@ -111,486 +107,15 @@ index 2501e6f1f965..9bdef69b0358 100644
source "fs/jffs2/Kconfig"
# UBIFS File system configuration
source "fs/ubifs/Kconfig"
-diff --git a/fs/Kconfig.pre.yaffs b/fs/Kconfig.pre.yaffs
-new file mode 100644
-index 000000000000..2501e6f1f965
---- /dev/null
-+++ b/fs/Kconfig.pre.yaffs
-@@ -0,0 +1,325 @@
-+# SPDX-License-Identifier: GPL-2.0-only
-+#
-+# File system configuration
-+#
-+
-+menu "File systems"
-+
-+# Use unaligned word dcache accesses
-+config DCACHE_WORD_ACCESS
-+ bool
-+
-+config VALIDATE_FS_PARSER
-+ bool "Validate filesystem parameter description"
-+ help
-+ Enable this to perform validation of the parameter description for a
-+ filesystem when it is registered.
-+
-+if BLOCK
-+
-+config FS_IOMAP
-+ bool
-+
-+source "fs/ext2/Kconfig"
-+source "fs/ext4/Kconfig"
-+source "fs/jbd2/Kconfig"
-+
-+config FS_MBCACHE
-+# Meta block cache for Extended Attributes (ext2/ext3/ext4)
-+ tristate
-+ default y if EXT2_FS=y && EXT2_FS_XATTR
-+ default y if EXT4_FS=y
-+ default m if EXT2_FS_XATTR || EXT4_FS
-+
-+source "fs/reiserfs/Kconfig"
-+source "fs/jfs/Kconfig"
-+
-+source "fs/xfs/Kconfig"
-+source "fs/gfs2/Kconfig"
-+source "fs/ocfs2/Kconfig"
-+source "fs/btrfs/Kconfig"
-+source "fs/nilfs2/Kconfig"
-+source "fs/f2fs/Kconfig"
-+
-+config FS_DAX
-+ bool "Direct Access (DAX) support"
-+ depends on MMU
-+ depends on !(ARM || MIPS || SPARC)
-+ select DEV_PAGEMAP_OPS if (ZONE_DEVICE && !FS_DAX_LIMITED)
-+ select FS_IOMAP
-+ select DAX
-+ help
-+ Direct Access (DAX) can be used on memory-backed block devices.
-+ If the block device supports DAX and the filesystem supports DAX,
-+ then you can avoid using the pagecache to buffer I/Os. Turning
-+ on this option will compile in support for DAX; you will need to
-+ mount the filesystem using the -o dax option.
-+
-+ If you do not have a block device that is capable of using this,
-+ or if unsure, say N. Saying Y will increase the size of the kernel
-+ by about 5kB.
-+
-+config FS_DAX_PMD
-+ bool
-+ default FS_DAX
-+ depends on FS_DAX
-+ depends on ZONE_DEVICE
-+ depends on TRANSPARENT_HUGEPAGE
-+
-+# Selected by DAX drivers that do not expect filesystem DAX to support
-+# get_user_pages() of DAX mappings. I.e. "limited" indicates no support
-+# for fork() of processes with MAP_SHARED mappings or support for
-+# direct-I/O to a DAX mapping.
-+config FS_DAX_LIMITED
-+ bool
-+
-+endif # BLOCK
-+
-+# Posix ACL utility routines
-+#
-+# Note: Posix ACLs can be implemented without these helpers. Never use
-+# this symbol for ifdefs in core code.
-+#
-+config FS_POSIX_ACL
-+ def_bool n
-+
-+config EXPORTFS
-+ tristate
-+
-+config EXPORTFS_BLOCK_OPS
-+ bool "Enable filesystem export operations for block IO"
-+ help
-+ This option enables the export operations for a filesystem to support
-+ external block IO.
-+
-+config FILE_LOCKING
-+ bool "Enable POSIX file locking API" if EXPERT
-+ default y
-+ help
-+ This option enables standard file locking support, required
-+ for filesystems like NFS and for the flock() system
-+ call. Disabling this option saves about 11k.
-+
-+config MANDATORY_FILE_LOCKING
-+ bool "Enable Mandatory file locking"
-+ depends on FILE_LOCKING
-+ default y
-+ help
-+ This option enables files appropriately marked files on appropriely
-+ mounted filesystems to support mandatory locking.
-+
-+ To the best of my knowledge this is dead code that no one cares about.
-+
-+source "fs/crypto/Kconfig"
-+
-+source "fs/verity/Kconfig"
-+
-+source "fs/notify/Kconfig"
-+
-+source "fs/quota/Kconfig"
-+
-+source "fs/autofs/Kconfig"
-+source "fs/fuse/Kconfig"
-+source "fs/overlayfs/Kconfig"
-+
-+menu "Caches"
-+
-+source "fs/fscache/Kconfig"
-+source "fs/cachefiles/Kconfig"
-+
-+endmenu
-+
-+if BLOCK
-+menu "CD-ROM/DVD Filesystems"
-+
-+source "fs/isofs/Kconfig"
-+source "fs/udf/Kconfig"
-+
-+endmenu
-+endif # BLOCK
-+
-+if BLOCK
-+menu "DOS/FAT/NT Filesystems"
-+
-+source "fs/fat/Kconfig"
-+source "fs/ntfs/Kconfig"
-+
-+endmenu
-+endif # BLOCK
-+
-+menu "Pseudo filesystems"
-+
-+source "fs/proc/Kconfig"
-+source "fs/kernfs/Kconfig"
-+source "fs/sysfs/Kconfig"
-+
-+config TMPFS
-+ bool "Tmpfs virtual memory file system support (former shm fs)"
-+ depends on SHMEM
-+ help
-+ Tmpfs is a file system which keeps all files in virtual memory.
-+
-+ Everything in tmpfs is temporary in the sense that no files will be
-+ created on your hard drive. The files live in memory and swap
-+ space. If you unmount a tmpfs instance, everything stored therein is
-+ lost.
-+
-+ See <file:Documentation/filesystems/tmpfs.txt> for details.
-+
-+config TMPFS_POSIX_ACL
-+ bool "Tmpfs POSIX Access Control Lists"
-+ depends on TMPFS
-+ select TMPFS_XATTR
-+ select FS_POSIX_ACL
-+ help
-+ POSIX Access Control Lists (ACLs) support additional access rights
-+ for users and groups beyond the standard owner/group/world scheme,
-+ and this option selects support for ACLs specifically for tmpfs
-+ filesystems.
-+
-+ If you've selected TMPFS, it's possible that you'll also need
-+ this option as there are a number of Linux distros that require
-+ POSIX ACL support under /dev for certain features to work properly.
-+ For example, some distros need this feature for ALSA-related /dev
-+ files for sound to work properly. In short, if you're not sure,
-+ say Y.
-+
-+config TMPFS_XATTR
-+ bool "Tmpfs extended attributes"
-+ depends on TMPFS
-+ default n
-+ help
-+ Extended attributes are name:value pairs associated with inodes by
-+ the kernel or by users (see the attr(5) manual page for details).
-+
-+ Currently this enables support for the trusted.* and
-+ security.* namespaces.
-+
-+ You need this for POSIX ACL support on tmpfs.
-+
-+ If unsure, say N.
-+
-+config HUGETLBFS
-+ bool "HugeTLB file system support"
-+ depends on X86 || IA64 || SPARC64 || (S390 && 64BIT) || \
-+ SYS_SUPPORTS_HUGETLBFS || BROKEN
-+ help
-+ hugetlbfs is a filesystem backing for HugeTLB pages, based on
-+ ramfs. For architectures that support it, say Y here and read
-+ <file:Documentation/admin-guide/mm/hugetlbpage.rst> for details.
-+
-+ If unsure, say N.
-+
-+config HUGETLB_PAGE
-+ def_bool HUGETLBFS
-+
-+config MEMFD_CREATE
-+ def_bool TMPFS || HUGETLBFS
-+
-+config ARCH_HAS_GIGANTIC_PAGE
-+ bool
-+
-+source "fs/configfs/Kconfig"
-+source "fs/efivarfs/Kconfig"
-+
-+endmenu
-+
-+menuconfig MISC_FILESYSTEMS
-+ bool "Miscellaneous filesystems"
-+ default y
-+ ---help---
-+ Say Y here to get to see options for various miscellaneous
-+ filesystems, such as filesystems that came from other
-+ operating systems.
-+
-+ This option alone does not add any kernel code.
-+
-+ If you say N, all options in this submenu will be skipped and
-+ disabled; if unsure, say Y here.
-+
-+if MISC_FILESYSTEMS
-+
-+source "fs/orangefs/Kconfig"
-+source "fs/adfs/Kconfig"
-+source "fs/affs/Kconfig"
-+source "fs/ecryptfs/Kconfig"
-+source "fs/hfs/Kconfig"
-+source "fs/hfsplus/Kconfig"
-+source "fs/befs/Kconfig"
-+source "fs/bfs/Kconfig"
-+source "fs/efs/Kconfig"
-+source "fs/jffs2/Kconfig"
-+# UBIFS File system configuration
-+source "fs/ubifs/Kconfig"
-+source "fs/cramfs/Kconfig"
-+source "fs/squashfs/Kconfig"
-+source "fs/freevxfs/Kconfig"
-+source "fs/minix/Kconfig"
-+source "fs/omfs/Kconfig"
-+source "fs/hpfs/Kconfig"
-+source "fs/qnx4/Kconfig"
-+source "fs/qnx6/Kconfig"
-+source "fs/romfs/Kconfig"
-+source "fs/pstore/Kconfig"
-+source "fs/sysv/Kconfig"
-+source "fs/ufs/Kconfig"
-+source "fs/erofs/Kconfig"
-+
-+endif # MISC_FILESYSTEMS
-+
-+menuconfig NETWORK_FILESYSTEMS
-+ bool "Network File Systems"
-+ default y
-+ depends on NET
-+ ---help---
-+ Say Y here to get to see options for network filesystems and
-+ filesystem-related networking code, such as NFS daemon and
-+ RPCSEC security modules.
-+
-+ This option alone does not add any kernel code.
-+
-+ If you say N, all options in this submenu will be skipped and
-+ disabled; if unsure, say Y here.
-+
-+if NETWORK_FILESYSTEMS
-+
-+source "fs/nfs/Kconfig"
-+source "fs/nfsd/Kconfig"
-+
-+config GRACE_PERIOD
-+ tristate
-+
-+config LOCKD
-+ tristate
-+ depends on FILE_LOCKING
-+ select GRACE_PERIOD
-+
-+config LOCKD_V4
-+ bool
-+ depends on NFSD_V3 || NFS_V3
-+ depends on FILE_LOCKING
-+ default y
-+
-+config NFS_ACL_SUPPORT
-+ tristate
-+ select FS_POSIX_ACL
-+
-+config NFS_COMMON
-+ bool
-+ depends on NFSD || NFS_FS || LOCKD
-+ default y
-+
-+source "net/sunrpc/Kconfig"
-+source "fs/ceph/Kconfig"
-+source "fs/cifs/Kconfig"
-+source "fs/coda/Kconfig"
-+source "fs/afs/Kconfig"
-+source "fs/9p/Kconfig"
-+
-+endif # NETWORK_FILESYSTEMS
-+
-+source "fs/nls/Kconfig"
-+source "fs/dlm/Kconfig"
-+source "fs/unicode/Kconfig"
-+
-+endmenu
diff --git a/fs/Makefile b/fs/Makefile
-index 14231b4cf383..6c03b014a129 100644
+index 505e51166973..4b7b6634e2ae 100644
--- a/fs/Makefile
+++ b/fs/Makefile
-@@ -132,3 +132,4 @@ obj-$(CONFIG_CEPH_FS) += ceph/
- obj-$(CONFIG_PSTORE) += pstore/
- obj-$(CONFIG_EFIVAR_FS) += efivarfs/
+@@ -135,3 +135,4 @@ obj-$(CONFIG_EFIVAR_FS) += efivarfs/
obj-$(CONFIG_EROFS_FS) += erofs/
+ obj-$(CONFIG_VBOXSF_FS) += vboxsf/
+ obj-$(CONFIG_ZONEFS_FS) += zonefs/
+obj-$(CONFIG_YAFFS_FS) += yaffs2/
-diff --git a/fs/Makefile.pre.yaffs b/fs/Makefile.pre.yaffs
-new file mode 100644
-index 000000000000..14231b4cf383
---- /dev/null
-+++ b/fs/Makefile.pre.yaffs
-@@ -0,0 +1,134 @@
-+# SPDX-License-Identifier: GPL-2.0
-+#
-+# Makefile for the Linux filesystems.
-+#
-+# 14 Sep 2000, Christoph Hellwig <hch@infradead.org>
-+# Rewritten to use lists instead of if-statements.
-+#
-+
-+obj-y := open.o read_write.o file_table.o super.o \
-+ char_dev.o stat.o exec.o pipe.o namei.o fcntl.o \
-+ ioctl.o readdir.o select.o dcache.o inode.o \
-+ attr.o bad_inode.o file.o filesystems.o namespace.o \
-+ seq_file.o xattr.o libfs.o fs-writeback.o \
-+ pnode.o splice.o sync.o utimes.o d_path.o \
-+ stack.o fs_struct.o statfs.o fs_pin.o nsfs.o \
-+ fs_types.o fs_context.o fs_parser.o fsopen.o
-+
-+ifeq ($(CONFIG_BLOCK),y)
-+obj-y += buffer.o block_dev.o direct-io.o mpage.o
-+else
-+obj-y += no-block.o
-+endif
-+
-+obj-$(CONFIG_PROC_FS) += proc_namespace.o
-+
-+obj-y += notify/
-+obj-$(CONFIG_EPOLL) += eventpoll.o
-+obj-y += anon_inodes.o
-+obj-$(CONFIG_SIGNALFD) += signalfd.o
-+obj-$(CONFIG_TIMERFD) += timerfd.o
-+obj-$(CONFIG_EVENTFD) += eventfd.o
-+obj-$(CONFIG_USERFAULTFD) += userfaultfd.o
-+obj-$(CONFIG_AIO) += aio.o
-+obj-$(CONFIG_IO_URING) += io_uring.o
-+obj-$(CONFIG_FS_DAX) += dax.o
-+obj-$(CONFIG_FS_ENCRYPTION) += crypto/
-+obj-$(CONFIG_FS_VERITY) += verity/
-+obj-$(CONFIG_FILE_LOCKING) += locks.o
-+obj-$(CONFIG_COMPAT) += compat.o compat_ioctl.o
-+obj-$(CONFIG_BINFMT_AOUT) += binfmt_aout.o
-+obj-$(CONFIG_BINFMT_EM86) += binfmt_em86.o
-+obj-$(CONFIG_BINFMT_MISC) += binfmt_misc.o
-+obj-$(CONFIG_BINFMT_SCRIPT) += binfmt_script.o
-+obj-$(CONFIG_BINFMT_ELF) += binfmt_elf.o
-+obj-$(CONFIG_COMPAT_BINFMT_ELF) += compat_binfmt_elf.o
-+obj-$(CONFIG_BINFMT_ELF_FDPIC) += binfmt_elf_fdpic.o
-+obj-$(CONFIG_BINFMT_FLAT) += binfmt_flat.o
-+
-+obj-$(CONFIG_FS_MBCACHE) += mbcache.o
-+obj-$(CONFIG_FS_POSIX_ACL) += posix_acl.o
-+obj-$(CONFIG_NFS_COMMON) += nfs_common/
-+obj-$(CONFIG_COREDUMP) += coredump.o
-+obj-$(CONFIG_SYSCTL) += drop_caches.o
-+
-+obj-$(CONFIG_FHANDLE) += fhandle.o
-+obj-y += iomap/
-+
-+obj-y += quota/
-+
-+obj-$(CONFIG_PROC_FS) += proc/
-+obj-$(CONFIG_KERNFS) += kernfs/
-+obj-$(CONFIG_SYSFS) += sysfs/
-+obj-$(CONFIG_CONFIGFS_FS) += configfs/
-+obj-y += devpts/
-+
-+obj-$(CONFIG_PROFILING) += dcookies.o
-+obj-$(CONFIG_DLM) += dlm/
-+
-+# Do not add any filesystems before this line
-+obj-$(CONFIG_FSCACHE) += fscache/
-+obj-$(CONFIG_REISERFS_FS) += reiserfs/
-+obj-$(CONFIG_EXT4_FS) += ext4/
-+# We place ext4 before ext2 so that clean ext3 root fs's do NOT mount using the
-+# ext2 driver, which doesn't know about journalling! Explicitly request ext2
-+# by giving the rootfstype= parameter.
-+obj-$(CONFIG_EXT2_FS) += ext2/
-+obj-$(CONFIG_JBD2) += jbd2/
-+obj-$(CONFIG_CRAMFS) += cramfs/
-+obj-$(CONFIG_SQUASHFS) += squashfs/
-+obj-y += ramfs/
-+obj-$(CONFIG_HUGETLBFS) += hugetlbfs/
-+obj-$(CONFIG_CODA_FS) += coda/
-+obj-$(CONFIG_MINIX_FS) += minix/
-+obj-$(CONFIG_FAT_FS) += fat/
-+obj-$(CONFIG_BFS_FS) += bfs/
-+obj-$(CONFIG_ISO9660_FS) += isofs/
-+obj-$(CONFIG_HFSPLUS_FS) += hfsplus/ # Before hfs to find wrapped HFS+
-+obj-$(CONFIG_HFS_FS) += hfs/
-+obj-$(CONFIG_ECRYPT_FS) += ecryptfs/
-+obj-$(CONFIG_VXFS_FS) += freevxfs/
-+obj-$(CONFIG_NFS_FS) += nfs/
-+obj-$(CONFIG_EXPORTFS) += exportfs/
-+obj-$(CONFIG_NFSD) += nfsd/
-+obj-$(CONFIG_LOCKD) += lockd/
-+obj-$(CONFIG_NLS) += nls/
-+obj-$(CONFIG_UNICODE) += unicode/
-+obj-$(CONFIG_SYSV_FS) += sysv/
-+obj-$(CONFIG_CIFS) += cifs/
-+obj-$(CONFIG_HPFS_FS) += hpfs/
-+obj-$(CONFIG_NTFS_FS) += ntfs/
-+obj-$(CONFIG_UFS_FS) += ufs/
-+obj-$(CONFIG_EFS_FS) += efs/
-+obj-$(CONFIG_JFFS2_FS) += jffs2/
-+obj-$(CONFIG_UBIFS_FS) += ubifs/
-+obj-$(CONFIG_AFFS_FS) += affs/
-+obj-$(CONFIG_ROMFS_FS) += romfs/
-+obj-$(CONFIG_QNX4FS_FS) += qnx4/
-+obj-$(CONFIG_QNX6FS_FS) += qnx6/
-+obj-$(CONFIG_AUTOFS_FS) += autofs/
-+obj-$(CONFIG_ADFS_FS) += adfs/
-+obj-$(CONFIG_FUSE_FS) += fuse/
-+obj-$(CONFIG_OVERLAY_FS) += overlayfs/
-+obj-$(CONFIG_ORANGEFS_FS) += orangefs/
-+obj-$(CONFIG_UDF_FS) += udf/
-+obj-$(CONFIG_SUN_OPENPROMFS) += openpromfs/
-+obj-$(CONFIG_OMFS_FS) += omfs/
-+obj-$(CONFIG_JFS_FS) += jfs/
-+obj-$(CONFIG_XFS_FS) += xfs/
-+obj-$(CONFIG_9P_FS) += 9p/
-+obj-$(CONFIG_AFS_FS) += afs/
-+obj-$(CONFIG_NILFS2_FS) += nilfs2/
-+obj-$(CONFIG_BEFS_FS) += befs/
-+obj-$(CONFIG_HOSTFS) += hostfs/
-+obj-$(CONFIG_CACHEFILES) += cachefiles/
-+obj-$(CONFIG_DEBUG_FS) += debugfs/
-+obj-$(CONFIG_TRACING) += tracefs/
-+obj-$(CONFIG_OCFS2_FS) += ocfs2/
-+obj-$(CONFIG_BTRFS_FS) += btrfs/
-+obj-$(CONFIG_GFS2_FS) += gfs2/
-+obj-$(CONFIG_F2FS_FS) += f2fs/
-+obj-$(CONFIG_CEPH_FS) += ceph/
-+obj-$(CONFIG_PSTORE) += pstore/
-+obj-$(CONFIG_EFIVAR_FS) += efivarfs/
-+obj-$(CONFIG_EROFS_FS) += erofs/
diff --git a/fs/yaffs2/Kconfig b/fs/yaffs2/Kconfig
new file mode 100644
index 000000000000..408570fc7a5e
diff --git a/features/yaffs2/yaffs2-v5.6-build-fixups.patch b/features/yaffs2/yaffs2-v5.6-build-fixups.patch
new file mode 100644
index 00000000..375625b4
--- /dev/null
+++ b/features/yaffs2/yaffs2-v5.6-build-fixups.patch
@@ -0,0 +1,50 @@
+From 046fe0a1215486fa81327553215eca8acab9d546 Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <bruce.ashfield@gmail.com>
+Date: Mon, 16 Mar 2020 23:20:57 -0400
+Subject: [PATCH] yaffs2: v5.6 build fixups
+
+Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
+---
+ fs/yaffs2/yaffs_vfs.c | 17 ++++++++---------
+ 1 file changed, 8 insertions(+), 9 deletions(-)
+
+diff --git a/fs/yaffs2/yaffs_vfs.c b/fs/yaffs2/yaffs_vfs.c
+index 4fbd0a42ff3d..598ecd57a0ed 100644
+--- a/fs/yaffs2/yaffs_vfs.c
++++ b/fs/yaffs2/yaffs_vfs.c
+@@ -2059,11 +2059,11 @@ static void yaffs_fill_inode_from_obj(struct inode *inode,
+ #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
+
+ inode->i_rdev = old_decode_dev(obj->yst_rdev);
+- inode->i_atime.tv_sec = (time_t) (obj->yst_atime);
++ inode->i_atime.tv_sec = (time64_t) (obj->yst_atime);
+ inode->i_atime.tv_nsec = 0;
+- inode->i_mtime.tv_sec = (time_t) obj->yst_mtime;
++ inode->i_mtime.tv_sec = (time64_t) obj->yst_mtime;
+ inode->i_mtime.tv_nsec = 0;
+- inode->i_ctime.tv_sec = (time_t) obj->yst_ctime;
++ inode->i_ctime.tv_sec = (time64_t) obj->yst_ctime;
+ inode->i_ctime.tv_nsec = 0;
+ #else
+ inode->i_rdev = obj->yst_rdev;
+@@ -3692,12 +3692,11 @@ static int yaffs_proc_open(struct inode *inode, struct file *file)
+ return single_open(file, yaffs_proc_show, NULL);
+ }
+
+-static struct file_operations procfs_ops = {
+- .owner = THIS_MODULE,
+- .open = yaffs_proc_open,
+- .read = seq_read,
+- .write = yaffs_proc_write,
+- .release = single_release,
++static struct proc_ops procfs_ops = {
++ .proc_open = yaffs_proc_open,
++ .proc_read = seq_read,
++ .proc_write = yaffs_proc_write,
++ .proc_release = single_release,
+ };
+
+ static int yaffs_procfs_init(void)
+--
+2.19.1
+
diff --git a/features/yaffs2/yaffs2-v6.5-fixups.patch b/features/yaffs2/yaffs2-v6.5-fixups.patch
new file mode 100644
index 00000000..0159a00b
--- /dev/null
+++ b/features/yaffs2/yaffs2-v6.5-fixups.patch
@@ -0,0 +1,26 @@
+From e9ca040537fb905d7a55ee9d20ce0414eed5f10e Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <bruce.ashfield@gmail.com>
+Date: Thu, 27 Jul 2023 18:17:32 -0400
+Subject: [PATCH] yaffs2: v6.5 fixups
+
+Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
+---
+ fs/yaffs2/yaffs_vfs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/fs/yaffs2/yaffs_vfs.c b/fs/yaffs2/yaffs_vfs.c
+index 32864c715545..04abeee99ff5 100644
+--- a/fs/yaffs2/yaffs_vfs.c
++++ b/fs/yaffs2/yaffs_vfs.c
+@@ -844,7 +844,7 @@ static const struct file_operations yaffs_file_operations = {
+ .mmap = generic_file_mmap,
+ .flush = yaffs_file_flush,
+ .fsync = yaffs_sync_object,
+- .splice_read = generic_file_splice_read,
++ .splice_read = copy_splice_read,
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
+ .splice_write = iter_file_splice_write,
+ #else
+--
+2.34.1
+
diff --git a/features/yaffs2/yaffs2.scc b/features/yaffs2/yaffs2.scc
index 37628e70..5b131bd7 100644
--- a/features/yaffs2/yaffs2.scc
+++ b/features/yaffs2/yaffs2.scc
@@ -8,3 +8,17 @@ patch yaffs2-fix-memory-leak-in-mount-umount.patch
patch yaffs-Fix-build-failure-by-handling-inode-i_version-.patch
patch yaffs-repair-yaffs_get_mtd_device.patch
patch yaffs-add-strict-check-when-call-yaffs_internal_read.patch
+patch yaffs2-fix-memory-leak-when-proc-yaffs-is-read.patch
+patch yaffs2-v5.6-build-fixups.patch
+patch yaffs-fix-misplaced-variable-declaration.patch
+patch yaffs-include-blkdev.h.patch
+patch 0001-yaffs2-v5.12-build-fixups-not-runtime-tested.patch
+patch yaffs-fix-Wstringop-overread-compile-warning-in-yaff.patch
+patch yaffs-replace-IS_ERR-with-IS_ERR_OR_NULL-to-check-bo.patch
+patch 0001-yaffs2-convert-read_page-readfolio.patch
+patch 0001-yaffs2-replace-bdevname-call-with-sprintf.patch
+patch yaffs2-convert-user_namespace-to-mnt_idmap.patch
+patch yaffs2-Fix-miscalculation-of-devname-buffer-length.patch
+patch yaffs2-v6.5-fixups.patch
+patch 0001-yaffs2-update-VFS-ctime-operations-to-6.6.patch
+patch yaffs-fix-mtime-itime-field-access.patch