Commit 04b43ea3 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'ubifs-for-linus-6.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs

Pull JFFS2, UBI and UBIFS updates from Richard Weinberger:
 "JFFS2:
   - Bug fix for rtime compression
   - Various cleanups

  UBI:
   - Cleanups for fastmap and wear leveling

  UBIFS:
   - Add support for FS_IOC_GETFSSYSFSPATH
   - Remove dead ioctl code
   - Fix UAF in ubifs_tnc_end_commit()"

* tag 'ubifs-for-linus-6.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs: (25 commits)
  ubifs: Fix uninitialized use of err in ubifs_jnl_write_inode()
  jffs2: Prevent rtime decompress memory corruption
  jffs2: remove redundant check on outpos > pos
  fs: jffs2: Fix inconsistent indentation in jffs2_mark_node_obsolete
  jffs2: Correct some typos in comments
  jffs2: fix use of uninitialized variable
  jffs2: Use str_yes_no() helper function
  mtd: ubi: remove redundant check on bytes_left at end of function
  mtd: ubi: fix unreleased fwnode_handle in find_volume_fwnode()
  ubifs: authentication: Fix use-after-free in ubifs_tnc_end_commit
  ubi: fastmap: Fix duplicate slab cache names while attaching
  ubifs: xattr: remove unused anonymous enum
  ubifs: Reduce kfree() calls in ubifs_purge_xattrs()
  ubifs: Call iput(xino) only once in ubifs_purge_xattrs()
  ubi: wl: Close down wear-leveling before nand is suspended
  mtd: ubi: Rmove unused declaration in header file
  ubifs: Correct the total block count by deducting journal reservation
  ubifs: Convert to use ERR_CAST()
  ubifs: add support for FS_IOC_GETFSSYSFSPATH
  ubifs: remove unused ioctl flags GETFLAGS/SETFLAGS
  ...
parents e864effa bcdcb115
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -1447,7 +1447,7 @@ static int scan_all(struct ubi_device *ubi, struct ubi_attach_info *ai,
	return err;
}

static struct ubi_attach_info *alloc_ai(void)
static struct ubi_attach_info *alloc_ai(const char *slab_name)
{
	struct ubi_attach_info *ai;

@@ -1461,7 +1461,7 @@ static struct ubi_attach_info *alloc_ai(void)
	INIT_LIST_HEAD(&ai->alien);
	INIT_LIST_HEAD(&ai->fastmap);
	ai->volumes = RB_ROOT;
	ai->aeb_slab_cache = kmem_cache_create("ubi_aeb_slab_cache",
	ai->aeb_slab_cache = kmem_cache_create(slab_name,
					       sizeof(struct ubi_ainf_peb),
					       0, 0, NULL);
	if (!ai->aeb_slab_cache) {
@@ -1491,7 +1491,7 @@ static int scan_fast(struct ubi_device *ubi, struct ubi_attach_info **ai)

	err = -ENOMEM;

	scan_ai = alloc_ai();
	scan_ai = alloc_ai("ubi_aeb_slab_cache_fastmap");
	if (!scan_ai)
		goto out;

@@ -1557,7 +1557,7 @@ int ubi_attach(struct ubi_device *ubi, int force_scan)
	int err;
	struct ubi_attach_info *ai;

	ai = alloc_ai();
	ai = alloc_ai("ubi_aeb_slab_cache");
	if (!ai)
		return -ENOMEM;

@@ -1575,7 +1575,7 @@ int ubi_attach(struct ubi_device *ubi, int force_scan)
		if (err > 0 || mtd_is_eccerr(err)) {
			if (err != UBI_NO_FASTMAP) {
				destroy_ai(ai);
				ai = alloc_ai();
				ai = alloc_ai("ubi_aeb_slab_cache");
				if (!ai)
					return -ENOMEM;

@@ -1614,7 +1614,7 @@ int ubi_attach(struct ubi_device *ubi, int force_scan)
	if (ubi->fm && ubi_dbg_chk_fastmap(ubi)) {
		struct ubi_attach_info *scan_ai;

		scan_ai = alloc_ai();
		scan_ai = alloc_ai("ubi_aeb_slab_cache_dbg_chk_fastmap");
		if (!scan_ai) {
			err = -ENOMEM;
			goto out_wl;
+16 −3
Original line number Diff line number Diff line
@@ -346,14 +346,27 @@ int ubi_wl_get_peb(struct ubi_device *ubi)
 * WL sub-system.
 *
 * @ubi: UBI device description object
 * @need_fill: whether to fill wear-leveling pool when no PEBs are found
 */
static struct ubi_wl_entry *next_peb_for_wl(struct ubi_device *ubi)
static struct ubi_wl_entry *next_peb_for_wl(struct ubi_device *ubi,
					    bool need_fill)
{
	struct ubi_fm_pool *pool = &ubi->fm_wl_pool;
	int pnum;

	if (pool->used == pool->size)
	if (pool->used == pool->size) {
		if (need_fill && !ubi->fm_work_scheduled) {
			/*
			 * We cannot update the fastmap here because this
			 * function is called in atomic context.
			 * Let's fail here and refill/update it as soon as
			 * possible.
			 */
			ubi->fm_work_scheduled = 1;
			schedule_work(&ubi->fm_work);
		}
		return NULL;
	}

	pnum = pool->pebs[pool->used];
	return ubi->lookuptbl[pnum];
@@ -375,7 +388,7 @@ static bool need_wear_leveling(struct ubi_device *ubi)
	if (!ubi->used.rb_node)
		return false;

	e = next_peb_for_wl(ubi);
	e = next_peb_for_wl(ubi, false);
	if (!e) {
		if (!ubi->free.rb_node)
			return false;
+1 −1
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ static int ubi_nvmem_reg_read(void *priv, unsigned int from,
	if (err)
		return err;

	return bytes_left == 0 ? 0 : -EIO;
	return 0;
}

static int ubi_nvmem_add(struct ubi_volume_info *vi)
+2 −1
Original line number Diff line number Diff line
@@ -549,6 +549,7 @@ struct ubi_debug_info {
 * @peb_buf: a buffer of PEB size used for different purposes
 * @buf_mutex: protects @peb_buf
 * @ckvol_mutex: serializes static volume checking when opening
 * @wl_reboot_notifier: close all wear-leveling work before reboot
 *
 * @dbg: debugging information for this UBI device
 */
@@ -651,6 +652,7 @@ struct ubi_device {
	void *peb_buf;
	struct mutex buf_mutex;
	struct mutex ckvol_mutex;
	struct notifier_block wl_reboot_notifier;

	struct ubi_debug_info dbg;
};
@@ -831,7 +833,6 @@ void ubi_remove_av(struct ubi_attach_info *ai, struct ubi_ainf_volume *av);
struct ubi_ainf_peb *ubi_early_get_peb(struct ubi_device *ubi,
				       struct ubi_attach_info *ai);
int ubi_attach(struct ubi_device *ubi, int force_scan);
void ubi_destroy_ai(struct ubi_attach_info *ai);

/* vtbl.c */
int ubi_change_vtbl_record(struct ubi_device *ubi, int idx,
+2 −0
Original line number Diff line number Diff line
@@ -143,8 +143,10 @@ static struct fwnode_handle *find_volume_fwnode(struct ubi_volume *vol)
		    vol->vol_id != volid)
			continue;

		fwnode_handle_put(fw_vols);
		return fw_vol;
	}
	fwnode_handle_put(fw_vols);

	return NULL;
}
Loading