public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Magnus Karlsson <magnus.karlsson@gmail.com>
Cc: gregkh@linuxfoundation.org, sashal@kernel.org,
	stable@vger.kernel.org, bjorn@kernel.org,
	Magnus Karlsson <magnus.karlsson@intel.com>,
	Jeff Shaw <jeffrey.b.shaw@intel.com>
Subject: Re: [PATCH 5.15] ice: fix crash at allocation failure
Date: Wed, 25 May 2022 11:46:52 +0200	[thread overview]
Message-ID: <Yo37DLxvEAf2aYGB@boxer> (raw)
In-Reply-To: <20220525071953.27755-1-magnus.karlsson@gmail.com>

On Wed, May 25, 2022 at 09:19:53AM +0200, Magnus Karlsson wrote:
> From: Magnus Karlsson <magnus.karlsson@intel.com>
> 
> Fix a crash in the zero-copy driver that occurs when it fails to
> allocate buffers from user-space. This crash can easily be triggered
> by a malicious program that does not provide any buffers in the fill
> ring for the kernel to use.
> 
> Note that this bug does not exist in upstream since the batched buffer
> allocation interface got introduced in 5.16 and replaced this code.
> 
> Reported-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> Tested-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>

Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>

> ---
>  drivers/net/ethernet/intel/ice/ice_xsk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c
> index 2b1873061912..5581747947e5 100644
> --- a/drivers/net/ethernet/intel/ice/ice_xsk.c
> +++ b/drivers/net/ethernet/intel/ice/ice_xsk.c
> @@ -378,7 +378,7 @@ bool ice_alloc_rx_bufs_zc(struct ice_ring *rx_ring, u16 count)
>  
>  	do {
>  		*xdp = xsk_buff_alloc(rx_ring->xsk_pool);
> -		if (!xdp) {
> +		if (!*xdp) {
>  			ok = false;
>  			break;
>  		}
> 
> base-commit: 9f43e3ac7e662f352f829077723fa0b92ccaded1
> -- 
> 2.34.1
> 

  reply	other threads:[~2022-05-25  9:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-25  7:19 [PATCH 5.15] ice: fix crash at allocation failure Magnus Karlsson
2022-05-25  9:46 ` Maciej Fijalkowski [this message]
2022-05-26 12:16   ` Greg KH

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=Yo37DLxvEAf2aYGB@boxer \
    --to=maciej.fijalkowski@intel.com \
    --cc=bjorn@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jeffrey.b.shaw@intel.com \
    --cc=magnus.karlsson@gmail.com \
    --cc=magnus.karlsson@intel.com \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /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