cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Andrew Price <anprice@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [libgfs2 PATCH] libgfs2: Check block range when inserting into rgrp tree
Date: Wed, 16 Sep 2015 11:45:39 +0100	[thread overview]
Message-ID: <55F94853.8060208@redhat.com> (raw)
In-Reply-To: <1300624095.28256563.1442251142819.JavaMail.zimbra@redhat.com>

On 14/09/15 18:19, Bob Peterson wrote:
> Hi,
>
> This patch adds checks to function rindex_read to make sure the
> rgrp starting address isn't grossly outside the file system.
> It may be in the case of severely corrupt file systems from fsck.
> If we added them to the rgrp tree, our calculations will get
> screwed up, eventually causing a segfault.
>
> Regards,
>
> Bob Peterson
> Red Hat File Systems
>
> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
> ---
> diff --git a/gfs2/libgfs2/super.c b/gfs2/libgfs2/super.c
> index b956366..73354ff 100644
> --- a/gfs2/libgfs2/super.c
> +++ b/gfs2/libgfs2/super.c
> @@ -166,6 +166,12 @@ int rindex_read(struct gfs2_sbd *sdp, int fd, int *count1, int *sane)
>   			return -1;
>
>   		gfs2_rindex_in(&ri, (char *)&buf.bufgfs2);
> +		if (gfs2_check_range(sdp, ri.ri_addr) != 0) {

I guess since we don't have the full rindex yet to get the fs size it's 
checking against the device size here. Assuming other tools using this 
function have initialized sdp->fssize sensibly before calling it: ACK.

Andy

> +			*sane = 0;
> +			if (prev_rgd == NULL)
> +				return -1;
> +			ri.ri_addr = prev_rgd->ri.ri_addr + prev_rgd->length;
> +		}
>   		rgd = rgrp_insert(&sdp->rgtree, ri.ri_addr);
>   		memcpy(&rgd->ri, &ri, sizeof(struct gfs2_rindex));
>
>



      reply	other threads:[~2015-09-16 10:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <661769988.28256076.1442251076435.JavaMail.zimbra@redhat.com>
2015-09-14 17:19 ` [Cluster-devel] [libgfs2 PATCH] libgfs2: Check block range when inserting into rgrp tree Bob Peterson
2015-09-16 10:45   ` Andrew Price [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=55F94853.8060208@redhat.com \
    --to=anprice@redhat.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 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).