public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] smb: client: Better exception handling for SMB3 hash allocations
@ 2025-10-10  6:45 Markus Elfring
  2025-10-10  6:48 ` [PATCH 1/3] smb: client: Return directly after a failed cifs_alloc_hash() in smb3_crypto_shash_allocate() Markus Elfring
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Markus Elfring @ 2025-10-10  6:45 UTC (permalink / raw)
  To: linux-cifs, samba-technical, Aurelien Aptel, Bharath SM,
	Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Steve French,
	Tom Talpey
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 10 Oct 2025 08:40:08 +0200

Refine a few implementation details for further development considerations.

Markus Elfring (3):
  Return directly after a failed cifs_alloc_hash()
    in smb3_crypto_shash_allocate()
  Improve resource release
    in smb311_crypto_shash_allocate()
  Omit a variable initialisation
    in smb311_crypto_shash_allocate()

 fs/smb/client/smb2transport.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

-- 
2.51.0

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

* [PATCH 1/3] smb: client: Return directly after a failed cifs_alloc_hash() in smb3_crypto_shash_allocate()
  2025-10-10  6:45 [PATCH 0/3] smb: client: Better exception handling for SMB3 hash allocations Markus Elfring
@ 2025-10-10  6:48 ` Markus Elfring
  2025-10-10  6:50 ` [PATCH 2/3] smb: client: Improve resource release in smb311_crypto_shash_allocate() Markus Elfring
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Markus Elfring @ 2025-10-10  6:48 UTC (permalink / raw)
  To: linux-cifs, samba-technical, Aurelien Aptel, Bharath SM,
	Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Steve French,
	Tom Talpey
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 9 Oct 2025 18:44:53 +0200

Return directly after a call of the function “cifs_alloc_hash” failed
at the beginning.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 fs/smb/client/smb2transport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/smb/client/smb2transport.c b/fs/smb/client/smb2transport.c
index bc0e92eb2b64..499b00c2a001 100644
--- a/fs/smb/client/smb2transport.c
+++ b/fs/smb/client/smb2transport.c
@@ -34,7 +34,7 @@ smb3_crypto_shash_allocate(struct TCP_Server_Info *server)
 
 	rc = cifs_alloc_hash("hmac(sha256)", &p->hmacsha256);
 	if (rc)
-		goto err;
+		return rc;
 
 	rc = cifs_alloc_hash("cmac(aes)", &p->aes_cmac);
 	if (rc)
-- 
2.51.0



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

* [PATCH 2/3] smb: client: Improve resource release in smb311_crypto_shash_allocate()
  2025-10-10  6:45 [PATCH 0/3] smb: client: Better exception handling for SMB3 hash allocations Markus Elfring
  2025-10-10  6:48 ` [PATCH 1/3] smb: client: Return directly after a failed cifs_alloc_hash() in smb3_crypto_shash_allocate() Markus Elfring
@ 2025-10-10  6:50 ` Markus Elfring
  2025-10-10  6:51 ` [PATCH 3/3] smb: client: Omit a variable initialisation " Markus Elfring
  2025-10-12  9:44 ` [0/3] smb: client: Better exception handling for SMB3 hash allocations Markus Elfring
  3 siblings, 0 replies; 7+ messages in thread
From: Markus Elfring @ 2025-10-10  6:50 UTC (permalink / raw)
  To: linux-cifs, samba-technical, Aurelien Aptel, Bharath SM,
	Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Steve French,
	Tom Talpey
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 9 Oct 2025 19:00:11 +0200

Adjust jump targets so that cifs_free_hash() functions will be called
in a recommended order at the end of this function implementation.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 fs/smb/client/smb2transport.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/smb/client/smb2transport.c b/fs/smb/client/smb2transport.c
index 499b00c2a001..b790f6b970a9 100644
--- a/fs/smb/client/smb2transport.c
+++ b/fs/smb/client/smb2transport.c
@@ -58,16 +58,17 @@ smb311_crypto_shash_allocate(struct TCP_Server_Info *server)
 
 	rc = cifs_alloc_hash("cmac(aes)", &p->aes_cmac);
 	if (rc)
-		goto err;
+		goto free_hmacsha256;
 
 	rc = cifs_alloc_hash("sha512", &p->sha512);
 	if (rc)
-		goto err;
+		goto free_aes_cmac;
 
 	return 0;
 
-err:
+free_aes_cmac:
 	cifs_free_hash(&p->aes_cmac);
+free_hmacsha256:
 	cifs_free_hash(&p->hmacsha256);
 	return rc;
 }
-- 
2.51.0



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

* [PATCH 3/3] smb: client: Omit a variable initialisation in smb311_crypto_shash_allocate()
  2025-10-10  6:45 [PATCH 0/3] smb: client: Better exception handling for SMB3 hash allocations Markus Elfring
  2025-10-10  6:48 ` [PATCH 1/3] smb: client: Return directly after a failed cifs_alloc_hash() in smb3_crypto_shash_allocate() Markus Elfring
  2025-10-10  6:50 ` [PATCH 2/3] smb: client: Improve resource release in smb311_crypto_shash_allocate() Markus Elfring
@ 2025-10-10  6:51 ` Markus Elfring
  2025-10-10 21:47   ` Steve French
  2025-10-12  9:44 ` [0/3] smb: client: Better exception handling for SMB3 hash allocations Markus Elfring
  3 siblings, 1 reply; 7+ messages in thread
From: Markus Elfring @ 2025-10-10  6:51 UTC (permalink / raw)
  To: linux-cifs, samba-technical, Aurelien Aptel, Bharath SM,
	Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Steve French,
	Tom Talpey
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 10 Oct 2025 08:05:21 +0200
Subject: [PATCH 3/3] smb: client: Omit a variable initialisation in smb311_crypto_shash_allocate()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The local variable “rc” is immediately reassigned. Thus omit the explicit
initialisation at the beginning.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 fs/smb/client/smb2transport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/smb/client/smb2transport.c b/fs/smb/client/smb2transport.c
index b790f6b970a9..3f8b0509f8c8 100644
--- a/fs/smb/client/smb2transport.c
+++ b/fs/smb/client/smb2transport.c
@@ -50,7 +50,7 @@ int
 smb311_crypto_shash_allocate(struct TCP_Server_Info *server)
 {
 	struct cifs_secmech *p = &server->secmech;
-	int rc = 0;
+	int rc;
 
 	rc = cifs_alloc_hash("hmac(sha256)", &p->hmacsha256);
 	if (rc)
-- 
2.51.0



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

* Re: [PATCH 3/3] smb: client: Omit a variable initialisation in smb311_crypto_shash_allocate()
  2025-10-10  6:51 ` [PATCH 3/3] smb: client: Omit a variable initialisation " Markus Elfring
@ 2025-10-10 21:47   ` Steve French
  2025-10-13 19:45     ` Steve French
  0 siblings, 1 reply; 7+ messages in thread
From: Steve French @ 2025-10-10 21:47 UTC (permalink / raw)
  To: Markus Elfring
  Cc: linux-cifs, samba-technical, Aurelien Aptel, Bharath SM,
	Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Steve French,
	Tom Talpey, LKML, kernel-janitors

merged into cifs-2.6.git for-next

On Fri, Oct 10, 2025 at 1:52 AM Markus Elfring <Markus.Elfring@web.de> wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 10 Oct 2025 08:05:21 +0200
> Subject: [PATCH 3/3] smb: client: Omit a variable initialisation in smb311_crypto_shash_allocate()
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> The local variable “rc” is immediately reassigned. Thus omit the explicit
> initialisation at the beginning.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  fs/smb/client/smb2transport.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/smb/client/smb2transport.c b/fs/smb/client/smb2transport.c
> index b790f6b970a9..3f8b0509f8c8 100644
> --- a/fs/smb/client/smb2transport.c
> +++ b/fs/smb/client/smb2transport.c
> @@ -50,7 +50,7 @@ int
>  smb311_crypto_shash_allocate(struct TCP_Server_Info *server)
>  {
>         struct cifs_secmech *p = &server->secmech;
> -       int rc = 0;
> +       int rc;
>
>         rc = cifs_alloc_hash("hmac(sha256)", &p->hmacsha256);
>         if (rc)
> --
> 2.51.0
>
>
>


-- 
Thanks,

Steve

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

* Re: [0/3] smb: client: Better exception handling for SMB3 hash allocations
  2025-10-10  6:45 [PATCH 0/3] smb: client: Better exception handling for SMB3 hash allocations Markus Elfring
                   ` (2 preceding siblings ...)
  2025-10-10  6:51 ` [PATCH 3/3] smb: client: Omit a variable initialisation " Markus Elfring
@ 2025-10-12  9:44 ` Markus Elfring
  3 siblings, 0 replies; 7+ messages in thread
From: Markus Elfring @ 2025-10-12  9:44 UTC (permalink / raw)
  To: linux-cifs, samba-technical, Bharath SM, Eric Biggers,
	Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Steve French,
	Tom Talpey
  Cc: LKML, kernel-janitors

> Refine a few implementation details for further development considerations.

Software components are evolving further somehow.

See also:
[PATCH 7/8] smb: client: Remove obsolete crypto_shash allocations
https://lore.kernel.org/linux-cifs/20251012015738.244315-8-ebiggers@kernel.org/
https://lkml.org/lkml/2025/10/11/443

Regards,
Markus

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

* Re: [PATCH 3/3] smb: client: Omit a variable initialisation in smb311_crypto_shash_allocate()
  2025-10-10 21:47   ` Steve French
@ 2025-10-13 19:45     ` Steve French
  0 siblings, 0 replies; 7+ messages in thread
From: Steve French @ 2025-10-13 19:45 UTC (permalink / raw)
  To: Markus Elfring
  Cc: linux-cifs, samba-technical, Paulo Alcantara, kernel-janitors,
	Stefan (metze) Metzmacher, Eric Biggers

Removed from cifs-2.6.git for-next, as it conflicts with Eric's recent
patch series ("smb: client: More crypto library conversions").

Obviously one of the problems of minor cleanup patches, is they can
cause noise like this

On Fri, Oct 10, 2025 at 4:47 PM Steve French <smfrench@gmail.com> wrote:
>
> merged into cifs-2.6.git for-next
>
> On Fri, Oct 10, 2025 at 1:52 AM Markus Elfring <Markus.Elfring@web.de> wrote:
> >
> > From: Markus Elfring <elfring@users.sourceforge.net>
> > Date: Fri, 10 Oct 2025 08:05:21 +0200
> > Subject: [PATCH 3/3] smb: client: Omit a variable initialisation in smb311_crypto_shash_allocate()
> > MIME-Version: 1.0
> > Content-Type: text/plain; charset=UTF-8
> > Content-Transfer-Encoding: 8bit
> >
> > The local variable “rc” is immediately reassigned. Thus omit the explicit
> > initialisation at the beginning.
> >
> > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> > ---
> >  fs/smb/client/smb2transport.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/smb/client/smb2transport.c b/fs/smb/client/smb2transport.c
> > index b790f6b970a9..3f8b0509f8c8 100644
> > --- a/fs/smb/client/smb2transport.c
> > +++ b/fs/smb/client/smb2transport.c
> > @@ -50,7 +50,7 @@ int
> >  smb311_crypto_shash_allocate(struct TCP_Server_Info *server)
> >  {
> >         struct cifs_secmech *p = &server->secmech;
> > -       int rc = 0;
> > +       int rc;
> >
> >         rc = cifs_alloc_hash("hmac(sha256)", &p->hmacsha256);
> >         if (rc)
> > --
> > 2.51.0
> >
> >
> >
>
>
> --
> Thanks,
>
> Steve



-- 
Thanks,

Steve

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

end of thread, other threads:[~2025-10-13 19:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-10  6:45 [PATCH 0/3] smb: client: Better exception handling for SMB3 hash allocations Markus Elfring
2025-10-10  6:48 ` [PATCH 1/3] smb: client: Return directly after a failed cifs_alloc_hash() in smb3_crypto_shash_allocate() Markus Elfring
2025-10-10  6:50 ` [PATCH 2/3] smb: client: Improve resource release in smb311_crypto_shash_allocate() Markus Elfring
2025-10-10  6:51 ` [PATCH 3/3] smb: client: Omit a variable initialisation " Markus Elfring
2025-10-10 21:47   ` Steve French
2025-10-13 19:45     ` Steve French
2025-10-12  9:44 ` [0/3] smb: client: Better exception handling for SMB3 hash allocations Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox