diff --git a/drivers/crypto/msm/qcedev.c b/drivers/crypto/msm/qcedev.c index 9c9d911b4cc7..aeb644f5ca16 100644 --- a/drivers/crypto/msm/qcedev.c +++ b/drivers/crypto/msm/qcedev.c @@ -1915,6 +1915,11 @@ static inline long qcedev_ioctl(struct file *file, goto exit_free_qcedev_areq; } + if (map_buf.num_fds > QCEDEV_MAX_BUFFERS) { + err = -EINVAL; + goto exit_free_qcedev_areq; + } + for (i = 0; i < map_buf.num_fds; i++) { err = qcedev_check_and_map_buffer(handle, map_buf.fd[i],