Comment 7 for bug 9835

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Message-ID: <email address hidden>
Date: Tue, 2 Nov 2004 14:08:36 +0100
From: Max Vozeler <email address hidden>
To: Nicolas Bouillon <email address hidden>,
 <email address hidden>
Subject: Re: Bug#279306: mount -a segfault

--7iMSBzlTiPOCCT2k
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Tue, Nov 02, 2004 at 11:19:41AM +0100, Nicolas Bouillon wrote:

> #/dev/hdb1
> LABEL=17Go /mnt/17Go ext3 errors=remount-ro 0 0
>
> In fact, the 17Go partition label is not present on my system anymore.
> Then, mount fails, that can be considered normal, but with a segfault...

I could reproduce this by having a LABEL=something in fstab of a system
without any volume labels present.

The check in mounted() doesn't handle the case where mount_get_devname()
returns NULL when it can't find the associated device. Instead it passes
the NULL pointer on to streq() which then causes the segfault.

The attached patch makes mounted() return immediately in that case. With
this mount outputs instead of segfaulting:
  mount: special device LABEL=something does not exist

> Hope this bug can be fixed soon, but maybe not so critical as it appears
> first.

> Thanks.

Cheers,
Max

--
308E81E7B97963BCA0E6ED889D5BD511B7CDA2DC

--7iMSBzlTiPOCCT2k
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline; filename=handle-null-devname

--- mount/mount.c.orig 2004-11-02 13:52:31.000000000 +0100
+++ mount/mount.c 2004-11-02 13:52:51.000000000 +0100
@@ -1190,6 +1190,8 @@

  /* Handle possible UUID= and LABEL= in spec */
  spec0 = mount_get_devname(spec0);
+ if (!spec0)
+ return ret;

  spec = canonicalize(spec0);
  node = canonicalize(node0);

--7iMSBzlTiPOCCT2k--