Skip to content

Commit

Permalink
Merge tag 'printk-for-5.10-fixup' of git://git.kernel.org/pub/scm/lin…
Browse files Browse the repository at this point in the history
…ux/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
  • Loading branch information
Linus Torvalds committed Oct 16, 2020
2 parents 49dc6fb + eac48eb commit 8119c43
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion kernel/printk/printk_ringbuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

Expand Down

0 comments on commit 8119c43

Please sign in to comment.