[PATCH 1/2] dump: Plug file descriptor leak on non-seekable file

Markus Armbruster posted 2 patches 1 year ago
Maintainers: "Marc-André Lureau" <marcandre.lureau@redhat.com>
There is a newer version of this series
[PATCH 1/2] dump: Plug file descriptor leak on non-seekable file
Posted by Markus Armbruster 1 year ago
Fixes: e6549197f7ed (dump: Add command interface for kdump-raw formats)
Fixes: CID 1523842
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 dump/dump.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/dump/dump.c b/dump/dump.c
index 1c304cadfd..ad5294e853 100644
--- a/dump/dump.c
+++ b/dump/dump.c
@@ -2160,6 +2160,7 @@ void qmp_dump_guest_memory(bool paging, const char *protocol,
         return;
     }
     if (kdump_raw && lseek(fd, 0, SEEK_CUR) == (off_t) -1) {
+        close(fd);
         error_setg(errp, "kdump-raw formats require a seekable file");
         return;
     }
-- 
2.41.0
Re: [PATCH 1/2] dump: Plug file descriptor leak on non-seekable file
Posted by Marc-André Lureau 1 year ago
Hi

On Wed, Nov 8, 2023 at 9:37 AM Markus Armbruster <armbru@redhat.com> wrote:
>
> Fixes: e6549197f7ed (dump: Add command interface for kdump-raw formats)
> Fixes: CID 1523842
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  dump/dump.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/dump/dump.c b/dump/dump.c
> index 1c304cadfd..ad5294e853 100644
> --- a/dump/dump.c
> +++ b/dump/dump.c
> @@ -2160,6 +2160,7 @@ void qmp_dump_guest_memory(bool paging, const char *protocol,
>          return;
>      }
>      if (kdump_raw && lseek(fd, 0, SEEK_CUR) == (off_t) -1) {
> +        close(fd);
>          error_setg(errp, "kdump-raw formats require a seekable file");
>          return;
>      }
> --

already queued for merge in:
[PULL 75/75] dump: Add close fd on error return to avoid resource leak