From: Anton Vasilyev Date: Mon, 21 Aug 2017 14:49:58 +0000 (+0200) Subject: video: fbdev: udlfb: Fix use after free on dlfb_usb_probe error path X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7af9a52e33ea07937fc216104e2cf3d4e690b43f;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Cc: Bernie Thompson Signed-off-by: Bartlomiej Zolnierkiewicz --- diff --git a/drivers/video/fbdev/udlfb.c b/drivers/video/fbdev/udlfb.c index d0d29743dae2..ef08a104fb42 100644 --- a/drivers/video/fbdev/udlfb.c +++ b/drivers/video/fbdev/udlfb.c @@ -1655,7 +1655,6 @@ static int dlfb_usb_probe(struct usb_interface *interface, error: if (dev) { - kref_put(&dev->kref, dlfb_free); /* ref for framebuffer */ kref_put(&dev->kref, dlfb_free); /* last ref from kref_init */ /* dev has been deallocated. Do not dereference */