All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5.10 0/1] eth: ena: Check return value of xdp_convert_buff_to_frame
@ 2022-10-03 11:48 Peter Kosyh
  2022-10-03 11:48 ` [PATCH 5.10 1/1] " Peter Kosyh
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Kosyh @ 2022-10-03 11:48 UTC (permalink / raw)
  To: stable, Greg Kroah-Hartman
  Cc: Peter Kosyh, Netanel Belgazal, Arthur Kiyanovski, Guy Tzalik,
	Saeed Bishara, Zorik Machulsky, lvc-project

Return value of a function 'xdp_convert_buff_to_frame' is dereferenced
without checking for null, but it is usually checked for this function.

This fixed in upstream commit <e8223eeff02> while refactoring. So,
simpler patch is offered for a stable version.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 5.10 1/1] eth: ena: Check return value of xdp_convert_buff_to_frame
  2022-10-03 11:48 [PATCH 5.10 0/1] eth: ena: Check return value of xdp_convert_buff_to_frame Peter Kosyh
@ 2022-10-03 11:48 ` Peter Kosyh
  2022-10-03 13:59   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Kosyh @ 2022-10-03 11:48 UTC (permalink / raw)
  To: stable, Greg Kroah-Hartman
  Cc: Peter Kosyh, Netanel Belgazal, Arthur Kiyanovski, Guy Tzalik,
	Saeed Bishara, Zorik Machulsky, lvc-project

Return value of a function 'xdp_convert_buff_to_frame' is dereferenced
without checking for null, but it is usually checked for this function.

This fixed in upstream commit <e8223eeff02> while refactoring.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Peter Kosyh <pkosyh@yandex.ru>
---
 drivers/net/ethernet/amazon/ena/ena_netdev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index 52414ac2c901..9e6b2bd73dac 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -237,6 +237,8 @@ static int ena_xdp_tx_map_buff(struct ena_ring *xdp_ring,
 	u32 size;
 
 	tx_info->xdpf = xdp_convert_buff_to_frame(xdp);
+	if (unlikely(!tx_info->xdpf))
+		goto error_report_dma_error;
 	size = tx_info->xdpf->len;
 	ena_buf = tx_info->bufs;
 
-- 
2.37.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 5.10 1/1] eth: ena: Check return value of xdp_convert_buff_to_frame
  2022-10-03 11:48 ` [PATCH 5.10 1/1] " Peter Kosyh
@ 2022-10-03 13:59   ` Greg Kroah-Hartman
  2022-10-05 10:45     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2022-10-03 13:59 UTC (permalink / raw)
  To: Peter Kosyh
  Cc: stable, Netanel Belgazal, Arthur Kiyanovski, Guy Tzalik,
	Saeed Bishara, Zorik Machulsky, lvc-project

On Mon, Oct 03, 2022 at 02:48:19PM +0300, Peter Kosyh wrote:
> Return value of a function 'xdp_convert_buff_to_frame' is dereferenced
> without checking for null, but it is usually checked for this function.
> 
> This fixed in upstream commit <e8223eeff02> while refactoring.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Peter Kosyh <pkosyh@yandex.ru>
> ---
>  drivers/net/ethernet/amazon/ena/ena_netdev.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
> index 52414ac2c901..9e6b2bd73dac 100644
> --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
> +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
> @@ -237,6 +237,8 @@ static int ena_xdp_tx_map_buff(struct ena_ring *xdp_ring,
>  	u32 size;
>  
>  	tx_info->xdpf = xdp_convert_buff_to_frame(xdp);
> +	if (unlikely(!tx_info->xdpf))
> +		goto error_report_dma_error;
>  	size = tx_info->xdpf->len;
>  	ena_buf = tx_info->bufs;
>  
> -- 
> 2.37.0
> 

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 5.10 1/1] eth: ena: Check return value of xdp_convert_buff_to_frame
  2022-10-03 13:59   ` Greg Kroah-Hartman
@ 2022-10-05 10:45     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2022-10-05 10:45 UTC (permalink / raw)
  To: Peter Kosyh
  Cc: stable, Netanel Belgazal, Arthur Kiyanovski, Guy Tzalik,
	Saeed Bishara, Zorik Machulsky, lvc-project

On Mon, Oct 03, 2022 at 03:59:08PM +0200, Greg Kroah-Hartman wrote:
> On Mon, Oct 03, 2022 at 02:48:19PM +0300, Peter Kosyh wrote:
> > Return value of a function 'xdp_convert_buff_to_frame' is dereferenced
> > without checking for null, but it is usually checked for this function.
> > 
> > This fixed in upstream commit <e8223eeff02> while refactoring.
> > 
> > Found by Linux Verification Center (linuxtesting.org) with SVACE.
> > 
> > Signed-off-by: Peter Kosyh <pkosyh@yandex.ru>
> > ---
> >  drivers/net/ethernet/amazon/ena/ena_netdev.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
> > index 52414ac2c901..9e6b2bd73dac 100644
> > --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
> > +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
> > @@ -237,6 +237,8 @@ static int ena_xdp_tx_map_buff(struct ena_ring *xdp_ring,
> >  	u32 size;
> >  
> >  	tx_info->xdpf = xdp_convert_buff_to_frame(xdp);
> > +	if (unlikely(!tx_info->xdpf))
> > +		goto error_report_dma_error;
> >  	size = tx_info->xdpf->len;
> >  	ena_buf = tx_info->bufs;
> >  
> > -- 
> > 2.37.0
> > 
> 
> <formletter>
> 
> This is not the correct way to submit patches for inclusion in the
> stable kernel tree.  Please read:
>     https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
> for how to do this properly.
> 
> </formletter>

To be specific, why is this non-upstream commit really needed?  Can
xdp_convert_buff_to_frame() ever fail under normal operation?  Why was
this one commit picked?  And always properly reference commits in
changelog text as the documentation asks you to.

Also, you didn't cc: everyone involved in the original commit, nor
showed how you tested this in anyway (hint, read
Documentation/process/researcher-guidelines.rst)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-05 10:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-03 11:48 [PATCH 5.10 0/1] eth: ena: Check return value of xdp_convert_buff_to_frame Peter Kosyh
2022-10-03 11:48 ` [PATCH 5.10 1/1] " Peter Kosyh
2022-10-03 13:59   ` Greg Kroah-Hartman
2022-10-05 10:45     ` Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.