• Yuval Basson's avatar
    qed: Fix use after free in qed_chain_free · 64325c28
    Yuval Basson authored
    commit 8063f761 upstream.
    
    The qed_chain data structure was modified in
    commit 1a4a6975 ("qed: Chain support for external PBL") to support
    receiving an external pbl (due to iWARP FW requirements).
    The pages pointed to by the pbl are allocated in qed_chain_alloc
    and their virtual address are stored in an virtual addresses array to
    enable accessing and freeing the data. The physical addresses however
    weren't stored and were accessed directly from the external-pbl
    during free.
    
    Destroy-qp flow, leads to freeing the external pbl before the chain is
    freed, when the chain is freed it tries accessing the already freed
    external pbl, leading to a use-after-free. Therefore we need to store
    the physical addresses in additional to the virtual addresses in a
    new data structure.
    
    Fixes: 1a4a6975 ("qed: Chain support for external PBL")
    Signed-off-by: default avatarMichal Kalderon <mkalderon@marvell.com>
    Signed-off-by: default avatarYuval Bason <ybason@marvell.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    64325c28
qed_dev.c 116 KB