netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Sai Krishna <saikrishnag@marvell.com>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, sgoutham@marvell.com,
	gakula@marvell.com, richardcochran@gmail.com,
	lcherian@marvell.com, jerinj@marvell.com, hkelam@marvell.com,
	sbhatta@marvell.com
Subject: Re: [net PATCH v2 3/7] octeontx2-af: Add validation for lmac type
Date: Sun, 9 Apr 2023 20:30:15 +0300	[thread overview]
Message-ID: <20230409173015.GK182481@unreal> (raw)
In-Reply-To: <20230407122344.4059-4-saikrishnag@marvell.com>

On Fri, Apr 07, 2023 at 05:53:40PM +0530, Sai Krishna wrote:
> From: Hariprasad Kelam <hkelam@marvell.com>
> 
> Upon physical link change, firmware reports to the kernel about the
> change along with the details like speed, lmac_type_id, etc.
> Kernel derives lmac_type based on lmac_type_id received from firmware.
> 
> In a few scenarios, firmware returns an invalid lmac_type_id, which
> is resulting in below kernel panic. This patch adds the missing
> validation of the lmac_type_id field.
> 
> Internal error: Oops: 96000005 [#1] PREEMPT SMP
> [   35.321595] Modules linked in:
> [   35.328982] CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted
> 5.4.210-g2e3169d8e1bc-dirty #17
> [   35.337014] Hardware name: Marvell CN103XX board (DT)
> [   35.344297] Workqueue: events work_for_cpu_fn
> [   35.352730] pstate: 40400089 (nZcv daIf +PAN -UAO)
> [   35.360267] pc : strncpy+0x10/0x30
> [   35.366595] lr : cgx_link_change_handler+0x90/0x180
> 
> Fixes: 61071a871ea6 ("octeontx2-af: Forward CGX link notifications to PFs")
> Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
> Signed-off-by: Sunil Kovvuri Goutham <sgoutham@marvell.com>
> Signed-off-by: Sai Krishna <saikrishnag@marvell.com>
> 

Your patch missing --- trailers and probably won't apply correctly.

Thanks

>  drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
> index 724df6398bbe..bd77152bb8d7 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
> @@ -1231,6 +1231,14 @@ static inline void link_status_user_format(u64 lstat,
>  	linfo->an = FIELD_GET(RESP_LINKSTAT_AN, lstat);
>  	linfo->fec = FIELD_GET(RESP_LINKSTAT_FEC, lstat);
>  	linfo->lmac_type_id = FIELD_GET(RESP_LINKSTAT_LMAC_TYPE, lstat);
> +
> +	if (linfo->lmac_type_id >= LMAC_MODE_MAX) {
> +		dev_err(&cgx->pdev->dev, "Unknown lmac_type_id %d reported by firmware on cgx port%d:%d",
> +			linfo->lmac_type_id, cgx->cgx_id, lmac_id);
> +		strncpy(linfo->lmac_type, "Unknown", LMACTYPE_STR_LEN - 1);
> +		return;
> +	}
> +
>  	lmac_string = cgx_lmactype_string[linfo->lmac_type_id];
>  	strncpy(linfo->lmac_type, lmac_string, LMACTYPE_STR_LEN - 1);
>  }
> -- 
> 2.25.1
> 

  parent reply	other threads:[~2023-04-09 17:30 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-07 12:23 [net PATCH v2 0/7] octeontx2: Miscellaneous fixes Sai Krishna
2023-04-07 12:23 ` [net PATCH v2 1/7] octeontx2-af: Secure APR table update with the lock Sai Krishna
2023-04-08 14:33   ` Simon Horman
2023-04-10  8:25     ` Sai Krishna Gajula
2023-04-07 12:23 ` [net PATCH v2 2/7] octeontx2-af: Fix start and end bit for scan config Sai Krishna
2023-04-08 14:40   ` Simon Horman
2023-04-10  8:39     ` Sai Krishna Gajula
2023-04-07 12:23 ` [net PATCH v2 3/7] octeontx2-af: Add validation for lmac type Sai Krishna
2023-04-08 14:42   ` Simon Horman
2023-04-09 17:30   ` Leon Romanovsky [this message]
2023-04-10  6:08     ` Sai Krishna Gajula
2023-04-07 12:23 ` [net PATCH v2 4/7] octeontx2-af: Update correct mask to filter IPv4 fragments Sai Krishna
2023-04-08 14:43   ` Simon Horman
2023-04-07 12:23 ` [net PATCH v2 5/7] octeontx2-af: Fix issues with NPC field hash extract Sai Krishna
2023-04-08 15:21   ` Simon Horman
2023-04-10  8:43     ` Sai Krishna Gajula
2023-04-07 12:23 ` [net PATCH v2 6/7] octeontx2-af: Skip PFs if not enabled Sai Krishna
2023-04-08 14:56   ` Simon Horman
2023-04-14 11:58     ` Sai Krishna Gajula
2023-04-07 12:23 ` [net PATCH v2 7/7] octeontx2-pf: Disable packet I/O for graceful exit Sai Krishna
2023-04-08 14:29   ` Simon Horman
2023-04-10  8:49     ` Sai Krishna Gajula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230409173015.GK182481@unreal \
    --to=leon@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gakula@marvell.com \
    --cc=hkelam@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=kuba@kernel.org \
    --cc=lcherian@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=saikrishnag@marvell.com \
    --cc=sbhatta@marvell.com \
    --cc=sgoutham@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).