* [PATCH net] net: dsa: microchip: Don't try to read stats for unused ports
@ 2019-06-12 20:33 Robert Hancock
2019-06-12 20:40 ` Vivien Didelot
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Robert Hancock @ 2019-06-12 20:33 UTC (permalink / raw)
To: netdev
Cc: woojung.huh, UNGLinuxDriver, andrew, vivien.didelot, f.fainelli,
Robert Hancock
If some of the switch ports were not listed in the device tree, due to
being unused, the ksz_mib_read_work function ended up accessing a NULL
dp->slave pointer and causing an oops. Skip checking statistics for any
unused ports.
Fixes: 7c6ff470aa867f53 ("net: dsa: microchip: add MIB counter reading
support")
Signed-off-by: Robert Hancock <hancock@sedsystems.ca>
---
drivers/net/dsa/microchip/ksz_common.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index 39dace8..f46086f 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -83,6 +83,9 @@ static void ksz_mib_read_work(struct work_struct *work)
int i;
for (i = 0; i < dev->mib_port_cnt; i++) {
+ if (dsa_is_unused_port(dev->ds, i))
+ continue;
+
p = &dev->ports[i];
mib = &p->mib;
mutex_lock(&mib->cnt_mutex);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net] net: dsa: microchip: Don't try to read stats for unused ports
2019-06-12 20:33 [PATCH net] net: dsa: microchip: Don't try to read stats for unused ports Robert Hancock
@ 2019-06-12 20:40 ` Vivien Didelot
2019-06-12 21:08 ` Andrew Lunn
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Vivien Didelot @ 2019-06-12 20:40 UTC (permalink / raw)
To: Robert Hancock
Cc: netdev, woojung.huh, UNGLinuxDriver, andrew, f.fainelli, Robert Hancock
On Wed, 12 Jun 2019 14:33:32 -0600, Robert Hancock <hancock@sedsystems.ca> wrote:
> If some of the switch ports were not listed in the device tree, due to
> being unused, the ksz_mib_read_work function ended up accessing a NULL
> dp->slave pointer and causing an oops. Skip checking statistics for any
> unused ports.
>
> Fixes: 7c6ff470aa867f53 ("net: dsa: microchip: add MIB counter reading
> support")
> Signed-off-by: Robert Hancock <hancock@sedsystems.ca>
Reviewed-by: Vivien Didelot <vivien.didelot@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] net: dsa: microchip: Don't try to read stats for unused ports
2019-06-12 20:33 [PATCH net] net: dsa: microchip: Don't try to read stats for unused ports Robert Hancock
2019-06-12 20:40 ` Vivien Didelot
@ 2019-06-12 21:08 ` Andrew Lunn
2019-06-12 21:41 ` Florian Fainelli
2019-06-15 2:10 ` David Miller
3 siblings, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2019-06-12 21:08 UTC (permalink / raw)
To: Robert Hancock
Cc: netdev, woojung.huh, UNGLinuxDriver, vivien.didelot, f.fainelli
On Wed, Jun 12, 2019 at 02:33:32PM -0600, Robert Hancock wrote:
> If some of the switch ports were not listed in the device tree, due to
> being unused, the ksz_mib_read_work function ended up accessing a NULL
> dp->slave pointer and causing an oops. Skip checking statistics for any
> unused ports.
>
> Fixes: 7c6ff470aa867f53 ("net: dsa: microchip: add MIB counter reading
> support")
> Signed-off-by: Robert Hancock <hancock@sedsystems.ca>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] net: dsa: microchip: Don't try to read stats for unused ports
2019-06-12 20:33 [PATCH net] net: dsa: microchip: Don't try to read stats for unused ports Robert Hancock
2019-06-12 20:40 ` Vivien Didelot
2019-06-12 21:08 ` Andrew Lunn
@ 2019-06-12 21:41 ` Florian Fainelli
2019-06-15 2:10 ` David Miller
3 siblings, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2019-06-12 21:41 UTC (permalink / raw)
To: Robert Hancock, netdev
Cc: woojung.huh, UNGLinuxDriver, andrew, vivien.didelot
On 6/12/19 1:33 PM, Robert Hancock wrote:
> If some of the switch ports were not listed in the device tree, due to
> being unused, the ksz_mib_read_work function ended up accessing a NULL
> dp->slave pointer and causing an oops. Skip checking statistics for any
> unused ports.
>
> Fixes: 7c6ff470aa867f53 ("net: dsa: microchip: add MIB counter reading
> support")
> Signed-off-by: Robert Hancock <hancock@sedsystems.ca>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] net: dsa: microchip: Don't try to read stats for unused ports
2019-06-12 20:33 [PATCH net] net: dsa: microchip: Don't try to read stats for unused ports Robert Hancock
` (2 preceding siblings ...)
2019-06-12 21:41 ` Florian Fainelli
@ 2019-06-15 2:10 ` David Miller
3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2019-06-15 2:10 UTC (permalink / raw)
To: hancock
Cc: netdev, woojung.huh, UNGLinuxDriver, andrew, vivien.didelot, f.fainelli
From: Robert Hancock <hancock@sedsystems.ca>
Date: Wed, 12 Jun 2019 14:33:32 -0600
> If some of the switch ports were not listed in the device tree, due to
> being unused, the ksz_mib_read_work function ended up accessing a NULL
> dp->slave pointer and causing an oops. Skip checking statistics for any
> unused ports.
>
> Fixes: 7c6ff470aa867f53 ("net: dsa: microchip: add MIB counter reading
> support")
> Signed-off-by: Robert Hancock <hancock@sedsystems.ca>
Applied and queued up for -stable.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-06-15 2:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-12 20:33 [PATCH net] net: dsa: microchip: Don't try to read stats for unused ports Robert Hancock
2019-06-12 20:40 ` Vivien Didelot
2019-06-12 21:08 ` Andrew Lunn
2019-06-12 21:41 ` Florian Fainelli
2019-06-15 2:10 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).