[PATCH] UBIFS: Fix Bulk read buf_len intialization

Brijesh Singh brij.singh at samsung.com
Thu Nov 20 09:22:31 EST 2008


In function bu_init in super.c, after buffer allocation, initialization of buf_len parameter is not done. So buf_len=0;

This causes bulk_read to be skipped in all cases.

Here is the scenario:
ubifs_do_bulk_read() {
...
       err  = ubifs_tnc_get_bu_keys() ;
        if (err)
 	goto out_warn;
...
out_warn:
            ubifs_warn("ignoring error %d and skipping bulk-read", err);
            goto out_free;
}

And function:

ubifs_tnc_get_bu_keys() {
                                    ...
                            if (len > bu->buf_len) {
        			err = -EINVAL;
    			goto out;
                           }
...
}

ubifs_tnc_get_bu_keys()  returns error -EINVAL to ubifs_do_bulk_read. So it decides to skip this bulk_read.
 This condition holds forever as mutex will always be free in this case.

The following patch does the initialization....

------------------------------------------------------------------------------------------------------------------------------

diff -urN ubifs-2.6.orig/fs/ubifs/super.c ubifs-2.6/fs/ubifs/super.c
--- ubifs-2.6.orig/fs/ubifs/super.c 2008-11-21 00:33:25.000000000 +0530
+++ ubifs-2.6/fs/ubifs/super.c 2008-11-21 00:36:27.000000000 +0530
@@ -1046,6 +1046,7 @@
   c->bulk_read = 0;
   return;
  }
+ c->bu.buf_len = c->max_bu_buf_len;
 }
 
 /**
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.infradead.org/pipermail/linux-mtd/attachments/20081120/814b59c3/attachment-0001.html 


More information about the linux-mtd mailing list