From: Lennart Poettering Date: Thu, 28 May 2020 21:26:16 +0000 (+0200) Subject: udev: catch genuine_random_bytes() failures X-Git-Tag: v246-rc1~259^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a745117dbac02996f7bc13e85d623cb824f39afd;p=thirdparty%2Fsystemd.git udev: catch genuine_random_bytes() failures Fixes: CID#1428926 --- diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c index 75c2aec491e..806f4574581 100644 --- a/src/udev/net/link-config.c +++ b/src/udev/net/link-config.c @@ -332,7 +332,9 @@ static int get_mac(sd_device *device, MACAddressPolicy policy, struct ether_addr /* We require genuine randomness here, since we want to make sure we won't collide with other * systems booting up at the very same time. We do allow RDRAND however, since this is not * cryptographic key material. */ - genuine_random_bytes(mac->ether_addr_octet, ETH_ALEN, RANDOM_ALLOW_RDRAND); + r = genuine_random_bytes(mac->ether_addr_octet, ETH_ALEN, RANDOM_ALLOW_RDRAND); + if (r < 0) + return log_device_error_errno(device, r, "Failed to acquire random data to generate MAC: %m"); } else { uint64_t result;