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
| ||
|
Message-ID: <cd313489-603e-4d8e-a09d-22a0c492a3cd@lunn.ch> Date: Mon, 29 May 2023 16:48:51 +0200 From: Andrew Lunn <andrew@...n.ch> To: Tristram.Ha@...rochip.com Cc: "David S. Miller" <davem@...emloft.net>, Florian Fainelli <f.fainelli@...il.com>, netdev@...r.kernel.org, UNGLinuxDriver@...rochip.com Subject: Re: [PATCH net-next] net: phy: smsc: add WoL support to LAN8740/LAN8742 PHYs. > + if (wol->wolopts & WAKE_ARP) { > + const u8 *ip_addr = > + ((const u8 *)&((ndev->ip_ptr)->ifa_list)->ifa_address); I'm not sure this is safe. What happens when the interface only has an IPv6 address? Is ifa_list a NULL pointer? I really think you need to be using a core helper to get the IPv4 address. > + const u16 mask[3] = { 0xF03F, 0x003F, 0x03C0 }; Are there any endianness issues here? I've not looked at how mask is used, but if it is indicating which bytes in the pattern should be matched on, i guess endian does matter. > + u8 pattern[42] = { > + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, > + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > + 0x08, 0x06, > + 0x00, 0x01, 0x08, 0x00, 0x06, 0x04, 0x00, 0x01, > + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > + 0x00, 0x00, 0x00, 0x00, > + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > + 0x00, 0x00, 0x00, 0x00 }; > + if (wol->wolopts & WAKE_MCAST) { > + u8 pattern[6] = { 0x33, 0x33, 0xFF, 0x00, 0x00, 0x00 }; > + u16 mask[1] = { 0x0007 }; > + u8 len = 3; > + > + /* Try to match IPv6 Neighbor Solicitation. */ > + if (ndev->ip6_ptr) { > + struct list_head *addr_list = > + &ndev->ip6_ptr->addr_list; > + struct inet6_ifaddr *ifa; > + > + list_for_each_entry(ifa, addr_list, if_list) { > + if (ifa->scope == IFA_LINK) { > + memcpy(&pattern[3], > + &ifa->addr.in6_u.u6_addr8[13], > + 3); > + mask[0] = 0x003F; > + len = 6; > + break; > + } > + } > + } >From an architecture point of view, i don't think a PHY driver should be access these data structure directly. See if ipv6_get_lladdr() does what you need? > + if (wol->wolopts & (WAKE_MAGIC | WAKE_UCAST)) { > + const u8 *mac = (const u8 *)ndev->dev_addr; > + > + if (!is_valid_ether_addr(mac)) > + return -EINVAL; Is that possible? Does the hardware care? Andrew --- pw-bot: cr
Powered by blists - more mailing lists