Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: arcnet: com20020-pci: fix support for 2.5Mbit cards

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>
Link: https://patch.msgid.link/20260213045510.32368-1-enelsonmoore@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Ethan Nelson-Moore and committed by
Paolo Abeni
c7d9be66 da29e453

+15 -1
+15 -1
drivers/net/arcnet/com20020-pci.c
··· 115 115 .attrs = com20020_state_attrs, 116 116 }; 117 117 118 + static struct com20020_pci_card_info card_info_2p5mbit; 119 + 118 120 static void com20020pci_remove(struct pci_dev *pdev); 119 121 120 122 static int com20020pci_probe(struct pci_dev *pdev, ··· 142 140 143 141 ci = (struct com20020_pci_card_info *)id->driver_data; 144 142 if (!ci) 145 - return -EINVAL; 143 + ci = &card_info_2p5mbit; 146 144 147 145 priv->ci = ci; 148 146 mm = &ci->misc_map; ··· 347 345 }, 348 346 }, 349 347 .flags = ARC_IS_5MBIT, 348 + }; 349 + 350 + static struct com20020_pci_card_info card_info_2p5mbit = { 351 + .name = "ARC-PCI", 352 + .devcount = 1, 353 + .chan_map_tbl = { 354 + { 355 + .bar = 2, 356 + .offset = 0x00, 357 + .size = 0x08, 358 + }, 359 + }, 350 360 }; 351 361 352 362 static struct com20020_pci_card_info card_info_sohard = {