linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Colin Ian King <colin.king@canonical.com>
Cc: linux-fsdevel@vger.kernel.org,
	David Howells <dhowells@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: fs: hfs: Possible issue with increment of extent
Date: Fri, 31 Aug 2018 14:56:15 +0100	[thread overview]
Message-ID: <20180831135614.GC19965@ZenIV.linux.org.uk> (raw)
In-Reply-To: <a519d1f2-81db-26c2-30ba-9ce2bacfecbe@canonical.com>

On Fri, Aug 31, 2018 at 02:39:11PM +0100, Colin Ian King wrote:
> Hi,
> 
> Static analysis has picked up a potential issue with an out of bounds
> read in fs/hfs/extent.c; the following for-loop in  hfs_free_fork()
> increments i and also extent while also reading extent[i].count.  This
> looks incorrect to me, I think the increment of extent is not needed:
> 
>         for (i = 0; i < 3; extent++, i++)
>                 blocks += be16_to_cpu(extent[i].count);
> 
>         res = hfs_free_extents(sb, extent, blocks, blocks);
> 
> I'm not familiar enough with the code to conclude that removing the
> increment of extent is necessary a correct fix just in case I'm missing
> something subtle here.

Goes back to commit d1081202f1d0 (in bk-to-git historical tree)
Author: Andrew Morton <akpm@osdl.org>
Date:   Wed Feb 25 16:17:36 2004 -0800

    [PATCH] HFS rewrite
    
    From: Roman Zippel <zippel@linux-m68k.org>

and it's almost certainly a bug in there, judging by the code nearby...

  reply	other threads:[~2018-08-31 18:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-31 13:39 fs: hfs: Possible issue with increment of extent Colin Ian King
2018-08-31 13:56 ` Al Viro [this message]
2018-08-31 13:56   ` Colin Ian King

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=20180831135614.GC19965@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=colin.king@canonical.com \
    --cc=dhowells@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@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 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).