-
Notifications
You must be signed in to change notification settings - Fork 549
Closed
Description
Dear developers:
First, thank you for your checking. In the method, bktr_start(struct context *cnt), the lock &bktr_mutex may not be released correctly if the branch conditionioctl(dev->fd_device, METEORCAPTUR, &dummy) < 0satisfies. Specifically, the lock is always released in the other place where the method returns except this.
The fix is to insert the pthread_mutex_unlock(&bktr_mutex); before returning.
Line 849 in 34091a7
| pthread_mutex_lock(&bktr_mutex); |
Line 879 in 34091a7
| if (ioctl(dev->fd_device, METEORCAPTUR, &dummy) < 0) { |
int bktr_start(struct context *cnt)
{
...;
pthread_mutex_lock(&bktr_mutex); // the lock
...;
while (dev) {
if (mystreq(conf->video_device, dev->video_device)) {
int dummy = METEOR_CAP_STOP_CONT;
dev->usage_count++;
if (ioctl(dev->fd_device, METEORCAPTUR, &dummy) < 0) {
MOTION_LOG(CRT, TYPE_VIDEO, SHOW_ERRNO,_("Stopping capture"));
return -1; //return without releasing the lock
}
MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO
,_("Reusing [%s] inputs [%d,%d] Change capture"
" method METEOR_CAP_SINGLE")
, dev->video_device, dev->input, cnt->param_input);
dev->bktr_method = METEOR_CAP_SINGLE;
MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO
,_("VIDEO_PALETTE_YUV420P setting"
" imgs.size_norm and imgs.motionsize"));
cnt->imgs.motionsize = width * height;
cnt->imgs.size_norm = (width * height * 3) / 2;
pthread_mutex_unlock(&bktr_mutex);
return dev->fd_device; // FIXME return bktr_fdtuner ?!
}
dev = dev->next;
}
...;
}
Best,
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels