Skip to content

ocfs2/dlm: fix two bugs in dlm_match_regions()

Junrui Luo lkml ocfs2-devel 1 version Applied

Status from this message: [merged mm-nonmm-stable] ocfs2-dlm-fix-off-by-one-in-dlm_match_regions-region-comparison.patch removed from -mm tree

Get series with b4
b4 am SYBPR01MB7881A334D02ACEE5E0645801AF7BA@SYBPR01MB7881.ausprd01.prod.outlook.com change-id 20260307-fixes-9d8b95012a49

Versions newest first

  1. v1 Latest2 patches 5 repliesApplied 2/2

Patches in v1 All 2 applied

#Subject and filesSizeRepliesApplied
1/2ocfs2/dlm: validate qr_numregions in dlm_match_regions()fs/ocfs2/dlm/dlmdomain.c+8 -01 replyApplied
2/2ocfs2/dlm: fix off-by-one in dlm_match_regions() region comparisonfs/ocfs2/dlm/dlmdomain.c+1 -11 replyApplied

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchWengang WangJoseph Qi
SeriesR-b R-b
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] ocfs2/dlm: fix two bugs in dlm_match_regions()

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.

---
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,

Signature · 1 line
Junrui Luo <[email protected]>