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: <0573C9D4B793EF43BF95221F2F4CC85153368C@CHN-SV-EXMX06.mchp-main.com>
Date:   Tue, 10 Apr 2018 02:27:54 +0000
From:   <RaghuramChary.Jallipalli@...rochip.com>
To:     <davem@...emloft.net>, <andrew@...n.ch>
CC:     <netdev@...r.kernel.org>, <UNGLinuxDriver@...rochip.com>,
        <Woojung.Huh@...rochip.com>
Subject: RE: [PATCH net 1/3] lan78xx: PHY DSP registers initialization to
 address EEE link drop issues with long cables

> >
> > Hi Raghuram
> >
> > You might want to look at phy_read_paged(), phy_write_paged(), etc.
> >
> > There can be race conditions with paged access.
> 
> Yep, so something like:
> 
> static void lan88xx_TR_reg_set(struct phy_device *phydev, u16 regaddr,
> 			       u32 data)
> {
> 	int save_page, val;
> 	u16 buf;
> 
> 	save_page = phy_save_page(phydev);
> 	phy_write_paged(phydev, LAN88XX_EXT_PAGE_ACCESS_TR,
> 			LAN88XX_EXT_PAGE_TR_LOW_DATA, (data &
> 0xFFFF));
> 	phy_write_paged(phydev, LAN88XX_EXT_PAGE_ACCESS_TR,
> 			LAN88XX_EXT_PAGE_TR_HIGH_DATA,
> 			(data & 0x00FF0000) >> 16);
> 
> 	/* Config control bits [15:13] of register */
> 	buf = (regaddr & ~(0x3 << 13));/* Clr [14:13] to write data in reg */
> 	buf |= 0x8000; /* Set [15] to Packet transmit */
> 
> 	phy_write_paged(phydev, LAN88XX_EXT_PAGE_ACCESS_TR,
> 			LAN88XX_EXT_PAGE_TR_CR, buf);
> 	usleep_range(1000, 2000);/* Wait for Data to be written */
> 
> 	val = phy_read_paged(phydev, LAN88XX_EXT_PAGE_ACCESS_TR,
> 			     LAN88XX_EXT_PAGE_TR_CR);
> 	if (!(val & 0x8000))
> 		pr_warn("TR Register[0x%X] configuration failed\n",
> regaddr);
> 
> 	phy_restore_page(phydev, save_page, 0); }
> 
> Since PHY accesses and thus things like phy_save_page() can fail, the return
> type of this function should be changed to 'int' and some error checking
> should be added.

Thanks David/Andrew.
Will take care of it.

Thanks,
Raghu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