linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amit Nagal <helloin.amit-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Jiri Kosina <jkosina-AlSwsSmVLrQ@public.gmane.org>,
	Alan Ott <alan-yzvJWuRpmD1zbRFIqnYvSA@public.gmane.org>,
	Antonio Ospite
	<ospite-aNJ+ML1ZbiP93QAQaVx+gl6hYfS7NtTn@public.gmane.org>
Subject: Re: list not released in case of -ENODEV in hidraw_release (hidraw.c)
Date: Wed, 22 Jun 2011 17:13:36 +0530	[thread overview]
Message-ID: <BANLkTikJfc_ZNG6LudKupUULqK+pN93MLg@mail.gmail.com> (raw)
In-Reply-To: <BANLkTi=Teg9iN8osSDY9fqadZ+sA-Ng2Sw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Wed, Jun 22, 2011 at 1:28 PM, Amit Nagal <helloin.amit-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Hi ,
>
> linux kernel ver 2.6.39.1  ,  hidraw.c  , in  hidraw_release function
> , list pointer ( struct hidraw_list *list ) is not freed
> in case of -ENODEV .
>
> i think the following patch is applicable :
>
> --- a/drivers/hid/hidraw.c      2011-06-22 08:57:55.000000000 -0400
> +++ b/drivers/hid/hidraw.c      2011-06-22 08:42:04.000000000 -0400
> @@ -298,6 +298,7 @@ static int hidraw_release(struct inode *
>
>        mutex_lock(&minors_lock);
>        if (!hidraw_table[minor]) {
> +               kfree(list);
>                ret = -ENODEV;
>                goto unlock;
>        }
>
> Please correct me if i am mistaken .
>

In continuation of above , in hidraw_release(), for the sequence
disconnect  followed by last userspace close(fd) call ,
even kfree(list->hidraw) should also be called , as in
hidraw_disconnect() function kfree(hidraw) is called only when
hidraw->open is 0 .
so list->hidraw should also be freed when calling last close() call
even after disconnect .

if i have misunderstood facts , kindly clear my doubts .


Regards
Amit Nagal
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2011-06-22 11:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-22  7:58 list not released in case of -ENODEV in hidraw_release (hidraw.c) Amit Nagal
     [not found] ` <BANLkTi=Teg9iN8osSDY9fqadZ+sA-Ng2Sw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-06-22 11:43   ` Amit Nagal [this message]
2011-07-22 14:36     ` Jiri Kosina
2011-07-27  4:03       ` Amit Nagal

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=BANLkTikJfc_ZNG6LudKupUULqK+pN93MLg@mail.gmail.com \
    --to=helloin.amit-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=alan-yzvJWuRpmD1zbRFIqnYvSA@public.gmane.org \
    --cc=jkosina-AlSwsSmVLrQ@public.gmane.org \
    --cc=linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=ospite-aNJ+ML1ZbiP93QAQaVx+gl6hYfS7NtTn@public.gmane.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).