Magellan Linux

Annotation of /trunk/kernel-alx/patches-4.9/0245-4.9.146-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3298 - (hide annotations) (download)
Tue Mar 12 10:43:07 2019 UTC (5 years, 3 months ago) by niro
File size: 48129 byte(s)
-linux-4.9.146
1 niro 3298 diff --git a/Makefile b/Makefile
2     index 1499c7ba2874..0a150d2b3353 100644
3     --- a/Makefile
4     +++ b/Makefile
5     @@ -1,6 +1,6 @@
6     VERSION = 4
7     PATCHLEVEL = 9
8     -SUBLEVEL = 145
9     +SUBLEVEL = 146
10     EXTRAVERSION =
11     NAME = Roaring Lionus
12    
13     diff --git a/arch/arm/boot/dts/logicpd-som-lv.dtsi b/arch/arm/boot/dts/logicpd-som-lv.dtsi
14     index e262fa9ef334..876ed5f2922c 100644
15     --- a/arch/arm/boot/dts/logicpd-som-lv.dtsi
16     +++ b/arch/arm/boot/dts/logicpd-som-lv.dtsi
17     @@ -122,7 +122,7 @@
18     };
19    
20     &mmc3 {
21     - interrupts-extended = <&intc 94 &omap3_pmx_core2 0x46>;
22     + interrupts-extended = <&intc 94 &omap3_pmx_core 0x136>;
23     pinctrl-0 = <&mmc3_pins &wl127x_gpio>;
24     pinctrl-names = "default";
25     vmmc-supply = <&wl12xx_vmmc>;
26     diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
27     index 6613a6ff5dbc..c4b634c54fbd 100644
28     --- a/arch/arm/mach-omap1/board-ams-delta.c
29     +++ b/arch/arm/mach-omap1/board-ams-delta.c
30     @@ -511,6 +511,9 @@ static void modem_pm(struct uart_port *port, unsigned int state, unsigned old)
31     {
32     struct modem_private_data *priv = port->private_data;
33    
34     + if (!priv)
35     + return;
36     +
37     if (IS_ERR(priv->regulator))
38     return;
39    
40     diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
41     index 30768003f854..8c505284bc0c 100644
42     --- a/arch/arm/mach-omap2/prm44xx.c
43     +++ b/arch/arm/mach-omap2/prm44xx.c
44     @@ -344,7 +344,7 @@ static void omap44xx_prm_reconfigure_io_chain(void)
45     * to occur, WAKEUPENABLE bits must be set in the pad mux registers, and
46     * omap44xx_prm_reconfigure_io_chain() must be called. No return value.
47     */
48     -static void __init omap44xx_prm_enable_io_wakeup(void)
49     +static void omap44xx_prm_enable_io_wakeup(void)
50     {
51     s32 inst = omap4_prmst_get_prm_dev_inst();
52    
53     diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c
54     index 037c2a253ae4..1238e7ef1170 100644
55     --- a/arch/s390/kernel/perf_cpum_cf.c
56     +++ b/arch/s390/kernel/perf_cpum_cf.c
57     @@ -344,6 +344,8 @@ static int __hw_perf_event_init(struct perf_event *event)
58     break;
59    
60     case PERF_TYPE_HARDWARE:
61     + if (is_sampling_event(event)) /* No sampling support */
62     + return -ENOENT;
63     ev = attr->config;
64     /* Count user space (problem-state) only */
65     if (!attr->exclude_user && attr->exclude_kernel) {
66     diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
67     index 69a81a7daa24..c8630569e392 100644
68     --- a/arch/x86/kvm/lapic.c
69     +++ b/arch/x86/kvm/lapic.c
70     @@ -57,7 +57,7 @@
71     #define APIC_BUS_CYCLE_NS 1
72    
73     /* #define apic_debug(fmt,arg...) printk(KERN_WARNING fmt,##arg) */
74     -#define apic_debug(fmt, arg...)
75     +#define apic_debug(fmt, arg...) do {} while (0)
76    
77     /* 14 is the version for Xeon and Pentium 8.4.8*/
78     #define APIC_VERSION (0x14UL | ((KVM_APIC_LVT_NUM - 1) << 16))
79     diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
80     index 8888d894bf39..011050820608 100644
81     --- a/arch/x86/kvm/vmx.c
82     +++ b/arch/x86/kvm/vmx.c
83     @@ -1077,7 +1077,7 @@ static void copy_vmcs12_to_shadow(struct vcpu_vmx *vmx);
84     static void copy_shadow_to_vmcs12(struct vcpu_vmx *vmx);
85     static int alloc_identity_pagetable(struct kvm *kvm);
86     static void vmx_update_msr_bitmap(struct kvm_vcpu *vcpu);
87     -static void __always_inline vmx_disable_intercept_for_msr(unsigned long *msr_bitmap,
88     +static __always_inline void vmx_disable_intercept_for_msr(unsigned long *msr_bitmap,
89     u32 msr, int type);
90    
91     static DEFINE_PER_CPU(struct vmcs *, vmxarea);
92     @@ -4872,7 +4872,7 @@ static void free_vpid(int vpid)
93     spin_unlock(&vmx_vpid_lock);
94     }
95    
96     -static void __always_inline vmx_disable_intercept_for_msr(unsigned long *msr_bitmap,
97     +static __always_inline void vmx_disable_intercept_for_msr(unsigned long *msr_bitmap,
98     u32 msr, int type)
99     {
100     int f = sizeof(unsigned long);
101     @@ -4907,7 +4907,7 @@ static void __always_inline vmx_disable_intercept_for_msr(unsigned long *msr_bit
102     }
103     }
104    
105     -static void __always_inline vmx_enable_intercept_for_msr(unsigned long *msr_bitmap,
106     +static __always_inline void vmx_enable_intercept_for_msr(unsigned long *msr_bitmap,
107     u32 msr, int type)
108     {
109     int f = sizeof(unsigned long);
110     @@ -4942,7 +4942,7 @@ static void __always_inline vmx_enable_intercept_for_msr(unsigned long *msr_bitm
111     }
112     }
113    
114     -static void __always_inline vmx_set_intercept_for_msr(unsigned long *msr_bitmap,
115     +static __always_inline void vmx_set_intercept_for_msr(unsigned long *msr_bitmap,
116     u32 msr, int type, bool value)
117     {
118     if (value)
119     diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
120     index 57205016b04a..201874b96dd6 100644
121     --- a/drivers/gpu/drm/ast/ast_mode.c
122     +++ b/drivers/gpu/drm/ast/ast_mode.c
123     @@ -954,9 +954,21 @@ static int get_clock(void *i2c_priv)
124     {
125     struct ast_i2c_chan *i2c = i2c_priv;
126     struct ast_private *ast = i2c->dev->dev_private;
127     - uint32_t val;
128     + uint32_t val, val2, count, pass;
129     +
130     + count = 0;
131     + pass = 0;
132     + val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4) & 0x01;
133     + do {
134     + val2 = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4) & 0x01;
135     + if (val == val2) {
136     + pass++;
137     + } else {
138     + pass = 0;
139     + val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4) & 0x01;
140     + }
141     + } while ((pass < 5) && (count++ < 0x10000));
142    
143     - val = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4;
144     return val & 1 ? 1 : 0;
145     }
146    
147     @@ -964,9 +976,21 @@ static int get_data(void *i2c_priv)
148     {
149     struct ast_i2c_chan *i2c = i2c_priv;
150     struct ast_private *ast = i2c->dev->dev_private;
151     - uint32_t val;
152     + uint32_t val, val2, count, pass;
153     +
154     + count = 0;
155     + pass = 0;
156     + val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x20) >> 5) & 0x01;
157     + do {
158     + val2 = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x20) >> 5) & 0x01;
159     + if (val == val2) {
160     + pass++;
161     + } else {
162     + pass = 0;
163     + val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x20) >> 5) & 0x01;
164     + }
165     + } while ((pass < 5) && (count++ < 0x10000));
166    
167     - val = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x20) >> 5;
168     return val & 1 ? 1 : 0;
169     }
170    
171     @@ -979,7 +1003,7 @@ static void set_clock(void *i2c_priv, int clock)
172    
173     for (i = 0; i < 0x10000; i++) {
174     ujcrb7 = ((clock & 0x01) ? 0 : 1);
175     - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xfe, ujcrb7);
176     + ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xf4, ujcrb7);
177     jtemp = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x01);
178     if (ujcrb7 == jtemp)
179     break;
180     @@ -995,7 +1019,7 @@ static void set_data(void *i2c_priv, int data)
181    
182     for (i = 0; i < 0x10000; i++) {
183     ujcrb7 = ((data & 0x01) ? 0 : 1) << 2;
184     - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xfb, ujcrb7);
185     + ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xf1, ujcrb7);
186     jtemp = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x04);
187     if (ujcrb7 == jtemp)
188     break;
189     diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c
190     index 9ac6e1673375..1f291b344178 100644
191     --- a/drivers/hwmon/ina2xx.c
192     +++ b/drivers/hwmon/ina2xx.c
193     @@ -273,7 +273,7 @@ static int ina2xx_get_value(struct ina2xx_data *data, u8 reg,
194     break;
195     case INA2XX_CURRENT:
196     /* signed register, result in mA */
197     - val = regval * data->current_lsb_uA;
198     + val = (s16)regval * data->current_lsb_uA;
199     val = DIV_ROUND_CLOSEST(val, 1000);
200     break;
201     case INA2XX_CALIBRATION:
202     diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c
203     index 49276bbdac3d..1bb80f992aa8 100644
204     --- a/drivers/hwmon/w83795.c
205     +++ b/drivers/hwmon/w83795.c
206     @@ -1691,7 +1691,7 @@ store_sf_setup(struct device *dev, struct device_attribute *attr,
207     * somewhere else in the code
208     */
209     #define SENSOR_ATTR_TEMP(index) { \
210     - SENSOR_ATTR_2(temp##index##_type, S_IRUGO | (index < 4 ? S_IWUSR : 0), \
211     + SENSOR_ATTR_2(temp##index##_type, S_IRUGO | (index < 5 ? S_IWUSR : 0), \
212     show_temp_mode, store_temp_mode, NOT_USED, index - 1), \
213     SENSOR_ATTR_2(temp##index##_input, S_IRUGO, show_temp, \
214     NULL, TEMP_READ, index - 1), \
215     diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
216     index f8f7a2191b98..f89489b28575 100644
217     --- a/drivers/infiniband/hw/mlx5/qp.c
218     +++ b/drivers/infiniband/hw/mlx5/qp.c
219     @@ -3888,17 +3888,18 @@ int mlx5_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
220     goto out;
221     }
222    
223     - if (wr->opcode == IB_WR_LOCAL_INV ||
224     - wr->opcode == IB_WR_REG_MR) {
225     + if (wr->opcode == IB_WR_REG_MR) {
226     fence = dev->umr_fence;
227     next_fence = MLX5_FENCE_MODE_INITIATOR_SMALL;
228     - } else if (wr->send_flags & IB_SEND_FENCE) {
229     - if (qp->next_fence)
230     - fence = MLX5_FENCE_MODE_SMALL_AND_FENCE;
231     - else
232     - fence = MLX5_FENCE_MODE_FENCE;
233     - } else {
234     - fence = qp->next_fence;
235     + } else {
236     + if (wr->send_flags & IB_SEND_FENCE) {
237     + if (qp->next_fence)
238     + fence = MLX5_FENCE_MODE_SMALL_AND_FENCE;
239     + else
240     + fence = MLX5_FENCE_MODE_FENCE;
241     + } else {
242     + fence = qp->next_fence;
243     + }
244     }
245    
246     switch (ibqp->qp_type) {
247     diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c
248     index 6677b96e1f3f..da142f6bd0c3 100644
249     --- a/drivers/net/ethernet/cavium/thunder/nic_main.c
250     +++ b/drivers/net/ethernet/cavium/thunder/nic_main.c
251     @@ -1371,6 +1371,9 @@ static void nic_remove(struct pci_dev *pdev)
252     {
253     struct nicpf *nic = pci_get_drvdata(pdev);
254    
255     + if (!nic)
256     + return;
257     +
258     if (nic->flags & NIC_SRIOV_ENABLED)
259     pci_disable_sriov(pdev);
260    
261     diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c
262     index 39778892b3b3..b5d18d95d7b9 100644
263     --- a/drivers/net/ethernet/hisilicon/hip04_eth.c
264     +++ b/drivers/net/ethernet/hisilicon/hip04_eth.c
265     @@ -922,10 +922,8 @@ static int hip04_mac_probe(struct platform_device *pdev)
266     }
267    
268     ret = register_netdev(ndev);
269     - if (ret) {
270     - free_netdev(ndev);
271     + if (ret)
272     goto alloc_fail;
273     - }
274    
275     return 0;
276    
277     diff --git a/drivers/net/ethernet/intel/igb/e1000_i210.c b/drivers/net/ethernet/intel/igb/e1000_i210.c
278     index 07d48f2e3369..6766081f5ab9 100644
279     --- a/drivers/net/ethernet/intel/igb/e1000_i210.c
280     +++ b/drivers/net/ethernet/intel/igb/e1000_i210.c
281     @@ -862,6 +862,7 @@ s32 igb_pll_workaround_i210(struct e1000_hw *hw)
282     nvm_word = E1000_INVM_DEFAULT_AL;
283     tmp_nvm = nvm_word | E1000_INVM_PLL_WO_VAL;
284     igb_write_phy_reg_82580(hw, I347AT4_PAGE_SELECT, E1000_PHY_PLL_FREQ_PAGE);
285     + phy_word = E1000_PHY_PLL_UNCONF;
286     for (i = 0; i < E1000_MAX_PLL_TRIES; i++) {
287     /* check current state directly from internal PHY */
288     igb_read_phy_reg_82580(hw, E1000_PHY_PLL_FREQ_REG, &phy_word);
289     diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
290     index 77a60aa5dc7e..8466f3874a28 100644
291     --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
292     +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
293     @@ -1702,7 +1702,9 @@ static s32 ixgbe_get_link_capabilities_X550em(struct ixgbe_hw *hw,
294     *autoneg = false;
295    
296     if (hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
297     - hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1) {
298     + hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1 ||
299     + hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
300     + hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1) {
301     *speed = IXGBE_LINK_SPEED_1GB_FULL;
302     return 0;
303     }
304     diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
305     index 9a4c4f8281bd..8a9a332d78b4 100644
306     --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
307     +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
308     @@ -1027,8 +1027,8 @@ static int mlx4_en_set_pauseparam(struct net_device *dev,
309    
310     tx_pause = !!(pause->tx_pause);
311     rx_pause = !!(pause->rx_pause);
312     - rx_ppp = priv->prof->rx_ppp && !(tx_pause || rx_pause);
313     - tx_ppp = priv->prof->tx_ppp && !(tx_pause || rx_pause);
314     + rx_ppp = (tx_pause || rx_pause) ? 0 : priv->prof->rx_ppp;
315     + tx_ppp = (tx_pause || rx_pause) ? 0 : priv->prof->tx_ppp;
316    
317     err = mlx4_SET_PORT_general(mdev->dev, priv->port,
318     priv->rx_skb_size + ETH_FCS_LEN,
319     diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c
320     index 5297bf77211c..d608c2a6c01f 100644
321     --- a/drivers/net/ethernet/realtek/8139cp.c
322     +++ b/drivers/net/ethernet/realtek/8139cp.c
323     @@ -578,6 +578,7 @@ static irqreturn_t cp_interrupt (int irq, void *dev_instance)
324     struct cp_private *cp;
325     int handled = 0;
326     u16 status;
327     + u16 mask;
328    
329     if (unlikely(dev == NULL))
330     return IRQ_NONE;
331     @@ -585,6 +586,10 @@ static irqreturn_t cp_interrupt (int irq, void *dev_instance)
332    
333     spin_lock(&cp->lock);
334    
335     + mask = cpr16(IntrMask);
336     + if (!mask)
337     + goto out_unlock;
338     +
339     status = cpr16(IntrStatus);
340     if (!status || (status == 0xFFFF))
341     goto out_unlock;
342     diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
343     index b131e555d3c2..f04be9e8980f 100644
344     --- a/drivers/net/phy/phy_device.c
345     +++ b/drivers/net/phy/phy_device.c
346     @@ -1579,20 +1579,17 @@ static int gen10g_resume(struct phy_device *phydev)
347    
348     static int __set_phy_supported(struct phy_device *phydev, u32 max_speed)
349     {
350     - phydev->supported &= ~(PHY_1000BT_FEATURES | PHY_100BT_FEATURES |
351     - PHY_10BT_FEATURES);
352     -
353     switch (max_speed) {
354     - default:
355     - return -ENOTSUPP;
356     - case SPEED_1000:
357     - phydev->supported |= PHY_1000BT_FEATURES;
358     + case SPEED_10:
359     + phydev->supported &= ~PHY_100BT_FEATURES;
360     /* fall through */
361     case SPEED_100:
362     - phydev->supported |= PHY_100BT_FEATURES;
363     - /* fall through */
364     - case SPEED_10:
365     - phydev->supported |= PHY_10BT_FEATURES;
366     + phydev->supported &= ~PHY_1000BT_FEATURES;
367     + break;
368     + case SPEED_1000:
369     + break;
370     + default:
371     + return -ENOTSUPP;
372     }
373    
374     return 0;
375     diff --git a/drivers/net/tun.c b/drivers/net/tun.c
376     index 0260bc15bc0c..7a0d5e928bec 100644
377     --- a/drivers/net/tun.c
378     +++ b/drivers/net/tun.c
379     @@ -1570,9 +1570,9 @@ static void tun_setup(struct net_device *dev)
380     */
381     static int tun_validate(struct nlattr *tb[], struct nlattr *data[])
382     {
383     - if (!data)
384     - return 0;
385     - return -EINVAL;
386     + /* NL_SET_ERR_MSG(extack,
387     + "tun/tap creation via rtnetlink is not supported."); */
388     + return -EOPNOTSUPP;
389     }
390    
391     static struct rtnl_link_ops tun_link_ops __read_mostly = {
392     diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
393     index dea018cba094..1253fe118044 100644
394     --- a/drivers/staging/speakup/kobjects.c
395     +++ b/drivers/staging/speakup/kobjects.c
396     @@ -387,7 +387,7 @@ static ssize_t synth_store(struct kobject *kobj, struct kobj_attribute *attr,
397     len = strlen(buf);
398     if (len < 2 || len > 9)
399     return -EINVAL;
400     - strncpy(new_synth_name, buf, len);
401     + memcpy(new_synth_name, buf, len);
402     if (new_synth_name[len - 1] == '\n')
403     len--;
404     new_synth_name[len] = '\0';
405     @@ -517,7 +517,7 @@ static ssize_t punc_store(struct kobject *kobj, struct kobj_attribute *attr,
406     return -EINVAL;
407     }
408    
409     - strncpy(punc_buf, buf, x);
410     + memcpy(punc_buf, buf, x);
411    
412     while (x && punc_buf[x - 1] == '\n')
413     x--;
414     diff --git a/drivers/usb/gadget/udc/omap_udc.c b/drivers/usb/gadget/udc/omap_udc.c
415     index a8709f9e5648..9eed4947aad8 100644
416     --- a/drivers/usb/gadget/udc/omap_udc.c
417     +++ b/drivers/usb/gadget/udc/omap_udc.c
418     @@ -2037,6 +2037,7 @@ static inline int machine_without_vbus_sense(void)
419     {
420     return machine_is_omap_innovator()
421     || machine_is_omap_osk()
422     + || machine_is_omap_palmte()
423     || machine_is_sx1()
424     /* No known omap7xx boards with vbus sense */
425     || cpu_is_omap7xx();
426     @@ -2045,7 +2046,7 @@ static inline int machine_without_vbus_sense(void)
427     static int omap_udc_start(struct usb_gadget *g,
428     struct usb_gadget_driver *driver)
429     {
430     - int status = -ENODEV;
431     + int status;
432     struct omap_ep *ep;
433     unsigned long flags;
434    
435     @@ -2083,6 +2084,7 @@ static int omap_udc_start(struct usb_gadget *g,
436     goto done;
437     }
438     } else {
439     + status = 0;
440     if (can_pullup(udc))
441     pullup_enable(udc);
442     else
443     @@ -2612,9 +2614,22 @@ omap_ep_setup(char *name, u8 addr, u8 type,
444    
445     static void omap_udc_release(struct device *dev)
446     {
447     - complete(udc->done);
448     + pullup_disable(udc);
449     + if (!IS_ERR_OR_NULL(udc->transceiver)) {
450     + usb_put_phy(udc->transceiver);
451     + udc->transceiver = NULL;
452     + }
453     + omap_writew(0, UDC_SYSCON1);
454     + remove_proc_file();
455     + if (udc->dc_clk) {
456     + if (udc->clk_requested)
457     + omap_udc_enable_clock(0);
458     + clk_put(udc->hhc_clk);
459     + clk_put(udc->dc_clk);
460     + }
461     + if (udc->done)
462     + complete(udc->done);
463     kfree(udc);
464     - udc = NULL;
465     }
466    
467     static int
468     @@ -2886,8 +2901,8 @@ bad_on_1710:
469     udc->clr_halt = UDC_RESET_EP;
470    
471     /* USB general purpose IRQ: ep0, state changes, dma, etc */
472     - status = request_irq(pdev->resource[1].start, omap_udc_irq,
473     - 0, driver_name, udc);
474     + status = devm_request_irq(&pdev->dev, pdev->resource[1].start,
475     + omap_udc_irq, 0, driver_name, udc);
476     if (status != 0) {
477     ERR("can't get irq %d, err %d\n",
478     (int) pdev->resource[1].start, status);
479     @@ -2895,20 +2910,20 @@ bad_on_1710:
480     }
481    
482     /* USB "non-iso" IRQ (PIO for all but ep0) */
483     - status = request_irq(pdev->resource[2].start, omap_udc_pio_irq,
484     - 0, "omap_udc pio", udc);
485     + status = devm_request_irq(&pdev->dev, pdev->resource[2].start,
486     + omap_udc_pio_irq, 0, "omap_udc pio", udc);
487     if (status != 0) {
488     ERR("can't get irq %d, err %d\n",
489     (int) pdev->resource[2].start, status);
490     - goto cleanup2;
491     + goto cleanup1;
492     }
493     #ifdef USE_ISO
494     - status = request_irq(pdev->resource[3].start, omap_udc_iso_irq,
495     - 0, "omap_udc iso", udc);
496     + status = devm_request_irq(&pdev->dev, pdev->resource[3].start,
497     + omap_udc_iso_irq, 0, "omap_udc iso", udc);
498     if (status != 0) {
499     ERR("can't get irq %d, err %d\n",
500     (int) pdev->resource[3].start, status);
501     - goto cleanup3;
502     + goto cleanup1;
503     }
504     #endif
505     if (cpu_is_omap16xx() || cpu_is_omap7xx()) {
506     @@ -2919,23 +2934,8 @@ bad_on_1710:
507     }
508    
509     create_proc_file();
510     - status = usb_add_gadget_udc_release(&pdev->dev, &udc->gadget,
511     - omap_udc_release);
512     - if (status)
513     - goto cleanup4;
514     -
515     - return 0;
516     -
517     -cleanup4:
518     - remove_proc_file();
519     -
520     -#ifdef USE_ISO
521     -cleanup3:
522     - free_irq(pdev->resource[2].start, udc);
523     -#endif
524     -
525     -cleanup2:
526     - free_irq(pdev->resource[1].start, udc);
527     + return usb_add_gadget_udc_release(&pdev->dev, &udc->gadget,
528     + omap_udc_release);
529    
530     cleanup1:
531     kfree(udc);
532     @@ -2962,42 +2962,15 @@ static int omap_udc_remove(struct platform_device *pdev)
533     {
534     DECLARE_COMPLETION_ONSTACK(done);
535    
536     - if (!udc)
537     - return -ENODEV;
538     -
539     - usb_del_gadget_udc(&udc->gadget);
540     - if (udc->driver)
541     - return -EBUSY;
542     -
543     udc->done = &done;
544    
545     - pullup_disable(udc);
546     - if (!IS_ERR_OR_NULL(udc->transceiver)) {
547     - usb_put_phy(udc->transceiver);
548     - udc->transceiver = NULL;
549     - }
550     - omap_writew(0, UDC_SYSCON1);
551     -
552     - remove_proc_file();
553     -
554     -#ifdef USE_ISO
555     - free_irq(pdev->resource[3].start, udc);
556     -#endif
557     - free_irq(pdev->resource[2].start, udc);
558     - free_irq(pdev->resource[1].start, udc);
559     + usb_del_gadget_udc(&udc->gadget);
560    
561     - if (udc->dc_clk) {
562     - if (udc->clk_requested)
563     - omap_udc_enable_clock(0);
564     - clk_put(udc->hhc_clk);
565     - clk_put(udc->dc_clk);
566     - }
567     + wait_for_completion(&done);
568    
569     release_mem_region(pdev->resource[0].start,
570     pdev->resource[0].end - pdev->resource[0].start + 1);
571    
572     - wait_for_completion(&done);
573     -
574     return 0;
575     }
576    
577     diff --git a/drivers/xen/xlate_mmu.c b/drivers/xen/xlate_mmu.c
578     index 23f1387b3ef7..e7df65d32c91 100644
579     --- a/drivers/xen/xlate_mmu.c
580     +++ b/drivers/xen/xlate_mmu.c
581     @@ -36,6 +36,7 @@
582     #include <asm/xen/hypervisor.h>
583    
584     #include <xen/xen.h>
585     +#include <xen/xen-ops.h>
586     #include <xen/page.h>
587     #include <xen/interface/xen.h>
588     #include <xen/interface/memory.h>
589     diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
590     index 79dc3ee1de58..a45f26ac5da7 100644
591     --- a/fs/btrfs/send.c
592     +++ b/fs/btrfs/send.c
593     @@ -3349,7 +3349,8 @@ static void free_pending_move(struct send_ctx *sctx, struct pending_dir_move *m)
594     kfree(m);
595     }
596    
597     -static void tail_append_pending_moves(struct pending_dir_move *moves,
598     +static void tail_append_pending_moves(struct send_ctx *sctx,
599     + struct pending_dir_move *moves,
600     struct list_head *stack)
601     {
602     if (list_empty(&moves->list)) {
603     @@ -3360,6 +3361,10 @@ static void tail_append_pending_moves(struct pending_dir_move *moves,
604     list_add_tail(&moves->list, stack);
605     list_splice_tail(&list, stack);
606     }
607     + if (!RB_EMPTY_NODE(&moves->node)) {
608     + rb_erase(&moves->node, &sctx->pending_dir_moves);
609     + RB_CLEAR_NODE(&moves->node);
610     + }
611     }
612    
613     static int apply_children_dir_moves(struct send_ctx *sctx)
614     @@ -3374,7 +3379,7 @@ static int apply_children_dir_moves(struct send_ctx *sctx)
615     return 0;
616    
617     INIT_LIST_HEAD(&stack);
618     - tail_append_pending_moves(pm, &stack);
619     + tail_append_pending_moves(sctx, pm, &stack);
620    
621     while (!list_empty(&stack)) {
622     pm = list_first_entry(&stack, struct pending_dir_move, list);
623     @@ -3385,7 +3390,7 @@ static int apply_children_dir_moves(struct send_ctx *sctx)
624     goto out;
625     pm = get_pending_dir_moves(sctx, parent_ino);
626     if (pm)
627     - tail_append_pending_moves(pm, &stack);
628     + tail_append_pending_moves(sctx, pm, &stack);
629     }
630     return 0;
631    
632     diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c
633     index 5e3bc9de7a16..799b59d96fe2 100644
634     --- a/fs/cachefiles/rdwr.c
635     +++ b/fs/cachefiles/rdwr.c
636     @@ -537,7 +537,10 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
637     netpage->index, cachefiles_gfp);
638     if (ret < 0) {
639     if (ret == -EEXIST) {
640     + put_page(backpage);
641     + backpage = NULL;
642     put_page(netpage);
643     + netpage = NULL;
644     fscache_retrieval_complete(op, 1);
645     continue;
646     }
647     @@ -610,7 +613,10 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
648     netpage->index, cachefiles_gfp);
649     if (ret < 0) {
650     if (ret == -EEXIST) {
651     + put_page(backpage);
652     + backpage = NULL;
653     put_page(netpage);
654     + netpage = NULL;
655     fscache_retrieval_complete(op, 1);
656     continue;
657     }
658     @@ -963,11 +969,8 @@ error:
659     void cachefiles_uncache_page(struct fscache_object *_object, struct page *page)
660     {
661     struct cachefiles_object *object;
662     - struct cachefiles_cache *cache;
663    
664     object = container_of(_object, struct cachefiles_object, fscache);
665     - cache = container_of(object->fscache.cache,
666     - struct cachefiles_cache, cache);
667    
668     _enter("%p,{%lu}", object, page->index);
669    
670     diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
671     index a4b531be9168..7a7bba7c2328 100644
672     --- a/fs/exportfs/expfs.c
673     +++ b/fs/exportfs/expfs.c
674     @@ -76,7 +76,7 @@ static bool dentry_connected(struct dentry *dentry)
675     struct dentry *parent = dget_parent(dentry);
676    
677     dput(dentry);
678     - if (IS_ROOT(dentry)) {
679     + if (dentry == parent) {
680     dput(parent);
681     return false;
682     }
683     diff --git a/fs/fscache/object.c b/fs/fscache/object.c
684     index 7a182c87f378..ab1d7f35f6c2 100644
685     --- a/fs/fscache/object.c
686     +++ b/fs/fscache/object.c
687     @@ -715,6 +715,9 @@ static const struct fscache_state *fscache_drop_object(struct fscache_object *ob
688    
689     if (awaken)
690     wake_up_bit(&cookie->flags, FSCACHE_COOKIE_INVALIDATING);
691     + if (test_and_clear_bit(FSCACHE_COOKIE_LOOKING_UP, &cookie->flags))
692     + wake_up_bit(&cookie->flags, FSCACHE_COOKIE_LOOKING_UP);
693     +
694    
695     /* Prevent a race with our last child, which has to signal EV_CLEARED
696     * before dropping our spinlock.
697     diff --git a/fs/hfs/btree.c b/fs/hfs/btree.c
698     index 37cdd955eceb..320f4372f172 100644
699     --- a/fs/hfs/btree.c
700     +++ b/fs/hfs/btree.c
701     @@ -328,13 +328,14 @@ void hfs_bmap_free(struct hfs_bnode *node)
702    
703     nidx -= len * 8;
704     i = node->next;
705     - hfs_bnode_put(node);
706     if (!i) {
707     /* panic */;
708     pr_crit("unable to free bnode %u. bmap not found!\n",
709     node->this);
710     + hfs_bnode_put(node);
711     return;
712     }
713     + hfs_bnode_put(node);
714     node = hfs_bnode_find(tree, i);
715     if (IS_ERR(node))
716     return;
717     diff --git a/fs/hfsplus/btree.c b/fs/hfsplus/btree.c
718     index d9d1a36ba826..8d2256454efe 100644
719     --- a/fs/hfsplus/btree.c
720     +++ b/fs/hfsplus/btree.c
721     @@ -453,14 +453,15 @@ void hfs_bmap_free(struct hfs_bnode *node)
722    
723     nidx -= len * 8;
724     i = node->next;
725     - hfs_bnode_put(node);
726     if (!i) {
727     /* panic */;
728     pr_crit("unable to free bnode %u. "
729     "bmap not found!\n",
730     node->this);
731     + hfs_bnode_put(node);
732     return;
733     }
734     + hfs_bnode_put(node);
735     node = hfs_bnode_find(tree, i);
736     if (IS_ERR(node))
737     return;
738     diff --git a/fs/ocfs2/export.c b/fs/ocfs2/export.c
739     index 827fc9809bc2..3494e220b510 100644
740     --- a/fs/ocfs2/export.c
741     +++ b/fs/ocfs2/export.c
742     @@ -125,10 +125,10 @@ check_err:
743    
744     check_gen:
745     if (handle->ih_generation != inode->i_generation) {
746     - iput(inode);
747     trace_ocfs2_get_dentry_generation((unsigned long long)blkno,
748     handle->ih_generation,
749     inode->i_generation);
750     + iput(inode);
751     result = ERR_PTR(-ESTALE);
752     goto bail;
753     }
754     diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c
755     index 4e8f32eb0bdb..c179afd0051a 100644
756     --- a/fs/ocfs2/move_extents.c
757     +++ b/fs/ocfs2/move_extents.c
758     @@ -156,18 +156,14 @@ out:
759     }
760    
761     /*
762     - * lock allocators, and reserving appropriate number of bits for
763     - * meta blocks and data clusters.
764     - *
765     - * in some cases, we don't need to reserve clusters, just let data_ac
766     - * be NULL.
767     + * lock allocator, and reserve appropriate number of bits for
768     + * meta blocks.
769     */
770     -static int ocfs2_lock_allocators_move_extents(struct inode *inode,
771     +static int ocfs2_lock_meta_allocator_move_extents(struct inode *inode,
772     struct ocfs2_extent_tree *et,
773     u32 clusters_to_move,
774     u32 extents_to_split,
775     struct ocfs2_alloc_context **meta_ac,
776     - struct ocfs2_alloc_context **data_ac,
777     int extra_blocks,
778     int *credits)
779     {
780     @@ -192,13 +188,6 @@ static int ocfs2_lock_allocators_move_extents(struct inode *inode,
781     goto out;
782     }
783    
784     - if (data_ac) {
785     - ret = ocfs2_reserve_clusters(osb, clusters_to_move, data_ac);
786     - if (ret) {
787     - mlog_errno(ret);
788     - goto out;
789     - }
790     - }
791    
792     *credits += ocfs2_calc_extend_credits(osb->sb, et->et_root_el);
793    
794     @@ -260,10 +249,10 @@ static int ocfs2_defrag_extent(struct ocfs2_move_extents_context *context,
795     }
796     }
797    
798     - ret = ocfs2_lock_allocators_move_extents(inode, &context->et, *len, 1,
799     - &context->meta_ac,
800     - &context->data_ac,
801     - extra_blocks, &credits);
802     + ret = ocfs2_lock_meta_allocator_move_extents(inode, &context->et,
803     + *len, 1,
804     + &context->meta_ac,
805     + extra_blocks, &credits);
806     if (ret) {
807     mlog_errno(ret);
808     goto out;
809     @@ -286,6 +275,21 @@ static int ocfs2_defrag_extent(struct ocfs2_move_extents_context *context,
810     }
811     }
812    
813     + /*
814     + * Make sure ocfs2_reserve_cluster is called after
815     + * __ocfs2_flush_truncate_log, otherwise, dead lock may happen.
816     + *
817     + * If ocfs2_reserve_cluster is called
818     + * before __ocfs2_flush_truncate_log, dead lock on global bitmap
819     + * may happen.
820     + *
821     + */
822     + ret = ocfs2_reserve_clusters(osb, *len, &context->data_ac);
823     + if (ret) {
824     + mlog_errno(ret);
825     + goto out_unlock_mutex;
826     + }
827     +
828     handle = ocfs2_start_trans(osb, credits);
829     if (IS_ERR(handle)) {
830     ret = PTR_ERR(handle);
831     @@ -606,9 +610,10 @@ static int ocfs2_move_extent(struct ocfs2_move_extents_context *context,
832     }
833     }
834    
835     - ret = ocfs2_lock_allocators_move_extents(inode, &context->et, len, 1,
836     - &context->meta_ac,
837     - NULL, extra_blocks, &credits);
838     + ret = ocfs2_lock_meta_allocator_move_extents(inode, &context->et,
839     + len, 1,
840     + &context->meta_ac,
841     + extra_blocks, &credits);
842     if (ret) {
843     mlog_errno(ret);
844     goto out;
845     diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
846     index 43033a3d66d5..2434bffbc6dd 100644
847     --- a/fs/pstore/platform.c
848     +++ b/fs/pstore/platform.c
849     @@ -584,8 +584,8 @@ static void pstore_console_write(struct console *con, const char *s, unsigned c)
850     } else {
851     spin_lock_irqsave(&psinfo->buf_lock, flags);
852     }
853     - memcpy(psinfo->buf, s, c);
854     - psinfo->write(PSTORE_TYPE_CONSOLE, 0, &id, 0, 0, 0, c, psinfo);
855     + psinfo->write_buf(PSTORE_TYPE_CONSOLE, 0, &id, 0,
856     + s, 0, c, psinfo);
857     spin_unlock_irqrestore(&psinfo->buf_lock, flags);
858     s += c;
859     c = e - s;
860     diff --git a/fs/sysv/inode.c b/fs/sysv/inode.c
861     index d62c423a5a2d..7b391b43bcf5 100644
862     --- a/fs/sysv/inode.c
863     +++ b/fs/sysv/inode.c
864     @@ -275,7 +275,7 @@ static int __sysv_write_inode(struct inode *inode, int wait)
865     }
866     }
867     brelse(bh);
868     - return 0;
869     + return err;
870     }
871    
872     int sysv_write_inode(struct inode *inode, struct writeback_control *wbc)
873     diff --git a/include/net/neighbour.h b/include/net/neighbour.h
874     index 8b683841e574..f6017ddc4ded 100644
875     --- a/include/net/neighbour.h
876     +++ b/include/net/neighbour.h
877     @@ -448,6 +448,7 @@ static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb)
878    
879     static inline int neigh_hh_output(const struct hh_cache *hh, struct sk_buff *skb)
880     {
881     + unsigned int hh_alen = 0;
882     unsigned int seq;
883     int hh_len;
884    
885     @@ -455,16 +456,33 @@ static inline int neigh_hh_output(const struct hh_cache *hh, struct sk_buff *skb
886     seq = read_seqbegin(&hh->hh_lock);
887     hh_len = hh->hh_len;
888     if (likely(hh_len <= HH_DATA_MOD)) {
889     - /* this is inlined by gcc */
890     - memcpy(skb->data - HH_DATA_MOD, hh->hh_data, HH_DATA_MOD);
891     + hh_alen = HH_DATA_MOD;
892     +
893     + /* skb_push() would proceed silently if we have room for
894     + * the unaligned size but not for the aligned size:
895     + * check headroom explicitly.
896     + */
897     + if (likely(skb_headroom(skb) >= HH_DATA_MOD)) {
898     + /* this is inlined by gcc */
899     + memcpy(skb->data - HH_DATA_MOD, hh->hh_data,
900     + HH_DATA_MOD);
901     + }
902     } else {
903     - int hh_alen = HH_DATA_ALIGN(hh_len);
904     + hh_alen = HH_DATA_ALIGN(hh_len);
905    
906     - memcpy(skb->data - hh_alen, hh->hh_data, hh_alen);
907     + if (likely(skb_headroom(skb) >= hh_alen)) {
908     + memcpy(skb->data - hh_alen, hh->hh_data,
909     + hh_alen);
910     + }
911     }
912     } while (read_seqretry(&hh->hh_lock, seq));
913    
914     - skb_push(skb, hh_len);
915     + if (WARN_ON_ONCE(skb_headroom(skb) < hh_alen)) {
916     + kfree_skb(skb);
917     + return NET_XMIT_DROP;
918     + }
919     +
920     + __skb_push(skb, hh_len);
921     return dev_queue_xmit(skb);
922     }
923    
924     diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
925     index 41805fb3c661..7cc06f267be5 100644
926     --- a/kernel/trace/bpf_trace.c
927     +++ b/kernel/trace/bpf_trace.c
928     @@ -161,11 +161,13 @@ BPF_CALL_5(bpf_trace_printk, char *, fmt, u32, fmt_size, u64, arg1,
929     i++;
930     } else if (fmt[i] == 'p' || fmt[i] == 's') {
931     mod[fmt_cnt]++;
932     - i++;
933     - if (!isspace(fmt[i]) && !ispunct(fmt[i]) && fmt[i] != 0)
934     + /* disallow any further format extensions */
935     + if (fmt[i + 1] != 0 &&
936     + !isspace(fmt[i + 1]) &&
937     + !ispunct(fmt[i + 1]))
938     return -EINVAL;
939     fmt_cnt++;
940     - if (fmt[i - 1] == 's') {
941     + if (fmt[i] == 's') {
942     if (str_seen)
943     /* allow only one '%s' per fmt string */
944     return -EINVAL;
945     diff --git a/lib/debugobjects.c b/lib/debugobjects.c
946     index 88580e8ee39e..1c43d4c5d2ab 100644
947     --- a/lib/debugobjects.c
948     +++ b/lib/debugobjects.c
949     @@ -1110,7 +1110,8 @@ void __init debug_objects_mem_init(void)
950    
951     obj_cache = kmem_cache_create("debug_objects_cache",
952     sizeof (struct debug_obj), 0,
953     - SLAB_DEBUG_OBJECTS, NULL);
954     + SLAB_DEBUG_OBJECTS | SLAB_NOLEAKTRACE,
955     + NULL);
956    
957     if (!obj_cache || debug_objects_replace_static_objects()) {
958     debug_objects_enabled = 0;
959     diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
960     index 928a0b84469d..ba724576764e 100644
961     --- a/net/core/rtnetlink.c
962     +++ b/net/core/rtnetlink.c
963     @@ -3186,6 +3186,9 @@ int ndo_dflt_fdb_dump(struct sk_buff *skb,
964     {
965     int err;
966    
967     + if (dev->type != ARPHRD_ETHER)
968     + return -EINVAL;
969     +
970     netif_addr_lock_bh(dev);
971     err = nlmsg_populate_fdb(skb, cb, dev, idx, &dev->uc);
972     if (err)
973     diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
974     index bd68f073570b..6f35cdd5f2f0 100644
975     --- a/net/ipv4/tcp_output.c
976     +++ b/net/ipv4/tcp_output.c
977     @@ -2346,14 +2346,18 @@ void tcp_send_loss_probe(struct sock *sk)
978     skb = tcp_write_queue_tail(sk);
979     }
980    
981     + if (unlikely(!skb)) {
982     + WARN_ONCE(tp->packets_out,
983     + "invalid inflight: %u state %u cwnd %u mss %d\n",
984     + tp->packets_out, sk->sk_state, tp->snd_cwnd, mss);
985     + inet_csk(sk)->icsk_pending = 0;
986     + return;
987     + }
988     +
989     /* At most one outstanding TLP retransmission. */
990     if (tp->tlp_high_seq)
991     goto rearm_timer;
992    
993     - /* Retransmit last segment. */
994     - if (WARN_ON(!skb))
995     - goto rearm_timer;
996     -
997     if (skb_still_in_host_queue(sk, skb))
998     goto rearm_timer;
999    
1000     diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
1001     index 8e77cecd2165..b723987761be 100644
1002     --- a/net/ipv6/ip6_output.c
1003     +++ b/net/ipv6/ip6_output.c
1004     @@ -177,37 +177,37 @@ int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
1005     const struct ipv6_pinfo *np = inet6_sk(sk);
1006     struct in6_addr *first_hop = &fl6->daddr;
1007     struct dst_entry *dst = skb_dst(skb);
1008     + unsigned int head_room;
1009     struct ipv6hdr *hdr;
1010     u8 proto = fl6->flowi6_proto;
1011     int seg_len = skb->len;
1012     int hlimit = -1;
1013     u32 mtu;
1014    
1015     - if (opt) {
1016     - unsigned int head_room;
1017     + head_room = sizeof(struct ipv6hdr) + LL_RESERVED_SPACE(dst->dev);
1018     + if (opt)
1019     + head_room += opt->opt_nflen + opt->opt_flen;
1020    
1021     - /* First: exthdrs may take lots of space (~8K for now)
1022     - MAX_HEADER is not enough.
1023     - */
1024     - head_room = opt->opt_nflen + opt->opt_flen;
1025     - seg_len += head_room;
1026     - head_room += sizeof(struct ipv6hdr) + LL_RESERVED_SPACE(dst->dev);
1027     -
1028     - if (skb_headroom(skb) < head_room) {
1029     - struct sk_buff *skb2 = skb_realloc_headroom(skb, head_room);
1030     - if (!skb2) {
1031     - IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
1032     - IPSTATS_MIB_OUTDISCARDS);
1033     - kfree_skb(skb);
1034     - return -ENOBUFS;
1035     - }
1036     - if (skb->sk)
1037     - skb_set_owner_w(skb2, skb->sk);
1038     - consume_skb(skb);
1039     - skb = skb2;
1040     + if (unlikely(skb_headroom(skb) < head_room)) {
1041     + struct sk_buff *skb2 = skb_realloc_headroom(skb, head_room);
1042     + if (!skb2) {
1043     + IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
1044     + IPSTATS_MIB_OUTDISCARDS);
1045     + kfree_skb(skb);
1046     + return -ENOBUFS;
1047     }
1048     + if (skb->sk)
1049     + skb_set_owner_w(skb2, skb->sk);
1050     + consume_skb(skb);
1051     + skb = skb2;
1052     + }
1053     +
1054     + if (opt) {
1055     + seg_len += opt->opt_nflen + opt->opt_flen;
1056     +
1057     if (opt->opt_flen)
1058     ipv6_push_frag_opts(skb, opt, &proto);
1059     +
1060     if (opt->opt_nflen)
1061     ipv6_push_nfrag_opts(skb, opt, &proto, &first_hop);
1062     }
1063     diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
1064     index 079b3c426720..8382b7880b24 100644
1065     --- a/net/netfilter/ipvs/ip_vs_ctl.c
1066     +++ b/net/netfilter/ipvs/ip_vs_ctl.c
1067     @@ -4013,6 +4013,9 @@ static void __net_exit ip_vs_control_net_cleanup_sysctl(struct netns_ipvs *ipvs)
1068    
1069     static struct notifier_block ip_vs_dst_notifier = {
1070     .notifier_call = ip_vs_dst_event,
1071     +#ifdef CONFIG_IP_VS_IPV6
1072     + .priority = ADDRCONF_NOTIFY_PRIORITY + 5,
1073     +#endif
1074     };
1075    
1076     int __net_init ip_vs_control_net_init(struct netns_ipvs *ipvs)
1077     diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
1078     index 3f87ddb1777d..2e417c907a28 100644
1079     --- a/net/sched/sch_netem.c
1080     +++ b/net/sched/sch_netem.c
1081     @@ -442,6 +442,9 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch,
1082     int count = 1;
1083     int rc = NET_XMIT_SUCCESS;
1084    
1085     + /* Do not fool qdisc_drop_all() */
1086     + skb->prev = NULL;
1087     +
1088     /* Random duplication */
1089     if (q->duplicate && q->duplicate >= get_crandom(&q->dup_cor))
1090     ++count;
1091     diff --git a/sound/soc/omap/omap-abe-twl6040.c b/sound/soc/omap/omap-abe-twl6040.c
1092     index 89fe95e877db..07af30017b48 100644
1093     --- a/sound/soc/omap/omap-abe-twl6040.c
1094     +++ b/sound/soc/omap/omap-abe-twl6040.c
1095     @@ -36,6 +36,8 @@
1096     #include "../codecs/twl6040.h"
1097    
1098     struct abe_twl6040 {
1099     + struct snd_soc_card card;
1100     + struct snd_soc_dai_link dai_links[2];
1101     int jack_detection; /* board can detect jack events */
1102     int mclk_freq; /* MCLK frequency speed for twl6040 */
1103     };
1104     @@ -208,40 +210,10 @@ static int omap_abe_dmic_init(struct snd_soc_pcm_runtime *rtd)
1105     ARRAY_SIZE(dmic_audio_map));
1106     }
1107    
1108     -/* Digital audio interface glue - connects codec <--> CPU */
1109     -static struct snd_soc_dai_link abe_twl6040_dai_links[] = {
1110     - {
1111     - .name = "TWL6040",
1112     - .stream_name = "TWL6040",
1113     - .codec_dai_name = "twl6040-legacy",
1114     - .codec_name = "twl6040-codec",
1115     - .init = omap_abe_twl6040_init,
1116     - .ops = &omap_abe_ops,
1117     - },
1118     - {
1119     - .name = "DMIC",
1120     - .stream_name = "DMIC Capture",
1121     - .codec_dai_name = "dmic-hifi",
1122     - .codec_name = "dmic-codec",
1123     - .init = omap_abe_dmic_init,
1124     - .ops = &omap_abe_dmic_ops,
1125     - },
1126     -};
1127     -
1128     -/* Audio machine driver */
1129     -static struct snd_soc_card omap_abe_card = {
1130     - .owner = THIS_MODULE,
1131     -
1132     - .dapm_widgets = twl6040_dapm_widgets,
1133     - .num_dapm_widgets = ARRAY_SIZE(twl6040_dapm_widgets),
1134     - .dapm_routes = audio_map,
1135     - .num_dapm_routes = ARRAY_SIZE(audio_map),
1136     -};
1137     -
1138     static int omap_abe_probe(struct platform_device *pdev)
1139     {
1140     struct device_node *node = pdev->dev.of_node;
1141     - struct snd_soc_card *card = &omap_abe_card;
1142     + struct snd_soc_card *card;
1143     struct device_node *dai_node;
1144     struct abe_twl6040 *priv;
1145     int num_links = 0;
1146     @@ -252,12 +224,18 @@ static int omap_abe_probe(struct platform_device *pdev)
1147     return -ENODEV;
1148     }
1149    
1150     - card->dev = &pdev->dev;
1151     -
1152     priv = devm_kzalloc(&pdev->dev, sizeof(struct abe_twl6040), GFP_KERNEL);
1153     if (priv == NULL)
1154     return -ENOMEM;
1155    
1156     + card = &priv->card;
1157     + card->dev = &pdev->dev;
1158     + card->owner = THIS_MODULE;
1159     + card->dapm_widgets = twl6040_dapm_widgets;
1160     + card->num_dapm_widgets = ARRAY_SIZE(twl6040_dapm_widgets);
1161     + card->dapm_routes = audio_map;
1162     + card->num_dapm_routes = ARRAY_SIZE(audio_map);
1163     +
1164     if (snd_soc_of_parse_card_name(card, "ti,model")) {
1165     dev_err(&pdev->dev, "Card name is not provided\n");
1166     return -ENODEV;
1167     @@ -274,14 +252,27 @@ static int omap_abe_probe(struct platform_device *pdev)
1168     dev_err(&pdev->dev, "McPDM node is not provided\n");
1169     return -EINVAL;
1170     }
1171     - abe_twl6040_dai_links[0].cpu_of_node = dai_node;
1172     - abe_twl6040_dai_links[0].platform_of_node = dai_node;
1173     +
1174     + priv->dai_links[0].name = "DMIC";
1175     + priv->dai_links[0].stream_name = "TWL6040";
1176     + priv->dai_links[0].cpu_of_node = dai_node;
1177     + priv->dai_links[0].platform_of_node = dai_node;
1178     + priv->dai_links[0].codec_dai_name = "twl6040-legacy";
1179     + priv->dai_links[0].codec_name = "twl6040-codec";
1180     + priv->dai_links[0].init = omap_abe_twl6040_init;
1181     + priv->dai_links[0].ops = &omap_abe_ops;
1182    
1183     dai_node = of_parse_phandle(node, "ti,dmic", 0);
1184     if (dai_node) {
1185     num_links = 2;
1186     - abe_twl6040_dai_links[1].cpu_of_node = dai_node;
1187     - abe_twl6040_dai_links[1].platform_of_node = dai_node;
1188     + priv->dai_links[1].name = "TWL6040";
1189     + priv->dai_links[1].stream_name = "DMIC Capture";
1190     + priv->dai_links[1].cpu_of_node = dai_node;
1191     + priv->dai_links[1].platform_of_node = dai_node;
1192     + priv->dai_links[1].codec_dai_name = "dmic-hifi";
1193     + priv->dai_links[1].codec_name = "dmic-codec";
1194     + priv->dai_links[1].init = omap_abe_dmic_init;
1195     + priv->dai_links[1].ops = &omap_abe_dmic_ops;
1196     } else {
1197     num_links = 1;
1198     }
1199     @@ -300,7 +291,7 @@ static int omap_abe_probe(struct platform_device *pdev)
1200     return -ENODEV;
1201     }
1202    
1203     - card->dai_link = abe_twl6040_dai_links;
1204     + card->dai_link = priv->dai_links;
1205     card->num_links = num_links;
1206    
1207     snd_soc_card_set_drvdata(card, priv);
1208     diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c
1209     index 09db2aec12a3..776e809a8aab 100644
1210     --- a/sound/soc/omap/omap-dmic.c
1211     +++ b/sound/soc/omap/omap-dmic.c
1212     @@ -48,6 +48,8 @@ struct omap_dmic {
1213     struct device *dev;
1214     void __iomem *io_base;
1215     struct clk *fclk;
1216     + struct pm_qos_request pm_qos_req;
1217     + int latency;
1218     int fclk_freq;
1219     int out_freq;
1220     int clk_div;
1221     @@ -124,6 +126,8 @@ static void omap_dmic_dai_shutdown(struct snd_pcm_substream *substream,
1222    
1223     mutex_lock(&dmic->mutex);
1224    
1225     + pm_qos_remove_request(&dmic->pm_qos_req);
1226     +
1227     if (!dai->active)
1228     dmic->active = 0;
1229    
1230     @@ -226,6 +230,8 @@ static int omap_dmic_dai_hw_params(struct snd_pcm_substream *substream,
1231     /* packet size is threshold * channels */
1232     dma_data = snd_soc_dai_get_dma_data(dai, substream);
1233     dma_data->maxburst = dmic->threshold * channels;
1234     + dmic->latency = (OMAP_DMIC_THRES_MAX - dmic->threshold) * USEC_PER_SEC /
1235     + params_rate(params);
1236    
1237     return 0;
1238     }
1239     @@ -236,6 +242,9 @@ static int omap_dmic_dai_prepare(struct snd_pcm_substream *substream,
1240     struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai);
1241     u32 ctrl;
1242    
1243     + if (pm_qos_request_active(&dmic->pm_qos_req))
1244     + pm_qos_update_request(&dmic->pm_qos_req, dmic->latency);
1245     +
1246     /* Configure uplink threshold */
1247     omap_dmic_write(dmic, OMAP_DMIC_FIFO_CTRL_REG, dmic->threshold);
1248    
1249     diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c
1250     index 64609c77a79d..44ffeb71cd1d 100644
1251     --- a/sound/soc/omap/omap-mcpdm.c
1252     +++ b/sound/soc/omap/omap-mcpdm.c
1253     @@ -54,6 +54,8 @@ struct omap_mcpdm {
1254     unsigned long phys_base;
1255     void __iomem *io_base;
1256     int irq;
1257     + struct pm_qos_request pm_qos_req;
1258     + int latency[2];
1259    
1260     struct mutex mutex;
1261    
1262     @@ -277,6 +279,9 @@ static void omap_mcpdm_dai_shutdown(struct snd_pcm_substream *substream,
1263     struct snd_soc_dai *dai)
1264     {
1265     struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
1266     + int tx = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
1267     + int stream1 = tx ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE;
1268     + int stream2 = tx ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK;
1269    
1270     mutex_lock(&mcpdm->mutex);
1271    
1272     @@ -289,6 +294,14 @@ static void omap_mcpdm_dai_shutdown(struct snd_pcm_substream *substream,
1273     }
1274     }
1275    
1276     + if (mcpdm->latency[stream2])
1277     + pm_qos_update_request(&mcpdm->pm_qos_req,
1278     + mcpdm->latency[stream2]);
1279     + else if (mcpdm->latency[stream1])
1280     + pm_qos_remove_request(&mcpdm->pm_qos_req);
1281     +
1282     + mcpdm->latency[stream1] = 0;
1283     +
1284     mutex_unlock(&mcpdm->mutex);
1285     }
1286    
1287     @@ -300,7 +313,7 @@ static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream,
1288     int stream = substream->stream;
1289     struct snd_dmaengine_dai_dma_data *dma_data;
1290     u32 threshold;
1291     - int channels;
1292     + int channels, latency;
1293     int link_mask = 0;
1294    
1295     channels = params_channels(params);
1296     @@ -340,14 +353,25 @@ static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream,
1297    
1298     dma_data->maxburst =
1299     (MCPDM_DN_THRES_MAX - threshold) * channels;
1300     + latency = threshold;
1301     } else {
1302     /* If playback is not running assume a stereo stream to come */
1303     if (!mcpdm->config[!stream].link_mask)
1304     mcpdm->config[!stream].link_mask = (0x3 << 3);
1305    
1306     dma_data->maxburst = threshold * channels;
1307     + latency = (MCPDM_DN_THRES_MAX - threshold);
1308     }
1309    
1310     + /*
1311     + * The DMA must act to a DMA request within latency time (usec) to avoid
1312     + * under/overflow
1313     + */
1314     + mcpdm->latency[stream] = latency * USEC_PER_SEC / params_rate(params);
1315     +
1316     + if (!mcpdm->latency[stream])
1317     + mcpdm->latency[stream] = 10;
1318     +
1319     /* Check if we need to restart McPDM with this stream */
1320     if (mcpdm->config[stream].link_mask &&
1321     mcpdm->config[stream].link_mask != link_mask)
1322     @@ -362,6 +386,20 @@ static int omap_mcpdm_prepare(struct snd_pcm_substream *substream,
1323     struct snd_soc_dai *dai)
1324     {
1325     struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
1326     + struct pm_qos_request *pm_qos_req = &mcpdm->pm_qos_req;
1327     + int tx = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
1328     + int stream1 = tx ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE;
1329     + int stream2 = tx ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK;
1330     + int latency = mcpdm->latency[stream2];
1331     +
1332     + /* Prevent omap hardware from hitting off between FIFO fills */
1333     + if (!latency || mcpdm->latency[stream1] < latency)
1334     + latency = mcpdm->latency[stream1];
1335     +
1336     + if (pm_qos_request_active(pm_qos_req))
1337     + pm_qos_update_request(pm_qos_req, latency);
1338     + else if (latency)
1339     + pm_qos_add_request(pm_qos_req, PM_QOS_CPU_DMA_LATENCY, latency);
1340    
1341     if (!omap_mcpdm_active(mcpdm)) {
1342     omap_mcpdm_start(mcpdm);
1343     @@ -423,6 +461,9 @@ static int omap_mcpdm_remove(struct snd_soc_dai *dai)
1344     free_irq(mcpdm->irq, (void *)mcpdm);
1345     pm_runtime_disable(mcpdm->dev);
1346    
1347     + if (pm_qos_request_active(&mcpdm->pm_qos_req))
1348     + pm_qos_remove_request(&mcpdm->pm_qos_req);
1349     +
1350     return 0;
1351     }
1352    
1353     diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
1354     index 4e3de566809c..168559b5e9f3 100644
1355     --- a/sound/soc/soc-core.c
1356     +++ b/sound/soc/soc-core.c
1357     @@ -2018,6 +2018,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
1358     }
1359    
1360     card->instantiated = 1;
1361     + dapm_mark_endpoints_dirty(card);
1362     snd_soc_dapm_sync(&card->dapm);
1363     mutex_unlock(&card->mutex);
1364     mutex_unlock(&client_mutex);
1365     diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
1366     index 0d1acb704f64..dd4ed7c3c062 100644
1367     --- a/tools/objtool/elf.c
1368     +++ b/tools/objtool/elf.c
1369     @@ -31,6 +31,8 @@
1370     #include "elf.h"
1371     #include "warn.h"
1372    
1373     +#define MAX_NAME_LEN 128
1374     +
1375     struct section *find_section_by_name(struct elf *elf, const char *name)
1376     {
1377     struct section *sec;
1378     @@ -298,6 +300,8 @@ static int read_symbols(struct elf *elf)
1379     /* Create parent/child links for any cold subfunctions */
1380     list_for_each_entry(sec, &elf->sections, list) {
1381     list_for_each_entry(sym, &sec->symbol_list, list) {
1382     + char pname[MAX_NAME_LEN + 1];
1383     + size_t pnamelen;
1384     if (sym->type != STT_FUNC)
1385     continue;
1386     sym->pfunc = sym->cfunc = sym;
1387     @@ -305,14 +309,21 @@ static int read_symbols(struct elf *elf)
1388     if (!coldstr)
1389     continue;
1390    
1391     - coldstr[0] = '\0';
1392     - pfunc = find_symbol_by_name(elf, sym->name);
1393     - coldstr[0] = '.';
1394     + pnamelen = coldstr - sym->name;
1395     + if (pnamelen > MAX_NAME_LEN) {
1396     + WARN("%s(): parent function name exceeds maximum length of %d characters",
1397     + sym->name, MAX_NAME_LEN);
1398     + return -1;
1399     + }
1400     +
1401     + strncpy(pname, sym->name, pnamelen);
1402     + pname[pnamelen] = '\0';
1403     + pfunc = find_symbol_by_name(elf, pname);
1404    
1405     if (!pfunc) {
1406     WARN("%s(): can't find parent function",
1407     sym->name);
1408     - goto err;
1409     + return -1;
1410     }
1411    
1412     sym->pfunc = pfunc;
1413     diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
1414     index 76faf5bf0b32..d37dfc6608c6 100644
1415     --- a/tools/testing/selftests/Makefile
1416     +++ b/tools/testing/selftests/Makefile
1417     @@ -15,6 +15,7 @@ TARGETS += memory-hotplug
1418     TARGETS += mount
1419     TARGETS += mqueue
1420     TARGETS += net
1421     +TARGETS += netfilter
1422     TARGETS += nsfs
1423     TARGETS += powerpc
1424     TARGETS += pstore
1425     diff --git a/tools/testing/selftests/netfilter/Makefile b/tools/testing/selftests/netfilter/Makefile
1426     new file mode 100644
1427     index 000000000000..47ed6cef93fb
1428     --- /dev/null
1429     +++ b/tools/testing/selftests/netfilter/Makefile
1430     @@ -0,0 +1,6 @@
1431     +# SPDX-License-Identifier: GPL-2.0
1432     +# Makefile for netfilter selftests
1433     +
1434     +TEST_PROGS := nft_trans_stress.sh
1435     +
1436     +include ../lib.mk
1437     diff --git a/tools/testing/selftests/netfilter/config b/tools/testing/selftests/netfilter/config
1438     new file mode 100644
1439     index 000000000000..1017313e41a8
1440     --- /dev/null
1441     +++ b/tools/testing/selftests/netfilter/config
1442     @@ -0,0 +1,2 @@
1443     +CONFIG_NET_NS=y
1444     +NF_TABLES_INET=y
1445     diff --git a/tools/testing/selftests/netfilter/nft_trans_stress.sh b/tools/testing/selftests/netfilter/nft_trans_stress.sh
1446     new file mode 100755
1447     index 000000000000..f1affd12c4b1
1448     --- /dev/null
1449     +++ b/tools/testing/selftests/netfilter/nft_trans_stress.sh
1450     @@ -0,0 +1,78 @@
1451     +#!/bin/bash
1452     +#
1453     +# This test is for stress-testing the nf_tables config plane path vs.
1454     +# packet path processing: Make sure we never release rules that are
1455     +# still visible to other cpus.
1456     +#
1457     +# set -e
1458     +
1459     +# Kselftest framework requirement - SKIP code is 4.
1460     +ksft_skip=4
1461     +
1462     +testns=testns1
1463     +tables="foo bar baz quux"
1464     +
1465     +nft --version > /dev/null 2>&1
1466     +if [ $? -ne 0 ];then
1467     + echo "SKIP: Could not run test without nft tool"
1468     + exit $ksft_skip
1469     +fi
1470     +
1471     +ip -Version > /dev/null 2>&1
1472     +if [ $? -ne 0 ];then
1473     + echo "SKIP: Could not run test without ip tool"
1474     + exit $ksft_skip
1475     +fi
1476     +
1477     +tmp=$(mktemp)
1478     +
1479     +for table in $tables; do
1480     + echo add table inet "$table" >> "$tmp"
1481     + echo flush table inet "$table" >> "$tmp"
1482     +
1483     + echo "add chain inet $table INPUT { type filter hook input priority 0; }" >> "$tmp"
1484     + echo "add chain inet $table OUTPUT { type filter hook output priority 0; }" >> "$tmp"
1485     + for c in $(seq 1 400); do
1486     + chain=$(printf "chain%03u" "$c")
1487     + echo "add chain inet $table $chain" >> "$tmp"
1488     + done
1489     +
1490     + for c in $(seq 1 400); do
1491     + chain=$(printf "chain%03u" "$c")
1492     + for BASE in INPUT OUTPUT; do
1493     + echo "add rule inet $table $BASE counter jump $chain" >> "$tmp"
1494     + done
1495     + echo "add rule inet $table $chain counter return" >> "$tmp"
1496     + done
1497     +done
1498     +
1499     +ip netns add "$testns"
1500     +ip -netns "$testns" link set lo up
1501     +
1502     +lscpu | grep ^CPU\(s\): | ( read cpu cpunum ;
1503     +cpunum=$((cpunum-1))
1504     +for i in $(seq 0 $cpunum);do
1505     + mask=$(printf 0x%x $((1<<$i)))
1506     + ip netns exec "$testns" taskset $mask ping -4 127.0.0.1 -fq > /dev/null &
1507     + ip netns exec "$testns" taskset $mask ping -6 ::1 -fq > /dev/null &
1508     +done)
1509     +
1510     +sleep 1
1511     +
1512     +for i in $(seq 1 10) ; do ip netns exec "$testns" nft -f "$tmp" & done
1513     +
1514     +for table in $tables;do
1515     + randsleep=$((RANDOM%10))
1516     + sleep $randsleep
1517     + ip netns exec "$testns" nft delete table inet $table 2>/dev/null
1518     +done
1519     +
1520     +randsleep=$((RANDOM%10))
1521     +sleep $randsleep
1522     +
1523     +pkill -9 ping
1524     +
1525     +wait
1526     +
1527     +rm -f "$tmp"
1528     +ip netns del "$testns"