afs: Fix overwriting of result of DNS query
Subsystems (2)
David Howells
maintainerPATCH 1/1 afs: Fix overwriting of result of DNS query
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].
--- fs/afs/cell.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/afs/cell.c +4 -2
@@ -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 :
Quoted 2 lines · David Howells
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