lkml.org 
[lkml]   [2010]   [May]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[35/39] CacheFiles: Fix error handling in cachefiles_determine_cache_security()

    2.6.33-stable review patch. If anyone has any objections, please let us know.

    ------------------
    From: David Howells <dhowells@redhat.com>

    commit 7ac512aa8237c43331ffaf77a4fd8b8d684819ba upstream.

    cachefiles_determine_cache_security() is expected to return with a
    security override in place. However, if set_create_files_as() fails, we
    fail to do this. In this case, we should just reinstate the security
    override that was set by the caller.

    Furthermore, if set_create_files_as() fails, we should dispose of the
    new credentials we were in the process of creating.

    Signed-off-by: David Howells <dhowells@redhat.com>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

    ---
    fs/cachefiles/security.c | 4 ++++
    1 file changed, 4 insertions(+)

    --- a/fs/cachefiles/security.c
    +++ b/fs/cachefiles/security.c
    @@ -77,6 +77,8 @@ static int cachefiles_check_cache_dir(st
    /*
    * check the security details of the on-disk cache
    * - must be called with security override in force
    + * - must return with a security override in force - even in the case of an
    + * error
    */
    int cachefiles_determine_cache_security(struct cachefiles_cache *cache,
    struct dentry *root,
    @@ -99,6 +101,8 @@ int cachefiles_determine_cache_security(
    * which create files */
    ret = set_create_files_as(new, root->d_inode);
    if (ret < 0) {
    + abort_creds(new);
    + cachefiles_begin_secure(cache, _saved_cred);
    _leave(" = %d [cfa]", ret);
    return ret;
    }



    \
     
     \ /
      Last update: 2010-05-25 01:29    [W:0.024 / U:94.320 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site