alistair23-linux/drivers/net/ethernet/mellanox/mlx4
Elena Reshetova 17ac99b2b8 drivers, net, mlx4: convert mlx4_srq.refcount from atomic_t to refcount_t
atomic_t variables are currently used to implement reference
counters with the following properties:
 - counter is initialized to 1 using atomic_set()
 - a resource is freed upon counter reaching zero
 - once counter reaches zero, its further
   increments aren't allowed
 - counter schema uses basic atomic operations
   (set, inc, inc_not_zero, dec_and_test, etc.)

Such atomic variables should be converted to a newly provided
refcount_t type and API that prevents accidental counter overflows
and underflows. This is important since overflows and underflows
can lead to use-after-free situation and be exploitable.

The variable mlx4_srq.refcount is used as pure reference counter.
Convert it to refcount_t and fix up the operations.

Suggested-by: Kees Cook <keescook@chromium.org>
Reviewed-by: David Windsor <dwindsor@gmail.com>
Reviewed-by: Hans Liljestrand <ishkamiel@gmail.com>
Signed-off-by: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-10-22 02:22:38 +01:00
..
alloc.c mlx4: sizeof style usage 2017-08-16 11:01:57 -07:00
catas.c drivers: net: mlx4: use setup_timer() helper. 2017-09-21 11:44:42 -07:00
cmd.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-09-06 14:45:08 -07:00
cq.c drivers, net, mlx4: convert mlx4_cq.refcount from atomic_t to refcount_t 2017-10-22 02:22:38 +01:00
en_clock.c net/mlx4_en: fix overflow in mlx4_en_init_timestamp() 2017-02-26 15:39:43 -05:00
en_cq.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-09-06 14:45:08 -07:00
en_dcb_nl.c net/mlx4_en: Do not allocate redundant TX queues when TC is disabled 2017-06-29 15:56:15 -04:00
en_ethtool.c net/mlx4_en: Limit the number of RX rings 2017-10-10 13:11:22 -07:00
en_main.c net/mlx4_en: Limit the number of TX rings 2017-10-10 13:11:22 -07:00
en_netdev.c net/mlx4_en: XDP_TX, assign constant values of TX descs on ring creaion 2017-10-11 20:21:23 -07:00
en_port.c mlx4: add rx_alloc_pages counter in ethtool -S 2017-03-09 09:54:46 -08:00
en_port.h net/mlx4_en: Check the enabling pptx/pprx flags in SET_PORT wrapper flow 2017-01-30 15:26:43 -05:00
en_resources.c net/mlx4: Fix endianness issue in qp context params 2017-10-09 10:33:05 -07:00
en_rx.c net/mlx4_en: Replace netdev parameter with priv in XDP xmit function 2017-10-11 20:21:23 -07:00
en_selftest.c networking: make skb_put & friends return void pointers 2017-06-16 11:48:39 -04:00
en_tx.c net/mlx4_en: XDP_TX, assign constant values of TX descs on ring creaion 2017-10-11 20:21:23 -07:00
eq.c net/mlx4_core: Fix misplaced brackets of sizeof 2017-08-29 14:58:32 -07:00
fw.c net/mlx4_core: Fix cast warning in fw.c 2017-10-09 10:33:05 -07:00
fw.h net/mlx4_core: Dynamically allocate structs at mlx4_slave_cap 2017-08-29 14:58:32 -07:00
fw_qos.c net/mlx4: fix spelling mistake: "availible" -> "available" 2017-08-16 14:23:45 -07:00
fw_qos.h net/mlx4: fix spelling mistake: "availible" -> "available" 2017-08-16 14:23:45 -07:00
icm.c mlx4: sizeof style usage 2017-08-16 11:01:57 -07:00
icm.h mlx4: sizeof style usage 2017-08-16 11:01:57 -07:00
intf.c mlx4: sizeof style usage 2017-08-16 11:01:57 -07:00
Kconfig ptp_clock: Allow for it to be optional 2016-11-16 09:26:34 +01:00
main.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-09-06 14:45:08 -07:00
Makefile net/mlx4: New file for QoS related firmware commands 2015-04-02 16:25:02 -04:00
mcg.c mlx4: sizeof style usage 2017-08-16 11:01:57 -07:00
mlx4.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-09-06 14:45:08 -07:00
mlx4_en.h net/mlx4_en: XDP_TX, assign constant values of TX descs on ring creaion 2017-10-11 20:21:23 -07:00
mlx4_stats.h mlx4: add rx_alloc_pages counter in ethtool -S 2017-03-09 09:54:46 -08:00
mr.c mlx4: sizeof style usage 2017-08-16 11:01:57 -07:00
pd.c io-mapping: Specify mapping size for io_mapping_map_wc() 2016-04-28 12:17:32 +01:00
port.c net/mlx4: Add user mac FW update support 2017-08-29 14:58:32 -07:00
profile.c net/mlx4_core: use swap() in mlx4_make_profile() 2015-06-11 15:19:41 -07:00
qp.c drivers, net, mlx4: convert mlx4_qp.refcount from atomic_t to refcount_t 2017-10-22 02:22:38 +01:00
reset.c
resource_tracker.c net/mlx4: Fix endianness issue in qp context params 2017-10-09 10:33:05 -07:00
sense.c
srq.c drivers, net, mlx4: convert mlx4_srq.refcount from atomic_t to refcount_t 2017-10-22 02:22:38 +01:00