Skip to content

Commit 28e63d0

Browse files
author
Paolo Abeni
committed
Merge branch 'bnxt_en-bug-fixes'
Michael Chan says: ==================== bnxt_en: Bug fixes This small series contains 2 fixes. The first one fixes the PTP initialization logic on older chips to avoid logging a warning. The second one fixes a potenial NULL pointer dereference in the driver's aux bus unload path. ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
2 parents e50b9b9 + 4f4e54b commit 28e63d0

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7627,7 +7627,7 @@ static int __bnxt_hwrm_ptp_qcfg(struct bnxt *bp)
76277627
u8 flags;
76287628
int rc;
76297629

7630-
if (bp->hwrm_spec_code < 0x10801) {
7630+
if (bp->hwrm_spec_code < 0x10801 || !BNXT_CHIP_P5_THOR(bp)) {
76317631
rc = -ENODEV;
76327632
goto no_ptp;
76337633
}

drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ void bnxt_rdma_aux_device_uninit(struct bnxt *bp)
304304
struct auxiliary_device *adev;
305305

306306
/* Skip if no auxiliary device init was done. */
307-
if (!(bp->flags & BNXT_FLAG_ROCE_CAP))
307+
if (!bp->aux_priv)
308308
return;
309309

310310
aux_priv = bp->aux_priv;
@@ -324,6 +324,7 @@ static void bnxt_aux_dev_release(struct device *dev)
324324
bp->edev = NULL;
325325
kfree(aux_priv->edev);
326326
kfree(aux_priv);
327+
bp->aux_priv = NULL;
327328
}
328329

329330
static void bnxt_set_edev_info(struct bnxt_en_dev *edev, struct bnxt *bp)
@@ -359,19 +360,18 @@ void bnxt_rdma_aux_device_init(struct bnxt *bp)
359360
if (!(bp->flags & BNXT_FLAG_ROCE_CAP))
360361
return;
361362

362-
bp->aux_priv = kzalloc(sizeof(*bp->aux_priv), GFP_KERNEL);
363-
if (!bp->aux_priv)
363+
aux_priv = kzalloc(sizeof(*bp->aux_priv), GFP_KERNEL);
364+
if (!aux_priv)
364365
goto exit;
365366

366-
bp->aux_priv->id = ida_alloc(&bnxt_aux_dev_ids, GFP_KERNEL);
367-
if (bp->aux_priv->id < 0) {
367+
aux_priv->id = ida_alloc(&bnxt_aux_dev_ids, GFP_KERNEL);
368+
if (aux_priv->id < 0) {
368369
netdev_warn(bp->dev,
369370
"ida alloc failed for ROCE auxiliary device\n");
370-
kfree(bp->aux_priv);
371+
kfree(aux_priv);
371372
goto exit;
372373
}
373374

374-
aux_priv = bp->aux_priv;
375375
aux_dev = &aux_priv->aux_dev;
376376
aux_dev->id = aux_priv->id;
377377
aux_dev->name = "rdma";
@@ -380,10 +380,11 @@ void bnxt_rdma_aux_device_init(struct bnxt *bp)
380380

381381
rc = auxiliary_device_init(aux_dev);
382382
if (rc) {
383-
ida_free(&bnxt_aux_dev_ids, bp->aux_priv->id);
384-
kfree(bp->aux_priv);
383+
ida_free(&bnxt_aux_dev_ids, aux_priv->id);
384+
kfree(aux_priv);
385385
goto exit;
386386
}
387+
bp->aux_priv = aux_priv;
387388

388389
/* From this point, all cleanup will happen via the .release callback &
389390
* any error unwinding will need to include a call to

0 commit comments

Comments
 (0)