video: fbdev: udlfb: Fix use after free on dlfb_usb_probe error path

If dlfb_usb_probe drops to error path then there is only one
kref_init() call and no kref_get(), so second kref_put() leads to
use after free.

The patch removes superfluous kref_put on dlfb_usb_probe error path.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru>
Cc: Bernie Thompson <bernie@plugable.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
This commit is contained in:
Anton Vasilyev 2017-08-21 16:49:58 +02:00 committed by Bartlomiej Zolnierkiewicz
parent 8bf25eadb3
commit 7af9a52e33
1 changed files with 0 additions and 1 deletions

View File

@ -1655,7 +1655,6 @@ static int dlfb_usb_probe(struct usb_interface *interface,
error: error:
if (dev) { if (dev) {
kref_put(&dev->kref, dlfb_free); /* ref for framebuffer */
kref_put(&dev->kref, dlfb_free); /* last ref from kref_init */ kref_put(&dev->kref, dlfb_free); /* last ref from kref_init */
/* dev has been deallocated. Do not dereference */ /* dev has been deallocated. Do not dereference */