From: Pavel Emelianov Date: Sat, 28 Oct 2006 17:38:33 +0000 (-0700) Subject: [PATCH] Fix potential OOPs in blkdev_open() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6a2aae06cc1e87e9712a26a639f6a2f3442e2027;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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) filp->f_flags |= O_LARGEFILE; bdev = bd_acquire(inode); + if (bdev == NULL) + return -ENOMEM; res = do_open(bdev, filp, BD_MUTEX_NORMAL); if (res)