0001-cfg80211.c-fix-missing-prandom_u32-with-Linux-6.1.0.patch 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. From f80e4343fa0a4d8b22933d1704c85a771fe234a4 Mon Sep 17 00:00:00 2001
  2. From: Giulio Benetti <giulio.benetti@benettiengineering.com>
  3. Date: Wed, 28 Dec 2022 19:56:46 +0100
  4. Subject: [PATCH] cfg80211.c: fix missing prandom_u32() with Linux >= 6.1.0
  5. prandom_u32() previously was only calling get_random_u32() so it's been
  6. dropped with Linux 6.1.0. So let's directly call get_random_u32() if Linux
  7. version >= 6.1.0.
  8. [Upstream status: https://github.com/embeddedTS/wilc3000-external-module/pull/2]
  9. Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
  10. ---
  11. cfg80211.c | 4 ++++
  12. 1 file changed, 4 insertions(+)
  13. diff --git a/cfg80211.c b/cfg80211.c
  14. index 016aa06..41edd02 100644
  15. --- a/cfg80211.c
  16. +++ b/cfg80211.c
  17. @@ -1422,7 +1422,11 @@ static int mgmt_tx(struct wiphy *wiphy,
  18. const u8 *vendor_ie;
  19. int ret = 0;
  20. +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
  21. + *cookie = get_random_u32();
  22. +#else
  23. *cookie = prandom_u32();
  24. +#endif
  25. priv->tx_cookie = *cookie;
  26. mgmt = (const struct ieee80211_mgmt *)buf;
  27. --
  28. 2.34.1