* [PATCH net v2 1/2] net/smc: bound the failover cursor catch-up by what is outstanding
@ 2026-11-23 13:53 Piyus Kedia
2026-11-23 13:53 ` [PATCH net v2 2/2] net/smc: bound the DMB-nocopy send-buffer credit as well Piyus Kedia
2026-11-24 13:53 ` [PATCH net v2 1/2] net/smc: bound the failover cursor catch-up by what is outstanding sashiko-bot
0 siblings, 2 replies; 4+ messages in thread
From: Piyus Kedia @ 2026-11-23 13:53 UTC (permalink / raw)
To: alibuda, Dust Li, Sidraya Jayagond, Mahanta Jambigi, netdev
Cc: Tony Lu, Wen Gu, linux-rdma, linux-s390, linux-kernel,
Kapil Vaswani, Piyus Kedia, stable
smc_switch_cursor() credits conn->sndbuf_space from the consumer cursor
the peer reported, with nothing bounding the amount:
smc_curs_copy(&cons, &conn->local_rx_ctrl.cons, conn);
if (smc_curs_comp(conn->peer_rmbe_size, &cons, &fin) < 0) {
diff = smc_curs_diff(conn->peer_rmbe_size, &fin, &cons);
smc_curs_add(conn->sndbuf_desc->len,
&conn->tx_curs_sent, diff);
smc_curs_add(conn->sndbuf_desc->len,
&conn->tx_curs_fin, diff);
smp_mb__before_atomic();
atomic_add(diff, &conn->sndbuf_space);
local_rx_ctrl.cons is whatever arrived in the peer's last CDC message.
smc_cdc_cursor_to_host() drops only a cursor that moves backward within
one wrap, so a peer can advance cons.count by nearly peer_rmbe_size and
report consuming data this side never sent. diff becomes that amount and
sndbuf_space ends above sndbuf_desc->len, which the tx path reads as free
room in the send ring:
writespace = atomic_read(&conn->sndbuf_space);
/* not more than what user space asked for */
copylen = min_t(size_t, send_remaining, writespace);
The first chunk of a two-part write is clamped against the buffer, the
second is not, so memcpy_from_msg() copies past the end of the send
buffer. The two cursors advanced beside the credit can also leave the
ring: smc_curs_add() subtracts the size only once, so a diff of two
buffers or more leaves tx_curs_sent.count at or above sndbuf_desc->len,
and smc_tx_rdma_writes() uses that count as a source offset.
A peer reaches this path on an SMC-R link group with a second link by
asking for the active one to be deleted:
smc_llc_rx_delete_link()
smc_llc_process_cli_delete_link()
smc_switch_conns()
smc_switch_cursor()
An honest peer cannot have consumed more than this side has outstanding,
so bound the catch-up by that. For a correct peer the bound changes
nothing. For a lying one sndbuf_space keeps the invariant that
smc_tx_sendmsg(), smc_tx_prepared_sends() and SIOCOUTQ in smc_ioctl()
all depend on, and both cursors stay inside the send buffer.
Bounding the credit where it is added is deliberate. Clamping the copy
length in smc_tx_sendmsg() instead stops the overflow but leaves
sndbuf_space inflated, so the producer never blocks in smc_tx_wait(),
later writes can overwrite data that has not been sent yet, and SIOCOUTQ
reports a negative queue length.
How this was found: by AI-driven fuzzing built on top of syzkaller. It
reached the overflow through the other writer of sndbuf_space, the
DMB-nocopy credit patched next, on a loopback-ism connection with the
peer's consumer cursor forged by a debug patch: KASAN reported an
869056-byte write past the send buffer in smc_tx_sendmsg()
(use-after-free in _copy_from_iter). The failover route above was then
found by reading the other writers of that counter; we do not have a
multi-link SMC-R group with two RDMA devices, so that route comes from
the code and not from a run. The bound was tested on the path we can
drive, where the forged cursor no longer inflates sndbuf_space and the
write stays inside the buffer.
Fixes: c6f02ebeea3a ("net/smc: switch connections to alternate link")
Cc: stable@vger.kernel.org
Signed-off-by: Kapil Vaswani <kapil@presceralabs.ai>
Signed-off-by: Piyus Kedia <piyus@iiitd.ac.in>
---
Link: https://lore.kernel.org/all/20261122053223.2497832-2-piyus@iiitd.ac.in/
Changes in v2:
- Corrected the threat model, which was wrong in v1 in a way that matters.
v1's subject and commit message named the SMC-D DMB-nocopy path as the
attack. That path runs only when smc_ism_support_dmb_nocopy() is true,
which needs a dibs device providing support_mmapped_rdmb(), and the only
provider in the tree is drivers/dibs/dibs_loopback.c - where both ends of
the connection are the same kernel and the cursor is written by SMC
itself. It is not reachable from a hostile peer. The remotely reachable
writer is smc_switch_cursor(), which v1 did not mention at all; it is
patch 1/2 here.
- Replaced the fix. v1 clamped the copy length in smc_tx_sendmsg(). That
stops the overflow but leaves sndbuf_space inflated, so the producer never
blocks in smc_tx_wait(), later writes can overwrite data that has not been
sent yet while sendmsg() reports success, smc_tx_prepared_sends()
misreports pending bytes, and SIOCOUTQ in smc_ioctl() returns a negative
queue length. v2 bounds the credit where it is added instead, and does
not touch smc_tx.c.
- Fixed a second fault v1 left alone: the cursors advanced beside the credit
in smc_switch_cursor() could also leave the ring, because smc_curs_add()
subtracts the size only once, and smc_tx_rdma_writes() uses
tx_curs_sent.count as a source offset. Bounding the difference fixes both.
- Added Fixes: tags to both patches, each confirmed by blaming the
atomic_add() in question, and Cc: stable to 1/2 only. 2/2 is unreachable
on any device in the tree, so by stable-kernel-rules it is not a bug that
bothers anyone.
- One patch became two, since the two sites have different Fixes: tags and
different reachability.
Measured, and not: the overflow and the fix were both measured on a
loopback-ism connection with the peer's consumer cursor forged by a debug
patch - KASAN reported an 869056-byte write past a 65504-byte send buffer
without the series, and with it no report at forged cursors of 100000,
1000000 and 2000000, the credit refused because nothing was outstanding, and
ordinary SMC-D traffic unaffected (SMC_DIAG mode=2, fb_reason=0x0). The
route to the writer in 1/2 is from reading the code: we have no multi-link
SMC-R group with two RDMA devices, so the LLC DELETE_LINK path to
smc_switch_cursor() has not been exercised here.
The receive side has the same unclamped second chunk in smc_rx_recvmsg(),
credited from the peer's producer cursor; that is a separate patch, "net/smc:
validate the peer's CDC cursors against our own buffers". The two are
independent: that one bounds cons by peer_rmbe_size, which still permits "I
consumed more than you sent", so it does not bound the credit this series
bounds.
net/smc/smc_core.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
index a3164201c142..436a702f3d8d 100644
--- a/net/smc/smc_core.c
+++ b/net/smc/smc_core.c
@@ -1057,6 +1057,7 @@ static int smc_switch_cursor(struct smc_sock *smc, struct smc_cdc_tx_pend *pend,
union smc_host_cursor cons, fin;
int rc = 0;
int diff;
+ int sent;
smc_curs_copy(&conn->tx_curs_sent, &conn->tx_curs_fin, conn);
smc_curs_copy(&fin, &conn->local_tx_ctrl_fin, conn);
@@ -1069,6 +1070,16 @@ static int smc_switch_cursor(struct smc_sock *smc, struct smc_cdc_tx_pend *pend,
* fin above, so now prod is smaller than cons. Fix that.
*/
diff = smc_curs_diff(conn->peer_rmbe_size, &fin, &cons);
+ /* The peer's consumer cursor is taken as it arrives, so this
+ * difference is a value the peer chose. An honest peer cannot
+ * have consumed more than this side has outstanding, so bound
+ * the catch-up by that: sndbuf_space then keeps the invariant
+ * the tx path relies on, and the cursors advanced below stay
+ * within the send buffer.
+ */
+ sent = conn->sndbuf_desc->len - atomic_read(&conn->sndbuf_space);
+ diff = min_t(int, diff, max_t(int, sent, 0));
+
smc_curs_add(conn->sndbuf_desc->len,
&conn->tx_curs_sent, diff);
smc_curs_add(conn->sndbuf_desc->len,
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net v2 2/2] net/smc: bound the DMB-nocopy send-buffer credit as well
2026-11-23 13:53 [PATCH net v2 1/2] net/smc: bound the failover cursor catch-up by what is outstanding Piyus Kedia
@ 2026-11-23 13:53 ` Piyus Kedia
2026-11-24 13:53 ` sashiko-bot
2026-11-24 13:53 ` [PATCH net v2 1/2] net/smc: bound the failover cursor catch-up by what is outstanding sashiko-bot
1 sibling, 1 reply; 4+ messages in thread
From: Piyus Kedia @ 2026-11-23 13:53 UTC (permalink / raw)
To: alibuda, Dust Li, Sidraya Jayagond, Mahanta Jambigi, netdev
Cc: Tony Lu, Wen Gu, linux-rdma, linux-s390, linux-kernel,
Kapil Vaswani, Piyus Kedia
smc_cdc_msg_recv_action() credits sndbuf_space from the peer's consumer
cursor on the SMC-D DMB-nocopy path and then assigns that cursor to this
side's tx_curs_fin:
diff_tx = smc_curs_diff(conn->sndbuf_desc->len,
&conn->tx_curs_fin,
&conn->local_rx_ctrl.cons);
/* increase local sndbuf space and fin_curs */
smp_mb__before_atomic();
atomic_add(diff_tx, &conn->sndbuf_space);
/* guarantee 0 <= sndbuf_space <= sndbuf_desc->len */
smp_mb__after_atomic();
smc_curs_copy(&conn->tx_curs_fin,
&conn->local_rx_ctrl.cons, conn);
sndbuf_space can already be non-zero when this runs, so the sum can
exceed sndbuf_desc->len and the comment asserting otherwise does not
hold; smcd_cdc_msg_to_host() takes the cursor in host order with no
validation, so tx_curs_fin can also be assigned a count outside the send
buffer.
Unlike the failover path in the previous patch this is not reachable from
a hostile peer today. The branch runs only when
smc_ism_support_dmb_nocopy() is true, which needs a dibs device providing
support_mmapped_rdmb(), and the only provider is
drivers/dibs/dibs_loopback.c - where both ends of the connection are the
same kernel and the cursor is written by SMC itself. So this is
hardening rather than a fix for an observed attack: it keeps the
invariant in the comment true by construction, keeps the cursor inside
the buffer, and stops a future device that implements the op from
inheriting the problem.
Bound the credit by what this side has outstanding and advance
tx_curs_fin by the bounded amount instead of assigning the reported
cursor. For a cursor that reflects real consumption both are the value
that is used today.
How this was found: by AI-driven fuzzing built on top of syzkaller, on a
loopback-ism connection with the peer's consumer cursor forged by a debug
patch so that it reports consuming data this side never sent. KASAN
reported an 869056-byte write past the send buffer in smc_tx_sendmsg()
(use-after-free in _copy_from_iter). With this patch the same forged
cursor credits nothing beyond the outstanding bytes.
Fixes: cc0ab806fc52 ("net/smc: adapt cursor update when sndbuf and peer DMB are merged")
Signed-off-by: Kapil Vaswani <kapil@presceralabs.ai>
Signed-off-by: Piyus Kedia <piyus@iiitd.ac.in>
---
Link: https://lore.kernel.org/all/20261122053223.2497832-2-piyus@iiitd.ac.in/
This is 2/2 of a two-patch series; there is no cover letter. The v2
changelog is under the --- line of patch 1/2, and in short: v1 was a single
patch that clamped the copy length in smc_tx_sendmsg() and named this
DMB-nocopy path as a remote attack. Both were wrong - the clamp left
sndbuf_space inflated, and this path is reachable only on loopback-ism, where
both ends are the same kernel. v2 bounds the credit at both sites where it is
added; this patch is the hardening half.
net/smc/smc_cdc.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/net/smc/smc_cdc.c b/net/smc/smc_cdc.c
index 32d6d03df321..9ffa3e422aa1 100644
--- a/net/smc/smc_cdc.c
+++ b/net/smc/smc_cdc.c
@@ -333,6 +333,7 @@ static void smc_cdc_msg_recv_action(struct smc_sock *smc,
union smc_host_cursor cons_old, prod_old;
struct smc_connection *conn = &smc->conn;
int diff_cons, diff_prod, diff_tx;
+ int sent;
smc_curs_copy(&prod_old, &conn->local_rx_ctrl.prod, conn);
smc_curs_copy(&cons_old, &conn->local_rx_ctrl.cons, conn);
@@ -361,13 +362,26 @@ static void smc_cdc_msg_recv_action(struct smc_sock *smc,
diff_tx = smc_curs_diff(conn->sndbuf_desc->len,
&conn->tx_curs_fin,
&conn->local_rx_ctrl.cons);
+ /* This difference comes from the cursor the peer
+ * reported, which is taken as it arrives. A peer
+ * cannot have consumed more than this side has
+ * outstanding, so bound it by that and advance
+ * tx_curs_fin by the bounded amount rather than
+ * assigning the reported cursor: the invariant below
+ * then holds by construction, and tx_curs_fin stays
+ * inside the send buffer.
+ */
+ sent = conn->sndbuf_desc->len -
+ atomic_read(&conn->sndbuf_space);
+ diff_tx = min_t(int, diff_tx, max_t(int, sent, 0));
+
/* increase local sndbuf space and fin_curs */
smp_mb__before_atomic();
atomic_add(diff_tx, &conn->sndbuf_space);
/* guarantee 0 <= sndbuf_space <= sndbuf_desc->len */
smp_mb__after_atomic();
- smc_curs_copy(&conn->tx_curs_fin,
- &conn->local_rx_ctrl.cons, conn);
+ smc_curs_add(conn->sndbuf_desc->len,
+ &conn->tx_curs_fin, diff_tx);
smc_tx_sndbuf_nonfull(smc);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net v2 1/2] net/smc: bound the failover cursor catch-up by what is outstanding
2026-11-23 13:53 [PATCH net v2 1/2] net/smc: bound the failover cursor catch-up by what is outstanding Piyus Kedia
2026-11-23 13:53 ` [PATCH net v2 2/2] net/smc: bound the DMB-nocopy send-buffer credit as well Piyus Kedia
@ 2026-11-24 13:53 ` sashiko-bot
1 sibling, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-11-24 13:53 UTC (permalink / raw)
To: Piyus Kedia
Cc: linux-rdma, linux-s390, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] net/smc: smc_switch_cursor() bounds catch-up by prepared
instead of sent bytes
- [High] net/smc: smc_switch_cursor() clamp leaves local_tx_ctrl.prod
behind cons
--
commit d641bcdb06babb4611de33b1b2a3ed34727ace6d
Author: Piyus Kedia <piyus@iiitd.ac.in>
net/smc: bound the failover cursor catch-up by what is outstanding
This commit bounds the cursor catch-up diff in smc_switch_cursor() by
conn->sndbuf_desc->len - atomic_read(&conn->sndbuf_space) so a peer's
consumer cursor cannot credit conn->sndbuf_space past the send buffer size.
Link: https://lore.kernel.org/all/20261122053223.2497832-2-piyus@iiitd.ac.in/
> diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
> index a3164201c1420..436a702f3d8de 100644
> --- a/net/smc/smc_core.c
> +++ b/net/smc/smc_core.c
> @@ -1057,6 +1057,7 @@ static int smc_switch_cursor(struct smc_sock *smc, struct smc_cdc_tx_pend *pend,
> union smc_host_cursor cons, fin;
> int rc = 0;
> int diff;
> + int sent;
>
> smc_curs_copy(&conn->tx_curs_sent, &conn->tx_curs_fin, conn);
> smc_curs_copy(&fin, &conn->local_tx_ctrl_fin, conn);
> @@ -1069,6 +1070,16 @@ static int smc_switch_cursor(struct smc_sock *smc, struct smc_cdc_tx_pend *pend,
> * fin above, so now prod is smaller than cons. Fix that.
> */
> diff = smc_curs_diff(conn->peer_rmbe_size, &fin, &cons);
> + /* The peer's consumer cursor is taken as it arrives, so this
> + * difference is a value the peer chose. An honest peer cannot
> + * have consumed more than this side has outstanding, so bound
> + * the catch-up by that: sndbuf_space then keeps the invariant
> + * the tx path relies on, and the cursors advanced below stay
> + * within the send buffer.
> + */
> + sent = conn->sndbuf_desc->len - atomic_read(&conn->sndbuf_space);
[Severity: High]
Does conn->sndbuf_desc->len - atomic_read(&conn->sndbuf_space) measure all
prepared bytes in the send buffer (tx_curs_prep - tx_curs_fin) rather than the
unconfirmed bytes actually transmitted to the peer RMBE (tx_curs_sent -
tx_curs_fin before tx_curs_sent is overwritten above)?
When prepared but unsent data sits between tx_curs_sent and tx_curs_prep (for
example due to corking, autocorking, or a full peer RMBE), advancing
tx_curs_sent and tx_curs_fin up to sent skips over unsent payload in sndbuf
and credits sndbuf_space for data that was never put on the wire. Also, when
conn->sndbuf_desc->len > conn->peer_rmbe_size, sent can exceed
conn->peer_rmbe_size, allowing smc_curs_add(conn->peer_rmbe_size, ...) below
(which subtracts peer_rmbe_size only once) to leave local_tx_ctrl.prod.count
at or above conn->peer_rmbe_size. Finally, advancing tx_curs_fin past the old
tx_curs_sent moves it ahead of any in-flight cdcpend->cursor on the old link
(which is drained via smc_wr_tx_wait_no_pending_sends() only after
smc_switch_conns() returns), so a completing CQE on the old link in
smc_cdc_tx_handler() either computes a wrapped diff or rewinds tx_curs_fin and
lets the new link's validation CQE double-credit sndbuf_space above
sndbuf_desc->len.
Computing the bound from smc_curs_diff(conn->sndbuf_desc->len,
&conn->tx_curs_fin, &conn->tx_curs_sent) before overwriting conn->tx_curs_sent
would limit the catch-up to bytes actually sent on the old link.
> + diff = min_t(int, diff, max_t(int, sent, 0));
[Severity: High]
When this clamp reduces diff below smc_curs_diff(conn->peer_rmbe_size, &fin,
&cons), does leaving conn->local_rx_ctrl.cons unclamped leave
conn->local_tx_ctrl.prod behind conn->local_rx_ctrl.cons after this block?
smc_switch_cursor() resets conn->local_tx_ctrl.prod to fin and relies on
adding diff to bring prod up to cons, then immediately updates peer_rmbe_space
via smc_write_space():
net/smc/smc_core.c:smc_write_space() {
...
smc_curs_copy(&prod, &conn->local_tx_ctrl.prod, conn);
smc_curs_copy(&cons, &conn->local_rx_ctrl.cons, conn);
/* determine rx_buf space */
space = buffer_len - smc_curs_diff(buffer_len, &cons, &prod);
return space;
}
Both smc_curs_diff(buffer_len, &cons, &prod) and smc_tx_rdma_writes() assume
cons <= prod. If prod < cons across a wrap boundary (prod.wrap != cons.wrap),
smc_curs_diff() takes the old->wrap != new->wrap branch and returns
(buffer_len - cons.count) + prod.count; when prod.count > cons.count that
exceeds buffer_len and makes peer_rmbe_space negative, and when
peer_rmbe_space > 0 smc_tx_rdma_writes() sees prod.wrap != cons.wrap, skips
clamping dst_len to conn->peer_rmbe_size - prod.count, and can RDMA-write past
the end of the peer RMBE.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261123135327.3953509-1-piyus@iiitd.ac.in?part=1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net v2 2/2] net/smc: bound the DMB-nocopy send-buffer credit as well
2026-11-23 13:53 ` [PATCH net v2 2/2] net/smc: bound the DMB-nocopy send-buffer credit as well Piyus Kedia
@ 2026-11-24 13:53 ` sashiko-bot
0 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-11-24 13:53 UTC (permalink / raw)
To: Piyus Kedia
Cc: linux-rdma, linux-s390, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] net/smc: smc_cdc_msg_recv_action() bounds diff_tx by prepared
not sent bytes
- [Medium] net/smc: smc_cdc_msg_recv_action() leaves local_rx_ctrl.cons
unclamped
--
commit 07f52f148d1ba914d6b4ce3e90b172be0a15f763
Author: Piyus Kedia <piyus@iiitd.ac.in>
net/smc: bound the DMB-nocopy send-buffer credit as well
This commit bounds the send-buffer credit on the SMC-D DMB-nocopy path in
smc_cdc_msg_recv_action() by the amount of data outstanding in the send
buffer and advances tx_curs_fin by the bounded amount.
Link: https://lore.kernel.org/all/20261122053223.2497832-2-piyus@iiitd.ac.in/
> diff --git a/net/smc/smc_cdc.c b/net/smc/smc_cdc.c
> index 32d6d03df3214..9ffa3e422aa1f 100644
> --- a/net/smc/smc_cdc.c
> +++ b/net/smc/smc_cdc.c
> @@ -333,6 +333,7 @@ static void smc_cdc_msg_recv_action(struct smc_sock *smc,
> union smc_host_cursor cons_old, prod_old;
> struct smc_connection *conn = &smc->conn;
> int diff_cons, diff_prod, diff_tx;
> + int sent;
>
> smc_curs_copy(&prod_old, &conn->local_rx_ctrl.prod, conn);
> smc_curs_copy(&cons_old, &conn->local_rx_ctrl.cons, conn);
> @@ -361,13 +362,26 @@ static void smc_cdc_msg_recv_action(struct smc_sock *smc,
> diff_tx = smc_curs_diff(conn->sndbuf_desc->len,
> &conn->tx_curs_fin,
> &conn->local_rx_ctrl.cons);
> + /* This difference comes from the cursor the peer
> + * reported, which is taken as it arrives. A peer
> + * cannot have consumed more than this side has
> + * outstanding, so bound it by that and advance
> + * tx_curs_fin by the bounded amount rather than
> + * assigning the reported cursor: the invariant below
> + * then holds by construction, and tx_curs_fin stays
> + * inside the send buffer.
> + */
> + sent = conn->sndbuf_desc->len -
> + atomic_read(&conn->sndbuf_space);
> + diff_tx = min_t(int, diff_tx, max_t(int, sent, 0));
[Severity: Medium]
Can bounding diff_tx by conn->sndbuf_desc->len - sndbuf_space still advance
conn->tx_curs_fin past conn->tx_curs_sent and credit sndbuf_space for
prepared data that has not been sent yet?
smc_tx_sendmsg() advances conn->tx_curs_prep and subtracts copylen from
conn->sndbuf_space as soon as data is copied into the send buffer, before
smc_tx_sndbuf_nonempty() advances conn->tx_curs_sent (which is skipped when
corked via MSG_MORE or TCP_CORK). When prepared-but-unsent bytes exist,
conn->sndbuf_desc->len - sndbuf_space includes [tx_curs_sent, tx_curs_prep),
so a peer consumer cursor ahead of tx_curs_sent pushes tx_curs_fin past
tx_curs_sent and allows subsequent smc_tx_sendmsg() calls to overwrite the
unsent bytes. Should sent be computed with smc_curs_diff() between
conn->tx_curs_fin and conn->tx_curs_sent, as smcd_cdc_msg_send() does?
> /* increase local sndbuf space and fin_curs */
> smp_mb__before_atomic();
> atomic_add(diff_tx, &conn->sndbuf_space);
> /* guarantee 0 <= sndbuf_space <= sndbuf_desc->len */
> smp_mb__after_atomic();
> - smc_curs_copy(&conn->tx_curs_fin,
> - &conn->local_rx_ctrl.cons, conn);
> + smc_curs_add(conn->sndbuf_desc->len,
> + &conn->tx_curs_fin, diff_tx);
[Severity: Medium]
Does advancing conn->tx_curs_fin by the clamped diff_tx while leaving
conn->local_rx_ctrl.cons at the peer's raw cursor desynchronize the two
cursors for subsequent CDC messages?
smc_cdc_msg_to_host() has already written the unclamped cursor into
conn->local_rx_ctrl.cons. Once diff_tx is clamped, local_rx_ctrl.cons sits
ahead of tx_curs_fin: if more data is sent and the peer advances its forged
cursor by 1 byte, diff_cons is 1 and smc_cdc_msg_recv_action() recomputes
diff_tx across the entire remaining gap between tx_curs_fin and the forged
local_rx_ctrl.cons, crediting all newly sent bytes at once (whereas a later
valid cursor below the forged cons_old yields diff_cons == 0 and credits
nothing).
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261123135327.3953509-1-piyus@iiitd.ac.in?part=2
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-24 13:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 13:53 [PATCH net v2 1/2] net/smc: bound the failover cursor catch-up by what is outstanding Piyus Kedia
2026-11-23 13:53 ` [PATCH net v2 2/2] net/smc: bound the DMB-nocopy send-buffer credit as well Piyus Kedia
2026-11-24 13:53 ` sashiko-bot
2026-11-24 13:53 ` [PATCH net v2 1/2] net/smc: bound the failover cursor catch-up by what is outstanding sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox