[PATCH] btrfs-progs: Check periodic.timer_fd's value before use

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <zhaolei@xxxxxxxxxxxxxx>
---
 task-utils.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/task-utils.c b/task-utils.c
index a4017ff..12b0002 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;
-- 
1.8.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux