lindebugfs: Make single_release() NULL safe.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
This commit is contained in:
Hans Petter Selasky 2022-03-11 17:39:44 +01:00
parent 68ec2949ad
commit a23e475c48

View File

@ -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);