summaryrefslogtreecommitdiffstats
path: root/include/linux/kfifo.h
diff options
context:
space:
mode:
authorStefani Seibold <stefani@seibold.net>2010-01-15 17:01:02 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2010-01-16 12:15:37 -0800
commit7e105057a34c83cea542dacc55ff0528bce67afa (patch)
tree2603ae4ef6b310d8a26f779761cff8cfb4815c09 /include/linux/kfifo.h
parent33f724eb9e3d6e33aad410318d3ac720fecbdbcd (diff)
downloadlinux-7e105057a34c83cea542dacc55ff0528bce67afa.tar.gz
linux-7e105057a34c83cea542dacc55ff0528bce67afa.tar.bz2
linux-7e105057a34c83cea542dacc55ff0528bce67afa.zip
kfifo: fix kfifo_out_locked race bug
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>
Diffstat (limited to 'include/linux/kfifo.h')
-rw-r--r--include/linux/kfifo.h7
1 files changed, 0 insertions, 7 deletions
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
index 7c6b32a1421c..c4ac88b3c302 100644
--- a/include/linux/kfifo.h
+++ b/include/linux/kfifo.h
@@ -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;