From: Sasha Levin <sashal@kernel.org>
To: Ben Hutchings <ben.hutchings@codethink.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable <stable@vger.kernel.org>
Subject: Re: [PATCH 4.4 01/13] GFS2: don't set rgrp gl_object until it's inserted into rgrp tree
Date: Tue, 27 Aug 2019 22:57:00 -0400 [thread overview]
Message-ID: <20190828025700.GW5281@sasha-vm> (raw)
In-Reply-To: <20190827230906.GA11046@xylophone.i.decadent.org.uk>
On Wed, Aug 28, 2019 at 12:09:06AM +0100, Ben Hutchings wrote:
>From: Bob Peterson <rpeterso@redhat.com>
>
>commit 36e4ad0316c017d5b271378ed9a1c9a4b77fab5f upstream.
>
>Before this patch, function read_rindex_entry would set a rgrp
>glock's gl_object pointer to itself before inserting the rgrp into
>the rgrp rbtree. The problem is: if another process was also reading
>the rgrp in, and had already inserted its newly created rgrp, then
>the second call to read_rindex_entry would overwrite that value,
>then return a bad return code to the caller. Later, other functions
>would reference the now-freed rgrp memory by way of gl_object.
>In some cases, that could result in gfs2_rgrp_brelse being called
>twice for the same rgrp: once for the failed attempt and once for
>the "real" rgrp release. Eventually the kernel would panic.
>There are also a number of other things that could go wrong when
>a kernel module is accessing freed storage. For example, this could
>result in rgrp corruption because the fake rgrp would point to a
>fake bitmap in memory too, causing gfs2_inplace_reserve to search
>some random memory for free blocks, and find some, since we were
>never setting rgd->rd_bits to NULL before freeing it.
>
>This patch fixes the problem by not setting gl_object until we
>have successfully inserted the rgrp into the rbtree. Also, it sets
>rd_bits to NULL as it frees them, which will ensure any accidental
>access to the wrong rgrp will result in a kernel panic rather than
>file system corruption, which is preferred.
>
>Signed-off-by: Bob Peterson <rpeterso@redhat.com>
>[bwh: Backported to 4.4: adjust context]
>Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
I've queued the series up, thanks Ben!
--
Thanks,
Sasha
prev parent reply other threads:[~2019-08-28 2:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-27 23:09 [PATCH 4.4 01/13] GFS2: don't set rgrp gl_object until it's inserted into rgrp tree Ben Hutchings
2019-08-27 23:10 ` [PATCH 4.4 02/13] net: arc_emac: fix koops caused by sk_buff free Ben Hutchings
2019-08-27 23:10 ` [PATCH 4.4 03/13] vhost-net: set packet weight of tx polling to 2 * vq size Ben Hutchings
2019-08-27 23:10 ` [PATCH 4.4 04/13] vhost_net: use packet weight for rx handler, too Ben Hutchings
2019-08-27 23:10 ` [PATCH 4.4 05/13] vhost_net: introduce vhost_exceeds_weight() Ben Hutchings
2019-08-27 23:10 ` [PATCH 4.4 06/13] vhost: " Ben Hutchings
2019-08-27 23:10 ` [PATCH 4.4 07/13] vhost_net: fix possible infinite loop Ben Hutchings
2019-08-27 23:10 ` [PATCH 4.4 08/13] vhost: scsi: add weight support Ben Hutchings
2019-08-27 23:10 ` [PATCH 4.4 09/13] siphash: add cryptographically secure PRF Ben Hutchings
2019-08-27 23:11 ` [PATCH 4.4 10/13] siphash: implement HalfSipHash1-3 for hash tables Ben Hutchings
2019-08-28 8:38 ` Greg Kroah-Hartman
2019-08-27 23:11 ` [PATCH 4.4 11/13] inet: switch IP ID generator to siphash Ben Hutchings
2019-08-27 23:11 ` [PATCH 4.4 12/13] netfilter: ctnetlink: don't use conntrack/expect object addresses as id Ben Hutchings
2019-08-27 23:11 ` [PATCH 4.4 13/13] netfilter: conntrack: Use consistent ct id hash calculation Ben Hutchings
2019-08-28 2:57 ` Sasha Levin [this message]
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=20190828025700.GW5281@sasha-vm \
--to=sashal@kernel.org \
--cc=ben.hutchings@codethink.co.uk \
--cc=gregkh@linuxfoundation.org \
--cc=stable@vger.kernel.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 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.