Skip to content

Commit

Permalink
Merge "qcedev: check num_fds during unmap"
Browse files Browse the repository at this point in the history
  • Loading branch information
qctecmdr authored and Gerrit - the friendly Code Review server committed Nov 14, 2022
2 parents 9026bcc + 3ae07bc commit 48ca3a8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion drivers/crypto/msm/qcedev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1916,7 +1916,9 @@ long qcedev_ioctl(struct file *file,
goto exit_free_qcedev_areq;
}

if (map_buf.num_fds > QCEDEV_MAX_BUFFERS) {
if (map_buf.num_fds > ARRAY_SIZE(map_buf.fd)) {
pr_err("%s: err: num_fds = %d exceeds max value\n",
__func__, map_buf.num_fds);
err = -EINVAL;
goto exit_free_qcedev_areq;
}
Expand Down Expand Up @@ -1956,6 +1958,12 @@ long qcedev_ioctl(struct file *file,
err = -EFAULT;
goto exit_free_qcedev_areq;
}
if (unmap_buf.num_fds > ARRAY_SIZE(unmap_buf.fd)) {
pr_err("%s: err: num_fds = %d exceeds max value\n",
__func__, unmap_buf.num_fds);
err = -EINVAL;
goto exit_free_qcedev_areq;
}

for (i = 0; i < unmap_buf.num_fds; i++) {
err = qcedev_check_and_unmap_buffer(handle,
Expand Down

0 comments on commit 48ca3a8

Please sign in to comment.