aboutsummaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorGravatar Peter Korsgaard <jacmet@sunsite.dk>2009-09-14 15:54:24 +0200
committerGravatar Peter Korsgaard <jacmet@sunsite.dk>2009-09-14 15:56:34 +0200
commit76aaac62a6da754b653d1f34e86133e19f364041 (patch)
treea6dd4c855af65cf6424dbb2147e2dad44210797b /target
parentf76d8a3fd445bf82c648924392f760603cad5f1d (diff)
downloadbuildroot-76aaac62a6da754b653d1f34e86133e19f364041.tar.gz
buildroot-76aaac62a6da754b653d1f34e86133e19f364041.tar.bz2
squashfs: fix for mksquashfs 4.0 race condition
Fix for the race condition in mksquashfs recently seen. Patch by Phillip Lougher. See http://thread.gmane.org/gmane.comp.file-systems.squashfs.devel/76 for details. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Diffstat (limited to 'target')
-rw-r--r--target/squashfs/squashfs-4.0-mksquashfs-race-condition-fix.patch41
-rw-r--r--target/squashfs/squashfsroot.mk2
2 files changed, 42 insertions, 1 deletions
diff --git a/target/squashfs/squashfs-4.0-mksquashfs-race-condition-fix.patch b/target/squashfs/squashfs-4.0-mksquashfs-race-condition-fix.patch
new file mode 100644
index 0000000000..7f8e8e0749
--- /dev/null
+++ b/target/squashfs/squashfs-4.0-mksquashfs-race-condition-fix.patch
@@ -0,0 +1,41 @@
+[PATCH]: fix mksquashfs race condition
+
+See http://thread.gmane.org/gmane.comp.file-systems.squashfs.devel/76
+for details.
+---
+ squashfs-tools/mksquashfs.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+Index: squashfs4.0/squashfs-tools/mksquashfs.c
+===================================================================
+--- squashfs4.0.orig/squashfs-tools/mksquashfs.c
++++ squashfs4.0/squashfs-tools/mksquashfs.c
+@@ -1733,8 +1733,8 @@ void unlock_fragments()
+ entry->buffer->block = bytes;
+ bytes += compressed_size;
+ fragments_outstanding --;
+- pthread_mutex_unlock(&fragment_mutex);
+ queue_put(to_writer, entry->buffer);
++ pthread_mutex_unlock(&fragment_mutex);
+ pthread_mutex_lock(&fragment_mutex);
+ TRACE("fragment_locked writing fragment %d, compressed size %d"
+ "\n", entry->fragment, compressed_size);
+@@ -2426,8 +2426,8 @@ void *frag_deflator(void *arg)
+ write_buffer->block = bytes;
+ bytes += compressed_size;
+ fragments_outstanding --;
+- pthread_mutex_unlock(&fragment_mutex);
+ queue_put(to_writer, write_buffer);
++ pthread_mutex_unlock(&fragment_mutex);
+ TRACE("Writing fragment %lld, uncompressed size %d, "
+ "compressed size %d\n", file_buffer->block,
+ file_buffer->size, compressed_size);
+@@ -4137,7 +4137,7 @@ void read_recovery_data(char *recovery_f
+
+
+ #define VERSION() \
+- printf("mksquashfs version 4.0 (2009/04/05)\n");\
++ printf("mksquashfs version 4.0-test (2009/04/05)\n");\
+ printf("copyright (C) 2009 Phillip Lougher <phillip@lougher.demon.co.uk>\n\n"); \
+ printf("This program is free software; you can redistribute it and/or\n");\
+ printf("modify it under the terms of the GNU General Public License\n");\
diff --git a/target/squashfs/squashfsroot.mk b/target/squashfs/squashfsroot.mk
index d7d559bab9..3ff0f3bc32 100644
--- a/target/squashfs/squashfsroot.mk
+++ b/target/squashfs/squashfsroot.mk
@@ -14,7 +14,7 @@ $(DL_DIR)/$(SQUASHFS_SOURCE):
$(SQUASHFS_DIR)/.unpacked: $(DL_DIR)/$(SQUASHFS_SOURCE) #$(SQUASHFS_PATCH)
$(SQUASHFS_CAT) $(DL_DIR)/$(SQUASHFS_SOURCE) | tar -C $(BUILD_DIR) -xvf -
- toolchain/patch-kernel.sh $(SQUASHFS_DIR) target/squashfs/ squashfs\*.patch
+ toolchain/patch-kernel.sh $(SQUASHFS_DIR) target/squashfs/ squashfs-$(SQUASHFS_VERSION)-\*.patch
touch $@
$(SQUASHFS_DIR)/squashfs-tools/mksquashfs: $(SQUASHFS_DIR)/.unpacked