Skip to content

Commit 1f9378d

Browse files
committed
Merge tag 'erofs-for-6.16-rc3-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs
Pull erofs fixes from Gao Xiang: - Use the mounter’s credentials for file-backed mounts to resolve Android SELinux permission issues - Remove the unused trace event `erofs_destroy_inode` - Error out on crafted out-of-file-range encoded extents - Remove an incorrect check for encoded extents * tag 'erofs-for-6.16-rc3-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs: erofs: remove a superfluous check for encoded extents erofs: refuse crafted out-of-file-range encoded extents erofs: remove unused trace event erofs_destroy_inode erofs: impersonate the opener's credentials when accessing backing file
2 parents f7301f8 + 417b8af commit 1f9378d

File tree

3 files changed

+7
-24
lines changed

3 files changed

+7
-24
lines changed

fs/erofs/fileio.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ static void erofs_fileio_ki_complete(struct kiocb *iocb, long ret)
4747

4848
static void erofs_fileio_rq_submit(struct erofs_fileio_rq *rq)
4949
{
50+
const struct cred *old_cred;
5051
struct iov_iter iter;
5152
int ret;
5253

@@ -60,7 +61,9 @@ static void erofs_fileio_rq_submit(struct erofs_fileio_rq *rq)
6061
rq->iocb.ki_flags = IOCB_DIRECT;
6162
iov_iter_bvec(&iter, ITER_DEST, rq->bvecs, rq->bio.bi_vcnt,
6263
rq->bio.bi_iter.bi_size);
64+
old_cred = override_creds(rq->iocb.ki_filp->f_cred);
6365
ret = vfs_iocb_iter_read(rq->iocb.ki_filp, &rq->iocb, &iter);
66+
revert_creds(old_cred);
6467
if (ret != -EIOCBQUEUED)
6568
erofs_fileio_ki_complete(&rq->iocb, ret);
6669
}

fs/erofs/zmap.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,10 @@ static int z_erofs_map_blocks_ext(struct inode *inode,
597597

598598
if (la > map->m_la) {
599599
r = mid;
600+
if (la > lend) {
601+
DBG_BUGON(1);
602+
return -EFSCORRUPTED;
603+
}
600604
lend = la;
601605
} else {
602606
l = mid + 1;
@@ -635,12 +639,6 @@ static int z_erofs_map_blocks_ext(struct inode *inode,
635639
}
636640
}
637641
map->m_llen = lend - map->m_la;
638-
if (!last && map->m_llen < sb->s_blocksize) {
639-
erofs_err(sb, "extent too small %llu @ offset %llu of nid %llu",
640-
map->m_llen, map->m_la, vi->nid);
641-
DBG_BUGON(1);
642-
return -EFSCORRUPTED;
643-
}
644642
return 0;
645643
}
646644

include/trace/events/erofs.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -211,24 +211,6 @@ TRACE_EVENT(erofs_map_blocks_exit,
211211
show_mflags(__entry->mflags), __entry->ret)
212212
);
213213

214-
TRACE_EVENT(erofs_destroy_inode,
215-
TP_PROTO(struct inode *inode),
216-
217-
TP_ARGS(inode),
218-
219-
TP_STRUCT__entry(
220-
__field( dev_t, dev )
221-
__field( erofs_nid_t, nid )
222-
),
223-
224-
TP_fast_assign(
225-
__entry->dev = inode->i_sb->s_dev;
226-
__entry->nid = EROFS_I(inode)->nid;
227-
),
228-
229-
TP_printk("dev = (%d,%d), nid = %llu", show_dev_nid(__entry))
230-
);
231-
232214
#endif /* _TRACE_EROFS_H */
233215

234216
/* This part must be outside protection */

0 commit comments

Comments
 (0)