]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
fixes for 4.9
authorSasha Levin <sashal@kernel.org>
Tue, 15 Oct 2019 05:17:54 +0000 (01:17 -0400)
committerSasha Levin <sashal@kernel.org>
Tue, 15 Oct 2019 05:17:54 +0000 (01:17 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.9/series
queue-4.9/staging-fbtft-fix-memory-leak-in-fbtft_framebuffer_a.patch [new file with mode: 0644]
queue-4.9/staging-fbtft-stop-using-bl_core_driver1.patch [new file with mode: 0644]

index 6ce1541831488c0eef9602040bde59e2ce45821d..8caed54b1a2cb86a8d419c1c418e36b2e8553e64 100644 (file)
@@ -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 (file)
index 0000000..ab75eba
--- /dev/null
@@ -0,0 +1,60 @@
+From d5c454af83f8964d2c62d2e4d37755670a70fa4d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 29 Sep 2019 22:09:45 -0500
+Subject: Staging: fbtft: fix memory leak in fbtft_framebuffer_alloc
+
+From: Navid Emamdoost <navid.emamdoost@gmail.com>
+
+[ 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 <navid.emamdoost@gmail.com>
+Reviewed-by: Dan Carpenter <dan.carpenter@gmail.com>
+Cc: stable <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20190930030949.28615-1-navid.emamdoost@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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 (file)
index 0000000..97dfd3c
--- /dev/null
@@ -0,0 +1,62 @@
+From 9b1a18bef446d27335cedf5c1fe99442f752ff3c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 25 Apr 2018 19:42:51 +0200
+Subject: staging: fbtft: Stop using BL_CORE_DRIVER1
+
+From: Daniel Vetter <daniel.vetter@ffwll.ch>
+
+[ 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 <daniel.vetter@intel.com>
+Acked-by: Daniel Thompson <daniel.thompson@linaro.org>
+Reviewed-by: Jani Nikula <jani.nikula@intel.com>
+Signed-off-by: Lee Jones <lee.jones@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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
+