mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 04:31:50 +00:00
This pull requests contains fixes for issues in both UBI and UBIFS:
- Fallout from the merge window, refactoring UBI code introduced some issues. - Fixes for an UBIFS readdir bug which can cause getdents() to busy loop for ever and a bug in the UBIFS xattr code. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABAgAGBQJYDMa5AAoJEEtJtSqsAOnWxKgP+wT4lCM9gP3/1FywhrJRxA4Z vH9YYWP6vjdYhZP8tt3RVIrJ/BxPMDx8+7IkZBzxVRQcnvaoaGibgEsfkGmTngyW 2rFVqDuwFIDIWLvNrKW26ep4p1Ek8yZhIIcW4upHKtnaJpZwvn6BmwxRep1JeLuc yZjGIJtejRbvuuaVwEBu+Et3Rlflg5/D6oPWOJfYqwjJjxihkb4hfAgzJkLeBK3Q Qw65S8FxKDPa7vAj2+jor3Cq0ETg3b2cQR4+UnGmDat9RVMquS3dDTBzBn6TNZx+ xw2aiOPi0JPMeEnJP+Z61/moeQhlLddZsEVdRQ5Ud6LcOeq6Rg7v5J+POkQ0hhIy DUfxHjnsmB4P9XqtaGGr74d8trjIm15cL6yAVKG/jMnb11oCWVDVyr0FmsXSmO7I O+b6P9hM7C3o+eAETdCLhd8Jg5isOm27WWQ2Bqq2FOjY9EmvTIFl+Imp+++3YHA6 R6jlFfMbju0gCfyPZdDPmTc91CPtWdTze43bpIdl2N3L2/efG2I0xFjjlr+WWEkL htYQr+b3vjO+moTl8KvT7pmvVNPUtNljOZsHHJjrsBLvuMDb0+7X1Wy860klTOPp B7NntTqwBUF6HtPpeebHvEfBiTruyspGZfokvkud6rqPuO1DbsJrVNY7Lwh9XA8M iGn9LwwlNjQYiyZNx0GT =Gjo0 -----END PGP SIGNATURE----- Merge tag 'upstream-4.9-rc2' of git://git.infradead.org/linux-ubifs Pull UBI[FS] fixes from Richard Weinberger: "This contains fixes for issues in both UBI and UBIFS: - Fallout from the merge window, refactoring UBI code introduced some issues. - Fixes for an UBIFS readdir bug which can cause getdents() to busy loop for ever and a bug in the UBIFS xattr code" * tag 'upstream-4.9-rc2' of git://git.infradead.org/linux-ubifs: ubifs: Abort readdir upon error UBI: Fix crash in try_recover_peb() ubi: fix swapped arguments to call to ubi_alloc_aeb ubifs: Fix xattr_names length in exit paths ubifs: Rename ubifs_rename2
This commit is contained in:
commit
5ff93abc7a
@ -741,6 +741,7 @@ static int try_recover_peb(struct ubi_volume *vol, int pnum, int lnum,
|
||||
goto out_put;
|
||||
}
|
||||
|
||||
vid_hdr = ubi_get_vid_hdr(vidb);
|
||||
ubi_assert(vid_hdr->vol_type == UBI_VID_DYNAMIC);
|
||||
|
||||
mutex_lock(&ubi->buf_mutex);
|
||||
|
@ -287,7 +287,7 @@ static int update_vol(struct ubi_device *ubi, struct ubi_attach_info *ai,
|
||||
|
||||
/* new_aeb is newer */
|
||||
if (cmp_res & 1) {
|
||||
victim = ubi_alloc_aeb(ai, aeb->ec, aeb->pnum);
|
||||
victim = ubi_alloc_aeb(ai, aeb->pnum, aeb->ec);
|
||||
if (!victim)
|
||||
return -ENOMEM;
|
||||
|
||||
|
@ -439,7 +439,7 @@ static unsigned int vfs_dent_type(uint8_t type)
|
||||
*/
|
||||
static int ubifs_readdir(struct file *file, struct dir_context *ctx)
|
||||
{
|
||||
int err;
|
||||
int err = 0;
|
||||
struct qstr nm;
|
||||
union ubifs_key key;
|
||||
struct ubifs_dent_node *dent;
|
||||
@ -541,14 +541,12 @@ out:
|
||||
kfree(file->private_data);
|
||||
file->private_data = NULL;
|
||||
|
||||
if (err != -ENOENT) {
|
||||
if (err != -ENOENT)
|
||||
ubifs_err(c, "cannot find next direntry, error %d", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
/* 2 is a special value indicating that there are no more direntries */
|
||||
ctx->pos = 2;
|
||||
return 0;
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Free saved readdir() state when the directory is closed */
|
||||
@ -1060,9 +1058,9 @@ static void unlock_4_inodes(struct inode *inode1, struct inode *inode2,
|
||||
mutex_unlock(&ubifs_inode(inode1)->ui_mutex);
|
||||
}
|
||||
|
||||
static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
struct inode *new_dir, struct dentry *new_dentry,
|
||||
unsigned int flags)
|
||||
static int do_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
struct inode *new_dir, struct dentry *new_dentry,
|
||||
unsigned int flags)
|
||||
{
|
||||
struct ubifs_info *c = old_dir->i_sb->s_fs_info;
|
||||
struct inode *old_inode = d_inode(old_dentry);
|
||||
@ -1323,7 +1321,7 @@ static int ubifs_xrename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
return err;
|
||||
}
|
||||
|
||||
static int ubifs_rename2(struct inode *old_dir, struct dentry *old_dentry,
|
||||
static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
struct inode *new_dir, struct dentry *new_dentry,
|
||||
unsigned int flags)
|
||||
{
|
||||
@ -1336,7 +1334,7 @@ static int ubifs_rename2(struct inode *old_dir, struct dentry *old_dentry,
|
||||
if (flags & RENAME_EXCHANGE)
|
||||
return ubifs_xrename(old_dir, old_dentry, new_dir, new_dentry);
|
||||
|
||||
return ubifs_rename(old_dir, old_dentry, new_dir, new_dentry, flags);
|
||||
return do_rename(old_dir, old_dentry, new_dir, new_dentry, flags);
|
||||
}
|
||||
|
||||
int ubifs_getattr(struct vfsmount *mnt, struct dentry *dentry,
|
||||
@ -1387,7 +1385,7 @@ const struct inode_operations ubifs_dir_inode_operations = {
|
||||
.mkdir = ubifs_mkdir,
|
||||
.rmdir = ubifs_rmdir,
|
||||
.mknod = ubifs_mknod,
|
||||
.rename = ubifs_rename2,
|
||||
.rename = ubifs_rename,
|
||||
.setattr = ubifs_setattr,
|
||||
.getattr = ubifs_getattr,
|
||||
.listxattr = ubifs_listxattr,
|
||||
|
@ -172,6 +172,7 @@ out_cancel:
|
||||
host_ui->xattr_cnt -= 1;
|
||||
host_ui->xattr_size -= CALC_DENT_SIZE(nm->len);
|
||||
host_ui->xattr_size -= CALC_XATTR_BYTES(size);
|
||||
host_ui->xattr_names -= nm->len;
|
||||
mutex_unlock(&host_ui->ui_mutex);
|
||||
out_free:
|
||||
make_bad_inode(inode);
|
||||
@ -478,6 +479,7 @@ out_cancel:
|
||||
host_ui->xattr_cnt += 1;
|
||||
host_ui->xattr_size += CALC_DENT_SIZE(nm->len);
|
||||
host_ui->xattr_size += CALC_XATTR_BYTES(ui->data_len);
|
||||
host_ui->xattr_names += nm->len;
|
||||
mutex_unlock(&host_ui->ui_mutex);
|
||||
ubifs_release_budget(c, &req);
|
||||
make_bad_inode(inode);
|
||||
|
Loading…
Reference in New Issue
Block a user