staging:rtl8192e: Usage count off by one
authorSean MacLennan <seanm@seanm.ca>
Mon, 16 Nov 2015 00:51:43 +0000 (19:51 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Feb 2016 04:01:45 +0000 (20:01 -0800)
The rtllib driver is not calling try_module_get() when loading the
encryption modules. Because of this, you can never remove the module
once you have used it one (i.e. bring up the wireless interface).

Signed-off-by: Sean MacLennan <seanm@seanm.ca>
Tested-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8192e/rtllib_softmac.c
drivers/staging/rtl8192e/rtllib_wx.c

index d0fedb0ff132d9cd1acb54cb702589a9d1cf22e9..acccf9b44b98dd83cc606ac6b95aa4dbde377a6d 100644 (file)
@@ -3328,7 +3328,7 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee,
                        goto done;
                }
                new_crypt->ops = ops;
-               if (new_crypt->ops)
+               if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
                        new_crypt->priv =
                                new_crypt->ops->init(param->u.crypt.idx);
 
index 80f7a099dff1efe560101c8fe2df15443e9b813d..84e6272f28cd7105e8ac7bd2067446efcd9a87f0 100644 (file)
@@ -623,7 +623,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
                        goto done;
                }
                new_crypt->ops = ops;
-               if (new_crypt->ops)
+               if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
                        new_crypt->priv = new_crypt->ops->init(idx);
 
                if (new_crypt->priv == NULL) {