Re: [PATCH] proc: s_fs_info may be NULL when proc_kill_sb is called

From: Al Viro
Date: Wed Jun 10 2020 - 13:42:04 EST


On Wed, Jun 10, 2020 at 12:12:54PM -0500, Eric W. Biederman wrote:

> > {
> > struct proc_fs_info *fs_info = proc_sb_info(sb);
> >
> > - if (fs_info->proc_self)
> > - dput(fs_info->proc_self);
> > + if (fs_info) {
> > + if (fs_info->proc_self)
> > + dput(fs_info->proc_self);
> >
> > - if (fs_info->proc_thread_self)
> > - dput(fs_info->proc_thread_self);
> > + if (fs_info->proc_thread_self)
> > + dput(fs_info->proc_thread_self);
> > +
> > + put_pid_ns(fs_info->pid_ns);
> > + kfree(fs_info);

While we are at it, dput(NULL) is an explicit no-op.