Skip to content

Commit 6d36c72

Browse files
committed
Merge tag 'net-6.1-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Pull networking fixes from Paolo Abeni: "Including fixes from netfilter. Current release - regressions: - revert "net: fix cpu_max_bits_warn() usage in netif_attrmask_next{,_and}" - revert "net: sched: fq_codel: remove redundant resource cleanup in fq_codel_init()" - dsa: uninitialized variable in dsa_slave_netdevice_event() - eth: sunhme: uninitialized variable in happy_meal_init() Current release - new code bugs: - eth: octeontx2: fix resource not freed after malloc Previous releases - regressions: - sched: fix return value of qdisc ingress handling on success - sched: fix race condition in qdisc_graft() - udp: update reuse->has_conns under reuseport_lock. - tls: strp: make sure the TCP skbs do not have overlapping data - hsr: avoid possible NULL deref in skb_clone() - tipc: fix an information leak in tipc_topsrv_kern_subscr - phylink: add mac_managed_pm in phylink_config structure - eth: i40e: fix DMA mappings leak - eth: hyperv: fix a RX-path warning - eth: mtk: fix memory leaks Previous releases - always broken: - sched: cake: fix null pointer access issue when cake_init() fails" * tag 'net-6.1-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (43 commits) net: phy: dp83822: disable MDI crossover status change interrupt net: sched: fix race condition in qdisc_graft() net: hns: fix possible memory leak in hnae_ae_register() wwan_hwsim: fix possible memory leak in wwan_hwsim_dev_new() sfc: include vport_id in filter spec hash and equal() genetlink: fix kdoc warnings selftests: add selftest for chaining of tc ingress handling to egress net: Fix return value of qdisc ingress handling on success net: sched: sfb: fix null pointer access issue when sfb_init() fails Revert "net: sched: fq_codel: remove redundant resource cleanup in fq_codel_init()" net: sched: cake: fix null pointer access issue when cake_init() fails ethernet: marvell: octeontx2 Fix resource not freed after malloc netfilter: nf_tables: relax NFTA_SET_ELEM_KEY_END set flags requirements netfilter: rpfilter/fib: Set ->flowic_uid correctly for user namespaces. ionic: catch NULL pointer issue on reconfig net: hsr: avoid possible NULL deref in skb_clone() bnxt_en: fix memory leak in bnxt_nvm_test() ip6mr: fix UAF issue in ip6mr_sk_done() when addrconf_init_net() failed udp: Update reuse->has_conns under reuseport_lock. net: ethernet: mediatek: ppe: Remove the unused function mtk_foe_entry_usable() ...
2 parents c7b0065 + 7f378c0 commit 6d36c72

Some content is hidden

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

58 files changed

+432
-185
lines changed

Documentation/devicetree/bindings/net/nfc/samsung,s3fwrn5.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ title: Samsung S3FWRN5 NCI NFC Controller
88

99
maintainers:
1010
- Krzysztof Kozlowski <[email protected]>
11-
- Krzysztof Opasiak <[email protected]>
1211

1312
properties:
1413
compatible:

MAINTAINERS

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18215,7 +18215,6 @@ F: include/media/drv-intf/s3c_camif.h
1821518215

1821618216
SAMSUNG S3FWRN5 NFC DRIVER
1821718217
M: Krzysztof Kozlowski <[email protected]>
18218-
M: Krzysztof Opasiak <[email protected]>
1821918218
L: [email protected] (subscribers-only)
1822018219
S: Maintained
1822118220
F: Documentation/devicetree/bindings/net/nfc/samsung,s3fwrn5.yaml
@@ -21297,7 +21296,7 @@ L: [email protected]
2129721296
2129821297
S: Maintained
2129921298
W: https://github.com/petkan/pegasus
21300-
T: git git://github.com/petkan/pegasus.git
21299+
T: git https://github.com/petkan/pegasus.git
2130121300
F: drivers/net/usb/pegasus.*
2130221301

