linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <Alexander.Levin@microsoft.com>
To: "stable@vger.kernel.org" <stable@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Brandon Maier <brandon.maier@rockwellcollins.com>,
	"David S . Miller" <davem@davemloft.net>,
	Sasha Levin <Alexander.Levin@microsoft.com>
Subject: [PATCH AUTOSEL 4.14 62/87] net: phy: xgmiitorgmii: Check phy_driver ready before accessing
Date: Mon, 17 Sep 2018 03:03:04 +0000	[thread overview]
Message-ID: <20180917030220.245686-62-alexander.levin@microsoft.com> (raw)
In-Reply-To: <20180917030220.245686-1-alexander.levin@microsoft.com>

From: Brandon Maier <brandon.maier@rockwellcollins.com>

[ Upstream commit ab4e6ee578e88a659938db8fbf33720bc048d29c ]

Since a phy_device is added to the global mdio_bus list during
phy_device_register(), but a phy_device's phy_driver doesn't get
attached until phy_probe(). It's possible of_phy_find_device() in
xgmiitorgmii will return a valid phy with a NULL phy_driver. Leading to
a NULL pointer access during the memcpy().

Fixes this Oops:

Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c0004000
[00000000] *pgd=00000000
Internal error: Oops: 5 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.14.40 #1
Hardware name: Xilinx Zynq Platform
task: ce4c8d00 task.stack: ce4ca000
PC is at memcpy+0x48/0x330
LR is at xgmiitorgmii_probe+0x90/0xe8
pc : [<c074bc68>]    lr : [<c0529548>]    psr: 20000013
sp : ce4cbb54  ip : 00000000  fp : ce4cbb8c
r10: 00000000  r9 : 00000000  r8 : c0c49178
r7 : 00000000  r6 : cdc14718  r5 : ce762800  r4 : cdc14710
r3 : 00000000  r2 : 00000054  r1 : 00000000  r0 : cdc14718
Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
Control: 18c5387d  Table: 0000404a  DAC: 00000051
Process swapper/0 (pid: 1, stack limit = 0xce4ca210)
...
[<c074bc68>] (memcpy) from [<c0529548>] (xgmiitorgmii_probe+0x90/0xe8)
[<c0529548>] (xgmiitorgmii_probe) from [<c0526a94>] (mdio_probe+0x28/0x34)
[<c0526a94>] (mdio_probe) from [<c04db98c>] (driver_probe_device+0x254/0x414)
[<c04db98c>] (driver_probe_device) from [<c04dbd58>] (__device_attach_driver+0xac/0x10c)
[<c04dbd58>] (__device_attach_driver) from [<c04d96f4>] (bus_for_each_drv+0x84/0xc8)
[<c04d96f4>] (bus_for_each_drv) from [<c04db5bc>] (__device_attach+0xd0/0x134)
[<c04db5bc>] (__device_attach) from [<c04dbdd4>] (device_initial_probe+0x1c/0x20)
[<c04dbdd4>] (device_initial_probe) from [<c04da8fc>] (bus_probe_device+0x98/0xa0)
[<c04da8fc>] (bus_probe_device) from [<c04d8660>] (device_add+0x43c/0x5d0)
[<c04d8660>] (device_add) from [<c0526cb8>] (mdio_device_register+0x34/0x80)
[<c0526cb8>] (mdio_device_register) from [<c0580b48>] (of_mdiobus_register+0x170/0x30c)
[<c0580b48>] (of_mdiobus_register) from [<c05349c4>] (macb_probe+0x710/0xc00)
[<c05349c4>] (macb_probe) from [<c04dd700>] (platform_drv_probe+0x44/0x80)
[<c04dd700>] (platform_drv_probe) from [<c04db98c>] (driver_probe_device+0x254/0x414)
[<c04db98c>] (driver_probe_device) from [<c04dbc58>] (__driver_attach+0x10c/0x118)
[<c04dbc58>] (__driver_attach) from [<c04d9600>] (bus_for_each_dev+0x8c/0xd0)
[<c04d9600>] (bus_for_each_dev) from [<c04db1fc>] (driver_attach+0x2c/0x30)
[<c04db1fc>] (driver_attach) from [<c04daa98>] (bus_add_driver+0x50/0x260)
[<c04daa98>] (bus_add_driver) from [<c04dc440>] (driver_register+0x88/0x108)
[<c04dc440>] (driver_register) from [<c04dd6b4>] (__platform_driver_register+0x50/0x58)
[<c04dd6b4>] (__platform_driver_register) from [<c0b31248>] (macb_driver_init+0x24/0x28)
[<c0b31248>] (macb_driver_init) from [<c010203c>] (do_one_initcall+0x60/0x1a4)
[<c010203c>] (do_one_initcall) from [<c0b00f78>] (kernel_init_freeable+0x15c/0x1f8)
[<c0b00f78>] (kernel_init_freeable) from [<c0763d10>] (kernel_init+0x18/0x124)
[<c0763d10>] (kernel_init) from [<c0112d74>] (ret_from_fork+0x14/0x20)
Code: ba000002 f5d1f03c f5d1f05c f5d1f07c (e8b151f8)
---[ end trace 3e4ec21905820a1f ]---

Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
---
 drivers/net/phy/xilinx_gmii2rgmii.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c
