diff options
author | Stefani Seibold <stefani@seibold.net> | 2010-01-15 20:01:02 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-01-16 15:15:37 -0500 |
commit | 7e105057a34c83cea542dacc55ff0528bce67afa (patch) | |
tree | 2603ae4ef6b310d8a26f779761cff8cfb4815c09 /include/linux/kfifo.h | |
parent | 33f724eb9e3d6e33aad410318d3ac720fecbdbcd (diff) |
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.h | 7 |
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, | |||
228 | 228 | ||
229 | ret = kfifo_out(fifo, to, n); | 229 | ret = kfifo_out(fifo, to, n); |
230 | 230 | ||
231 | /* | ||
232 | * optimization: if the FIFO is empty, set the indices to 0 | ||
233 | * so we don't wrap the next time | ||
234 | */ | ||
235 | if (kfifo_is_empty(fifo)) | ||
236 | kfifo_reset(fifo); | ||
237 | |||
238 | spin_unlock_irqrestore(lock, flags); | 231 | spin_unlock_irqrestore(lock, flags); |
239 | 232 | ||
240 | return ret; | 233 | return ret; |