rds: avoid potential stack overflow
authorArnd Bergmann <arnd@arndb.de>
Wed, 11 Mar 2015 21:46:59 +0000 (22:46 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 24 May 2015 08:10:49 +0000 (10:10 +0200)
commit71372d0e02d5ce142d36f963b7eda542876da75f
tree3647b1dc8d2b9dd0d9007fcb3d4b3a84c7b17b10
parentc5424cf0b04845c76a87baa4a0fc51dc67340369
rds: avoid potential stack overflow

[ Upstream commit f862e07cf95d5b62a5fc5e981dd7d0dbaf33a501 ]

The rds_iw_update_cm_id function stores a large 'struct rds_sock' object
on the stack in order to pass a pair of addresses. This happens to just
fit withint the 1024 byte stack size warning limit on x86, but just
exceed that limit on ARM, which gives us this warning:

net/rds/iw_rdma.c:200:1: warning: the frame size of 1056 bytes is larger than 1024 bytes [-Wframe-larger-than=]

As the use of this large variable is basically bogus, we can rearrange
the code to not do that. Instead of passing an rds socket into
rds_iw_get_device, we now just pass the two addresses that we have
available in rds_iw_update_cm_id, and we change rds_iw_get_mr accordingly,
to create two address structures on the stack there.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
(cherry picked from commit 3fe2d645fe4ea7ff6cba9020685e46c1a1dff9c0)

Signed-off-by: Willy Tarreau <w@1wt.eu>
net/rds/iw_rdma.c