public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: arcnet: com20020-pci: fix support for 2.5Mbit cards
@ 2026-02-05  6:51 Ethan Nelson-Moore
  2026-02-09 15:41 ` Simon Horman
  0 siblings, 1 reply; 4+ messages in thread
From: Ethan Nelson-Moore @ 2026-02-05  6:51 UTC (permalink / raw)
  To: netdev
  Cc: Ethan Nelson-Moore, stable, Michael Grzeschik, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Zheyu Ma

Commit 8c14f9c70327 ("ARCNET: add com20020 PCI IDs with metadata")
converted the com20020-pci driver to use a card info structure instead
of a single flag mask in driver_data. However, it failed to take into
account that in the original code, driver_data of 0 indicates a card
with no special flags, not a card that should not have any card info
structure. This introduced a null pointer dereference when cards with
no flags were probed.

Commit bd6f1fd5d33d ("net: arcnet: com20020: Fix null-ptr-deref in
com20020pci_probe()") then papered over this issue by rejecting cards
with no driver_data instead of resolving the problem at its source.

Revert the incorrect fix and fix the original issue by introducing a
new card info structure for 2.5Mbit cards that does not set any flags.

Fixes: 8c14f9c70327 ("ARCNET: add com20020 PCI IDs with metadata")
Fixes: bd6f1fd5d33d ("net: arcnet: com20020: Fix null-ptr-deref in com20020pci_probe()")
Cc: stable@vger.kernel.org
Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
---
 drivers/net/arcnet/com20020-pci.c | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c
index 0472bcdff130..4847f40a2095 100644
--- a/drivers/net/arcnet/com20020-pci.c
+++ b/drivers/net/arcnet/com20020-pci.c
@@ -139,9 +139,6 @@ static int com20020pci_probe(struct pci_dev *pdev,
 		return -ENOMEM;
 
 	ci = (struct com20020_pci_card_info *)id->driver_data;
-	if (!ci)
-		return -EINVAL;
-
 	priv->ci = ci;
 	mm = &ci->misc_map;
 
@@ -347,6 +344,18 @@ static struct com20020_pci_card_info card_info_5mbit = {
 	.flags = ARC_IS_5MBIT,
 };
 
+static struct com20020_pci_card_info card_info_2p5mbit = {
+	.name = "ARC-PCI",
+	.devcount = 1,
+	.chan_map_tbl = {
+		{
+			.bar = 2,
+			.offset = 0x00,
+			.size = 0x08,
+		},
+	},
+};
+
 static struct com20020_pci_card_info card_info_sohard = {
 	.name = "SOHARD SH ARC-PCI",
 	.devcount = 1,
@@ -448,49 +457,49 @@ static const struct pci_device_id com20020pci_id_table[] = {
 		0x1571, 0xa001,
 		PCI_ANY_ID, PCI_ANY_ID,
 		0, 0,
-		0,
+		(kernel_ulong_t)&card_info_2p5mbit
 	},
 	{
 		0x1571, 0xa002,
 		PCI_ANY_ID, PCI_ANY_ID,
 		0, 0,
-		0,
+		(kernel_ulong_t)&card_info_2p5mbit
 	},
 	{
 		0x1571, 0xa003,
 		PCI_ANY_ID, PCI_ANY_ID,
 		0, 0,
-		0
+		(kernel_ulong_t)&card_info_2p5mbit
 	},
 	{
 		0x1571, 0xa004,
 		PCI_ANY_ID, PCI_ANY_ID,
 		0, 0,
-		0,
+		(kernel_ulong_t)&card_info_2p5mbit
 	},
 	{
 		0x1571, 0xa005,
 		PCI_ANY_ID, PCI_ANY_ID,
 		0, 0,
-		0
+		(kernel_ulong_t)&card_info_2p5mbit
 	},
 	{
 		0x1571, 0xa006,
 		PCI_ANY_ID, PCI_ANY_ID,
 		0, 0,
-		0
+		(kernel_ulong_t)&card_info_2p5mbit
 	},
 	{
 		0x1571, 0xa007,
 		PCI_ANY_ID, PCI_ANY_ID,
 		0, 0,
-		0
+		(kernel_ulong_t)&card_info_2p5mbit
 	},
 	{
 		0x1571, 0xa008,
 		PCI_ANY_ID, PCI_ANY_ID,
 		0, 0,
-		0
+		(kernel_ulong_t)&card_info_2p5mbit
 	},
 	{
 		0x1571, 0xa009,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net: arcnet: com20020-pci: fix support for 2.5Mbit cards
  2026-02-05  6:51 [PATCH net-next] net: arcnet: com20020-pci: fix support for 2.5Mbit cards Ethan Nelson-Moore
@ 2026-02-09 15:41 ` Simon Horman
  2026-02-09 21:58   ` Ethan Nelson-Moore
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Horman @ 2026-02-09 15:41 UTC (permalink / raw)
  To: Ethan Nelson-Moore
  Cc: netdev, stable, Michael Grzeschik, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Zheyu Ma

On Wed, Feb 04, 2026 at 10:51:12PM -0800, Ethan Nelson-Moore wrote:
> Commit 8c14f9c70327 ("ARCNET: add com20020 PCI IDs with metadata")
> converted the com20020-pci driver to use a card info structure instead
> of a single flag mask in driver_data. However, it failed to take into
> account that in the original code, driver_data of 0 indicates a card
> with no special flags, not a card that should not have any card info
> structure. This introduced a null pointer dereference when cards with
> no flags were probed.
> 
> Commit bd6f1fd5d33d ("net: arcnet: com20020: Fix null-ptr-deref in
> com20020pci_probe()") then papered over this issue by rejecting cards
> with no driver_data instead of resolving the problem at its source.
> 
> Revert the incorrect fix and fix the original issue by introducing a
> new card info structure for 2.5Mbit cards that does not set any flags.
> 
> Fixes: 8c14f9c70327 ("ARCNET: add com20020 PCI IDs with metadata")
> Fixes: bd6f1fd5d33d ("net: arcnet: com20020: Fix null-ptr-deref in com20020pci_probe()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>

I do wonder if this should be targeted at net rather than net-next.
But at any rate, looking over the cited commits, the change looks good to
me.

Reviewed-by: Simon Horman <horms@kernel.org>

...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net: arcnet: com20020-pci: fix support for 2.5Mbit cards
  2026-02-09 15:41 ` Simon Horman
