lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241212172157.40c7bf3a@kernel.org>
Date: Thu, 12 Dec 2024 17:21:57 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Lorenz Brun <lorenz@...n.one>
Cc: Igor Russkikh <irusskikh@...vell.com>, "David S. Miller"
 <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Paolo Abeni
 <pabeni@...hat.com>, Manuel Ullmann <labre@...teo.de>,
 netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net] net: atlantic: keep rings across suspend/resume

On Thu, 12 Dec 2024 03:39:24 +0100 Lorenz Brun wrote:
> -void aq_nic_deinit(struct aq_nic_s *self, bool link_down)
> +void aq_nic_deinit(struct aq_nic_s *self, bool link_down, bool keep_rings)
>  {
>  	struct aq_vec_s *aq_vec = NULL;
>  	unsigned int i = 0U;
> @@ -1433,7 +1433,8 @@ void aq_nic_deinit(struct aq_nic_s *self, bool link_down)
>  	for (i = 0U; i < self->aq_vecs; i++) {
>  		aq_vec = self->aq_vec[i];
>  		aq_vec_deinit(aq_vec);
> -		aq_vec_ring_free(aq_vec);
> +		if (!keep_rings)
> +			aq_vec_ring_free(aq_vec);
>  	}

I'd suggest to break out the memory freeing from aq_nic_deinit(),
and conversely allocating from aq_nic_init(). Then explicitly call
free / alloc from where aq_nic_deinit() / aq_nic_init() are called.

The booleans passed into init functions are pretty error prone.
Pretty quickly one needs to grep the entire driver to find which
callsites pass what.
-- 
pw-bot: cr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