linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] net/mlx5e: Generalize IPsec work structs
@ 2023-04-20  8:24 Dan Carpenter
  2023-04-23 13:24 ` Leon Romanovsky
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2023-04-20  8:24 UTC (permalink / raw)
  To: leon; +Cc: linux-rdma

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)

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

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

* Re: [bug report] net/mlx5e: Generalize IPsec work structs
  2023-04-20  8:24 [bug report] net/mlx5e: Generalize IPsec work structs Dan Carpenter
@ 2023-04-23 13:24 ` Leon Romanovsky
  0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2023-04-23 13:24 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-rdma

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

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

end of thread, other threads:[~2023-04-23 13:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-20  8:24 [bug report] net/mlx5e: Generalize IPsec work structs Dan Carpenter
2023-04-23 13:24 ` Leon Romanovsky

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).