dlm: Fix kernel memory disclosure
authorVlad Tsyrklevich <vlad@tsyrklevich.net>
Wed, 22 Feb 2017 21:31:45 +0000 (15:31 -0600)
committerDavid Teigland <teigland@redhat.com>
Mon, 7 Aug 2017 16:23:09 +0000 (11:23 -0500)
Clear the 'unused' field and the uninitialized padding in 'lksb' to
avoid leaking memory to userland in copy_result_to_user().

Signed-off-by: Vlad Tsyrklevich <vlad@tsyrklevich.net>
Signed-off-by: David Teigland <teigland@redhat.com>
fs/dlm/user.c

index 23488f559cf969180a5c9b827477196acef5ff8e..322a6bcd70a20ceb2dc6027514b39736bc325693 100644 (file)
@@ -123,6 +123,8 @@ static void compat_input(struct dlm_write_request *kb,
 static void compat_output(struct dlm_lock_result *res,
                          struct dlm_lock_result32 *res32)
 {
+       memset(res32, 0, sizeof(*res32));
+
        res32->version[0] = res->version[0];
        res32->version[1] = res->version[1];
        res32->version[2] = res->version[2];