devpts/inode.c : Fix Possible dentry NULL dereference
PATCH 1/1 devpts/inode.c : Fix Possible dentry NULL dereference
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)
--- fs/devpts/inode.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
fs/devpts/inode.c +2 -1
@@ -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 */
Signature · 4 lines
1.7.1
Thanks ,
Maninder Singhÿôèº{.nÇ+‰·Ÿ®‰†+%ŠËÿ±éݶ¥Šwÿº{.nÇ+‰·¥Š{±þG«�éÿŠ{ayºÊ‡Ú™ë,j¢f£¢·hš�ï�êÿ‘êçz_è®(階ŠÝ¢j"�ú¶m§ÿÿ¾«þG«�éÿ¢¸?™¨èÚ&£ø§~�á¶iO•æ¬z·švØ^¶m§ÿÿÃÿ¶ìÿ¢¸?–I¥Quoted 2 lines · Maninder Singh
EP-F6AA0618C49C4AEDA73BFF1B39950BAB
What is this?
Quoted 19 lines
Hi,
Subject: [PATCH 1/1]
devpts/inode.c: Fix Possible dentry NULL dereferenceIssue reported by static tool Analyzer (Prevent).
d_find_aliascan return NULL to deentry, Thus we need NULL check before callingd_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(-)fs/devpts/inode.c +0
-0
fs/devpts/inode.c void devpts_pty_kill(struct inode *inode) · line 669
Quoted 8 lines
fs/devpts/inode.c +2
-1@@ -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?
Signature · 2 lines
Thanks, //richard
Al Viro
NAKQuoted 5 lines · Maninder Singh
Subject: [PATCH 1/1]
devpts/inode.c: Fix Possible dentry NULL dereferenceIssue reported by static tool Analyzer (Prevent).
d_find_aliascan return NULL to deentry, Thus we need NULL check before callingd_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.