linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.de>
To: James Woodcock <James.Woodcock@aculab.com>
Cc: linux-input@vger.kernel.org
Subject: Re: Memory leak in drivers/hid/hidraw.c
Date: Wed, 25 Apr 2012 14:59:25 +0200	[thread overview]
Message-ID: <201204251459.25180.oneukum@suse.de> (raw)
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F602BB6E1D@saturn3.aculab.com>

Am Mittwoch, 25. April 2012, 11:56:57 schrieb James Woodcock:
> Hi,
> 
> I have got a USB HID device which I am talking to with ioctls
> HIDIOCSFEATURE and HIDIOCGFEATURE on Linux 3.3.3, and I think I have
> discovered a memory leak.
> 
> When I call ioctl(fd, HIDIOCGFEATURE...), a long series of things
> happens in the kernel that eventually causes hidraw_report_event() to be
> called to let the user space program know there is data to be retrieved
> by read().  hidraw_report_event() calls kmemdup() to create a copy of
> the data to be returned.  However, I'm never going to call read()
> because
> the data is returned by the ioctl() call.
> 
> So, I think that the main bug I have spotted is that if the user calls
> ioctl(fd, HIODCGFEATURE...), hidraw_report_event() should not be called.
> I'm not really familiar with the code, so I'm not sure what the best fix
> would be.

Please post the full call chain you see.

	Regards
		Oliver

  reply	other threads:[~2012-04-25 13:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-25  9:56 Memory leak in drivers/hid/hidraw.c James Woodcock
2012-04-25 12:59 ` Oliver Neukum [this message]
2012-04-25 14:06   ` James Woodcock

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=201204251459.25180.oneukum@suse.de \
    --to=oneukum@suse.de \
    --cc=James.Woodcock@aculab.com \
    --cc=linux-input@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).