OSDN Git Service

IB/core: Protect against concurrent access to hardware stats
authorMark Bloch <markb@mellanox.com>
Tue, 27 Mar 2018 12:51:05 +0000 (15:51 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Tue, 27 Mar 2018 21:07:21 +0000 (15:07 -0600)
commite945130b52bea65d15f9bdf54949d4cb7a88db7f
treef6ec3278b190b01473e4aedee559bccc2ef5c4bc
parentc8d75a980fab886a9c716567e6b47cc414ad84ee
IB/core: Protect against concurrent access to hardware stats

Currently access to hardware stats buffer isn't protected, this can
result in multiple writes and reads at the same time to the same
memory location. This can lead to providing an incorrect value to
the user. Add a mutex to protect against it.

Fixes: b40f4757daa1 ("IB/core: Make device counter infrastructure dynamic")
Signed-off-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/sysfs.c
include/rdma/ib_verbs.h