From: Greg Kroah-Hartman Date: Wed, 23 Jan 2019 07:40:38 +0000 (+0100) Subject: 4.4-stable patches X-Git-Tag: v4.20.5~26 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=49dc4a3917e57ac6515ffd980360cc5c190d5d92;p=thirdparty%2Fkernel%2Fstable-queue.git 4.4-stable patches added patches: ipv6-consider-sk_bound_dev_if-when-binding-a-socket-to-a-v4-mapped-address.patch ipv6-take-rcu_read_lock-in-__inet6_bind-for-mapped-addresses.patch r8169-add-support-for-new-realtek-ethernet.patch --- diff --git a/queue-4.4/ipv6-consider-sk_bound_dev_if-when-binding-a-socket-to-a-v4-mapped-address.patch b/queue-4.4/ipv6-consider-sk_bound_dev_if-when-binding-a-socket-to-a-v4-mapped-address.patch new file mode 100644 index 00000000000..9f6cdbfe52d --- /dev/null +++ b/queue-4.4/ipv6-consider-sk_bound_dev_if-when-binding-a-socket-to-a-v4-mapped-address.patch @@ -0,0 +1,51 @@ +From foo@baz Wed Jan 23 08:29:58 CET 2019 +From: David Ahern +Date: Fri, 4 Jan 2019 16:58:15 -0800 +Subject: ipv6: Consider sk_bound_dev_if when binding a socket to a v4 mapped address + +From: David Ahern + +[ Upstream commit ec90ad334986fa5856d11dd272f7f22fa86c55c4 ] + +Similar to c5ee066333eb ("ipv6: Consider sk_bound_dev_if when binding a +socket to an address"), binding a socket to v4 mapped addresses needs to +consider if the socket is bound to a device. + +This problem also exists from the beginning of git history. + +Signed-off-by: David Ahern +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + net/ipv6/af_inet6.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +--- a/net/ipv6/af_inet6.c ++++ b/net/ipv6/af_inet6.c +@@ -292,6 +292,7 @@ int inet6_bind(struct socket *sock, stru + + /* Check if the address belongs to the host. */ + if (addr_type == IPV6_ADDR_MAPPED) { ++ struct net_device *dev = NULL; + int chk_addr_ret; + + /* Binding to v4-mapped address on a v6-only socket +@@ -302,9 +303,17 @@ int inet6_bind(struct socket *sock, stru + goto out; + } + ++ if (sk->sk_bound_dev_if) { ++ dev = dev_get_by_index_rcu(net, sk->sk_bound_dev_if); ++ if (!dev) { ++ err = -ENODEV; ++ goto out; ++ } ++ } ++ + /* Reproduce AF_INET checks to make the bindings consistent */ + v4addr = addr->sin6_addr.s6_addr32[3]; +- chk_addr_ret = inet_addr_type(net, v4addr); ++ chk_addr_ret = inet_addr_type_dev_table(net, dev, v4addr); + if (!net->ipv4.sysctl_ip_nonlocal_bind && + !(inet->freebind || inet->transparent) && + v4addr != htonl(INADDR_ANY) && diff --git a/queue-4.4/ipv6-take-rcu_read_lock-in-__inet6_bind-for-mapped-addresses.patch b/queue-4.4/ipv6-take-rcu_read_lock-in-__inet6_bind-for-mapped-addresses.patch new file mode 100644 index 00000000000..be8444420d4 --- /dev/null +++ b/queue-4.4/ipv6-take-rcu_read_lock-in-__inet6_bind-for-mapped-addresses.patch @@ -0,0 +1,44 @@ +From foo@baz Wed Jan 23 08:17:01 CET 2019 +From: David Ahern +Date: Sat, 5 Jan 2019 07:35:04 -0800 +Subject: ipv6: Take rcu_read_lock in __inet6_bind for mapped addresses + +From: David Ahern + +[ Upstream commit d4a7e9bb74b5aaf07b89f6531c080b1130bdf019 ] + +I realized the last patch calls dev_get_by_index_rcu in a branch not +holding the rcu lock. Add the calls to rcu_read_lock and rcu_read_unlock. + +Fixes: ec90ad334986 ("ipv6: Consider sk_bound_dev_if when binding a socket to a v4 mapped address") +Signed-off-by: David Ahern +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + net/ipv6/af_inet6.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/net/ipv6/af_inet6.c ++++ b/net/ipv6/af_inet6.c +@@ -303,17 +303,20 @@ int inet6_bind(struct socket *sock, stru + goto out; + } + ++ rcu_read_lock(); + if (sk->sk_bound_dev_if) { + dev = dev_get_by_index_rcu(net, sk->sk_bound_dev_if); + if (!dev) { + err = -ENODEV; +- goto out; ++ goto out_unlock; + } + } + + /* Reproduce AF_INET checks to make the bindings consistent */ + v4addr = addr->sin6_addr.s6_addr32[3]; + chk_addr_ret = inet_addr_type_dev_table(net, dev, v4addr); ++ rcu_read_unlock(); ++ + if (!net->ipv4.sysctl_ip_nonlocal_bind && + !(inet->freebind || inet->transparent) && + v4addr != htonl(INADDR_ANY) && diff --git a/queue-4.4/r8169-add-support-for-new-realtek-ethernet.patch b/queue-4.4/r8169-add-support-for-new-realtek-ethernet.patch new file mode 100644 index 00000000000..f5f3425dfdc --- /dev/null +++ b/queue-4.4/r8169-add-support-for-new-realtek-ethernet.patch @@ -0,0 +1,31 @@ +From foo@baz Wed Jan 23 08:29:58 CET 2019 +From: Kai-Heng Feng +Date: Wed, 2 Jan 2019 14:45:07 +0800 +Subject: r8169: Add support for new Realtek Ethernet + +From: Kai-Heng Feng + +[ Upstream commit 36352991835ce99e46b4441dd0eb6980f9a83e8f ] + +There are two new Realtek Ethernet devices which are re-branded r8168h. +Add the IDs to to support them. + +Signed-off-by: Kai-Heng Feng +Reviewed-by: Heiner Kallweit +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/realtek/r8169.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/net/ethernet/realtek/r8169.c ++++ b/drivers/net/ethernet/realtek/r8169.c +@@ -324,6 +324,8 @@ enum cfg_version { + }; + + static const struct pci_device_id rtl8169_pci_tbl[] = { ++ { PCI_VDEVICE(REALTEK, 0x2502), RTL_CFG_1 }, ++ { PCI_VDEVICE(REALTEK, 0x2600), RTL_CFG_1 }, + { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8129), 0, 0, RTL_CFG_0 }, + { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8136), 0, 0, RTL_CFG_2 }, + { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8161), 0, 0, RTL_CFG_1 },