Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/i2c ihidev(4): Avoid reference count overflow.



details:   https://anonhg.NetBSD.org/src/rev/57248f792162
branches:  trunk
changeset: 359626:57248f792162
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Jan 14 22:28:50 2022 +0000

description:
ihidev(4): Avoid reference count overflow.

diffstat:

 sys/dev/i2c/ihidev.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 318f31f2888a -r 57248f792162 sys/dev/i2c/ihidev.c
--- a/sys/dev/i2c/ihidev.c      Fri Jan 14 22:28:42 2022 +0000
+++ b/sys/dev/i2c/ihidev.c      Fri Jan 14 22:28:50 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ihidev.c,v 1.24 2022/01/14 22:28:23 riastradh Exp $ */
+/* $NetBSD: ihidev.c,v 1.25 2022/01/14 22:28:50 riastradh Exp $ */
 /* $OpenBSD ihidev.c,v 1.13 2017/04/08 02:57:23 deraadt Exp $ */
 
 /*-
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ihidev.c,v 1.24 2022/01/14 22:28:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ihidev.c,v 1.25 2022/01/14 22:28:50 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -889,7 +889,7 @@
 
        mutex_enter(&sc->sc_lock);
 
-       if (scd->sc_state & IHIDEV_OPEN) {
+       if (scd->sc_state & IHIDEV_OPEN || sc->sc_refcnt == INT_MAX) {
                error = EBUSY;
                goto out;
        }



Home | Main Index | Thread Index | Old Index