Skip to content

Commit 61eb236

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Merge in late fixes in preparation for the net-next PR. Conflicts: drivers/dpll/dpll_core.c drivers/dpll/dpll_netlink.c 33f016b ("dpll: fix NULL deref in dpll_device_ops() during teardown race") b1d0c41 ("dpll: add STATE_CONNECTED_OVERRIDE pin capability") https://lore.kernel.org/aoR9YYY2P5--3x0N@sirena.org.uk https://lore.kernel.org/aoR9VmKllVGwmQn_@sirena.org.uk No adjacent changes. Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents f28ceed + e246639 commit 61eb236

68 files changed

Lines changed: 708 additions & 381 deletions

Some content is hidden

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

drivers/dpll/dpll_core.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -876,14 +876,12 @@ int
876876
dpll_pin_register(struct dpll_device *dpll, struct dpll_pin *pin,
877877
const struct dpll_pin_ops *ops, void *priv)
878878
{
879+
const struct dpll_device_ops *dev_ops;
879880
int ret;
880881

881882
if (WARN_ON(!ops) ||
882883
WARN_ON(!ops->state_on_dpll_get) ||
883884
WARN_ON(!ops->direction_get) ||
884-
WARN_ON(ops->measured_freq_get &&
885-
(!dpll_device_ops(dpll)->freq_monitor_get ||
886-
!dpll_device_ops(dpll)->freq_monitor_set)) ||
887885
WARN_ON(ops->supported_ffo && !ops->ffo_get) ||
888886
WARN_ON((pin->prop.capabilities &
889887
DPLL_PIN_CAPABILITIES_STATE_CONNECTED_OVERRIDE) &&
@@ -893,6 +891,14 @@ dpll_pin_register(struct dpll_device *dpll, struct dpll_pin *pin,
893891

894892
mutex_lock(&dpll_lock);
895893

894+
dev_ops = dpll_device_ops(dpll);
895+
if (WARN_ON(ops->measured_freq_get &&
896+
(!dev_ops || !dev_ops->freq_monitor_get ||
897+
!dev_ops->freq_monitor_set))) {
898+
ret = -EINVAL;
899+
goto out_unlock;
900+
}
901+
896902
/*
897903
* For pins identified via firmware (pin->fwnode), allow registration
898904
* even if the pin's (module, clock_id) differs from the target DPLL.
@@ -1085,19 +1091,17 @@ EXPORT_SYMBOL_GPL(dpll_pin_ref_sync_pair_add);
10851091
static struct dpll_device_registration *
10861092
dpll_device_registration_first(struct dpll_device *dpll)
10871093
{
1088-
struct dpll_device_registration *reg;
1089-
1090-
reg = list_first_entry_or_null((struct list_head *)&dpll->registration_list,
1091-
struct dpll_device_registration, list);
1092-
WARN_ON(!reg);
1093-
return reg;
1094+
return list_first_entry_or_null((struct list_head *)&dpll->registration_list,
1095+
struct dpll_device_registration, list);
10941096
}
10951097

10961098
void *dpll_priv(struct dpll_device *dpll)
10971099
{
10981100
struct dpll_device_registration *reg;
10991101

11001102
reg = dpll_device_registration_first(dpll);
1103+
if (!reg)
1104+
return NULL;
11011105
return reg->priv;
11021106
}
11031107

@@ -1106,6 +1110,8 @@ const struct dpll_device_ops *dpll_device_ops(struct dpll_device *dpll)
11061110
struct dpll_device_registration *reg;
11071111

11081112
reg = dpll_device_registration_first(dpll);
1113+
if (!reg)
1114+
return NULL;
11091115
return reg->ops;
11101116
}
11111117

drivers/dpll/dpll_netlink.c

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,22 @@ static bool dpll_pin_available(struct dpll_pin *pin)
6666
return false;
6767
}
6868

69+
static bool dpll_device_registered(struct dpll_device *dpll)
70+
{
71+
return dpll_device_ops(dpll);
72+
}
73+
74+
static struct dpll_pin_ref *dpll_pin_first_registered_ref(struct dpll_pin *pin)
75+
{
76+
struct dpll_pin_ref *ref;
77+
unsigned long i;
78+
79+
xa_for_each(&pin->dpll_refs, i, ref)
80+
if (dpll_device_registered(ref->dpll))
81+
return ref;
82+
return NULL;
83+
}
84+
6985
/**
7086
* dpll_msg_add_pin_handle - attach pin handle attribute to a given message
7187
* @msg: pointer to sk_buff message to attach a pin handle
@@ -656,6 +672,8 @@ dpll_msg_add_pin_dplls(struct sk_buff *msg, struct dpll_pin *pin,
656672
int ret;
657673

658674
xa_for_each(&pin->dpll_refs, index, ref) {
675+
if (!dpll_device_registered(ref->dpll))
676+
continue;
659677
attr = nla_nest_start(msg, DPLL_A_PIN_PARENT_DEVICE);
660678
if (!attr)
661679
return -EMSGSIZE;
@@ -700,9 +718,10 @@ dpll_cmd_pin_get_one(struct sk_buff *msg, struct dpll_pin *pin,
700718
int ret;
701719

702720
ref = dpll_pin_own_dpll_ref_first(pin);
721+
if (!ref || !dpll_device_registered(ref->dpll))
722+
ref = dpll_pin_first_registered_ref(pin);
703723
if (!ref)
704-
ref = dpll_xa_ref_dpll_first(&pin->dpll_refs);
705-
ASSERT_NOT_NULL(ref);
724+
return -ENODEV;
706725

707726
ret = dpll_msg_add_pin_handle(msg, pin);
708727
if (ret)
@@ -1090,7 +1109,7 @@ dpll_pin_freq_set(struct dpll_pin *pin, struct nlattr *a,
10901109
}
10911110

10921111
ref = dpll_pin_own_dpll_ref_first(pin);
1093-
if (!ref) {
1112+
if (!ref || !dpll_device_registered(ref->dpll)) {
10941113
NL_SET_ERR_MSG(extack, "pin owner dpll not found");
10951114
return -ENODEV;
10961115
}
@@ -1136,7 +1155,7 @@ dpll_pin_esync_set(struct dpll_pin *pin, struct nlattr *a,
11361155
int ret, i;
11371156

11381157
ref = dpll_pin_own_dpll_ref_first(pin);
1139-
if (!ref) {
1158+
if (!ref || !dpll_device_registered(ref->dpll)) {
11401159
NL_SET_ERR_MSG(extack, "pin owner dpll not found");
11411160
return -ENODEV;
11421161
}
@@ -1201,7 +1220,7 @@ dpll_pin_ref_sync_state_set(struct dpll_pin *pin,
12011220
return -EINVAL;
12021221
}
12031222
ref = dpll_pin_own_dpll_ref_first(pin);
1204-
if (!ref) {
1223+
if (!ref || !dpll_device_registered(ref->dpll)) {
12051224
NL_SET_ERR_MSG(extack, "pin owner dpll not found");
12061225
return -ENODEV;
12071226
}
@@ -1416,7 +1435,7 @@ dpll_pin_phase_adj_set(struct dpll_pin *pin, struct nlattr *phase_adj_attr,
14161435
}
14171436

14181437
ref = dpll_pin_own_dpll_ref_first(pin);
1419-
if (!ref) {
1438+
if (!ref || !dpll_device_registered(ref->dpll)) {
14201439
NL_SET_ERR_MSG(extack, "pin owner dpll not found");
14211440
return -ENODEV;
14221441
}
@@ -1468,7 +1487,7 @@ dpll_pin_parent_device_set(struct dpll_pin *pin, struct nlattr *parent_nest,
14681487
return -EINVAL;
14691488
}
14701489
pdpll_idx = nla_get_u32(tb[DPLL_A_PIN_PARENT_ID]);
1471-
dpll = xa_load(&dpll_device_xa, pdpll_idx);
1490+
dpll = dpll_device_get_by_id(pdpll_idx);
14721491
if (!dpll) {
14731492
NL_SET_ERR_MSG(extack, "parent device not found");
14741493
return -EINVAL;
@@ -1760,6 +1779,10 @@ int dpll_nl_pin_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
17601779
ret = dpll_cmd_pin_get_one(skb, pin, cb->extack);
17611780
if (ret) {
17621781
genlmsg_cancel(skb, hdr);
1782+
if (ret == -ENODEV) {
1783+
ret = 0;
1784+
continue;
1785+
}
17631786
break;
17641787
}
17651788
genlmsg_end(skb, hdr);

drivers/net/bonding/bond_netlink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ static int bond_changelink(struct net_device *bond_dev, struct nlattr *tb[],
220220
struct bonding *bond = netdev_priv(bond_dev);
221221
struct bond_opt_value newval;
222222
int miimon = 0;
223-
int err;
223+
int err = 0;
224224

225225
if (!data)
226226
return 0;

drivers/net/dsa/b53/b53_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2219,7 +2219,7 @@ int b53_fdb_dump(struct dsa_switch *ds, int port,
22192219

22202220
mutex_unlock(&priv->arl_mutex);
22212221

2222-
return 0;
2222+
return ret;
22232223
}
22242224
EXPORT_SYMBOL(b53_fdb_dump);
22252225

drivers/net/dsa/mv88e6xxx/pcs-6352.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,13 +305,16 @@ static bool mv88e6352_pcs_link_check(struct marvell_c22_pcs *mpcs)
305305
struct mv88e6xxx_port *port = mpcs->port;
306306
struct mv88e6xxx_chip *chip = port->chip;
307307
u8 cmode;
308+
int err;
308309

309310
/* Port 4 can be in auto-media mode. Check that the port is
310311
* associated with the mpcs.
311312
*/
312313
mv88e6xxx_reg_lock(chip);
313-
chip->info->ops->port_get_cmode(chip, port->port, &cmode);
314+
err = chip->info->ops->port_get_cmode(chip, port->port, &cmode);
314315
mv88e6xxx_reg_unlock(chip);
316+
if (err)
317+
return false;
315318

316319
return cmode == MV88E6XXX_PORT_STS_CMODE_100BASEX ||
317320
cmode == MV88E6XXX_PORT_STS_CMODE_1000BASEX ||

drivers/net/dsa/realtek/rtl83xx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ void rtl83xx_reset_assert(struct realtek_priv *priv)
321321
"Failed to assert the switch reset control: %pe\n",
322322
ERR_PTR(ret));
323323

324-
gpiod_set_value(priv->reset, true);
324+
gpiod_set_value_cansleep(priv->reset, true);
325325
}
326326

327327
void rtl83xx_reset_deassert(struct realtek_priv *priv)
@@ -334,7 +334,7 @@ void rtl83xx_reset_deassert(struct realtek_priv *priv)
334334
"Failed to deassert the switch reset control: %pe\n",
335335
ERR_PTR(ret));
336336

337-
gpiod_set_value(priv->reset, false);
337+
gpiod_set_value_cansleep(priv->reset, false);
338338
}
339339

