Skip to content

Commit 8119c43

Browse files
committed
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
2 parents 49dc6fb + eac48eb commit 8119c43

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

kernel/printk/printk_ringbuffer.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,10 @@ static char *data_realloc(struct printk_ringbuffer *rb,
11251125

11261126
/* If the data block does not increase, there is nothing to do. */
11271127
if (head_lpos - next_lpos < DATA_SIZE(data_ring)) {
1128-
blk = to_block(data_ring, blk_lpos->begin);
1128+
if (wrapped)
1129+
blk = to_block(data_ring, 0);
1130+
else
1131+
blk = to_block(data_ring, blk_lpos->begin);
11291132
return &blk->data[0];
11301133
}
11311134

0 commit comments

Comments
 (0)