net: arcnet: com20020-pci: fix support for 2.5Mbit cards
Subsystems (4)
PATCH 1/1 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.
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.
--- drivers/net/arcnet/com20020-pci.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-)
drivers/net/arcnet/com20020-pci.c +20 -11
@@ -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,
Signature · 1 line
2.43.0
Quoted 12 lines · Ethan Nelson-Moore
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 indriver_data. However, it failed to take into account that in the original code,driver_dataof 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 incom20020pci_probe()") then papered over this issue by rejecting cards with nodriver_datainstead of resolving the problem at its source.
Quoted 7 lines
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()")Signed-off-by Ethan Nelson-Moore <[email protected]>
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.
...
Hi, Simon,
Quoted 1 line · Simon Horman
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
Simon Horman
reviewerQuoted 6 lines · Ethan Nelson-Moore
Hi, Simon,
Quoted 1 line · Simon Horman
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.