[SCSI] libsas: fix leak of dev->sata_dev.identify_[packet_]device
[linux-3.10.git] / drivers / scsi / libsas / sas_discover.c
index 4e64930..dc52b1f 100644 (file)
@@ -30,6 +30,7 @@
 
 #include <scsi/scsi_transport.h>
 #include <scsi/scsi_transport_sas.h>
+#include <scsi/sas_ata.h>
 #include "../scsi_sas_internal.h"
 
 /* ---------- Basic task processing for discovery purposes ---------- */
@@ -231,6 +232,11 @@ void sas_free_device(struct kref *kref)
        if (dev->dev_type == EDGE_DEV || dev->dev_type == FANOUT_DEV)
                kfree(dev->ex_dev.ex_phy);
 
+       if (dev_is_sata(dev)) {
+               kfree(dev->sata_dev.identify_device);
+               kfree(dev->sata_dev.identify_packet_device);
+       }
+
        kfree(dev);
 }