* [EDT] [PATCH] devpts/inode.c : Fix Possible dentry NULL dereference
@ 2015-05-21 10:28 Maninder Singh
2015-05-21 10:42 ` Richard Weinberger
2015-05-21 11:12 ` Al Viro
0 siblings, 2 replies; 3+ messages in thread
From: Maninder Singh @ 2015-05-21 10:28 UTC (permalink / raw)
To: akpm, dhowells, fabf, viro, linux-kernel, v.narang
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=windows-1252, Size: 1055 bytes --]
EP-F6AA0618C49C4AEDA73BFF1B39950BAB
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 <maninder1.s@samsung.com>
Reviewed-by: Vaneet Narang <v.narang@samsung.com>
---
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 */
--
1.7.1
Thanks ,
Maninder Singhÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [EDT] [PATCH] devpts/inode.c : Fix Possible dentry NULL dereference
2015-05-21 10:28 [EDT] [PATCH] devpts/inode.c : Fix Possible dentry NULL dereference Maninder Singh
@ 2015-05-21 10:42 ` Richard Weinberger
2015-05-21 11:12 ` Al Viro
1 sibling, 0 replies; 3+ messages in thread
From: Richard Weinberger @ 2015-05-21 10:42 UTC (permalink / raw)
To: maninder1.s
Cc: Andrew Morton, David Howells, Fabian Frederick, Al Viro, LKML, v.narang
On Thu, May 21, 2015 at 12:28 PM, Maninder Singh
<maninder1.s@samsung.com> 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 <maninder1.s@samsung.com>
> Reviewed-by: Vaneet Narang <v.narang@samsung.com>
> ---
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [EDT] [PATCH] devpts/inode.c : Fix Possible dentry NULL dereference
2015-05-21 10:28 [EDT] [PATCH] devpts/inode.c : Fix Possible dentry NULL dereference Maninder Singh
2015-05-21 10:42 ` Richard Weinberger
@ 2015-05-21 11:12 ` Al Viro
1 sibling, 0 replies; 3+ messages in thread
From: Al Viro @ 2015-05-21 11:12 UTC (permalink / raw)
To: Maninder Singh; +Cc: akpm, dhowells, fabf, linux-kernel, v.narang
On Thu, May 21, 2015 at 10:28:52AM +0000, Maninder Singh wrote:
> 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)
No, we do not. That inode must have come from devpts_pty_new() and it
wouldn't have made it out of there without having a dentry attached to
it (and pinned).
NAK.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-05-21 11:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-21 10:28 [EDT] [PATCH] devpts/inode.c : Fix Possible dentry NULL dereference Maninder Singh
2015-05-21 10:42 ` Richard Weinberger
2015-05-21 11:12 ` Al Viro
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome