All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] lockd: fix two bugs on nlmclnt_find_lockowner() failure path
@ 2026-08-19  7:46 Ran Hongyun
  2026-08-19  7:46 ` [PATCH 1/2] lockd: fix NULL pointer dereference in nlmclnt_locks_release_private Ran Hongyun
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ran Hongyun @ 2026-08-19  7:46 UTC (permalink / raw)
  To: trondmy, anna, cel, jlayton, viro, bcodding
  Cc: linux-nfs, linux-kernel, ranhongyun1, chengzhihao1, yangerkun,
	yi.zhang

Both bugs are triggered when nlmclnt_find_lockowner() returns NULL
due to allocation failure in nlmclnt_proc():

Patch 1 fixes a NULL pointer dereference: nlmclnt_locks_init_private()
unconditionally sets fl->fl_ops before checking whether owner is NULL,
so locks_release_private() later calls fl_release_private which
dereferences the NULL owner. Fix by inlining the function so that
fl_ops is only set after the owner is valid.

Patch 2 fixes a reference leak: call->a_callback_data has not been
assigned when nlmclnt_release_call() is invoked on the error path,
so nlmclnt_ops->nlmclnt_release_call(NULL) skips cleanup and the
references taken by nlmclnt_alloc_call() are never freed. Fix by
moving the assignment before the lockowner check.

Ran Hongyun (2):
  lockd: fix NULL pointer dereference in nlmclnt_locks_release_private
  lockd: fix reference leak on lockowner allocation failure in
    nlmclnt_proc

 fs/lockd/clntproc.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

-- 
2.52.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-08-20 14:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-19  7:46 [PATCH 0/2] lockd: fix two bugs on nlmclnt_find_lockowner() failure path Ran Hongyun
2026-08-19  7:46 ` [PATCH 1/2] lockd: fix NULL pointer dereference in nlmclnt_locks_release_private Ran Hongyun
2026-08-19  7:46 ` [PATCH 2/2] lockd: fix reference leak on lockowner allocation failure in nlmclnt_proc Ran Hongyun
2026-08-19 12:06 ` [PATCH 0/2] lockd: fix two bugs on nlmclnt_find_lockowner() failure path Jeff Layton
2026-08-20 14:45 ` Jeff Layton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.