linux/net/rds
Linus Torvalds dcef84f17a net: fix rds_iovec page count overflow
commit 1b1f693d7a upstream.

As reported by Thomas Pollet, the rdma page counting can overflow.  We
get the rdma sizes in 64-bit unsigned entities, but then limit it to
UINT_MAX bytes and shift them down to pages (so with a possible "+1" for
an unaligned address).

So each individual page count fits comfortably in an 'unsigned int' (not
even close to overflowing into signed), but as they are added up, they
might end up resulting in a signed return value. Which would be wrong.

Catch the case of tot_pages turning negative, and return the appropriate
error code.

Reported-by: Thomas Pollet <thomas.pollet@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Andy Grover <andy.grover@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[v2: nr is unsigned in the old code]
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Brad Figg <brad.figg@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-04-22 08:44:32 -07:00
..
af_rds.c net: Make setsockopt() optlen be unsigned. 2009-09-30 16:12:20 -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_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/IB: Rename byte_len to data_len to enhance readability 2009-07-20 08:03:07 -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
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
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_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/IW+IB: Allow max credit advertise window. 2009-04-09 17:21:17 -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
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
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 De-pessimize rds_page_copy_user 2010-10-28 21:44:05 -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
rdma.c net: fix rds_iovec page count overflow 2011-04-22 08:44:32 -07:00
rdma.h RDS: RDMA support 2009-02-26 23:39:29 -08:00
rds.h RDS: Track transports via an array, not a list 2009-08-23 19:13:12 -07:00
recv.c rds: fix a leak of kernel memory 2010-09-26 17:21:20 -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_connect.c RDS: Add TCP transport to RDS 2009-08-23 19:13:02 -07:00
tcp_listen.c RDS: Add TCP transport to RDS 2009-08-23 19:13:02 -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
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
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