Commit 2c8bc914 authored by Colin Ian King's avatar Colin Ian King Committed by Lyude Paul

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: 2f015ec6 ("drm/dp_mst: Add sideband down request tracing + selftests")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191120173509.347490-1-colin.king@canonical.com
parent 8896e40c
...@@ -504,8 +504,10 @@ drm_dp_decode_sideband_req(const struct drm_dp_sideband_msg_tx *raw, ...@@ -504,8 +504,10 @@ drm_dp_decode_sideband_req(const struct drm_dp_sideband_msg_tx *raw,
} }
if (failed) { 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); kfree(tx->bytes);
}
return -ENOMEM; return -ENOMEM;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment