Module Name:    src
Committed By:   riastradh
Date:           Sat Sep  1 22:28:04 UTC 2018

Modified Files:
        src/sys/external/bsd/drm2/linux: linux_fence.c

Log Message:
Allow fence_get(NULL).

This is kind of silly: if the caller has exclusive access to the
fence, they should be able to guarantee it's there, so this could
serve to suppress legitimate bugs.  But better to preserve Linux
semantics here than to be picky about API design.

Bug by me, fix from Tobias Ulmer in PR kern/53565.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/drm2/linux/linux_fence.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/linux/linux_fence.c
diff -u src/sys/external/bsd/drm2/linux/linux_fence.c:1.12 src/sys/external/bsd/drm2/linux/linux_fence.c:1.13
--- src/sys/external/bsd/drm2/linux/linux_fence.c:1.12	Tue Aug 28 15:04:02 2018
+++ src/sys/external/bsd/drm2/linux/linux_fence.c	Sat Sep  1 22:28:04 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_fence.c,v 1.12 2018/08/28 15:04:02 riastradh Exp $	*/
+/*	$NetBSD: linux_fence.c,v 1.13 2018/09/01 22:28:04 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_fence.c,v 1.12 2018/08/28 15:04:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_fence.c,v 1.13 2018/09/01 22:28:04 riastradh Exp $");
 
 #include <sys/atomic.h>
 #include <sys/condvar.h>
@@ -179,7 +179,8 @@ struct fence *
 fence_get(struct fence *fence)
 {
 
-	kref_get(&fence->refcount);
+	if (fence)
+		kref_get(&fence->refcount);
 	return fence;
 }
 

Reply via email to