lkml.org 
[lkml]   [2019]   [Aug]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH] tracefs: Fix NULL pointer dereference when no lockdown is used
    Date
    Commit 757ff7244358 ("tracefs: Restrict tracefs when the kernel is locked
    down") added infrastructure for restricting tracefs access when lockdown
    is enabled. It however broke tracefs operation when no lockdown is used.
    Fix this issue by adding missing check for a NULL ->open() callback.

    Fixes: 757ff7244358 ("tracefs: Restrict tracefs when the kernel is locked down")
    Reported-by: Krzysztof Kozlowski <krzk@kernel.org>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    ---
    fs/tracefs/inode.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
    index 12a325fb4cbd..8efff7603032 100644
    --- a/fs/tracefs/inode.c
    +++ b/fs/tracefs/inode.c
    @@ -43,7 +43,7 @@ static int default_open_file(struct inode *inode, struct file *filp)
    return ret;

    real_fops = dentry->d_fsdata;
    - return real_fops->open(inode, filp);
    + return real_fops->open ? real_fops->open(inode, filp) : 0;
    }

    static ssize_t default_read_file(struct file *file, char __user *buf,
    --
    2.17.1
    \
     
     \ /
      Last update: 2019-08-14 08:13    [W:3.974 / U:0.036 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site