[Devel] [PATCH RHEL7 COMMIT] ext4: fix file allocation check in ext4_open_balloon

Konstantin Khorenko khorenko at virtuozzo.com
Thu Nov 12 01:37:53 PST 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2.vz7.9.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.9.9
------>
commit 342e51a37012efe62b9e8fb01e6a72017639d58e
Author: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
Date:   Thu Nov 12 13:37:53 2015 +0400

    ext4: fix file allocation check in ext4_open_balloon
    
    Function alloc_file() doesn't return NULL (unlike in 2.6.32-x).
    It returns error pointer. File structure allocation may fail before
    file->f_ep_links is initialized, which may lead to crash in
    eventpoll_release_file().
    
    https://jira.sw.ru/browse/PSBM-41222
    
    Fixes: 9cea7449aa589f325fff378e7256a3c2fc8f048d
    "ext4: Provide a balloon nipple for management"
    
    Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
---
 fs/ext4/ioctl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index c782189..4ef2876 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -233,9 +233,10 @@ static int ext4_open_balloon(struct super_block *sb, struct vfsmount *mnt)
 			&ext4_file_operations);
 	if (mode & FMODE_WRITE)
 		mnt_drop_write(path.mnt);
-	err = -ENOMEM;
-	if (filp == NULL)
+	if (IS_ERR(filp)) {
+		err = PTR_ERR(filp);
 		goto err_filp;
+	}
 
 	filp->f_flags |= O_LARGEFILE;
 	fd_install(fd, filp);


More information about the Devel mailing list