public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Ashutosh Desai <ashutoshdesai993@gmail.com>
To: netdev@vger.kernel.org
Cc: linux-hams@vger.kernel.org, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	horms@kernel.org, linux-kernel@vger.kernel.org,
	Ashutosh Desai <ashutoshdesai993@gmail.com>
Subject: [PATCH] net: rose: use pskb_may_pull() in CLEAR_REQUEST length check
Date: Mon, 20 Apr 2026 01:57:23 +0000	[thread overview]
Message-ID: <20260420015723.462479-1-ashutoshdesai993@gmail.com> (raw)

Commit 2835750dd647 ("net: rose: reject truncated CLEAR_REQUEST frames
in state machines") guards against short CLEAR_REQUEST frames using a
plain skb->len comparison. Use pskb_may_pull() instead, which both
enforces the length requirement and ensures the bytes are in the linear
part of the skb, making the subsequent accesses to skb->data[3] and
skb->data[4] safe for non-linear buffers.

Suggested-by: Simon Horman <horms@kernel.org>
Signed-off-by: Ashutosh Desai <ashutoshdesai993@gmail.com>
---
 net/rose/rose_in.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/rose/rose_in.c b/net/rose/rose_in.c
index ca4f217ef3d3..48183363d3f9 100644
--- a/net/rose/rose_in.c
+++ b/net/rose/rose_in.c
@@ -274,7 +274,7 @@ int rose_process_rx_frame(struct sock *sk, struct sk_buff *skb)
 	 * ROSE_CLEAR_REQUEST carries cause and diagnostic in bytes 3..4.
 	 * Reject a malformed frame that is too short to contain them.
 	 */
-	if (frametype == ROSE_CLEAR_REQUEST && skb->len < 5)
+	if (frametype == ROSE_CLEAR_REQUEST && !pskb_may_pull(skb, 5))
 		return 0;
 
 	switch (rose->state) {
-- 
2.34.1


             reply	other threads:[~2026-04-20  1:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-20  1:57 Ashutosh Desai [this message]
2026-04-20 13:04 ` [PATCH] net: rose: use pskb_may_pull() in CLEAR_REQUEST length check Andrew Lunn
2026-04-21  2:27   ` Ashutosh Desai
2026-04-21  2:50     ` Andrew Lunn

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=20260420015723.462479-1-ashutoshdesai993@gmail.com \
    --to=ashutoshdesai993@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-hams@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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