Patchwork [2/2] fs: prevent null pointer dereference for fs-less devices

login
register
mail settings
Submitter Dmitri Monakho
Date March 20, 2013, 12:48 p.m.
Message ID <1363783698-28092-2-git-send-email-dmonakhov@openvz.org>
Download mbox | patch
Permalink /patch/229377/
State Not Applicable
Headers show

Comments

Dmitri Monakho - March 20, 2013, 12:48 p.m.
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 fs/block_dev.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Patch

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 172f849..e13d1df 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -228,7 +228,8 @@  struct super_block *freeze_bdev(struct block_device *bdev)
 		 * thaw_bdev drops it.
 		 */
 		sb = get_super(bdev);
-		drop_super(sb);
+		if (sb)
+			drop_super(sb);
 		mutex_unlock(&bdev->bd_fsfreeze_mutex);
 		return sb;
 	}