diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2020-10-16 12:52:37 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-10-16 12:52:37 -0700 |
commit | 8119c4332d253660e0a6b8748fe0749961cfbc97 (patch) | |
tree | f0cee0b6c342034952bc00d484bd15e286634d42 /kernel | |
parent | 49dc6fbce33011733601e4e81c551e066f1682fc (diff) | |
parent | eac48eb6ce10c1dc6fd3366608f4d3ca2430166c (diff) | |
download | linux-stable-8119c4332d253660e0a6b8748fe0749961cfbc97.tar.gz linux-stable-8119c4332d253660e0a6b8748fe0749961cfbc97.tar.bz2 linux-stable-8119c4332d253660e0a6b8748fe0749961cfbc97.zip |
Merge tag 'printk-for-5.10-fixup' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux
Pull printk fix from Petr Mladek:
"Prevent overflow in the new lockless ringbuffer"
* tag 'printk-for-5.10-fixup' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux:
printk: ringbuffer: Wrong data pointer when appending small string
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/printk/printk_ringbuffer.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/printk/printk_ringbuffer.c b/kernel/printk/printk_ringbuffer.c index 2493348a1631..24a960a89aa8 100644 --- a/kernel/printk/printk_ringbuffer.c +++ b/kernel/printk/printk_ringbuffer.c @@ -1125,7 +1125,10 @@ static char *data_realloc(struct printk_ringbuffer *rb, /* If the data block does not increase, there is nothing to do. */ if (head_lpos - next_lpos < DATA_SIZE(data_ring)) { - blk = to_block(data_ring, blk_lpos->begin); + if (wrapped) + blk = to_block(data_ring, 0); + else + blk = to_block(data_ring, blk_lpos->begin); return &blk->data[0]; } |