[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 5/8] qemu-bridge-helper: Fix fd leak in main()
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH 5/8] qemu-bridge-helper: Fix fd leak in main() |
Date: |
Tue, 27 May 2014 13:32:03 +0200 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Tue, May 27, 2014 at 09:40:02AM +0800, address@hidden wrote:
> From: Gonglei <address@hidden>
>
> Signed-off-by: Gonglei <address@hidden>
> ---
> qemu-bridge-helper.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/qemu-bridge-helper.c b/qemu-bridge-helper.c
> index 6a0974e..dce5abc 100644
> --- a/qemu-bridge-helper.c
> +++ b/qemu-bridge-helper.c
> @@ -436,7 +436,12 @@ int main(int argc, char **argv)
> /* profit! */
>
> cleanup:
> -
> + if (fd >= 0) {
> + close(fd);
> + }
> + if (ctlfd >= 0) {
> + close(ctlfd);
> + }
fd and ctlfd are uninitialized:
int fd, ctlfd, unixfd = -1;
This patch introduces a read of uninitialized memory and could close a
random file descriptor.
There wasn't a real leak since this is the main() function and the
kernel frees resources when the process terminates.
Please either drop this patch or fix it carefully.
- [Qemu-devel] [PATCH 1/8] vnc-enc-tight: Fix divide-by-zero in tight_detect_smooth_image{16, 24, 32}, (continued)
- [Qemu-devel] [PATCH 1/8] vnc-enc-tight: Fix divide-by-zero in tight_detect_smooth_image{16, 24, 32}, arei.gonglei, 2014/05/26
- Re: [Qemu-devel] [PATCH 1/8] vnc-enc-tight: Fix divide-by-zero in tight_detect_smooth_image{16, 24, 32}, Paolo Bonzini, 2014/05/27
- Re: [Qemu-devel] [PATCH 1/8] vnc-enc-tight: Fix divide-by-zero in tight_detect_smooth_image{16, 24, 32}, Gonglei (Arei), 2014/05/28
- Re: [Qemu-devel] [PATCH 1/8] vnc-enc-tight: Fix divide-by-zero in tight_detect_smooth_image{16, 24, 32}, Paolo Bonzini, 2014/05/28
- Re: [Qemu-devel] [PATCH 1/8] vnc-enc-tight: Fix divide-by-zero in tight_detect_smooth_image{16, 24, 32}, Gonglei (Arei), 2014/05/28
[Qemu-devel] [PATCH 8/8] audio: Fix using freed pointer in wav_fini_out(), arei.gonglei, 2014/05/26
[Qemu-devel] [PATCH 4/8] qcow2-cluster: Fix memory leak in copy_sectors, arei.gonglei, 2014/05/26
[Qemu-devel] [PATCH 5/8] qemu-bridge-helper: Fix fd leak in main(), arei.gonglei, 2014/05/26
- Re: [Qemu-devel] [PATCH 5/8] qemu-bridge-helper: Fix fd leak in main(),
Stefan Hajnoczi <=