mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
rnbd-srv: Zero the rsp buffer before using it
[ Upstream commit 69d26698e4 ]
Before using the data buffer to send back the response message, zero it
completely. This prevents any stray bytes to be picked up by the client
side when there the message is exchanged between different protocol
versions.
Signed-off-by: Md Haris Iqbal <haris.iqbal@ionos.com>
Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Grzegorz Prajsner <grzegorz.prajsner@ionos.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Sasha Levin
parent
fd51d47fca
commit
c94ede3c43
@@ -551,6 +551,8 @@ static void rnbd_srv_fill_msg_open_rsp(struct rnbd_msg_open_rsp *rsp,
|
||||
{
|
||||
struct block_device *bdev = file_bdev(sess_dev->bdev_file);
|
||||
|
||||
memset(rsp, 0, sizeof(*rsp));
|
||||
|
||||
rsp->hdr.type = cpu_to_le16(RNBD_MSG_OPEN_RSP);
|
||||
rsp->device_id = cpu_to_le32(sess_dev->device_id);
|
||||
rsp->nsectors = cpu_to_le64(bdev_nr_sectors(bdev));
|
||||
@@ -657,6 +659,7 @@ static void process_msg_sess_info(struct rnbd_srv_session *srv_sess,
|
||||
|
||||
trace_process_msg_sess_info(srv_sess, sess_info_msg);
|
||||
|
||||
memset(rsp, 0, sizeof(*rsp));
|
||||
rsp->hdr.type = cpu_to_le16(RNBD_MSG_SESS_INFO_RSP);
|
||||
rsp->ver = srv_sess->ver;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user