Skip to content

Commit 825464e

Browse files
committed
Merge tag 'net-5.19-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Pull networking fixes from Paolo Abeni: "Including fixes from bpf and netfilter. Current release - regressions: - eth: amt: fix possible null-ptr-deref in amt_rcv() Previous releases - regressions: - tcp: use alloc_large_system_hash() to allocate table_perturb - af_unix: fix a data-race in unix_dgram_peer_wake_me() - nfc: st21nfca: fix memory leaks in EVT_TRANSACTION handling - eth: ixgbe: fix unexpected VLAN rx in promisc mode on VF Previous releases - always broken: - ipv6: fix signed integer overflow in __ip6_append_data - netfilter: - nat: really support inet nat without l3 address - nf_tables: memleak flow rule from commit path - bpf: fix calling global functions from BPF_PROG_TYPE_EXT programs - openvswitch: fix misuse of the cached connection on tuple changes - nfc: nfcmrvl: fix memory leak in nfcmrvl_play_deferred - eth: altera: fix refcount leak in altera_tse_mdio_create Misc: - add Quentin Monnet to bpftool maintainers" * tag 'net-5.19-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (45 commits) net: amd-xgbe: fix clang -Wformat warning tcp: use alloc_large_system_hash() to allocate table_perturb net: dsa: realtek: rtl8365mb: fix GMII caps for ports with internal PHY net: dsa: mv88e6xxx: correctly report serdes link failure net: dsa: mv88e6xxx: fix BMSR error to be consistent with others net: dsa: mv88e6xxx: use BMSR_ANEGCOMPLETE bit for filling an_complete net: altera: Fix refcount leak in altera_tse_mdio_create net: openvswitch: fix misuse of the cached connection on tuple changes net: ethernet: mtk_eth_soc: fix misuse of mem alloc interface netdev[napi]_alloc_frag ip_gre: test csum_start instead of transport header au1000_eth: stop using virt_to_bus() ipv6: Fix signed integer overflow in l2tp_ip6_sendmsg ipv6: Fix signed integer overflow in __ip6_append_data nfc: nfcmrvl: Fix memory leak in nfcmrvl_play_deferred nfc: st21nfca: fix incorrect sizing calculations in EVT_TRANSACTION nfc: st21nfca: fix memory leaks in EVT_TRANSACTION handling nfc: st21nfca: fix incorrect validating logic in EVT_TRANSACTION net: ipv6: unexport __init-annotated seg6_hmac_init() net: xfrm: unexport __init-annotated xfrm4_protocol_init() net: mdio: unexport __init-annotated mdio_bus_init() ...
2 parents 507160f + 647df0d commit 825464e

File tree

44 files changed

+367
-189
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+367
-189
lines changed

MAINTAINERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3757,6 +3757,13 @@ F: include/linux/bpf_lsm.h
37573757
F: kernel/bpf/bpf_lsm.c
37583758
F: security/bpf/
37593759

3760+
BPFTOOL
3761+
M: Quentin Monnet <[email protected]>
3762+
3763+
S: Maintained
3764+
F: kernel/bpf/disasm.*
3765+
F: tools/bpf/bpftool/
3766+
37603767
BROADCOM B44 10/100 ETHERNET DRIVER
37613768
M: Michael Chan <[email protected]>
37623769

arch/arm64/net/bpf_jit_comp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,6 +1478,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
14781478
bpf_jit_binary_free(header);
14791479
prog->bpf_func = NULL;
14801480
prog->jited = 0;
1481+
prog->jited_len = 0;
14811482
goto out_off;
14821483
}
14831484
bpf_jit_binary_lock_ro(header);

drivers/net/amt.c

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ static char *status_str[] = {
5151
};
5252

5353
static char *type_str[] = {
54+
"", /* Type 0 is not defined */
5455
"AMT_MSG_DISCOVERY",
5556
"AMT_MSG_ADVERTISEMENT",
5657
"AMT_MSG_REQUEST",
@@ -2220,8 +2221,7 @@ static bool amt_advertisement_handler(struct amt_dev *amt, struct sk_buff *skb)
22202221
struct amt_header_advertisement *amta;
22212222
int hdr_size;
22222223

2223-
hdr_size = sizeof(*amta) - sizeof(struct amt_header);
2224-
2224+
hdr_size = sizeof(*amta) + sizeof(struct udphdr);
22252225
if (!pskb_may_pull(skb, hdr_size))
22262226
return true;
22272227

@@ -2251,19 +2251,27 @@ static bool amt_multicast_data_handler(struct amt_dev *amt, struct sk_buff *skb)
22512251
struct ethhdr *eth;
22522252
struct iphdr *iph;
22532253

2254+
hdr_size = sizeof(*amtmd) + sizeof(struct udphdr);
2255+
if (!pskb_may_pull(skb, hdr_size))
2256+
return true;
2257+
22542258
amtmd = (struct amt_header_mcast_data *)(udp_hdr(skb) + 1);
22552259
if (amtmd->reserved || amtmd->version)
22562260
return true;
22572261

2258-
hdr_size = sizeof(*amtmd) + sizeof(struct udphdr);
22592262
if (iptunnel_pull_header(skb, hdr_size, htons(ETH_P_IP), false))
22602263
return true;
2264+
22612265
skb_reset_network_header(skb);
22622266
skb_push(skb, sizeof(*eth));
22632267
skb_reset_mac_header(skb);
22642268
skb_pull(skb, sizeof(*eth));
22652269
eth = eth_hdr(skb);
2270+
2271+
if (!pskb_may_pull(skb, sizeof(*iph)))
2272+
return true;
22662273
iph = ip_hdr(skb);
2274+
22672275
if (iph->version == 4) {
22682276
if (!ipv4_is_multicast(iph->daddr))
22692277
return true;
@@ -2274,6 +2282,9 @@ static bool amt_multicast_data_handler(struct amt_dev *amt, struct sk_buff *skb)
22742282
} else if (iph->version == 6) {
22752283
struct ipv6hdr *ip6h;
22762284

2285+
if (!pskb_may_pull(skb, sizeof(*ip6h)))
2286+
return true;
2287+
22772288
ip6h = ipv6_hdr(skb);
22782289
if (!ipv6_addr_is_multicast(&ip6h->daddr))
22792290
return true;
@@ -2306,31 +2317,35 @@ static bool amt_membership_query_handler(struct amt_dev *amt,
23062317
struct iphdr *iph;
23072318
int hdr_size, len;
23082319

2309-
hdr_size = sizeof(*amtmq) - sizeof(struct amt_header);
2310-
2320+
hdr_size = sizeof(*amtmq) + sizeof(struct udphdr);
23112321
if (!pskb_may_pull(skb, hdr_size))
23122322
return true;
23132323

23142324
amtmq = (struct amt_header_membership_query *)(udp_hdr(skb) + 1);
23152325
if (amtmq->reserved || amtmq->version)
23162326
return true;
23172327

2318-
hdr_size = sizeof(*amtmq) + sizeof(struct udphdr) - sizeof(*eth);
2328+
hdr_size -= sizeof(*eth);
23192329
if (iptunnel_pull_header(skb, hdr_size, htons(ETH_P_TEB), false))
23202330
return true;
2331+
23212332
oeth = eth_hdr(skb);
23222333
skb_reset_mac_header(skb);
23232334
skb_pull(skb, sizeof(*eth));
23242335
skb_reset_network_header(skb);
23252336
eth = eth_hdr(skb);
2337+
if (!pskb_may_pull(skb, sizeof(*iph)))
2338+
return true;
2339+
23262340
iph = ip_hdr(skb);
23272341
if (iph->version == 4) {
2328-
if (!ipv4_is_multicast(iph->daddr))
2329-
return true;
23302342
if (!pskb_may_pull(skb, sizeof(*iph) + AMT_IPHDR_OPTS +
23312343
sizeof(*ihv3)))
23322344
return true;
23332345

2346+
if (!ipv4_is_multicast(iph->daddr))
2347+
return true;
2348+
23342349
ihv3 = skb_pull(skb, sizeof(*iph) + AMT_IPHDR_OPTS);
23352350
skb_reset_transport_header(skb);
23362351
skb_push(skb, sizeof(*iph) + AMT_IPHDR_OPTS);
@@ -2345,15 +2360,17 @@ static bool amt_membership_query_handler(struct amt_dev *amt,
23452360
ip_eth_mc_map(iph->daddr, eth->h_dest);
23462361
#if IS_ENABLED(CONFIG_IPV6)
23472362
} else if (iph->version == 6) {
2348-
struct ipv6hdr *ip6h = ipv6_hdr(skb);
23492363
struct mld2_query *mld2q;
2364+
struct ipv6hdr *ip6h;
23502365

2351-
if (!ipv6_addr_is_multicast(&ip6h->daddr))
2352-
return true;
23532366
if (!pskb_may_pull(skb, sizeof(*ip6h) + AMT_IP6HDR_OPTS +
23542367
sizeof(*mld2q)))
23552368
return true;
23562369

2370+
ip6h = ipv6_hdr(skb);
2371+
if (!ipv6_addr_is_multicast(&ip6h->daddr))
2372+
return true;
2373+
23572374
mld2q = skb_pull(skb, sizeof(*ip6h) + AMT_IP6HDR_OPTS);
23582375
skb_reset_transport_header(skb);
23592376
skb_push(skb, sizeof(*ip6h) + AMT_IP6HDR_OPTS);
@@ -2389,23 +2406,23 @@ static bool amt_update_handler(struct amt_dev *amt, struct sk_buff *skb)
23892406
{
23902407
struct amt_header_membership_update *amtmu;
23912408
struct amt_tunnel_list *tunnel;
2392-
struct udphdr *udph;
23932409
struct ethhdr *eth;
23942410
struct iphdr *iph;
2395-
int len;
2411+
int len, hdr_size;
23962412

23972413
iph = ip_hdr(skb);
2398-
udph = udp_hdr(skb);
23992414

2400-
if (__iptunnel_pull_header(skb, sizeof(*udph), skb->protocol,
2401-
false, false))
2415+
hdr_size = sizeof(*amtmu) + sizeof(struct udphdr);
2416+
if (!pskb_may_pull(skb, hdr_size))
24022417
return true;
24032418

2404-
amtmu = (struct amt_header_membership_update *)skb->data;
2419+
amtmu = (struct amt_header_membership_update *)(udp_hdr(skb) + 1);
24052420
if (amtmu->reserved || amtmu->version)
24062421
return true;
24072422

2408-
skb_pull(skb, sizeof(*amtmu));
2423+
if (iptunnel_pull_header(skb, hdr_size, skb->protocol, false))
2424+
return true;
2425+
24092426
skb_reset_network_header(skb);
24102427

24112428
list_for_each_entry_rcu(tunnel, &amt->tunnel_list, list) {
@@ -2426,6 +2443,9 @@ static bool amt_update_handler(struct amt_dev *amt, struct sk_buff *skb)
24262443
return true;
24272444

24282445
report:
2446+
if (!pskb_may_pull(skb, sizeof(*iph)))
2447+
return true;
2448+
24292449
iph = ip_hdr(skb);
24302450
if (iph->version == 4) {
24312451
if (ip_mc_check_igmp(skb)) {
@@ -2679,7 +2699,8 @@ static int amt_rcv(struct sock *sk, struct sk_buff *skb)
26792699
amt = rcu_dereference_sk_user_data(sk);
26802700
if (!amt) {
26812701
err = true;
2682-
goto drop;
2702+
kfree_skb(skb);
2703+
goto out;
26832704
}
26842705

26852706
skb->dev = amt->dev;

drivers/net/dsa/lantiq_gswip.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2070,8 +2070,10 @@ static int gswip_gphy_fw_list(struct gswip_priv *priv,
20702070
for_each_available_child_of_node(gphy_fw_list_np, gphy_fw_np) {
20712071
err = gswip_gphy_fw_probe(priv, &priv->gphy_fw[i],
20722072
gphy_fw_np, i);
2073-
if (err)
2073+
if (err) {
2074+
of_node_put(gphy_fw_np);
20742075
goto remove_gphy;
2076+
}
20752077
i++;
20762078
}
20772079

drivers/net/dsa/mv88e6xxx/serdes.c

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,25 @@ static int mv88e6390_serdes_write(struct mv88e6xxx_chip *chip,
5050
}
5151

5252
static int mv88e6xxx_serdes_pcs_get_state(struct mv88e6xxx_chip *chip,
53-
u16 ctrl, u16 status, u16 lpa,
53+
u16 bmsr, u16 lpa, u16 status,
5454
struct phylink_link_state *state)
5555
{
56+
state->link = false;
57+
58+
/* If the BMSR reports that the link had failed, report this to
59+
* phylink.
60+
*/
61+
if (!(bmsr & BMSR_LSTATUS))
62+
return 0;
63+
5664
state->link = !!(status & MV88E6390_SGMII_PHY_STATUS_LINK);
65+
state->an_complete = !!(bmsr & BMSR_ANEGCOMPLETE);
5766

5867
if (status & MV88E6390_SGMII_PHY_STATUS_SPD_DPL_VALID) {
5968
/* The Spped and Duplex Resolved register is 1 if AN is enabled
6069
* and complete, or if AN is disabled. So with disabled AN we
61-
* still get here on link up. But we want to set an_complete
62-
* only if AN was enabled, thus we look at BMCR_ANENABLE.
63-
* (According to 802.3-2008 section 22.2.4.2.10, we should be
64-
* able to get this same value from BMSR_ANEGCAPABLE, but tests
65-
* show that these Marvell PHYs don't conform to this part of
66-
* the specificaion - BMSR_ANEGCAPABLE is simply always 1.)
70+
* still get here on link up.
6771
*/
68-
state->an_complete = !!(ctrl & BMCR_ANENABLE);
6972
state->duplex = status &
7073
MV88E6390_SGMII_PHY_STATUS_DUPLEX_FULL ?
7174
DUPLEX_FULL : DUPLEX_HALF;
@@ -191,12 +194,12 @@ int mv88e6352_serdes_pcs_config(struct mv88e6xxx_chip *chip, int port,
191194
int mv88e6352_serdes_pcs_get_state(struct mv88e6xxx_chip *chip, int port,
192195
int lane, struct phylink_link_state *state)
193196
{
194-
u16 lpa, status, ctrl;
197+
u16 bmsr, lpa, status;
195198
int err;
196199

197-
err = mv88e6352_serdes_read(chip, MII_BMCR, &ctrl);
200+
err = mv88e6352_serdes_read(chip, MII_BMSR, &bmsr);
198201
if (err) {
199-
dev_err(chip->dev, "can't read Serdes PHY control: %d\n", err);
202+
dev_err(chip->dev, "can't read Serdes PHY BMSR: %d\n", err);
200203
return err;
201204
}
202205

@@ -212,7 +215,7 @@ int mv88e6352_serdes_pcs_get_state(struct mv88e6xxx_chip *chip, int port,
212215
return err;
213216
}
214217

215-
return mv88e6xxx_serdes_pcs_get_state(chip, ctrl, status, lpa, state);
218+
return mv88e6xxx_serdes_pcs_get_state(chip, bmsr, lpa, status, state);
216219
}
217220

218221
int mv88e6352_serdes_pcs_an_restart(struct mv88e6xxx_chip *chip, int port,
@@ -918,13 +921,13 @@ int mv88e6390_serdes_pcs_config(struct mv88e6xxx_chip *chip, int port,
918921
static int mv88e6390_serdes_pcs_get_state_sgmii(struct mv88e6xxx_chip *chip,
919922
int port, int lane, struct phylink_link_state *state)
920923
{
921-
u16 lpa, status, ctrl;
924+
u16 bmsr, lpa, status;
922925
int err;
923926

924927
err = mv88e6390_serdes_read(chip, lane, MDIO_MMD_PHYXS,
925-
MV88E6390_SGMII_BMCR, &ctrl);
928+
MV88E6390_SGMII_BMSR, &bmsr);
926929
if (err) {
927-
dev_err(chip->dev, "can't read Serdes PHY control: %d\n", err);
930+
dev_err(chip->dev, "can't read Serdes PHY BMSR: %d\n", err);
928931
return err;
929932
}
930933

@@ -942,7 +945,7 @@ static int mv88e6390_serdes_pcs_get_state_sgmii(struct mv88e6xxx_chip *chip,
942945
return err;
943946
}
944947

945-
return mv88e6xxx_serdes_pcs_get_state(chip, ctrl, status, lpa, state);
948+
return mv88e6xxx_serdes_pcs_get_state(chip, bmsr, lpa, status, state);
946949
}
947950

948951
static int mv88e6390_serdes_pcs_get_state_10g(struct mv88e6xxx_chip *chip,

drivers/net/dsa/realtek/rtl8365mb.c

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -955,35 +955,21 @@ static int rtl8365mb_ext_config_forcemode(struct realtek_priv *priv, int port,
955955
return 0;
956956
}
957957

958-
static bool rtl8365mb_phy_mode_supported(struct dsa_switch *ds, int port,
959-
phy_interface_t interface)
960-
{
961-
int ext_int;
962-
963-
ext_int = rtl8365mb_extint_port_map[port];
964-
965-
if (ext_int < 0 &&
966-
(interface == PHY_INTERFACE_MODE_NA ||
967-
interface == PHY_INTERFACE_MODE_INTERNAL ||
968-
interface == PHY_INTERFACE_MODE_GMII))
969-
/* Internal PHY */
970-
return true;
971-
else if ((ext_int >= 1) &&
972-
phy_interface_mode_is_rgmii(interface))
973-
/* Extension MAC */
974-
return true;
975-
976-
return false;
977-
}
978-
979958
static void rtl8365mb_phylink_get_caps(struct dsa_switch *ds, int port,
980959
struct phylink_config *config)
981960
{
982-
if (dsa_is_user_port(ds, port))
961+
if (dsa_is_user_port(ds, port)) {
983962
__set_bit(PHY_INTERFACE_MODE_INTERNAL,
984963
config->supported_interfaces);
985-
else if (dsa_is_cpu_port(ds, port))
964+
965+
/* GMII is the default interface mode for phylib, so
966+
* we have to support it for ports with integrated PHY.
967+
*/
968+
__set_bit(PHY_INTERFACE_MODE_GMII,
969+
config->supported_interfaces);
970+
} else if (dsa_is_cpu_port(ds, port)) {
986971
phy_interface_set_rgmii(config->supported_interfaces);
972+
}
987973

988974
config->mac_capabilities = MAC_SYM_PAUSE | MAC_ASYM_PAUSE |
989975
MAC_10 | MAC_100 | MAC_1000FD;
@@ -996,12 +982,6 @@ static void rtl8365mb_phylink_mac_config(struct dsa_switch *ds, int port,
996982
struct realtek_priv *priv = ds->priv;
997983
int ret;
998984

999-
if (!rtl8365mb_phy_mode_supported(ds, port, state->interface)) {
1000-
dev_err(priv->dev, "phy mode %s is unsupported on port %d\n",
1001-
phy_modes(state->interface), port);
1002-
return;
1003-
}
1004-
1005985
if (mode != MLO_AN_PHY && mode != MLO_AN_FIXED) {
1006986
dev_err(priv->dev,
1007987
"port %d supports only conventional PHY or fixed-link\n",

drivers/net/ethernet/altera/altera_tse_main.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ static int altera_tse_mdio_create(struct net_device *dev, unsigned int id)
163163
mdio = mdiobus_alloc();
164164
if (mdio == NULL) {
165165
netdev_err(dev, "Error allocating MDIO bus\n");
166-
return -ENOMEM;
166+
ret = -ENOMEM;
167+
goto put_node;
167168
}
168169

169170
mdio->name = ALTERA_TSE_RESOURCE_NAME;
@@ -180,6 +181,7 @@ static int altera_tse_mdio_create(struct net_device *dev, unsigned int id)
180181
mdio->id);
181182
goto out_free_mdio;
182183
}
184+
of_node_put(mdio_node);
183185

184186
if (netif_msg_drv(priv))
185187
netdev_info(dev, "MDIO bus %s: created\n", mdio->id);
@@ -189,6 +191,8 @@ static int altera_tse_mdio_create(struct net_device *dev, unsigned int id)
189191
out_free_mdio:
190192
mdiobus_free(mdio);
191193
mdio = NULL;
194+
put_node:
195+
of_node_put(mdio_node);
192196
return ret;
193197
}
194198

0 commit comments

Comments
 (0)