From: Sasha Levin Date: Tue, 15 Oct 2019 05:17:54 +0000 (-0400) Subject: fixes for 4.9 X-Git-Tag: v4.4.197~27 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=45aaca6aa4a47ee793409ea2f7ebc3081e0be9fc;p=thirdparty%2Fkernel%2Fstable-queue.git fixes for 4.9 Signed-off-by: Sasha Levin --- diff --git a/queue-4.9/series b/queue-4.9/series index 6ce15418314..8caed54b1a2 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -81,3 +81,5 @@ cifs-gracefully-handle-queryinfo-errors-during-open.patch cifs-force-revalidate-inode-when-dentry-is-stale.patch cifs-force-reval-dentry-if-lookup_reval-flag-is-set.patch kernel-sysctl.c-do-not-override-max_threads-provided-by-userspace.patch +staging-fbtft-stop-using-bl_core_driver1.patch +staging-fbtft-fix-memory-leak-in-fbtft_framebuffer_a.patch diff --git a/queue-4.9/staging-fbtft-fix-memory-leak-in-fbtft_framebuffer_a.patch b/queue-4.9/staging-fbtft-fix-memory-leak-in-fbtft_framebuffer_a.patch new file mode 100644 index 00000000000..ab75eba0ee0 --- /dev/null +++ b/queue-4.9/staging-fbtft-fix-memory-leak-in-fbtft_framebuffer_a.patch @@ -0,0 +1,60 @@ +From d5c454af83f8964d2c62d2e4d37755670a70fa4d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 29 Sep 2019 22:09:45 -0500 +Subject: Staging: fbtft: fix memory leak in fbtft_framebuffer_alloc + +From: Navid Emamdoost + +[ Upstream commit 5bdea6060618cfcf1459dca137e89aee038ac8b9 ] + +In fbtft_framebuffer_alloc the error handling path should take care of +releasing frame buffer after it is allocated via framebuffer_alloc, too. +Therefore, in two failure cases the goto destination is changed to +address this issue. + +Fixes: c296d5f9957c ("staging: fbtft: core support") +Signed-off-by: Navid Emamdoost +Reviewed-by: Dan Carpenter +Cc: stable +Link: https://lore.kernel.org/r/20190930030949.28615-1-navid.emamdoost@gmail.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/staging/fbtft/fbtft-core.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c +index f4682ba44cd74..d9ba8c0f1353b 100644 +--- a/drivers/staging/fbtft/fbtft-core.c ++++ b/drivers/staging/fbtft/fbtft-core.c +@@ -814,7 +814,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, + if (par->gamma.curves && gamma) { + if (fbtft_gamma_parse_str(par, + par->gamma.curves, gamma, strlen(gamma))) +- goto alloc_fail; ++ goto release_framebuf; + } + + /* Transmit buffer */ +@@ -839,7 +839,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, + txbuf = devm_kzalloc(par->info->device, txbuflen, GFP_KERNEL); + } + if (!txbuf) +- goto alloc_fail; ++ goto release_framebuf; + par->txbuf.buf = txbuf; + par->txbuf.len = txbuflen; + } +@@ -875,6 +875,9 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, + + return info; + ++release_framebuf: ++ framebuffer_release(info); ++ + alloc_fail: + vfree(vmem); + +-- +2.20.1 + diff --git a/queue-4.9/staging-fbtft-stop-using-bl_core_driver1.patch b/queue-4.9/staging-fbtft-stop-using-bl_core_driver1.patch new file mode 100644 index 00000000000..97dfd3cee7d --- /dev/null +++ b/queue-4.9/staging-fbtft-stop-using-bl_core_driver1.patch @@ -0,0 +1,62 @@ +From 9b1a18bef446d27335cedf5c1fe99442f752ff3c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 25 Apr 2018 19:42:51 +0200 +Subject: staging: fbtft: Stop using BL_CORE_DRIVER1 + +From: Daniel Vetter + +[ Upstream commit 9adfe5c89be497bb8761a9f788297c258d535334 ] + +Leaking driver internal tracking into the already massively confusing +backlight power tracking is really confusing. + +Luckily we have already a drvdata structure, so fixing this is really +easy. + +Signed-off-by: Daniel Vetter +Acked-by: Daniel Thompson +Reviewed-by: Jani Nikula +Signed-off-by: Lee Jones +Signed-off-by: Sasha Levin +--- + drivers/staging/fbtft/fbtft-core.c | 4 ++-- + drivers/staging/fbtft/fbtft.h | 1 + + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c +index 587f68aa466c2..f4682ba44cd74 100644 +--- a/drivers/staging/fbtft/fbtft-core.c ++++ b/drivers/staging/fbtft/fbtft-core.c +@@ -247,7 +247,7 @@ static int fbtft_request_gpios_dt(struct fbtft_par *par) + static int fbtft_backlight_update_status(struct backlight_device *bd) + { + struct fbtft_par *par = bl_get_data(bd); +- bool polarity = !!(bd->props.state & BL_CORE_DRIVER1); ++ bool polarity = par->polarity; + + fbtft_par_dbg(DEBUG_BACKLIGHT, par, + "%s: polarity=%d, power=%d, fb_blank=%d\n", +@@ -296,7 +296,7 @@ void fbtft_register_backlight(struct fbtft_par *par) + /* Assume backlight is off, get polarity from current state of pin */ + bl_props.power = FB_BLANK_POWERDOWN; + if (!gpio_get_value(par->gpio.led[0])) +- bl_props.state |= BL_CORE_DRIVER1; ++ par->polarity = true; + + bd = backlight_device_register(dev_driver_string(par->info->device), + par->info->device, par, &fbtft_bl_ops, &bl_props); +diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h +index 89c4b5b76ce69..0275319906748 100644 +--- a/drivers/staging/fbtft/fbtft.h ++++ b/drivers/staging/fbtft/fbtft.h +@@ -241,6 +241,7 @@ struct fbtft_par { + ktime_t update_time; + bool bgr; + void *extra; ++ bool polarity; + }; + + #define NUMARGS(...) (sizeof((int[]){__VA_ARGS__})/sizeof(int)) +-- +2.20.1 +