mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
net: qed: fix async event callbacks unregistering
qed_spq_unregister_async_cb() should be called before
qed_rdma_info_free() to avoid crash-spawning uses-after-free.
Instead of calling it from each subsystem exit code, do it in one place
on PF down.
Fixes: 291d57f67d
("qed: Fix rdma_info structure allocation")
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>
This commit is contained in:
parent
97dd1abd02
commit
31333c1a25
3 changed files with 7 additions and 5 deletions
|
@ -1368,6 +1368,8 @@ static void qed_dbg_user_data_free(struct qed_hwfn *p_hwfn)
|
||||||
|
|
||||||
void qed_resc_free(struct qed_dev *cdev)
|
void qed_resc_free(struct qed_dev *cdev)
|
||||||
{
|
{
|
||||||
|
struct qed_rdma_info *rdma_info;
|
||||||
|
struct qed_hwfn *p_hwfn;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (IS_VF(cdev)) {
|
if (IS_VF(cdev)) {
|
||||||
|
@ -1385,7 +1387,8 @@ void qed_resc_free(struct qed_dev *cdev)
|
||||||
qed_llh_free(cdev);
|
qed_llh_free(cdev);
|
||||||
|
|
||||||
for_each_hwfn(cdev, i) {
|
for_each_hwfn(cdev, i) {
|
||||||
struct qed_hwfn *p_hwfn = &cdev->hwfns[i];
|
p_hwfn = cdev->hwfns + i;
|
||||||
|
rdma_info = p_hwfn->p_rdma_info;
|
||||||
|
|
||||||
qed_cxt_mngr_free(p_hwfn);
|
qed_cxt_mngr_free(p_hwfn);
|
||||||
qed_qm_info_free(p_hwfn);
|
qed_qm_info_free(p_hwfn);
|
||||||
|
@ -1404,8 +1407,10 @@ void qed_resc_free(struct qed_dev *cdev)
|
||||||
qed_ooo_free(p_hwfn);
|
qed_ooo_free(p_hwfn);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (QED_IS_RDMA_PERSONALITY(p_hwfn))
|
if (QED_IS_RDMA_PERSONALITY(p_hwfn) && rdma_info) {
|
||||||
|
qed_spq_unregister_async_cb(p_hwfn, rdma_info->proto);
|
||||||
qed_rdma_info_free(p_hwfn);
|
qed_rdma_info_free(p_hwfn);
|
||||||
|
}
|
||||||
|
|
||||||
qed_iov_free(p_hwfn);
|
qed_iov_free(p_hwfn);
|
||||||
qed_l2_free(p_hwfn);
|
qed_l2_free(p_hwfn);
|
||||||
|
|
|
@ -2836,8 +2836,6 @@ int qed_iwarp_stop(struct qed_hwfn *p_hwfn)
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
qed_spq_unregister_async_cb(p_hwfn, PROTOCOLID_IWARP);
|
|
||||||
|
|
||||||
return qed_iwarp_ll2_stop(p_hwfn);
|
return qed_iwarp_ll2_stop(p_hwfn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,6 @@ void qed_roce_stop(struct qed_hwfn *p_hwfn)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qed_spq_unregister_async_cb(p_hwfn, PROTOCOLID_ROCE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qed_rdma_copy_gids(struct qed_rdma_qp *qp, __le32 *src_gid,
|
static void qed_rdma_copy_gids(struct qed_rdma_qp *qp, __le32 *src_gid,
|
||||||
|
|
Loading…
Reference in a new issue