All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] gdbstub: Prevent fd leakage
@ 2018-05-24 22:34 Philippe Mathieu-Daudé
  2018-05-25  3:37 ` Thomas Huth
  2018-05-25 13:52 ` Peter Maydell
  0 siblings, 2 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-05-24 22:34 UTC (permalink / raw)
  To: Peter Maydell, Paolo Bonzini
  Cc: Philippe Mathieu-Daudé, qemu-devel, Thomas Huth, Michael Tokarev

Since 2f652224f7, we now check if socket_set_nodelay() errored,
but forgot to close the socket before reporting an error.

Fixes: Coverity CID 1391290 (RESOURCE_LEAK)
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 gdbstub.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gdbstub.c b/gdbstub.c
index e4ece2f5bc..9c860cd81c 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1836,6 +1836,7 @@ static bool gdb_accept(void)
     /* set short latency */
     if (socket_set_nodelay(fd)) {
         perror("setsockopt");
+        close(fd);
         return false;
     }
 
-- 
2.17.0

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

* Re: [Qemu-devel] [PATCH] gdbstub: Prevent fd leakage
  2018-05-24 22:34 [Qemu-devel] [PATCH] gdbstub: Prevent fd leakage Philippe Mathieu-Daudé
@ 2018-05-25  3:37 ` Thomas Huth
  2018-05-25 13:52 ` Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Huth @ 2018-05-25  3:37 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Peter Maydell, Paolo Bonzini
  Cc: qemu-devel, Michael Tokarev

On 25.05.2018 00:34, Philippe Mathieu-Daudé wrote:
> Since 2f652224f7, we now check if socket_set_nodelay() errored,
> but forgot to close the socket before reporting an error.
> 
> Fixes: Coverity CID 1391290 (RESOURCE_LEAK)
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  gdbstub.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/gdbstub.c b/gdbstub.c
> index e4ece2f5bc..9c860cd81c 100644
> --- a/gdbstub.c
> +++ b/gdbstub.c
> @@ -1836,6 +1836,7 @@ static bool gdb_accept(void)
>      /* set short latency */
>      if (socket_set_nodelay(fd)) {
>          perror("setsockopt");
> +        close(fd);
>          return false;
>      }

Reviewed-by: Thomas Huth <thuth@redhat.com>

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

* Re: [Qemu-devel] [PATCH] gdbstub: Prevent fd leakage
  2018-05-24 22:34 [Qemu-devel] [PATCH] gdbstub: Prevent fd leakage Philippe Mathieu-Daudé
  2018-05-25  3:37 ` Thomas Huth
@ 2018-05-25 13:52 ` Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2018-05-25 13:52 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paolo Bonzini, QEMU Developers, Thomas Huth, Michael Tokarev

On 24 May 2018 at 23:34, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> Since 2f652224f7, we now check if socket_set_nodelay() errored,
> but forgot to close the socket before reporting an error.
>
> Fixes: Coverity CID 1391290 (RESOURCE_LEAK)
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  gdbstub.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/gdbstub.c b/gdbstub.c
> index e4ece2f5bc..9c860cd81c 100644
> --- a/gdbstub.c
> +++ b/gdbstub.c
> @@ -1836,6 +1836,7 @@ static bool gdb_accept(void)
>      /* set short latency */
>      if (socket_set_nodelay(fd)) {
>          perror("setsockopt");
> +        close(fd);
>          return false;
>      }

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM

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

end of thread, other threads:[~2018-05-25 13:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-24 22:34 [Qemu-devel] [PATCH] gdbstub: Prevent fd leakage Philippe Mathieu-Daudé
2018-05-25  3:37 ` Thomas Huth
2018-05-25 13:52 ` Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.