Message ID | 20171127142126.25765-1-tomeu.vizoso@collabora.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <dri-devel-bounces@lists.freedesktop.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7E6DD6028E for <patchwork-dri-devel@patchwork.kernel.org>; Mon, 27 Nov 2017 14:22:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7139328E7F for <patchwork-dri-devel@patchwork.kernel.org>; Mon, 27 Nov 2017 14:22:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 605AF28EAF; Mon, 27 Nov 2017 14:22:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0972828E8F for <patchwork-dri-devel@patchwork.kernel.org>; Mon, 27 Nov 2017 14:22:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1A631896B5; Mon, 27 Nov 2017 14:22:40 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7B326896B5 for <dri-devel@lists.freedesktop.org>; Mon, 27 Nov 2017 14:22:39 +0000 (UTC) Received: by mail-wm0-x241.google.com with SMTP id w73so6548989wmw.0 for <dri-devel@lists.freedesktop.org>; Mon, 27 Nov 2017 06:22:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=2MgcXo3sg5lpMQozYPcFpkYlQaBQv1SLp6Ec7/Wpnxo=; b=Vtvd3044SXn/G6pJpxHNkuGPnUK8v1RIHLFLD21XAnjIutC5Hy6ZzCYCEgQiExLYhk VM8xaij8BnZDN7yOL+uT3LCPK7dO/+CNfw/has19vNyNv0qIpC7TTy/kSm1QryaVwIMj E88FNAKFcR+2xGUNaxFKw6WsnjEobNMRbAP/OUzzMWI5Q/4t52FbrWj6/smNHs2nbR72 8GcahBfTyk3N6XWMsr4uQDyi9Ys8GH4QBXt8vg0NqNpnI3IgDFaXQzcGX5VhLWgTTGe/ wTbVf0o8snrIxIkeuBpnfS2EDlZ7bhlJ2nXVf9mO6adTzxDWXrRiD3XBa3FI/ft1qCpG fQVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=2MgcXo3sg5lpMQozYPcFpkYlQaBQv1SLp6Ec7/Wpnxo=; b=tvK9HjETQ/OWg/CZveNgodE4T9gihc6QgMUEnvMb955NJUUXMYgYver5NS/oeCm8W9 f6etdHmUoy9unafk5NG3TvhZvNitF0YwrR/v4zvfsBst2xb0TVtbG0qLgydjDCKjIAIl Ac3Fwuinkrh0iifZayg4sng5SrDY4uNiypavJGI/pvUTG7iEE4/mQAQM0NjctIv5sT89 HgEnm4nZTLEVh/AB0toVWYVZifjLdYA+8yoTwstEEKgnMzXfxpPFSmCQlWsCC1dRmvpZ 0gjg+DWAFVYfcSHiv1EvNF9C2hjciG8taq3NYzBFyjQ6lN50FDm43Eukl4DoHNKiixbB nsaw== X-Gm-Message-State: AJaThX7vxF3vtT6HtIijApQoylHm8cAoWa/8SSzBIdrkyIZOpcbQeFXo uIVrTOcTRLqcBBO5IPu1XXpamcF6 X-Google-Smtp-Source: AGs4zMYE6kZL5/FFvHtt/f3Jxjb9jWcInJJHzgT9kfZhwNoOljyzU5JtVXJ7iMC4gkDlwLESwekRkQ== X-Received: by 10.28.111.146 with SMTP id c18mr17657849wmi.123.1511792557713; Mon, 27 Nov 2017 06:22:37 -0800 (PST) Received: from cizrna.lan ([109.72.12.11]) by smtp.gmail.com with ESMTPSA id 68sm21843732wmh.2.2017.11.27.06.22.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Nov 2017 06:22:36 -0800 (PST) From: Tomeu Vizoso <tomeu.vizoso@collabora.com> To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/virtio: Don't return invalid caps on timeout Date: Mon, 27 Nov 2017 15:21:25 +0100 Message-Id: <20171127142126.25765-1-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.14.3 Cc: David Airlie <airlied@linux.ie>, open list <linux-kernel@vger.kernel.org>, Gerd Hoffmann <kraxel@redhat.com>, Tomeu Vizoso <tomeu.vizoso@collabora.com>, "open list:VIRTIO GPU DRIVER" <virtualization@lists.linux-foundation.org> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development <dri-devel.lists.freedesktop.org> List-Unsubscribe: <https://lists.freedesktop.org/mailman/options/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=unsubscribe> List-Archive: <https://lists.freedesktop.org/archives/dri-devel> List-Post: <mailto:dri-devel@lists.freedesktop.org> List-Help: <mailto:dri-devel-request@lists.freedesktop.org?subject=help> List-Subscribe: <https://lists.freedesktop.org/mailman/listinfo/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=subscribe> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" <dri-devel-bounces@lists.freedesktop.org> X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c index b94bd5440e57..902120ad4a6d 100644 --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c @@ -517,6 +517,8 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev, ret = wait_event_timeout(vgdev->resp_wq, atomic_read(&cache_ent->is_valid), 5 * HZ); + if (!ret) + return -EBUSY; ptr = cache_ent->caps_cache;
If the wait timeouts, the caps are probably invalid and we shouldn't be passing them to userspace. Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> --- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 2 ++ 1 file changed, 2 insertions(+)