--- linux-2.6.31.orig/fs/ubifs/io.c	2009-09-10 10:13:59.000000000 +1200
+++ linux-2.6.31/fs/ubifs/io.c	2011-04-11 15:43:50.026527002 +1200
@@ -916,6 +916,14 @@
 {
 	int i, err = 0;
 
+	/* If this is a read-only mount, write buffers will be null
+	 * Skip the sync, returning success (even though this is an invalid operation
+	 * on a read-only file-system, return success because all data on flash
+	 * is up to date)
+	 */
+	if(!c->jheads)
+		return 0;
+
 	for (i = 0; i < c->jhead_cnt; i++) {
 		struct ubifs_wbuf *wbuf = &c->jheads[i].wbuf;
 
