lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 30 Jul 2006 03:56:21 -0300
From:	Alexandre Oliva <aoliva@...hat.com>
To:	linux-kernel@...r.kernel.org
Subject: let md auto-detect 128+ raid members, fix potential race condition

I accidentally ran into the 128-devices limit in md.c's
detected_devices.  It doesn't seem like a high-enough limit, and I
don't quite see why we wouldn't use a list for this.

Besides, there appears to be a race condition in it:

         detected_devices[dev_cnt++] = dev;

won't atomically increment dev_cnt and use its previous value, unless
there's something up the call stack that guarantees mutual exclusion.
I don't see that this is the case.

Previously devices that exceeded the array would be silently
discarded.  Now we'll only discard them if we run out of memory, and
we'll report so if we do.

Before I wrap up, a question on style: does it make sense to use
kzmalloc to allocate this newly-created data structure that contains
only a list_head and a dev_t, where the latter is immediately copied
from another dev_t variable, and then the whole thing is added to a
list?  I.e., could any list-checking present or future feature rely on
list_head fields that might hurt if not zero-initialized, or would it
be future-proof to just use kmalloc in this case?

This was tested on an Athlon64 notebook with 2 disks on RAID (internal
and external USB) with the latest Fedora development kernel plus this
patch.

	Signed-off-by: Alexandre Oliva <oliva@....ic.unicamp.br>


View attachment "raid-detected-list.patch" of type "text/x-patch" (3393 bytes)


-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
Secretary for FSF Latin America        http://www.fsfla.org/
Red Hat Compiler Engineer   aoliva@...dhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@...d.ic.unicamp.br, gnu.org}

Powered by blists - more mailing lists