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>] [day] [month] [year] [list]
Date:	Tue, 08 May 2007 13:25:06 +1000
From:	Benjamin Herrenschmidt <benh@...nel.crashing.org>
To:	Ricardo Cerqueira <v4l@...queira.org>,
	Carvalho Chehab <mchehab@...radead.org>
Cc:	Linux Kernel list <linux-kernel@...r.kernel.org>
Subject: Incorrect atomic usage in cx88-alsa driver


Hi !

So I see this construct:

	if (test_and_set_bit(0, &chip->opened))
		return -EBUSY;

	.../...

	return 0;
_error:
	dprintk(1,"Error opening PCM!\n");
	clear_bit(0, &chip->opened);
	smp_mb__after_clear_bit();
	return err;

So that's basically an attempt at doing a spinlock. The problem is your
barrier is wrong at the end. Better would be:

done:
	smp_mb__before_clear_bit();
	clear_bit(0, &chip->opened);

Though it's still less optimal that doing:

	if (!spin_trylock(...))
		goto bail;

	.../...

done:
	spin_unlock(...)

If you really want to stick to bitops, then you may want to look at
Nick's upcoming patches adding some bitops with appropriate lock
semantics.


Cheers,
Ben.


-
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