340340
/**

drivers/net/ethernet/huawei/hinic3/hinic3_tx.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,7 @@ static int hinic3_tx_csum(struct hinic3_txq *txq, struct hinic3_sq_task *task,
261261
((struct udphdr *)skb_transport_header(skb))->dest !=
262262
VXLAN_OFFLOAD_PORT_LE) {
263263
/* Unsupported tunnel packet, disable csum offload */
264-
skb_checksum_help(skb);
265-
return 0;
264+
return skb_checksum_help(skb);
266265
}
267266
}
268267

@@ -412,6 +411,10 @@ static u32 hinic3_tx_offload(struct sk_buff *skb, struct hinic3_sq_task *task,
412411
offload |= HINIC3_TX_OFFLOAD_TSO;
413412
} else {
414413
tso_cs_en = hinic3_tx_csum(txq, task, skb);
414+
if (tso_cs_en < 0) {
415+
offload = HINIC3_TX_OFFLOAD_INVALID;
416+
return offload;
417+
}
415418
if (tso_cs_en)
416419
offload |= HINIC3_TX_OFFLOAD_CSUM;
417420
}
@@ -545,6 +548,7 @@ static netdev_tx_t hinic3_send_one_skb(struct sk_buff *skb,
545548
skb->len = MIN_SKB_LEN;
546549
}
547550

