linux-stable/drivers/net
Kevin Hao e83acf9391 net: stmmac: Use readl_poll_timeout_atomic() in atomic state
[ Upstream commit 234901de2b ]

The init_systime() may be invoked in atomic state. We have observed the
following call trace when running "phc_ctl /dev/ptp0 set" on a Intel
Agilex board.
  BUG: sleeping function called from invalid context at drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c:74
  in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 381, name: phc_ctl
  preempt_count: 1, expected: 0
  RCU nest depth: 0, expected: 0
  Preemption disabled at:
  [<ffff80000892ef78>] stmmac_set_time+0x34/0x8c
  CPU: 2 PID: 381 Comm: phc_ctl Not tainted 5.18.0-rc2-next-20220414-yocto-standard+ #567
  Hardware name: SoCFPGA Agilex SoCDK (DT)
  Call trace:
   dump_backtrace.part.0+0xc4/0xd0
   show_stack+0x24/0x40
   dump_stack_lvl+0x7c/0xa0
   dump_stack+0x18/0x34
   __might_resched+0x154/0x1c0
   __might_sleep+0x58/0x90
   init_systime+0x78/0x120
   stmmac_set_time+0x64/0x8c
   ptp_clock_settime+0x60/0x9c
   pc_clock_settime+0x6c/0xc0
   __arm64_sys_clock_settime+0x88/0xf0
   invoke_syscall+0x5c/0x130
   el0_svc_common.constprop.0+0x4c/0x100
   do_el0_svc+0x7c/0xa0
   el0_svc+0x58/0xcc
   el0t_64_sync_handler+0xa4/0x130
   el0t_64_sync+0x18c/0x190

So we should use readl_poll_timeout_atomic() here instead of
readl_poll_timeout().

Also adjust the delay time to 10us to fix a "__bad_udelay" build error
reported by "kernel test robot <lkp@intel.com>". I have tested this on
Intel Agilex and NXP S32G boards, there is no delay needed at all.
So the 10us delay should be long enough for most cases.

Fixes: ff8ed73786 ("net: stmmac: use readl_poll_timeout() function in init_systime()")
Signed-off-by: Kevin Hao <haokexin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-27 14:38:54 +02:00
..
appletalk
arcnet net: arcnet: com20020: Fix null-ptr-deref in com20020pci_probe() 2022-03-08 19:12:46 +01:00
bonding bonding: fix data-races around agg_select_timer 2022-02-23 12:03:12 +01:00
caif
can can: etas_es58x: es58x_fd_rx_event_msg(): initialize rx_event_msg before calling es58x_check_msg_len() 2022-04-13 20:59:08 +02:00
dsa net: dsa: felix: suppress -EPROBE_DEFER errors 2022-04-20 09:34:10 +02:00
ethernet net: stmmac: Use readl_poll_timeout_atomic() in atomic state 2022-04-27 14:38:54 +02:00
fddi
fjes
hamradio hamradio: remove needs_free_netdev to avoid UAF 2022-04-20 09:34:04 +02:00
hippi
hyperv hv_netvsc: Add check for kvmalloc_array 2022-03-23 09:16:42 +01:00
ieee802154 net: ieee802154: ca8210: Fix lifs/sifs periods 2022-02-23 12:03:11 +01:00
ipa net: ipa: fix a build dependency 2022-04-20 09:34:21 +02:00
ipvlan
mctp
mdio net: mdio: don't defer probe forever if PHY IRQ provider is missing 2022-04-20 09:34:10 +02:00
netdevsim ipv6: fix data-race in fib6_info_hw_flags_set / fib6_purge_rt 2022-02-23 12:03:10 +01:00
pcs
phy net: sfp: add 2500base-X quirk for Lantech SFP module 2022-04-13 20:59:09 +02:00
plip
ppp
slip drivers: net: slip: fix NPD bug in sl_tx_timeout() 2022-04-20 09:34:17 +02:00
team
usb net: usb: aqc111: Fix out-of-bounds accesses in RX fixup 2022-04-20 09:34:16 +02:00
vmxnet3
wan
wireguard wireguard: socket: ignore v6 endpoints when ipv6 is disabled 2022-04-08 14:24:09 +02:00
wireless ath9k: Fix usage of driver-private space in tx_info 2022-04-20 09:34:19 +02:00
wwan
xen-netback Revert "xen-netback: Check for hotplug-status existence before watching" 2022-03-16 14:23:41 +01:00
bareudp.c bareudp: use ipv6_mod_enabled to check if IPv6 enabled 2022-04-08 14:23:41 +02:00
dummy.c
eql.c
geneve.c
gtp.c
ifb.c
Kconfig
LICENSE.SRC
loopback.c
macsec.c net: macsec: Verify that send_sci is on when setting Tx sci explicitly 2022-02-08 18:34:09 +01:00
macvlan.c macvlan: Fix leaking skb in source mode with nodst option 2022-04-20 09:34:13 +02:00
macvtap.c macvtap: advertise link netns via netlink 2022-04-13 20:59:07 +02:00
Makefile
mdio.c
mhi_net.c
mii.c
net_failover.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
Space.c
sungem_phy.c
tap.c tuntap: add sanity checks about msg_controllen in sendmsg 2022-04-13 20:59:07 +02:00
thunderbolt.c
tun.c tuntap: add sanity checks about msg_controllen in sendmsg 2022-04-13 20:59:07 +02:00
veth.c veth: Ensure eth header is in skb's linear part 2022-04-20 09:34:10 +02:00
virtio_net.c
vrf.c vrf: fix packet sniffing for traffic originating from ip tunnels 2022-04-13 20:59:15 +02:00
vsockmon.c
vxlan.c
xen-netfront.c xen/netfront: react properly to failing gnttab_end_foreign_access_ref() 2022-03-11 12:22:37 +01:00