]> git.baikalelectronics.ru Git - kernel.git/commit
drm/virtio: fix resource id creation race
authorJohn Bates <jbates@chromium.org>
Thu, 20 Feb 2020 22:53:19 +0000 (14:53 -0800)
committerGerd Hoffmann <kraxel@redhat.com>
Mon, 24 Feb 2020 14:45:34 +0000 (15:45 +0100)
commite922d3756e76b53e630cb26e7e121107ab7dc184
treecf8c61d6b684676f6812793271ffaa09ddee15a8
parented4b37cdf11630aeb375b258fd5f2713a5c4d2c6
drm/virtio: fix resource id creation race

The previous code was not thread safe and caused
undefined behavior from spurious duplicate resource IDs.
In this patch, an atomic_t is used instead. We no longer
see any duplicate IDs in tests with this change.

Fixes: e7197c8c74cb ("drm/virtio: do NOT reuse resource ids")
Signed-off-by: John Bates <jbates@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200220225319.45621-1-jbates@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
drivers/gpu/drm/virtio/virtgpu_object.c