No description
Find a file
Thomas Gleixner d5a8eeea37 net: enic: Cure the enic api locking trainwreck
[ Upstream commit a53b59ece8 ]

enic_dev_wait() has a BUG_ON(in_interrupt()).

Chasing the callers of enic_dev_wait() revealed the gems of enic_reset()
and enic_tx_hang_reset() which are both invoked through work queues in
order to be able to call rtnl_lock(). So far so good.

After locking rtnl both functions acquire enic::enic_api_lock which
serializes against the (ab)use from infiniband. This is where the
trainwreck starts.

enic::enic_api_lock is a spin_lock() which implicitly disables preemption,
but both functions invoke a ton of functions under that lock which can
sleep. The BUG_ON(in_interrupt()) does not trigger in that case because it
can't detect the preempt disabled condition.

This clearly has never been tested with any of the mandatory debug options
for 7+ years, which would have caught that for sure.

Cure it by adding a enic_api_busy member to struct enic, which is modified
and evaluated with enic::enic_api_lock held.

If enic_api_devcmd_proxy_by_index() observes enic::enic_api_busy as true,
it drops enic::enic_api_lock and busy waits for enic::enic_api_busy to
become false.

It would be smarter to wait for a completion of that busy period, but
enic_api_devcmd_proxy_by_index() is called with other spin locks held which
obviously can't sleep.

Remove the BUG_ON(in_interrupt()) check as well because it's incomplete and
with proper debugging enabled the problem would have been caught from the
debug checks in schedule_timeout().

Fixes: 0b038566c0 ("drivers/net: enic: Add an interface for USNIC to interact with firmware")
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-10-29 09:07:06 +01:00
arch x86/fpu: Allow multiple bits in clearcpuid= parameter 2020-10-29 09:07:00 +01:00
block block: ensure bdi->io_pages is always initialized 2020-09-12 13:39:11 +02:00
certs Replace magic for trusting the secondary keyring with #define 2018-09-09 19:55:54 +02:00
crypto crypto: algif_skcipher - EBUSY on aio should be an error 2020-10-29 09:07:01 +01:00
Documentation x86/fpu: Allow multiple bits in clearcpuid= parameter 2020-10-29 09:07:00 +01:00
drivers net: enic: Cure the enic api locking trainwreck 2020-10-29 09:07:06 +01:00
firmware Fix built-in early-load Intel microcode alignment 2020-01-23 08:20:30 +01:00
fs quota: clear padding in v2r1_mem2diskdqb() 2020-10-29 09:07:06 +01:00
include net/ipv4: always honour route mtu during forwarding 2020-10-29 09:06:58 +01:00
init x86: Fix early boot crash on gcc-10, third try 2020-05-20 08:17:15 +02:00
ipc ipc/util.c: sysvipc_find_ipc() incorrectly updates position index 2020-05-20 08:17:07 +02:00
kernel perf: Fix task_function_call() error handling 2020-10-14 09:51:14 +02:00
lib Fonts: Support FONT_EXTRA_WORDS macros for built-in fonts 2020-10-14 09:51:10 +02:00
mm mm: khugepaged: recalculate min_free_kbytes after memory hotplug as expected by khugepaged 2020-10-14 09:51:14 +02:00
net icmp: randomize the global rate limiter 2020-10-29 09:06:59 +01:00
samples samples: bpf: Fix build error 2020-06-03 08:17:55 +02:00
scripts checkpatch: fix the usage of capture group ( ... ) 2020-09-09 19:03:13 +02:00
security ima: Don't ignore errors from crypto_shash_update() 2020-10-29 09:07:00 +01:00
sound ALSA: seq: oss: Avoid mutex lock for a long-time ioctl 2020-10-29 09:07:06 +01:00
tools perf top: Fix stdio interface input handling with glibc 2.28+ 2020-10-14 09:51:11 +02:00
usr initramfs: restore default compression behavior 2020-04-13 10:34:19 +02:00
virt KVM: fix overflow of zero page refcount with ksm running 2020-10-01 13:12:33 +02:00
.cocciconfig
.get_maintainer.ignore
.gitattributes .gitattributes: set git diff driver for C source code files 2016-10-07 18:46:30 -07:00
.gitignore kbuild: rpm-pkg: keep spec file until make mrproper 2018-02-13 10:19:46 +01:00
.mailmap .mailmap: Add Maciej W. Rozycki's Imagination e-mail address 2017-11-10 12:16:15 -08:00
COPYING
CREDITS MAINTAINERS: update TPM driver infrastructure changes 2017-11-09 17:58:40 -08:00
Kbuild License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Kconfig License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
MAINTAINERS MAINTAINERS: Update drm/i915 bug filing URL 2020-02-28 16:36:12 +01:00
Makefile Linux 4.14.202 2020-10-17 10:29:55 +02:00
README README: add a new README file, pointing to the Documentation/ 2016-10-24 08:12:35 -02:00

Linux kernel
============

This file was moved to Documentation/admin-guide/README.rst

Please notice that there are several guides for kernel developers and users.
These guides can be rendered in a number of formats, like HTML and PDF.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.
See Documentation/00-INDEX for a list of what is contained in each file.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.