From nobody Thu Apr 9 12:08:45 2026 Received: from mail115-69.sinamail.sina.com.cn (mail115-69.sinamail.sina.com.cn [218.30.115.69]) (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 833BA18DF9D for ; Mon, 9 Mar 2026 07:17:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=218.30.115.69 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773040653; cv=none; b=MWMUdtOtqoX9q1iUx+z3qteHGIUi0VtDQfg31J1TfIndjcZ0Pype3E0okqObAvnfl5ce923iC1N/RDEG0U61LaeQGwBe83CMY0rx0xbq/ANUbtryr6Ue+h+VkMsYM40ivJUcZpuc5JcS6L0Fkffv9ktdSFv30Cr4XbAUYcm9RS8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773040653; c=relaxed/simple; bh=ErTJ9oJiQ41nXTWpalPuN4tgtAIAEsdBqpRRR75CHEs=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=oNsTzeErFGO9zin8p4ORbFRmENjv6UWFiiglpEmzNoSDx3Vbo1F79j5iCgBBrCGSO1gOqv9UDqVpXBIh6hds2lqxmgm0VFWW4PVEkMSEHoikSaI8Fnl+sHMYytUZ6VPBpyZR5//9W5NWxlBBAdAK2yxjPMtD6lEioW3n0TMusHU= 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=kHTwVjFs; arc=none smtp.client-ip=218.30.115.69 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="kHTwVjFs" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sina.com; s=201208; t=1773040648; bh=1Dek5A81r6AP/qj4cXStGFtHr0uB+0N7oMFFyoqIedA=; h=From:Subject:Date:Message-Id; b=kHTwVjFsgYuMZBifqg4xgWpetikPgStmB1ga80tO6T4OIybQQjUOxrwW9mC0FEdX/ IL3PYpIYjL5c0IjbZ+c9uppLvzgoA1hSy9tPS/QEXqx1KcR5hHz7oFSh1/054Bgf9f madFYUnCrFun+hgJK7kEgCUi8v+943OBDX0cvAI4= 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 69AE73FC00003C17; Mon, 9 Mar 2026 15:17:24 +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: 1843927602396 X-SMAIL-UIID: 64C2F4942B6C4866BC7A9F60DA2FE276-20260309-151724-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 6.1.y] dlm: fix possible lkb_resource null dereference Date: Mon, 9 Mar 2026 15:17:15 +0800 Message-Id: <20260309071715.2380423-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 e1af8728f600 ("fs: dlm: move internal flags to atomic ops") in v6.4 which is irrelevant to the logic of this patch. ] Signed-off-by: Johnny Hao --- fs/dlm/lock.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c index 0b1bc24536ce..d5aeda3399f9 100644 --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c @@ -2908,16 +2908,14 @@ static int validate_lock_args(struct dlm_ls *ls, st= ruct dlm_lkb *lkb, case -EINVAL: /* annoy the user because dlm usage is wrong */ WARN_ON(1); - log_error(ls, "%s %d %x %x %x %d %d %s", __func__, + log_error(ls, "%s %d %x %x %x %d %d", __func__, 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); break; default: - log_debug(ls, "%s %d %x %x %x %d %d %s", __func__, + log_debug(ls, "%s %d %x %x %x %d %d", __func__, 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); break; } =20 --=20 2.34.1