V4L/DVB: drivers/media/radio/si470x/radio-si470x-usb.c fix use after free
authorDarren Jenkins <darrenrjenkins@gmail.com>
Thu, 11 Feb 2010 11:07:53 +0000 (08:07 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 26 Feb 2010 18:10:58 +0000 (15:10 -0300)
In si470x_usb_driver_disconnect() radio->disconnect_lock is accessed
after it is freed. This fixes the problem.

Coverity CID: 2530

Signed-off-by: Darren Jenkins <darrenrjenkins@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/radio/si470x/radio-si470x-usb.c

index a0a79c70dd5b4fb97281ee304e5e3bb07b08c0ee..6f60841828dace59eda8b836475dc70a9b35e6c7 100644 (file)
@@ -842,9 +842,11 @@ static void si470x_usb_driver_disconnect(struct usb_interface *intf)
                kfree(radio->int_in_buffer);
                video_unregister_device(radio->videodev);
                kfree(radio->buffer);
+               mutex_unlock(&radio->disconnect_lock);
                kfree(radio);
+       } else {
+               mutex_unlock(&radio->disconnect_lock);
        }
-       mutex_unlock(&radio->disconnect_lock);
 }