LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Colin King <colin.king@canonical.com>
To: Steve French <sfrench@samba.org>,
linux-cifs@vger.kernel.org, Ronnie Sahlberg <lsahlber@redhat.com>,
samba-technical@lists.samba.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH][next] cifs: ensure full_path is free'd on error exit path
Date: Fri, 20 Apr 2018 14:15:19 +0100 [thread overview]
Message-ID: <20180420131519.30510-1-colin.king@canonical.com> (raw)
From: Colin Ian King <colin.king@canonical.com>
Currently the check on the mode flags that returns -EPERM is leaking
full_path on the error exit return. Fix this by kfree'ing it before
the return.
Detected by CoverityScan, CID#1468029 ("Resource Leak")
Fixes: 49162bfde140 ("cifs: do not allow creating sockets except with SMB1 posix exensions")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
fs/cifs/dir.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index f0a759dd6817..207883b39362 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -684,8 +684,10 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, umode_t mode,
goto mknod_out;
}
- if (!S_ISCHR(mode) && !S_ISBLK(mode))
+ if (!S_ISCHR(mode) && !S_ISBLK(mode)) {
+ kfree(full_path);
return -EPERM;
+ }
if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL))
goto mknod_out;
--
2.17.0
reply other threads:[~2018-04-20 13:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180420131519.30510-1-colin.king@canonical.com \
--to=colin.king@canonical.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lsahlber@redhat.com \
--cc=samba-technical@lists.samba.org \
--cc=sfrench@samba.org \
--subject='Re: [PATCH][next] cifs: ensure full_path is free'\''d on error exit path' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).