All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: Tanuj Sharma <ertanuj96@gmail.com>,
	"rtl8821cerfe2@gmail.com" <rtl8821cerfe2@gmail.com>
Cc: "security@kernel.org" <security@kernel.org>,
	"kvalo@kernel.org" <kvalo@kernel.org>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: RE: [PATCH v2] wifi: rtlwifi: fix P2P NoA bounds check using truncated length
Date: Tue, 1 Dec 2026 02:59:05 +0000	[thread overview]
Message-ID: <4999a75ee6e24db18c019bb6e5fcda6a@realtek.com> (raw)
In-Reply-To: <20261130205750.64080-1-ertanuj96@gmail.com>

Tanuj Sharma <ertanuj96@gmail.com> wrote:
> Both rtl_p2p_noa_ie() and rtl_p2p_action_ie() parse P2P sub-elements
> whose length field is 16 bits (little-endian at bytes 1-2 of each
> sub-element header). The code reads the full 16-bit value into noa_len:
> 
>     noa_len = le16_to_cpu(*((__le16 *)&ie[1]));
> 
> but the bounds check only uses the low byte:
> 
>     if (ie + 3 + ie[1] > end)
> 
> When the high byte (ie[2]) is non-zero, the bounds check passes with a
> smaller value than the actual length, allowing the inner NOA descriptor
> loop to read up to 26 bytes past the validated region. Use noa_len in the
> bounds check to match the actual length used for parsing.
> 
> Additionally, the while loop condition 'ie + 1 < end' only guarantees
> ie[0] and ie[1] are readable, but the le16_to_cpu read accesses both
> ie[1] and ie[2]. Change the condition to 'ie + 2 < end' to ensure the
> full 3-byte sub-element header (attribute ID + 16-bit length) is
> accessible before reading.
> 
> Cc: stable@vger.kernel.org
> Fixes: 8c55dedb795b ("rtlwifi: Fix potential overflow on P2P code")

I think Fixes should be:

Fixes: 26634c4b1868 ("rtlwifi Modify existing bits to match vendor version 2013.02.07")

> Signed-off-by: Tanuj Sharma <ertanuj96@gmail.com>

Otherwise, looks good to me.

Acked-by: Ping-Ke Shih <pkshih@realtek.com>




  reply	other threads:[~2026-12-01  2:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <d2a222a066a1419a89d1c8b2c119066a@realtek.com>
2026-11-30 20:57 ` [PATCH v2] wifi: rtlwifi: fix P2P NoA bounds check using truncated length Tanuj Sharma
2026-12-01  2:59   ` Ping-Ke Shih [this message]
2026-12-01  7:34     ` [PATCH v3] " Tanuj Sharma

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=4999a75ee6e24db18c019bb6e5fcda6a@realtek.com \
    --to=pkshih@realtek.com \
    --cc=ertanuj96@gmail.com \
    --cc=kvalo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=rtl8821cerfe2@gmail.com \
    --cc=security@kernel.org \
    --cc=stable@vger.kernel.org \
    /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 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.