linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] samples/sockmap: Make signal handling safer
@ 2017-11-09 14:15 SF Markus Elfring
  0 siblings, 0 replies; only message in thread
From: SF Markus Elfring @ 2017-11-09 14:15 UTC (permalink / raw)
  To: kernel-janitors, Alexei Starovoitov, David S. Miller, John Fastabend; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 9 Nov 2017 15:06:16 +0100

Use the data type "sig_atomic_t" for the variable "running"
so that it can be safely modified by a signal handler.

Fixes: 69e8cc134bcbf0ccfcf852c400b8e6788d1d0038 ("bpf: sockmap sample program")
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 samples/sockmap/sockmap_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/samples/sockmap/sockmap_user.c b/samples/sockmap/sockmap_user.c
index 7cc9d228216f..6e3ebbb1f8f4 100644
--- a/samples/sockmap/sockmap_user.c
+++ b/samples/sockmap/sockmap_user.c
@@ -39,7 +39,7 @@
 #include "../bpf/bpf_util.h"
 #include "../bpf/libbpf.h"
 
-int running;
+static sig_atomic_t running;
 void running_handler(int a);
 
 /* randomly selected ports for testing on lo */
-- 
2.15.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-11-09 14:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-09 14:15 [PATCH] samples/sockmap: Make signal handling safer SF Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).