* [PATCH] dlm: fix out-of-bounds read triggered by short rcom messages
@ 2026-12-03 7:09 xuehaolin
2026-12-03 7:26 ` sashiko-bot
2026-12-04 2:19 ` [PATCH v2] " xuehaolin
0 siblings, 2 replies; 8+ messages in thread
From: xuehaolin @ 2026-12-03 7:09 UTC (permalink / raw)
To: aahringo, teigland; +Cc: gfs2, linux-kernel, xuehaolin
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 3118 bytes --]
From: xuehaolin <xuehaolin@uniontech.com>
The dlm_validate_incoming_buffer() in midcomms.c only checks that
received messages are at least sizeof(struct dlm_header) (16 bytes).
It does not verify that rcom messages meet the sizeof(struct dlm_rcom)
(48 bytes) minimum. A malicious cluster member can send a DLM_RCOM_LOOKUP
or DLM_RCOM_NAMES message with h_length set to 16, causing the payload
length calculation in receive_rcom_lookup() / receive_rcom_names():
len = le16_to_cpu(rc_in->rc_header.h_length) - sizeof(struct dlm_rcom);
to produce a negative value (16 - 48 = -32). In the LOOKUP path, the
negative len is passed to dlm_master_lookup() -> _dlm_master_lookup(),
where the signed comparison "len > DLM_RESNAME_MAXLEN" (-32 > 64)
evaluates to false, allowing the negative length to reach
jhash(name, len, 0); promoted to unsigned for jhash it becomes
approximately 4 GB, triggering an out-of-bounds read and kernel
oops/panic (CWE-125, remote DoS). In the NAMES path, the negative
inlen reaches dlm_copy_master_names(), where the signed "inlen > 1"
check misroutes it — a logic bug rather than an out-of-bounds access.
Fix this by adding a unified h_length >= sizeof(struct dlm_rcom) check at
the top of dlm_receive_rcom(), before any type-specific dispatch. This
is consistent with the existing lock_size check already performed for
DLM_RCOM_LOCK and DLM_RCOM_LOCK_REPLY. All legitimate rcom messages,
including those with zero-length payloads (e.g. DLM_RCOM_LOOKUP_REPLY),
carry at least a full dlm_rcom header.
Additionally, harden _dlm_master_lookup() in lock.c by adding a
"len < 0" guard to the existing bounds check, as defense-in-depth in
case other call paths bypass the rcom dispatch validation.
Found by an internal automated security research pipeline (static
analysis scan with automated triage and audit). The fix was drafted
within the same pipeline and is submitted after review by the human
signer. Reproduction was confirmed on a test VM with a kernel module
demonstrating the out-of-bounds read.
Fixes: e7fd41792fc0 ("[DLM] The core of the DLM for GFS2/CLVM")
Signed-off-by: xuehaolin <xuehaolin@uniontech.com>
---
fs/dlm/lock.c | 2 +-
fs/dlm/rcom.c | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
index c715e171bab7..56ec68e28f93 100644
--- a/fs/dlm/lock.c
+++ b/fs/dlm/lock.c
@@ -1270,7 +1270,7 @@ static int _dlm_master_lookup(struct dlm_ls *ls, int from_nodeid, const char *na
int our_nodeid = dlm_our_nodeid();
int dir_nodeid, error;
- if (len > DLM_RESNAME_MAXLEN)
+ if (len < 0 || len > DLM_RESNAME_MAXLEN)
return -EINVAL;
if (from_nodeid == our_nodeid) {
diff --git a/fs/dlm/rcom.c b/fs/dlm/rcom.c
index be1a71a6303a..b343d05f36f2 100644
--- a/fs/dlm/rcom.c
+++ b/fs/dlm/rcom.c
@@ -586,6 +586,9 @@ void dlm_receive_rcom(struct dlm_ls *ls, const struct dlm_rcom *rc, int nodeid)
uint32_t status;
uint64_t seq;
+ if (le16_to_cpu(rc->rc_header.h_length) < sizeof(struct dlm_rcom))
+ goto Eshort;
+
switch (rc->rc_type) {
case cpu_to_le32(DLM_RCOM_STATUS_REPLY):
reply = 1;
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH] dlm: fix out-of-bounds read triggered by short rcom messages 2026-12-03 7:09 [PATCH] dlm: fix out-of-bounds read triggered by short rcom messages xuehaolin @ 2026-12-03 7:26 ` sashiko-bot 2026-12-04 2:42 ` xuehaolin 2026-12-04 2:19 ` [PATCH v2] " xuehaolin 1 sibling, 1 reply; 8+ messages in thread From: sashiko-bot @ 2026-12-03 7:26 UTC (permalink / raw) To: xuehaolin, aahringo, teigland; +Cc: gfs2 Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [High] dlm: out-of-bounds read of rc_type at Eshort in dlm_receive_rcom() - [Low] dlm: Fixes trailer cites e7fd41792fc0 instead of regression 63e711b08160 -- commit e82cd5421775cac9af6a548cb1ceb3404125aed1 Author: xuehaolin <xuehaolin@uniontech.com> > dlm: fix out-of-bounds read triggered by short rcom messages > > The dlm_validate_incoming_buffer() in midcomms.c only checks that > received messages are at least sizeof(struct dlm_header) (16 bytes). > It does not verify that rcom messages meet the sizeof(struct dlm_rcom) > (48 bytes) minimum. A malicious cluster member can send a DLM_RCOM_LOOKUP > or DLM_RCOM_NAMES message with h_length set to 16, causing the payload > length calculation in receive_rcom_lookup() / receive_rcom_names(): > > len = le16_to_cpu(rc_in->rc_header.h_length) - sizeof(struct dlm_rcom); > > to produce a negative value (16 - 48 = -32). In the LOOKUP path, the > negative len is passed to dlm_master_lookup() -> _dlm_master_lookup(), > where the signed comparison "len > DLM_RESNAME_MAXLEN" (-32 > 64) > evaluates to false, allowing the negative length to reach > jhash(name, len, 0); promoted to unsigned for jhash it becomes > approximately 4 GB, triggering an out-of-bounds read and kernel > oops/panic (CWE-125, remote DoS). In the NAMES path, the negative > inlen reaches dlm_copy_master_names(), where the signed "inlen > 1" > check misroutes it — a logic bug rather than an out-of-bounds access. > > Fix this by adding a unified h_length >= sizeof(struct dlm_rcom) check at > the top of dlm_receive_rcom(), before any type-specific dispatch. This > is consistent with the existing lock_size check already performed for > DLM_RCOM_LOCK and DLM_RCOM_LOCK_REPLY. All legitimate rcom messages, > including those with zero-length payloads (e.g. DLM_RCOM_LOOKUP_REPLY), > carry at least a full dlm_rcom header. > > Additionally, harden _dlm_master_lookup() in lock.c by adding a > "len < 0" guard to the existing bounds check, as defense-in-depth in > case other call paths bypass the rcom dispatch validation. > > Found by an internal automated security research pipeline (static > analysis scan with automated triage and audit). The fix was drafted > within the same pipeline and is submitted after review by the human > signer. Reproduction was confirmed on a test VM with a kernel module > demonstrating the out-of-bounds read. > > Fixes: e7fd41792fc0 ("[DLM] The core of the DLM for GFS2/CLVM") > Signed-off-by: xuehaolin <xuehaolin@uniontech.com> [Severity: Low] Should the Fixes tag cite 63e711b08160 ("fs: dlm: create midcomms nodes when configure") instead? The sizeof(struct dlm_rcom) check was added to fs/dlm/midcomms.c in eef7d739c218 ("dlm: dlm_process_incoming_buffer() fixes") and dropped when 63e711b08160 ("fs: dlm: create midcomms nodes when configure") removed dlm_midcomms_recv_node_lookup(). Citing the initial import misdirects stable backports to older branches that already reject short rcom messages. [ ... ] > diff --git a/fs/dlm/rcom.c b/fs/dlm/rcom.c > index be1a71a6303af..b343d05f36f23 100644 > --- a/fs/dlm/rcom.c > +++ b/fs/dlm/rcom.c > @@ -586,6 +586,9 @@ void dlm_receive_rcom(struct dlm_ls *ls, const struct dlm_rcom *rc, int nodeid) > uint32_t status; > uint64_t seq; > > + if (le16_to_cpu(rc->rc_header.h_length) < sizeof(struct dlm_rcom)) > + goto Eshort; > + > switch (rc->rc_type) { > case cpu_to_le32(DLM_RCOM_STATUS_REPLY): > reply = 1; [Severity: High] Does jumping to Eshort here cause an out-of-bounds read of rc->rc_type? fs/dlm/rcom.c:dlm_receive_rcom() { ... Eshort: log_error(ls, "recovery message %d from %d is too short", le32_to_cpu(rc->rc_type), nodeid); } rc_type sits at bytes 16..19 immediately after the 16-byte struct dlm_header. When a cluster peer sends a 16-byte rcom message at the end of the kmalloc() buffer allocated by new_processqueue_entry(), Eshort performs a 4-byte slab out-of-bounds read. Logging the error without dereferencing rc->rc_type (or rejecting short rcom messages in midcomms.c before reaching dlm_receive_rcom()) would avoid the out-of-bounds access. -- Sashiko AI review · https://sashiko.dev/#/patchset/20261203070904.510344-1-xuehaolin@uniontech.com?part=1 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] dlm: fix out-of-bounds read triggered by short rcom messages 2026-12-03 7:26 ` sashiko-bot @ 2026-12-04 2:42 ` xuehaolin 0 siblings, 0 replies; 8+ messages in thread From: xuehaolin @ 2026-12-04 2:42 UTC (permalink / raw) To: sashiko-bot; +Cc: aahringo, teigland, gfs2 - The short-message rejection path no longer dereferences rc->rc_type: the guard in dlm_receive_rcom() logs the validated h_length only, and the sizeof(struct dlm_rcom) check is restored in dlm_midcomms_receive_buffer_3_1(), so short rcom messages are rejected before reaching the recovery layer. - Confirmed via git log -S that 63e711b08160 dropped the midcomms length check; the Fixes tag now cites it instead of the original import. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] dlm: fix out-of-bounds read triggered by short rcom messages 2026-12-03 7:09 [PATCH] dlm: fix out-of-bounds read triggered by short rcom messages xuehaolin 2026-12-03 7:26 ` sashiko-bot @ 2026-12-04 2:19 ` xuehaolin 2026-12-04 2:37 ` sashiko-bot 2026-12-04 3:16 ` [PATCH v3] " xuehaolin 1 sibling, 2 replies; 8+ messages in thread From: xuehaolin @ 2026-12-04 2:19 UTC (permalink / raw) To: aahringo, teigland; +Cc: gfs2, linux-kernel, xuehaolin From: xuehaolin <xuehaolin@uniontech.com> The dlm_validate_incoming_buffer() in midcomms.c only checks that received messages are at least sizeof(struct dlm_header) (16 bytes). It does not verify that rcom messages meet the sizeof(struct dlm_rcom) (48 bytes) minimum. A malicious cluster member can send a DLM_RCOM_LOOKUP or DLM_RCOM_NAMES message with h_length set to 16, causing the payload length calculation in receive_rcom_lookup() / receive_rcom_names(): len = le16_to_cpu(rc_in->rc_header.h_length) - sizeof(struct dlm_rcom); to produce a negative value (16 - 48 = -32). In the LOOKUP path, the negative len is passed to dlm_master_lookup() -> _dlm_master_lookup(), where the signed comparison "len > DLM_RESNAME_MAXLEN" (-32 > 64) evaluates to false, allowing the negative length to reach jhash(name, len, 0); promoted to unsigned for jhash it becomes approximately 4 GB, triggering an out-of-bounds read and kernel oops/panic (CWE-125, remote DoS). In the NAMES path, the negative inlen reaches dlm_copy_master_names(), where the signed "inlen > 1" check misroutes it — a logic bug rather than an out-of-bounds access. Fix this by restoring the sizeof(struct dlm_rcom) length check in dlm_midcomms_receive_buffer_3_1() before the message is handed to the recovery layer: the DLM_MSG case validates its message size, but the DLM_RCOM case lost this check when the midcomms receive path was restructured, leaving only a stale "length already checked" comment. Additionally, guard the entry of dlm_receive_rcom() with the same check as defense-in-depth covering all rcom entry paths, using a rejection log that references only the validated header fields, and harden _dlm_master_lookup() in lock.c by adding a "len < 0" guard to the existing bounds check, in case other call paths bypass the rcom dispatch validation. Found by an internal automated security research pipeline (static analysis scan with automated triage and audit). The fix was drafted within the same pipeline and is submitted after review by the human signer. Reproduction was confirmed on a test VM with a kernel module demonstrating the out-of-bounds read. Fixes: 63e711b08160 ("fs: dlm: create midcomms nodes when configure") Signed-off-by: xuehaolin <xuehaolin@uniontech.com> --- fs/dlm/lock.c | 2 +- fs/dlm/midcomms.c | 7 ++++++- fs/dlm/rcom.c | 6 ++++++ 3 files changed, 13 insertions(+), 2 deletions(-) Changes in v2: - restore the sizeof(struct dlm_rcom) length check in dlm_midcomms_receive_buffer_3_1(); the DLM_MSG case kept its check when the midcomms receive path was restructured, the DLM_RCOM case lost it, leaving a stale "length already checked" comment - stop dereferencing rc->rc_type in the short-message rejection path of dlm_receive_rcom(); the guard now logs the validated h_length only, since rc_type sits beyond the 16 bytes that dlm_validate_incoming_buffer() guarantees - point Fixes at 63e711b08160, the commit that dropped the midcomms length check, instead of the original DLM import diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c index c715e171bab7..56ec68e28f93 100644 --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c @@ -1270,7 +1270,7 @@ static int _dlm_master_lookup(struct dlm_ls *ls, int from_nodeid, const char *na int our_nodeid = dlm_our_nodeid(); int dir_nodeid, error; - if (len > DLM_RESNAME_MAXLEN) + if (len < 0 || len > DLM_RESNAME_MAXLEN) return -EINVAL; if (from_nodeid == our_nodeid) { diff --git a/fs/dlm/midcomms.c b/fs/dlm/midcomms.c index 045431524494..495b2517ef7e 100644 --- a/fs/dlm/midcomms.c +++ b/fs/dlm/midcomms.c @@ -815,7 +815,12 @@ static void dlm_midcomms_receive_buffer_3_1(const union dlm_packet *p, int nodei switch (p->header.h_cmd) { case DLM_RCOM: - /* length already checked */ + if (msglen < sizeof(struct dlm_rcom)) { + log_print("rcom msg too small: %u, will skip this message from node %d", + msglen, nodeid); + return; + } + break; case DLM_MSG: if (msglen < sizeof(struct dlm_message)) { diff --git a/fs/dlm/rcom.c b/fs/dlm/rcom.c index be1a71a6303a..fe23b92a3faf 100644 --- a/fs/dlm/rcom.c +++ b/fs/dlm/rcom.c @@ -586,6 +586,12 @@ void dlm_receive_rcom(struct dlm_ls *ls, const struct dlm_rcom *rc, int nodeid) uint32_t status; uint64_t seq; + if (le16_to_cpu(rc->rc_header.h_length) < sizeof(struct dlm_rcom)) { + log_error(ls, "rcom message from %d is too short (%u bytes)", + nodeid, le16_to_cpu(rc->rc_header.h_length)); + return; + } + switch (rc->rc_type) { case cpu_to_le32(DLM_RCOM_STATUS_REPLY): reply = 1; -- 2.43.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2] dlm: fix out-of-bounds read triggered by short rcom messages 2026-12-04 2:19 ` [PATCH v2] " xuehaolin @ 2026-12-04 2:37 ` sashiko-bot 2026-12-04 3:16 ` [PATCH v3] " xuehaolin 1 sibling, 0 replies; 8+ messages in thread From: sashiko-bot @ 2026-12-04 2:37 UTC (permalink / raw) To: xuehaolin, aahringo, teigland; +Cc: gfs2 Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] dlm: missing dlm_rcom length check in dlm_midcomms_receive_buffer_3_2() -- commit 4e1720112a3b4b8b5636c0651ec522fee2cd7dfb Author: xuehaolin <xuehaolin@uniontech.com> dlm: fix out-of-bounds read triggered by short rcom messages This commit restores the sizeof(struct dlm_rcom) length check in dlm_midcomms_receive_buffer_3_1(), adds a matching check at the entry of dlm_receive_rcom(), and rejects negative lengths in _dlm_master_lookup(). [ ... ] > diff --git a/fs/dlm/midcomms.c b/fs/dlm/midcomms.c > index 488a58f2c00b4..b904445be4765 100644 > --- a/fs/dlm/midcomms.c > +++ b/fs/dlm/midcomms.c > @@ -823,7 +823,12 @@ static void dlm_midcomms_receive_buffer_3_1(const union dlm_packet *p, int nodei > > switch (p->header.h_cmd) { > case DLM_RCOM: > - /* length already checked */ > + if (msglen < sizeof(struct dlm_rcom)) { > + log_print("rcom msg too small: %u, will skip this message from node %d", > + msglen, nodeid); > + return; > + } > + > break; > case DLM_MSG: > if (msglen < sizeof(struct dlm_message)) { [Severity: High] Should dlm_midcomms_receive_buffer_3_2() also restore this length check? Commit 63e711b08160 ("fs: dlm: create midcomms nodes when configure") dropped it for both versions, leaving the same stale comment before the switch on p->rcom.rc_type in dlm_midcomms_receive_buffer_3_2(). A 16-byte DLM v3.2 DLM_RCOM message triggers a 4-byte out-of-bounds read. A 20-byte DLM_RCOM_STATUS for an unknown lockspace also bypasses the new guard in dlm_receive_rcom() via dlm_receive_buffer() -> dlm_send_ls_not_ready(), which reads rc_in->rc_id and rc_in->rc_seq past the packet and sends 16 bytes of heap memory back to the peer. Adding the check before reading p->rcom.rc_type in dlm_midcomms_receive_buffer_3_2() needs to jump to out so nodes_srcu is unlocked. -- Sashiko AI review · https://sashiko.dev/#/patchset/20261204021910.706512-1-xuehaolin@uniontech.com?part=1 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3] dlm: fix out-of-bounds read triggered by short rcom messages 2026-12-04 2:19 ` [PATCH v2] " xuehaolin 2026-12-04 2:37 ` sashiko-bot @ 2026-12-04 3:16 ` xuehaolin 2026-12-04 3:30 ` [PATCH v2] " xuehaolin 2026-12-04 6:55 ` [PATCH v3] " xuehaolin 1 sibling, 2 replies; 8+ messages in thread From: xuehaolin @ 2026-12-04 3:16 UTC (permalink / raw) To: aahringo, teigland; +Cc: gfs2, linux-kernel, xuehaolin From: xuehaolin <xuehaolin@uniontech.com> The dlm_validate_incoming_buffer() in midcomms.c only checks that received messages are at least sizeof(struct dlm_header) (16 bytes). It does not verify that rcom messages meet the sizeof(struct dlm_rcom) (48 bytes) minimum. A malicious cluster member can send a DLM_RCOM_LOOKUP or DLM_RCOM_NAMES message with h_length set to 16, causing the payload length calculation in receive_rcom_lookup() / receive_rcom_names(): len = le16_to_cpu(rc_in->rc_header.h_length) - sizeof(struct dlm_rcom); to produce a negative value (16 - 48 = -32). In the LOOKUP path, the negative len is passed to dlm_master_lookup() -> _dlm_master_lookup(), where the signed comparison "len > DLM_RESNAME_MAXLEN" (-32 > 64) evaluates to false, allowing the negative length to reach jhash(name, len, 0); promoted to unsigned for jhash it becomes approximately 4 GB, triggering an out-of-bounds read and kernel oops/panic (CWE-125, remote DoS). In the NAMES path, the negative inlen reaches dlm_copy_master_names(), where the signed "inlen > 1" check misroutes it — a logic bug rather than an out-of-bounds access. Fix this by restoring the sizeof(struct dlm_rcom) length check in dlm_midcomms_receive_buffer_3_1() and adding it to the DLM_RCOM case of dlm_midcomms_receive_buffer_3_2() before the rcom type is read: the DLM_MSG case validates its message size, but the DLM_RCOM cases lost this check when the midcomms receive path was restructured, leaving only a stale "length already checked" comment. Without it, short rcom messages reach dlm_receive_buffer() and the recovery layer, where fields beyond the validated header are read and, in the lockspace not-ready path, echoed back to the peer. Additionally, guard the entry of dlm_receive_rcom() with the same check as defense-in-depth covering all rcom entry paths, using a rejection log that references only the validated header fields, and harden _dlm_master_lookup() in lock.c by adding a "len < 0" guard to the existing bounds check, in case other call paths bypass the rcom dispatch validation. Found by an internal automated security research pipeline (static analysis scan with automated triage and audit). The fix was drafted within the same pipeline and is submitted after review by the human signer. Reproduction was confirmed on a test VM with a kernel module demonstrating the out-of-bounds read. Fixes: 63e711b08160 ("fs: dlm: create midcomms nodes when configure") Signed-off-by: xuehaolin <xuehaolin@uniontech.com> --- fs/dlm/lock.c | 2 +- fs/dlm/midcomms.c | 15 ++++++++++++--- fs/dlm/rcom.c | 6 ++++++ 3 files changed, 19 insertions(+), 4 deletions(-) Changes in v3: - also restore the sizeof(struct dlm_rcom) check in the DLM_RCOM case of dlm_midcomms_receive_buffer_3_2(): 63e711b08160 dropped the check for both protocol versions, and a short 3.2 rcom message reaches the same stale-commented rc_type read; it can also reach the lockspace not-ready path in dlm_send_ls_not_ready(), which reads rc_id/rc_seq past the packet and echoes them back to the peer - drop the stale "length already checked" comment it replaced Changes in v2: - restore the sizeof(struct dlm_rcom) length check in dlm_midcomms_receive_buffer_3_1(); the DLM_MSG case kept its check when the midcomms receive path was restructured, the DLM_RCOM case lost it, leaving a stale "length already checked" comment - stop dereferencing rc->rc_type in the short-message rejection path of dlm_receive_rcom(); the guard now logs the validated h_length only, since rc_type sits beyond the 16 bytes that dlm_validate_incoming_buffer() guarantees - point Fixes at 63e711b08160, the commit that dropped the midcomms length check, instead of the original DLM import diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c index c715e171bab7..56ec68e28f93 100644 --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c @@ -1270,7 +1270,7 @@ static int _dlm_master_lookup(struct dlm_ls *ls, int from_nodeid, const char *na int our_nodeid = dlm_our_nodeid(); int dir_nodeid, error; - if (len > DLM_RESNAME_MAXLEN) + if (len < 0 || len > DLM_RESNAME_MAXLEN) return -EINVAL; if (from_nodeid == our_nodeid) { diff --git a/fs/dlm/midcomms.c b/fs/dlm/midcomms.c index 045431524494..bc52c43b0700 100644 --- a/fs/dlm/midcomms.c +++ b/fs/dlm/midcomms.c @@ -700,9 +700,13 @@ static void dlm_midcomms_receive_buffer_3_2(const union dlm_packet *p, int nodei /* these rcom message we use to determine version. * they have their own retransmission handling and * are the first messages of dlm. - * - * length already checked. */ + if (msglen < sizeof(struct dlm_rcom)) { + log_print("rcom msg too small: %u, will skip this message from node %d", + msglen, nodeid); + goto out; + } + switch (p->rcom.rc_type) { case cpu_to_le32(DLM_RCOM_NAMES): fallthrough; @@ -815,7 +819,12 @@ static void dlm_midcomms_receive_buffer_3_1(const union dlm_packet *p, int nodei switch (p->header.h_cmd) { case DLM_RCOM: - /* length already checked */ + if (msglen < sizeof(struct dlm_rcom)) { + log_print("rcom msg too small: %u, will skip this message from node %d", + msglen, nodeid); + return; + } + break; case DLM_MSG: if (msglen < sizeof(struct dlm_message)) { diff --git a/fs/dlm/rcom.c b/fs/dlm/rcom.c index be1a71a6303a..fe23b92a3faf 100644 --- a/fs/dlm/rcom.c +++ b/fs/dlm/rcom.c @@ -586,6 +586,12 @@ void dlm_receive_rcom(struct dlm_ls *ls, const struct dlm_rcom *rc, int nodeid) uint32_t status; uint64_t seq; + if (le16_to_cpu(rc->rc_header.h_length) < sizeof(struct dlm_rcom)) { + log_error(ls, "rcom message from %d is too short (%u bytes)", + nodeid, le16_to_cpu(rc->rc_header.h_length)); + return; + } + switch (rc->rc_type) { case cpu_to_le32(DLM_RCOM_STATUS_REPLY): reply = 1; -- 2.43.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2] dlm: fix out-of-bounds read triggered by short rcom messages 2026-12-04 3:16 ` [PATCH v3] " xuehaolin @ 2026-12-04 3:30 ` xuehaolin 2026-12-04 6:55 ` [PATCH v3] " xuehaolin 1 sibling, 0 replies; 8+ messages in thread From: xuehaolin @ 2026-12-04 3:30 UTC (permalink / raw) To: sashiko-bot; +Cc: aahringo, teigland, gfs2 Fixed in v3: the sizeof(struct dlm_rcom) check is now restored in dlm_midcomms_receive_buffer_3_2() as well, with goto out to release nodes_srcu before returning. This closes the rc_type out-of-bounds read in the 3.2 path, the dlm_send_ls_not_ready() heap echo via short STATUS messages, and the 3.1 path - all three are rejected before reaching dlm_receive_rcom(). ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3] dlm: fix out-of-bounds read triggered by short rcom messages 2026-12-04 3:16 ` [PATCH v3] " xuehaolin 2026-12-04 3:30 ` [PATCH v2] " xuehaolin @ 2026-12-04 6:55 ` xuehaolin 1 sibling, 0 replies; 8+ messages in thread From: xuehaolin @ 2026-12-04 6:55 UTC (permalink / raw) To: sashiko-bot; +Cc: aahringo, teigland, gfs2 Fixed in v3: the sizeof(struct dlm_rcom) check is now restored in dlm_midcomms_receive_buffer_3_2() as well, with goto out to release nodes_srcu before returning. This closes the rc_type out-of-bounds read in the 3.2 path, the dlm_send_ls_not_ready() heap echo via short STATUS messages, and the 3.1 path - all three are rejected before reaching dlm_receive_rcom(). ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-12-04 6:55 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-12-03 7:09 [PATCH] dlm: fix out-of-bounds read triggered by short rcom messages xuehaolin 2026-12-03 7:26 ` sashiko-bot 2026-12-04 2:42 ` xuehaolin 2026-12-04 2:19 ` [PATCH v2] " xuehaolin 2026-12-04 2:37 ` sashiko-bot 2026-12-04 3:16 ` [PATCH v3] " xuehaolin 2026-12-04 3:30 ` [PATCH v2] " xuehaolin 2026-12-04 6:55 ` [PATCH v3] " xuehaolin
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.