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

Submitted by Dmitri Monakho on March 20, 2013, 12:48 p.m.

Details

Message ID 1363783698-28092-2-git-send-email-dmonakhov@openvz.org
State Not Applicable, archived
Headers show

Commit Message

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 hide | download patch | download mbox

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;
 	}