diff options
author | Alexander Lobakin <alobakin@marvell.com> | 2020-07-23 00:10:34 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-07-23 03:19:03 +0200 |
commit | 96ca4c50c7f711531d4fa238906f8abbbd0ff517 (patch) | |
tree | 68b99966ced35c21e2a24afc21b224b9fdb6b7ae /drivers | |
parent | qed: move chain methods to a separate file (diff) | |
download | linux-96ca4c50c7f711531d4fa238906f8abbbd0ff517.tar.xz linux-96ca4c50c7f711531d4fa238906f8abbbd0ff517.zip |
qed: prevent possible double-frees of the chains
Zero-initialize chain on qed_chain_free(), so it couldn't be freed
twice and provoke undefined behaviour.
Signed-off-by: Alexander Lobakin <alobakin@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: Michal Kalderon <michal.kalderon@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/qlogic/qed/qed_chain.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/ethernet/qlogic/qed/qed_chain.c b/drivers/net/ethernet/qlogic/qed/qed_chain.c index bab02ff32514..917b783433f7 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_chain.c +++ b/drivers/net/ethernet/qlogic/qed/qed_chain.c @@ -92,8 +92,10 @@ void qed_chain_free(struct qed_dev *cdev, struct qed_chain *chain) qed_chain_free_pbl(cdev, chain); break; default: - break; + return; } + + qed_chain_init_mem(chain, NULL, 0); } static int |