Merge "FROMGIT: media: venus: hfi: add check to handle incorrect queue size" into kernel.lnx.5.4.r9-rel

This commit is contained in:
Linux Build Service Account 2025-03-17 03:08:52 -07:00 • committed by Gerrit - the friendly Code Review server
commit ee6d41445d

View file

@ -188,6 +188,9 @@ static int venus_write_queue(struct venus_hfi_device *hdev,
/* ensure rd/wr indices's are read from memory */
rmb();
if (qsize > IFACEQ_QUEUE_SIZE / 4)
return -EINVAL;
if (wr_idx >= rd_idx)
empty_space = qsize - (wr_idx - rd_idx);
else
@ -256,6 +259,9 @@ static int venus_read_queue(struct venus_hfi_device *hdev,
wr_idx = qhdr->write_idx;
qsize = qhdr->q_size;
if (qsize > IFACEQ_QUEUE_SIZE / 4)
return -EINVAL;
/* make sure data is valid before using it */
rmb();