Skip to content

Commit 4ad5c92

Browse files
fs/ntfs3: Allow repeated call to ntfs3_put_sbi
Signed-off-by: Konstantin Komarov <[email protected]>
1 parent 3f2f09f commit 4ad5c92

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

fs/ntfs3/bitmap.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ void wnd_close(struct wnd_bitmap *wnd)
125125
struct rb_node *node, *next;
126126

127127
kfree(wnd->free_bits);
128+
wnd->free_bits = NULL;
128129
run_close(&wnd->run);
129130

130131
node = rb_first(&wnd->start_tree);

fs/ntfs3/super.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -576,20 +576,30 @@ static noinline void ntfs3_put_sbi(struct ntfs_sb_info *sbi)
576576
wnd_close(&sbi->mft.bitmap);
577577
wnd_close(&sbi->used.bitmap);
578578

579-
if (sbi->mft.ni)
579+
if (sbi->mft.ni) {
580580
iput(&sbi->mft.ni->vfs_inode);
581+
sbi->mft.ni = NULL;
582+
}
581583

582-
if (sbi->security.ni)
584+
if (sbi->security.ni) {
583585
iput(&sbi->security.ni->vfs_inode);
586+
sbi->security.ni = NULL;
587+
}
584588

585-
if (sbi->reparse.ni)
589+
if (sbi->reparse.ni) {
586590
iput(&sbi->reparse.ni->vfs_inode);
591+
sbi->reparse.ni = NULL;
592+
}
587593

588-
if (sbi->objid.ni)
594+
if (sbi->objid.ni) {
589595
iput(&sbi->objid.ni->vfs_inode);
596+
sbi->objid.ni = NULL;
597+
}
590598

591-
if (sbi->volume.ni)
599+
if (sbi->volume.ni) {
592600
iput(&sbi->volume.ni->vfs_inode);
601+
sbi->volume.ni = NULL;
602+
}
593603

594604
ntfs_update_mftmirr(sbi, 0);
595605

@@ -1577,6 +1587,7 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
15771587
iput(inode);
15781588
out:
15791589
kfree(boot2);
1590+
ntfs3_put_sbi(sbi);
15801591
return err;
15811592
}
15821593

0 commit comments

Comments
 (0)