diff options
author | PixelBot AutoMerger <android-nexus-securitybot@system.gserviceaccount.com> | 2023-10-29 18:40:26 -0700 |
---|---|---|
committer | Pindar Yang <pindaryang@google.com> | 2023-10-30 08:20:04 +0000 |
commit | ebc441967af0637888ccb51502855ce76671a726 (patch) | |
tree | 5db7d588659f5a0201ca128445d41476d0f50863 | |
parent | 9c2ce76d0fb757e94af18496e42b69b3924846b0 (diff) | |
parent | 7db1424e76745193a3e19710a2db5bff0a357da2 (diff) | |
download | gs-android-gs-felix-5.10-android14-qpr1.tar.gz |
Merge android13-gs-pixel-5.10-udc into android13-gs-pixel-5.10-udc-qpr1android-14.0.0_r0.44android-14.0.0_r0.43android-14.0.0_r0.42android-14.0.0_r0.41android-14.0.0_r0.40android-14.0.0_r0.39android-14.0.0_r0.37android-14.0.0_r0.36android-14.0.0_r0.35android-14.0.0_r0.34android-14.0.0_r0.33android-14.0.0_r0.31android-gs-tangorpro-5.10-android14-qpr1android-gs-raviole-5.10-android14-qpr1android-gs-pantah-5.10-android14-qpr1android-gs-lynx-5.10-android14-qpr1android-gs-felix-5.10-android14-qpr1android-gs-bluejay-5.10-android14-qpr1
Bug: 300854197
SBMerger: 571992243
Change-Id: I07e51db8677acb5bd32503fdd64c42b3a451ef19
Signed-off-by: SecurityBot <android-nexus-securitybot@system.gserviceaccount.com>
-rw-r--r-- | fs/f2fs/node.c | 4 | ||||
-rw-r--r-- | fs/f2fs/xattr.c | 20 |
2 files changed, 16 insertions, 8 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 7f637b7c34cd..8df5cfcc3ab1 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -2741,7 +2741,9 @@ recover_xnid: f2fs_update_inode_page(inode); /* 3: update and set xattr node page dirty */ - memcpy(F2FS_NODE(xpage), F2FS_NODE(page), VALID_XATTR_BLOCK_SIZE); + if (page) + memcpy(F2FS_NODE(xpage), F2FS_NODE(page), + VALID_XATTR_BLOCK_SIZE); set_page_dirty(xpage); f2fs_put_page(xpage, 1); diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c index edd803b70232..6eb47b7445b4 100644 --- a/fs/f2fs/xattr.c +++ b/fs/f2fs/xattr.c @@ -361,10 +361,10 @@ static int lookup_all_xattrs(struct inode *inode, struct page *ipage, *xe = __find_xattr(cur_addr, last_txattr_addr, NULL, index, len, name); if (!*xe) { - f2fs_err(F2FS_I_SB(inode), "inode (%lu) has corrupted xattr", + f2fs_err(F2FS_I_SB(inode), "lookup inode (%lu) has corrupted xattr", inode->i_ino); set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_FSCK); - err = -EFSCORRUPTED; + err = -ENODATA; goto out; } check: @@ -579,11 +579,10 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) if ((void *)(entry) + sizeof(__u32) > last_base_addr || (void *)XATTR_NEXT_ENTRY(entry) > last_base_addr) { - f2fs_err(F2FS_I_SB(inode), "inode (%lu) has corrupted xattr", + f2fs_err(F2FS_I_SB(inode), "list inode (%lu) has corrupted xattr", inode->i_ino); set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_FSCK); - error = -EFSCORRUPTED; - goto cleanup; + break; } if (!handler || (handler->list && !handler->list(dentry))) @@ -644,7 +643,7 @@ static int __f2fs_setxattr(struct inode *inode, int index, if (size > MAX_VALUE_LEN(inode)) return -E2BIG; - +retry: error = read_all_xattrs(inode, ipage, &base_addr); if (error) return error; @@ -654,7 +653,14 @@ static int __f2fs_setxattr(struct inode *inode, int index, /* find entry with wanted name. */ here = __find_xattr(base_addr, last_base_addr, NULL, index, len, name); if (!here) { - f2fs_err(F2FS_I_SB(inode), "inode (%lu) has corrupted xattr", + if (!F2FS_I(inode)->i_xattr_nid) { + f2fs_notice(F2FS_I_SB(inode), + "recover xattr in inode (%lu)", inode->i_ino); + f2fs_recover_xattr_data(inode, NULL); + kfree(base_addr); + goto retry; + } + f2fs_err(F2FS_I_SB(inode), "set inode (%lu) has corrupted xattr", inode->i_ino); set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_FSCK); error = -EFSCORRUPTED; |