382-nl80211-fix-memory-leak-if-validate_pae_over_nl80211.patch 934 B

1234567891011121314151617181920212223242526272829
  1. From d350a0f431189517b1af0dbbb605c273231a8966 Mon Sep 17 00:00:00 2001
  2. From: Johannes Berg <[email protected]>
  3. Date: Sat, 15 Dec 2018 11:03:22 +0200
  4. Subject: [PATCH 2/3] nl80211: fix memory leak if validate_pae_over_nl80211()
  5. fails
  6. If validate_pae_over_nl80211() were to fail in nl80211_crypto_settings(),
  7. we might leak the 'connkeys' allocation. Fix this.
  8. Fixes: 64bf3d4bc2b0 ("nl80211: Add CONTROL_PORT_OVER_NL80211 attribute")
  9. Signed-off-by: Johannes Berg <[email protected]>
  10. ---
  11. net/wireless/nl80211.c | 4 +++-
  12. 1 file changed, 3 insertions(+), 1 deletion(-)
  13. --- a/net/wireless/nl80211.c
  14. +++ b/net/wireless/nl80211.c
  15. @@ -9002,8 +9002,10 @@ static int nl80211_join_ibss(struct sk_b
  16. if (info->attrs[NL80211_ATTR_CONTROL_PORT_OVER_NL80211]) {
  17. int r = validate_pae_over_nl80211(rdev, info);
  18. - if (r < 0)
  19. + if (r < 0) {
  20. + kzfree(connkeys);
  21. return r;
  22. + }
  23. ibss.control_port_over_nl80211 = true;
  24. }