Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.19 commit in: /
Date: Sat, 23 Feb 2019 11:35:05
Message-Id: 1550921679.2977abdfac22b14217a40357013c33b40efbef56.mpagano@gentoo
1 commit: 2977abdfac22b14217a40357013c33b40efbef56
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Sat Feb 23 11:34:39 2019 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Sat Feb 23 11:34:39 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=2977abdf
7
8 proj/linux-patches: Linux patch 4.19.25
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1024_linux-4.19.25.patch | 925 +++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 929 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 4b56fba..aee0edf 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -139,6 +139,10 @@ Patch: 1023_linux-4.19.24.patch
21 From: http://www.kernel.org
22 Desc: Linux 4.19.24
23
24 +Patch: 1024_linux-4.19.25.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 4.19.25
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1024_linux-4.19.25.patch b/1024_linux-4.19.25.patch
33 new file mode 100644
34 index 0000000..3dee03e
35 --- /dev/null
36 +++ b/1024_linux-4.19.25.patch
37 @@ -0,0 +1,925 @@
38 +diff --git a/Makefile b/Makefile
39 +index 370ad0d34076..2caa131ff306 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,7 +1,7 @@
43 + # SPDX-License-Identifier: GPL-2.0
44 + VERSION = 4
45 + PATCHLEVEL = 19
46 +-SUBLEVEL = 24
47 ++SUBLEVEL = 25
48 + EXTRAVERSION =
49 + NAME = "People's Front"
50 +
51 +diff --git a/crypto/af_alg.c b/crypto/af_alg.c
52 +index 17eb09d222ff..ec78a04eb136 100644
53 +--- a/crypto/af_alg.c
54 ++++ b/crypto/af_alg.c
55 +@@ -122,8 +122,10 @@ static void alg_do_release(const struct af_alg_type *type, void *private)
56 +
57 + int af_alg_release(struct socket *sock)
58 + {
59 +- if (sock->sk)
60 ++ if (sock->sk) {
61 + sock_put(sock->sk);
62 ++ sock->sk = NULL;
63 ++ }
64 + return 0;
65 + }
66 + EXPORT_SYMBOL_GPL(af_alg_release);
67 +diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c
68 +index 0e30fa00204c..f9b8e3e23a8e 100644
69 +--- a/drivers/hwmon/lm80.c
70 ++++ b/drivers/hwmon/lm80.c
71 +@@ -393,8 +393,10 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr,
72 + }
73 +
74 + rv = lm80_read_value(client, LM80_REG_FANDIV);
75 +- if (rv < 0)
76 ++ if (rv < 0) {
77 ++ mutex_unlock(&data->update_lock);
78 + return rv;
79 ++ }
80 + reg = (rv & ~(3 << (2 * (nr + 1))))
81 + | (data->fan_div[nr] << (2 * (nr + 1)));
82 + lm80_write_value(client, LM80_REG_FANDIV, reg);
83 +diff --git a/drivers/isdn/mISDN/timerdev.c b/drivers/isdn/mISDN/timerdev.c
84 +index 211ed6cffd10..578978711887 100644
85 +--- a/drivers/isdn/mISDN/timerdev.c
86 ++++ b/drivers/isdn/mISDN/timerdev.c
87 +@@ -170,8 +170,8 @@ dev_expire_timer(struct timer_list *t)
88 + spin_lock_irqsave(&timer->dev->lock, flags);
89 + if (timer->id >= 0)
90 + list_move_tail(&timer->list, &timer->dev->expired);
91 +- spin_unlock_irqrestore(&timer->dev->lock, flags);
92 + wake_up_interruptible(&timer->dev->wait);
93 ++ spin_unlock_irqrestore(&timer->dev->lock, flags);
94 + }
95 +
96 + static int
97 +diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
98 +index ef9deaa361c7..ddd98cdd33bc 100644
99 +--- a/drivers/mmc/host/meson-gx-mmc.c
100 ++++ b/drivers/mmc/host/meson-gx-mmc.c
101 +@@ -1286,7 +1286,8 @@ static int meson_mmc_probe(struct platform_device *pdev)
102 + host->regs + SD_EMMC_IRQ_EN);
103 +
104 + ret = request_threaded_irq(host->irq, meson_mmc_irq,
105 +- meson_mmc_irq_thread, IRQF_SHARED, NULL, host);
106 ++ meson_mmc_irq_thread, IRQF_SHARED,
107 ++ dev_name(&pdev->dev), host);
108 + if (ret)
109 + goto err_init_clk;
110 +
111 +diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
112 +index 258918d8a416..9f697a5b8e3d 100644
113 +--- a/drivers/net/dsa/mv88e6xxx/chip.c
114 ++++ b/drivers/net/dsa/mv88e6xxx/chip.c
115 +@@ -261,6 +261,7 @@ static irqreturn_t mv88e6xxx_g1_irq_thread_work(struct mv88e6xxx_chip *chip)
116 + unsigned int sub_irq;
117 + unsigned int n;
118 + u16 reg;
119 ++ u16 ctl1;
120 + int err;
121 +
122 + mutex_lock(&chip->reg_lock);
123 +@@ -270,13 +271,28 @@ static irqreturn_t mv88e6xxx_g1_irq_thread_work(struct mv88e6xxx_chip *chip)
124 + if (err)
125 + goto out;
126 +
127 +- for (n = 0; n < chip->g1_irq.nirqs; ++n) {
128 +- if (reg & (1 << n)) {
129 +- sub_irq = irq_find_mapping(chip->g1_irq.domain, n);
130 +- handle_nested_irq(sub_irq);
131 +- ++nhandled;
132 ++ do {
133 ++ for (n = 0; n < chip->g1_irq.nirqs; ++n) {
134 ++ if (reg & (1 << n)) {
135 ++ sub_irq = irq_find_mapping(chip->g1_irq.domain,
136 ++ n);
137 ++ handle_nested_irq(sub_irq);
138 ++ ++nhandled;
139 ++ }
140 + }
141 +- }
142 ++
143 ++ mutex_lock(&chip->reg_lock);
144 ++ err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, &ctl1);
145 ++ if (err)
146 ++ goto unlock;
147 ++ err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, &reg);
148 ++unlock:
149 ++ mutex_unlock(&chip->reg_lock);
150 ++ if (err)
151 ++ goto out;
152 ++ ctl1 &= GENMASK(chip->g1_irq.nirqs, 0);
153 ++ } while (reg & ctl1);
154 ++
155 + out:
156 + return (nhandled > 0 ? IRQ_HANDLED : IRQ_NONE);
157 + }
158 +diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
159 +index 697d9b374f5e..ae2f35039343 100644
160 +--- a/drivers/net/ethernet/marvell/sky2.c
161 ++++ b/drivers/net/ethernet/marvell/sky2.c
162 +@@ -5087,7 +5087,7 @@ static int sky2_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
163 + INIT_WORK(&hw->restart_work, sky2_restart);
164 +
165 + pci_set_drvdata(pdev, hw);
166 +- pdev->d3_delay = 200;
167 ++ pdev->d3_delay = 300;
168 +
169 + return 0;
170 +
171 +diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
172 +index d64cd8d44d83..a12b5710891e 100644
173 +--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
174 ++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
175 +@@ -841,8 +841,9 @@ int __mlxsw_sp_port_headroom_set(struct mlxsw_sp_port *mlxsw_sp_port, int mtu,
176 + for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
177 + bool configure = false;
178 + bool pfc = false;
179 ++ u16 thres_cells;
180 ++ u16 delay_cells;
181 + bool lossy;
182 +- u16 thres;
183 +
184 + for (j = 0; j < IEEE_8021QAZ_MAX_TCS; j++) {
185 + if (prio_tc[j] == i) {
186 +@@ -856,10 +857,11 @@ int __mlxsw_sp_port_headroom_set(struct mlxsw_sp_port *mlxsw_sp_port, int mtu,
187 + continue;
188 +
189 + lossy = !(pfc || pause_en);
190 +- thres = mlxsw_sp_pg_buf_threshold_get(mlxsw_sp, mtu);
191 +- delay = mlxsw_sp_pg_buf_delay_get(mlxsw_sp, mtu, delay, pfc,
192 +- pause_en);
193 +- mlxsw_sp_pg_buf_pack(pbmc_pl, i, thres + delay, thres, lossy);
194 ++ thres_cells = mlxsw_sp_pg_buf_threshold_get(mlxsw_sp, mtu);
195 ++ delay_cells = mlxsw_sp_pg_buf_delay_get(mlxsw_sp, mtu, delay,
196 ++ pfc, pause_en);
197 ++ mlxsw_sp_pg_buf_pack(pbmc_pl, i, thres_cells + delay_cells,
198 ++ thres_cells, lossy);
199 + }
200 +
201 + return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(pbmc), pbmc_pl);
202 +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
203 +index 20299f6f65fc..736e29635b77 100644
204 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
205 ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
206 +@@ -241,15 +241,18 @@ static inline void dwmac4_get_timestamp(void *desc, u32 ats, u64 *ts)
207 + static int dwmac4_rx_check_timestamp(void *desc)
208 + {
209 + struct dma_desc *p = (struct dma_desc *)desc;
210 ++ unsigned int rdes0 = le32_to_cpu(p->des0);
211 ++ unsigned int rdes1 = le32_to_cpu(p->des1);
212 ++ unsigned int rdes3 = le32_to_cpu(p->des3);
213 + u32 own, ctxt;
214 + int ret = 1;
215 +
216 +- own = p->des3 & RDES3_OWN;
217 +- ctxt = ((p->des3 & RDES3_CONTEXT_DESCRIPTOR)
218 ++ own = rdes3 & RDES3_OWN;
219 ++ ctxt = ((rdes3 & RDES3_CONTEXT_DESCRIPTOR)
220 + >> RDES3_CONTEXT_DESCRIPTOR_SHIFT);
221 +
222 + if (likely(!own && ctxt)) {
223 +- if ((p->des0 == 0xffffffff) && (p->des1 == 0xffffffff))
224 ++ if ((rdes0 == 0xffffffff) && (rdes1 == 0xffffffff))
225 + /* Corrupted value */
226 + ret = -EINVAL;
227 + else
228 +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
229 +index 5710864fa809..9caf79ba5ef1 100644
230 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
231 ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
232 +@@ -692,25 +692,27 @@ static int stmmac_ethtool_op_set_eee(struct net_device *dev,
233 + struct ethtool_eee *edata)
234 + {
235 + struct stmmac_priv *priv = netdev_priv(dev);
236 ++ int ret;
237 +
238 +- priv->eee_enabled = edata->eee_enabled;
239 +-
240 +- if (!priv->eee_enabled)
241 ++ if (!edata->eee_enabled) {
242 + stmmac_disable_eee_mode(priv);
243 +- else {
244 ++ } else {
245 + /* We are asking for enabling the EEE but it is safe
246 + * to verify all by invoking the eee_init function.
247 + * In case of failure it will return an error.
248 + */
249 +- priv->eee_enabled = stmmac_eee_init(priv);
250 +- if (!priv->eee_enabled)
251 ++ edata->eee_enabled = stmmac_eee_init(priv);
252 ++ if (!edata->eee_enabled)
253 + return -EOPNOTSUPP;
254 +-
255 +- /* Do not change tx_lpi_timer in case of failure */
256 +- priv->tx_lpi_timer = edata->tx_lpi_timer;
257 + }
258 +
259 +- return phy_ethtool_set_eee(dev->phydev, edata);
260 ++ ret = phy_ethtool_set_eee(dev->phydev, edata);
261 ++ if (ret)
262 ++ return ret;
263 ++
264 ++ priv->eee_enabled = edata->eee_enabled;
265 ++ priv->tx_lpi_timer = edata->tx_lpi_timer;
266 ++ return 0;
267 + }
268 +
269 + static u32 stmmac_usec2riwt(u32 usec, struct stmmac_priv *priv)
270 +diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c
271 +index 74a8782313cf..bd6084e315de 100644
272 +--- a/drivers/net/phy/xilinx_gmii2rgmii.c
273 ++++ b/drivers/net/phy/xilinx_gmii2rgmii.c
274 +@@ -44,7 +44,10 @@ static int xgmiitorgmii_read_status(struct phy_device *phydev)
275 + u16 val = 0;
276 + int err;
277 +
278 +- err = priv->phy_drv->read_status(phydev);
279 ++ if (priv->phy_drv->read_status)
280 ++ err = priv->phy_drv->read_status(phydev);
281 ++ else
282 ++ err = genphy_read_status(phydev);
283 + if (err < 0)
284 + return err;
285 +
286 +diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
287 +index 27bd586b94b0..9fc9aed6ca9a 100644
288 +--- a/drivers/net/vxlan.c
289 ++++ b/drivers/net/vxlan.c
290 +@@ -2003,7 +2003,7 @@ static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan,
291 + struct pcpu_sw_netstats *tx_stats, *rx_stats;
292 + union vxlan_addr loopback;
293 + union vxlan_addr *remote_ip = &dst_vxlan->default_dst.remote_ip;
294 +- struct net_device *dev = skb->dev;
295 ++ struct net_device *dev;
296 + int len = skb->len;
297 +
298 + tx_stats = this_cpu_ptr(src_vxlan->dev->tstats);
299 +@@ -2023,9 +2023,15 @@ static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan,
300 + #endif
301 + }
302 +
303 ++ rcu_read_lock();
304 ++ dev = skb->dev;
305 ++ if (unlikely(!(dev->flags & IFF_UP))) {
306 ++ kfree_skb(skb);
307 ++ goto drop;
308 ++ }
309 ++
310 + if (dst_vxlan->cfg.flags & VXLAN_F_LEARN)
311 +- vxlan_snoop(skb->dev, &loopback, eth_hdr(skb)->h_source, 0,
312 +- vni);
313 ++ vxlan_snoop(dev, &loopback, eth_hdr(skb)->h_source, 0, vni);
314 +
315 + u64_stats_update_begin(&tx_stats->syncp);
316 + tx_stats->tx_packets++;
317 +@@ -2038,8 +2044,10 @@ static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan,
318 + rx_stats->rx_bytes += len;
319 + u64_stats_update_end(&rx_stats->syncp);
320 + } else {
321 ++drop:
322 + dev->stats.rx_dropped++;
323 + }
324 ++ rcu_read_unlock();
325 + }
326 +
327 + static int encap_bypass_if_local(struct sk_buff *skb, struct net_device *dev,
328 +diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
329 +index afc4680c584f..7eb1549cea81 100644
330 +--- a/drivers/pci/pci.c
331 ++++ b/drivers/pci/pci.c
332 +@@ -6113,7 +6113,8 @@ static int __init pci_setup(char *str)
333 + } else if (!strncmp(str, "pcie_scan_all", 13)) {
334 + pci_add_flags(PCI_SCAN_ALL_PCIE_DEVS);
335 + } else if (!strncmp(str, "disable_acs_redir=", 18)) {
336 +- disable_acs_redir_param = str + 18;
337 ++ disable_acs_redir_param =
338 ++ kstrdup(str + 18, GFP_KERNEL);
339 + } else {
340 + printk(KERN_ERR "PCI: Unknown option `%s'\n",
341 + str);
342 +diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
343 +index 3f7aad45d215..f1b730b77a31 100644
344 +--- a/drivers/target/target_core_transport.c
345 ++++ b/drivers/target/target_core_transport.c
346 +@@ -266,7 +266,7 @@ struct se_session *transport_alloc_session(enum target_prot_op sup_prot_ops)
347 + }
348 + ret = transport_init_session(se_sess);
349 + if (ret < 0) {
350 +- kfree(se_sess);
351 ++ kmem_cache_free(se_sess_cache, se_sess);
352 + return ERR_PTR(ret);
353 + }
354 + se_sess->sup_prot_ops = sup_prot_ops;
355 +diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
356 +index cf82e7266397..5eaeca805c95 100644
357 +--- a/drivers/vhost/vhost.c
358 ++++ b/drivers/vhost/vhost.c
359 +@@ -1784,7 +1784,7 @@ static int log_used(struct vhost_virtqueue *vq, u64 used_offset, u64 len)
360 +
361 + ret = translate_desc(vq, (uintptr_t)vq->used + used_offset,
362 + len, iov, 64, VHOST_ACCESS_WO);
363 +- if (ret)
364 ++ if (ret < 0)
365 + return ret;
366 +
367 + for (i = 0; i < ret; i++) {
368 +diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
369 +index 2b2a6dce1630..4c76fe2c8488 100644
370 +--- a/include/linux/netdev_features.h
371 ++++ b/include/linux/netdev_features.h
372 +@@ -11,6 +11,8 @@
373 + #define _LINUX_NETDEV_FEATURES_H
374 +
375 + #include <linux/types.h>
376 ++#include <linux/bitops.h>
377 ++#include <asm/byteorder.h>
378 +
379 + typedef u64 netdev_features_t;
380 +
381 +@@ -154,8 +156,26 @@ enum {
382 + #define NETIF_F_HW_TLS_TX __NETIF_F(HW_TLS_TX)
383 + #define NETIF_F_HW_TLS_RX __NETIF_F(HW_TLS_RX)
384 +
385 +-#define for_each_netdev_feature(mask_addr, bit) \
386 +- for_each_set_bit(bit, (unsigned long *)mask_addr, NETDEV_FEATURE_COUNT)
387 ++/* Finds the next feature with the highest number of the range of start till 0.
388 ++ */
389 ++static inline int find_next_netdev_feature(u64 feature, unsigned long start)
390 ++{
391 ++ /* like BITMAP_LAST_WORD_MASK() for u64
392 ++ * this sets the most significant 64 - start to 0.
393 ++ */
394 ++ feature &= ~0ULL >> (-start & ((sizeof(feature) * 8) - 1));
395 ++
396 ++ return fls64(feature) - 1;
397 ++}
398 ++
399 ++/* This goes for the MSB to the LSB through the set feature bits,
400 ++ * mask_addr should be a u64 and bit an int
401 ++ */
402 ++#define for_each_netdev_feature(mask_addr, bit) \
403 ++ for ((bit) = find_next_netdev_feature((mask_addr), \
404 ++ NETDEV_FEATURE_COUNT); \
405 ++ (bit) >= 0; \
406 ++ (bit) = find_next_netdev_feature((mask_addr), (bit) - 1))
407 +
408 + /* Features valid for ethtool to change */
409 + /* = all defined minus driver/device-class-related */
410 +diff --git a/include/net/ax25.h b/include/net/ax25.h
411 +index 3f9aea8087e3..8b7eb46ad72d 100644
412 +--- a/include/net/ax25.h
413 ++++ b/include/net/ax25.h
414 +@@ -201,6 +201,18 @@ static inline void ax25_hold_route(ax25_route *ax25_rt)
415 +
416 + void __ax25_put_route(ax25_route *ax25_rt);
417 +
418 ++extern rwlock_t ax25_route_lock;
419 ++
420 ++static inline void ax25_route_lock_use(void)
421 ++{
422 ++ read_lock(&ax25_route_lock);
423 ++}
424 ++
425 ++static inline void ax25_route_lock_unuse(void)
426 ++{
427 ++ read_unlock(&ax25_route_lock);
428 ++}
429 ++
430 + static inline void ax25_put_route(ax25_route *ax25_rt)
431 + {
432 + if (refcount_dec_and_test(&ax25_rt->refcount))
433 +diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
434 +index 00b5e7825508..74ff688568a0 100644
435 +--- a/include/net/inetpeer.h
436 ++++ b/include/net/inetpeer.h
437 +@@ -39,6 +39,7 @@ struct inet_peer {
438 +
439 + u32 metrics[RTAX_MAX];
440 + u32 rate_tokens; /* rate limiting for ICMP */
441 ++ u32 n_redirects;
442 + unsigned long rate_last;
443 + /*
444 + * Once inet_peer is queued for deletion (refcnt == 0), following field
445 +diff --git a/net/ax25/ax25_ip.c b/net/ax25/ax25_ip.c
446 +index 70417e9b932d..314bbc8010fb 100644
447 +--- a/net/ax25/ax25_ip.c
448 ++++ b/net/ax25/ax25_ip.c
449 +@@ -114,6 +114,7 @@ netdev_tx_t ax25_ip_xmit(struct sk_buff *skb)
450 + dst = (ax25_address *)(bp + 1);
451 + src = (ax25_address *)(bp + 8);
452 +
453 ++ ax25_route_lock_use();
454 + route = ax25_get_route(dst, NULL);
455 + if (route) {
456 + digipeat = route->digipeat;
457 +@@ -206,9 +207,8 @@ netdev_tx_t ax25_ip_xmit(struct sk_buff *skb)
458 + ax25_queue_xmit(skb, dev);
459 +
460 + put:
461 +- if (route)
462 +- ax25_put_route(route);
463 +
464 ++ ax25_route_lock_unuse();
465 + return NETDEV_TX_OK;
466 + }
467 +
468 +diff --git a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c
469 +index a0eff323af12..66f74c85cf6b 100644
470 +--- a/net/ax25/ax25_route.c
471 ++++ b/net/ax25/ax25_route.c
472 +@@ -40,7 +40,7 @@
473 + #include <linux/export.h>
474 +
475 + static ax25_route *ax25_route_list;
476 +-static DEFINE_RWLOCK(ax25_route_lock);
477 ++DEFINE_RWLOCK(ax25_route_lock);
478 +
479 + void ax25_rt_device_down(struct net_device *dev)
480 + {
481 +@@ -335,6 +335,7 @@ const struct seq_operations ax25_rt_seqops = {
482 + * Find AX.25 route
483 + *
484 + * Only routes with a reference count of zero can be destroyed.
485 ++ * Must be called with ax25_route_lock read locked.
486 + */
487 + ax25_route *ax25_get_route(ax25_address *addr, struct net_device *dev)
488 + {
489 +@@ -342,7 +343,6 @@ ax25_route *ax25_get_route(ax25_address *addr, struct net_device *dev)
490 + ax25_route *ax25_def_rt = NULL;
491 + ax25_route *ax25_rt;
492 +
493 +- read_lock(&ax25_route_lock);
494 + /*
495 + * Bind to the physical interface we heard them on, or the default
496 + * route if none is found;
497 +@@ -365,11 +365,6 @@ ax25_route *ax25_get_route(ax25_address *addr, struct net_device *dev)
498 + if (ax25_spe_rt != NULL)
499 + ax25_rt = ax25_spe_rt;
500 +
501 +- if (ax25_rt != NULL)
502 +- ax25_hold_route(ax25_rt);
503 +-
504 +- read_unlock(&ax25_route_lock);
505 +-
506 + return ax25_rt;
507 + }
508 +
509 +@@ -400,9 +395,12 @@ int ax25_rt_autobind(ax25_cb *ax25, ax25_address *addr)
510 + ax25_route *ax25_rt;
511 + int err = 0;
512 +
513 +- if ((ax25_rt = ax25_get_route(addr, NULL)) == NULL)
514 ++ ax25_route_lock_use();
515 ++ ax25_rt = ax25_get_route(addr, NULL);
516 ++ if (!ax25_rt) {
517 ++ ax25_route_lock_unuse();
518 + return -EHOSTUNREACH;
519 +-
520 ++ }
521 + if ((ax25->ax25_dev = ax25_dev_ax25dev(ax25_rt->dev)) == NULL) {
522 + err = -EHOSTUNREACH;
523 + goto put;
524 +@@ -437,8 +435,7 @@ int ax25_rt_autobind(ax25_cb *ax25, ax25_address *addr)
525 + }
526 +
527 + put:
528 +- ax25_put_route(ax25_rt);
529 +-
530 ++ ax25_route_lock_unuse();
531 + return err;
532 + }
533 +
534 +diff --git a/net/core/dev.c b/net/core/dev.c
535 +index af097ca9cb4f..5c8c0a572ee9 100644
536 +--- a/net/core/dev.c
537 ++++ b/net/core/dev.c
538 +@@ -8039,7 +8039,7 @@ static netdev_features_t netdev_sync_upper_features(struct net_device *lower,
539 + netdev_features_t feature;
540 + int feature_bit;
541 +
542 +- for_each_netdev_feature(&upper_disables, feature_bit) {
543 ++ for_each_netdev_feature(upper_disables, feature_bit) {
544 + feature = __NETIF_F_BIT(feature_bit);
545 + if (!(upper->wanted_features & feature)
546 + && (features & feature)) {
547 +@@ -8059,7 +8059,7 @@ static void netdev_sync_lower_features(struct net_device *upper,
548 + netdev_features_t feature;
549 + int feature_bit;
550 +
551 +- for_each_netdev_feature(&upper_disables, feature_bit) {
552 ++ for_each_netdev_feature(upper_disables, feature_bit) {
553 + feature = __NETIF_F_BIT(feature_bit);
554 + if (!(features & feature) && (lower->features & feature)) {
555 + netdev_dbg(upper, "Disabling feature %pNF on lower dev %s.\n",
556 +diff --git a/net/core/skbuff.c b/net/core/skbuff.c
557 +index 589ec5b9ec5f..8656b1e20d35 100644
558 +--- a/net/core/skbuff.c
559 ++++ b/net/core/skbuff.c
560 +@@ -353,6 +353,8 @@ static void *__netdev_alloc_frag(unsigned int fragsz, gfp_t gfp_mask)
561 + */
562 + void *netdev_alloc_frag(unsigned int fragsz)
563 + {
564 ++ fragsz = SKB_DATA_ALIGN(fragsz);
565 ++
566 + return __netdev_alloc_frag(fragsz, GFP_ATOMIC);
567 + }
568 + EXPORT_SYMBOL(netdev_alloc_frag);
569 +@@ -366,6 +368,8 @@ static void *__napi_alloc_frag(unsigned int fragsz, gfp_t gfp_mask)
570 +
571 + void *napi_alloc_frag(unsigned int fragsz)
572 + {
573 ++ fragsz = SKB_DATA_ALIGN(fragsz);
574 ++
575 + return __napi_alloc_frag(fragsz, GFP_ATOMIC);
576 + }
577 + EXPORT_SYMBOL(napi_alloc_frag);
578 +diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
579 +index d757b9642d0d..be778599bfed 100644
580 +--- a/net/ipv4/inetpeer.c
581 ++++ b/net/ipv4/inetpeer.c
582 +@@ -216,6 +216,7 @@ struct inet_peer *inet_getpeer(struct inet_peer_base *base,
583 + atomic_set(&p->rid, 0);
584 + p->metrics[RTAX_LOCK-1] = INETPEER_METRICS_NEW;
585 + p->rate_tokens = 0;
586 ++ p->n_redirects = 0;
587 + /* 60*HZ is arbitrary, but chosen enough high so that the first
588 + * calculation of tokens is at its maximum.
589 + */
590 +diff --git a/net/ipv4/netfilter/nf_nat_snmp_basic_main.c b/net/ipv4/netfilter/nf_nat_snmp_basic_main.c
591 +index ac110c1d55b5..481437fc1eb2 100644
592 +--- a/net/ipv4/netfilter/nf_nat_snmp_basic_main.c
593 ++++ b/net/ipv4/netfilter/nf_nat_snmp_basic_main.c
594 +@@ -104,6 +104,8 @@ static void fast_csum(struct snmp_ctx *ctx, unsigned char offset)
595 + int snmp_version(void *context, size_t hdrlen, unsigned char tag,
596 + const void *data, size_t datalen)
597 + {
598 ++ if (datalen != 1)
599 ++ return -EINVAL;
600 + if (*(unsigned char *)data > 1)
601 + return -ENOTSUPP;
602 + return 1;
603 +@@ -113,8 +115,11 @@ int snmp_helper(void *context, size_t hdrlen, unsigned char tag,
604 + const void *data, size_t datalen)
605 + {
606 + struct snmp_ctx *ctx = (struct snmp_ctx *)context;
607 +- __be32 *pdata = (__be32 *)data;
608 ++ __be32 *pdata;
609 +
610 ++ if (datalen != 4)
611 ++ return -EINVAL;
612 ++ pdata = (__be32 *)data;
613 + if (*pdata == ctx->from) {
614 + pr_debug("%s: %pI4 to %pI4\n", __func__,
615 + (void *)&ctx->from, (void *)&ctx->to);
616 +diff --git a/net/ipv4/route.c b/net/ipv4/route.c
617 +index 8501554e96a4..436b46c0e687 100644
618 +--- a/net/ipv4/route.c
619 ++++ b/net/ipv4/route.c
620 +@@ -887,13 +887,15 @@ void ip_rt_send_redirect(struct sk_buff *skb)
621 + /* No redirected packets during ip_rt_redirect_silence;
622 + * reset the algorithm.
623 + */
624 +- if (time_after(jiffies, peer->rate_last + ip_rt_redirect_silence))
625 ++ if (time_after(jiffies, peer->rate_last + ip_rt_redirect_silence)) {
626 + peer->rate_tokens = 0;
627 ++ peer->n_redirects = 0;
628 ++ }
629 +
630 + /* Too many ignored redirects; do not send anything
631 + * set dst.rate_last to the last seen redirected packet.
632 + */
633 +- if (peer->rate_tokens >= ip_rt_redirect_number) {
634 ++ if (peer->n_redirects >= ip_rt_redirect_number) {
635 + peer->rate_last = jiffies;
636 + goto out_put_peer;
637 + }
638 +@@ -910,6 +912,7 @@ void ip_rt_send_redirect(struct sk_buff *skb)
639 + icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST, gw);
640 + peer->rate_last = jiffies;
641 + ++peer->rate_tokens;
642 ++ ++peer->n_redirects;
643 + #ifdef CONFIG_IP_ROUTE_VERBOSE
644 + if (log_martians &&
645 + peer->rate_tokens == ip_rt_redirect_number)
646 +diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
647 +index 87fe44197aa1..432dc9af1172 100644
648 +--- a/net/ipv4/tcp.c
649 ++++ b/net/ipv4/tcp.c
650 +@@ -2519,6 +2519,7 @@ void tcp_write_queue_purge(struct sock *sk)
651 + sk_mem_reclaim(sk);
652 + tcp_clear_all_retrans_hints(tcp_sk(sk));
653 + tcp_sk(sk)->packets_out = 0;
654 ++ inet_csk(sk)->icsk_backoff = 0;
655 + }
656 +
657 + int tcp_disconnect(struct sock *sk, int flags)
658 +@@ -2567,7 +2568,6 @@ int tcp_disconnect(struct sock *sk, int flags)
659 + tp->write_seq += tp->max_window + 2;
660 + if (tp->write_seq == 0)
661 + tp->write_seq = 1;
662 +- icsk->icsk_backoff = 0;
663 + tp->snd_cwnd = 2;
664 + icsk->icsk_probes_out = 0;
665 + tp->snd_ssthresh = TCP_INFINITE_SSTHRESH;
666 +diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
667 +index cd426313a298..3b83b157b0a1 100644
668 +--- a/net/ipv4/tcp_ipv4.c
669 ++++ b/net/ipv4/tcp_ipv4.c
670 +@@ -535,14 +535,15 @@ void tcp_v4_err(struct sk_buff *icmp_skb, u32 info)
671 + if (sock_owned_by_user(sk))
672 + break;
673 +
674 ++ skb = tcp_rtx_queue_head(sk);
675 ++ if (WARN_ON_ONCE(!skb))
676 ++ break;
677 ++
678 + icsk->icsk_backoff--;
679 + icsk->icsk_rto = tp->srtt_us ? __tcp_set_rto(tp) :
680 + TCP_TIMEOUT_INIT;
681 + icsk->icsk_rto = inet_csk_rto_backoff(icsk, TCP_RTO_MAX);
682 +
683 +- skb = tcp_rtx_queue_head(sk);
684 +- BUG_ON(!skb);
685 +-
686 + tcp_mstamp_refresh(tp);
687 + delta_us = (u32)(tp->tcp_mstamp - skb->skb_mstamp);
688 + remaining = icsk->icsk_rto -
689 +diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
690 +index 3dfc50cd86d6..c57efd5c5b38 100644
691 +--- a/net/ipv6/addrconf.c
692 ++++ b/net/ipv6/addrconf.c
693 +@@ -1148,7 +1148,8 @@ check_cleanup_prefix_route(struct inet6_ifaddr *ifp, unsigned long *expires)
694 + list_for_each_entry(ifa, &idev->addr_list, if_list) {
695 + if (ifa == ifp)
696 + continue;
697 +- if (!ipv6_prefix_equal(&ifa->addr, &ifp->addr,
698 ++ if (ifa->prefix_len != ifp->prefix_len ||
699 ++ !ipv6_prefix_equal(&ifa->addr, &ifp->addr,
700 + ifp->prefix_len))
701 + continue;
702 + if (ifa->flags & (IFA_F_PERMANENT | IFA_F_NOPREFIXROUTE))
703 +diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
704 +index be04877b3827..faed98dab913 100644
705 +--- a/net/ipv6/ip6_gre.c
706 ++++ b/net/ipv6/ip6_gre.c
707 +@@ -1735,6 +1735,24 @@ static int ip6erspan_tap_validate(struct nlattr *tb[], struct nlattr *data[],
708 + return 0;
709 + }
710 +
711 ++static void ip6erspan_set_version(struct nlattr *data[],
712 ++ struct __ip6_tnl_parm *parms)
713 ++{
714 ++ parms->erspan_ver = 1;
715 ++ if (data[IFLA_GRE_ERSPAN_VER])
716 ++ parms->erspan_ver = nla_get_u8(data[IFLA_GRE_ERSPAN_VER]);
717 ++
718 ++ if (parms->erspan_ver == 1) {
719 ++ if (data[IFLA_GRE_ERSPAN_INDEX])
720 ++ parms->index = nla_get_u32(data[IFLA_GRE_ERSPAN_INDEX]);
721 ++ } else if (parms->erspan_ver == 2) {
722 ++ if (data[IFLA_GRE_ERSPAN_DIR])
723 ++ parms->dir = nla_get_u8(data[IFLA_GRE_ERSPAN_DIR]);
724 ++ if (data[IFLA_GRE_ERSPAN_HWID])
725 ++ parms->hwid = nla_get_u16(data[IFLA_GRE_ERSPAN_HWID]);
726 ++ }
727 ++}
728 ++
729 + static void ip6gre_netlink_parms(struct nlattr *data[],
730 + struct __ip6_tnl_parm *parms)
731 + {
732 +@@ -1783,20 +1801,6 @@ static void ip6gre_netlink_parms(struct nlattr *data[],
733 +
734 + if (data[IFLA_GRE_COLLECT_METADATA])
735 + parms->collect_md = true;
736 +-
737 +- parms->erspan_ver = 1;
738 +- if (data[IFLA_GRE_ERSPAN_VER])
739 +- parms->erspan_ver = nla_get_u8(data[IFLA_GRE_ERSPAN_VER]);
740 +-
741 +- if (parms->erspan_ver == 1) {
742 +- if (data[IFLA_GRE_ERSPAN_INDEX])
743 +- parms->index = nla_get_u32(data[IFLA_GRE_ERSPAN_INDEX]);
744 +- } else if (parms->erspan_ver == 2) {
745 +- if (data[IFLA_GRE_ERSPAN_DIR])
746 +- parms->dir = nla_get_u8(data[IFLA_GRE_ERSPAN_DIR]);
747 +- if (data[IFLA_GRE_ERSPAN_HWID])
748 +- parms->hwid = nla_get_u16(data[IFLA_GRE_ERSPAN_HWID]);
749 +- }
750 + }
751 +
752 + static int ip6gre_tap_init(struct net_device *dev)
753 +@@ -2225,6 +2229,7 @@ static int ip6erspan_newlink(struct net *src_net, struct net_device *dev,
754 + int err;
755 +
756 + ip6gre_netlink_parms(data, &nt->parms);
757 ++ ip6erspan_set_version(data, &nt->parms);
758 + ign = net_generic(net, ip6gre_net_id);
759 +
760 + if (nt->parms.collect_md) {
761 +@@ -2270,6 +2275,7 @@ static int ip6erspan_changelink(struct net_device *dev, struct nlattr *tb[],
762 + if (IS_ERR(t))
763 + return PTR_ERR(t);
764 +
765 ++ ip6erspan_set_version(data, &p);
766 + ip6gre_tunnel_unlink_md(ign, t);
767 + ip6gre_tunnel_unlink(ign, t);
768 + ip6erspan_tnl_change(t, &p, !tb[IFLA_MTU]);
769 +diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
770 +index b6ea0fadb34f..c76c21604ffd 100644
771 +--- a/net/packet/af_packet.c
772 ++++ b/net/packet/af_packet.c
773 +@@ -2887,7 +2887,8 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
774 + goto out_free;
775 + } else if (reserve) {
776 + skb_reserve(skb, -reserve);
777 +- if (len < reserve)
778 ++ if (len < reserve + sizeof(struct ipv6hdr) &&
779 ++ dev->min_header_len != dev->hard_header_len)
780 + skb_reset_network_header(skb);
781 + }
782 +
783 +diff --git a/net/sunrpc/auth_gss/gss_krb5_seqnum.c b/net/sunrpc/auth_gss/gss_krb5_seqnum.c
784 +index c8b9082f4a9d..2d2ed6772fe4 100644
785 +--- a/net/sunrpc/auth_gss/gss_krb5_seqnum.c
786 ++++ b/net/sunrpc/auth_gss/gss_krb5_seqnum.c
787 +@@ -44,7 +44,7 @@ krb5_make_rc4_seq_num(struct krb5_ctx *kctx, int direction, s32 seqnum,
788 + unsigned char *cksum, unsigned char *buf)
789 + {
790 + struct crypto_skcipher *cipher;
791 +- unsigned char plain[8];
792 ++ unsigned char *plain;
793 + s32 code;
794 +
795 + dprintk("RPC: %s:\n", __func__);
796 +@@ -53,6 +53,10 @@ krb5_make_rc4_seq_num(struct krb5_ctx *kctx, int direction, s32 seqnum,
797 + if (IS_ERR(cipher))
798 + return PTR_ERR(cipher);
799 +
800 ++ plain = kmalloc(8, GFP_NOFS);
801 ++ if (!plain)
802 ++ return -ENOMEM;
803 ++
804 + plain[0] = (unsigned char) ((seqnum >> 24) & 0xff);
805 + plain[1] = (unsigned char) ((seqnum >> 16) & 0xff);
806 + plain[2] = (unsigned char) ((seqnum >> 8) & 0xff);
807 +@@ -69,6 +73,7 @@ krb5_make_rc4_seq_num(struct krb5_ctx *kctx, int direction, s32 seqnum,
808 + code = krb5_encrypt(cipher, cksum, plain, buf, 8);
809 + out:
810 + crypto_free_skcipher(cipher);
811 ++ kfree(plain);
812 + return code;
813 + }
814 + s32
815 +@@ -78,12 +83,17 @@ krb5_make_seq_num(struct krb5_ctx *kctx,
816 + u32 seqnum,
817 + unsigned char *cksum, unsigned char *buf)
818 + {
819 +- unsigned char plain[8];
820 ++ unsigned char *plain;
821 ++ s32 code;
822 +
823 + if (kctx->enctype == ENCTYPE_ARCFOUR_HMAC)
824 + return krb5_make_rc4_seq_num(kctx, direction, seqnum,
825 + cksum, buf);
826 +
827 ++ plain = kmalloc(8, GFP_NOFS);
828 ++ if (!plain)
829 ++ return -ENOMEM;
830 ++
831 + plain[0] = (unsigned char) (seqnum & 0xff);
832 + plain[1] = (unsigned char) ((seqnum >> 8) & 0xff);
833 + plain[2] = (unsigned char) ((seqnum >> 16) & 0xff);
834 +@@ -94,7 +104,9 @@ krb5_make_seq_num(struct krb5_ctx *kctx,
835 + plain[6] = direction;
836 + plain[7] = direction;
837 +
838 +- return krb5_encrypt(key, cksum, plain, buf, 8);
839 ++ code = krb5_encrypt(key, cksum, plain, buf, 8);
840 ++ kfree(plain);
841 ++ return code;
842 + }
843 +
844 + static s32
845 +@@ -102,7 +114,7 @@ krb5_get_rc4_seq_num(struct krb5_ctx *kctx, unsigned char *cksum,
846 + unsigned char *buf, int *direction, s32 *seqnum)
847 + {
848 + struct crypto_skcipher *cipher;
849 +- unsigned char plain[8];
850 ++ unsigned char *plain;
851 + s32 code;
852 +
853 + dprintk("RPC: %s:\n", __func__);
854 +@@ -115,20 +127,28 @@ krb5_get_rc4_seq_num(struct krb5_ctx *kctx, unsigned char *cksum,
855 + if (code)
856 + goto out;
857 +
858 ++ plain = kmalloc(8, GFP_NOFS);
859 ++ if (!plain) {
860 ++ code = -ENOMEM;
861 ++ goto out;
862 ++ }
863 ++
864 + code = krb5_decrypt(cipher, cksum, buf, plain, 8);
865 + if (code)
866 +- goto out;
867 ++ goto out_plain;
868 +
869 + if ((plain[4] != plain[5]) || (plain[4] != plain[6])
870 + || (plain[4] != plain[7])) {
871 + code = (s32)KG_BAD_SEQ;
872 +- goto out;
873 ++ goto out_plain;
874 + }
875 +
876 + *direction = plain[4];
877 +
878 + *seqnum = ((plain[0] << 24) | (plain[1] << 16) |
879 + (plain[2] << 8) | (plain[3]));
880 ++out_plain:
881 ++ kfree(plain);
882 + out:
883 + crypto_free_skcipher(cipher);
884 + return code;
885 +@@ -141,26 +161,33 @@ krb5_get_seq_num(struct krb5_ctx *kctx,
886 + int *direction, u32 *seqnum)
887 + {
888 + s32 code;
889 +- unsigned char plain[8];
890 + struct crypto_skcipher *key = kctx->seq;
891 ++ unsigned char *plain;
892 +
893 + dprintk("RPC: krb5_get_seq_num:\n");
894 +
895 + if (kctx->enctype == ENCTYPE_ARCFOUR_HMAC)
896 + return krb5_get_rc4_seq_num(kctx, cksum, buf,
897 + direction, seqnum);
898 ++ plain = kmalloc(8, GFP_NOFS);
899 ++ if (!plain)
900 ++ return -ENOMEM;
901 +
902 + if ((code = krb5_decrypt(key, cksum, buf, plain, 8)))
903 +- return code;
904 ++ goto out;
905 +
906 + if ((plain[4] != plain[5]) || (plain[4] != plain[6]) ||
907 +- (plain[4] != plain[7]))
908 +- return (s32)KG_BAD_SEQ;
909 ++ (plain[4] != plain[7])) {
910 ++ code = (s32)KG_BAD_SEQ;
911 ++ goto out;
912 ++ }
913 +
914 + *direction = plain[4];
915 +
916 + *seqnum = ((plain[0]) |
917 + (plain[1] << 8) | (plain[2] << 16) | (plain[3] << 24));
918 +
919 +- return 0;
920 ++out:
921 ++ kfree(plain);
922 ++ return code;
923 + }
924 +diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c
925 +index c361ce782412..c3d5ab01fba7 100644
926 +--- a/net/vmw_vsock/vmci_transport.c
927 ++++ b/net/vmw_vsock/vmci_transport.c
928 +@@ -1651,6 +1651,10 @@ static void vmci_transport_cleanup(struct work_struct *work)
929 +
930 + static void vmci_transport_destruct(struct vsock_sock *vsk)
931 + {
932 ++ /* transport can be NULL if we hit a failure at init() time */
933 ++ if (!vmci_trans(vsk))
934 ++ return;
935 ++
936 + /* Ensure that the detach callback doesn't use the sk/vsk
937 + * we are about to destruct.
938 + */
939 +diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
940 +index d49aa79b7997..fef473c736fa 100644
941 +--- a/net/x25/af_x25.c
942 ++++ b/net/x25/af_x25.c
943 +@@ -352,17 +352,15 @@ static unsigned int x25_new_lci(struct x25_neigh *nb)
944 + unsigned int lci = 1;
945 + struct sock *sk;
946 +
947 +- read_lock_bh(&x25_list_lock);
948 +-
949 +- while ((sk = __x25_find_socket(lci, nb)) != NULL) {
950 ++ while ((sk = x25_find_socket(lci, nb)) != NULL) {
951 + sock_put(sk);
952 + if (++lci == 4096) {
953 + lci = 0;
954 + break;
955 + }
956 ++ cond_resched();
957 + }
958 +
959 +- read_unlock_bh(&x25_list_lock);
960 + return lci;
961 + }
962 +