Commit 1f9378d4 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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
parents f7301f85 417b8af2
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ static void erofs_fileio_ki_complete(struct kiocb *iocb, long ret)

static void erofs_fileio_rq_submit(struct erofs_fileio_rq *rq)
{
	const struct cred *old_cred;
	struct iov_iter iter;
	int ret;

@@ -60,7 +61,9 @@ static void erofs_fileio_rq_submit(struct erofs_fileio_rq *rq)
		rq->iocb.ki_flags = IOCB_DIRECT;
	iov_iter_bvec(&iter, ITER_DEST, rq->bvecs, rq->bio.bi_vcnt,
		      rq->bio.bi_iter.bi_size);
	old_cred = override_creds(rq->iocb.ki_filp->f_cred);
	ret = vfs_iocb_iter_read(rq->iocb.ki_filp, &rq->iocb, &iter);
	revert_creds(old_cred);
	if (ret != -EIOCBQUEUED)
		erofs_fileio_ki_complete(&rq->iocb, ret);
}
+4 −6
Original line number Diff line number Diff line
@@ -597,6 +597,10 @@ static int z_erofs_map_blocks_ext(struct inode *inode,

			if (la > map->m_la) {
				r = mid;
				if (la > lend) {
					DBG_BUGON(1);
					return -EFSCORRUPTED;
				}
				lend = la;
			} else {
				l = mid + 1;
@@ -635,12 +639,6 @@ static int z_erofs_map_blocks_ext(struct inode *inode,
		}
	}
	map->m_llen = lend - map->m_la;
	if (!last && map->m_llen < sb->s_blocksize) {
		erofs_err(sb, "extent too small %llu @ offset %llu of nid %llu",
			  map->m_llen, map->m_la, vi->nid);
		DBG_BUGON(1);
		return -EFSCORRUPTED;
	}
	return 0;
}

+0 −18
Original line number Diff line number Diff line
@@ -211,24 +211,6 @@ TRACE_EVENT(erofs_map_blocks_exit,
		  show_mflags(__entry->mflags), __entry->ret)
);

TRACE_EVENT(erofs_destroy_inode,
	TP_PROTO(struct inode *inode),

	TP_ARGS(inode),

	TP_STRUCT__entry(
		__field(	dev_t,		dev		)
		__field(	erofs_nid_t,	nid		)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
		__entry->nid	= EROFS_I(inode)->nid;
	),

	TP_printk("dev = (%d,%d), nid = %llu", show_dev_nid(__entry))
);

#endif /* _TRACE_EROFS_H */

 /* This part must be outside protection */