linux/drivers/net
Jack Morgenstein 95f76fb6b1 net/mlx4_core: Fix deadlock when switching between polling and event fw commands
commit a7e1f04905 upstream.

When switching from polling-based fw commands to event-based fw
commands, there is a race condition which could cause a fw command
in another task to hang: that task will keep waiting for the polling
sempahore, but may never be able to acquire it. This is due to
mlx4_cmd_use_events, which "down"s the sempahore back to 0.

During driver initialization, this is not a problem, since no other
tasks which invoke FW commands are active.

However, there is a problem if the driver switches to polling mode
and then back to event mode during normal operation.

The "test_interrupts" feature does exactly that.
Running "ethtool -t <eth device> offline" causes the PF driver to
temporarily switch to polling mode, and then back to event mode.
(Note that for VF drivers, such switching is not performed).

Fix this by adding a read-write semaphore for protection when
switching between modes.

Fixes: 225c7b1fee ("IB/mlx4: Add a driver Mellanox ConnectX InfiniBand adapters")
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[bwh: Backported to 3.16: adjust context, indentation]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2017-02-23 03:54:02 +00:00
..
appletalk PTR_RET is now PTR_ERR_OR_ZERO(): Replace most. 2013-07-15 11:25:01 +09:30
arcnet drivers/net: delete non-required instances of include <linux/init.h> 2014-01-16 11:53:26 -08:00
bonding bonding: prevent out of bound accesses 2016-08-22 22:38:25 +01:00
caif caif: remove wrong dev_net_set() call 2015-03-04 13:24:16 +00:00
can can: dev: fix deadlock reported after bus-off 2016-11-20 01:17:34 +00:00
cris ethtool: fix drvinfo strings set in drivers 2013-01-06 21:06:31 -08:00
dsa net: dsa: update DSA drivers to use ds_to_priv 2014-04-30 13:31:25 -04:00
ethernet net/mlx4_core: Fix deadlock when switching between polling and event fw commands 2017-02-23 03:54:02 +00:00
fddi defxx: Fix !DYNAMIC_BUFFERS compilation warnings 2014-07-02 18:26:29 -07:00
hamradio yam: replace del_timer by del_timer_sync 2014-03-27 15:28:06 -04:00
hippi drivers/net: delete non-required instances of include <linux/init.h> 2014-01-16 11:53:26 -08:00
hyperv hyperv: Fix the error processing in netvsc_send() 2015-02-10 13:38:51 +00:00
ieee802154 ieee802154: fix error handling in ieee802154fake_probe() 2014-12-01 10:02:09 +00:00
irda net: irda: Fix use-after-free in irtty_open() 2016-05-01 00:05:47 +02:00
phy net: phy: Manage fixed PHY address space using IDA 2016-08-22 22:38:24 +01:00
plip net: plip: slight optimization of addr compare 2013-12-31 16:48:33 -05:00
ppp ppp: defer netns reference release for ppp channel 2016-11-20 01:16:47 +00:00
slip ppp, slip: Validate VJ compression slot parameters completely 2015-11-16 11:27:22 +00:00
team team: Replace rcu_read_lock with a mutex in team_vlan_rx_kill_vid 2016-01-28 11:08:01 +00:00
usb qmi_wwan: add "D-Link DWM-221 B1" device id 2016-05-01 00:06:14 +02:00
vmxnet3 vmxnet3: adjust ring sizes when interface is down 2014-06-16 21:26:40 -07:00
wan farsync: fix off-by-one bug in fst_add_one 2016-05-01 00:06:14 +02:00
wimax net: wimax: i2400m: control.c: Cleaning up conjunction always evaluates to false 2014-06-11 00:13:16 -07:00
wireless rtlwifi: Fix missing country code for Great Britain 2017-02-23 03:53:57 +00:00
xen-netback xen-netback: respect user provided max_queues 2016-01-28 11:10:00 +00:00
dummy.c net: Replace u64_stats_fetch_begin_bh to u64_stats_fetch_begin_irq 2014-03-14 22:41:36 -04:00
eql.c eql: use __dev_get_by_name instead of dev_get_by_name to find interface 2014-01-14 18:50:46 -08:00
ifb.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2014-03-29 18:48:54 -04:00
Kconfig drivers/net: macvtap and tun depend on INET 2014-11-13 11:48:26 +00:00
LICENSE.SRC Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
loopback.c net: Replace u64_stats_fetch_begin_bh to u64_stats_fetch_begin_irq 2014-03-14 22:41:36 -04:00
macvlan.c macvlan: Fix potential use-after free for broadcasts 2016-11-20 01:16:39 +00:00
macvtap.c macvtap: segmented packet is consumed 2016-06-15 21:29:31 +01:00
Makefile packet: nlmon: virtual netlink monitoring device for packet sockets 2013-06-24 16:39:05 -07:00
mdio.c mdio: unused ethtool functions 2013-12-26 13:29:35 -05:00
mii.c ethtool, mdio, mii: Specify MDIO information fields in struct ethtool_cmd 2012-03-01 16:41:26 -05:00
netconsole.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-11-04 13:48:30 -05:00
nlmon.c net: nlmon: flag nlmon devs with LLTX/SG 2014-03-28 16:49:47 -04:00
ntb_netdev.c net: use ethtool_cmd_speed_set helper to set ethtool speed value 2014-06-06 16:24:07 -07:00
rionet.c rapidio/rionet: fix deadlock on SMP 2016-05-01 00:06:04 +02:00
sb1000.c drivers/net/sb1000.c: delete double assignment 2010-10-27 12:23:20 -07:00
Space.c drivers: net: Include new header file in sbni.c 2013-12-19 18:51:20 -05:00
sungem_phy.c Fix misspellings of "whether" in comments. 2012-11-19 14:31:35 +01:00
tun.c tun: fix transmit timestamp support 2016-11-20 01:17:17 +00:00
veth.c veth: don’t modify ip_summed; doing so treats packets with bad checksums as good. 2016-01-28 10:10:59 +00:00
virtio_net.c virtio-net: drop NETIF_F_FRAGLIST 2015-09-11 17:24:16 +01:00
vxlan.c vxlan: fix test which detect duplicate vxlan iface 2016-01-28 10:40:23 +00:00
xen-netfront.c xen-netfront: update num_queues to real created 2016-01-28 11:57:51 +00:00