On 13/11/2024 11:13, Shinas Rasheed wrote:
> During unload, at times the OQ parsed in the napi callbacks
> have been observed to be null, causing system crash.
> Add protective checks to avoid the same, for cn9k cards.
>
> Fixes: cb7dd712189f ("octeon_ep_vf: Add driver framework and device initialization")
> Signed-off-by: Shinas Rasheed <srasheed@marvell.com>
> ---
> V4:
> - No changes
>
> V3: https://lore.kernel.org/all/20241108074543.1123036-7-srasheed@marvell.com/
> - Added back "Fixes" to the changelist
>
> V2: https://lore.kernel.org/all/20241107132846.1118835-7-srasheed@marvell.com/
> - Split into a separate patch
> - Added more context
>
> V1: https://lore.kernel.org/all/20241101103416.1064930-4-srasheed@marvell.com/
>
> drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_cn9k.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_cn9k.c b/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_cn9k.c
> index 88937fce75f1..f1b7eda3fa42 100644
> --- a/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_cn9k.c
> +++ b/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_cn9k.c
> @@ -273,8 +273,14 @@ static irqreturn_t octep_vf_ioq_intr_handler_cn93(void *data)
> struct octep_vf_oq *oq;
> u64 reg_val;
>
> - oct = vector->octep_vf_dev;
> + if (!vector)
> + return IRQ_HANDLED;
And again, this function is irq handler, which is
called from octep_vf_ioq_intr_handler() only if ioq_vector was properly
resolved. This check makes no sense here.
The same goes to the next patch.
> +
> oq = vector->oq;
> + if (!oq)
> + return IRQ_HANDLED;
> +
> + oct = vector->octep_vf_dev;
> /* Mailbox interrupt arrives along with interrupt of tx/rx ring pair 0 */
> if (oq->q_no == 0) {
> reg_val = octep_vf_read_csr64(oct, CN93_VF_SDP_R_MBOX_PF_VF_INT(0));