ima: Set file->f_mode instead of file->f_flags in ima_calc_file_hash()
stable inclusion from stable-v4.19.125 commit 904de138bae903a6e377322e64312e22a84f2140 category: bugfix bugzilla: 91657, https://gitee.com/openeuler/kernel/issues/I5047U CVE: NA ----------------------------------------------------------------- [ Upstream commit 0014cc04 ] Commit a408e4a8 ("ima: open a new file instance if no read permissions") tries to create a new file descriptor to calculate a file digest if the file has not been opened with O_RDONLY flag. However, if a new file descriptor cannot be obtained, it sets the FMODE_READ flag to file->f_flags instead of file->f_mode. This patch fixes this issue by replacing f_flags with f_mode as it was before that commit. Cc: stable@vger.kernel.org # 4.20.x Fixes: a408e4a8 ("ima: open a new file instance if no read permissions") Signed-off-by:Roberto Sassu <roberto.sassu@huawei.com> Reviewed-by:
Goldwyn Rodrigues <rgoldwyn@suse.com> Signed-off-by:
Mimi Zohar <zohar@linux.ibm.com> Signed-off-by:
Sasha Levin <sashal@kernel.org> Signed-off-by:
Wang Weiyang <wangweiyang2@huawei.com> Reviewed-by:
Xiu Jianfeng <xiujianfeng@huawei.com> Signed-off-by:
Yongqiang Liu <liuyongqiang13@huawei.com>
Loading
Please sign in to comment