Re: [RFC PATCH 29/30] vfio: Add support for Shared Virtual Memory

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

 



On 26.04.2017 12:08, Jean-Philippe Brucker wrote:
On 26/04/17 07:53, Tomasz Nowicki wrote:
+        mutex_lock(&device->tasks_lock);
+        list_for_each_entry(vfio_task, &device->tasks, list) {
+            if (vfio_task->pasid != svm.pasid)
+                continue;
+
+            ret = iommu_unbind_task(device->dev, svm.pasid, flags);
+            if (ret)
+                dev_warn(device->dev, "failed to unbind PASID %u\n",
+                     vfio_task->pasid);
+
+            list_del(&vfio_task->list);
+            kfree(vfio_task);

Please use list_for_each_entry_safe.

There is:

+            break;

right after kfree, so we'd never follow vfio_task->list.next after freeing
vfio_task. The code searches for the _only_ task matching the PASID,
removes it and leaves the loop.


Ah right. Sorry for the noise.

Tomasz



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux