]> www.infradead.org Git - users/jedix/linux-maple.git/commit
qed: avoid possible stack overflow in qed_ll2_acquire_connection
authorArnd Bergmann <arnd@arndb.de>
Wed, 18 Jan 2017 14:52:52 +0000 (15:52 +0100)
committerChuck Anderson <chuck.anderson@oracle.com>
Mon, 6 Mar 2017 05:00:25 +0000 (21:00 -0800)
commitb3366fdad53f8162bbd8b14b48ee925e3e192352
tree72cff6892efb770826130abd746c5047d198418c
parentf6c26d754ba3b54f7944fa859c51406ceb6b08eb
qed: avoid possible stack overflow in qed_ll2_acquire_connection

Orabug: 25477939

struct qed_ll2_info is rather large, so putting it on the stack
can cause an overflow, as this warning tries to tell us:

drivers/net/ethernet/qlogic/qed/qed_ll2.c: In function 'qed_ll2_start':
drivers/net/ethernet/qlogic/qed/qed_ll2.c:2159:1: error: the frame size of 1056 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]

qed_ll2_start_ooo() already uses a dynamic allocation for the structure
to work around that problem, and we could do the same in qed_ll2_start()
as well as qed_roce_ll2_start(), but since the structure is only
used to pass a couple of initialization values here, it seems nicer
to replace it with a different structure.

Lacking any idea for better naming, I'm adding 'struct qed_ll2_conn',
which now contains all the initialization data, and this now simply
gets copied into struct qed_ll2_info rather than assigning all members
one by one.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 0629a330cf55454962168dd3ee46fad53a39323e)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
drivers/net/ethernet/qlogic/qed/qed_ll2.c
drivers/net/ethernet/qlogic/qed/qed_ll2.h
drivers/net/ethernet/qlogic/qed/qed_roce.c