Commit 189d42b
committed
Merge: CVE-2024-49983: ext4: drop ppath from ext4_ext_replay_update_ex() to avoid double-free
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/5565
JIRA: https://issues.redhat.com/browse/RHEL-64010
CVE: CVE-2024-49983
```
ext4: drop ppath from ext4_ext_replay_update_ex() to avoid double-free
When calling ext4_force_split_extent_at() in ext4_ext_replay_update_ex(),
the 'ppath' is updated but it is the 'path' that is freed, thus potentially
triggering a double-free in the following process:
ext4_ext_replay_update_ex
ppath = path
ext4_force_split_extent_at(&ppath)
ext4_split_extent_at
ext4_ext_insert_extent
ext4_ext_create_new_leaf
ext4_ext_grow_indepth
ext4_find_extent
if (depth > path[0].p_maxdepth)
kfree(path) ---> path First freed
*orig_path = path = NULL ---> null ppath
kfree(path) ---> path double-free !!!
So drop the unnecessary ppath and use path directly to avoid this problem.
And use ext4_find_extent() directly to update path, avoiding unnecessary
memory allocation and freeing. Also, propagate the error returned by
ext4_find_extent() instead of using strange error codes.
Fixes: 8016e29 ("ext4: fast commit recovery path")
Cc: stable@kernel.org
Signed-off-by: Baokun Li <libaokun1@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Tested-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Link: https://patch.msgid.link/20240822023545.1994557-8-libaokun@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
(cherry picked from commit 5c0f4cc)
```
Signed-off-by: CKI Backport Bot <cki-ci-bot+cki-gitlab-backport-bot@redhat.com>
---
<small>Created 2024-10-22 13:58 UTC by backporter - [KWF FAQ](https://red.ht/kernel_workflow_doc) - [Slack #team-kernel-workflow](https://redhat-internal.slack.com/archives/C04LRUPMJQ5) - [Source](https://gitlab.com/cki-project/kernel-workflow/-/blob/main/webhook/utils/backporter.py) - [Documentation](https://gitlab.com/cki-project/kernel-workflow/-/blob/main/docs/README.backporter.md) - [Report an issue](https://gitlab.com/cki-project/kernel-workflow/-/issues/new?issue%5Btitle%5D=backporter%20webhook%20issue)</small>
Approved-by: Brian Foster <bfoster@redhat.com>
Approved-by: Chris von Recklinghausen <crecklin@redhat.com>
Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com>
Merged-by: Rado Vrbovsky <rvrbovsk@redhat.com>1 file changed
+10
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5876 | 5876 | | |
5877 | 5877 | | |
5878 | 5878 | | |
5879 | | - | |
| 5879 | + | |
5880 | 5880 | | |
5881 | 5881 | | |
5882 | 5882 | | |
| |||
5892 | 5892 | | |
5893 | 5893 | | |
5894 | 5894 | | |
5895 | | - | |
5896 | 5895 | | |
5897 | | - | |
| 5896 | + | |
5898 | 5897 | | |
5899 | 5898 | | |
5900 | 5899 | | |
5901 | | - | |
5902 | | - | |
| 5900 | + | |
| 5901 | + | |
5903 | 5902 | | |
5904 | | - | |
5905 | | - | |
| 5903 | + | |
5906 | 5904 | | |
5907 | 5905 | | |
| 5906 | + | |
5908 | 5907 | | |
5909 | 5908 | | |
5910 | | - | |
| 5909 | + | |
5911 | 5910 | | |
5912 | 5911 | | |
5913 | 5912 | | |
5914 | 5913 | | |
5915 | | - | |
5916 | | - | |
| 5914 | + | |
| 5915 | + | |
5917 | 5916 | | |
5918 | | - | |
| 5917 | + | |
5919 | 5918 | | |
5920 | 5919 | | |
5921 | 5920 | | |
| |||
0 commit comments