@ 2026-02-09 21:58   ` Ethan Nelson-Moore
  2026-02-12 15:02     ` Simon Horman
  0 siblings, 1 reply; 4+ messages in thread
From: Ethan Nelson-Moore @ 2026-02-09 21:58 UTC (permalink / raw)
  To: Simon Horman
  Cc: netdev, stable, Michael Grzeschik, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Zheyu Ma

Hi, Simon,

On Mon, Feb 9, 2026 at 7:41 AM Simon Horman <horms@kernel.org> wrote:
> I do wonder if this should be targeted at net rather than net-next.
Should I send a new version redone against net, or will this be taken
care of by a maintainer?

Ethan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net: arcnet: com20020-pci: fix support for 2.5Mbit cards
  2026-02-09 21:58   ` Ethan Nelson-Moore
@ 2026-02-12 15:02     ` Simon Horman
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2026-02-12 15:02 UTC (permalink / raw)
  To: Ethan Nelson-Moore
  Cc: netdev, stable, Michael Grzeschik, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Zheyu Ma

On Mon, Feb 09, 2026 at 01:58:38PM -0800, Ethan Nelson-Moore wrote:
> Hi, Simon,
> 
> On Mon, Feb 9, 2026 at 7:41 AM Simon Horman <horms@kernel.org> wrote:
> > I do wonder if this should be targeted at net rather than net-next.
> Should I send a new version redone against net, or will this be taken
> care of by a maintainer?

I'm unsure.
But at this point - a few days have past - I'd lean towards reposting for net.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-02-12 15:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-05  6:51 [PATCH net-next] net: arcnet: com20020-pci: fix support for 2.5Mbit cards Ethan Nelson-Moore
2026-02-09 15:41 ` Simon Horman
2026-02-09 21:58   ` Ethan Nelson-Moore
2026-02-12 15:02     ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox