dlm: fix user space lkb refcounting
authorAlexander Aring <aahringo@redhat.com>
Tue, 12 Mar 2024 17:05:07 +0000 (13:05 -0400)
committerDavid Teigland <teigland@redhat.com>
Tue, 12 Mar 2024 17:12:52 +0000 (12:12 -0500)
commit2ab3d705ca5d4f7ea345a21c3da41a447a549649
tree03e5727b27821ca175a5f531d9fa7691eded083f
parentd206a76d7d2726f3b096037f2079ce0bd3ba329b
dlm: fix user space lkb refcounting

This patch fixes to check on the right return value if it was the last
callback. The rv variable got overwritten by the return of
copy_result_to_user(). Fixing it by introducing a second variable for
the return value and don't let rv being overwritten.

Cc: stable@vger.kernel.org
Fixes: 61bed0baa4db ("fs: dlm: use a non-static queue for callbacks")
Reported-by: Valentin Vidić <vvidic@valentin-vidic.from.hr>
Closes: https://lore.kernel.org/gfs2/Ze4qSvzGJDt5yxC3@valentin-vidic.from.hr
Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
fs/dlm/user.c