/* * sysctl - sysctl set/get helpers * Subject to the GPL, version 2. */ #include #include #include #include #include #include #include "built_in.h" #include "sysctl.h" int sysctl_set_int(const char *file, int value) { char path[PATH_MAX]; char str[64]; ssize_t ret; int fd; strncpy(path, SYSCTL_PROC_PATH, PATH_MAX); strncat(path, file, PATH_MAX - sizeof(SYSCTL_PROC_PATH) - 1); fd = open(path, O_WRONLY); if (unlikely(fd < 0)) return -1; ret = snprintf(str, 63, "%d", value); if (ret < 0) { close(fd); return -1; } ret = write(fd, str, strlen(str)); close(fd); return ret <= 0 ? -1 : 0; } int sysctl_get_int(const char *file, int *value) { char path[PATH_MAX]; char str[64]; ssize_t ret; int fd; strncpy(path, SYSCTL_PROC_PATH, PATH_MAX); strncat(path, file, PATH_MAX - sizeof(SYSCTL_PROC_PATH) - 1); fd = open(path, O_RDONLY); if (fd < 0) return -1; ret = read(fd, str, sizeof(str)); if (ret > 0) { *value = atoi(str); ret = 0; } else { ret = -1; } close(fd); return ret; } net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2017-02-04 18:08:42 +0200
committerJohannes Berg <johannes.berg@intel.com>2017-02-06 07:42:47 +0100
commit01fba20b5976e445676febbdf6dc78d71c6d7b62 (patch)
tree59358197378bdac3509767b02531bf30b2b79f50 /net/mac80211/fils_aead.c
parente479ab651f071dbd1518ce8fb121c7f42f2bb97d (diff)
mac80211: Allocate a sync skcipher explicitly for FILS AEAD
The skcipher could have been of the async variant which may return from skcipher_encrypt() with -EINPROGRESS after having queued the request. The FILS AEAD implementation here does not have code for dealing with that possibility, so allocate a sync cipher explicitly to avoid potential issues with hardware accelerators. This is based on the patch sent out by Ard. Fixes: 39404feee691 ("mac80211: FILS AEAD protection for station mode association frames") Reported-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/fils_aead.c')
-rw-r--r--net/mac80211/fils_aead.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/mac80211/fils_aead.c b/net/mac80211/fils_aead.c