On Thu, May 21, 2015 at 12:28 PM, Maninder Singh
<[email protected]> wrote:
>
> EP-F6AA0618C49C4AEDA73BFF1B39950BAB

What is this?

> Hi,
>
> Subject: [PATCH 1/1] devpts/inode.c : Fix Possible dentry NULL dereference
>
> Issue reported by static tool Analyzer (Prevent).
> d_find_alias can return NULL to deentry, Thus we need NULL check
> before calling d_delete(dentry)
>
> Signed-off-by: Maninder Singh <[email protected]>
> Reviewed-by: Vaneet Narang <[email protected]>
> ---
>  fs/devpts/inode.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
> index add5663..0350ac2 100644
> --- a/fs/devpts/inode.c
> +++ b/fs/devpts/inode.c
> @@ -663,7 +663,8 @@ void devpts_pty_kill(struct inode *inode)
>         dentry = d_find_alias(inode);
>
>         drop_nlink(inode);
> -       d_delete(dentry);
> +       if (dentry)
> +               d_delete(dentry);
>         dput(dentry);   /* d_alloc_name() in devpts_pty_new() */
>         dput(dentry);           /* d_find_alias above */

While it is correct that d_find_alias() may return NULL, can this also
happen here?
I mean if that happens in the kill path we might have bigger trouble...

Al?

-- 
Thanks,
//richard
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to