diff options
| author | mlelstv <mlelstv@NetBSD.org> | 2021-06-06 10:40:14 +0000 |
|---|---|---|
| committer | mlelstv <mlelstv@NetBSD.org> | 2021-06-06 10:40:14 +0000 |
| commit | 4103893ace444428b67f2e7be75f4dedc732d87c (patch) | |
| tree | a7b4c162af0a907a6a2044f6908477c844e3300d /sys/dev | |
| parent | 56f630941ab84d0624c354174208e5af70889495 (diff) | |
Provide missing file ops. Before a simple read() would panic the kernel.
No longer fail close().
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/iscsi/iscsi_main.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/sys/dev/iscsi/iscsi_main.c b/sys/dev/iscsi/iscsi_main.c index ea0a58dc9dd..adb30d948d9 100644 --- a/sys/dev/iscsi/iscsi_main.c +++ b/sys/dev/iscsi/iscsi_main.c @@ -1,4 +1,4 @@ -/* $NetBSD: iscsi_main.c,v 1.35 2021/04/24 23:36:56 thorpej Exp $ */ +/* $NetBSD: iscsi_main.c,v 1.36 2021/06/06 10:40:14 mlelstv Exp $ */ /*- * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc. @@ -87,8 +87,15 @@ static int iscsiclose(struct file *); static const struct fileops iscsi_fileops = { .fo_name = "iscsi", + .fo_read = fbadop_read, + .fo_write = fbadop_write, .fo_ioctl = iscsiioctl, + .fo_fcntl = fnullop_fcntl, + .fo_poll = fnullop_poll, + .fo_stat = fbadop_stat, .fo_close = iscsiclose, + .fo_kqfilter = fnullop_kqfilter, + .fo_restart = fnullop_restart }; struct cdevsw iscsi_cdevsw = { @@ -166,15 +173,12 @@ iscsiclose(struct file *fp) struct iscsi_softc *sc; sc = device_lookup_private(&iscsi_cd, d->fd_unit); - if (sc == NULL) { - DEBOUT(("%s: Cannot find private data\n",__func__)); - return ENXIO; + if (sc != NULL) { + mutex_enter(&sc->lock); + TAILQ_REMOVE(&sc->fds, d, fd_link); + mutex_exit(&sc->lock); } - mutex_enter(&sc->lock); - TAILQ_REMOVE(&sc->fds, d, fd_link); - mutex_exit(&sc->lock); - kmem_free(d, sizeof(*d)); fp->f_iscsi = NULL; |
