linux/net/rds
Andy Grover 86357b19bc RDS: Fix potential race around rds_i[bw]_allocation
"At rds_ib_recv_refill_one(), it first executes atomic_read(&rds_ib_allocation)
for if-condition checking,

and then executes atomic_inc(&rds_ib_allocation) if the condition was
not satisfied.

However, if any other code which updates rds_ib_allocation executes
between these two atomic operation executions,
it seems that it may result race condition. (especially when
rds_ib_allocation + 1 == rds_ib_sysctl_max_recv_allocation)"

This patch fixes this by using atomic_inc_unless to eliminate the
possibility of allocating more than rds_ib_sysctl_max_recv_allocation
and then decrementing the count if the allocation fails. It also
makes an identical change to the iwarp transport.

Reported-by: Shin Hong <hongshin@gmail.com>
Signed-off-by: Andy Grover <andy.grover@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-10-30 15:06:38 -07:00
..
af_rds.c RDS: Add GET_MR_FOR_DEST sockopt 2009-10-30 15:06:37 -07:00
bind.c RDS: Add a debug message suggesting to load transport modules 2009-08-23 19:13:14 -07:00
cong.c RDS: Export symbols from core RDS 2009-08-23 19:13:07 -07:00
connection.c RDS: Export symbols from core RDS 2009-08-23 19:13:07 -07:00
ib.c RDS: Track transports via an array, not a list 2009-08-23 19:13:12 -07:00
ib.h RDS/IB: Always use PAGE_SIZE for FMR page size 2009-07-20 08:03:13 -07:00
ib_cm.c RDS/IB: Drop connection when a fatal QP event is received 2009-07-20 08:03:11 -07:00
ib_rdma.c RDS/IB: Always use PAGE_SIZE for FMR page size 2009-07-20 08:03:13 -07:00
ib_recv.c RDS: Fix potential race around rds_i[bw]_allocation 2009-10-30 15:06:38 -07:00
ib_ring.c RDS/IW+IB: Set recv ring low water mark to 1/2 full. 2009-04-09 17:21:14 -07:00
ib_send.c RDS/IW+IB: Allow max credit advertise window. 2009-04-09 17:21:17 -07:00
ib_stats.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu 2009-09-15 09:39:44 -07:00
ib_sysctl.c RDS/IB: Disable flow control in sysctl and explain why 2009-07-20 08:03:10 -07:00
info.c RDS: Export symbols from core RDS 2009-08-23 19:13:07 -07:00
info.h RDS: Info and stats 2009-02-26 23:39:25 -08:00
iw.c RDS: Track transports via an array, not a list 2009-08-23 19:13:12 -07:00
iw.h RDS/IW: Remove page_shift variable from iwarp transport 2009-07-20 08:03:14 -07:00
iw_cm.c RDS: Use spinlock to protect 64b value update on 32b archs 2009-04-02 00:52:22 -07:00
iw_rdma.c RDS/IW: Remove page_shift variable from iwarp transport 2009-07-20 08:03:14 -07:00
iw_recv.c RDS: Fix potential race around rds_i[bw]_allocation 2009-10-30 15:06:38 -07:00
iw_ring.c RDS/IW+IB: Set recv ring low water mark to 1/2 full. 2009-04-09 17:21:14 -07:00
iw_send.c RDS/IW: Remove page_shift variable from iwarp transport 2009-07-20 08:03:14 -07:00
iw_stats.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu 2009-09-15 09:39:44 -07:00
iw_sysctl.c RDS: Add iWARP support 2009-02-26 23:39:33 -08:00
Kconfig RDS: Modularize RDMA and TCP transports 2009-08-23 19:13:09 -07:00
loop.c RDS: loopback 2009-02-26 23:39:26 -08:00
loop.h RDS: loopback 2009-02-26 23:39:26 -08:00
Makefile RDS: Modularize RDMA and TCP transports 2009-08-23 19:13:09 -07:00
message.c RDS: Export symbols from core RDS 2009-08-23 19:13:07 -07:00
page.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu 2009-09-15 09:39:44 -07:00
rdma.c RDS: Add GET_MR_FOR_DEST sockopt 2009-10-30 15:06:37 -07:00
rdma.h RDS: Add GET_MR_FOR_DEST sockopt 2009-10-30 15:06:37 -07:00
rdma_transport.c RDS: Modularize RDMA and TCP transports 2009-08-23 19:13:09 -07:00
rdma_transport.h RDS: Common RDMA transport code 2009-02-26 23:39:33 -08:00
rds.h RDS: Track transports via an array, not a list 2009-08-23 19:13:12 -07:00
recv.c RDS: Export symbols from core RDS 2009-08-23 19:13:07 -07:00
send.c RDS: Export symbols from core RDS 2009-08-23 19:13:07 -07:00
stats.c RDS: Export symbols from core RDS 2009-08-23 19:13:07 -07:00
sysctl.c RDS: sysctls 2009-02-26 23:39:26 -08:00
tcp.c RDS: Track transports via an array, not a list 2009-08-23 19:13:12 -07:00
tcp.h RDS: Add TCP transport to RDS 2009-08-23 19:13:02 -07:00
tcp_connect.c RDS: Add TCP transport to RDS 2009-08-23 19:13:02 -07:00
tcp_listen.c inet: rename some inet_sock fields 2009-10-18 18:52:53 -07:00
tcp_recv.c RDS: Add TCP transport to RDS 2009-08-23 19:13:02 -07:00
tcp_send.c RDS: Add TCP transport to RDS 2009-08-23 19:13:02 -07:00
tcp_stats.c RDS: Add TCP transport to RDS 2009-08-23 19:13:02 -07:00
threads.c RDS: Export symbols from core RDS 2009-08-23 19:13:07 -07:00
transport.c RDS: Track transports via an array, not a list 2009-08-23 19:13:12 -07:00