Skip to content

Commit

Permalink
kfifo: fix kfifo_out_locked race bug
Browse files Browse the repository at this point in the history
Fix a wrong optimization in include/linux/kfifo.h which could cause a race
in kfifo_out_locked.

Signed-off-by: Stefani Seibold <stefani@seibold.net>
Reported-by: Johan Hovold <jhovold@gmail.com>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Stefani Seibold authored and Linus Torvalds committed Jan 16, 2010
1 parent 33f724e commit 7e10505
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions include/linux/kfifo.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,6 @@ static inline __must_check unsigned int kfifo_out_locked(struct kfifo *fifo,

ret = kfifo_out(fifo, to, n);

/*
* optimization: if the FIFO is empty, set the indices to 0
* so we don't wrap the next time
*/
if (kfifo_is_empty(fifo))
kfifo_reset(fifo);

spin_unlock_irqrestore(lock, flags);

return ret;
Expand Down

0 comments on commit 7e10505

Please sign in to comment.