Patch "kselftests: dmabuf-heaps: Ensure the driver name is null-terminated" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    kselftests: dmabuf-heaps: Ensure the driver name is null-terminated

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     kselftests-dmabuf-heaps-ensure-the-driver-name-is-nu.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 06dd246e73ef89178f1cfbcc1857b006e4ac1d34
Author: Zenghui Yu <yuzenghui@xxxxxxxxxx>
Date:   Mon Jul 29 10:46:04 2024 +0800

    kselftests: dmabuf-heaps: Ensure the driver name is null-terminated
    
    [ Upstream commit 291e4baf70019f17a81b7b47aeb186b27d222159 ]
    
    Even if a vgem device is configured in, we will skip the import_vgem_fd()
    test almost every time.
    
      TAP version 13
      1..11
      # Testing heap: system
      # =======================================
      # Testing allocation and importing:
      ok 1 # SKIP Could not open vgem -1
    
    The problem is that we use the DRM_IOCTL_VERSION ioctl to query the driver
    version information but leave the name field a non-null-terminated string.
    Terminate it properly to actually test against the vgem device.
    
    While at it, let's check the length of the driver name is exactly 4 bytes
    and return early otherwise (in case there is a name like "vgemfoo" that
    gets converted to "vgem\0" unexpectedly).
    
    Signed-off-by: Zenghui Yu <yuzenghui@xxxxxxxxxx>
    Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxx>
    Link: https://patchwork.freedesktop.org/patch/msgid/20240729024604.2046-1-yuzenghui@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c b/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c
index 890a8236a8ba..2809f9a25c43 100644
--- a/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c
+++ b/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c
@@ -28,9 +28,11 @@ static int check_vgem(int fd)
 	version.name = name;
 
 	ret = ioctl(fd, DRM_IOCTL_VERSION, &version);
-	if (ret)
+	if (ret || version.name_len != 4)
 		return 0;
 
+	name[4] = '\0';
+
 	return !strcmp(name, "vgem");
 }
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux