diff options
author | Pavel Emelianov <xemul@openvz.org> | 2006-10-28 13:38:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-28 14:30:52 -0400 |
commit | 6a2aae06cc1e87e9712a26a639f6a2f3442e2027 (patch) | |
tree | 6c9e0f73d39646670c301e19ccd8b33d3aa3a293 /fs | |
parent | f2d0aa5bf8d4f7ae4cb1a7feebf5b1afddd0b9b0 (diff) |
[PATCH] Fix potential OOPs in blkdev_open()
blkdev_open() calls bc_acquire() to get a struct block_device. Since
bc_acquire() may return NULL when system is out of memory an appropriate
check is required.
Signed-off-by: Pavel Emelianov <xemul@openvz.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/block_dev.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index bc8f27cc4483..702b88cbd91d 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -1131,6 +1131,8 @@ static int blkdev_open(struct inode * inode, struct file * filp) | |||
1131 | filp->f_flags |= O_LARGEFILE; | 1131 | filp->f_flags |= O_LARGEFILE; |
1132 | 1132 | ||
1133 | bdev = bd_acquire(inode); | 1133 | bdev = bd_acquire(inode); |
1134 | if (bdev == NULL) | ||
1135 | return -ENOMEM; | ||
1134 | 1136 | ||
1135 | res = do_open(bdev, filp, BD_MUTEX_NORMAL); | 1137 | res = do_open(bdev, filp, BD_MUTEX_NORMAL); |
1136 | if (res) | 1138 | if (res) |