From nobody Thu Apr 9 09:04:45 2026 Received: from mail115-24.sinamail.sina.com.cn (mail115-24.sinamail.sina.com.cn [218.30.115.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2AB743A900B for ; Tue, 10 Mar 2026 03:10:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=218.30.115.24 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773112229; cv=none; b=aYIVpkpoz73vhQSxI1as06PD7a4iQ9N46gOImXwH57WoKJ9iNeH/oNFRqeyKCIUPqsQ/PfWA1/ZgqngSJl2e4/zqYcnz/uO2GNkXtBMVYAr8yM7K8DGSBLejxCeQsZ7M8+xJe1tmRwrAgpDvXBD8nKn+mfPzx/fPDGDyyhN5Hto= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773112229; c=relaxed/simple; bh=cfwLVXFdj37og/RHm0uXsOCFQ+WS2Pv92LVVeBHIxao=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=ME/ZXL56GT+joScASlQIsKhwh9IbVpKKGsXRU3BZSooh/K6iCdLFdRQkebjxzw8N+PqaZeJ0/aGZmwmcS6U4BaF/19/eIDwukq/yq/Es9d82JoF+pklKqMzXqJk5kt6EzZUTu2FNDKf1iw6UbgWGQiziWJRAPg1ic6clCYZwdqc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sina.com; spf=pass smtp.mailfrom=sina.com; dkim=pass (1024-bit key) header.d=sina.com header.i=@sina.com header.b=EjJHYaP8; arc=none smtp.client-ip=218.30.115.24 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sina.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=sina.com header.i=@sina.com header.b="EjJHYaP8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sina.com; s=201208; t=1773112226; bh=n9nXfBjiGOyRuUo5cxPsgCNLzkaiz4s7BuO6ctzS8X4=; h=From:Subject:Date:Message-Id; b=EjJHYaP8wZv7VgGL7VtdtY8QO+oPEeLVcwAwPlsbvCbwX3ab0/433wGqt5oMDnCF6 50FKBfsZjugW+hHm04ZucYa47Jb7chkK4q4n28DUhXcjTr03Wfd2OrS3+iFH9QRlu0 5zLFYd9bZmquyGKstpy8v9gPqe2PFKoHEQD1l0o4= X-SMAIL-HELO: pek-lpg-core6.wrs.com Received: from unknown (HELO pek-lpg-core6.wrs.com)([60.247.85.88]) by sina.com (10.185.250.22) with ESMTP id 69AF8B9C00004255; Tue, 10 Mar 2026 11:10:22 +0800 (CST) X-Sender: johnny_haocn@sina.com X-Auth-ID: johnny_haocn@sina.com Authentication-Results: sina.com; spf=none smtp.mailfrom=johnny_haocn@sina.com; dkim=none header.i=none; dmarc=none action=none header.from=johnny_haocn@sina.com X-SMAIL-MID: 8930297602215 X-SMAIL-UIID: 0F7EAD5C376F4073AFB8022533207912-20260310-111022-1 From: Johnny Hao To: gregkh@linuxfoundation.org, stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Alexander Aring , David Teigland , Johnny Hao Subject: [PATCH 5.15.y] dlm: fix possible lkb_resource null dereference Date: Tue, 10 Mar 2026 11:10:19 +0800 Message-Id: <20260310031019.3572626-1-johnny_haocn@sina.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Alexander Aring [ 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 Signed-off-by: David Teigland [ The context change is due to the commit 9ac8ba46a701 ("fs: dlm: handle -EINVAL as log_error()") in v6.1 which is irrelevant to the logic of this patch. ] Signed-off-by: Johnny Hao --- fs/dlm/lock.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c index b9829b873bf2..ffe12593a8b7 100644 --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c @@ -2923,10 +2923,9 @@ static int validate_lock_args(struct dlm_ls *ls, str= uct dlm_lkb *lkb, rv =3D 0; out: if (rv) - log_debug(ls, "validate_lock_args %d %x %x %x %d %d %s", + log_debug(ls, "validate_lock_args %d %x %x %x %d %d", rv, lkb->lkb_id, lkb->lkb_flags, args->flags, - lkb->lkb_status, lkb->lkb_wait_type, - lkb->lkb_resource->res_name); + lkb->lkb_status, lkb->lkb_wait_type); return rv; } =20 --=20 2.34.1