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  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 5 Nov 2007 17:38:34 -0800
From:	David Brownell <david-b@...bell.net>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	linux-usb-devel@...ts.sourceforge.net, Greg KH <greg@...ah.com>,
	Alan Stern <stern@...land.harvard.edu>,
	Oliver Neukum <oneukum@...e.de>, Ingo Molnar <mingo@...e.hu>,
	Stephen Hemminger <shemminger@...ux-foundation.org>,
	linux-kernel@...r.kernel.org, apw <apw@...dowen.org>
Subject: Re: [linux-usb-devel] device struct bloat

On Monday 05 November 2007, Greg KH wrote:
> --- linux-2.6-2.orig/drivers/spi/spi.c
> +++ linux-2.6-2/drivers/spi/spi.c

It'd be quicker to end up in the right hands if you had
split this big and random patch according to subsystem...

There's already a patch in the MM queue that removes
the SPI-private semaphore.  Except that it's missing
the bug noted below.

The class semaphore removal would be a different issue.


> @@ -613,7 +613,7 @@ int spi_write_then_read(struct spi_devic
>         }
>  
>         /* ... unless someone else is using the pre-allocated buffer */
> -       if (down_trylock(&lock)) {
> +       if (mutex_trylock(&lock)) {

According to its kerneldoc, mutex_trylock() follows the
spinlock model not the semaphore model.  So the sense of
this test is incorrect ... as will be any similar changes
in other parts of this patch:

 * NOTE: this function follows the spin_trylock() convention, so
 * it is negated to the down_trylock() return values! Be careful
 * about this when converting semaphore users to mutexes.

So the patch in the MM queue says "if (!mutex_trylock(...)) {

>                 local_buf = kmalloc(SPI_BUFSIZ, GFP_KERNEL);
>                 if (!local_buf)
>                         return -ENOMEM;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