mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: valdis.kletnieks@vt.edu
To: gregkh@linuxfoundation.org, John Whitmore <arigead@gmail.com>,
	Kees Cook <keescook@chromium.org>
Cc: kernelnewbies@kernelnewbies.org, linux-kernel@vger.kernel.org,
	devel@driverdev.osuosl.org
Subject: [PATCH] fix error handling in drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
Date: Wed, 26 Sep 2018 13:52:17 -0400	[thread overview]
Message-ID: <13450.1537984337@turing-police.cc.vt.edu> (raw)

John notes that if the kzalloc of ieee->pHTInfo fails, we fail to call
ieee80211_networks_free().  In addition, that function has an un-needed check
before kfree().

Reported-by: John Whitmore <arigead@gmail.com>
Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
---
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
index 90a097f2cd4e..97ff0371b5bb 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
@@ -78,8 +78,6 @@ static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
 
 static inline void ieee80211_networks_free(struct ieee80211_device *ieee)
 {
-	if (!ieee->networks)
-		return;
 	kfree(ieee->networks);
 	ieee->networks = NULL;
 }
@@ -180,6 +178,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
 	return dev;
 
  failed:
+	ieee80211_networks_free(ieee);
 	if (dev)
 		free_netdev(dev);
 


             reply	other threads:[~2018-09-26 17:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-26 17:52 valdis.kletnieks [this message]
2018-09-26 18:04 ` Kees Cook
2018-09-27 14:24 ` Dan Carpenter
2018-09-27 15:43   ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=13450.1537984337@turing-police.cc.vt.edu \
    --to=valdis.kletnieks@vt.edu \
    --cc=arigead@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=keescook@chromium.org \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®