diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-01-02 00:58:03 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-01-02 00:58:03 +0100 |
commit | 99c20c07ab7685744acc91076e3f474b7d95f67c (patch) | |
tree | 0ecb23fbd1daee8b5cb79dd48a7e660c431856ac /boot | |
parent | a31d09509c0547ce3239b5776edd59c01202f78c (diff) | |
download | hurd-99c20c07ab7685744acc91076e3f474b7d95f67c.tar.gz hurd-99c20c07ab7685744acc91076e3f474b7d95f67c.tar.bz2 hurd-99c20c07ab7685744acc91076e3f474b7d95f67c.zip |
boot: Fix erroneous munmap in S_io_read on error
Diffstat (limited to 'boot')
-rw-r--r-- | boot/boot.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/boot/boot.c b/boot/boot.c index eb78a1c6..978d8943 100644 --- a/boot/boot.c +++ b/boot/boot.c @@ -1458,10 +1458,11 @@ S_io_read (mach_port_t object, ioctl (0, FIONREAD, &avail); if (avail) { + data_t orig_data = *data; if (amount > *datalen) *data = mmap (0, amount, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0); *datalen = read (0, *data, amount); - if (*datalen == -1) + if (*datalen == -1 && *data != orig_data) munmap (*data, amount); unlock_readlock (); return *datalen == -1 ? errno : 0; |