]> rtime.felk.cvut.cz Git - zynq/linux.git/commit
net: gmii2rgmii: Add check before calling phy read status
authorHarini Katakam <harini.katakam@xilinx.com>
Mon, 11 Feb 2019 08:05:08 +0000 (13:35 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 20 Feb 2019 13:25:28 +0000 (14:25 +0100)
commitb6c2c4464407977e61ed3b6cf180e663fcd913a4
tree48f1fa176021f6a7396242d8f307bb24f00ee542
parent3cfda94ff6a322a2fb6a7e94f6a549dde356d15a
net: gmii2rgmii: Add check before calling phy read status

Phy read status hook will not be assigned if generic phy is attached.
Add a check for the hook and then call genphy's implementation in
case hook isn't present. This is a fix for the following kernel oops:

[    6.806251] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
[    6.815033] Mem abort info:
[    6.817809]   ESR = 0x86000005
[    6.820854]   Exception class = IABT (current EL), IL = 32 bits
[    6.826766]   SET = 0, FnV = 0
[    6.829805]   EA = 0, S1PTW = 0
[    6.832938] user pgtable: 4k pages, 39-bit VAs, pgdp = (____ptrval____)
[    6.839540] [0000000000000000] pgd=0000000000000000, pud=0000000000000000
[    6.846322] Internal error: Oops: 86000005 [#1] SMP
[    6.851184] Modules linked in: uio_pdrv_genirq
[    6.855623] CPU: 2 PID: 42 Comm: kworker/2:1 Not tainted 4.19.0-xilinx-v2018.3 #1
[    6.863093] Hardware name: ZynqMP ZC1275 RevB (DT)
[    6.867876] Workqueue: events_power_efficient phy_state_machine
[    6.873780] pstate: 60000005 (nZCv daif -PAN -UAO)
[    6.878552] pc :           (null)
[    6.881853] lr : xgmiitorgmii_read_status+0x30/0x98
[    6.886720] sp : ffffff800a79bd40
[    6.890018] x29: ffffff800a79bd40 x28: 0000000000000000
[    6.895321] x27: ffffffc06da5fb38 x26: ffffff8008d088a0
[    6.900616] x25: 0000000000000000 x24: ffffffc06bed6be8
[    6.905911] x23: ffffffc06bed6800 x22: ffffffc06bed6c38
[    6.911206] x21: 0000000000000008 x20: ffffffc06bed5000
[    6.916501] x19: ffffffc06bed6800 x18: 0000000000000400
[    6.921795] x17: 0000000000000000 x16: 0000000000000000
[    6.927090] x15: 0000000000000400 x14: 00000000000003b8
[    6.932385] x13: 0000000000000000 x12: 0000000000000001
[    6.937680] x11: 0000000000000000 x10: 00000000000007f0
[    6.942975] x9 : ffffffc06d9f5d60 x8 : fefefefefefefeff
[    6.948269] x7 : 0000000000000018 x6 : 0000000000000018
[    6.953564] x5 : 0000746e65696369 x4 : 000000000000002f
[    6.958859] x3 : ffffffc06bed6c38 x2 : 0000000000000000
[    6.964154] x1 : ffffffc06bc1b000 x0 : ffffffc06bed6800
[    6.969450] Process kworker/2:1 (pid: 42, stack limit = 0x(____ptrval____))
[    6.976392] Call trace:
[    6.978823]            (null)
[    6.981777]  phy_state_machine+0x244/0x528
[    6.985857]  process_one_work+0x1e4/0x340
[    6.989857]  worker_thread+0x3c/0x488
[    6.993504]  kthread+0x124/0x128
[    6.996715]  ret_from_fork+0x10/0x18
[    7.000274] Code: bad PC value
[    7.003312] ---[ end trace 058be319ffdbcfb0 ]---

Signed-off-by: Harini Katakam <harini.katakam@xilinx.com>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/net/phy/xilinx_gmii2rgmii.c