mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 09:11:26 +03:00
vsc: fix out of bound memory access
kernel panic when doing a IOCTL on UFS virtual partition with pass thru enabled. IOCTL require larger space than the mempool size (512KB) and the len check fails and leads to a out-of-bound memory access. Bug 4683333 Change-Id: Ie8d13bbed13a257e73087c9472054aa4083cf3eb Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3151274 Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com> Tested-by: Tonny Liang <tonnyl@nvidia.com> GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com> Reviewed-by: Tonny Liang <tonnyl@nvidia.com> Reviewed-by: Sanjith T D <std@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
2a104ca84d
commit
e44802987e
@@ -55,7 +55,7 @@ int vblk_prep_ioctl_req(struct vblk_dev *vblkdev,
|
||||
|
||||
if (ioctl_req->ioctl_len > vsc_req->mempool_len) {
|
||||
dev_err(vblkdev->device,
|
||||
"Ioctl length exceeding mempool length!\n");
|
||||
"Ioctl length %u exceeding mempool length!\n", ioctl_req->ioctl_len);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
||||
@@ -1144,14 +1144,15 @@ static void setup_device(struct vblk_dev *vblkdev)
|
||||
req->mempool_virt = (void *)((uintptr_t)vblkdev->shared_buffer +
|
||||
(uintptr_t)(req_id * max_io_bytes));
|
||||
req->mempool_offset = (req_id * max_io_bytes);
|
||||
req->mempool_len = max_io_bytes;
|
||||
} else {
|
||||
if (vblkdev->config.blk_config.req_ops_supported & VS_BLK_IOCTL_OP_F) {
|
||||
req->mempool_virt = (void *)((uintptr_t)vblkdev->shared_buffer +
|
||||
(uintptr_t)((req_id % max_ioctl_requests) * UFS_IOCTL_MAX_SIZE_SUPPORTED));
|
||||
req->mempool_offset = (req_id % max_ioctl_requests) * UFS_IOCTL_MAX_SIZE_SUPPORTED;
|
||||
req->mempool_len = UFS_IOCTL_MAX_SIZE_SUPPORTED;
|
||||
}
|
||||
}
|
||||
req->mempool_len = max_io_bytes;
|
||||
req->id = req_id;
|
||||
req->vblkdev = vblkdev;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user