lkml.org 
[lkml]   [2014]   [Jun]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.12 171/181] fs: btrfs: volumes.c: Fix for possible null pointer dereference
    Date
    From: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>

    3.12-stable review patch. If anyone has any objections, please let me know.

    ===============

    commit 8321cf2596d283821acc466377c2b85bcd3422b7 upstream.

    There is otherwise a risk of a possible null pointer dereference.

    Was largely found by using a static code analysis program called cppcheck.

    Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
    Signed-off-by: Chris Mason <clm@fb.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>
    ---
    fs/btrfs/volumes.c | 5 +++--
    1 file changed, 3 insertions(+), 2 deletions(-)

    diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
    index c06616106fa9..7fae00b72283 100644
    --- a/fs/btrfs/volumes.c
    +++ b/fs/btrfs/volumes.c
    @@ -1676,11 +1676,12 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)
    struct btrfs_fs_devices *fs_devices;
    fs_devices = root->fs_info->fs_devices;
    while (fs_devices) {
    - if (fs_devices->seed == cur_devices)
    + if (fs_devices->seed == cur_devices) {
    + fs_devices->seed = cur_devices->seed;
    break;
    + }
    fs_devices = fs_devices->seed;
    }
    - fs_devices->seed = cur_devices->seed;
    cur_devices->seed = NULL;
    lock_chunks(root);
    __btrfs_close_devices(cur_devices);
    --
    2.0.0


    \
     
     \ /
      Last update: 2014-06-30 15:41    [W:4.059 / U:0.024 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site