From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2BF21C84DC for ; Mon, 1 Jun 2026 14:19:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780323586; cv=none; b=OD5DG7KGEulG5rg9ogxrra3BQ4/ssTssFXHfOLYHe9vNzoLxWT7tU3I44IgntBg4u+LoBxp0UvNQFsw9v1+RiWbKrDZ8DGknGt5sja4DvAODCdrdeHQZNRZ6DJpJMBpsV8s2QXPa+59j4k2cFObtw1JRvhyfWJgM5BcyeJslZN8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780323586; c=relaxed/simple; bh=tTrsFrMKi0qIkPhYn47uB1h5ZRopQH8NcvnNbEiufuA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dZPQ0bKpKBYaA80B4LXOx89JrV5S04IZKb48V0VEuYCC70g8/nv+gxn7c+XWDi81W6i9EqUqb8Xyg60F0mEBl7JIiK8UCa/nqu1Am1r1Qxfc+NrIgQY9yr1LX/KGgs0X9pOhYsVZQjDFRfFcBMYuT13UTeH6lGag2sVEI5SWeDo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id DFE026AE89; Mon, 1 Jun 2026 14:19:29 +0000 (UTC) Authentication-Results: smtp-out1.suse.de; none Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 896B3779A7; Mon, 1 Jun 2026 14:19:29 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 0CleIPGUHWpSdwAAD6G6ig (envelope-from ); Mon, 01 Jun 2026 14:19:29 +0000 From: Thomas Zimmermann To: simona@ffwll.ch, michel.daenzer@mailbox.org, louis.chauvet@bootlin.com, ville.syrjala@linux.intel.com, jani.nikula@intel.com, mhklkml@zohomail.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, airlied@gmail.com Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, virtualization@lists.linux.dev, Thomas Zimmermann Subject: [PATCH 6/7] drm/vblank: timer: Verify that expiry time is in the future Date: Mon, 1 Jun 2026 16:08:34 +0200 Message-ID: <20260601141922.91498-7-tzimmermann@suse.de> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260601141922.91498-1-tzimmermann@suse.de> References: <20260601141922.91498-1-tzimmermann@suse.de> Precedence: bulk X-Mailing-List: virtualization@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spam-Flag: NO X-Spam-Score: -4.00 X-Spam-Level: X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Rspamd-Queue-Id: DFE026AE89 X-Rspamd-Action: no action The timer expiry must be later than the current vblank timestamp. By testing with !ktime_compare(), the expiry time could also be before the vblank timestamp. Use ktime_after() to verify that the timer expires in the future. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/drm_vblank.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c index b5d2fb741b2d..75e2183be0ab 100644 --- a/drivers/gpu/drm/drm_vblank.c +++ b/drivers/gpu/drm/drm_vblank.c @@ -2329,7 +2329,7 @@ bool drm_crtc_vblank_get_vblank_timeout(struct drm_crtc *crtc, ktime_t *vblank_t *vblank_time = READ_ONCE(vtimer->timer.node.expires); } while (cur_count != drm_crtc_vblank_count_and_time(crtc, &cur_time)); - if (drm_WARN_ON(dev, !ktime_compare(*vblank_time, cur_time))) + if (drm_WARN_ON(dev, !ktime_after(*vblank_time, cur_time))) return false; /* already expired */ framedur_ns = vblank->framedur_ns; -- 2.54.0