vsc: use max supported ioctl size

target is getting crash while triggering multiple
ioctl call from userpsace due to miscalculation
of mempool_virt and mempool_offset for each slot.
So use max supported ioctl size macro instead of
max supported read and write operation size.

Bug 4336445

Change-Id: I438ff50cb0dfba845f4d7852e74314c66dab196c
Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3001185
Reviewed-by: Kasinadha Dendukuri <kdendukuri@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
Tested-by: Tonny Liang <tonnyl@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Manish Bhardwaj
2023-10-20 06:17:44 +00:00
committed by mobile promotions
parent b8fca78022
commit e8c5cb610a

View File

@@ -1145,8 +1145,8 @@ static void setup_device(struct vblk_dev *vblkdev)
} else { } else {
if (vblkdev->config.blk_config.req_ops_supported & VS_BLK_IOCTL_OP_F) { if (vblkdev->config.blk_config.req_ops_supported & VS_BLK_IOCTL_OP_F) {
req->mempool_virt = (void *)((uintptr_t)vblkdev->shared_buffer + req->mempool_virt = (void *)((uintptr_t)vblkdev->shared_buffer +
(uintptr_t)((req_id % max_ioctl_requests) * max_io_bytes)); (uintptr_t)((req_id % max_ioctl_requests) * UFS_IOCTL_MAX_SIZE_SUPPORTED));
req->mempool_offset = (req_id % max_ioctl_requests) * max_io_bytes; req->mempool_offset = (req_id % max_ioctl_requests) * UFS_IOCTL_MAX_SIZE_SUPPORTED;
} }
} }
req->mempool_len = max_io_bytes; req->mempool_len = max_io_bytes;