mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: iceberg <strakh@ispras.ru>
To: linux-kernel@vger.kernel.org
Subject: [PATCH]   drivers/media/video: fix lock imbalances in hdpvr-core.c
Date: Wed, 12 Aug 2009 15:08:24 +0000	[thread overview]
Message-ID: <200908121508.24619.strakh@ispras.ru> (raw)

In ./drivers/media/video/hdpvr/hdpvr-core.c in function 
device_authorization: 
        If after mutex_lock in usb_control_msg returns ret!=46 we go to 
label error. In this case before exit from function mutex must be unlocked.

Fix lock imbalances in function device_authorization.

Signed-off-by: Alexander Strakh <strakh@ispras.ru>

---
diff --git a/a/drivers/media/video/hdpvr/hdpvr-core.c 
b/b/drivers/media/video/hdpvr/hdpvr-core.c
index 188bd5a..1d03d1c 100644
--- a/a/drivers/media/video/hdpvr/hdpvr-core.c
+++ b/b/drivers/media/video/hdpvr/hdpvr-core.c
@@ -126,7 +126,7 @@ static int device_authorization(struct hdpvr_device *dev)
        char *print_buf = kzalloc(5*buf_size+1, GFP_KERNEL);
        if (!print_buf) {
                v4l2_err(&dev->v4l2_dev, "Out of memory\n");
-               goto error;
+               return retval;
        }
 #endif

@@ -188,10 +188,10 @@ static int device_authorization(struct hdpvr_device 
*dev)
                              10000);
        v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
                 "magic request returned %d\n", ret);
-       mutex_unlock(&dev->usbc_mutex);

        retval = ret != 8;
 error:
+       moutex_unlock(&dev->usbc_mutex);
        return retval;
 }




                 reply	other threads:[~2009-08-12 11:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200908121508.24619.strakh@ispras.ru \
    --to=strakh@ispras.ru \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®