lkml.org 
[lkml]   [2019]   [Dec]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4.14 204/267] blk-mq: avoid sysfs buffer overflow with too many CPU cores
On Tue, Dec 17, 2019 at 01:28:29PM +0900, Nobuhiro Iwamatsu wrote:
> On Mon, Dec 16, 2019 at 06:48:50PM +0100, Greg Kroah-Hartman wrote:
> > From: Ming Lei <ming.lei@redhat.com>
> >
> > commit 8962842ca5abdcf98e22ab3b2b45a103f0408b95 upstream.
> >
> > It is reported that sysfs buffer overflow can be triggered if the system
> > has too many CPU cores(>841 on 4K PAGE_SIZE) when showing CPUs of
> > hctx via /sys/block/$DEV/mq/$N/cpu_list.
> >
> > Use snprintf to avoid the potential buffer overflow.
> >
> > This version doesn't change the attribute format, and simply stops
> > showing CPU numbers if the buffer is going to overflow.
> >
> > Cc: stable@vger.kernel.org
> > Fixes: 676141e48af7("blk-mq: don't dump CPU -> hw queue map on driver load")
> > Signed-off-by: Ming Lei <ming.lei@redhat.com>
> > Signed-off-by: Jens Axboe <axboe@kernel.dk>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> >
>
> This commit also required following commit:
>
> commit d2c9be89f8ebe7ebcc97676ac40f8dec1cf9b43a
> Author: Ming Lei <ming.lei@redhat.com>
> Date: Mon Nov 4 16:26:53 2019 +0800
>
> blk-mq: make sure that line break can be printed
>
> 8962842ca5ab ("blk-mq: avoid sysfs buffer overflow with too many CPU cores")
> avoids sysfs buffer overflow, and reserves one character for line break.
> However, the last snprintf() doesn't get correct 'size' parameter passed
> in, so fixed it.
>
> Fixes: 8962842ca5ab ("blk-mq: avoid sysfs buffer overflow with too many CPU cores")
> Signed-off-by: Ming Lei <ming.lei@redhat.com>
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
>
>
> And this is also required for 4.4, 4.9 and 4.19.
> Please apply.

Thank you for catching this, now queued up.

greg k-h

\
 
 \ /
  Last update: 2019-12-17 08:50    [W:0.202 / U:0.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site