Commit f97b870e authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'upstream-4.3-rc4' of git://git.infradead.org/linux-ubifs

Pull UBI/UBIFS fixes from Richard Weinberger:
 "This contains three bug fixes for both UBI and UBIFS"

* tag 'upstream-4.3-rc4' of git://git.infradead.org/linux-ubifs:
  UBI: return ENOSPC if no enough space available
  UBI: Validate data_size
  UBIFS: Kill unneeded locking in ubifs_init_security
parents 9522f476 7c7feb2e
...@@ -926,6 +926,11 @@ static int validate_vid_hdr(const struct ubi_device *ubi, ...@@ -926,6 +926,11 @@ static int validate_vid_hdr(const struct ubi_device *ubi,
goto bad; goto bad;
} }
if (data_size > ubi->leb_size) {
ubi_err(ubi, "bad data_size");
goto bad;
}
if (vol_type == UBI_VID_STATIC) { if (vol_type == UBI_VID_STATIC) {
/* /*
* Although from high-level point of view static volumes may * Although from high-level point of view static volumes may
......
...@@ -649,6 +649,7 @@ static int init_volumes(struct ubi_device *ubi, ...@@ -649,6 +649,7 @@ static int init_volumes(struct ubi_device *ubi,
if (ubi->corr_peb_count) if (ubi->corr_peb_count)
ubi_err(ubi, "%d PEBs are corrupted and not used", ubi_err(ubi, "%d PEBs are corrupted and not used",
ubi->corr_peb_count); ubi->corr_peb_count);
return -ENOSPC;
} }
ubi->rsvd_pebs += reserved_pebs; ubi->rsvd_pebs += reserved_pebs;
ubi->avail_pebs -= reserved_pebs; ubi->avail_pebs -= reserved_pebs;
......
...@@ -1601,6 +1601,7 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai) ...@@ -1601,6 +1601,7 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai)
if (ubi->corr_peb_count) if (ubi->corr_peb_count)
ubi_err(ubi, "%d PEBs are corrupted and not used", ubi_err(ubi, "%d PEBs are corrupted and not used",
ubi->corr_peb_count); ubi->corr_peb_count);
err = -ENOSPC;
goto out_free; goto out_free;
} }
ubi->avail_pebs -= reserved_pebs; ubi->avail_pebs -= reserved_pebs;
......
...@@ -652,11 +652,8 @@ int ubifs_init_security(struct inode *dentry, struct inode *inode, ...@@ -652,11 +652,8 @@ int ubifs_init_security(struct inode *dentry, struct inode *inode,
{ {
int err; int err;
mutex_lock(&inode->i_mutex);
err = security_inode_init_security(inode, dentry, qstr, err = security_inode_init_security(inode, dentry, qstr,
&init_xattrs, 0); &init_xattrs, 0);
mutex_unlock(&inode->i_mutex);
if (err) { if (err) {
struct ubifs_info *c = dentry->i_sb->s_fs_info; struct ubifs_info *c = dentry->i_sb->s_fs_info;
ubifs_err(c, "cannot initialize security for inode %lu, error %d", ubifs_err(c, "cannot initialize security for inode %lu, error %d",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment