From 3ab23415804502b1ba89360c55ac3e8143822a0b Mon Sep 17 00:00:00 2001 From: Ashish Pandey Date: Thu, 11 Jul 2019 16:52:49 +0530 Subject: cluster/ec: Change handling of heal failure to avoid crash Problem: ec_getxattr_heal_cbk was called with NULL as second argument in case heal was failing. This function was dereferencing "cookie" argument which caused crash. Solution: Cookie is changed to carry the value that was supposed to be stored in fop->data, so even in the case when fop is NULL in error case, there won't be any NULL dereference. Thanks to Xavi for the suggestion about the fix. Change-Id: I0798000d5cadb17c3c2fbfa1baf77033ffc2bb8c fixes: bz#1729085 --- xlators/cluster/ec/src/ec-inode-read.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'xlators/cluster/ec/src/ec-inode-read.c') diff --git a/xlators/cluster/ec/src/ec-inode-read.c b/xlators/cluster/ec/src/ec-inode-read.c index 8f6c2aab1f1..a891ccd0952 100644 --- a/xlators/cluster/ec/src/ec-inode-read.c +++ b/xlators/cluster/ec/src/ec-inode-read.c @@ -392,8 +392,7 @@ ec_getxattr_heal_cbk(call_frame_t *frame, void *cookie, xlator_t *xl, int32_t op_ret, int32_t op_errno, uintptr_t mask, uintptr_t good, uintptr_t bad, dict_t *xdata) { - ec_fop_data_t *fop = cookie; - fop_getxattr_cbk_t func = fop->data; + fop_getxattr_cbk_t func = cookie; ec_t *ec = xl->private; dict_t *dict = NULL; char *str; -- cgit