linux/net/dsa
Florian Fainelli c7848399ec net: dsa: Don't dereference dst->cpu_dp->netdev
If we do not have a master network device attached dst->cpu_dp will be
NULL and accessing cpu_dp->netdev will create a trace similar to the one
below. The correct check is on dst->cpu_dp period.

[    1.004650] DSA: switch 0 0 parsed
[    1.008078] Unable to handle kernel NULL pointer dereference at
virtual address 00000010
[    1.016195] pgd = c0003000
[    1.018918] [00000010] *pgd=80000000004003, *pmd=00000000
[    1.024349] Internal error: Oops: 206 [#1] SMP ARM
[    1.029157] Modules linked in:
[    1.032228] CPU: 0 PID: 1 Comm: swapper/0 Not tainted
4.13.0-rc6-00071-g45b45afab9bd-dirty #7
[    1.040772] Hardware name: Broadcom STB (Flattened Device Tree)
[    1.046704] task: ee08f840 task.stack: ee090000
[    1.051258] PC is at dsa_register_switch+0x5e0/0x9dc
[    1.056234] LR is at dsa_register_switch+0x5d0/0x9dc
[    1.061211] pc : [<c08fb28c>]    lr : [<c08fb27c>]    psr: 60000213
[    1.067491] sp : ee091d88  ip : 00000000  fp : 0000000c
[    1.072728] r10: 00000000  r9 : 00000001  r8 : ee208010
[    1.077965] r7 : ee2b57b0  r6 : ee2b5780  r5 : 00000000  r4 :
ee208e0c
[    1.084506] r3 : 00000000  r2 : 00040d00  r1 : 2d1b2000  r0 :
00000016
[    1.091050] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM
Segment user
[    1.098199] Control: 32c5387d  Table: 00003000  DAC: fffffffd
[    1.103957] Process swapper/0 (pid: 1, stack limit = 0xee090210)

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 6d3c8c0dd8 ("net: dsa: Remove master_netdev and use dst->cpu_dp->netdev")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-28 21:19:43 -07:00
..
Kconfig dsa: add support for Microchip KSZ tail tagging 2017-05-31 20:56:31 -04:00
Makefile dsa: add support for Microchip KSZ tail tagging 2017-05-31 20:56:31 -04:00
dsa.c net: dsa: Relocate master ethtool operations 2017-06-13 16:35:02 -04:00
dsa2.c net: dsa: Don't dereference dst->cpu_dp->netdev 2017-08-28 21:19:43 -07:00
dsa_priv.h net: dsa: Introduce dsa_get_cpu_port() 2017-06-13 16:35:03 -04:00
legacy.c net: dsa: Fix legacy probing 2017-06-17 22:59:45 -04:00
port.c net: dsa: support cross-chip ageing time 2017-05-24 16:27:47 -04:00
slave.c net: dsa: Introduce dsa_get_cpu_port() 2017-06-13 16:35:03 -04:00
switch.c net: dsa: add cross-chip multicast support 2017-06-16 15:21:14 -04:00
tag_brcm.c net: dsa: Introduce dsa_get_cpu_port() 2017-06-13 16:35:03 -04:00
tag_dsa.c net: dsa: factor skb freeing on xmit 2017-06-01 17:34:56 -04:00
tag_edsa.c net: dsa: factor skb freeing on xmit 2017-06-01 17:34:56 -04:00
tag_ksz.c net: dsa: use consume_skb() 2017-08-23 22:13:34 -07:00
tag_lan9303.c net: dsa: factor skb freeing on xmit 2017-06-01 17:34:56 -04:00
tag_mtk.c net: dsa: factor skb freeing on xmit 2017-06-01 17:34:56 -04:00
tag_qca.c net: dsa: Introduce dsa_get_cpu_port() 2017-06-13 16:35:03 -04:00
tag_trailer.c net: dsa: use consume_skb() 2017-08-23 22:13:34 -07:00