From f3fbb9a39860a6131a408d07238f5c245fac20a2 Mon Sep 17 00:00:00 2001 From: Zhao Lei Date: Mon, 9 Nov 2015 17:06:53 +0800 Subject: btrfs-progs: Check periodic.timer_fd's value before use periodic.timer_fd's value is 0 on inititlize-failed case, if no value-checking before read(), the code will run as read(STDIN). This patch fixed above case. Signed-off-by: Zhao Lei Signed-off-by: David Sterba --- task-utils.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'task-utils.c') diff --git a/task-utils.c b/task-utils.c index a4017ff2..12b00027 100644 --- a/task-utils.c +++ b/task-utils.c @@ -119,6 +119,9 @@ void task_period_wait(struct task_info *info) if (!info) return; + if (info->periodic.timer_fd == 0) + return; + ret = read(info->periodic.timer_fd, &missed, sizeof (missed)); if (ret == -1) return; -- cgit v1.2.3