Index: vscsi.c =================================================================== RCS file: /cvs/src/sys/dev/vscsi.c,v retrieving revision 1.32 diff -u -p -r1.32 vscsi.c --- vscsi.c 22 Sep 2014 01:09:29 -0000 1.32 +++ vscsi.c 22 Sep 2014 01:10:27 -0000 @@ -1,4 +1,4 @@ -/* $OpenBSD: vscsi.c,v 1.32 2014/09/22 01:09:29 dlg Exp $ */ +/* $OpenBSD: vscsi.c,v 1.31 2014/09/14 14:17:24 jsg Exp $ */ /* * Copyright (c) 2008 David Gwynne @@ -583,7 +583,8 @@ vscsikqfilter(dev_t dev, struct knote *k SLIST_INSERT_HEAD(klist, kn, kn_selnext); mtx_leave(&sc->sc_sel_mtx); - device_unref(&sc->sc_dev); + /* device ref is given to the knote in the klist */ + return (0); } @@ -596,6 +597,8 @@ filt_vscsidetach(struct knote *kn) mtx_enter(&sc->sc_sel_mtx); SLIST_REMOVE(klist, kn, knote, kn_selnext); mtx_leave(&sc->sc_sel_mtx); + + device_unref(&sc->sc_dev); } int