Skip to content

Commit 1b13a70

Browse files
dTenebraeakpm00
authored andcommitted
fs: ocfs2: check status values
Test return values before overwriting. Found by Linux Verification Center (linuxtesting.org) with SVACE. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Artem Chernyshev <[email protected]> Reviewed-by: Joseph Qi <[email protected]> Cc: Mark Fasheh <[email protected]> Cc: Joel Becker <[email protected]> Cc: Junxiao Bi <[email protected]> Cc: Changwei Ge <[email protected]> Cc: Gang He <[email protected]> Cc: Jun Piao <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 6e79b37 commit 1b13a70

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

fs/ocfs2/namei.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,6 +1597,10 @@ static int ocfs2_rename(struct mnt_idmap *idmap,
15971597
if (update_dot_dot) {
15981598
status = ocfs2_update_entry(old_inode, handle,
15991599
&old_inode_dot_dot_res, new_dir);
1600+
if (status < 0) {
1601+
mlog_errno(status);
1602+
goto bail;
1603+
}
16001604
drop_nlink(old_dir);
16011605
if (new_inode) {
16021606
drop_nlink(new_inode);
@@ -1636,6 +1640,10 @@ static int ocfs2_rename(struct mnt_idmap *idmap,
16361640
INODE_CACHE(old_dir),
16371641
old_dir_bh,
16381642
OCFS2_JOURNAL_ACCESS_WRITE);
1643+
if (status < 0) {
1644+
mlog_errno(status);
1645+
goto bail;
1646+
}
16391647
fe = (struct ocfs2_dinode *) old_dir_bh->b_data;
16401648
ocfs2_set_links_count(fe, old_dir->i_nlink);
16411649
ocfs2_journal_dirty(handle, old_dir_bh);

fs/ocfs2/quota_local.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,6 +1240,10 @@ int ocfs2_create_local_dquot(struct dquot *dquot)
12401240
&od->dq_local_phys_blk,
12411241
&pcount,
12421242
NULL);
1243+
if (status < 0) {
1244+
mlog_errno(status);
1245+
goto out;
1246+
}
12431247

12441248
/* Initialize dquot structure on disk */
12451249
status = ocfs2_local_write_dquot(dquot);

0 commit comments

Comments
 (0)