551+
offload = hinic3_tx_offload(skb, &task, &queue_info, txq);
548552
num_sge = skb_shinfo(skb)->nr_frags + 1;
549553
/* assume normal wqe format + 1 wqebb for task info */
550554
wqebb_cnt = num_sge + 1;
@@ -560,7 +564,6 @@ static netdev_tx_t hinic3_send_one_skb(struct sk_buff *skb,
560564
return NETDEV_TX_BUSY;
561565
}
562566

563-
offload = hinic3_tx_offload(skb, &task, &queue_info, txq);
564567
if (unlikely(offload == HINIC3_TX_OFFLOAD_INVALID)) {
565568
goto err_drop_pkt;
566569
} else if (!offload) {

drivers/net/ethernet/ibm/emac/mal.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ int mal_register_commac(struct mal_instance *mal, struct mal_commac *commac)
3535
{
3636
unsigned long flags;
3737

38+
netdev_lock(mal->napi.dev);
3839
spin_lock_irqsave(&mal->lock, flags);
3940

4041
MAL_DBG(mal, "reg(%08x, %08x)" NL,
@@ -44,18 +45,20 @@ int mal_register_commac(struct mal_instance *mal, struct mal_commac *commac)
4445
if ((mal->tx_chan_mask & commac->tx_chan_mask) ||
4546
(mal->rx_chan_mask & commac->rx_chan_mask)) {
4647
spin_unlock_irqrestore(&mal->lock, flags);
48+
netdev_unlock(mal->napi.dev);
4749
printk(KERN_WARNING "mal%d: COMMAC channels conflict!\n",
4850
mal->index);
4951
return -EBUSY;
5052
}
5153

5254
if (list_empty(&mal->list))
53-
napi_enable(&mal->napi);
55+
napi_enable_locked(&mal->napi);
5456
mal->tx_chan_mask |= commac->tx_chan_mask;
5557
mal->rx_chan_mask |= commac->rx_chan_mask;
5658
list_add(&commac->list, &mal->list);
5759

5860
spin_unlock_irqrestore(&mal->lock, flags);
61+
netdev_unlock(mal->napi.dev);
5962

6063
return 0;
6164
}
@@ -64,7 +67,9 @@ void mal_unregister_commac(struct mal_instance *mal,
6467
struct mal_commac *commac)
6568
{
6669
unsigned long flags;
70+
bool disable_napi;
6771

72+
netdev_lock(mal->napi.dev);
6873
spin_lock_irqsave(&mal->lock, flags);
6974

7075
MAL_DBG(mal, "unreg(%08x, %08x)" NL,
@@ -73,10 +78,12 @@ void mal_unregister_commac(struct mal_instance *mal,
7378
mal->tx_chan_mask &= ~commac->tx_chan_mask;
7479
mal->rx_chan_mask &= ~commac->rx_chan_mask;
7580
list_del_init(&commac->list);
76-
if (list_empty(&mal->list))
77-
napi_disable(&mal->napi);
81+
disable_napi = list_empty(&mal->list);
7882

7983
spin_unlock_irqrestore(&mal->lock, flags);
84+
if (disable_napi)
85+
napi_disable_locked(&mal->napi);
86+
netdev_unlock(mal->napi.dev);
8087
}
8188

8289
int mal_set_rcbs(struct mal_instance *mal, int channel, unsigned long size)

drivers/net/ethernet/intel/ice/devlink/devlink.c

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,27 +1890,18 @@ static int ice_devlink_nvm_snapshot(struct devlink *devlink,
18901890
*/
18911891
for (i = 0; i < num_blks; i++) {
18921892
u32 read_sz = min_t(u32, ICE_DEVLINK_READ_BLK_SIZE, left);
1893-
1894-
status = ice_acquire_nvm(hw, ICE_RES_READ);
1895-
if (status) {
1896-
dev_dbg(dev, "ice_acquire_nvm failed, err %d aq_err %d\n",
1897-
status, hw->adminq.sq_last_status);
1898-
NL_SET_ERR_MSG_MOD(extack, "Failed to acquire NVM semaphore");
1899-
vfree(nvm_data);
1900-
return -EIO;
1901-
}
1893+
enum libie_aq_err read_aq_err = LIBIE_AQ_RC_OK;
19021894

19031895
status = ice_read_flat_nvm(hw, i * ICE_DEVLINK_READ_BLK_SIZE,
1904-
&read_sz, tmp, read_shadow_ram);
1896+
&read_sz, tmp, read_shadow_ram,
1897+
&read_aq_err);
19051898
if (status) {
19061899
dev_dbg(dev, "ice_read_flat_nvm failed after reading %u bytes, err %d aq_err %d\n",
1907-
read_sz, status, hw->adminq.sq_last_status);
1900+
read_sz, status, read_aq_err);
19081901
NL_SET_ERR_MSG_MOD(extack, "Failed to read NVM contents");
1909-
ice_release_nvm(hw);
19101902
vfree(nvm_data);
19111903
return -EIO;
19121904
}
1913-
ice_release_nvm(hw);
19141905

19151906
tmp += read_sz;
19161907
left -= read_sz;
@@ -1943,6 +1934,7 @@ static int ice_devlink_nvm_read(struct devlink *devlink,
19431934
struct netlink_ext_ack *extack,
19441935
u64 offset, u32 size, u8 *data)
19451936
{
1937+
enum libie_aq_err read_aq_err = LIBIE_AQ_RC_OK;
19461938
struct ice_pf *pf = devlink_priv(devlink);
19471939
struct device *dev = ice_pf_to_dev(pf);
19481940
struct ice_hw *hw = &pf->hw;
@@ -1966,24 +1958,14 @@ static int ice_devlink_nvm_read(struct devlink *devlink,
19661958
return -ERANGE;
19671959
}
19681960

1969-
status = ice_acquire_nvm(hw, ICE_RES_READ);
1970-
if (status) {
1971-
dev_dbg(dev, "ice_acquire_nvm failed, err %d aq_err %d\n",
1972-
status, hw->adminq.sq_last_status);
1973-
NL_SET_ERR_MSG_MOD(extack, "Failed to acquire NVM semaphore");
1974-
return -EIO;
1975-
}
1976-
19771961
status = ice_read_flat_nvm(hw, (u32)offset, &size, data,
1978-
read_shadow_ram);
1962+
read_shadow_ram, &read_aq_err);
19791963
if (status) {
19801964
dev_dbg(dev, "ice_read_flat_nvm failed after reading %u bytes, err %d aq_err %d\n",
1981-
size, status, hw->adminq.sq_last_status);
1965+
size, status, read_aq_err);
19821966
NL_SET_ERR_MSG_MOD(extack, "Failed to read NVM contents");
1983-
ice_release_nvm(hw);
19841967
return -EIO;
19851968
}
1986-
ice_release_nvm(hw);
19871969

19881970
return 0;
19891971
}

0 commit comments

Comments
 (0)