squashfs-4.0-mksquashfs-race-condition-fix.patch 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. [PATCH]: fix mksquashfs race condition
  2. See http://thread.gmane.org/gmane.comp.file-systems.squashfs.devel/76
  3. for details.
  4. ---
  5. squashfs-tools/mksquashfs.c | 6 +++---
  6. 1 file changed, 3 insertions(+), 3 deletions(-)
  7. Index: squashfs4.0/squashfs-tools/mksquashfs.c
  8. ===================================================================
  9. --- squashfs4.0.orig/squashfs-tools/mksquashfs.c
  10. +++ squashfs4.0/squashfs-tools/mksquashfs.c
  11. @@ -1733,8 +1733,8 @@ void unlock_fragments()
  12. entry->buffer->block = bytes;
  13. bytes += compressed_size;
  14. fragments_outstanding --;
  15. - pthread_mutex_unlock(&fragment_mutex);
  16. queue_put(to_writer, entry->buffer);
  17. + pthread_mutex_unlock(&fragment_mutex);
  18. pthread_mutex_lock(&fragment_mutex);
  19. TRACE("fragment_locked writing fragment %d, compressed size %d"
  20. "\n", entry->fragment, compressed_size);
  21. @@ -2426,8 +2426,8 @@ void *frag_deflator(void *arg)
  22. write_buffer->block = bytes;
  23. bytes += compressed_size;
  24. fragments_outstanding --;
  25. - pthread_mutex_unlock(&fragment_mutex);
  26. queue_put(to_writer, write_buffer);
  27. + pthread_mutex_unlock(&fragment_mutex);
  28. TRACE("Writing fragment %lld, uncompressed size %d, "
  29. "compressed size %d\n", file_buffer->block,
  30. file_buffer->size, compressed_size);
  31. @@ -4137,7 +4137,7 @@ void read_recovery_data(char *recovery_f
  32. #define VERSION() \
  33. - printf("mksquashfs version 4.0 (2009/04/05)\n");\
  34. + printf("mksquashfs version 4.0-test (2009/04/05)\n");\
  35. printf("copyright (C) 2009 Phillip Lougher <phillip@lougher.demon.co.uk>\n\n"); \
  36. printf("This program is free software; you can redistribute it and/or\n");\
  37. printf("modify it under the terms of the GNU General Public License\n");\