Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 May 2017 12:25:37 +0000 (UTC)
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r317645 - head/sys/compat/linux
Message-ID:  <201705011225.v41CPbA6043210@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dchagin
Date: Mon May  1 12:25:37 2017
New Revision: 317645
URL: https://svnweb.freebsd.org/changeset/base/317645

Log:
  Fix NULL pointer dereference in futex_wake_op() in case when the same
  address specified for arguments uaddr and uaddr2.
  
  PR:		218987
  Reported by:	luke.tw gmail
  MFC after:	1 week

Modified:
  head/sys/compat/linux/linux_futex.c

Modified: head/sys/compat/linux/linux_futex.c
==============================================================================
--- head/sys/compat/linux/linux_futex.c	Mon May  1 10:12:59 2017	(r317644)
+++ head/sys/compat/linux/linux_futex.c	Mon May  1 12:25:37 2017	(r317645)
@@ -952,6 +952,11 @@ retry1:
 		    args->uaddr, args->val, args->uaddr2, args->val3,
 		    args->timeout);
 
+		if (args->uaddr == args->uaddr2) {
+			LIN_SDT_PROBE1(futex, linux_sys_futex, return, EINVAL);
+			return (EINVAL);
+		}
+
 retry2:
 		error = futex_get(args->uaddr, NULL, &f, flags | FUTEX_DONTLOCK);
 		if (error) {
@@ -959,9 +964,7 @@ retry2:
 			return (error);
 		}
 
-		if (args->uaddr != args->uaddr2)
-			error = futex_get(args->uaddr2, NULL, &f2,
-			    flags | FUTEX_DONTLOCK);
+		error = futex_get(args->uaddr2, NULL, &f2, flags | FUTEX_DONTLOCK);
 		if (error) {
 			futex_put(f, NULL);
 



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