2130321302
USB PHY LAYER
@@ -21334,7 +21333,7 @@ L: [email protected]
2133421333
2133521334
S: Maintained
2133621335
W: https://github.com/petkan/rtl8150
21337-
T: git git://github.com/petkan/rtl8150.git
21336+
T: git https://github.com/petkan/rtl8150.git
2133821337
F: drivers/net/usb/rtl8150.c
2133921338

2134021339
USB SERIAL SUBSYSTEM

drivers/net/dsa/qca/qca8k-8xxx.c

Lines changed: 55 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -137,27 +137,42 @@ static void qca8k_rw_reg_ack_handler(struct dsa_switch *ds, struct sk_buff *skb)
137137
struct qca8k_mgmt_eth_data *mgmt_eth_data;
138138
struct qca8k_priv *priv = ds->priv;
139139
struct qca_mgmt_ethhdr *mgmt_ethhdr;
140+
u32 command;
140141
u8 len, cmd;
142+
int i;
141143

142144
mgmt_ethhdr = (struct qca_mgmt_ethhdr *)skb_mac_header(skb);
143145
mgmt_eth_data = &priv->mgmt_eth_data;
144146

145-
cmd = FIELD_GET(QCA_HDR_MGMT_CMD, mgmt_ethhdr->command);
146-
len = FIELD_GET(QCA_HDR_MGMT_LENGTH, mgmt_ethhdr->command);
147+
command = get_unaligned_le32(&mgmt_ethhdr->command);
148+
cmd = FIELD_GET(QCA_HDR_MGMT_CMD, command);
149+
len = FIELD_GET(QCA_HDR_MGMT_LENGTH, command);
147150

148151
/* Make sure the seq match the requested packet */
149-
if (mgmt_ethhdr->seq == mgmt_eth_data->seq)
152+
if (get_unaligned_le32(&mgmt_ethhdr->seq) == mgmt_eth_data->seq)
150153
mgmt_eth_data->ack = true;
151154

152155
if (cmd == MDIO_READ) {
153-
mgmt_eth_data->data[0] = mgmt_ethhdr->mdio_data;
156+
u32 *val = mgmt_eth_data->data;
157+
158+
*val = get_unaligned_le32(&mgmt_ethhdr->mdio_data);
154159

155160
/* Get the rest of the 12 byte of data.
156161
* The read/write function will extract the requested data.
157162
*/
158-
if (len > QCA_HDR_MGMT_DATA1_LEN)
159-
memcpy(mgmt_eth_data->data + 1, skb->data,
160-
QCA_HDR_MGMT_DATA2_LEN);
163+
if (len > QCA_HDR_MGMT_DATA1_LEN) {
164+
__le32 *data2 = (__le32 *)skb->data;
165+
int data_len = min_t(int, QCA_HDR_MGMT_DATA2_LEN,
166+
len - QCA_HDR_MGMT_DATA1_LEN);
167+
168+
val++;
169+
170+
for (i = sizeof(u32); i <= data_len; i += sizeof(u32)) {
171+
*val = get_unaligned_le32(data2);
172+
val++;
173+
data2++;
174+
}
175+
}
161176
}
162177

