Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 942ab600 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "security: pfk: use page_mapping to avoid wrong memory access"

parents 4672201b 243b3d4f
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1650,6 +1650,7 @@ bool bio_attempt_front_merge(struct request_queue *q, struct request *req,
	bio->bi_next = req->bio;
	req->bio = bio;

	WARN_ON(req->__dun || bio->bi_iter.bi_dun);
	req->__sector = bio->bi_iter.bi_sector;
	req->__data_len += bio->bi_iter.bi_size;
	req->ioprio = ioprio_best(req->ioprio, bio_prio(bio));
@@ -1799,6 +1800,7 @@ void blk_init_request_from_bio(struct request *req, struct bio *bio)
	else
		req->ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, 0);
	req->write_hint = bio->bi_write_hint;
	req->__dun = bio->bi_iter.bi_dun;
	blk_rq_bio_prep(req->q, req, bio);
}
EXPORT_SYMBOL_GPL(blk_init_request_from_bio);
@@ -2784,8 +2786,11 @@ bool blk_update_request(struct request *req, blk_status_t error,
	req->__data_len -= total_bytes;

	/* update sector only for requests with clear definition of sector */
	if (!blk_rq_is_passthrough(req))
	if (!blk_rq_is_passthrough(req)) {
		req->__sector += total_bytes >> 9;
		if (req->__dun)
			req->__dun += total_bytes >> 12;
	}

	/* mixed attributes always follow the first bio */
	if (req->rq_flags & RQF_MIXED_MERGE) {
@@ -3148,6 +3153,7 @@ static void __blk_rq_prep_clone(struct request *dst, struct request *src)
{
	dst->cpu = src->cpu;
	dst->__sector = blk_rq_pos(src);
	dst->__dun = blk_rq_dun(src);
	dst->__data_len = blk_rq_bytes(src);
	if (src->rq_flags & RQF_SPECIAL_PAYLOAD) {
		dst->rq_flags |= RQF_SPECIAL_PAYLOAD;
+2 −0
Original line number Diff line number Diff line
@@ -845,6 +845,8 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio)

enum elv_merge blk_try_merge(struct request *rq, struct bio *bio)
{
	if (blk_rq_dun(rq) || bio_dun(bio))
		return ELEVATOR_NO_MERGE;
	if (req_op(rq) == REQ_OP_DISCARD &&
	    queue_max_discard_segments(rq->q) > 1)
		return ELEVATOR_DISCARD_MERGE;
+21 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ static void ext4_mark_recovery_complete(struct super_block *sb,
static void ext4_clear_journal_err(struct super_block *sb,
				   struct ext4_super_block *es);
static int ext4_sync_fs(struct super_block *sb, int wait);
static void ext4_umount_end(struct super_block *sb, int flags);
static int ext4_remount(struct super_block *sb, int *flags, char *data);
static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf);
static int ext4_unfreeze(struct super_block *sb);
@@ -1315,6 +1316,7 @@ static const struct super_operations ext4_sops = {
	.freeze_fs	= ext4_freeze,
	.unfreeze_fs	= ext4_unfreeze,
	.statfs		= ext4_statfs,
	.umount_end	= ext4_umount_end,
	.remount_fs	= ext4_remount,
	.show_options	= ext4_show_options,
#ifdef CONFIG_QUOTA
@@ -5027,6 +5029,25 @@ struct ext4_mount_options {
#endif
};

static void ext4_umount_end(struct super_block *sb, int flags)
{
	/*
	 * this is called at the end of umount(2). If there is an unclosed
	 * namespace, ext4 won't do put_super() which triggers fsck in the
	 * next boot.
	 */
	if ((flags & MNT_FORCE) || atomic_read(&sb->s_active) > 1) {
		ext4_msg(sb, KERN_ERR,
			"errors=remount-ro for active namespaces on umount %x",
						flags);
		clear_opt(sb, ERRORS_PANIC);
		set_opt(sb, ERRORS_RO);
		/* to write the latest s_kbytes_written */
		if (!(sb->s_flags & MS_RDONLY))
			ext4_commit_super(sb, 1);
	}
}

static int ext4_remount(struct super_block *sb, int *flags, char *data)
{
	struct ext4_super_block *es;
+2 −1
Original line number Diff line number Diff line
@@ -575,7 +575,8 @@ static struct bio *f2fs_grab_read_bio(struct inode *inode, block_t blkaddr,
			  REQ_NOENCRYPT :
			  0));

	if (f2fs_encrypted_file(inode))
	if (f2fs_encrypted_file(inode) &&
		!fscrypt_using_hardware_encryption(inode))
		post_read_steps |= 1 << STEP_DECRYPT;
	if (post_read_steps) {
		ctx = mempool_alloc(bio_post_read_ctx_pool, GFP_NOFS);
+1 −1
Original line number Diff line number Diff line
@@ -3281,7 +3281,7 @@ static inline bool f2fs_may_encrypt(struct inode *inode)

static inline bool f2fs_force_buffered_io(struct inode *inode, int rw)
{
	return ((f2fs_post_read_required(inode) &&
	return ((f2fs_encrypted_file(inode) &&
		!fscrypt_using_hardware_encryption(inode)) ||
			(rw == WRITE && test_opt(F2FS_I_SB(inode), LFS)) ||
			F2FS_I_SB(inode)->s_ndevs);
Loading