kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Arend van Spriel" <arend@broadcom.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Julia Lawall <julia@diku.dk>, Jiri Kosina <jkosina@suse.cz>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>,
	"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/5] drivers/hid/hid-roccat.c: eliminate a null
Date: Sat, 29 Oct 2011 09:36:55 +0000	[thread overview]
Message-ID: <4EABC937.60600@broadcom.com> (raw)
In-Reply-To: <20111029062412.GG14881@longonot.mountain>

On 10/29/2011 08:24 AM, Dan Carpenter wrote:
> On Sat, Oct 29, 2011 at 01:58:15AM +0200, Julia Lawall wrote:
>> diff --git a/drivers/hid/hid-roccat.c b/drivers/hid/hid-roccat.c
>> index 2596321..36a28b8 100644
>> --- a/drivers/hid/hid-roccat.c
>> +++ b/drivers/hid/hid-roccat.c
>> @@ -163,14 +163,15 @@ static int roccat_open(struct inode *inode, struct file *file)
>>  
>>  	device = devices[minor];
>>  
>> -	mutex_lock(&device->readers_lock);
>> -
>>  	if (!device) {
>>  		pr_emerg("roccat device with minor %d doesn't exist\n", minor);
>> -		error = -ENODEV;
>> -		goto exit_err;
>> +		kfree(reader);
>> +		mutex_lock(&devices_lock);
> 
> Typo.  mutex_unlock() instead of mutex_lock().

This is no typo, but simply wrong. Remove the mutex_lock() as we are
leaving the function here in error flow.

>> +		return -ENODEV;
>>  	}
>>  
>> +	mutex_lock(&device->readers_lock);
>> +
>>  	if (!device->open++) {
>>  		/* power on device on adding first reader */
>>  		error = hid_hw_power(device->hid, PM_HINT_FULLON);
>>
> 
> regards,
> dan carpenter

Gr. AvS


  reply	other threads:[~2011-10-29  9:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-28 23:58 [PATCH 3/5] drivers/hid/hid-roccat.c: eliminate a null pointer dereference Julia Lawall
2011-10-29  6:24 ` [PATCH 3/5] drivers/hid/hid-roccat.c: eliminate a null pointer Dan Carpenter
2011-10-29  9:36   ` Arend van Spriel [this message]
2011-10-29 10:53     ` [PATCH 3/5] drivers/hid/hid-roccat.c: eliminate a null pointer dereference David Herrmann
2011-10-29 12:11       ` [PATCH 3/5 v2] drivers/hid/hid-roccat.c: eliminate a null pointer Julia Lawall
2011-10-29 17:00         ` Jiri Kosina
2011-10-29 18:18           ` Julia Lawall
2011-10-29 18:45           ` [PATCH 3/5 v3] " Julia Lawall
2011-11-01 14:14             ` Jiri Kosina
2011-10-31  9:22       ` [PATCH 3/5] drivers/hid/hid-roccat.c: eliminate a null Arend van Spriel

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=4EABC937.60600@broadcom.com \
    --to=arend@broadcom.com \
    --cc=dan.carpenter@oracle.com \
    --cc=jkosina@suse.cz \
    --cc=julia@diku.dk \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).