• Arnd Bergmann's avatar
    rds: avoid potential stack overflow · c3d353a4
    Arnd Bergmann authored
    commit f862e07c upstream.
    
    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: default avatarArnd Bergmann <arnd@arndb.de>
    Acked-by: default avatarSowmini Varadhan <sowmini.varadhan@oracle.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
    c3d353a4
iw_rdma.c 24.1 KB