index 449b31319010..7a14e8170e82 100644
--- a/drivers/net/phy/xilinx_gmii2rgmii.c
+++ b/drivers/net/phy/xilinx_gmii2rgmii.c
@@ -84,6 +84,11 @@ static int xgmiitorgmii_probe(struct mdio_device *mdiodev)
 		return -EPROBE_DEFER;
 	}
 
+	if (!priv->phy_dev->drv) {
+		dev_info(dev, "Attached phy not ready\n");
+		return -EPROBE_DEFER;
+	}
+
 	priv->addr = mdiodev->addr;
 	priv->phy_drv = priv->phy_dev->drv;
 	memcpy(&priv->conv_phy_drv, priv->phy_dev->drv,
-- 
2.17.1

  parent reply	other threads:[~2018-09-17  3:05 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-17  3:02 [PATCH AUTOSEL 4.14 01/87] crypto: skcipher - Fix -Wstringop-truncation warnings Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 02/87] iio: adc: ina2xx: avoid kthread_stop() with stale task_struct Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 03/87] tsl2550: fix lux1_input error in low light Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 04/87] vmci: type promotion bug in qp_host_get_user_memory() Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 05/87] x86/numa_emulation: Fix emulated-to-physical node mapping Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 06/87] staging: rts5208: fix missing error check on call to rtsx_write_register Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 07/87] power: supply: axp288_charger: Fix initial constant_charge_current value Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 08/87] misc: sram: enable clock before registering regions Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 09/87] serial: sh-sci: Stop RX FIFO timer during port shutdown Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 10/87] uwb: hwa-rc: fix memory leak at probe Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 11/87] power: vexpress: fix corruption in notifier registration Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 13/87] Bluetooth: Add a new Realtek 8723DE ID 0bda:b009 Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 12/87] iommu/amd: make sure TLB to be flushed before IOVA freed Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 14/87] USB: serial: kobil_sct: fix modem-status error handling Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 15/87] 6lowpan: iphc: reset mac_header after decompress to fix panic Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 16/87] iommu/msm: Don't call iommu_device_{,un}link from atomic context Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 18/87] power: remove possible deadlock when unregistering power_supply Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 17/87] s390/mm: correct allocate_pgste proc_handler callback Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 20/87] RDMA/bnxt_re: Fix a couple off by one bugs Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 19/87] md-cluster: clear another node's suspend_area after the copy is finished Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 22/87] arm64: fix infinite stacktrace Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 21/87] RDMA/i40w: Hold read semaphore while looking after VMA Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 23/87] IB/core: type promotion bug in rdma_rw_init_one_mr() Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 25/87] IB/mlx4: Test port number before querying type Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 24/87] media: exynos4-is: Prevent NULL pointer dereference in __isp_video_try_fmt() Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 27/87] media: fsl-viu: fix error handling in viu_of_probe() Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 26/87] powerpc/kdump: Handle crashkernel memory reservation failure Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 28/87] media: staging/imx: fill vb2_v4l2_buffer field entry Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 29/87] media: sta2x11: Add video_device and vb2_queue locks Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 30/87] x86/tsc: Add missing header to tsc_msr.c Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 31/87] ARM: hwmod: RTC: Don't assume lock/unlock will be called with irq enabled Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 33/87] ARM: dts: ls1021a: Add missing cooling device properties for CPUs Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 32/87] x86/entry/64: Add two more instruction suffixes Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 34/87] scsi: target/iscsi: Make iscsit_ta_authentication() respect the output buffer size Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 35/87] scsi: klist: Make it safe to use klists in atomic context Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 36/87] scsi: ibmvscsi: Improve strings handling Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 37/87] scsi: target: Avoid that EXTENDED COPY commands trigger lock inversion Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 38/87] usb: wusbcore: security: cast sizeof to int for comparison Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 39/87] ath10k: sdio: use same endpoint id for all packets in a bundle Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 40/87] ath10k: sdio: set skb len for all rx packets Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 41/87] powerpc/powernv/ioda2: Reduce upper limit for DMA window size Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 42/87] s390/sysinfo: add missing #ifdef CONFIG_PROC_FS Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 43/87] alarmtimer: Prevent overflow for relative nanosleep Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 45/87] s390/scm_blk: correct numa_node in scm_blk_dev_setup Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 44/87] s390/dasd: correct numa_node in dasd_alloc_queue Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 46/87] s390/extmem: fix gcc 8 stringop-overflow warning Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 47/87] mtd: rawnand: atmel: add module param to avoid using dma Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 48/87] iio: accel: adxl345: convert address field usage in iio_chan_spec Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 49/87] posix-timers: Make forward callback return s64 Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 50/87] posix-timers: Sanitize overrun handling Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 52/87] nfp: fail probe if serial or interface id is missing Sasha Levin
