0 Star 0 Fork 40

wangjufeng/multipath-tools

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
6002-libmultipath-fix-memory-issue-in-path_latency-prio.patch 1.24 KB
一键复制 编辑 原始数据 按行查看 历史
wangjufeng 提交于 2020-01-10 17:13 . rename the package
From c3b739527258dae7ebe4b5d083a33ce527675082 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 9 Oct 2018 18:03:07 -0500
Subject: [PATCH] libmultipath: fix memory issue in path_latency prio
The path_latency prioriziter was assuming that prepare_directio_read()
always succeeds. However, it doesn't, and when it fails, the prioritizer
used buf without it pointing to alloced memory. Found by coverity.
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/prioritizers/path_latency.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libmultipath/prioritizers/path_latency.c b/libmultipath/prioritizers/path_latency.c
index 765265c0..eeee01e1 100644
--- a/libmultipath/prioritizers/path_latency.c
+++ b/libmultipath/prioritizers/path_latency.c
@@ -237,7 +237,8 @@ int getprio(struct path *pp, char *args, unsigned int timeout)
lg_maxavglatency = log(MAX_AVG_LATENCY) / lg_base;
lg_minavglatency = log(MIN_AVG_LATENCY) / lg_base;
- prepare_directio_read(pp->fd, &blksize, &buf, &restore_flags);
+ if (prepare_directio_read(pp->fd, &blksize, &buf, &restore_flags) < 0)
+ return PRIO_UNDEF;
temp = io_num;
while (temp-- > 0) {
--
2.11.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wangjufeng/multipath-tools.git
git@gitee.com:wangjufeng/multipath-tools.git
wangjufeng
multipath-tools
multipath-tools
master

搜索帮助