diff options
author | Daniel Henrique Barboza <danielhb413@gmail.com> | 2020-01-20 15:11:39 +0100 |
---|---|---|
committer | Michael Roth <mdroth@linux.vnet.ibm.com> | 2020-06-16 17:21:18 -0500 |
commit | 03afe9c035884c5901258967cf906de64eff25de (patch) | |
tree | 17ab0f7f96e1c087bfc043b991ac3637f7d570a5 /qapi/qobject-output-visitor.c | |
parent | 18f6b13e085fdb81f5385bffce35364ab8535303 (diff) | |
download | qemu-03afe9c035884c5901258967cf906de64eff25de.zip qemu-03afe9c035884c5901258967cf906de64eff25de.tar.gz qemu-03afe9c035884c5901258967cf906de64eff25de.tar.bz2 |
9p: local: always return -1 on error in local_unlinkat_common
local_unlinkat_common() is supposed to always return -1 on error.
This is being done by jumps to the 'err_out' label, which is
a 'return ret' call, and 'ret' is initialized with -1.
Unfortunately there is a condition in which the function will
return 0 on error: in a case where flags == AT_REMOVEDIR, 'ret'
will be 0 when reaching
map_dirfd = openat_dir(...)
And, if map_dirfd == -1 and errno != ENOENT, the existing 'err_out'
jump will execute 'return ret', when ret is still set to zero
at that point.
This patch fixes it by changing all 'err_out' labels by
'return -1' calls, ensuring that the function will always
return -1 on error conditions. 'ret' can be left unintialized
since it's now being used just to store the result of 'unlinkat'
calls.
CC: Greg Kurz <groug@kaod.org>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
[groug: changed prefix in title to be "9p: local:"]
Signed-off-by: Greg Kurz <groug@kaod.org>
(cherry picked from commit 846cf408a4c8055063f4a5a71ccf7ed030cdad30)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'qapi/qobject-output-visitor.c')
0 files changed, 0 insertions, 0 deletions