Merge branch 'linux-next' of git://git.infradead.org/ubi-2.6
* 'linux-next' of git://git.infradead.org/ubi-2.6: UBI: fix memory leak in update path UBI: add more checks to chdev open UBI: initialise update marker
This commit is contained in:
commit
a8d0b6666e
3 changed files with 10 additions and 9 deletions
|
@ -291,8 +291,7 @@ EXPORT_SYMBOL_GPL(ubi_open_volume_nm);
|
||||||
*/
|
*/
|
||||||
struct ubi_volume_desc *ubi_open_volume_path(const char *pathname, int mode)
|
struct ubi_volume_desc *ubi_open_volume_path(const char *pathname, int mode)
|
||||||
{
|
{
|
||||||
int error, ubi_num, vol_id;
|
int error, ubi_num, vol_id, mod;
|
||||||
struct ubi_volume_desc *ret;
|
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
struct path path;
|
struct path path;
|
||||||
|
|
||||||
|
@ -306,16 +305,16 @@ struct ubi_volume_desc *ubi_open_volume_path(const char *pathname, int mode)
|
||||||
return ERR_PTR(error);
|
return ERR_PTR(error);
|
||||||
|
|
||||||
inode = path.dentry->d_inode;
|
inode = path.dentry->d_inode;
|
||||||
|
mod = inode->i_mode;
|
||||||
ubi_num = ubi_major2num(imajor(inode));
|
ubi_num = ubi_major2num(imajor(inode));
|
||||||
vol_id = iminor(inode) - 1;
|
vol_id = iminor(inode) - 1;
|
||||||
|
|
||||||
if (vol_id >= 0 && ubi_num >= 0)
|
|
||||||
ret = ubi_open_volume(ubi_num, vol_id, mode);
|
|
||||||
else
|
|
||||||
ret = ERR_PTR(-ENODEV);
|
|
||||||
|
|
||||||
path_put(&path);
|
path_put(&path);
|
||||||
return ret;
|
|
||||||
|
if (!S_ISCHR(mod))
|
||||||
|
return ERR_PTR(-EINVAL);
|
||||||
|
if (vol_id >= 0 && ubi_num >= 0)
|
||||||
|
return ubi_open_volume(ubi_num, vol_id, mode);
|
||||||
|
return ERR_PTR(-ENODEV);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(ubi_open_volume_path);
|
EXPORT_SYMBOL_GPL(ubi_open_volume_path);
|
||||||
|
|
||||||
|
|
|
@ -155,6 +155,7 @@ int ubi_start_update(struct ubi_device *ubi, struct ubi_volume *vol,
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
vol->updating = 0;
|
vol->updating = 0;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
vol->upd_buf = vmalloc(ubi->leb_size);
|
vol->upd_buf = vmalloc(ubi->leb_size);
|
||||||
|
|
|
@ -566,6 +566,7 @@ static int init_volumes(struct ubi_device *ubi, const struct ubi_scan_info *si,
|
||||||
vol->reserved_pebs = be32_to_cpu(vtbl[i].reserved_pebs);
|
vol->reserved_pebs = be32_to_cpu(vtbl[i].reserved_pebs);
|
||||||
vol->alignment = be32_to_cpu(vtbl[i].alignment);
|
vol->alignment = be32_to_cpu(vtbl[i].alignment);
|
||||||
vol->data_pad = be32_to_cpu(vtbl[i].data_pad);
|
vol->data_pad = be32_to_cpu(vtbl[i].data_pad);
|
||||||
|
vol->upd_marker = vtbl[i].upd_marker;
|
||||||
vol->vol_type = vtbl[i].vol_type == UBI_VID_DYNAMIC ?
|
vol->vol_type = vtbl[i].vol_type == UBI_VID_DYNAMIC ?
|
||||||
UBI_DYNAMIC_VOLUME : UBI_STATIC_VOLUME;
|
UBI_DYNAMIC_VOLUME : UBI_STATIC_VOLUME;
|
||||||
vol->name_len = be16_to_cpu(vtbl[i].name_len);
|
vol->name_len = be16_to_cpu(vtbl[i].name_len);
|
||||||
|
|
Reference in a new issue