2018-09-17 14:03   ` Jakub Kicinski
2018-09-27 19:50     ` Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 51/87] ALSA: snd-aoa: add of_node_put() in error path Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 53/87] media: s3c-camif: ignore -ENOIOCTLCMD from v4l2_subdev_call for s_power Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 54/87] media: soc_camera: ov772x: correct setting of banding filter Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 55/87] media: omap3isp: zero-initialize the isp cam_xclk{a,b} initial data Sasha Levin
2018-09-17  3:02 ` [PATCH AUTOSEL 4.14 56/87] staging: android: ashmem: Fix mmap size validation Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 57/87] drivers/tty: add error handling for pcmcia_loop_config Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 59/87] ALSA: hda: Add AZX_DCAPS_PM_RUNTIME for AMD Raven Ridge Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 58/87] media: tm6000: add error handling for dvb_register_adapter Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 60/87] net: phy: xgmiitorgmii: Check read_status results Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 61/87] ath10k: protect ath10k_htt_rx_ring_free with rx_ring.lock Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 63/87] drm/sun4i: Fix releasing node when enumerating enpoints Sasha Levin
2018-09-17  3:03 ` Sasha Levin [this message]
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 64/87] ath10k: transmit queued frames after processing rx packets Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 65/87] rndis_wlan: potential buffer overflow in rndis_wlan_auth_indication() Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 66/87] brcmsmac: fix wrap around in conversion from constant to s16 Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 67/87] wlcore: Add missing PM call for wlcore_cmd_wait_for_event_or_timeout() Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 69/87] arm: dts: mediatek: Add missing cooling device properties for CPUs Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 68/87] ARM: mvebu: declare asm symbols as character arrays in pmsu.c Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 70/87] HID: hid-ntrig: add error handling for sysfs_create_group Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 71/87] MIPS: boot: fix build rule of vmlinux.its.S Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 72/87] perf/x86/intel/lbr: Fix incomplete LBR call stack Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 73/87] scsi: bnx2i: add error handling for ioremap_nocache Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 74/87] iomap: complete partial direct I/O writes synchronously Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 75/87] audit: Fix extended comparison of GID/EGID Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 76/87] scsi: megaraid_sas: Update controller info during resume Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 77/87] EDAC, i7core: Fix memleaks and use-after-free on probe and remove Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 78/87] ASoC: dapm: Fix potential DAI widget pointer deref when linking DAIs Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 80/87] gpio: Fix wrong rounding in gpio-menz127 Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 79/87] module: exclude SHN_UNDEF symbols from kallsyms api Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 81/87] nfsd: fix corrupted reply to badly ordered compound Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 83/87] fs/lock: skip lock owner pid translation in case we are in init_pid_ns Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 82/87] EDAC: Fix memleak in module init error path Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 84/87] Input: xen-kbdfront - fix multi-touch XenStore node's locations Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 85/87] iio: 104-quad-8: Fix off-by-one error in register selection Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 86/87] ARM: dts: dra7: fix DCAN node addresses Sasha Levin
2018-09-17  3:03 ` [PATCH AUTOSEL 4.14 87/87] PCI: Whitelist Thunderbolt ports for runtime D3 Sasha Levin
2018-09-17  8:25   ` Lukas Wunner
2018-09-27 19:43     ` Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180917030220.245686-62-alexander.levin@microsoft.com \
    --to=alexander.levin@microsoft.com \
    --cc=brandon.maier@rockwellcollins.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).