Linux bluetooth development
 help / color / mirror / Atom feed
From: Muhammad Bilal <meatuni001@gmail.com>
To: michael.bommarito@gmail.com
Cc: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
	marcel@holtmann.org, luiz.dentz@gmail.com,
	johan.hedberg@gmail.com
Subject: Re: [PATCH] Bluetooth: L2CAP: rate-limit ECHO_RSP per signaling PDU
Date: Sun, 17 May 2026 21:00:19 -0400	[thread overview]
Message-ID: <20260518010019.121323-1-meatuni001@gmail.com> (raw)
In-Reply-To: <20260518002800.1361430-1-michael.bommarito@gmail.com>

Hi Michael,

Thanks for the patch. The ECHO_REQ cap addresses one amplification
vector, but the same N:1 amplification appears reachable via the
unknown-command path in the same loop.

When l2cap_bredr_sig_cmd() returns an error for an unrecognised command
code, the loop calls l2cap_sig_send_rej() unconditionally:

        err = l2cap_bredr_sig_cmd(conn, cmd, len, skb->data);
        if (err) {
                BT_ERR("Wrong link type (%d)", err);
                l2cap_sig_send_rej(conn, cmd->ident);
        }

A peer that packs N commands with an unknown code (e.g. 0xFF, len = 0)
into a single signaling PDU would trigger N calls to
l2cap_sig_send_rej(), sending N COMMAND_REJ responses,
bypassing the new L2CAP_SIG_ECHO_BURST limit entirely. This produces
the same TX queue saturation the patch intends to prevent, and also
floods the kernel log with N BT_ERR() writes per PDU.

A response counter covering all outbound responses generated per PDU
would close both paths. Something like:

        int resp_count = 0;

        /* in the error path: */
        if (err) {
                if (++resp_count <= L2CAP_SIG_ECHO_BURST) {
                        BT_ERR("Wrong link type (%d)", err);
                        l2cap_sig_send_rej(conn, cmd->ident);
                }
                continue;
        }

        /* existing echo path: */
        if (cmd->code == L2CAP_ECHO_REQ &&
            ++resp_count > L2CAP_SIG_ECHO_BURST) {
                skb_pull(skb, len);
                continue;
        }

Using pr_warn_ratelimited() instead of BT_ERR() in the loop would
also reduce log amplification independent of the skb path.

Regards,
Muhammad Bilal

  reply	other threads:[~2026-05-18  1:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-18  0:28 [PATCH] Bluetooth: L2CAP: rate-limit ECHO_RSP per signaling PDU Michael Bommarito
2026-05-18  1:00 ` Muhammad Bilal [this message]
2026-05-18  1:03   ` Michael Bommarito
2026-05-18 21:27     ` Luiz Augusto von Dentz
2026-05-18 21:37       ` Luiz Augusto von Dentz
2026-05-19  0:42         ` Michael Bommarito
2026-05-19 16:02           ` Luiz Augusto von Dentz
2026-05-18  2:04 ` bluez.test.bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260518010019.121323-1-meatuni001@gmail.com \
    --to=meatuni001@gmail.com \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    --cc=michael.bommarito@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox