All of lore.kernel.org
 help / color / mirror / Atom feed
From: greg@kroah.com (Greg KH)
Subject: [PATCH for-4.19] staging: erofs: fix mis-acted TAIL merging behavior
Date: Thu, 7 Mar 2019 16:21:47 +0100	[thread overview]
Message-ID: <20190307152147.GA24453@kroah.com> (raw)
In-Reply-To: <5b7e1914-f8e5-da3d-4492-17d6afc00fb1@huawei.com>

On Thu, Mar 07, 2019@09:04:06PM +0800, Gao Xiang wrote:
> Hi Greg,
> 
> On 2019/3/7 20:25, Greg KH wrote:
> > On Thu, Mar 07, 2019@01:34:04PM +0800, Gao Xiang wrote:
> >> commit a112152f6f3a2a88caa6f414d540bd49e406af60 upstream.
> >>
> >> EROFS has an optimized path called TAIL merging, which is designed
> >> to merge multiple reads and the corresponding decompressions into
> >> one if these requests read continuous pages almost at the same time.
> >>
> >> In general, it behaves as follows:
> >>  ________________________________________________________________
> >>   ... |  TAIL  .  HEAD  |  PAGE  |  PAGE  |  TAIL    . HEAD | ...
> >>  _____|_combined page A_|________|________|_combined page B_|____
> >>         1  ]  ->  [  2                          ]  ->  [ 3
> >> If the above three reads are requested in the order 1-2-3, it will
> >> generate a large work chain rather than 3 individual work chains
> >> to reduce scheduling overhead and boost up sequential read.
> >>
> >> However, if Read 2 is processed slightly earlier than Read 1,
> >> currently it still generates 2 individual work chains (chain 1, 2)
> >> but it does in-place decompression for combined page A, moreover,
> >> if chain 2 decompresses ahead of chain 1, it will be a race and
> >> lead to corrupted decompressed page. This patch fixes it.
> >>
> >> Fixes: 3883a79abd02 ("staging: erofs: introduce VLE decompression support")
> >> Cc: <stable at vger.kernel.org> # 4.19+
> >> Signed-off-by: Gao Xiang <gaoxiang25 at huawei.com>
> >> Reviewed-by: Chao Yu <yuchao0 at huawei.com>
> >> ---
> >>  drivers/staging/erofs/unzip_vle.c | 69 +++++++++++++++++++++++++--------------
> >>  1 file changed, 44 insertions(+), 25 deletions(-)
> >>
> > 
> > thanks for the backport, now applied.
> 
> Yes, it seems that Sasha's bot cannot cherry-pick it directly,
> therefore I made this patch for 4.19 by hand...
> 
> BTW, there is another patch called "staging: erofs: compressed_pages should not be accessed again after freed"
> in the same condition... And I also send 4.19 and 4.20 version to stable mailing list,
> could you also kindly check them out?

Yes, please give me a chance to catch up on stable pending patches to
process:

	$ mdfrm -c ~/mail/stable/
	585 messages in /home/gregkh/mail/stable/

You are in good company :)

greg k-h

WARNING: multiple messages have this Message-ID (diff)
From: Greg KH <greg@kroah.com>
To: Gao Xiang <gaoxiang25@huawei.com>
Cc: Sasha Levin <sashal@kernel.org>, Chao Yu <yuchao0@huawei.com>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-erofs@lists.ozlabs.org, stable@vger.kernel.org
Subject: Re: [PATCH for-4.19] staging: erofs: fix mis-acted TAIL merging behavior
Date: Thu, 7 Mar 2019 16:21:47 +0100	[thread overview]
Message-ID: <20190307152147.GA24453@kroah.com> (raw)
In-Reply-To: <5b7e1914-f8e5-da3d-4492-17d6afc00fb1@huawei.com>

On Thu, Mar 07, 2019 at 09:04:06PM +0800, Gao Xiang wrote:
> Hi Greg,
> 
> On 2019/3/7 20:25, Greg KH wrote:
> > On Thu, Mar 07, 2019 at 01:34:04PM +0800, Gao Xiang wrote:
> >> commit a112152f6f3a2a88caa6f414d540bd49e406af60 upstream.
> >>
> >> EROFS has an optimized path called TAIL merging, which is designed
> >> to merge multiple reads and the corresponding decompressions into
> >> one if these requests read continuous pages almost at the same time.
> >>
> >> In general, it behaves as follows:
> >>  ________________________________________________________________
> >>   ... |  TAIL  .  HEAD  |  PAGE  |  PAGE  |  TAIL    . HEAD | ...
> >>  _____|_combined page A_|________|________|_combined page B_|____
> >>         1  ]  ->  [  2                          ]  ->  [ 3
> >> If the above three reads are requested in the order 1-2-3, it will
> >> generate a large work chain rather than 3 individual work chains
> >> to reduce scheduling overhead and boost up sequential read.
> >>
> >> However, if Read 2 is processed slightly earlier than Read 1,
> >> currently it still generates 2 individual work chains (chain 1, 2)
> >> but it does in-place decompression for combined page A, moreover,
> >> if chain 2 decompresses ahead of chain 1, it will be a race and
> >> lead to corrupted decompressed page. This patch fixes it.
> >>
> >> Fixes: 3883a79abd02 ("staging: erofs: introduce VLE decompression support")
> >> Cc: <stable@vger.kernel.org> # 4.19+
> >> Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
> >> Reviewed-by: Chao Yu <yuchao0@huawei.com>
> >> ---
> >>  drivers/staging/erofs/unzip_vle.c | 69 +++++++++++++++++++++++++--------------
> >>  1 file changed, 44 insertions(+), 25 deletions(-)
> >>
> > 
> > thanks for the backport, now applied.
> 
> Yes, it seems that Sasha's bot cannot cherry-pick it directly,
> therefore I made this patch for 4.19 by hand...
> 
> BTW, there is another patch called "staging: erofs: compressed_pages should not be accessed again after freed"
> in the same condition... And I also send 4.19 and 4.20 version to stable mailing list,
> could you also kindly check them out?

Yes, please give me a chance to catch up on stable pending patches to
process:

	$ mdfrm -c ~/mail/stable/
	585 messages in /home/gregkh/mail/stable/

You are in good company :)

greg k-h

  reply	other threads:[~2019-03-07 15:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190301212203.5FE0C2084F@mail.kernel.org>
2019-03-07  5:34 ` [PATCH for-4.19] staging: erofs: fix mis-acted TAIL merging behavior Gao Xiang
2019-03-07  5:34   ` Gao Xiang
2019-03-07 12:25   ` Greg KH
2019-03-07 12:25     ` Greg KH
2019-03-07 13:04     ` Gao Xiang
2019-03-07 13:04       ` Gao Xiang
2019-03-07 15:21       ` Greg KH [this message]
2019-03-07 15:21         ` Greg KH
2019-03-08  0:03         ` Gao Xiang
2019-03-08  0:03           ` Gao Xiang

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=20190307152147.GA24453@kroah.com \
    --to=greg@kroah.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.