summaryrefslogtreecommitdiffstats
path: root/fs/lockd
diff options
context:
space:
mode:
authorBenjamin Coddington <bcodding@redhat.com>2021-07-26 09:33:28 -0400
committerChuck Lever <chuck.lever@oracle.com>2021-08-17 11:47:52 -0400
commitcd2d644ddba183ec7b451b7c20d5c7cc06fcf0d7 (patch)
treee67924a0a136ac10dc690da48f17df50af2e6f32 /fs/lockd
parentd27b74a8675ca34dfd54c4bc4b3a11b7aa87e1a3 (diff)
downloadlinux-stable-cd2d644ddba183ec7b451b7c20d5c7cc06fcf0d7.tar.gz
linux-stable-cd2d644ddba183ec7b451b7c20d5c7cc06fcf0d7.tar.bz2
linux-stable-cd2d644ddba183ec7b451b7c20d5c7cc06fcf0d7.zip
lockd: Fix invalid lockowner cast after vfs_test_lock
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>
Diffstat (limited to 'fs/lockd')
-rw-r--r--fs/lockd/svclock.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
index 61d3cc2283dc..498cb70c2c0d 100644
--- a/fs/lockd/svclock.c
+++ b/fs/lockd/svclock.c
@@ -634,7 +634,7 @@ nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file,
conflock->caller = "somehost"; /* FIXME */
conflock->len = strlen(conflock->caller);
conflock->oh.len = 0; /* don't return OH info */
- conflock->svid = ((struct nlm_lockowner *)lock->fl.fl_owner)->pid;
+ conflock->svid = lock->fl.fl_pid;
conflock->fl.fl_type = lock->fl.fl_type;
conflock->fl.fl_start = lock->fl.fl_start;
conflock->fl.fl_end = lock->fl.fl_end;