public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] UBIFS: Fix Bulk read buf_len  intialization
@ 2008-11-20 14:22 Brijesh Singh
  2008-11-20 17:19 ` Artem Bityutskiy
  0 siblings, 1 reply; 2+ messages in thread
From: Brijesh Singh @ 2008-11-20 14:22 UTC (permalink / raw)
  To: dedekind; +Cc: linux-mtd

[-- Attachment #1: Type: text/plain, Size: 1297 bytes --]

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;
 }
 
 /**

[-- Attachment #2: Type: text/html, Size: 32484 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] UBIFS: Fix Bulk read buf_len  intialization
  2008-11-20 14:22 [PATCH] UBIFS: Fix Bulk read buf_len intialization Brijesh Singh
@ 2008-11-20 17:19 ` Artem Bityutskiy
  0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2008-11-20 17:19 UTC (permalink / raw)
  To: Brijesh Singh; +Cc: linux-mtd

Hi,

right. I fixed this yesterday but forgot to push, sorry.
Just pushed the right patches.

Note, we consider the master branch of ubifs-2.6.git as
experimental and we re-base it often. So if you want more
stable UBIFS - use the linux-next branch as we noted here:

http://www.linux-mtd.infradead.org/doc/ubifs.html#L_source

Anyway, it is nice to see you reacted so quickly. Thanks.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-11-20 17:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-20 14:22 [PATCH] UBIFS: Fix Bulk read buf_len intialization Brijesh Singh
2008-11-20 17:19 ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox