|
@@ -256,7 +256,9 @@ void ubifs_scanned_corruption(const struct ubifs_info *c, int lnum, int offs,
|
|
|
* @sbuf: scan buffer (must be c->leb_size)
|
|
|
*
|
|
|
* This function scans LEB number @lnum and returns complete information about
|
|
|
- * its contents. Returns an error code in case of failure.
|
|
|
+ * its contents. Returns the scaned information in case of success and,
|
|
|
+ * %-EUCLEAN if the LEB neads recovery, and other negative error codes in case
|
|
|
+ * of failure.
|
|
|
*/
|
|
|
struct ubifs_scan_leb *ubifs_scan(const struct ubifs_info *c, int lnum,
|
|
|
int offs, void *sbuf)
|
|
@@ -279,7 +281,6 @@ struct ubifs_scan_leb *ubifs_scan(const struct ubifs_info *c, int lnum,
|
|
|
cond_resched();
|
|
|
|
|
|
ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 0);
|
|
|
-
|
|
|
if (ret > 0) {
|
|
|
/* Padding bytes or a valid padding node */
|
|
|
offs += ret;
|
|
@@ -304,7 +305,8 @@ struct ubifs_scan_leb *ubifs_scan(const struct ubifs_info *c, int lnum,
|
|
|
goto corrupted;
|
|
|
default:
|
|
|
dbg_err("unknown");
|
|
|
- goto corrupted;
|
|
|
+ err = -EINVAL;
|
|
|
+ goto error;
|
|
|
}
|
|
|
|
|
|
err = ubifs_add_snod(c, sleb, buf, offs);
|
|
@@ -317,8 +319,10 @@ struct ubifs_scan_leb *ubifs_scan(const struct ubifs_info *c, int lnum,
|
|
|
len -= node_len;
|
|
|
}
|
|
|
|
|
|
- if (offs % c->min_io_size)
|
|
|
- goto corrupted;
|
|
|
+ if (offs % c->min_io_size) {
|
|
|
+ ubifs_err("empty space starts at non-aligned offset %d", offs);
|
|
|
+ goto corrupted;;
|
|
|
+ }
|
|
|
|
|
|
ubifs_end_scan(c, sleb, lnum, offs);
|
|
|
|