• Andrzej Pietrasiewicz's avatar
    [media] s5p-jpeg: Eliminate double kfree() · 7a1d4e7c
    Andrzej Pietrasiewicz authored
    video_unregister_device() calls device_unregister(), which calls
    put_device(), which calls kobject_put(), and if this is the last reference
    then kobject_release() is called, which calls kobject_cleanup(), which
    calls ktype's release method which happens to be device_release() in this
    case, which calls dev->release(), which happens to be
    v4l2_device_release() in this case, which calls vdev->release(), which
    happens to be video_device_release(). But video_device_release() is
    called explicitly both in error recovery path of s5p_jpeg_probe() and
    in s5p_jpeg_remove(). The pointers in question are not nullified between
    the two calls, so this is harmful.
    
    This patch fixes the driver so that video_device_release() is not called
    twice for the same object.
    Signed-off-by: default avatarAndrzej Pietrasiewicz <andrzej.p@samsung.com>
    Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
    7a1d4e7c
jpeg-core.c 73.4 KB