aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwtracing/intel_th
diff options
context:
space:
mode:
authorAlexander Shishkin <alexander.shishkin@linux.intel.com>2018-05-24 04:27:27 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-25 12:09:17 -0400
commit0ed2424b911f3a058dfea01b78817abed767433d (patch)
treee4445e5183b389375ce379c20f2a14420419b030 /drivers/hwtracing/intel_th
parentb5e2ced9bf81393034072dd4d372f6b430bc1f0a (diff)
intel_th: Use correct device when freeing buffers
Commit d5c435df4a890 ("intel_th: msu: Use the real device in case of IOMMU domain allocation") changes dma buffer allocation to use the actual underlying device, but forgets to change the deallocation path, which leads to (if you've got CAP_SYS_RAWIO): > # echo 0,0 > /sys/bus/intel_th/devices/0-msc0/nr_pages > ------------[ cut here ]------------ > kernel BUG at ../linux/drivers/iommu/intel-iommu.c:3670! > CPU: 3 PID: 231 Comm: sh Not tainted 4.17.0-rc1+ #2729 > RIP: 0010:intel_unmap+0x11e/0x130 ... > Call Trace: > intel_free_coherent+0x3e/0x60 > msc_buffer_win_free+0x100/0x160 [intel_th_msu] This patch fixes the buffer deallocation code to use the correct device. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Fixes: d5c435df4a890 ("intel_th: msu: Use the real device in case of IOMMU domain allocation") Reported-by: Baofeng Tian <baofeng.tian@intel.com> CC: stable@vger.kernel.org # v4.14+ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hwtracing/intel_th')
-rw-r--r--drivers/hwtracing/intel_th/msu.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c
index ede388309376..634f58042c77 100644
--- a/drivers/hwtracing/intel_th/msu.c
+++ b/drivers/hwtracing/intel_th/msu.c
@@ -733,8 +733,8 @@ err_nomem:
733 /* Reset the page to write-back before releasing */ 733 /* Reset the page to write-back before releasing */
734 set_memory_wb((unsigned long)win->block[i].bdesc, 1); 734 set_memory_wb((unsigned long)win->block[i].bdesc, 1);
735#endif 735#endif
736 dma_free_coherent(msc_dev(msc), size, win->block[i].bdesc, 736 dma_free_coherent(msc_dev(msc)->parent->parent, size,
737 win->block[i].addr); 737 win->block[i].bdesc, win->block[i].addr);
738 } 738 }
739 kfree(win); 739 kfree(win);
740 740
@@ -769,7 +769,7 @@ static void msc_buffer_win_free(struct msc *msc, struct msc_window *win)
769 /* Reset the page to write-back before releasing */ 769 /* Reset the page to write-back before releasing */
770 set_memory_wb((unsigned long)win->block[i].bdesc, 1); 770 set_memory_wb((unsigned long)win->block[i].bdesc, 1);
771#endif 771#endif
772 dma_free_coherent(msc_dev(win->msc), PAGE_SIZE, 772 dma_free_coherent(msc_dev(win->msc)->parent->parent, PAGE_SIZE,
773 win->block[i].bdesc, win->block[i].addr); 773 win->block[i].bdesc, win->block[i].addr);
774 } 774 }
775 775