]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
dlm: fix possible lkb_resource null dereference
authorAlexander Aring <aahringo@redhat.com>
Fri, 4 Oct 2024 15:13:38 +0000 (11:13 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 19:03:44 +0000 (20:03 +0100)
commit2db11504ef82a60c1a2063ba7431a5cd013ecfcb
treee95467db108f4dccc3360b20efc0982a905ef641
parent0becac5c4e1025b477875c0ccff322cdc0c17124
dlm: fix possible lkb_resource null dereference

[ Upstream commit b98333c67daf887c724cd692e88e2db9418c0861 ]

This patch fixes a possible null pointer dereference when this function is
called from request_lock() as lkb->lkb_resource is not assigned yet,
only after validate_lock_args() by calling attach_lkb(). Another issue
is that a resource name could be a non printable bytearray and we cannot
assume to be ASCII coded.

The log functionality is probably never being hit when DLM is used in
normal way and no debug logging is enabled. The null pointer dereference
can only occur on a new created lkb that does not have the resource
assigned yet, it probably never hits the null pointer dereference but we
should be sure that other changes might not change this behaviour and we
actually can hit the mentioned null pointer dereference.

In this patch we just drop the printout of the resource name, the lkb id
is enough to make a possible connection to a resource name if this
exists.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/dlm/lock.c