public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fsck: don't free fstab table on parse failure
@ 2012-03-27 12:53 Dave Reisner
  2012-04-09 14:12 ` Dave Reisner
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Reisner @ 2012-03-27 12:53 UTC (permalink / raw)
  To: util-linux; +Cc: Dave Reisner

Even if we fail parsing, fstab gets referenced later in the code (and
will subsequently crash via heap corruption). Take the easy way out and
simply avoid deallocating this table, as it will be freed for us on
program exit regardless.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
---
Crash reproducible with 'FSTAB_FILE=/dev/null fsck <any-blockdev>'

 disk-utils/fsck.c |    1 -
 1 file changed, 1 deletion(-)

diff --git a/disk-utils/fsck.c b/disk-utils/fsck.c
index a019a69..44200d0 100644
--- a/disk-utils/fsck.c
+++ b/disk-utils/fsck.c
@@ -430,7 +430,6 @@ static void load_fs_info(void)
 	path = getenv("FSTAB_FILE");
 
 	if (mnt_table_parse_fstab(fstab, path)) {
-		mnt_free_table(fstab);
 		if (!path)
 			path = mnt_get_fstab_path();
 		if (errno)
-- 
1.7.9.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] fsck: don't free fstab table on parse failure
  2012-03-27 12:53 [PATCH] fsck: don't free fstab table on parse failure Dave Reisner
@ 2012-04-09 14:12 ` Dave Reisner
  2012-04-10  9:47   ` Karel Zak
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Reisner @ 2012-04-09 14:12 UTC (permalink / raw)
  To: util-linux

On Tue, Mar 27, 2012 at 08:53:58AM -0400, Dave Reisner wrote:
> Even if we fail parsing, fstab gets referenced later in the code (and
> will subsequently crash via heap corruption). Take the easy way out and
> simply avoid deallocating this table, as it will be freed for us on
> program exit regardless.
> 
> Signed-off-by: Dave Reisner <dreisner@archlinux.org>
> ---

Pinging this, as it doesn't seem it was merged...

d

> Crash reproducible with 'FSTAB_FILE=/dev/null fsck <any-blockdev>'
> 
>  disk-utils/fsck.c |    1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/disk-utils/fsck.c b/disk-utils/fsck.c
> index a019a69..44200d0 100644
> --- a/disk-utils/fsck.c
> +++ b/disk-utils/fsck.c
> @@ -430,7 +430,6 @@ static void load_fs_info(void)
>  	path = getenv("FSTAB_FILE");
>  
>  	if (mnt_table_parse_fstab(fstab, path)) {
> -		mnt_free_table(fstab);
>  		if (!path)
>  			path = mnt_get_fstab_path();
>  		if (errno)
> -- 
> 1.7.9.4
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fsck: don't free fstab table on parse failure
  2012-04-09 14:12 ` Dave Reisner
@ 2012-04-10  9:47   ` Karel Zak
  0 siblings, 0 replies; 3+ messages in thread
From: Karel Zak @ 2012-04-10  9:47 UTC (permalink / raw)
  To: util-linux

On Mon, Apr 09, 2012 at 10:12:26AM -0400, Dave Reisner wrote:
> On Tue, Mar 27, 2012 at 08:53:58AM -0400, Dave Reisner wrote:
> > Even if we fail parsing, fstab gets referenced later in the code (and
> > will subsequently crash via heap corruption). Take the easy way out and
> > simply avoid deallocating this table, as it will be freed for us on
> > program exit regardless.
> > 
> > Signed-off-by: Dave Reisner <dreisner@archlinux.org>
> > ---
> 
> Pinging this, as it doesn't seem it was merged...

 Sorry, somehow marked as applied in my u-l mail folder, but not
 applied in git.

 Applied, thanks.

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-10  9:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-27 12:53 [PATCH] fsck: don't free fstab table on parse failure Dave Reisner
2012-04-09 14:12 ` Dave Reisner
2012-04-10  9:47   ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox