From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
To: Petr Mladek <mladek.petr@gmail.com>
Cc: John Ogness <john.ogness@linutronix.de>,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>,
Linux-Next Mailing List <linux-next@vger.kernel.org>,
linux-mm <linux-mm@kvack.org>,
open list <linux-kernel@vger.kernel.org>,
lkft-triage@lists.linaro.org, LTP List <ltp@lists.linux.it>,
Andrew Morton <akpm@linux-foundation.org>,
Mike Rapoport <rppt@linux.ibm.com>,
Stephen Rothwell <sfr@canb.auug.org.au>,
Rasmus Villemoes <rasmus.villemoes@prevas.dk>,
Linus Torvalds <torvalds@linux-foundation.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
Naresh Kamboju <naresh.kamboju@linaro.org>
Subject: Re: [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 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 ` [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=akpm@linux-foundation.org \
--cc=gregkh@linuxfoundation.org \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-next@vger.kernel.org \
--cc=lkft-triage@lists.linaro.org \
--cc=ltp@lists.linux.it \
--cc=mladek.petr@gmail.com \
--cc=naresh.kamboju@linaro.org \
--cc=rasmus.villemoes@prevas.dk \
--cc=rostedt@goodmis.org \
--cc=rppt@linux.ibm.com \
--cc=sfr@canb.auug.org.au \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/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;
as well as URLs for NNTP newsgroup(s).