The branch releng/13.1 has been updated by hselasky:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=cad0a51d388db1744f6dfce2ac95d8df57e6e5dc

commit cad0a51d388db1744f6dfce2ac95d8df57e6e5dc
Author:     Hans Petter Selasky <hsela...@freebsd.org>
AuthorDate: 2022-03-11 16:39:44 +0000
Commit:     Hans Petter Selasky <hsela...@freebsd.org>
CommitDate: 2022-03-17 12:26:26 +0000

    lindebugfs: Make single_release() NULL safe.
    
    Sponsored by:   NVIDIA Networking
    Approved by:    re (gjb)
    
    (cherry picked from commit a23e475c48da7a3751ffdc689be01d514ea2857c)
    (cherry picked from commit d67b2c96153fcef344648d907893b50e30817a38)
---
 sys/compat/linuxkpi/common/src/linux_seq_file.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_seq_file.c 
b/sys/compat/linuxkpi/common/src/linux_seq_file.c
index 6f4f1a368c4a..ed23bf8d010f 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);

Reply via email to