Skip to content

Commit 87997b6

Browse files
mwiniarsrodrigovivi
authored andcommitted
drm/xe/pf: Fix use-after-free in migration restore
When an error is returned from xe_sriov_pf_migration_restore_produce(), the data pointer is not set to NULL, which can trigger use-after-free in subsequent .write() calls. Set the pointer to NULL upon error to fix the problem. Fixes: 1ed3039 ("drm/xe/pf: Add support for encap/decap of bitstream to/from packet") Reported-by: Sebastian Österlund <[email protected]> Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/7230 Reviewed-by: Shuicheng Lin <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Michał Winiarski <[email protected]> (cherry picked from commit 4f53d8c) Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent c369299 commit 87997b6

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/gpu/drm/xe/xe_sriov_packet.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,8 @@ ssize_t xe_sriov_packet_write_single(struct xe_device *xe, unsigned int vfid,
341341
ret = xe_sriov_pf_migration_restore_produce(xe, vfid, *data);
342342
if (ret) {
343343
xe_sriov_packet_free(*data);
344+
*data = NULL;
345+
344346
return ret;
345347
}
346348

0 commit comments

Comments
 (0)