mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] ocfs2/dlm: fix two bugs in dlm_match_regions()
@ 2026-03-07  7:22 Junrui Luo
  2026-03-07  7:21 ` [PATCH 1/2] ocfs2/dlm: validate qr_numregions " Junrui Luo
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Junrui Luo @ 2026-03-07  7:22 UTC (permalink / raw)
  To: Mark Fasheh, Joel Becker, Joseph Qi, Sunil Mushran
  Cc: ocfs2-devel, linux-kernel, Junrui Luo, Yuhao Jiang

In dlm_match_regions(), the qr_numregions field from a DLM_QUERY_REGION
network message is used to drive loops over the qr_regions buffer without
sufficient validation. This series fixes two issues:

- Patch 1 adds a bounds check to reject messages where qr_numregions
  exceeds O2NM_MAX_REGIONS. The o2net layer only validates message
  byte length; it does not constrain field values, so a crafted message
  can set qr_numregions up to 255 and trigger out-of-bounds reads past
  the 1024-byte qr_regions buffer.

- Patch 2 fixes an off-by-one in the local-vs-remote comparison loop,
  which uses '<=' instead of '<', reading one entry past the valid range
  even when qr_numregions is within bounds.

Signed-off-by: Junrui Luo <moonafterrain@outlook.com>
---
Junrui Luo (2):
      ocfs2/dlm: validate qr_numregions in dlm_match_regions()
      ocfs2/dlm: fix off-by-one in dlm_match_regions() region comparison

 fs/ocfs2/dlm/dlmdomain.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
base-commit: 0031c06807cfa8aa51a759ff8aa09e1aa48149af
change-id: 20260307-fixes-9d8b95012a49

Best regards,
-- 
Junrui Luo <moonafterrain@outlook.com>


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

end of thread, other threads:[~2026-03-18  5:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-07  7:22 [PATCH 0/2] ocfs2/dlm: fix two bugs in dlm_match_regions() Junrui Luo
2026-03-07  7:21 ` [PATCH 1/2] ocfs2/dlm: validate qr_numregions " Junrui Luo
2026-03-18  5:54   ` Joseph Qi
2026-03-07  7:21 ` [PATCH 2/2] ocfs2/dlm: fix off-by-one in dlm_match_regions() region comparison Junrui Luo
2026-03-18  5:55   ` Joseph Qi
2026-03-07 16:06 ` [PATCH 0/2] ocfs2/dlm: fix two bugs in dlm_match_regions() Wengang Wang
2026-03-07 16:14   ` Wengang Wang
2026-03-09  1:26   ` Joseph Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®