Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Aug 2017 12:51:05 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r322354 - head/sys/compat/linuxkpi/common/src
Message-ID:  <201708101251.v7ACp5oL088242@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Thu Aug 10 12:51:04 2017
New Revision: 322354
URL: https://svnweb.freebsd.org/changeset/base/322354

Log:
  Make sure the linux_wait_event_common() function in the LinuxKPI properly
  handles a timeout value of MAX_SCHEDULE_TIMEOUT which basically means there
  is no timeout. This is a regression issue after r319757.
  
  While at it change the type of returned variable from "long" to "int" to
  match the actual return type.
  
  MFC after:	1 week
  Sponsored by:	Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/src/linux_schedule.c

Modified: head/sys/compat/linuxkpi/common/src/linux_schedule.c
==============================================================================
--- head/sys/compat/linuxkpi/common/src/linux_schedule.c	Thu Aug 10 12:31:55 2017	(r322353)
+++ head/sys/compat/linuxkpi/common/src/linux_schedule.c	Thu Aug 10 12:51:04 2017	(r322354)
@@ -213,12 +213,18 @@ linux_wait_event_common(wait_queue_head_t *wqh, wait_q
     unsigned int state, spinlock_t *lock)
 {
 	struct task_struct *task;
-	long ret;
+	int ret;
 
 	if (lock != NULL)
 		spin_unlock_irq(lock);
 
 	DROP_GIANT();
+
+	/* range check timeout */
+	if (timeout < 1)
+		timeout = 1;
+	else if (timeout == MAX_SCHEDULE_TIMEOUT)
+		timeout = 0;
 
 	task = current;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708101251.v7ACp5oL088242>