* [PATCH] afs: Fix overwriting of result of DNS query
@ 2023-12-21 14:23 David Howells
2023-12-21 14:30 ` Jeffrey E Altman
2023-12-21 14:50 ` Jeffrey E Altman
0 siblings, 2 replies; 5+ messages in thread
From: David Howells @ 2023-12-21 14:23 UTC (permalink / raw)
To: Anastasia Belova, Marc Dionne
Cc: dhowells, linux-afs, linux-fsdevel, linux-kernel, lvc-project
In afs_update_cell(), ret is the result of the DNS lookup and the errors
are to be handled by a switch - however, the value gets clobbered in
between by setting it to -ENOMEM in case afs_alloc_vlserver_list() fails.
Fix this by moving the setting of -ENOMEM into the error handling for OOM
failure. Further, only do it if we don't have an alternative error to
return.
Found by Linux Verification Center (linuxtesting.org) with SVACE. Based on
a patch from Anastasia Belova[1].
Fixes: d5c32c89b208 ("afs: Fix cell DNS lookup")
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Anastasia Belova <abelova@astralinux.ru>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
cc: lvc-project@linuxtesting.org
Link: https://lore.kernel.org/r/20231221085849.1463-1-abelova@astralinux.ru/ [1]
---
fs/afs/cell.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/afs/cell.c b/fs/afs/cell.c
index 988c2ac7cece..926cb1188eba 100644
--- a/fs/afs/cell.c
+++ b/fs/afs/cell.c
@@ -409,10 +409,12 @@ static int afs_update_cell(struct afs_cell *cell)
if (ret == -ENOMEM)
goto out_wake;
- ret = -ENOMEM;
vllist = afs_alloc_vlserver_list(0);
- if (!vllist)
+ if (!vllist) {
+ if (ret >= 0)
+ ret = -ENOMEM;
goto out_wake;
+ }
switch (ret) {
case -ENODATA:
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] afs: Fix overwriting of result of DNS query
2023-12-21 14:23 [PATCH] afs: Fix overwriting of result of DNS query David Howells
@ 2023-12-21 14:30 ` Jeffrey E Altman
2023-12-21 14:50 ` Jeffrey E Altman
1 sibling, 0 replies; 5+ messages in thread
From: Jeffrey E Altman @ 2023-12-21 14:30 UTC (permalink / raw)
To: David Howells, Anastasia Belova, Marc Dionne
Cc: linux-afs, linux-fsdevel, linux-kernel, lvc-project
[-- Attachment #1.1: Type: text/plain, Size: 1514 bytes --]
On 12/21/2023 9:23 AM, David Howells wrote:
> In afs_update_cell(), ret is the result of the DNS lookup and the errors
> are to be handled by a switch - however, the value gets clobbered in
> between by setting it to -ENOMEM in case afs_alloc_vlserver_list() fails.
>
> Fix this by moving the setting of -ENOMEM into the error handling for OOM
> failure. Further, only do it if we don't have an alternative error to
> return.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE. Based on
> a patch from Anastasia Belova[1].
>
> Fixes: d5c32c89b208 ("afs: Fix cell DNS lookup")
> Signed-off-by: David Howells<dhowells@redhat.com>
> cc: Anastasia Belova<abelova@astralinux.ru>
> cc: Marc Dionne<marc.dionne@auristor.com>
> cc:linux-afs@lists.infradead.org
> cc:lvc-project@linuxtesting.org
> Link:https://lore.kernel.org/r/20231221085849.1463-1-abelova@astralinux.ru/ [1]
>
> ---
> fs/afs/cell.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/fs/afs/cell.c b/fs/afs/cell.c
> index 988c2ac7cece..926cb1188eba 100644
> --- a/fs/afs/cell.c
> +++ b/fs/afs/cell.c
> @@ -409,10 +409,12 @@ static int afs_update_cell(struct afs_cell *cell)
> if (ret == -ENOMEM)
> goto out_wake;
>
> - ret = -ENOMEM;
> vllist = afs_alloc_vlserver_list(0);
> - if (!vllist)
> + if (!vllist) {
> + if (ret >= 0)
> + ret = -ENOMEM;
> goto out_wake;
> + }
>
> switch (ret) {
> case -ENODATA:
>
Reviewed-by: Jeffrey Altman <jaltman@auristor.com>
[-- Attachment #1.2: Type: text/html, Size: 2446 bytes --]
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4039 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] afs: Fix overwriting of result of DNS query
2023-12-21 14:23 [PATCH] afs: Fix overwriting of result of DNS query David Howells
2023-12-21 14:30 ` Jeffrey E Altman
@ 2023-12-21 14:50 ` Jeffrey E Altman
1 sibling, 0 replies; 5+ messages in thread
From: Jeffrey E Altman @ 2023-12-21 14:50 UTC (permalink / raw)
To: David Howells, Anastasia Belova, Marc Dionne
Cc: linux-afs, linux-fsdevel, linux-kernel, lvc-project
[-- Attachment #1: Type: text/plain, Size: 1515 bytes --]
On 12/21/2023 9:23 AM, David Howells wrote:
> In afs_update_cell(), ret is the result of the DNS lookup and the errors
> are to be handled by a switch - however, the value gets clobbered in
> between by setting it to -ENOMEM in case afs_alloc_vlserver_list() fails.
>
> Fix this by moving the setting of -ENOMEM into the error handling for OOM
> failure. Further, only do it if we don't have an alternative error to
> return.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE. Based on
> a patch from Anastasia Belova[1].
>
> Fixes: d5c32c89b208 ("afs: Fix cell DNS lookup")
> Signed-off-by: David Howells<dhowells@redhat.com>
> cc: Anastasia Belova<abelova@astralinux.ru>
> cc: Marc Dionne<marc.dionne@auristor.com>
> cc:linux-afs@lists.infradead.org
> cc:lvc-project@linuxtesting.org
> Link:https://lore.kernel.org/r/20231221085849.1463-1-abelova@astralinux.ru/ [1]
>
> ---
> fs/afs/cell.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/fs/afs/cell.c b/fs/afs/cell.c
> index 988c2ac7cece..926cb1188eba 100644
> --- a/fs/afs/cell.c
> +++ b/fs/afs/cell.c
> @@ -409,10 +409,12 @@ static int afs_update_cell(struct afs_cell *cell)
> if (ret == -ENOMEM)
> goto out_wake;
>
> - ret = -ENOMEM;
> vllist = afs_alloc_vlserver_list(0);
> - if (!vllist)
> + if (!vllist) {
> + if (ret >= 0)
> + ret = -ENOMEM;
> goto out_wake;
> + }
>
> switch (ret) {
> case -ENODATA:
>
Reviewed-by: Jeffrey Altman <jaltman@auristor.com>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4039 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] afs: Fix overwriting of result of DNS query
@ 2023-12-21 15:09 David Howells
2023-12-21 18:01 ` Linus Torvalds
0 siblings, 1 reply; 5+ messages in thread
From: David Howells @ 2023-12-21 15:09 UTC (permalink / raw)
To: torvalds
Cc: Anastasia Belova, Marc Dionne, dhowells, linux-afs, linux-fsdevel,
linux-kernel, lvc-project
Hi Linus,
Could you apply this fix, please?
Thanks,
David
---
In afs_update_cell(), ret is the result of the DNS lookup and the errors
are to be handled by a switch - however, the value gets clobbered in
between by setting it to -ENOMEM in case afs_alloc_vlserver_list() fails.
Fix this by moving the setting of -ENOMEM into the error handling for OOM
failure. Further, only do it if we don't have an alternative error to
return.
Found by Linux Verification Center (linuxtesting.org) with SVACE. Based on
a patch from Anastasia Belova[1].
Fixes: d5c32c89b208 ("afs: Fix cell DNS lookup")
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Jeffrey Altman <jaltman@auristor.com>
cc: Anastasia Belova <abelova@astralinux.ru>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
cc: lvc-project@linuxtesting.org
Link: https://lore.kernel.org/r/20231221085849.1463-1-abelova@astralinux.ru/ [1]
Link: https://lore.kernel.org/r/1700862.1703168632@warthog.procyon.org.uk/ # v1
---
fs/afs/cell.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/afs/cell.c b/fs/afs/cell.c
index 988c2ac7cece..926cb1188eba 100644
--- a/fs/afs/cell.c
+++ b/fs/afs/cell.c
@@ -409,10 +409,12 @@ static int afs_update_cell(struct afs_cell *cell)
if (ret == -ENOMEM)
goto out_wake;
- ret = -ENOMEM;
vllist = afs_alloc_vlserver_list(0);
- if (!vllist)
+ if (!vllist) {
+ if (ret >= 0)
+ ret = -ENOMEM;
goto out_wake;
+ }
switch (ret) {
case -ENODATA:
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] afs: Fix overwriting of result of DNS query
2023-12-21 15:09 David Howells
@ 2023-12-21 18:01 ` Linus Torvalds
0 siblings, 0 replies; 5+ messages in thread
From: Linus Torvalds @ 2023-12-21 18:01 UTC (permalink / raw)
To: David Howells
Cc: Anastasia Belova, Marc Dionne, linux-afs, linux-fsdevel,
linux-kernel, lvc-project
On Thu, 21 Dec 2023 at 07:09, David Howells <dhowells@redhat.com> wrote:
>
> Could you apply this fix, please?
Ok, so this is just *annoying*.
Why did you send me this as a patch, and then *twenty minutes* later
you send me an AFS pull request that does *not* include this patch?
WTF?
I've applied this, but I'm really annoyed, because it really feels
like you went out of your way to just generate unnecessary noise and
pointless workflow churn.
It's not even like the pull request contained anything different. The
patch _and_ the pull request were both not just about AFS, but about
DNS issues in AFS.
Get your act together.
Linus
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-12-21 18:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-21 14:23 [PATCH] afs: Fix overwriting of result of DNS query David Howells
2023-12-21 14:30 ` Jeffrey E Altman
2023-12-21 14:50 ` Jeffrey E Altman
-- strict thread matches above, loose matches on Subject: below --
2023-12-21 15:09 David Howells
2023-12-21 18:01 ` Linus Torvalds
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox