From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] printk: ringbuffer: Wrong data pointer when appending small string
Date: Thu, 15 Oct 2020 15:31:37 +0900 [thread overview]
Message-ID: <20201015063137.GA3668@jagdpanzerIV.localdomain> (raw)
In-Reply-To: <20201014175051.GC13775@alley>
On (20/10/14 19:50), Petr Mladek wrote:
> 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];
> }
Great catch.
Acked-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
-ss
next prev parent reply other threads:[~2020-10-15 6:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-14 10:49 [LTP] BUG: KASAN: global-out-of-bounds in vprintk_store on x86_64 Naresh Kamboju
2020-10-14 12:47 ` Sergey Senozhatsky
2020-10-14 14:05 ` Petr Mladek
2020-10-14 15:13 ` Petr Mladek
2020-10-14 17:50 ` [LTP] [PATCH] printk: ringbuffer: Wrong data pointer when appending small string Petr Mladek
2020-10-15 6:31 ` Sergey Senozhatsky [this message]
2020-10-15 9:59 ` John Ogness
2020-10-15 12:22 ` Petr Mladek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201015063137.GA3668@jagdpanzerIV.localdomain \
--to=sergey.senozhatsky@gmail.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox