From: Xiaohui Zhang <ruc_zhangxiaohui@163.com>
To: martin.petersen@oracle.com, linux-scsi@vger.kernel.org,
target-devel@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Zhang Xiaohui <ruc_zhangxiaohui@163.com>
Subject: [PATCH 1/1] target: Make sure no zero value in the buffer
Date: Thu, 3 Dec 2020 19:40:40 +0800 [thread overview]
Message-ID: <20201203114040.12656-1-ruc_zhangxiaohui@163.com> (raw)
From: Zhang Xiaohui <ruc_zhangxiaohui@163.com>
The fix makes sure no zero value in the buffer, by comparing the
strlen() of the original buffer with the size variable.
Signed-off-by: Zhang Xiaohui <ruc_zhangxiaohui@163.com>
---
drivers/target/target_core_iblock.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
index f2bd2e207..b23e92449 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -537,6 +537,8 @@ static ssize_t iblock_set_configfs_dev_params(struct se_device *dev,
int ret = 0, token;
unsigned long tmp_readonly;
+ if (strlen(page) < count)
+ return -EOVERFLOW;
opts = kstrdup(page, GFP_KERNEL);
if (!opts)
return -ENOMEM;
--
2.17.1
next reply other threads:[~2020-12-03 13:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-03 11:40 Xiaohui Zhang [this message]
2020-12-06 18:55 ` Bodo Stroesser
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=20201203114040.12656-1-ruc_zhangxiaohui@163.com \
--to=ruc_zhangxiaohui@163.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=target-devel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®