diff --git a/sys/compat/linuxkpi/common/src/linux_seq_file.c b/sys/compat/linuxkpi/common/src/linux_seq_file.c index 6f4f1a368c4..ed23bf8d010 100644 --- a/sys/compat/linuxkpi/common/src/linux_seq_file.c +++ b/sys/compat/linuxkpi/common/src/linux_seq_file.c @@ -147,9 +147,15 @@ seq_release(struct inode *inode __unused, struct linux_file *file) int single_release(struct vnode *v, struct linux_file *f) { - const struct seq_operations *op = ((struct seq_file *)f->private_data)->op; + const struct seq_operations *op; + struct seq_file *m; int rc; + /* be NULL safe */ + if ((m = f->private_data) == NULL) + return (0); + + op = m->op; rc = seq_release(v, f); free(__DECONST(void *, op), M_LSEQ); return (rc);