[Devel] [PATCH RHEL7 COMMIT] cbt: fix panic in blk_cbt_map_copy_once()

Konstantin Khorenko khorenko at virtuozzo.com
Fri May 27 02:01:24 PDT 2016


The commit is pushed to "branch-rh7-3.10.0-327.18.2.vz7.14.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.18.2.vz7.14.8
------>
commit 92051fef17b47b41f7426504b5a3a2f96da865d3
Author: Maxim Patlasov <mpatlasov at virtuozzo.com>
Date:   Fri May 27 13:01:24 2016 +0400

    cbt: fix panic in blk_cbt_map_copy_once()
    
    Avoid panic if userspace erroneously calls ioctl(PLOOP_IOC_PUSH_BACKUP_INIT)
    while CBT is off (i.e. q->cbt == NULL).
    
    https://jira.sw.ru/browse/PSBM-47416
    
    Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
---
 block/blk-cbt.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/block/blk-cbt.c b/block/blk-cbt.c
index 8cdf1d6..8ba52fb 100644
--- a/block/blk-cbt.c
+++ b/block/blk-cbt.c
@@ -290,7 +290,11 @@ int blk_cbt_map_copy_once(struct request_queue *q, __u8 *uuid,
 	mutex_lock(&cbt_mutex);
 	cbt = q->cbt;
 
-	BUG_ON(!cbt);
+	if (!cbt) {
+		mutex_unlock(&cbt_mutex);
+		return -ENOENT;
+	}
+
 	BUG_ON(!cbt->map);
 	BUG_ON(!cbt->block_max);
 


More information about the Devel mailing list