mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 10:33:41 +02:00
bnxt_en: Fix netdev locking in ULP IRQ functions
netdev_lock is already held when calling bnxt_ulp_irq_stop() and
bnxt_ulp_irq_restart(). When converting rtnl_lock to netdev_lock,
the original code was rtnl_dereference() to indicate that rtnl_lock
was already held. rcu_dereference_protected() is the correct
conversion after replacing rtnl_lock with netdev_lock.
Add a new helper netdev_lock_dereference() similar to
rtnl_dereference().
Fixes: 004b500801 ("eth: bnxt: remove most dependencies on RTNL")
Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250519204130.3097027-2-michael.chan@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
48a6285507
commit
aed031da7e
|
|
@ -20,6 +20,7 @@
|
|||
#include <asm/byteorder.h>
|
||||
#include <linux/bitmap.h>
|
||||
#include <linux/auxiliary_bus.h>
|
||||
#include <net/netdev_lock.h>
|
||||
|
||||
#include "bnxt_hsi.h"
|
||||
#include "bnxt.h"
|
||||
|
|
@ -309,14 +310,12 @@ void bnxt_ulp_irq_stop(struct bnxt *bp)
|
|||
if (!ulp->msix_requested)
|
||||
return;
|
||||
|
||||
netdev_lock(bp->dev);
|
||||
ops = rcu_dereference(ulp->ulp_ops);
|
||||
ops = netdev_lock_dereference(ulp->ulp_ops, bp->dev);
|
||||
if (!ops || !ops->ulp_irq_stop)
|
||||
return;
|
||||
if (test_bit(BNXT_STATE_FW_RESET_DET, &bp->state))
|
||||
reset = true;
|
||||
ops->ulp_irq_stop(ulp->handle, reset);
|
||||
netdev_unlock(bp->dev);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -335,8 +334,7 @@ void bnxt_ulp_irq_restart(struct bnxt *bp, int err)
|
|||
if (!ulp->msix_requested)
|
||||
return;
|
||||
|
||||
netdev_lock(bp->dev);
|
||||
ops = rcu_dereference(ulp->ulp_ops);
|
||||
ops = netdev_lock_dereference(ulp->ulp_ops, bp->dev);
|
||||
if (!ops || !ops->ulp_irq_restart)
|
||||
return;
|
||||
|
||||
|
|
@ -348,7 +346,6 @@ void bnxt_ulp_irq_restart(struct bnxt *bp, int err)
|
|||
bnxt_fill_msix_vecs(bp, ent);
|
||||
}
|
||||
ops->ulp_irq_restart(ulp->handle, ent);
|
||||
netdev_unlock(bp->dev);
|
||||
kfree(ent);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,6 +98,9 @@ static inline int netdev_lock_cmp_fn(const struct lockdep_map *a,
|
|||
&qdisc_xmit_lock_key); \
|
||||
}
|
||||
|
||||
#define netdev_lock_dereference(p, dev) \
|
||||
rcu_dereference_protected(p, lockdep_is_held(&(dev)->lock))
|
||||
|
||||
int netdev_debug_event(struct notifier_block *nb, unsigned long event,
|
||||
void *ptr);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user