• David Gibson's avatar
    [PATCH] Fix error handling with put_compat_statfs() · 86e07ce7
    David Gibson authored
    In fs/compat.c, whenever put_compat_statfs() returns an error, the
    containing syscall returns -EFAULT.  This is presumably by analogy with the
    non-compat case, where any non-zero code from copy_to_user() should be
    translated into an EFAULT.  However, put_compat_statfs() is also return
    -EOVERFLOW.  The same applies for put_compat_statfs64().
    
    This bug can be observed with a statfs() on a hugetlbfs directory.
    hugetlbfs, when mounted without limits reports available, free and total
    blocks as -1 (itself a bug, another patch coming).  statfs() will
    mysteriously return EFAULT although it's parameters are perfectly valid
    addresses.
    
    This patch causes the compat versions of statfs() and statfs64() to
    correctly propogate the return values from put_compat_statfs() and
    put_compat_statfs64().
    Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    86e07ce7
compat.c 45.3 KB