From: Greg Kroah-Hartman Date: Fri, 7 May 2021 15:22:30 +0000 (+0200) Subject: 4.19-stable patches X-Git-Tag: v5.4.118~98 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9a89ee70f52dff7c82427929e9e26346151b36da;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: erofs-add-unsupported-inode-i_format-check.patch --- diff --git a/queue-4.19/erofs-add-unsupported-inode-i_format-check.patch b/queue-4.19/erofs-add-unsupported-inode-i_format-check.patch new file mode 100644 index 00000000000..70f778ae488 --- /dev/null +++ b/queue-4.19/erofs-add-unsupported-inode-i_format-check.patch @@ -0,0 +1,52 @@ +From 24a806d849c0b0c1d0cd6a6b93ba4ae4c0ec9f08 Mon Sep 17 00:00:00 2001 +From: Gao Xiang +Date: Mon, 29 Mar 2021 08:36:14 +0800 +Subject: erofs: add unsupported inode i_format check + +From: Gao Xiang + +commit 24a806d849c0b0c1d0cd6a6b93ba4ae4c0ec9f08 upstream. + +If any unknown i_format fields are set (may be of some new incompat +inode features), mark such inode as unsupported. + +Just in case of any new incompat i_format fields added in the future. + +Link: https://lore.kernel.org/r/20210329003614.6583-1-hsiangkao@aol.com +Fixes: 431339ba9042 ("staging: erofs: add inode operations") +Cc: # 4.19+ +Signed-off-by: Gao Xiang +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/staging/erofs/erofs_fs.h | 3 +++ + drivers/staging/erofs/inode.c | 6 ++++++ + 2 files changed, 9 insertions(+) + +--- a/drivers/staging/erofs/erofs_fs.h ++++ b/drivers/staging/erofs/erofs_fs.h +@@ -71,6 +71,9 @@ enum { + #define EROFS_I_VERSION_BIT 0 + __EROFS_BIT(EROFS_I_, DATA_MAPPING, VERSION); + ++#define EROFS_I_ALL \ ++ ((1 << (EROFS_I_DATA_MAPPING_BIT + EROFS_I_DATA_MAPPING_BITS)) - 1) ++ + struct erofs_inode_v1 { + /* 0 */__le16 i_advise; + +--- a/drivers/staging/erofs/inode.c ++++ b/drivers/staging/erofs/inode.c +@@ -48,6 +48,12 @@ static struct page *read_inode(struct in + v1 = page_address(page) + *ofs; + ifmt = le16_to_cpu(v1->i_advise); + ++ if (ifmt & ~EROFS_I_ALL) { ++ errln("unsupported i_format %u of nid %llu", ifmt, vi->nid); ++ err = -EOPNOTSUPP; ++ goto err_out; ++ } ++ + vi->data_mapping_mode = __inode_data_mapping(ifmt); + if (unlikely(vi->data_mapping_mode >= EROFS_INODE_LAYOUT_MAX)) { + errln("unknown data mapping mode %u of nid %llu", diff --git a/queue-4.19/series b/queue-4.19/series index f3af67c23a4..1fddff06392 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -15,3 +15,4 @@ mmc-block-update-ext_csd.cache_ctrl-if-it-was-written.patch mmc-block-issue-a-cache-flush-only-when-it-s-enabled.patch mmc-core-do-a-power-cycle-when-the-cmd11-fails.patch mmc-core-set-read-only-for-sd-cards-with-permanent-write-protect-bit.patch +erofs-add-unsupported-inode-i_format-check.patch