All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [bug report] net/mlx5e: Generalize IPsec work structs
Date: Sun, 23 Apr 2023 16:24:12 +0300	[thread overview]
Message-ID: <20230423132412.GB4782@unreal> (raw)
In-Reply-To: <9ef32c2b-8e07-486b-af8d-9d332d5426ab@kili.mountain>

On Thu, Apr 20, 2023 at 11:24:09AM +0300, Dan Carpenter wrote:
> Hello Leon Romanovsky,
> 
> This is a semi-automatic email about new static checker warnings.
> 
> The patch 4562116f8a56: "net/mlx5e: Generalize IPsec work structs"
> from Mar 30, 2023, leads to the following Smatch complaint:
> 
>     drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c:755 mlx5e_xfrm_free_state()
>     error: we previously assumed 'sa_entry->work' could be null (see line 746)

Thanks for the report,
I fixed it in commit 94edec448479 ("net/mlx5e: Properly release work data structure")

> 
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
>    745	
>    746		if (sa_entry->work)
>                     ^^^^^^^^^^^^^^
> 
>    747			cancel_work_sync(&sa_entry->work->work);
>    748	
>    749		if (sa_entry->dwork)
>                     ^^^^^^^^^^^^^^^
> These checks can be deleted, right?
> 
>    750			cancel_delayed_work_sync(&sa_entry->dwork->dwork);
>    751	
>    752		mlx5e_accel_ipsec_fs_del_rule(sa_entry);
>    753		mlx5_ipsec_free_sa_ctx(sa_entry);
>    754		kfree(sa_entry->dwork);
>    755		kfree(sa_entry->work->data);
>                       ^^^^^^^^^^^^^^^^^^^^
> Unchecked dereference.
> 
>    756		kfree(sa_entry->work);
>    757	sa_entry_free:
> 
> regards,
> dan carpenter

      reply	other threads:[~2023-04-23 13:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-20  8:24 [bug report] net/mlx5e: Generalize IPsec work structs Dan Carpenter
2023-04-23 13:24 ` Leon Romanovsky [this message]

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=20230423132412.GB4782@unreal \
    --to=leon@kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=linux-rdma@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 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.