Linux kernel staging patches
 help / color / mirror / Atom feed
From: Ivy Lopez <skunkolee@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Ovidiu Panait <ovidiu.panait.oss@gmail.com>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	Ivy Lopez <skunkolee@gmail.com>
Subject: [PATCH] staging: axis-fifo: validate tx_fifo_depth from device tree
Date: Thu, 30 Jul 2026 18:01:36 -0600	[thread overview]
Message-ID: <20260731000136.96707-1-skunkolee@gmail.com> (raw)

tx_fifo_depth is read from the "xlnx,tx-fifo-depth" device tree
property with no lower-bound check. It is later used in
axis_fifo_write() as (fifo->tx_fifo_depth - 4), an unsigned
subtraction, to bound the size of writes accepted from userspace.
If tx_fifo_depth is less than 4, this subtraction underflows,
defeating the check that exists specifically to prevent a
'Transmit Packet Overrun Error' requiring a reset of the TX
circuit to recover.

Reject tx_fifo_depth values below 4 at parse time, consistent
with the existing validation of the tdata-width properties in
the same function.

Signed-off-by: Ivy Lopez <skunkolee@gmail.com>
---
 drivers/staging/axis-fifo/axis-fifo.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-fifo/axis-fifo.c
index 3aa2aa870ea9..66845f919375 100644
--- a/drivers/staging/axis-fifo/axis-fifo.c
+++ b/drivers/staging/axis-fifo/axis-fifo.c
@@ -413,6 +413,8 @@ static int axis_fifo_parse_dt(struct axis_fifo *fifo)
 				   &fifo->tx_fifo_depth);
 	if (ret)
 		return ret;
+	if (fifo->tx_fifo_depth < 4)
+		return -EINVAL;
 
 	ret = of_property_read_u32(node, "xlnx,use-rx-data",
 				   &fifo->has_rx_fifo);
-- 
2.55.0


                 reply	other threads:[~2026-07-31  0:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260731000136.96707-1-skunkolee@gmail.com \
    --to=skunkolee@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=ovidiu.panait.oss@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