Thread (14 messages) 14 messages, 5 authors, 2005-05-01

Re: [PATCH] resource release cleanup in net/

From: Alexey Dobriyan <hidden>
Date: 2005-05-01 08:29:24
Also in: lkml

On Sun, May 01, 2005 at 01:13:28AM +0200, Jesper Juhl wrote:
On Sun, 1 May 2005, Alexey Dobriyan wrote:
quoted
On Sat, Apr 30, 2005 at 10:36:00PM +0200, Jesper Juhl wrote:
quoted
Since Andrew merged the patch that makes calling crypto_free_tfm() with a 
NULL pointer safe into 2.6.12-rc3-mm1, I made a patch to remove checks for 
NULL before calling that function
 drivers/net/wireless/hostap/hostap_crypt_ccmp.c |    5 -
 drivers/net/wireless/hostap/hostap_crypt_tkip.c |   10 +-
 drivers/net/wireless/hostap/hostap_crypt_wep.c  |    5 -
 net/ieee80211/ieee80211_crypt_ccmp.c            |    5 -
 net/ieee80211/ieee80211_crypt_tkip.c            |   10 +-
 net/ieee80211/ieee80211_crypt_wep.c             |    5 -
I think I have a better one for these.
--- linux-2.6.12-rc3-mm1/drivers/net/wireless/hostap/hostap_crypt_ccmp.c	2005-05-01 01:53:50.000000000 +0000
+++ linux-2.6.12-rc3-mm1-hostap/drivers/net/wireless/hostap/hostap_crypt_ccmp.c	2005-05-01 02:21:10.000000000 +0000
quoted
@@ -121,8 +118,7 @@ fail:
 static void hostap_ccmp_deinit(void *priv)
 {
 	struct hostap_ccmp_data *_priv = priv;
-	if (_priv && _priv->tfm)
-		crypto_free_tfm(_priv->tfm);
+	crypto_free_tfm(_priv->tfm);
 	kfree(priv);
 	module_put(THIS_MODULE);
 }
This will Oops if _priv is NULL. That's why my patch did 

if (_priv)
	crypto_free_tfm(_priv->tfm);
After hostap_ccmp_init() returns successfully:
1. priv is valid pointer	line 95
2. priv->tfm is valid pointer	line 102
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help