浏览代码

PCI hotplug: fix memory leaks

Stanse found a cut&pasted memory leak in pciehp_queue_pushbutton_work
and shpchp_queue_pushbutton_work. info is not freed/assigned on all
paths. Fix that.

Reviewed-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Jiri Slaby 15 年之前
父节点
当前提交
6fcaf17ac7
共有 2 个文件被更改,包括 2 次插入0 次删除
  1. 1 0
      drivers/pci/hotplug/pciehp_ctrl.c
  2. 1 0
      drivers/pci/hotplug/shpchp_ctrl.c

+ 1 - 0
drivers/pci/hotplug/pciehp_ctrl.c

@@ -341,6 +341,7 @@ void pciehp_queue_pushbutton_work(struct work_struct *work)
 		p_slot->state = POWERON_STATE;
 		break;
 	default:
+		kfree(info);
 		goto out;
 	}
 	queue_work(pciehp_wq, &info->work);

+ 1 - 0
drivers/pci/hotplug/shpchp_ctrl.c

@@ -453,6 +453,7 @@ void shpchp_queue_pushbutton_work(struct work_struct *work)
 		p_slot->state = POWERON_STATE;
 		break;
 	default:
+		kfree(info);
 		goto out;
 	}
 	queue_work(shpchp_wq, &info->work);