From: Dan Carpenter <dan.carpenter@oracle.com>
To: Namjae Jeon <namjae.jeon@samsung.com>,
Marios Makassikis <mmakassikis@freebox.fr>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Steve French <sfrench@samba.org>,
Hyunchul Lee <hyc.lee@gmail.com>,
linux-cifs@vger.kernel.org,
linux-cifsd-devel@lists.sourceforge.net,
kernel-janitors@vger.kernel.org
Subject: [PATCH] cifsd: fix an uninitialized variable in smb2_write()
Date: Tue, 11 May 2021 10:08:09 +0300 [thread overview]
Message-ID: <YJotWR/qMDIoJAcV@mwanda> (raw)
If there is a permissions problem then the "fp" variable is used in the
"goto out;" without being initialized. The correct fix is to initialize
"fp" to NULL which turns the ksmbd_fd_put(work, fp); call into a no-op.
Fixes: bb03a3d512bf ("cifsd: Call smb2_set_err_rsp() in smb2_read/smb2_write error path")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
fs/cifsd/smb2pdu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/cifsd/smb2pdu.c b/fs/cifsd/smb2pdu.c
index d07d7c45f899..18de8a763209 100644
--- a/fs/cifsd/smb2pdu.c
+++ b/fs/cifsd/smb2pdu.c
@@ -6078,7 +6078,7 @@ int smb2_write(struct ksmbd_work *work)
{
struct smb2_write_req *req;
struct smb2_write_rsp *rsp, *rsp_org;
- struct ksmbd_file *fp;
+ struct ksmbd_file *fp = NULL;
loff_t offset;
size_t length;
ssize_t nbytes;
--
2.30.2
next reply other threads:[~2021-05-11 7:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20210511070900epcas1p1619e7c7f3c6248d4bb871d8e244590ab@epcas1p1.samsung.com>
2021-05-11 7:08 ` Dan Carpenter [this message]
2021-05-11 9:10 ` [PATCH] cifsd: fix an uninitialized variable in smb2_write() Namjae Jeon
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=YJotWR/qMDIoJAcV@mwanda \
--to=dan.carpenter@oracle.com \
--cc=hyc.lee@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-cifsd-devel@lists.sourceforge.net \
--cc=mmakassikis@freebox.fr \
--cc=namjae.jeon@samsung.com \
--cc=sergey.senozhatsky@gmail.com \
--cc=sfrench@samba.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.