From: Colin Ian King Date: Wed, 20 Nov 2019 17:35:09 +0000 (+0000) Subject: drm/dp_mst: fix multiple frees of tx->bytes X-Git-Tag: v5.10.7~2352^2~6^2~841 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2c8bc91488fc57438c43b3bb19deb7fdbc1e5119;p=platform%2Fkernel%2Flinux-rpi.git drm/dp_mst: fix multiple frees of tx->bytes Currently tx->bytes is being freed r->num_transactions number of times because tx is not being set correctly. Fix this by setting tx to &r->transactions[i] so that the correct objects are being freed on each loop iteration. Addresses-Coverity: ("Double free") Fixes: 2f015ec6eab6 ("drm/dp_mst: Add sideband down request tracing + selftests") Signed-off-by: Colin Ian King Signed-off-by: Lyude Paul Link: https://patchwork.freedesktop.org/patch/msgid/20191120173509.347490-1-colin.king@canonical.com --- diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index b854a42..1437bc4 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -504,8 +504,10 @@ drm_dp_decode_sideband_req(const struct drm_dp_sideband_msg_tx *raw, } if (failed) { - for (i = 0; i < r->num_transactions; i++) + for (i = 0; i < r->num_transactions; i++) { + tx = &r->transactions[i]; kfree(tx->bytes); + } return -ENOMEM; }