[RHEL7,COMMIT] fuse/kio_pcs: read is broken by FIEMAP patch

Submitted by Konstantin Khorenko on April 28, 2018, 8:26 a.m.

Details

Message ID 201804280826.w3S8QU1M003913@finist_ce7.work
State New
Series "fuse/kio_pcs: read is broken by FIEMAP patch"
Headers show

Commit Message

Konstantin Khorenko April 28, 2018, 8:26 a.m.
The commit is pushed to "branch-rh7-3.10.0-693.21.1.vz7.47.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.21.1.vz7.47.3
------>
commit f51c796e73504b11207d5de5cd81c7c6e5f825a7
Author: Alexey Kuznetsov <kuznet@virtuozzo.com>
Date:   Sat Apr 28 11:26:30 2018 +0300

    fuse/kio_pcs: read is broken by FIEMAP patch
    
    This is unpleasant discovery both for user space and for kernel pcs module.
    Ages ago we have lost possibility to detect incorrectly formatted rpc responces
    and instead of logging the event and connection abort we complete requests
    returning invalid data. The issue must be addressed.
    
    https://pmc.acronis.com/browse/VSTOR-9727
    
    Signed-off-by: Alexey Kuznetsov <kuznet@virtuozzo.com>
    Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 fs/fuse/kio/pcs/pcs_cs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/fuse/kio/pcs/pcs_cs.c b/fs/fuse/kio/pcs/pcs_cs.c
index ba3c0fea5fe4..151b06cb18cf 100644
--- a/fs/fuse/kio/pcs/pcs_cs.c
+++ b/fs/fuse/kio/pcs/pcs_cs.c
@@ -413,10 +413,10 @@  static struct pcs_msg *cs_get_hdr(struct pcs_rpc *ep, struct pcs_rpc_hdr *h)
 	if (ireq->type != PCS_IREQ_IOCHUNK)
 		return NULL;
 	if (ireq->iochunk.cmd == PCS_REQ_T_READ) {
-		if (ireq->iochunk.size + sizeof(struct pcs_cs_iohdr) != msg->size)
+		if (ireq->iochunk.size + sizeof(struct pcs_cs_iohdr) != h->len)
 			return NULL;
 	} else if (ireq->iochunk.cmd == PCS_REQ_T_FIEMAP) {
-		if (PCS_FIEMAP_BUFSIZE + sizeof(struct pcs_cs_iohdr) < msg->size)
+		if (PCS_FIEMAP_BUFSIZE + sizeof(struct pcs_cs_iohdr) < h->len)
 			return NULL;
 	} else
 		return NULL;