* [PATCH v3] net: arcnet: com20020-pci: fix support for 2.5Mbit cards
@ 2026-02-13 4:55 Ethan Nelson-Moore
2026-02-15 4:48 ` Ethan Nelson-Moore
2026-02-17 11:30 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Ethan Nelson-Moore @ 2026-02-13 4:55 UTC (permalink / raw)
To: netdev
Cc: Ethan Nelson-Moore, stable, Simon Horman, 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.
Fix the original issue by introducing a new card info structure for
2.5Mbit cards that does not set any flags and using it if no
driver_data is present.
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
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
---
Changes from v1:
Rebase on latest mainline instead of net-next
Add received tag
Changes from v2:
Use card_info_2p5mbit if driver_data is NULL (see rationale above)
Remove modification of driver_data fields for each device because the
above makes it unnecessary
Rebase on latest mainline
I know the forward declaration of card_info_2p5mbit is not ideal, but
the alternative is moving all the card_info struct definitions earlier
in the file, which is too invasive for a bug fix that will be
backported to stable versions.
drivers/net/arcnet/com20020-pci.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c
index 19e411b2e3a7..dbadda08dce2 100644
--- a/drivers/net/arcnet/com20020-pci.c
+++ b/drivers/net/arcnet/com20020-pci.c
@@ -115,6 +115,8 @@ static const struct attribute_group com20020_state_group = {
.attrs = com20020_state_attrs,
};
+static struct com20020_pci_card_info card_info_2p5mbit;
+
static void com20020pci_remove(struct pci_dev *pdev);
static int com20020pci_probe(struct pci_dev *pdev,
@@ -140,7 +142,7 @@ static int com20020pci_probe(struct pci_dev *pdev,
ci = (struct com20020_pci_card_info *)id->driver_data;
if (!ci)
- return -EINVAL;
+ ci = &card_info_2p5mbit;
priv->ci = ci;
mm = &ci->misc_map;
@@ -347,6 +349,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,
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v3] net: arcnet: com20020-pci: fix support for 2.5Mbit cards
2026-02-13 4:55 [PATCH v3] net: arcnet: com20020-pci: fix support for 2.5Mbit cards Ethan Nelson-Moore
@ 2026-02-15 4:48 ` Ethan Nelson-Moore
2026-02-17 11:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Ethan Nelson-Moore @ 2026-02-15 4:48 UTC (permalink / raw)
To: netdev
Cc: stable, Simon Horman, Michael Grzeschik, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Zheyu Ma
On Thu, Feb 12, 2026 at 8:55 PM Ethan Nelson-Moore
<enelsonmoore@gmail.com> wrote:
> Use card_info_2p5mbit if driver_data is NULL (see rationale above)
That rationale got accidentally lost when I was editing the commit
message. It is that driver_data can be null if the user adds a device
ID using the sysfs new_id file, as pointed out by Jakub.
Ethan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] net: arcnet: com20020-pci: fix support for 2.5Mbit cards
2026-02-13 4:55 [PATCH v3] net: arcnet: com20020-pci: fix support for 2.5Mbit cards Ethan Nelson-Moore
2026-02-15 4:48 ` Ethan Nelson-Moore
@ 2026-02-17 11:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-02-17 11:30 UTC (permalink / raw)
To: Ethan Nelson-Moore
Cc: netdev, stable, horms, m.grzeschik, andrew+netdev, davem,
edumazet, kuba, pabeni, zheyuma97
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Thu, 12 Feb 2026 20:55:09 -0800 you 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.
>
> [...]
Here is the summary with links:
- [v3] net: arcnet: com20020-pci: fix support for 2.5Mbit cards
https://git.kernel.org/netdev/net/c/c7d9be66b71a
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-02-17 11:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-13 4:55 [PATCH v3] net: arcnet: com20020-pci: fix support for 2.5Mbit cards Ethan Nelson-Moore
2026-02-15 4:48 ` Ethan Nelson-Moore
2026-02-17 11:30 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox