driver inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/IB9H0P CVE: NA
----------------------------------------------------------------------
Since the resources of uacce_queue cannot be ensured to be fully released before calling put_queue, directly putting the queue might pose a slight risk.
However, the release interface can guarantee that the resources have already been released. Therefore, putting the queue through the release interface is a reliable action.
Signed-off-by: Yang Shen shenyang39@huawei.com Signed-off-by: JiangShui Yang yangjiangshui@h-partners.com --- drivers/misc/uacce/uacce.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/misc/uacce/uacce.c b/drivers/misc/uacce/uacce.c index 34ba926c1d56..26df666a6529 100644 --- a/drivers/misc/uacce/uacce.c +++ b/drivers/misc/uacce/uacce.c @@ -47,22 +47,28 @@ static int uacce_start_queue(struct uacce_queue *q) return 0; }
-static int uacce_put_queue(struct uacce_queue *q) +static int uacce_stop_queue(struct uacce_queue *q) { struct uacce_device *uacce = q->uacce;
if ((q->state == UACCE_Q_STARTED) && uacce->ops->stop_queue) uacce->ops->stop_queue(q);
- if ((q->state == UACCE_Q_INIT || q->state == UACCE_Q_STARTED) && - uacce->ops->put_queue) - uacce->ops->put_queue(q); - q->state = UACCE_Q_ZOMBIE;
return 0; }
+static void uacce_put_queue(struct uacce_queue *q) +{ + struct uacce_device *uacce = q->uacce; + + uacce_stop_queue(q); + + if (uacce->ops->put_queue) + uacce->ops->put_queue(q); +} + static long uacce_cmd_share_qfr(struct uacce_queue *src, int fd) { struct device *dev = &src->uacce->dev; @@ -222,7 +228,7 @@ static long uacce_fops_unl_ioctl(struct file *filep, ret = uacce_start_queue(q); break; case UACCE_CMD_PUT_Q: - ret = uacce_put_queue(q); + ret = uacce_stop_queue(q); break; case UACCE_CMD_SHARE_SVAS: ret = uacce_cmd_share_qfr(q, (int)arg);