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]
Message-ID: <20110407130008.GX23633@amd.com>
Date:	Thu, 7 Apr 2011 15:00:08 +0200
From:	"Roedel, Joerg" <Joerg.Roedel@....com>
To:	"Xu, Andiry" <Andiry.Xu@....com>
CC:	Alan Stern <stern@...land.harvard.edu>,
	Greg Kroah-Hartman <gregkh@...e.de>,
	Sarah Sharp <sarah.a.sharp@...ux.intel.com>,
	"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"stable@...nel.org" <stable@...nel.org>
Subject: Re: [PATCH] USB host: Fix lockdep warning in AMD PLL quirk

On Thu, Apr 07, 2011 at 05:01:01AM -0400, Xu, Andiry wrote:
> > -----Original Message-----
> > From: Roedel, Joerg [mailto:Joerg.Roedel@....com]
> > Sent: Thursday, April 07, 2011 3:51 PM
> > To: Alan Stern
> > Cc: Greg Kroah-Hartman; Sarah Sharp; Xu, Andiry; linux-usb@...r.kernel.org;
> > linux-kernel@...r.kernel.org; stable@...nel.org
> > Subject: Re: [PATCH] USB host: Fix lockdep warning in AMD PLL quirk
> >
> > On Wed, Apr 06, 2011 at 11:16:07AM -0400, Alan Stern wrote:
> > > On Wed, 6 Apr 2011, Joerg Roedel wrote:
> >
> > > The counter really should be a bool: Has the chipset already been
> > > probed or not?  After all, nobody cares how many times this routine was
> > > called.
> > >
> > > > + spin_unlock_irqrestore(&amd_lock, flags);
> > >
> > > This code now contains a bug: You incremented the probe_count _before_
> > > doing the probe.  If another thread calls this routine right now, it
> > > will get an incorrect result.
> > >
> > > Fixing this up should be fairly easy.
> >
> > Hmm, we can get rid of the amd_lock completly if every thread uses the
> > following call-order:
> >
> >       usb_amd_find_chipset_info();
> >       usb_amd_quirk_pll_enable();
> >       usb_amd_quirk_pll_disable();
> >       usb_amd_dev_put();
> >
> 
> The correct order is:
> 
> usb_amd_find_chipset_info();
> usb_amd_quirk_pll_disable();
> usb_amd_quirk_pll_enable();
> usb_amd_dev_put();
> 
> The pair of pll disable and enable may be called for multiple times.

So we could access the data structure without any locks if we want using
atomic_t for the probe_count and isoc_reqs members. But as I've seen
meanwhile the lock still needs to protect the access to the hardware in
the usb_amd_quirk_pll() function.
So its probably not worth the work, what do you think?

Regards,

	Joerg

-- 
AMD Operating System Research Center

Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632

--
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