[PATCH 2/3] drm/vkms: stop generating CRCs on buffer overflow

Oleg Vasilev oleg.vasilev at intel.com
Thu Jun 13 12:18:01 UTC 2019


Because interrupts are generated artifitially, kernel bug may lead to
infinte attempts to submit CRC.

Signed-off-by: Oleg Vasilev <oleg.vasilev at intel.com>
---
 drivers/gpu/drm/vkms/vkms_crc.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vkms/vkms_crc.c b/drivers/gpu/drm/vkms/vkms_crc.c
index d7b409a3c0f8..bc717a8888b5 100644
--- a/drivers/gpu/drm/vkms/vkms_crc.c
+++ b/drivers/gpu/drm/vkms/vkms_crc.c
@@ -167,6 +167,7 @@ void vkms_crc_work_handle(struct work_struct *work)
 	u32 crc32 = 0;
 	u64 frame_start, frame_end;
 	unsigned long flags;
+	int ret;
 
 	spin_lock_irqsave(&out->state_lock, flags);
 	frame_start = crtc_state->frame_start;
@@ -202,7 +203,14 @@ void vkms_crc_work_handle(struct work_struct *work)
 	 * missing frames
 	 */
 	while (frame_start <= frame_end)
-		drm_crtc_add_crc_entry(crtc, true, frame_start++, &crc32);
+	{
+		ret = drm_crtc_add_crc_entry(crtc, true, frame_start++, &crc32);
+		if (ret) {
+			DRM_WARN("VKMS stop generating CRCs\n");
+			out->crc_enabled = false;
+			break;
+		}
+	}
 
 out:
 	/* to avoid using the same value for frame number again */
-- 
2.21.0



More information about the dri-devel mailing list