[openwrt/openwrt] gpio-button-hotplug: fix data race

LEDE Commits lede-commits at lists.infradead.org
Sat Apr 9 10:40:35 PDT 2022


hauke pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/1e991e09b73c309321d21b9cb706bd5139d952d2

commit 1e991e09b73c309321d21b9cb706bd5139d952d2
Author: Andrey Erokhin <a.erokhin at inango-systems.com>
AuthorDate: Wed Apr 6 12:36:15 2022 +0300

    gpio-button-hotplug: fix data race
    
    bh_event_add_var can be called by multiple threads concurrently,
    so it shall not use a static char buffer
    
    Signed-off-by: Andrey Erokhin <a.erokhin at inango-systems.com>
---
 package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
index fcaf7f59de..2b39ec8f3b 100644
--- a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
+++ b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
@@ -107,7 +107,7 @@ static struct bh_map button_map[] = {
 static __printf(3, 4)
 int bh_event_add_var(struct bh_event *event, int argv, const char *format, ...)
 {
-	static char buf[128];
+	char buf[128];
 	char *s;
 	va_list args;
 	int len;




More information about the lede-commits mailing list