lockd: Fix invalid lockowner cast after vfs_test_lock
authorBenjamin Coddington <bcodding@redhat.com>
Mon, 26 Jul 2021 13:33:28 +0000 (09:33 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Sep 2021 07:50:41 +0000 (09:50 +0200)
commitc9773f42c1debe4d942eb8f05909a98bc8ec9e62
treeced6455c660789e128cf17863b8a9e9524b8150f
parent2600861b9069d57bff1cac0e73fd3aac4f181df1
lockd: Fix invalid lockowner cast after vfs_test_lock

[ Upstream commit cd2d644ddba183ec7b451b7c20d5c7cc06fcf0d7 ]

After calling vfs_test_lock() the pointer to a conflicting lock can be
returned, and that lock is not guarunteed to be owned by nlm.  In that
case, we cannot cast it to struct nlm_lockowner.  Instead return the pid
of that conflicting lock.

Fixes: 646d73e91b42 ("lockd: Show pid of lockd for remote locks")
Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/lockd/svclock.c