Re: [PATCH net] octeontx2-pf: Add missing mutex lock in otx2_get_pauseparam

From: Simon Horman
Date: Tue Nov 28 2023 - 12:21:05 EST


On Sat, Nov 25, 2023 at 10:05:41PM +0530, Subbaraya Sundeep wrote:
> All the mailbox messages sent to AF needs to be guarded
> by mutex lock. Add the missing lock in otx2_get_pauseparam
> function.
>
> Fixes: 75f36270990c ("octeontx2-pf: Support to enable/disable pause frames via ethtool")
> Signed-off-by: Subbaraya Sundeep <sbhatta@xxxxxxxxxxx>

Hi,

I am wondering if the call to otx2_nix_config_bp()
in otx2_dcbnl_ieee_setpfc() also needs to be protected by mbox.lock.

And although not strictly related to this patch, while looking over this, I
noticed that in otx2_init_hw_resources() it appears that &mbox->lock may be
unlocked twice in some error paths.

e.g.
/* Init Auras and pools used by NIX RQ, for free buffer ptrs */
err = otx2_rq_aura_pool_init(pf);
if (err) {
mutex_unlock(&mbox->lock);
goto err_free_nix_lf;
}
...
err_free_nix_lf:
mutex_lock(&mbox->lock);
...

...