#include #include #include #include #include "rnd.h" #include "die.h" #include "ioexact.h" #include "ioops.h" static int fdw = -1; static void randombytes_weak(unsigned char *x, size_t xlen) { int ret; if (fdw == -1) { for (;;) { fdw = open(LOW_ENTROPY_SOURCE, O_RDONLY); if (fdw != -1) break; sleep(1); } } while (xlen > 0) { if (xlen < 1048576) ret = xlen; else ret = 1048576; ret = read(fdw, x, ret); if (ret < 1) { sleep(1); continue; } x += ret; xlen -= ret; } } static void randombytes_strong(unsigned char *x, size_t xlen) { int fds, ret; fds = open_or_die(HIG_ENTROPY_SOURCE, O_RDONLY); ret = read_exact(fds, x, xlen, 0); if (ret != (int) xlen) panic("Error reading from entropy source!\n"); close(fds); } int secrand(void) { int ret; randombytes_weak((void *) &ret, sizeof(ret)); return ret; } void gen_key_bytes(unsigned char *area, size_t len) { randombytes_strong(area, len); } .submit();'> net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGoodstein, Mordechay <mordechay.goodstein@intel.com>2017-01-15 16:00:12 +0200
committerLuca Coelho <luciano.coelho@intel.com>2017-02-08 17:54:22 +0200
commit735a0045f9ea8372bcf3e599cbd3aa891a216b26 (patch)
treef78361df24149aa7b4db2dd71e0ad335a76f16c8
parentb45242c99f503d0a526c2b1f647ad562f9cf9dd5 (diff)
iwlwifi: mvm: avoid race condition in ADD_STA.
The race happens when we send ADD_STA(auth->assoc) -> LQ_CMD between the commands the FW sometimes loses the medium for AUX, and sends a ndp to the AP and the flow becomes, ADD_STA -> send ndp -> LQ_CMD the problem is that there's no rates yet defined for sending the ndp and FW generates an assert. The fix: change the order of the commands to LQ_CMD -> ADD_STA Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>