for (i = 0; i < vi->xattr_shared_count; ++i) {
if (unlikely(it.ofs >= EROFS_BLKSIZ)) {
/* cannot be unaligned */
- BUG_ON(it.ofs != EROFS_BLKSIZ);
+ DBG_BUGON(it.ofs != EROFS_BLKSIZ);
xattr_iter_end(&it, atomic_map);
it.page = erofs_get_meta_page(sb, ++it.blkaddr,
xattr_header_sz = inlinexattr_header_size(inode);
if (unlikely(xattr_header_sz >= vi->xattr_isize)) {
- BUG_ON(xattr_header_sz > vi->xattr_isize);
+ DBG_BUGON(xattr_header_sz > vi->xattr_isize);
return -ENOATTR;
}
if (tlimit) {
unsigned int entry_sz = EROFS_XATTR_ENTRY_SIZE(&entry);
- BUG_ON(*tlimit < entry_sz);
+ /* xattr on-disk corruption: xattr entry beyond xattr_isize */
+ if (unlikely(*tlimit < entry_sz)) {
+ DBG_BUGON(1);
+ return -EIO;
+ }
*tlimit -= entry_sz;
}
while (processed < entry.e_name_len) {
if (it->ofs >= EROFS_BLKSIZ) {
- BUG_ON(it->ofs > EROFS_BLKSIZ);
+ DBG_BUGON(it->ofs > EROFS_BLKSIZ);
err = xattr_iter_fixup(it);
if (err)
while (processed < value_sz) {
if (it->ofs >= EROFS_BLKSIZ) {
- BUG_ON(it->ofs > EROFS_BLKSIZ);
+ DBG_BUGON(it->ofs > EROFS_BLKSIZ);
err = xattr_iter_fixup(it);
if (err)