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;
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to