Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 6951abe

Browse files
committed
Merge tag 'jffs2-for-linus-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs
Pull jffs2 updates from Richard Weinberger: - Fix illegal memory access in jffs2_free_inode() - Kernel-doc fixes - print symbolic error names * tag 'jffs2-for-linus-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs: jffs2: Fix potential illegal address access in jffs2_free_inode jffs2: Simplify the allocation of slab caches jffs2: nodemgmt: fix kernel-doc comments jffs2: print symbolic error name instead of error code
2 parents 2313022 + af9a873 commit 6951abe

File tree

4 files changed

+26
-35
lines changed

4 files changed

+26
-35
lines changed

fs/jffs2/background.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ int jffs2_start_garbage_collect_thread(struct jffs2_sb_info *c)
4444

4545
tsk = kthread_run(jffs2_garbage_collect_thread, c, "jffs2_gcd_mtd%d", c->mtd->index);
4646
if (IS_ERR(tsk)) {
47-
pr_warn("fork failed for JFFS2 garbage collect thread: %ld\n",
48-
-PTR_ERR(tsk));
47+
pr_warn("fork failed for JFFS2 garbage collect thread: %pe\n",
48+
tsk);
4949
complete(&c->gc_thread_exit);
5050
ret = PTR_ERR(tsk);
5151
} else {

fs/jffs2/malloc.c

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,19 @@ static struct kmem_cache *xattr_ref_cache;
3333

3434
int __init jffs2_create_slab_caches(void)
3535
{
36-
full_dnode_slab = kmem_cache_create("jffs2_full_dnode",
37-
sizeof(struct jffs2_full_dnode),
38-
0, 0, NULL);
36+
full_dnode_slab = KMEM_CACHE(jffs2_full_dnode, 0);
3937
if (!full_dnode_slab)
4038
goto err;
4139

42-
raw_dirent_slab = kmem_cache_create("jffs2_raw_dirent",
43-
sizeof(struct jffs2_raw_dirent),
44-
0, SLAB_HWCACHE_ALIGN, NULL);
40+
raw_dirent_slab = KMEM_CACHE(jffs2_raw_dirent, SLAB_HWCACHE_ALIGN);
4541
if (!raw_dirent_slab)
4642
goto err;
4743

48-
raw_inode_slab = kmem_cache_create("jffs2_raw_inode",
49-
sizeof(struct jffs2_raw_inode),
50-
0, SLAB_HWCACHE_ALIGN, NULL);
44+
raw_inode_slab = KMEM_CACHE(jffs2_raw_inode, SLAB_HWCACHE_ALIGN);
5145
if (!raw_inode_slab)
5246
goto err;
5347

54-
tmp_dnode_info_slab = kmem_cache_create("jffs2_tmp_dnode",
55-
sizeof(struct jffs2_tmp_dnode_info),
56-
0, 0, NULL);
48+
tmp_dnode_info_slab = KMEM_CACHE(jffs2_tmp_dnode_info, 0);
5749
if (!tmp_dnode_info_slab)
5850
goto err;
5951

@@ -63,28 +55,20 @@ int __init jffs2_create_slab_caches(void)
6355
if (!raw_node_ref_slab)
6456
goto err;
6557

66-
node_frag_slab = kmem_cache_create("jffs2_node_frag",
67-
sizeof(struct jffs2_node_frag),
68-
0, 0, NULL);
58+
node_frag_slab = KMEM_CACHE(jffs2_node_frag, 0);
6959
if (!node_frag_slab)
7060
goto err;
7161

72-
inode_cache_slab = kmem_cache_create("jffs2_inode_cache",
73-
sizeof(struct jffs2_inode_cache),
74-
0, 0, NULL);
62+
inode_cache_slab = KMEM_CACHE(jffs2_inode_cache, 0);
7563
if (!inode_cache_slab)
7664
goto err;
7765

7866
#ifdef CONFIG_JFFS2_FS_XATTR
79-
xattr_datum_cache = kmem_cache_create("jffs2_xattr_datum",
80-
sizeof(struct jffs2_xattr_datum),
81-
0, 0, NULL);
67+
xattr_datum_cache = KMEM_CACHE(jffs2_xattr_datum, 0);
8268
if (!xattr_datum_cache)
8369
goto err;
8470

85-
xattr_ref_cache = kmem_cache_create("jffs2_xattr_ref",
86-
sizeof(struct jffs2_xattr_ref),
87-
0, 0, NULL);
71+
xattr_ref_cache = KMEM_CACHE(jffs2_xattr_ref, 0);
8872
if (!xattr_ref_cache)
8973
goto err;
9074
#endif

fs/jffs2/nodemgmt.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,28 +49,31 @@ static int jffs2_rp_can_write(struct jffs2_sb_info *c)
4949
return 0;
5050
}
5151

52+
static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
53+
uint32_t *len, uint32_t sumsize);
54+
5255
/**
5356
* jffs2_reserve_space - request physical space to write nodes to flash
5457
* @c: superblock info
5558
* @minsize: Minimum acceptable size of allocation
5659
* @len: Returned value of allocation length
5760
* @prio: Allocation type - ALLOC_{NORMAL,DELETION}
61+
* @sumsize: summary size requested or JFFS2_SUMMARY_NOSUM_SIZE for no summary
62+
*
63+
* Requests a block of physical space on the flash.
5864
*
59-
* Requests a block of physical space on the flash. Returns zero for success
60-
* and puts 'len' into the appropriate place, or returns -ENOSPC or other
61-
* error if appropriate. Doesn't return len since that's
65+
* Returns: %0 for success and puts 'len' into the appropriate place,
66+
* or returns -ENOSPC or other error if appropriate.
67+
* Doesn't return len since that's already returned in @len.
6268
*
63-
* If it returns zero, jffs2_reserve_space() also downs the per-filesystem
69+
* If it returns %0, jffs2_reserve_space() also downs the per-filesystem
6470
* allocation semaphore, to prevent more than one allocation from being
65-
* active at any time. The semaphore is later released by jffs2_commit_allocation()
71+
* active at any time. The semaphore is later released by jffs2_commit_allocation().
6672
*
6773
* jffs2_reserve_space() may trigger garbage collection in order to make room
6874
* for the requested allocation.
6975
*/
7076

71-
static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
72-
uint32_t *len, uint32_t sumsize);
73-
7477
int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
7578
uint32_t *len, int prio, uint32_t sumsize)
7679
{
@@ -488,13 +491,16 @@ static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
488491
/**
489492
* jffs2_add_physical_node_ref - add a physical node reference to the list
490493
* @c: superblock info
491-
* @new: new node reference to add
494+
* @ofs: offset in the block
492495
* @len: length of this physical node
496+
* @ic: inode cache pointer
493497
*
494498
* Should only be used to report nodes for which space has been allocated
495499
* by jffs2_reserve_space.
496500
*
497501
* Must be called with the alloc_sem held.
502+
*
503+
* Returns: pointer to new node on success or -errno code on error
498504
*/
499505

500506
struct jffs2_raw_node_ref *jffs2_add_physical_node_ref(struct jffs2_sb_info *c,

fs/jffs2/super.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ static void jffs2_i_init_once(void *foo)
5858
struct jffs2_inode_info *f = foo;
5959

6060
mutex_init(&f->sem);
61+
f->target = NULL;
6162
inode_init_once(&f->vfs_inode);
6263
}
6364

0 commit comments

Comments
 (0)