163178
complete(&mgmt_eth_data->rw_done);
@@ -169,8 +184,10 @@ static struct sk_buff *qca8k_alloc_mdio_header(enum mdio_cmd cmd, u32 reg, u32 *
169184
struct qca_mgmt_ethhdr *mgmt_ethhdr;
170185
unsigned int real_len;
171186
struct sk_buff *skb;
172-
u32 *data2;
187+
__le32 *data2;
188+
u32 command;
173189
u16 hdr;
190+
int i;
174191

175192
skb = dev_alloc_skb(QCA_HDR_MGMT_PKT_LEN);
176193
if (!skb)
@@ -199,30 +216,44 @@ static struct sk_buff *qca8k_alloc_mdio_header(enum mdio_cmd cmd, u32 reg, u32 *
199216
hdr |= FIELD_PREP(QCA_HDR_XMIT_DP_BIT, BIT(0));
200217
hdr |= FIELD_PREP(QCA_HDR_XMIT_CONTROL, QCA_HDR_XMIT_TYPE_RW_REG);
201218

202-
mgmt_ethhdr->command = FIELD_PREP(QCA_HDR_MGMT_ADDR, reg);
203-
mgmt_ethhdr->command |= FIELD_PREP(QCA_HDR_MGMT_LENGTH, real_len);
204-
mgmt_ethhdr->command |= FIELD_PREP(QCA_HDR_MGMT_CMD, cmd);
205-
mgmt_ethhdr->command |= FIELD_PREP(QCA_HDR_MGMT_CHECK_CODE,
219+
command = FIELD_PREP(QCA_HDR_MGMT_ADDR, reg);
220+
command |= FIELD_PREP(QCA_HDR_MGMT_LENGTH, real_len);
221+
command |= FIELD_PREP(QCA_HDR_MGMT_CMD, cmd);
222+
command |= FIELD_PREP(QCA_HDR_MGMT_CHECK_CODE,
206223
QCA_HDR_MGMT_CHECK_CODE_VAL);
207224

225+
put_unaligned_le32(command, &mgmt_ethhdr->command);
226+
208227
if (cmd == MDIO_WRITE)
209-
mgmt_ethhdr->mdio_data = *val;
228+
put_unaligned_le32(*val, &mgmt_ethhdr->mdio_data);
210229

211230
mgmt_ethhdr->hdr = htons(hdr);
212231

213232
data2 = skb_put_zero(skb, QCA_HDR_MGMT_DATA2_LEN + QCA_HDR_MGMT_PADDING_LEN);
214-
if (cmd == MDIO_WRITE && len > QCA_HDR_MGMT_DATA1_LEN)
215-
memcpy(data2, val + 1, len - QCA_HDR_MGMT_DATA1_LEN);
233+
if (cmd == MDIO_WRITE && len > QCA_HDR_MGMT_DATA1_LEN) {
234+
int data_len = min_t(int, QCA_HDR_MGMT_DATA2_LEN,
235+
len - QCA_HDR_MGMT_DATA1_LEN);
236+
237+
val++;
238+
239+
for (i = sizeof(u32); i <= data_len; i += sizeof(u32)) {
240+
put_unaligned_le32(*val, data2);
241+
data2++;
242+
val++;
243+
}
244+
}
216245

217246
return skb;
218247
}
219248

220249
static void qca8k_mdio_header_fill_seq_num(struct sk_buff *skb, u32 seq_num)
221250
{
222251
struct qca_mgmt_ethhdr *mgmt_ethhdr;
252+
u32 seq;
223253

254+
seq = FIELD_PREP(QCA_HDR_MGMT_SEQ_NUM, seq_num);
224255
mgmt_ethhdr = (struct qca_mgmt_ethhdr *)skb->data;
225-
mgmt_ethhdr->seq = FIELD_PREP(QCA_HDR_MGMT_SEQ_NUM, seq_num);
256+
put_unaligned_le32(seq, &mgmt_ethhdr->seq);
226257
}
227258

228259
static int qca8k_read_eth(struct qca8k_priv *priv, u32 reg, u32 *val, int len)
@@ -1487,9 +1518,9 @@ static void qca8k_mib_autocast_handler(struct dsa_switch *ds, struct sk_buff *sk
14871518
struct qca8k_priv *priv = ds->priv;
14881519
const struct qca8k_mib_desc *mib;
14891520
struct mib_ethhdr *mib_ethhdr;
1490-
int i, mib_len, offset = 0;
1491-
u64 *data;
1521+
__le32 *data2;
14921522
u8 port;
1523+
int i;
14931524

14941525
mib_ethhdr = (struct mib_ethhdr *)skb_mac_header(skb);
14951526
mib_eth_data = &priv->mib_eth_data;
@@ -1501,28 +1532,24 @@ static void qca8k_mib_autocast_handler(struct dsa_switch *ds, struct sk_buff *sk
15011532
if (port != mib_eth_data->req_port)
15021533
goto exit;
15031534

1504-
data = mib_eth_data->data;
1535+
data2 = (__le32 *)skb->data;
15051536

15061537
for (i = 0; i < priv->info->mib_count; i++) {
15071538
mib = &ar8327_mib[i];
15081539

15091540
/* First 3 mib are present in the skb head */
15101541
if (i < 3) {
1511-
data[i] = mib_ethhdr->data[i];
1542+
mib_eth_data->data[i] = get_unaligned_le32(mib_ethhdr->data + i);
15121543
continue;
15131544
}
15141545

1515-
mib_len = sizeof(uint32_t);
1516-
15171546
/* Some mib are 64 bit wide */
15181547
if (mib->size == 2)
1519-
mib_len = sizeof(uint64_t);
1520-
1521-
/* Copy the mib value from packet to the */
1522-
memcpy(data + i, skb->data + offset, mib_len);
1548+
mib_eth_data->data[i] = get_unaligned_le64((__le64 *)data2);
1549+
else
1550+
mib_eth_data->data[i] = get_unaligned_le32(data2);
15231551

1524-
/* Set the offset for the next mib */
1525-
offset += mib_len;
1552+
data2 += mib->size;
15261553
}
15271554

15281555
exit:

drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,7 @@ static int bnxt_dl_reload_up(struct devlink *dl, enum devlink_reload_action acti
613613

614614
static bool bnxt_nvm_test(struct bnxt *bp, struct netlink_ext_ack *extack)
615615
{
616+
bool rc = false;
616617
u32 datalen;
617618
u16 index;
618619
u8 *buf;
@@ -632,20 +633,20 @@ static bool bnxt_nvm_test(struct bnxt *bp, struct netlink_ext_ack *extack)
632633

633634
if (bnxt_get_nvram_item(bp->dev, index, 0, datalen, buf)) {
634635
NL_SET_ERR_MSG_MOD(extack, "nvm test vpd read error");
635-
goto err;
636+
goto done;
636637
}
637638

638639
if (bnxt_flash_nvram(bp->dev, BNX_DIR_TYPE_VPD, BNX_DIR_ORDINAL_FIRST,
639640
BNX_DIR_EXT_NONE, 0, 0, buf, datalen)) {
640641
NL_SET_ERR_MSG_MOD(extack, "nvm test vpd write error");
641-
goto err;
642+
goto done;
642643
}
643644

644-
return true;
645+
rc = true;
645646

646-
err:
647+
done:
647648
kfree(buf);
648-
return false;
649+
return rc;
649650
}
650651

651652
static bool bnxt_dl_selftest_check(struct devlink *dl, unsigned int id,

drivers/net/ethernet/hisilicon/hns/hnae.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,10 @@ int hnae_ae_register(struct hnae_ae_dev *hdev, struct module *owner)
419419
hdev->cls_dev.release = hnae_release;
420420
(void)dev_set_name(&hdev->cls_dev, "hnae%d", hdev->id);
421421
ret = device_register(&hdev->cls_dev);
422-
if (ret)
422+
if (ret) {
423+
put_device(&hdev->cls_dev);
423424
return ret;
425+
}
424426

425427
__module_get(THIS_MODULE);
426428

drivers/net/ethernet/intel/i40e/i40e_ethtool.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2181,9 +2181,6 @@ static int i40e_set_ringparam(struct net_device *netdev,
21812181
*/
21822182
rx_rings[i].tail = hw->hw_addr + I40E_PRTGEN_STATUS;
21832183
err = i40e_setup_rx_descriptors(&rx_rings[i]);
2184-
if (err)
2185-
goto rx_unwind;
2186-
err = i40e_alloc_rx_bi(&rx_rings[i]);
21872184
if (err)
21882185
goto rx_unwind;
21892186

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3566,12 +3566,8 @@ static int i40e_configure_rx_ring(struct i40e_ring *ring)
35663566
if (ring->vsi->type == I40E_VSI_MAIN)
35673567
xdp_rxq_info_unreg_mem_model(&ring->xdp_rxq);
35683568

3569-
kfree(ring->rx_bi);
35703569
ring->xsk_pool = i40e_xsk_pool(ring);
35713570
if (ring->xsk_pool) {
3572-
ret = i40e_alloc_rx_bi_zc(ring);
3573-
if (ret)
3574-
return ret;
35753571
ring->rx_buf_len =
35763572
xsk_pool_get_rx_frame_size(ring->xsk_pool);
35773573
/* For AF_XDP ZC, we disallow packets to span on
@@ -3589,9 +3585,6 @@ static int i40e_configure_rx_ring(struct i40e_ring *ring)
35893585
ring->queue_index);
35903586

35913587
} else {
3592-
ret = i40e_alloc_rx_bi(ring);
3593-
if (ret)
3594-
return ret;
35953588
ring->rx_buf_len = vsi->rx_buf_len;
35963589
if (ring->vsi->type == I40E_VSI_MAIN) {
35973590
ret = xdp_rxq_info_reg_mem_model(&ring->xdp_rxq,
@@ -13296,6 +13289,14 @@ static int i40e_xdp_setup(struct i40e_vsi *vsi, struct bpf_prog *prog,
1329613289
i40e_reset_and_rebuild(pf, true, true);
1329713290
}
1329813291

13292+
if (!i40e_enabled_xdp_vsi(vsi) && prog) {
13293+
if (i40e_realloc_rx_bi_zc(vsi, true))
13294+
return -ENOMEM;
13295+
} else if (i40e_enabled_xdp_vsi(vsi) && !prog) {
13296+
if (i40e_realloc_rx_bi_zc(vsi, false))
13297+
return -ENOMEM;
13298+
}
13299+
1329913300
for (i = 0; i < vsi->num_queue_pairs; i++)
1330013301
WRITE_ONCE(vsi->rx_rings[i]->xdp_prog, vsi->xdp_prog);
1330113302

@@ -13528,6 +13529,7 @@ int i40e_queue_pair_disable(struct i40e_vsi *vsi, int queue_pair)
1352813529

1352913530
i40e_queue_pair_disable_irq(vsi, queue_pair);
1353013531
err = i40e_queue_pair_toggle_rings(vsi, queue_pair, false /* off */);
13532+
i40e_clean_rx_ring(vsi->rx_rings[queue_pair]);
1353113533
i40e_queue_pair_toggle_napi(vsi, queue_pair, false /* off */);
1353213534
i40e_queue_pair_clean_rings(vsi, queue_pair);
1353313535
i40e_queue_pair_reset_stats(vsi, queue_pair);

drivers/net/ethernet/intel/i40e/i40e_txrx.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,14 +1457,6 @@ int i40e_setup_tx_descriptors(struct i40e_ring *tx_ring)
14571457
return -ENOMEM;
14581458
}
14591459

1460-
int i40e_alloc_rx_bi(struct i40e_ring *rx_ring)
1461-
{
1462-
unsigned long sz = sizeof(*rx_ring->rx_bi) * rx_ring->count;
1463-
1464-
rx_ring->rx_bi = kzalloc(sz, GFP_KERNEL);
1465-
return rx_ring->rx_bi ? 0 : -ENOMEM;
1466-
}
1467-
14681460
static void i40e_clear_rx_bi(struct i40e_ring *rx_ring)
14691461
{
14701462
memset(rx_ring->rx_bi, 0, sizeof(*rx_ring->rx_bi) * rx_ring->count);
@@ -1593,6 +1585,11 @@ int i40e_setup_rx_descriptors(struct i40e_ring *rx_ring)
15931585

15941586
rx_ring->xdp_prog = rx_ring->vsi->xdp_prog;
15951587

1588+
rx_ring->rx_bi =
1589+
kcalloc(rx_ring->count, sizeof(*rx_ring->rx_bi), GFP_KERNEL);
1590+
if (!rx_ring->rx_bi)
1591+
return -ENOMEM;
1592+
15961593
return 0;
15971594
}
15981595

drivers/net/ethernet/intel/i40e/i40e_txrx.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,6 @@ int __i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size);
469469
bool __i40e_chk_linearize(struct sk_buff *skb);
470470
int i40e_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames,
471471
u32 flags);
472-
int i40e_alloc_rx_bi(struct i40e_ring *rx_ring);
473472

474473
/**
475474
* i40e_get_head - Retrieve head from head writeback

0 commit comments

Comments
 (0)