All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amit Nagal <helloin.amit@gmail.com>
To: linux-input@vger.kernel.org, linux-usb@vger.kernel.org
Cc: Jiri Kosina <jkosina@suse.cz>, Alan Ott <alan@signal11.us>
Subject: Re: [PATCH] hidraw : free list for all error in hidraw_open
Date: Fri, 2 Sep 2011 12:57:58 +0530	[thread overview]
Message-ID: <CA+F9FsA=u6EtGkWO8PVfJ4voSx+=wvoFdZ_61WO6x=8WMFM0Rg@mail.gmail.com> (raw)
In-Reply-To: <CA+F9FsBqeW9PEL9F5h4Rx+-2QY=PcFXW0MVyZPJJOjUo5zGeig@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 336 bytes --]

On Fri, Sep 2, 2011 at 10:59 AM, Amit Nagal <helloin.amit@gmail.com> wrote:
> Hi ,
>
> In function hidraw_open (linux-3.0.3/drivers/hid/hidraw.c ) ,  struct
> hidraw_list *list should be freed for all error conditions .

Due to tab to space conversion by gmail , i have enclosed patch as
attachment currently .

Regards
Amit

[-- Attachment #2: [Patch]  hidraw_open free list for errors --]
[-- Type: application/octet-stream, Size: 580 bytes --]

Signed-off-by: Amit Nagal <helloin.amit@gmail.com>
---

diff -up a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
--- a/drivers/hid/hidraw.c	2011-08-17 13:57:16.000000000 -0400
+++ b/drivers/hid/hidraw.c	2011-09-02 07:06:52.000000000 -0400
@@ -259,7 +259,6 @@ static int hidraw_open(struct inode *ino
 
 	mutex_lock(&minors_lock);
 	if (!hidraw_table[minor]) {
-		kfree(list);
 		err = -ENODEV;
 		goto out_unlock;
 	}
@@ -285,6 +284,8 @@ static int hidraw_open(struct inode *ino
 out_unlock:
 	mutex_unlock(&minors_lock);
 out:
+	if (err < 0)
+		kfree(list);
 	return err;
 
 }

--

  reply	other threads:[~2011-09-02  7:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-02  5:29 [PATCH] hidraw : free list for all error in hidraw_open Amit Nagal
2011-09-02  7:27 ` Amit Nagal [this message]
     [not found]   ` <CA+F9FsA=u6EtGkWO8PVfJ4voSx+=wvoFdZ_61WO6x=8WMFM0Rg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-09-02 11:03     ` Sergei Shtylyov
2011-09-07 11:50   ` Jiri Kosina
2011-09-15 15:34 ` James Hogan

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='CA+F9FsA=u6EtGkWO8PVfJ4voSx+=wvoFdZ_61WO6x=8WMFM0Rg@mail.gmail.com' \
    --to=helloin.amit@gmail.com \
    --cc=alan@signal11.us \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-usb@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.