lkml.org 
[lkml]   [2018]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] rapidio: use a reference count for struct mport_dma_req
From
Date

On 2018-04-05 04:33 PM, Ioan Nicu wrote:
> Once the dma request is passed to the DMA engine, the DMA
> subsystem would hold a pointer to this structure and could
> call the completion callback after do_dma_request() has
> timed out.
>
> The current code deals with this by putting timed out SYNC
> requests to a pending list and freeing them later, when the
> mport cdev device is released. But this still does not
> guarantee that the DMA subsystem is really done with those
> transfers, so in theory dma_xfer_callback/dma_req_free
> could be called after mport_cdev_release_dma and could
> potentially access already freed memory.
>
> This patch simplifies the current handling by using a kref
> in the mport dma request structure, so that it gets freed
> only when nobody uses it anymore.
>
> This also simplifies the code a bit, as FAF transfers are
> now handled in the same way as SYNC and ASYNC transfers.
> There is no need anymore for the pending list and for the
> dma workqueue which was used in case of FAF transfers, so
> we remove them both.
>
> Signed-off-by: Ioan Nicu <ioan.nicu.ext@nokia.com>
> ---
> drivers/rapidio/devices/rio_mport_cdev.c | 122 +++++--------------------------
> 1 file changed, 18 insertions(+), 104 deletions(-)

Acked-by: Alexandre Bounine <alex.bou9@gmail.com>

\
 
 \ /
  Last update: 2018-04-09 21:40    [W:0.125 / U:0.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site