The commit is pushed to "branch-rh9-5.14.0-427.44.1.vz9.80.x-ovz" and will 
appear at g...@bitbucket.org:openvz/vzkernel.git
after rh9-5.14.0-427.44.1.vz9.80.36
------>
commit 2b97e9d1d1b664bc67724739a0edb7321e20b2ef
Author: Liu Kui <kui....@virtuozzo.com>
Date:   Thu May 29 12:52:53 2025 +0800

    fs/fuse kio: fix bug due to potential memory alloc failure
    
    When the memory allocation for a response msg in cs_get_hdr() fails,
    it falls back to rpc_get_hdr() to try to allocate. However the
    response msg allocated by rpc_get_hdr() will cause the data being
    received into the newly allocated memory area instead of expected
    destination, and then complete the request without error, thus
    returning incorrect data back. This bug only affect small sized (<4k)
    read.
    
    To fix, we set the request on a recoverable err, PCS_ERR_INTERRUPTED,
    if the allocation in cs_get_hdr fail. This will trigger a retry by
    client.
    
    Related to $VSTOR-107235
    https://virtuozzo.atlassian.net/browse/VSTOR-107235
    Fixes: 694142cae2c43 ("fuse kio: Add pcs engine combo v0.8")
    
    Signed-off-by: Liu Kui <kui....@virtuozzo.com>
    Acked-by: Alexey Kuznetsov <kuz...@virtuozzo.com>
    
    Feature: vStorage
---
 fs/fuse/kio/pcs/pcs_cs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/fuse/kio/pcs/pcs_cs.c b/fs/fuse/kio/pcs/pcs_cs.c
index 6eef58994feff..10d6c860c3f84 100644
--- a/fs/fuse/kio/pcs/pcs_cs.c
+++ b/fs/fuse/kio/pcs/pcs_cs.c
@@ -468,8 +468,10 @@ struct pcs_msg *cs_get_hdr(struct pcs_rpc *ep, struct 
pcs_rpc_hdr *h)
                return NULL;
 
        resp = pcs_rpc_alloc_input_msg(ep, sizeof(struct pcs_cs_iohdr));
-       if (!resp)
+       if (!resp) {
+               pcs_set_local_error(&msg->error, PCS_ERR_INTERRUPTED);
                return NULL;
+       }
 
        memcpy(resp->_inline_buffer, h, sizeof(struct pcs_rpc_hdr));
        resp->size = h->len;
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to