diff options
author | Wei Hu <whu@FreeBSD.org> | 2023-08-11 03:30:38 +0000 |
---|---|---|
committer | Wei Hu <whu@FreeBSD.org> | 2023-08-11 03:30:38 +0000 |
commit | 7b9bd54ae86db1ac81d10964be4e3acf1b877495 (patch) | |
tree | dae778aa250a2b099d64b6875f023111e4729bf7 | |
parent | 535af610a4fdace6d50960c0ad9be0597eea7a1b (diff) | |
download | src-7b9bd54ae86db1ac81d10964be4e3acf1b877495.tar.gz src-7b9bd54ae86db1ac81d10964be4e3acf1b877495.zip |
mana: fix a KASSERT panic on recursed lock access in mana_cfg_vport
The panic stack looks like this:
panic: _sx_xlock_hard: recursed on non-recursive sx MANA port lock
@ /usr/src/sys/dev/mana/mana_en.c:1022
KDB: stack backtrace:
vpanic() at vpanic+0x150/frame 0xfffffe011b3c1970
panic() at panic+0x43/frame 0xfffffe011b3c19d0
_sx_xlock_hard() at _sx_xlock_hard+0x82d/frame 0xfffffe011b3c1a70
_sx_xlock() at _sx_xlock+0xb0/frame 0xfffffe011b3c1ab0
mana_cfg_vport() at mana_cfg_vport+0x79/frame 0xfffffe011b3c1b40
mana_alloc_queues() at mana_alloc_queues+0x3b/frame 0xfffffe011b3c1c50
mana_up() at mana_up+0x40/frame 0xfffffe011b3c1c70
mana_ioctl() at mana_ioctl+0x25b/frame 0xfffffe011b3c1cb0
ifhwioctl() at ifhwioctl+0xd11/frame 0xfffffe011b3c1db0
hn_xpnt_vf_init() at hn_xpnt_vf_init+0x15f/frame 0xfffffe011b3c1e10
The lock has already been held in the caller. Remove this
redundant lock attempt.
Reported by: NetApp
Sponsored by: Microsoft
-rw-r--r-- | sys/dev/mana/mana_en.c | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/sys/dev/mana/mana_en.c b/sys/dev/mana/mana_en.c index 9d9a4084efe1..4bab6719e59f 100644 --- a/sys/dev/mana/mana_en.c +++ b/sys/dev/mana/mana_en.c @@ -983,14 +983,12 @@ mana_query_vport_cfg(struct mana_port_context *apc, uint32_t vport_index, void mana_uncfg_vport(struct mana_port_context *apc) { - MANA_APC_LOCK_LOCK(apc); apc->vport_use_count--; if (apc->vport_use_count < 0) { mana_err(NULL, "WARNING: vport_use_count less than 0: %u\n", apc->vport_use_count); } - MANA_APC_LOCK_UNLOCK(apc); } int @@ -1019,13 +1017,10 @@ mana_cfg_vport(struct mana_port_context *apc, uint32_t protection_dom_id, * QPs on a physical port up to the hardware limits independent of the * Ethernet usage on the same port. */ - MANA_APC_LOCK_LOCK(apc); if (apc->vport_use_count > 0) { - MANA_APC_LOCK_UNLOCK(apc); return EBUSY; } apc->vport_use_count++; - MANA_APC_LOCK_UNLOCK(apc); mana_gd_init_req_hdr(&req.hdr, MANA_CONFIG_VPORT_TX, sizeof(req), sizeof(resp)); |