Skip to content

Commit bae4c0c

Browse files
khaled-R216smfrench
authored andcommitted
fs/cifs: Fix resource leak
The -EIO error return path is leaking memory allocated to page. Fix this by moving the allocation block after the check of cifs_forced_shutdown. Addresses-Coverity: ("Resource leak") Fixes: 087f757 ("cifs: add shutdown support") Signed-off-by: Khaled ROMDHANI <[email protected]> Reviewed-by: Dan Carpenter <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 78c0963 commit bae4c0c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fs/cifs/link.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,12 +683,16 @@ cifs_symlink(struct user_namespace *mnt_userns, struct inode *inode,
683683
struct tcon_link *tlink;
684684
struct cifs_tcon *pTcon;
685685
const char *full_path;
686-
void *page = alloc_dentry_path();
686+
void *page;
687687
struct inode *newinode = NULL;
688688

689689
if (unlikely(cifs_forced_shutdown(cifs_sb)))
690690
return -EIO;
691691

692+
page = alloc_dentry_path();
693+
if (!page)
694+
return -ENOMEM;
695+
692696
xid = get_xid();
693697

694698
tlink = cifs_sb_tlink(cifs_sb);

0 commit comments

Comments
 (0)