Skip to content

Commit

Permalink
mailbox: tegra-hsp: Use after free in tegra_hsp_remove_doorbells()
Browse files Browse the repository at this point in the history
We have to use the _safe version of list_for_each() because we're
freeing the pointer as we go along.  (This might not show up testing
depending on what config options you have enabled).

Fixes: 0fe8846 ("mailbox: Add Tegra HSP driver")
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Thierry Reding <[email protected]>
  • Loading branch information
Dan Carpenter authored and thierryreding committed Nov 18, 2016
1 parent 0fe8846 commit 68050eb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/mailbox/tegra-hsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,12 +334,12 @@ static struct mbox_chan *of_tegra_hsp_xlate(struct mbox_controller *mbox,

static void tegra_hsp_remove_doorbells(struct tegra_hsp *hsp)
{
struct tegra_hsp_doorbell *db;
struct tegra_hsp_doorbell *db, *tmp;
unsigned long flags;

spin_lock_irqsave(&hsp->lock, flags);

list_for_each_entry(db, &hsp->doorbells, list)
list_for_each_entry_safe(db, tmp, &hsp->doorbells, list)
__tegra_hsp_doorbell_destroy(db);

spin_unlock_irqrestore(&hsp->lock, flags);
Expand Down

0 comments on commit 68050eb

Please sign in to comment.