video_processor: fix panic while make strict safety test [1/1]

PD#SWPL-123626

Problem:
while make strict safety test,v4lvideo and ionvideo
module will panic.

Solution:
modify v4lvideo and ionvideo module code,make it safe.

Verify:
T982_AR301

Change-Id: I491f6b8ca1f2047e86bd02e87578d4683df1d415
Signed-off-by: chen.xu <chen.xu@amlogic.com>
This commit is contained in:
chen.xu
2023-05-12 13:45:25 +08:00
committed by gerrit autosubmit
parent 97f9c7a57f
commit a8317f38b8
3 changed files with 21 additions and 4 deletions
@@ -482,7 +482,7 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
dprintk(dev, 2, "%s\n", __func__);
/* shutdown control thread */
if (dma_q->kthread) {
if (!IS_ERR(dma_q->kthread)) {
kthread_stop(dma_q->kthread);
dma_q->kthread = NULL;
}
@@ -752,6 +752,11 @@ static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *p)
return 0;
}
static int vidioc_mmap(struct file *file, struct vm_area_struct *vma)
{
return 0;
}
static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p)
{
struct ionvideo_dev *dev = video_drvdata(file);
@@ -788,7 +793,7 @@ static const struct v4l2_file_operations ionvideo_v4l2_fops = {
.read = vidioc_read,
.poll = vidioc_poll,
.unlocked_ioctl = video_ioctl2,/* V4L2 ioctl handler */
.mmap = vb2_fop_mmap,
.mmap = vidioc_mmap,
};
static const struct v4l2_ioctl_ops ionvideo_ioctl_ops = {
@@ -1760,6 +1760,11 @@ static unsigned int v4lvideo_poll(struct file *file,
}
}
static int vidioc_mmap(struct file *file, struct vm_area_struct *vma)
{
return 0;
}
static int vidioc_querycap(struct file *file,
void *priv,
struct v4l2_capability *cap)
@@ -1951,6 +1956,11 @@ static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *p)
struct v4lvideo_file_s *v4lvideo_file;
u32 inst_id = dev->inst;
if (p->index >= V4LVIDEO_POOL_SIZE) {
pr_err("ionvideo: dbuf: err index=%d\n", p->index);
return -EINVAL;
}
dev->v4lvideo_input[p->index] = *p;
q_count[inst_id]++;
@@ -2309,7 +2319,7 @@ static const struct v4l2_file_operations v4lvideo_v4l2_fops = {
.read = vidioc_read,
.poll = v4lvideo_poll,
.unlocked_ioctl = video_ioctl2,/* V4L2 ioctl handler */
.mmap = vb2_fop_mmap,
.mmap = vidioc_mmap,
};
static const struct v4l2_ioctl_ops v4lvideo_ioctl_ops = {
@@ -5635,8 +5635,10 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE || i != fh->type)
return -EINVAL;
ret = videobuf_streamoff(&fh->vb_vidq);
if (ret < 0)
if (ret < 0) {
pr_err("videobuf stream off failed\n");
return 0;
}
if (amlvideo2_dbg_en) {
pr_info("%s , %d\n", __func__, __LINE__);
pr_info("start_vdin_flag = %d\n", node->start_vdin_flag);