public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] hurd: Fix calling vm_deallocate (NULL)
@ 2023-07-02 23:38 Samuel Thibault
  0 siblings, 0 replies; only message in thread
From: Samuel Thibault @ 2023-07-02 23:38 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f84c3ceb0447477eb022cd5da6c8f27a705deae6

commit f84c3ceb0447477eb022cd5da6c8f27a705deae6
Author: Sergey Bugaev <bugaevc@gmail.com>
Date:   Mon Jun 26 02:17:49 2023 +0300

    hurd: Fix calling vm_deallocate (NULL)
    
    Only call vm_deallocate when we do have the old buffer, and check for
    unexpected errors.
    
    Spotted while debugging a msgids/readdir issue on x86_64-gnu.
    
    Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
    Message-Id: <20230625231751.404120-3-bugaevc@gmail.com>

Diff:
---
 sysdeps/mach/hurd/readdir64.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/sysdeps/mach/hurd/readdir64.c b/sysdeps/mach/hurd/readdir64.c
index 2c01ca22c9..2d946793af 100644
--- a/sysdeps/mach/hurd/readdir64.c
+++ b/sysdeps/mach/hurd/readdir64.c
@@ -64,9 +64,13 @@ __readdir64 (DIR *dirp)
 	      /* The data was passed out of line, so our old buffer is no
 		 longer useful.  Deallocate the old buffer and reset our
 		 information for the new buffer.  */
-	      __vm_deallocate (__mach_task_self (),
-			       (vm_address_t) dirp->__data,
-			       dirp->__allocation);
+	      if (dirp->__data != NULL)
+		{
+		  err = __vm_deallocate (__mach_task_self (),
+					 (vm_address_t) dirp->__data,
+					 dirp->__allocation);
+		  assert_perror (err);
+		}
 	      dirp->__data = data;
 	      dirp->__allocation = round_page (dirp->__size);
 	    }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-07-02 23:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-02 23:38 [glibc] hurd: Fix calling vm_deallocate (NULL) Samuel Thibault

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).