Skip to content

Commit

Permalink
hippi: Fix a Fix a possible sleep-in-atomic bug in rr_close
Browse files Browse the repository at this point in the history
[ Upstream commit 6e26661 ]

The driver may sleep under a spinlock.
The function call path is:
rr_close (acquire the spinlock)
  free_irq --> may sleep

To fix it, free_irq is moved to the place without holding the spinlock.

This bug is found by my static analysis tool(DSAC) and checked by my code review.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
XidianGeneral authored and gregkh committed Feb 25, 2018
1 parent 385aeea commit e94fc84
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/hippi/rrunner.c
Original file line number Diff line number Diff line change
Expand Up @@ -1381,8 +1381,8 @@ static int rr_close(struct net_device *dev)
rrpriv->info_dma);
rrpriv->info = NULL;

free_irq(pdev->irq, dev);
spin_unlock_irqrestore(&rrpriv->lock, flags);
free_irq(pdev->irq, dev);

return 0;
}
Expand Down

0 comments on commit e94fc84

Please sign in to comment.