Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754478AbbEUKmG (ORCPT ); Thu, 21 May 2015 06:42:06 -0400 Received: from mail-vn0-f52.google.com ([209.85.216.52]:46503 "EHLO mail-vn0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751385AbbEUKmC (ORCPT ); Thu, 21 May 2015 06:42:02 -0400 MIME-Version: 1.0 In-Reply-To: <1817342376.533191432204130151.JavaMail.weblogic@ep2mlwas07b> References: <1817342376.533191432204130151.JavaMail.weblogic@ep2mlwas07b> Date: Thu, 21 May 2015 12:42:01 +0200 Message-ID: Subject: Re: [EDT] [PATCH] devpts/inode.c : Fix Possible dentry NULL dereference From: Richard Weinberger To: maninder1.s@samsung.com Cc: Andrew Morton , David Howells , Fabian Frederick , Al Viro , LKML , "v.narang@samsung.com" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1496 Lines: 49 On Thu, May 21, 2015 at 12:28 PM, Maninder Singh 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 > Reviewed-by: Vaneet Narang > --- > 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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/