Netdev List
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: "Loktionov, Aleksandr" <aleksandr.loktionov@intel.com>
Cc: "Жамбакиев Радий Рикардинович" <r.zhambakiev@prosoftsystems.ru>,
	"Andrew Lunn" <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Michael Grzeschik" <mgr@kernel.org>,
	"Jijie Shao" <shaojijie@huawei.com>,
	"Denis Benato" <benato.denis96@gmail.com>,
	"Uwe Kleine-König (The Capable Hub)"
	<u.kleine-koenig@baylibre.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"lvc-project@linuxtesting.org" <lvc-project@linuxtesting.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH net v3 3/3] net: fealnx: bound card_idx to prevent out-of-bounds access
Date: Wed, 21 Oct 2026 19:26:36 +0200	[thread overview]
Message-ID: <d9d7342b-49fd-4256-9829-bf1e3f88f973@lunn.ch> (raw)
In-Reply-To: <CH3PR11MB566895CD7DE8923616D891C85BE5662@CH3PR11MB566895.namprd11.prod.outlook.com>

> > +	if (card_idx >= MAX_CARD_IDX) {
> > +		dev_err(&pdev->dev, "card_idx is too big %d, aborting",
> > card_idx);
> > +		return -ENODEV;
> > +	}
> >  	card_idx++;
> card_idx can reach 100000 is it ok? 

It is one of those stupid LLM issues which never happens, but
$DEVELOPER wants to fix it anyway.

If you unbind and bind the device lots, you can eventually get
card_idx to overflow. Assuming card_idx is a 32 bit int, and it takes
10ms to unbind/bind, you could make it overflow in about 18 months.

100,000 iterations makes it around 16 hours, which is feasible, so i
hope the submitted has tested it. But probably not, it is just
pointless LLM churn wasting all our time.

     Andrew

      reply	other threads:[~2026-10-21 17:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19 13:42 [PATCH net v3 0/3] net: fealnx: fix card-index overflow and PCI device teardown Жамбакиев Радий Рикардинович
2026-10-19 13:42 ` [PATCH net v3 1/3] net: fealnx: fix teardown order in remove Жамбакиев Радий Рикардинович
2026-10-19 15:44   ` Andrew Lunn
2026-10-19 13:42 ` [PATCH net v3 2/3] net: fealnx: disable the PCI device on remove and probe failure Жамбакиев Радий Рикардинович
2026-10-21 10:41   ` Loktionov, Aleksandr
2026-10-19 13:43 ` [PATCH net v3 3/3] net: fealnx: bound card_idx to prevent out-of-bounds access Жамбакиев Радий Рикардинович
2026-10-19 14:46   ` Fedor Pchelkin
2026-10-19 15:47   ` Andrew Lunn
2026-10-21 11:10   ` Loktionov, Aleksandr
2026-10-21 17:26     ` Andrew Lunn [this message]

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=d9d7342b-49fd-4256-9829-bf1e3f88f973@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=aleksandr.loktionov@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=benato.denis96@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=mgr@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=r.zhambakiev@prosoftsystems.ru \
    --cc=shaojijie@huawei.com \
    --cc=stable@vger.kernel.org \
    --cc=u.kleine-koenig@baylibre.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