Skip to content

Commit f3e60a2

Browse files
committed
fbdev: mxc_hdmi: hotplug: lock fb_info before modification
When an HDMI hotplug interrupt occurs, it schedules hotplug_worker(), which indirectly makes one or more calls to fb_videomode_to_var() that modify the fb_info struct associated with the HDMI connection. These can occur concurrently with the handling of an FBIOPUT_VSCREENINFO ioctl which also reads, modifies, and writes the same fields of fb_info, leading to race conditions. This patch holds the fb_info lock in mxc_hdmi_cable_connected() while calling mxc_hdmi_set_mode(), eliminating those race conditions. All of the hogplug handler's calls to fb_videomode_to_var() happen either directly or indirectly from mxc_hdmi_set_mode(), which is called from only one place, in mxc_hdmi_cable_connected(). That seems like the most convenient, least invasive, easiest to get right place to take and release the fb_info lock.
1 parent 04b05c5 commit f3e60a2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/video/fbdev/mxc/mxc_hdmi.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,7 +1974,9 @@ static void mxc_hdmi_cable_connected(struct mxc_hdmi *hdmi)
19741974
}
19751975

19761976
/* Setting video mode */
1977+
lock_fb_info(hdmi->fbi);
19771978
mxc_hdmi_set_mode(hdmi);
1979+
unlock_fb_info(hdmi->fbi);
19781980

19791981
dev_dbg(&hdmi->pdev->dev, "%s exit\n", __func__);
19801982
}

0 commit comments

Comments
 (0)