Skip to content

Commit 426cd8e

Browse files
avasummergregkh
authored andcommitted
ocfs2/dlm: fix off-by-one in dlm_match_regions() region comparison
[ Upstream commit 01b61e8 ] The local-vs-remote region comparison loop uses '<=' instead of '<', causing it to read one entry past the valid range of qr_regions. The other loops in the same function correctly use '<'. Fix the loop condition to use '<' for consistency and correctness. Link: https://lkml.kernel.org/r/SYBPR01MB78813DA26B50EC5E01F00566AF7BA@SYBPR01MB7881.ausprd01.prod.outlook.com Fixes: ea20344 ("ocfs2/dlm: Add message DLM_QUERY_REGION") Signed-off-by: Junrui Luo <moonafterrain@outlook.com> Reported-by: Yuhao Jiang <danisjiang@gmail.com> Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com> Cc: Mark Fasheh <mark@fasheh.com> Cc: Joel Becker <jlbec@evilplan.org> Cc: Junxiao Bi <junxiao.bi@oracle.com> Cc: Changwei Ge <gechangwei@live.cn> Cc: Jun Piao <piaojun@huawei.com> Cc: Heming Zhao <heming.zhao@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 3c2d0de commit 426cd8e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/ocfs2/dlm/dlmdomain.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ static int dlm_match_regions(struct dlm_ctxt *dlm,
10021002
for (i = 0; i < localnr; ++i) {
10031003
foundit = 0;
10041004
r = remote;
1005-
for (j = 0; j <= qr->qr_numregions; ++j) {
1005+
for (j = 0; j < qr->qr_numregions; ++j) {
10061006
if (!memcmp(l, r, O2HB_MAX_REGION_NAME_LEN)) {
10071007
foundit = 1;
10081008
break;

0 commit comments

Comments
 (0)