[PATCH] drivers/crypto/nx: prevent oops on module exit

Dan Streetman ddstreet at ieee.org
Fri Oct 17 06:30:19 AEDT 2014


Check old_devdata->dev in nx-842 driver before accessing it, as
on systems without any nx-842 hardware, the ->dev will never be
set.  Currently, the module will cause an oops during unload
since old_devdata->dev is null.

Signed-off-by: Dan Streetman <ddstreet at ieee.org>
---

Also Seth and Rob, you guys should change your emails in this
driver, your IBM emails are still listed.

 drivers/crypto/nx/nx-842.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/nx/nx-842.c b/drivers/crypto/nx/nx-842.c
index 061407d..809a220 100644
--- a/drivers/crypto/nx/nx-842.c
+++ b/drivers/crypto/nx/nx-842.c
@@ -1269,7 +1269,7 @@ static void __exit nx842_exit(void)
 	RCU_INIT_POINTER(devdata, NULL);
 	spin_unlock_irqrestore(&devdata_mutex, flags);
 	synchronize_rcu();
-	if (old_devdata)
+	if (old_devdata && old_devdata->dev)
 		dev_set_drvdata(old_devdata->dev, NULL);
 	kfree(old_devdata);
 	vio_unregister_driver(&nx842_driver);
-- 
1.8.3.1



More information about the Linuxppc-dev mailing list