From patchwork Wed Jul 29 23:43:05 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trent Piepho X-Patchwork-Id: 1426 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Wed, 29 Jul 2009 23:43:11 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra.chehab.org with IMAP (fetchmail-6.3.6) for (single-drop); Wed, 29 Jul 2009 20:48:16 -0300 (BRT) Received: from vger.kernel.org ([209.132.176.167]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1MWIne-0001ut-U1; Wed, 29 Jul 2009 23:43:11 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753321AbZG2XnH (ORCPT + 1 other); Wed, 29 Jul 2009 19:43:07 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754826AbZG2XnH (ORCPT ); Wed, 29 Jul 2009 19:43:07 -0400 Received: from mail8.sea5.speakeasy.net ([69.17.117.10]:35957 "EHLO mail8.sea5.speakeasy.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753321AbZG2XnG (ORCPT ); Wed, 29 Jul 2009 19:43:06 -0400 Received: (qmail 27017 invoked from network); 29 Jul 2009 23:43:05 -0000 Received: from shell2.sea5.speakeasy.net ([69.17.116.3]) (envelope-sender ) by mail8.sea5.speakeasy.net (qmail-ldap-1.03) with AES256-SHA encrypted SMTP for ; 29 Jul 2009 23:43:05 -0000 Date: Wed, 29 Jul 2009 16:43:05 -0700 (PDT) From: Trent Piepho X-X-Sender: xyzzy@shell2.speakeasy.net To: Dan Carpenter cc: mchehab@infradead.org, linux-media@vger.kernel.org Subject: Re: double unlock in bttv_poll() and in saa7134-video.c In-Reply-To: Message-ID: References: MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org On Sat, 25 Jul 2009, Dan Carpenter wrote: > My source code checker, smatch (http://repo.or.cz/w/smatch.git), > complains about a double unlock in bttv_poll() from > drivers/media/video/bt8xx/bttv-driver.c. It unlocks on line 3190 and > again on 3201. How about this: http://linuxtv.org/hg/~tap/bttv?cmd=changeset;node=35ddb77b68f8 --- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff -r fd96af63f79b -r 35ddb77b68f8 linux/drivers/media/video/bt8xx/bttv-driver.c --- a/linux/drivers/media/video/bt8xx/bttv-driver.c Fri Jun 19 19:56:56 2009 +0000 +++ b/linux/drivers/media/video/bt8xx/bttv-driver.c Wed Jul 29 16:33:45 2009 -0700 @@ -3191,15 +3191,14 @@ static unsigned int bttv_poll(struct fil return videobuf_poll_stream(file, &fh->vbi, wait); } + mutex_lock(&fh->cap.vb_lock); if (check_btres(fh,RESOURCE_VIDEO_STREAM)) { - mutex_lock(&fh->cap.vb_lock); /* streaming capture */ if (list_empty(&fh->cap.stream)) goto err; buf = list_entry(fh->cap.stream.next,struct bttv_buffer,vb.stream); } else { /* read() capture */ - mutex_lock(&fh->cap.vb_lock); if (NULL == fh->cap.read_buf) { /* need to capture a new frame */ if (locked_btres(fh->btv,RESOURCE_VIDEO_STREAM)) @@ -3217,7 +3216,6 @@ static unsigned int bttv_poll(struct fil fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf); fh->cap.read_off = 0; } - mutex_unlock(&fh->cap.vb_lock); buf = (struct bttv_buffer*)fh->cap.read_buf; }