Skip to contentSkip to conversation

double-free security PTI fix

PATCH New [email protected] 1 participant 1 message May 25, 2011 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 double-free security PTI fix

From: J Freyensee <[email protected]>

This patch fixes a double-free error that will not always be seen unless /dev/pti char interface is stressed.

---
 drivers/misc/pti.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/misc/pti.c +3 -2
index bb6f925..be48573 100644
@@ -317,7 +317,8 @@ EXPORT_SYMBOL_GPL(pti_request_masterchannel);
  *				a master, channel ID address
  *				used to write to PTI HW.
  *
- * @mc: master, channel apeture ID address to be released.
+ * @mc: master, channel apeture ID address to be released.  This
+ *      will de-allocate the structure via kfree().
  */
 void pti_release_masterchannel(struct pti_masterchannel *mc)
 {
@@ -581,7 +582,7 @@ static int pti_char_open(struct inode *inode, struct file *filp)
 static int pti_char_release(struct inode *inode, struct file *filp)
 {
 	pti_release_masterchannel(filp->private_data);
-	kfree(filp->private_data);
+	filp->private_data = NULL;
 	return 0;
 }
 
Signature · 1 line
1.7.2.3