kernel-fxtec-pro1x/drivers/media
Anatolij Gustschin 1bb6419433 V4L/DVB: v4l2-dev: fix memory leak
Since commit b402843787
the 'driver_data' field resides in device's struct device_private
which may be allocated by dev_set_drvdata() if device_private
struct was not allocated previously.

dev_set_drvdata() is used in video_set_drvdata() to set
the driver's private data pointer in v4l2 drivers. Setting
the private data _before_ registering the v4l2 device results
in a memory leak since __video_register_device() also calls
video_set_drvdata(), but after zeroing the device structure.
Thus, the reference to the previously allocated device_private
struct goes lost and a new device_private will be allocated.

All v4l drivers which call video_set_drvdata() _before_
calling video_register_device() are affected. The patch fixes
__video_register_device() to preserve previously allocated
device_private reference.

Caught by kmemleak.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02 15:36:02 -03:00
..
common V4L/DVB: xc5000: Fix a few warnings 2010-08-02 15:31:59 -03:00
dvb V4L/DVB: dvb_frontend: fix typos in comments and one function 2010-08-02 15:35:51 -03:00
IR V4L/DVB: IR/mceusb: unify and simplify different gen device init 2010-08-02 15:34:49 -03:00
radio V4L/DVB: media/radio: fix copy_to_user to user handling 2010-08-02 15:28:51 -03:00
video V4L/DVB: v4l2-dev: fix memory leak 2010-08-02 15:36:02 -03:00
Kconfig V4L/DVB (13612): IR: Move common IR code to drivers/media/IR 2009-12-16 00:18:42 -02:00
Makefile V4L/DVB (13612): IR: Move common IR code to drivers/media/IR 2009-12-16 00:18:42 -02:00