Skip to content

Commit

Permalink
staging: vme_user: Fix possible UAF in tsi148_dma_list_add
Browse files Browse the repository at this point in the history
[ Upstream commit 357057ee55d3c99a5de5abe8150f7bca04f8e53b ]

Smatch report warning as follows:

drivers/staging/vme_user/vme_tsi148.c:1757 tsi148_dma_list_add() warn:
  '&entry->list' not removed from list

In tsi148_dma_list_add(), the error path "goto err_dma" will not
remove entry->list from list->entries, but entry will be freed,
then list traversal may cause UAF.

Fix by removeing it from list->entries before free().

Fixes: b2383c9 ("vme: tsi148: fix first DMA item mapping")
Signed-off-by: Gaosheng Cui <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
gscui authored and gregkh committed Jan 18, 2023
1 parent bc890cc commit 51c0ad3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/vme/bridges/vme_tsi148.c
Original file line number Diff line number Diff line change
Expand Up @@ -1778,6 +1778,7 @@ static int tsi148_dma_list_add(struct vme_dma_list *list,
return 0;

err_dma:
list_del(&entry->list);
err_dest:
err_source:
err_align:
Expand Down

0 comments on commit 51c0ad3

Please sign in to comment.