]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
uio_hv_generic: Align ring size to system page
authorLong Li <longli@microsoft.com>
Tue, 6 May 2025 00:56:35 +0000 (17:56 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Jul 2025 16:27:40 +0000 (18:27 +0200)
[ Upstream commit 0315fef2aff9f251ddef8a4b53db9187429c3553 ]

Following the ring header, the ring data should align to system page
boundary. Adjust the size if necessary.

Cc: stable@vger.kernel.org
Fixes: 95096f2fbd10 ("uio-hv-generic: new userspace i/o driver for VMBus")
Signed-off-by: Long Li <longli@microsoft.com>
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Link: https://lore.kernel.org/r/1746492997-4599-4-git-send-email-longli@linuxonhyperv.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Message-ID: <1746492997-4599-4-git-send-email-longli@linuxonhyperv.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/uio/uio_hv_generic.c

index 03a4ca762c49990b45633a5f372a221240304071..6625d340f3ac5d60ff2d8957eb2f8fd766e261dc 100644 (file)
@@ -260,6 +260,9 @@ hv_uio_probe(struct hv_device *dev,
        if (!ring_size)
                ring_size = HV_RING_SIZE * PAGE_SIZE;
 
+       /* Adjust ring size if necessary to have it page aligned */
+       ring_size = VMBUS_RING_SIZE(ring_size);
+
        pdata = devm_kzalloc(&dev->device, sizeof(*pdata), GFP_KERNEL);
        if (!pdata)
                return -ENOMEM;