From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Piotr Kwapulinski <piotr.kwapulinski@intel.com>
Cc: <intel-wired-lan@lists.osuosl.org>, <netdev@vger.kernel.org>,
<dan.carpenter@linaro.org>, <yuehaibing@huawei.com>,
<przemyslaw.kitszel@intel.com>
Subject: Re: [Intel-wired-lan] [PATCH iwl-next v3] ixgbe: Fix possible skb NULL pointer dereference
Date: Mon, 27 Jan 2025 16:09:08 +0100 [thread overview]
Message-ID: <Z5ehlNnVrb/PdGq8@boxer> (raw)
In-Reply-To: <20250127103836.4742-1-piotr.kwapulinski@intel.com>
On Mon, Jan 27, 2025 at 11:38:36AM +0100, Piotr Kwapulinski wrote:
> The commit c824125cbb18 ("ixgbe: Fix passing 0 to ERR_PTR in
> ixgbe_run_xdp()") stopped utilizing the ERR-like macros for xdp status
> encoding. Propagate this logic to the ixgbe_put_rx_buffer().
>
> The commit also relaxed the skb NULL pointer check - caught by Smatch.
> Restore this check.
>
> Fixes: c824125cbb18 ("ixgbe: Fix passing 0 to ERR_PTR in ixgbe_run_xdp()")
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Signed-off-by: Piotr Kwapulinski <piotr.kwapulinski@intel.com>
> ---
> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index 7236f20..467f812 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> @@ -2105,7 +2105,7 @@ static void ixgbe_put_rx_buffer(struct ixgbe_ring *rx_ring,
> /* hand second half of page back to the ring */
> ixgbe_reuse_rx_page(rx_ring, rx_buffer);
> } else {
> - if (!IS_ERR(skb) && IXGBE_CB(skb)->dma == rx_buffer->dma) {
> + if (skb && IXGBE_CB(skb)->dma == rx_buffer->dma) {
> /* the page has been released from the ring */
> IXGBE_CB(skb)->page_released = true;
> } else {
> --
> v1 -> v2
> Provide extra details in commit message for motivation of this patch.
> v2 -> v3
> Simplify the check condition
Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Thanks!
>
> 2.43.0
>
WARNING: multiple messages have this Message-ID (diff)
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Piotr Kwapulinski <piotr.kwapulinski@intel.com>
Cc: <intel-wired-lan@lists.osuosl.org>, <netdev@vger.kernel.org>,
<dan.carpenter@linaro.org>, <yuehaibing@huawei.com>,
<przemyslaw.kitszel@intel.com>
Subject: Re: [PATCH iwl-next v3] ixgbe: Fix possible skb NULL pointer dereference
Date: Mon, 27 Jan 2025 16:09:08 +0100 [thread overview]
Message-ID: <Z5ehlNnVrb/PdGq8@boxer> (raw)
In-Reply-To: <20250127103836.4742-1-piotr.kwapulinski@intel.com>
On Mon, Jan 27, 2025 at 11:38:36AM +0100, Piotr Kwapulinski wrote:
> The commit c824125cbb18 ("ixgbe: Fix passing 0 to ERR_PTR in
> ixgbe_run_xdp()") stopped utilizing the ERR-like macros for xdp status
> encoding. Propagate this logic to the ixgbe_put_rx_buffer().
>
> The commit also relaxed the skb NULL pointer check - caught by Smatch.
> Restore this check.
>
> Fixes: c824125cbb18 ("ixgbe: Fix passing 0 to ERR_PTR in ixgbe_run_xdp()")
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Signed-off-by: Piotr Kwapulinski <piotr.kwapulinski@intel.com>
> ---
> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index 7236f20..467f812 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> @@ -2105,7 +2105,7 @@ static void ixgbe_put_rx_buffer(struct ixgbe_ring *rx_ring,
> /* hand second half of page back to the ring */
> ixgbe_reuse_rx_page(rx_ring, rx_buffer);
> } else {
> - if (!IS_ERR(skb) && IXGBE_CB(skb)->dma == rx_buffer->dma) {
> + if (skb && IXGBE_CB(skb)->dma == rx_buffer->dma) {
> /* the page has been released from the ring */
> IXGBE_CB(skb)->page_released = true;
> } else {
> --
> v1 -> v2
> Provide extra details in commit message for motivation of this patch.
> v2 -> v3
> Simplify the check condition
Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Thanks!
>
> 2.43.0
>
next prev parent reply other threads:[~2025-01-27 15:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-27 10:38 [Intel-wired-lan] [PATCH iwl-next v3] ixgbe: Fix possible skb NULL pointer dereference Piotr Kwapulinski
2025-01-27 10:38 ` Piotr Kwapulinski
2025-01-27 15:09 ` Maciej Fijalkowski [this message]
2025-01-27 15:09 ` Maciej Fijalkowski
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=Z5ehlNnVrb/PdGq8@boxer \
--to=maciej.fijalkowski@intel.com \
--cc=dan.carpenter@linaro.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=netdev@vger.kernel.org \
--cc=piotr.kwapulinski@intel.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=yuehaibing@huawei.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 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.