From: Ilya Krutskih <devsec@tpz.ru>
To: Andrew Lunn <andrew+netdev@lunn.ch>
Cc: Ilya Krutskih <devsec@tpz.ru>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@kernel.org>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <lvc-project@linuxtesting.org>,
<stable@vger.kernel.org>
Subject: [PATCH v2] net: fealnx: fix possible 'card_idx' integer overflow in
Date: Thu, 11 Dec 2025 17:30:33 +0000 [thread overview]
Message-ID: <20251211173035.852756-1-devsec@tpz.ru> (raw)
'card_idx' can be overflowed when fealnx_init_one() will be called more than
INT_MAX times. Check before incremention is required.
Fixes: 15c037d6423e ("fealnx: Move the Myson driver")
Cc: stable@vger.kernel.org # v5.10+
Signed-off-by: Ilya Krutskih <devsec@tpz.ru>
---
drivers/net/ethernet/fealnx.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/fealnx.c b/drivers/net/ethernet/fealnx.c
index 6ac8547ef9b8..7eb6e42b4551 100644
--- a/drivers/net/ethernet/fealnx.c
+++ b/drivers/net/ethernet/fealnx.c
@@ -489,7 +489,10 @@ static int fealnx_init_one(struct pci_dev *pdev,
int bar = 1;
#endif
- card_idx++;
+ if (card_idx == INT_MAX)
+ return -EINVAL;
+ else
+ card_idx++;
sprintf(boardname, "fealnx%d", card_idx);
option = card_idx < MAX_UNITS ? options[card_idx] : 0;
--
2.43.0
next reply other threads:[~2025-12-11 17:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-11 17:30 Ilya Krutskih [this message]
2025-12-12 9:45 ` [PATCH v2] net: fealnx: fix possible 'card_idx' integer overflow in Simon Horman
2025-12-12 11:30 ` kernel test robot
2025-12-12 14:46 ` Simon Horman
2025-12-12 17:36 ` David Laight
2025-12-13 0:21 ` Francois Romieu
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=20251211173035.852756-1-devsec@tpz.ru \
--to=devsec@tpz.ru \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=mingo@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).