加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-home-fix-heap-use-after-free.patch 1.06 KB
一键复制 编辑 原始数据 按行查看 历史
From 5ed20345db356121bc72e0092c17b74e2de67ff7 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Tue, 14 Dec 2021 15:38:12 +0900
Subject: [PATCH] home: fix heap-use-after-free
`bus_home_emit_remove()` may be called from manager_free() -> home_free().
In that case, manager->bus is already unref()ed.
Fixes #21767.
(cherry picked from commit 2ff457720bd3bc59985e807b748f6305bdf27826)
Conflict:NA
Reference:https://github.com/systemd/systemd/commit/5ed20345db356121bc72e0092c17b74e2de67ff7
---
src/home/homed-home-bus.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/home/homed-home-bus.c b/src/home/homed-home-bus.c
index c71256d15e..601ecc5cf5 100644
--- a/src/home/homed-home-bus.c
+++ b/src/home/homed-home-bus.c
@@ -940,6 +940,12 @@ int bus_home_emit_remove(Home *h) {
if (!h->announced)
return 0;
+ if (!h->manager)
+ return 0;
+
+ if (!h->manager->bus)
+ return 0;
+
r = bus_home_path(h, &path);
if (r < 0)
return r;
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化