lkml.org 
[lkml]   [2012]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[ 59/82] ext4: fix potential NULL dereference in ext4_free_inodes_counts()
    3.4-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Dan Carpenter <dan.carpenter@oracle.com>

    commit bb3d132a24cd8bf5e7773b2d9f9baa58b07a7dae upstream.

    The ext4_get_group_desc() function returns NULL on error, and
    ext4_free_inodes_count() function dereferences it without checking.
    There is a check on the next line, but it's too late.

    Reviewed-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    fs/ext4/ialloc.c | 10 ++++++----
    1 file changed, 6 insertions(+), 4 deletions(-)

    --- a/fs/ext4/ialloc.c
    +++ b/fs/ext4/ialloc.c
    @@ -488,10 +488,12 @@ fallback_retry:
    for (i = 0; i < ngroups; i++) {
    grp = (parent_group + i) % ngroups;
    desc = ext4_get_group_desc(sb, grp, NULL);
    - grp_free = ext4_free_inodes_count(sb, desc);
    - if (desc && grp_free && grp_free >= avefreei) {
    - *group = grp;
    - return 0;
    + if (desc) {
    + grp_free = ext4_free_inodes_count(sb, desc);
    + if (grp_free && grp_free >= avefreei) {
    + *group = grp;
    + return 0;
    + }
    }
    }




    \
     
     \ /
      Last update: 2012-06-07 07:43    [W:2.375 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site