]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
udmabuf: fix a buf size overflow issue during udmabuf creation
authorXiaogang Chen <xiaogang.chen@amd.com>
Thu, 30 Oct 2025 16:08:32 +0000 (11:08 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 2 Nov 2025 13:15:23 +0000 (22:15 +0900)
[ Upstream commit 021ba7f1babd029e714d13a6bf2571b08af96d0f ]

by casting size_limit_mb to u64  when calculate pglimit.

Signed-off-by: Xiaogang Chen<Xiaogang.Chen@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250321164126.329638-1-xiaogang.chen@amd.com
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Amelia Crate <acrate@waldn.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/dma-buf/udmabuf.c

index 0e127a9109e75258d4b45ebbb011c934cd5a1ee2..2e5c30f7ba0f4a26681ef6d55e76420f437a4dd6 100644 (file)
@@ -350,7 +350,7 @@ static long udmabuf_create(struct miscdevice *device,
                return -ENOMEM;
 
        INIT_LIST_HEAD(&ubuf->unpin_list);
-       pglimit = (size_limit_mb * 1024 * 1024) >> PAGE_SHIFT;
+       pglimit = ((u64)size_limit_mb * 1024 * 1024) >> PAGE_SHIFT;
        for (i = 0; i < head->count; i++) {
                if (!PAGE_ALIGNED(list[i].offset))
                        goto err;