From: Yangtao Li frank.li@vivo.com
mainline inclusion from mainline-v6.4-rc1 commit f8107c996f5419a5b964b9796d736c7b81f099a0 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I7D7ZL?from=project-issue CVE: NA
--------------------------------
For v1_write_file_info function, when quota_write() returns 0, it should be considered an EIO error. And for v2_write_file_info(), fix to proper error return code instead of raw number.
Signed-off-by: Yangtao Li frank.li@vivo.com Signed-off-by: Jan Kara jack@suse.cz Message-Id: 20230227120216.31306-1-frank.li@vivo.com Signed-off-by: Ye Bin yebin10@huawei.com Reviewed-by: Yang Erkun yangerkun@huawei.com Signed-off-by: Yongqiang Liu liuyongqiang13@huawei.com --- fs/quota/quota_v1.c | 2 +- fs/quota/quota_v2.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/quota/quota_v1.c b/fs/quota/quota_v1.c index 7ac5298aba70..ebae72dc805a 100644 --- a/fs/quota/quota_v1.c +++ b/fs/quota/quota_v1.c @@ -205,7 +205,7 @@ static int v1_write_file_info(struct super_block *sb, int type) sizeof(struct v1_disk_dqblk), v1_dqoff(0)); if (ret == sizeof(struct v1_disk_dqblk)) ret = 0; - else if (ret > 0) + else if (ret >= 0) ret = -EIO; out: up_write(&dqopt->dqio_sem); diff --git a/fs/quota/quota_v2.c b/fs/quota/quota_v2.c index 22367b851d6b..760b947d061e 100644 --- a/fs/quota/quota_v2.c +++ b/fs/quota/quota_v2.c @@ -213,7 +213,7 @@ static int v2_write_file_info(struct super_block *sb, int type) up_write(&dqopt->dqio_sem); if (size != sizeof(struct v2_disk_dqinfo)) { quota_error(sb, "Can't write info structure"); - return -1; + return size < 0 ? size : -EIO; } return 0; }