V4L/DVB: mx2_camera: fix a race causing NULL dereference
The mx25_camera_irq irq handler may get called after the camera has been deactivated (from mx2_camera_deactivate). Detect this situation, and bail out. Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
1b376dac05
commit
5384a12b23
1 changed files with 4 additions and 0 deletions
|
@ -378,6 +378,9 @@ static void mx25_camera_frame_done(struct mx2_camera_dev *pcdev, int fb,
|
||||||
|
|
||||||
spin_lock_irqsave(&pcdev->lock, flags);
|
spin_lock_irqsave(&pcdev->lock, flags);
|
||||||
|
|
||||||
|
if (*fb_active == NULL)
|
||||||
|
goto out;
|
||||||
|
|
||||||
vb = &(*fb_active)->vb;
|
vb = &(*fb_active)->vb;
|
||||||
dev_dbg(pcdev->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
|
dev_dbg(pcdev->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
|
||||||
vb, vb->baddr, vb->bsize);
|
vb, vb->baddr, vb->bsize);
|
||||||
|
@ -402,6 +405,7 @@ static void mx25_camera_frame_done(struct mx2_camera_dev *pcdev, int fb,
|
||||||
|
|
||||||
*fb_active = buf;
|
*fb_active = buf;
|
||||||
|
|
||||||
|
out:
|
||||||
spin_unlock_irqrestore(&pcdev->lock, flags);
|
spin_unlock_irqrestore(&pcdev->lock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue