Skip to content

Commit

Permalink
mount: fix dereference after null check
Browse files Browse the repository at this point in the history
CID 1168169 (#1 of 1): Dereference after null check (FORWARD_NULL)
7. var_deref_model: Passing "mi" to function "do_bind_mount(struct
   mount_info *)", which dereferences null "mi->bind"

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
  • Loading branch information
avagin authored and xemul committed Aug 7, 2014
1 parent 1e0e837 commit 9ba0baa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -1305,7 +1305,7 @@ static int restore_ext_mount(struct mount_info *mi)

static int do_bind_mount(struct mount_info *mi)
{
bool shared = mi->shared_id && mi->shared_id == mi->bind->shared_id;
bool shared = 0;

if (!mi->need_plugin) {
char *root, rpath[PATH_MAX];
Expand All @@ -1322,6 +1322,8 @@ static int do_bind_mount(struct mount_info *mi)
goto do_bind;
}

shared = mi->shared_id && mi->shared_id == mi->bind->shared_id;

/*
* Cut common part of root.
* For non-root binds the source is always "/" (checked)
Expand Down

0 comments on commit 9ba0baa

Please sign in to comment.