[PATCH 03/24] usb/otg/isp1301_omap: Fix dangling pointer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fix this i2c-driver which missed setting clientdata to NULL before freeing the
structure it points to. Found by a semantic patch, but fixed by hand.

Signed-off-by: Wolfram Sang <w.sang@xxxxxxxxxxxxxx>
Cc: David Brownell <dbrownell@xxxxxxxxxxxxxxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxx>
---
 drivers/usb/otg/isp1301_omap.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/otg/isp1301_omap.c b/drivers/usb/otg/isp1301_omap.c
index 78a2097..0ad16e3 100644
--- a/drivers/usb/otg/isp1301_omap.c
+++ b/drivers/usb/otg/isp1301_omap.c
@@ -1224,7 +1224,9 @@ static void isp1301_release(struct device *dev)
 	/* ugly -- i2c hijacks our memory hook to wait_for_completion() */
 	if (isp->i2c_release)
 		isp->i2c_release(dev);
-	kfree (isp);
+
+	i2c_set_clientdata(isp->client, NULL);
+	kfree(isp);
 }
 
 static struct isp1301 *the_transceiver;
@@ -1629,6 +1631,7 @@ isp1301_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
 	return 0;
 
 fail:
+	i2c_set_clientdata(i2c, NULL);
 	kfree(isp);
 	return -ENODEV;
 }
-- 
1.7.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux