disp: msm: dsi: Nullify display modes after kfree

The 'display->modes' pointer must be set to NULL immediately
after calling kfree on it to prevent potential double-free
vulnerabilities or use-after-free issues.

This change ensures robust memory management by clearing the
pointer to previously freed memory, aligning with best practices
for kernel memory deallocation.

Change-Id: I4fd939bc6ee5f3d9c506f0c311a9400f366e7fd2
Signed-off-by: Vedant Yevale <vyevale@qti.qualcomm.com>
(cherry picked from commit 1d3c5a477ea8f6aca1158209e1b87209c21c61f5)
This commit is contained in:
Vedant Yevale 2025-08-22 14:32:54 +05:30 • committed by Prasad Valavala
commit 38f771a775

View file

@ -7168,8 +7168,10 @@ exit:
rc = 0;
error:
if (rc)
if (rc) {
kfree(display->modes);
display->modes = NULL;
}
mutex_unlock(&display->display_lock);
return rc;