Magellan Linux

Annotation of /trunk/kernel-alx/patches-3.10/0119-3.10.20-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2347 - (hide annotations) (download)
Mon Dec 16 10:05:01 2013 UTC (10 years, 4 months ago) by niro
File size: 39409 byte(s)
-linux-3.10.20
1 niro 2347 diff --git a/Makefile b/Makefile
2     index 83a02f5b2c00..ba784b7b0f51 100644
3     --- a/Makefile
4     +++ b/Makefile
5     @@ -1,6 +1,6 @@
6     VERSION = 3
7     PATCHLEVEL = 10
8     -SUBLEVEL = 19
9     +SUBLEVEL = 20
10     EXTRAVERSION =
11     NAME = TOSSUG Baby Fish
12    
13     diff --git a/drivers/media/platform/sh_vou.c b/drivers/media/platform/sh_vou.c
14     index 7d0235069c87..5d538e7cd1bb 100644
15     --- a/drivers/media/platform/sh_vou.c
16     +++ b/drivers/media/platform/sh_vou.c
17     @@ -776,7 +776,7 @@ static int sh_vou_try_fmt_vid_out(struct file *file, void *priv,
18     v4l_bound_align_image(&pix->width, 0, VOU_MAX_IMAGE_WIDTH, 1,
19     &pix->height, 0, VOU_MAX_IMAGE_HEIGHT, 1, 0);
20    
21     - for (i = 0; ARRAY_SIZE(vou_fmt); i++)
22     + for (i = 0; i < ARRAY_SIZE(vou_fmt); i++)
23     if (vou_fmt[i].pfmt == pix->pixelformat)
24     return 0;
25    
26     diff --git a/drivers/misc/atmel_pwm.c b/drivers/misc/atmel_pwm.c
27     index 494d0500bda6..a6dc56e1bc58 100644
28     --- a/drivers/misc/atmel_pwm.c
29     +++ b/drivers/misc/atmel_pwm.c
30     @@ -90,8 +90,10 @@ int pwm_channel_alloc(int index, struct pwm_channel *ch)
31     unsigned long flags;
32     int status = 0;
33    
34     - /* insist on PWM init, with this signal pinned out */
35     - if (!pwm || !(pwm->mask & 1 << index))
36     + if (!pwm)
37     + return -EPROBE_DEFER;
38     +
39     + if (!(pwm->mask & 1 << index))
40     return -ENODEV;
41    
42     if (index < 0 || index >= PWM_NCHAN || !ch)
43     diff --git a/drivers/net/ethernet/chelsio/cxgb3/sge.c b/drivers/net/ethernet/chelsio/cxgb3/sge.c
44     index f12e6b85a653..f057a189d975 100644
45     --- a/drivers/net/ethernet/chelsio/cxgb3/sge.c
46     +++ b/drivers/net/ethernet/chelsio/cxgb3/sge.c
47     @@ -1600,7 +1600,8 @@ static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb,
48     flits = skb_transport_offset(skb) / 8;
49     sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl;
50     sgl_flits = make_sgl(skb, sgp, skb_transport_header(skb),
51     - skb->tail - skb->transport_header,
52     + skb_tail_pointer(skb) -
53     + skb_transport_header(skb),
54     adap->pdev);
55     if (need_skb_unmap()) {
56     setup_deferred_unmapping(skb, adap->pdev, sgp, sgl_flits);
57     diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c
58     index 0e572a527154..28d706bd12eb 100644
59     --- a/drivers/net/ethernet/mellanox/mlx4/cmd.c
60     +++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c
61     @@ -1544,7 +1544,7 @@ static void mlx4_master_deactivate_admin_state(struct mlx4_priv *priv, int slave
62     vp_oper->vlan_idx = NO_INDX;
63     }
64     if (NO_INDX != vp_oper->mac_idx) {
65     - __mlx4_unregister_mac(&priv->dev, port, vp_oper->mac_idx);
66     + __mlx4_unregister_mac(&priv->dev, port, vp_oper->state.mac);
67     vp_oper->mac_idx = NO_INDX;
68     }
69     }
70     diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
71     index 1d01534c2020..64cf70247048 100644
72     --- a/drivers/net/virtio_net.c
73     +++ b/drivers/net/virtio_net.c
74     @@ -1096,11 +1096,6 @@ static int virtnet_cpu_callback(struct notifier_block *nfb,
75     {
76     struct virtnet_info *vi = container_of(nfb, struct virtnet_info, nb);
77    
78     - mutex_lock(&vi->config_lock);
79     -
80     - if (!vi->config_enable)
81     - goto done;
82     -
83     switch(action & ~CPU_TASKS_FROZEN) {
84     case CPU_ONLINE:
85     case CPU_DOWN_FAILED:
86     @@ -1114,8 +1109,6 @@ static int virtnet_cpu_callback(struct notifier_block *nfb,
87     break;
88     }
89    
90     -done:
91     - mutex_unlock(&vi->config_lock);
92     return NOTIFY_OK;
93     }
94    
95     @@ -1672,6 +1665,8 @@ static int virtnet_freeze(struct virtio_device *vdev)
96     struct virtnet_info *vi = vdev->priv;
97     int i;
98    
99     + unregister_hotcpu_notifier(&vi->nb);
100     +
101     /* Prevent config work handler from accessing the device */
102     mutex_lock(&vi->config_lock);
103     vi->config_enable = false;
104     @@ -1720,6 +1715,10 @@ static int virtnet_restore(struct virtio_device *vdev)
105     virtnet_set_queues(vi, vi->curr_queue_pairs);
106     rtnl_unlock();
107    
108     + err = register_hotcpu_notifier(&vi->nb);
109     + if (err)
110     + return err;
111     +
112     return 0;
113     }
114     #endif
115     diff --git a/drivers/net/wireless/iwlwifi/iwl-7000.c b/drivers/net/wireless/iwlwifi/iwl-7000.c
116     index dc94d44d95cd..822443c5a3b5 100644
117     --- a/drivers/net/wireless/iwlwifi/iwl-7000.c
118     +++ b/drivers/net/wireless/iwlwifi/iwl-7000.c
119     @@ -125,7 +125,7 @@ static const struct iwl_ht_params iwl7000_ht_params = {
120    
121    
122     const struct iwl_cfg iwl7260_2ac_cfg = {
123     - .name = "Intel(R) Dual Band Wireless AC7260",
124     + .name = "Intel(R) Dual Band Wireless AC 7260",
125     .fw_name_pre = IWL7260_FW_PRE,
126     IWL_DEVICE_7000,
127     .ht_params = &iwl7000_ht_params,
128     @@ -133,8 +133,44 @@ const struct iwl_cfg iwl7260_2ac_cfg = {
129     .nvm_calib_ver = IWL7260_TX_POWER_VERSION,
130     };
131    
132     -const struct iwl_cfg iwl3160_ac_cfg = {
133     - .name = "Intel(R) Dual Band Wireless AC3160",
134     +const struct iwl_cfg iwl7260_2n_cfg = {
135     + .name = "Intel(R) Dual Band Wireless N 7260",
136     + .fw_name_pre = IWL7260_FW_PRE,
137     + IWL_DEVICE_7000,
138     + .ht_params = &iwl7000_ht_params,
139     + .nvm_ver = IWL7260_NVM_VERSION,
140     + .nvm_calib_ver = IWL7260_TX_POWER_VERSION,
141     +};
142     +
143     +const struct iwl_cfg iwl7260_n_cfg = {
144     + .name = "Intel(R) Wireless N 7260",
145     + .fw_name_pre = IWL7260_FW_PRE,
146     + IWL_DEVICE_7000,
147     + .ht_params = &iwl7000_ht_params,
148     + .nvm_ver = IWL7260_NVM_VERSION,
149     + .nvm_calib_ver = IWL7260_TX_POWER_VERSION,
150     +};
151     +
152     +const struct iwl_cfg iwl3160_2ac_cfg = {
153     + .name = "Intel(R) Dual Band Wireless AC 3160",
154     + .fw_name_pre = IWL3160_FW_PRE,
155     + IWL_DEVICE_7000,
156     + .ht_params = &iwl7000_ht_params,
157     + .nvm_ver = IWL3160_NVM_VERSION,
158     + .nvm_calib_ver = IWL3160_TX_POWER_VERSION,
159     +};
160     +
161     +const struct iwl_cfg iwl3160_2n_cfg = {
162     + .name = "Intel(R) Dual Band Wireless N 3160",
163     + .fw_name_pre = IWL3160_FW_PRE,
164     + IWL_DEVICE_7000,
165     + .ht_params = &iwl7000_ht_params,
166     + .nvm_ver = IWL3160_NVM_VERSION,
167     + .nvm_calib_ver = IWL3160_TX_POWER_VERSION,
168     +};
169     +
170     +const struct iwl_cfg iwl3160_n_cfg = {
171     + .name = "Intel(R) Wireless N 3160",
172     .fw_name_pre = IWL3160_FW_PRE,
173     IWL_DEVICE_7000,
174     .ht_params = &iwl7000_ht_params,
175     diff --git a/drivers/net/wireless/iwlwifi/iwl-config.h b/drivers/net/wireless/iwlwifi/iwl-config.h
176     index c67e29655b2d..44e3370ce343 100644
177     --- a/drivers/net/wireless/iwlwifi/iwl-config.h
178     +++ b/drivers/net/wireless/iwlwifi/iwl-config.h
179     @@ -321,6 +321,10 @@ extern const struct iwl_cfg iwl105_bgn_cfg;
180     extern const struct iwl_cfg iwl105_bgn_d_cfg;
181     extern const struct iwl_cfg iwl135_bgn_cfg;
182     extern const struct iwl_cfg iwl7260_2ac_cfg;
183     -extern const struct iwl_cfg iwl3160_ac_cfg;
184     +extern const struct iwl_cfg iwl7260_2n_cfg;
185     +extern const struct iwl_cfg iwl7260_n_cfg;
186     +extern const struct iwl_cfg iwl3160_2ac_cfg;
187     +extern const struct iwl_cfg iwl3160_2n_cfg;
188     +extern const struct iwl_cfg iwl3160_n_cfg;
189    
190     #endif /* __IWL_CONFIG_H__ */
191     diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c
192     index b7858a595973..b53e5c3f403b 100644
193     --- a/drivers/net/wireless/iwlwifi/pcie/drv.c
194     +++ b/drivers/net/wireless/iwlwifi/pcie/drv.c
195     @@ -267,10 +267,83 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = {
196    
197     /* 7000 Series */
198     {IWL_PCI_DEVICE(0x08B1, 0x4070, iwl7260_2ac_cfg)},
199     - {IWL_PCI_DEVICE(0x08B1, 0x4062, iwl7260_2ac_cfg)},
200     + {IWL_PCI_DEVICE(0x08B1, 0x4072, iwl7260_2ac_cfg)},
201     + {IWL_PCI_DEVICE(0x08B1, 0x4170, iwl7260_2ac_cfg)},
202     + {IWL_PCI_DEVICE(0x08B1, 0x4060, iwl7260_2n_cfg)},
203     + {IWL_PCI_DEVICE(0x08B1, 0x406A, iwl7260_2n_cfg)},
204     + {IWL_PCI_DEVICE(0x08B1, 0x4160, iwl7260_2n_cfg)},
205     + {IWL_PCI_DEVICE(0x08B1, 0x4062, iwl7260_n_cfg)},
206     + {IWL_PCI_DEVICE(0x08B1, 0x4162, iwl7260_n_cfg)},
207     + {IWL_PCI_DEVICE(0x08B2, 0x4270, iwl7260_2ac_cfg)},
208     + {IWL_PCI_DEVICE(0x08B2, 0x4272, iwl7260_2ac_cfg)},
209     + {IWL_PCI_DEVICE(0x08B2, 0x4260, iwl7260_2n_cfg)},
210     + {IWL_PCI_DEVICE(0x08B2, 0x426A, iwl7260_2n_cfg)},
211     + {IWL_PCI_DEVICE(0x08B2, 0x4262, iwl7260_n_cfg)},
212     + {IWL_PCI_DEVICE(0x08B1, 0x4470, iwl7260_2ac_cfg)},
213     + {IWL_PCI_DEVICE(0x08B1, 0x4472, iwl7260_2ac_cfg)},
214     + {IWL_PCI_DEVICE(0x08B1, 0x4460, iwl7260_2n_cfg)},
215     + {IWL_PCI_DEVICE(0x08B1, 0x446A, iwl7260_2n_cfg)},
216     + {IWL_PCI_DEVICE(0x08B1, 0x4462, iwl7260_n_cfg)},
217     + {IWL_PCI_DEVICE(0x08B1, 0x4870, iwl7260_2ac_cfg)},
218     + {IWL_PCI_DEVICE(0x08B1, 0x486E, iwl7260_2ac_cfg)},
219     + {IWL_PCI_DEVICE(0x08B1, 0x4570, iwl7260_2ac_cfg)},
220     + {IWL_PCI_DEVICE(0x08B1, 0x4560, iwl7260_2n_cfg)},
221     + {IWL_PCI_DEVICE(0x08B2, 0x4370, iwl7260_2ac_cfg)},
222     + {IWL_PCI_DEVICE(0x08B2, 0x4360, iwl7260_2n_cfg)},
223     + {IWL_PCI_DEVICE(0x08B1, 0x5070, iwl7260_2ac_cfg)},
224     + {IWL_PCI_DEVICE(0x08B1, 0x4020, iwl7260_2n_cfg)},
225     + {IWL_PCI_DEVICE(0x08B1, 0x402A, iwl7260_2n_cfg)},
226     + {IWL_PCI_DEVICE(0x08B2, 0x4220, iwl7260_2n_cfg)},
227     + {IWL_PCI_DEVICE(0x08B1, 0x4420, iwl7260_2n_cfg)},
228     {IWL_PCI_DEVICE(0x08B1, 0xC070, iwl7260_2ac_cfg)},
229     - {IWL_PCI_DEVICE(0x08B3, 0x0070, iwl3160_ac_cfg)},
230     - {IWL_PCI_DEVICE(0x08B3, 0x8070, iwl3160_ac_cfg)},
231     + {IWL_PCI_DEVICE(0x08B1, 0xC072, iwl7260_2ac_cfg)},
232     + {IWL_PCI_DEVICE(0x08B1, 0xC170, iwl7260_2ac_cfg)},
233     + {IWL_PCI_DEVICE(0x08B1, 0xC060, iwl7260_2n_cfg)},
234     + {IWL_PCI_DEVICE(0x08B1, 0xC06A, iwl7260_2n_cfg)},
235     + {IWL_PCI_DEVICE(0x08B1, 0xC160, iwl7260_2n_cfg)},
236     + {IWL_PCI_DEVICE(0x08B1, 0xC062, iwl7260_n_cfg)},
237     + {IWL_PCI_DEVICE(0x08B1, 0xC162, iwl7260_n_cfg)},
238     + {IWL_PCI_DEVICE(0x08B1, 0xC770, iwl7260_2ac_cfg)},
239     + {IWL_PCI_DEVICE(0x08B1, 0xC760, iwl7260_2n_cfg)},
240     + {IWL_PCI_DEVICE(0x08B2, 0xC270, iwl7260_2ac_cfg)},
241     + {IWL_PCI_DEVICE(0x08B2, 0xC272, iwl7260_2ac_cfg)},
242     + {IWL_PCI_DEVICE(0x08B2, 0xC260, iwl7260_2n_cfg)},
243     + {IWL_PCI_DEVICE(0x08B2, 0xC26A, iwl7260_n_cfg)},
244     + {IWL_PCI_DEVICE(0x08B2, 0xC262, iwl7260_n_cfg)},
245     + {IWL_PCI_DEVICE(0x08B1, 0xC470, iwl7260_2ac_cfg)},
246     + {IWL_PCI_DEVICE(0x08B1, 0xC472, iwl7260_2ac_cfg)},
247     + {IWL_PCI_DEVICE(0x08B1, 0xC460, iwl7260_2n_cfg)},
248     + {IWL_PCI_DEVICE(0x08B1, 0xC462, iwl7260_n_cfg)},
249     + {IWL_PCI_DEVICE(0x08B1, 0xC570, iwl7260_2ac_cfg)},
250     + {IWL_PCI_DEVICE(0x08B1, 0xC560, iwl7260_2n_cfg)},
251     + {IWL_PCI_DEVICE(0x08B2, 0xC370, iwl7260_2ac_cfg)},
252     + {IWL_PCI_DEVICE(0x08B1, 0xC360, iwl7260_2n_cfg)},
253     + {IWL_PCI_DEVICE(0x08B1, 0xC020, iwl7260_2n_cfg)},
254     + {IWL_PCI_DEVICE(0x08B1, 0xC02A, iwl7260_2n_cfg)},
255     + {IWL_PCI_DEVICE(0x08B2, 0xC220, iwl7260_2n_cfg)},
256     + {IWL_PCI_DEVICE(0x08B1, 0xC420, iwl7260_2n_cfg)},
257     +
258     +/* 3160 Series */
259     + {IWL_PCI_DEVICE(0x08B3, 0x0070, iwl3160_2ac_cfg)},
260     + {IWL_PCI_DEVICE(0x08B3, 0x0072, iwl3160_2ac_cfg)},
261     + {IWL_PCI_DEVICE(0x08B3, 0x0170, iwl3160_2ac_cfg)},
262     + {IWL_PCI_DEVICE(0x08B3, 0x0172, iwl3160_2ac_cfg)},
263     + {IWL_PCI_DEVICE(0x08B3, 0x0060, iwl3160_2n_cfg)},
264     + {IWL_PCI_DEVICE(0x08B3, 0x0062, iwl3160_n_cfg)},
265     + {IWL_PCI_DEVICE(0x08B4, 0x0270, iwl3160_2ac_cfg)},
266     + {IWL_PCI_DEVICE(0x08B4, 0x0272, iwl3160_2ac_cfg)},
267     + {IWL_PCI_DEVICE(0x08B3, 0x0470, iwl3160_2ac_cfg)},
268     + {IWL_PCI_DEVICE(0x08B3, 0x0472, iwl3160_2ac_cfg)},
269     + {IWL_PCI_DEVICE(0x08B4, 0x0370, iwl3160_2ac_cfg)},
270     + {IWL_PCI_DEVICE(0x08B3, 0x8070, iwl3160_2ac_cfg)},
271     + {IWL_PCI_DEVICE(0x08B3, 0x8072, iwl3160_2ac_cfg)},
272     + {IWL_PCI_DEVICE(0x08B3, 0x8170, iwl3160_2ac_cfg)},
273     + {IWL_PCI_DEVICE(0x08B3, 0x8172, iwl3160_2ac_cfg)},
274     + {IWL_PCI_DEVICE(0x08B3, 0x8060, iwl3160_2n_cfg)},
275     + {IWL_PCI_DEVICE(0x08B3, 0x8062, iwl3160_n_cfg)},
276     + {IWL_PCI_DEVICE(0x08B4, 0x8270, iwl3160_2ac_cfg)},
277     + {IWL_PCI_DEVICE(0x08B3, 0x8470, iwl3160_2ac_cfg)},
278     + {IWL_PCI_DEVICE(0x08B3, 0x8570, iwl3160_2ac_cfg)},
279    
280     {0}
281     };
282     diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h
283     index 1a285083d24a..f2faa779e3fe 100644
284     --- a/drivers/net/xen-netback/common.h
285     +++ b/drivers/net/xen-netback/common.h
286     @@ -88,6 +88,7 @@ struct xenvif {
287     unsigned long credit_usec;
288     unsigned long remaining_credit;
289     struct timer_list credit_timeout;
290     + u64 credit_window_start;
291    
292     /* Statistics */
293     unsigned long rx_gso_checksum_fixup;
294     diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
295     index 3a294c2528d5..c4a2eb2cd8a0 100644
296     --- a/drivers/net/xen-netback/interface.c
297     +++ b/drivers/net/xen-netback/interface.c
298     @@ -275,8 +275,7 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,
299     vif->credit_bytes = vif->remaining_credit = ~0UL;
300     vif->credit_usec = 0UL;
301     init_timer(&vif->credit_timeout);
302     - /* Initialize 'expires' now: it's used to track the credit window. */
303     - vif->credit_timeout.expires = jiffies;
304     + vif->credit_window_start = get_jiffies_64();
305    
306     dev->netdev_ops = &xenvif_netdev_ops;
307     dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO;
308     diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
309     index 0071f211a08a..36efb418c26f 100644
310     --- a/drivers/net/xen-netback/netback.c
311     +++ b/drivers/net/xen-netback/netback.c
312     @@ -1423,9 +1423,8 @@ out:
313    
314     static bool tx_credit_exceeded(struct xenvif *vif, unsigned size)
315     {
316     - unsigned long now = jiffies;
317     - unsigned long next_credit =
318     - vif->credit_timeout.expires +
319     + u64 now = get_jiffies_64();
320     + u64 next_credit = vif->credit_window_start +
321     msecs_to_jiffies(vif->credit_usec / 1000);
322    
323     /* Timer could already be pending in rare cases. */
324     @@ -1433,8 +1432,8 @@ static bool tx_credit_exceeded(struct xenvif *vif, unsigned size)
325     return true;
326    
327     /* Passed the point where we can replenish credit? */
328     - if (time_after_eq(now, next_credit)) {
329     - vif->credit_timeout.expires = now;
330     + if (time_after_eq64(now, next_credit)) {
331     + vif->credit_window_start = now;
332     tx_add_credit(vif);
333     }
334    
335     @@ -1446,6 +1445,7 @@ static bool tx_credit_exceeded(struct xenvif *vif, unsigned size)
336     tx_credit_callback;
337     mod_timer(&vif->credit_timeout,
338     next_credit);
339     + vif->credit_window_start = next_credit;
340    
341     return true;
342     }
343     diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
344     index abe24ff000f0..8a9e8750703f 100644
345     --- a/drivers/net/xen-netback/xenbus.c
346     +++ b/drivers/net/xen-netback/xenbus.c
347     @@ -24,6 +24,12 @@
348     struct backend_info {
349     struct xenbus_device *dev;
350     struct xenvif *vif;
351     +
352     + /* This is the state that will be reflected in xenstore when any
353     + * active hotplug script completes.
354     + */
355     + enum xenbus_state state;
356     +
357     enum xenbus_state frontend_state;
358     struct xenbus_watch hotplug_status_watch;
359     u8 have_hotplug_status_watch:1;
360     @@ -33,11 +39,15 @@ static int connect_rings(struct backend_info *);
361     static void connect(struct backend_info *);
362     static void backend_create_xenvif(struct backend_info *be);
363     static void unregister_hotplug_status_watch(struct backend_info *be);
364     +static void set_backend_state(struct backend_info *be,
365     + enum xenbus_state state);
366    
367     static int netback_remove(struct xenbus_device *dev)
368     {
369     struct backend_info *be = dev_get_drvdata(&dev->dev);
370    
371     + set_backend_state(be, XenbusStateClosed);
372     +
373     unregister_hotplug_status_watch(be);
374     if (be->vif) {
375     kobject_uevent(&dev->dev.kobj, KOBJ_OFFLINE);
376     @@ -126,6 +136,8 @@ static int netback_probe(struct xenbus_device *dev,
377     if (err)
378     goto fail;
379    
380     + be->state = XenbusStateInitWait;
381     +
382     /* This kicks hotplug scripts, so do it immediately. */
383     backend_create_xenvif(be);
384    
385     @@ -198,24 +210,113 @@ static void backend_create_xenvif(struct backend_info *be)
386     kobject_uevent(&dev->dev.kobj, KOBJ_ONLINE);
387     }
388    
389     -
390     -static void disconnect_backend(struct xenbus_device *dev)
391     +static void backend_disconnect(struct backend_info *be)
392     {
393     - struct backend_info *be = dev_get_drvdata(&dev->dev);
394     -
395     if (be->vif)
396     xenvif_disconnect(be->vif);
397     }
398    
399     -static void destroy_backend(struct xenbus_device *dev)
400     +static void backend_connect(struct backend_info *be)
401     {
402     - struct backend_info *be = dev_get_drvdata(&dev->dev);
403     + if (be->vif)
404     + connect(be);
405     +}
406    
407     - if (be->vif) {
408     - kobject_uevent(&dev->dev.kobj, KOBJ_OFFLINE);
409     - xenbus_rm(XBT_NIL, dev->nodename, "hotplug-status");
410     - xenvif_free(be->vif);
411     - be->vif = NULL;
412     +static inline void backend_switch_state(struct backend_info *be,
413     + enum xenbus_state state)
414     +{
415     + struct xenbus_device *dev = be->dev;
416     +
417     + pr_debug("%s -> %s\n", dev->nodename, xenbus_strstate(state));
418     + be->state = state;
419     +
420     + /* If we are waiting for a hotplug script then defer the
421     + * actual xenbus state change.
422     + */
423     + if (!be->have_hotplug_status_watch)
424     + xenbus_switch_state(dev, state);
425     +}
426     +
427     +/* Handle backend state transitions:
428     + *
429     + * The backend state starts in InitWait and the following transitions are
430     + * allowed.
431     + *
432     + * InitWait -> Connected
433     + *
434     + * ^ \ |
435     + * | \ |
436     + * | \ |
437     + * | \ |
438     + * | \ |
439     + * | \ |
440     + * | V V
441     + *
442     + * Closed <-> Closing
443     + *
444     + * The state argument specifies the eventual state of the backend and the
445     + * function transitions to that state via the shortest path.
446     + */
447     +static void set_backend_state(struct backend_info *be,
448     + enum xenbus_state state)
449     +{
450     + while (be->state != state) {
451     + switch (be->state) {
452     + case XenbusStateClosed:
453     + switch (state) {
454     + case XenbusStateInitWait:
455     + case XenbusStateConnected:
456     + pr_info("%s: prepare for reconnect\n",
457     + be->dev->nodename);
458     + backend_switch_state(be, XenbusStateInitWait);
459     + break;
460     + case XenbusStateClosing:
461     + backend_switch_state(be, XenbusStateClosing);
462     + break;
463     + default:
464     + BUG();
465     + }
466     + break;
467     + case XenbusStateInitWait:
468     + switch (state) {
469     + case XenbusStateConnected:
470     + backend_connect(be);
471     + backend_switch_state(be, XenbusStateConnected);
472     + break;
473     + case XenbusStateClosing:
474     + case XenbusStateClosed:
475     + backend_switch_state(be, XenbusStateClosing);
476     + break;
477     + default:
478     + BUG();
479     + }
480     + break;
481     + case XenbusStateConnected:
482     + switch (state) {
483     + case XenbusStateInitWait:
484     + case XenbusStateClosing:
485     + case XenbusStateClosed:
486     + backend_disconnect(be);
487     + backend_switch_state(be, XenbusStateClosing);
488     + break;
489     + default:
490     + BUG();
491     + }
492     + break;
493     + case XenbusStateClosing:
494     + switch (state) {
495     + case XenbusStateInitWait:
496     + case XenbusStateConnected:
497     + case XenbusStateClosed:
498     + backend_switch_state(be, XenbusStateClosed);
499     + break;
500     + default:
501     + BUG();
502     + }
503     + break;
504     + default:
505     + BUG();
506     + }
507     }
508     }
509    
510     @@ -227,41 +328,33 @@ static void frontend_changed(struct xenbus_device *dev,
511     {
512     struct backend_info *be = dev_get_drvdata(&dev->dev);
513    
514     - pr_debug("frontend state %s", xenbus_strstate(frontend_state));
515     + pr_debug("%s -> %s\n", dev->otherend, xenbus_strstate(frontend_state));
516    
517     be->frontend_state = frontend_state;
518    
519     switch (frontend_state) {
520     case XenbusStateInitialising:
521     - if (dev->state == XenbusStateClosed) {
522     - printk(KERN_INFO "%s: %s: prepare for reconnect\n",
523     - __func__, dev->nodename);
524     - xenbus_switch_state(dev, XenbusStateInitWait);
525     - }
526     + set_backend_state(be, XenbusStateInitWait);
527     break;
528    
529     case XenbusStateInitialised:
530     break;
531    
532     case XenbusStateConnected:
533     - if (dev->state == XenbusStateConnected)
534     - break;
535     - if (be->vif)
536     - connect(be);
537     + set_backend_state(be, XenbusStateConnected);
538     break;
539    
540     case XenbusStateClosing:
541     - disconnect_backend(dev);
542     - xenbus_switch_state(dev, XenbusStateClosing);
543     + set_backend_state(be, XenbusStateClosing);
544     break;
545    
546     case XenbusStateClosed:
547     - xenbus_switch_state(dev, XenbusStateClosed);
548     + set_backend_state(be, XenbusStateClosed);
549     if (xenbus_dev_is_online(dev))
550     break;
551     - destroy_backend(dev);
552     /* fall through if not online */
553     case XenbusStateUnknown:
554     + set_backend_state(be, XenbusStateClosed);
555     device_unregister(&dev->dev);
556     break;
557    
558     @@ -354,7 +447,9 @@ static void hotplug_status_changed(struct xenbus_watch *watch,
559     if (IS_ERR(str))
560     return;
561     if (len == sizeof("connected")-1 && !memcmp(str, "connected", len)) {
562     - xenbus_switch_state(be->dev, XenbusStateConnected);
563     + /* Complete any pending state change */
564     + xenbus_switch_state(be->dev, be->state);
565     +
566     /* Not interested in this watch anymore. */
567     unregister_hotplug_status_watch(be);
568     }
569     @@ -384,12 +479,8 @@ static void connect(struct backend_info *be)
570     err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch,
571     hotplug_status_changed,
572     "%s/%s", dev->nodename, "hotplug-status");
573     - if (err) {
574     - /* Switch now, since we can't do a watch. */
575     - xenbus_switch_state(dev, XenbusStateConnected);
576     - } else {
577     + if (!err)
578     be->have_hotplug_status_watch = 1;
579     - }
580    
581     netif_wake_queue(be->vif->dev);
582     }
583     diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
584     index d53547d2e4c7..d3aa353908aa 100644
585     --- a/drivers/usb/core/hcd.c
586     +++ b/drivers/usb/core/hcd.c
587     @@ -1010,6 +1010,7 @@ static int register_root_hub(struct usb_hcd *hcd)
588     dev_name(&usb_dev->dev), retval);
589     return retval;
590     }
591     + usb_dev->lpm_capable = usb_device_supports_lpm(usb_dev);
592     }
593    
594     retval = usb_new_device (usb_dev);
595     diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
596     index 6cf2ae0aa1f7..c8b9fa0e9275 100644
597     --- a/drivers/usb/core/hub.c
598     +++ b/drivers/usb/core/hub.c
599     @@ -135,7 +135,7 @@ struct usb_hub *usb_hub_to_struct_hub(struct usb_device *hdev)
600     return usb_get_intfdata(hdev->actconfig->interface[0]);
601     }
602    
603     -static int usb_device_supports_lpm(struct usb_device *udev)
604     +int usb_device_supports_lpm(struct usb_device *udev)
605     {
606     /* USB 2.1 (and greater) devices indicate LPM support through
607     * their USB 2.0 Extended Capabilities BOS descriptor.
608     @@ -156,6 +156,11 @@ static int usb_device_supports_lpm(struct usb_device *udev)
609     "Power management will be impacted.\n");
610     return 0;
611     }
612     +
613     + /* udev is root hub */
614     + if (!udev->parent)
615     + return 1;
616     +
617     if (udev->parent->lpm_capable)
618     return 1;
619    
620     @@ -1557,10 +1562,15 @@ static int hub_configure(struct usb_hub *hub,
621     if (hub->has_indicators && blinkenlights)
622     hub->indicator [0] = INDICATOR_CYCLE;
623    
624     - for (i = 0; i < hdev->maxchild; i++)
625     - if (usb_hub_create_port_device(hub, i + 1) < 0)
626     + for (i = 0; i < hdev->maxchild; i++) {
627     + ret = usb_hub_create_port_device(hub, i + 1);
628     + if (ret < 0) {
629     dev_err(hub->intfdev,
630     "couldn't create port%d device.\n", i + 1);
631     + hdev->maxchild = i;
632     + goto fail_keep_maxchild;
633     + }
634     + }
635    
636     usb_hub_adjust_deviceremovable(hdev, hub->descriptor);
637    
638     @@ -1568,6 +1578,8 @@ static int hub_configure(struct usb_hub *hub,
639     return 0;
640    
641     fail:
642     + hdev->maxchild = 0;
643     +fail_keep_maxchild:
644     dev_err (hub_dev, "config failed, %s (err %d)\n",
645     message, ret);
646     /* hub_disconnect() frees urb and descriptor */
647     diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
648     index 823857767a16..c49383669cd8 100644
649     --- a/drivers/usb/core/usb.h
650     +++ b/drivers/usb/core/usb.h
651     @@ -35,6 +35,7 @@ extern int usb_get_device_descriptor(struct usb_device *dev,
652     unsigned int size);
653     extern int usb_get_bos_descriptor(struct usb_device *dev);
654     extern void usb_release_bos_descriptor(struct usb_device *dev);
655     +extern int usb_device_supports_lpm(struct usb_device *udev);
656     extern char *usb_cache_string(struct usb_device *udev, int index);
657     extern int usb_set_configuration(struct usb_device *dev, int configuration);
658     extern int usb_choose_configuration(struct usb_device *udev);
659     diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
660     index acaee066b99a..c3d94853b4ab 100644
661     --- a/drivers/usb/serial/option.c
662     +++ b/drivers/usb/serial/option.c
663     @@ -1376,6 +1376,23 @@ static const struct usb_device_id option_ids[] = {
664     .driver_info = (kernel_ulong_t)&net_intf2_blacklist },
665     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1426, 0xff, 0xff, 0xff), /* ZTE MF91 */
666     .driver_info = (kernel_ulong_t)&net_intf2_blacklist },
667     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1533, 0xff, 0xff, 0xff) },
668     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1534, 0xff, 0xff, 0xff) },
669     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1535, 0xff, 0xff, 0xff) },
670     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1545, 0xff, 0xff, 0xff) },
671     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1546, 0xff, 0xff, 0xff) },
672     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1547, 0xff, 0xff, 0xff) },
673     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1565, 0xff, 0xff, 0xff) },
674     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1566, 0xff, 0xff, 0xff) },
675     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1567, 0xff, 0xff, 0xff) },
676     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1589, 0xff, 0xff, 0xff) },
677     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1590, 0xff, 0xff, 0xff) },
678     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1591, 0xff, 0xff, 0xff) },
679     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1592, 0xff, 0xff, 0xff) },
680     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1594, 0xff, 0xff, 0xff) },
681     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1596, 0xff, 0xff, 0xff) },
682     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1598, 0xff, 0xff, 0xff) },
683     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1600, 0xff, 0xff, 0xff) },
684     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff,
685     0xff, 0xff), .driver_info = (kernel_ulong_t)&zte_k3765_z_blacklist },
686     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) },
687     diff --git a/drivers/video/backlight/atmel-pwm-bl.c b/drivers/video/backlight/atmel-pwm-bl.c
688     index a60d6afca97c..30e4ed52d701 100644
689     --- a/drivers/video/backlight/atmel-pwm-bl.c
690     +++ b/drivers/video/backlight/atmel-pwm-bl.c
691     @@ -118,7 +118,7 @@ static const struct backlight_ops atmel_pwm_bl_ops = {
692     .update_status = atmel_pwm_bl_set_intensity,
693     };
694    
695     -static int __init atmel_pwm_bl_probe(struct platform_device *pdev)
696     +static int atmel_pwm_bl_probe(struct platform_device *pdev)
697     {
698     struct backlight_properties props;
699     const struct atmel_pwm_bl_platform_data *pdata;
700     @@ -203,7 +203,7 @@ err_free_mem:
701     return retval;
702     }
703    
704     -static int __exit atmel_pwm_bl_remove(struct platform_device *pdev)
705     +static int atmel_pwm_bl_remove(struct platform_device *pdev)
706     {
707     struct atmel_pwm_bl *pwmbl = platform_get_drvdata(pdev);
708    
709     @@ -222,10 +222,11 @@ static struct platform_driver atmel_pwm_bl_driver = {
710     .name = "atmel-pwm-bl",
711     },
712     /* REVISIT add suspend() and resume() */
713     - .remove = __exit_p(atmel_pwm_bl_remove),
714     + .probe = atmel_pwm_bl_probe,
715     + .remove = atmel_pwm_bl_remove,
716     };
717    
718     -module_platform_driver_probe(atmel_pwm_bl_driver, atmel_pwm_bl_probe);
719     +module_platform_driver(atmel_pwm_bl_driver);
720    
721     MODULE_AUTHOR("Hans-Christian egtvedt <hans-christian.egtvedt@atmel.com>");
722     MODULE_DESCRIPTION("Atmel PWM backlight driver");
723     diff --git a/drivers/video/hyperv_fb.c b/drivers/video/hyperv_fb.c
724     index d4d2c5fe2488..0f3b33cf13ef 100644
725     --- a/drivers/video/hyperv_fb.c
726     +++ b/drivers/video/hyperv_fb.c
727     @@ -795,12 +795,21 @@ static int hvfb_remove(struct hv_device *hdev)
728     }
729    
730    
731     +static DEFINE_PCI_DEVICE_TABLE(pci_stub_id_table) = {
732     + {
733     + .vendor = PCI_VENDOR_ID_MICROSOFT,
734     + .device = PCI_DEVICE_ID_HYPERV_VIDEO,
735     + },
736     + { /* end of list */ }
737     +};
738     +
739     static const struct hv_vmbus_device_id id_table[] = {
740     /* Synthetic Video Device GUID */
741     {HV_SYNTHVID_GUID},
742     {}
743     };
744    
745     +MODULE_DEVICE_TABLE(pci, pci_stub_id_table);
746     MODULE_DEVICE_TABLE(vmbus, id_table);
747    
748     static struct hv_driver hvfb_drv = {
749     @@ -810,14 +819,43 @@ static struct hv_driver hvfb_drv = {
750     .remove = hvfb_remove,
751     };
752    
753     +static int hvfb_pci_stub_probe(struct pci_dev *pdev,
754     + const struct pci_device_id *ent)
755     +{
756     + return 0;
757     +}
758     +
759     +static void hvfb_pci_stub_remove(struct pci_dev *pdev)
760     +{
761     +}
762     +
763     +static struct pci_driver hvfb_pci_stub_driver = {
764     + .name = KBUILD_MODNAME,
765     + .id_table = pci_stub_id_table,
766     + .probe = hvfb_pci_stub_probe,
767     + .remove = hvfb_pci_stub_remove,
768     +};
769    
770     static int __init hvfb_drv_init(void)
771     {
772     - return vmbus_driver_register(&hvfb_drv);
773     + int ret;
774     +
775     + ret = vmbus_driver_register(&hvfb_drv);
776     + if (ret != 0)
777     + return ret;
778     +
779     + ret = pci_register_driver(&hvfb_pci_stub_driver);
780     + if (ret != 0) {
781     + vmbus_driver_unregister(&hvfb_drv);
782     + return ret;
783     + }
784     +
785     + return 0;
786     }
787    
788     static void __exit hvfb_drv_exit(void)
789     {
790     + pci_unregister_driver(&hvfb_pci_stub_driver);
791     vmbus_driver_unregister(&hvfb_drv);
792     }
793    
794     diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
795     index 2a601e7da1bf..665e0cee59bd 100644
796     --- a/include/net/ip6_fib.h
797     +++ b/include/net/ip6_fib.h
798     @@ -165,6 +165,7 @@ static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst)
799     static inline void rt6_clean_expires(struct rt6_info *rt)
800     {
801     rt->rt6i_flags &= ~RTF_EXPIRES;
802     + rt->dst.expires = 0;
803     }
804    
805     static inline void rt6_set_expires(struct rt6_info *rt, unsigned long expires)
806     diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
807     index a9942e1faefb..7ac7f91f0242 100644
808     --- a/include/net/ip_tunnels.h
809     +++ b/include/net/ip_tunnels.h
810     @@ -113,7 +113,7 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,
811     __be32 key);
812    
813     int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb,
814     - const struct tnl_ptk_info *tpi, bool log_ecn_error);
815     + const struct tnl_ptk_info *tpi, int hdr_len, bool log_ecn_error);
816     int ip_tunnel_changelink(struct net_device *dev, struct nlattr *tb[],
817     struct ip_tunnel_parm *p);
818     int ip_tunnel_newlink(struct net_device *dev, struct nlattr *tb[],
819     diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
820     index fb104e51496e..9e59950f55cf 100644
821     --- a/include/uapi/linux/perf_event.h
822     +++ b/include/uapi/linux/perf_event.h
823     @@ -425,13 +425,15 @@ struct perf_event_mmap_page {
824     /*
825     * Control data for the mmap() data buffer.
826     *
827     - * User-space reading the @data_head value should issue an rmb(), on
828     - * SMP capable platforms, after reading this value -- see
829     - * perf_event_wakeup().
830     + * User-space reading the @data_head value should issue an smp_rmb(),
831     + * after reading this value.
832     *
833     * When the mapping is PROT_WRITE the @data_tail value should be
834     - * written by userspace to reflect the last read data. In this case
835     - * the kernel will not over-write unread data.
836     + * written by userspace to reflect the last read data, after issueing
837     + * an smp_mb() to separate the data read from the ->data_tail store.
838     + * In this case the kernel will not over-write unread data.
839     + *
840     + * See perf_output_put_handle() for the data ordering.
841     */
842     __u64 data_head; /* head in the data section */
843     __u64 data_tail; /* user-space written tail */
844     diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
845     index cd55144270b5..9c2ddfbf4525 100644
846     --- a/kernel/events/ring_buffer.c
847     +++ b/kernel/events/ring_buffer.c
848     @@ -87,10 +87,31 @@ again:
849     goto out;
850    
851     /*
852     - * Publish the known good head. Rely on the full barrier implied
853     - * by atomic_dec_and_test() order the rb->head read and this
854     - * write.
855     + * Since the mmap() consumer (userspace) can run on a different CPU:
856     + *
857     + * kernel user
858     + *
859     + * READ ->data_tail READ ->data_head
860     + * smp_mb() (A) smp_rmb() (C)
861     + * WRITE $data READ $data
862     + * smp_wmb() (B) smp_mb() (D)
863     + * STORE ->data_head WRITE ->data_tail
864     + *
865     + * Where A pairs with D, and B pairs with C.
866     + *
867     + * I don't think A needs to be a full barrier because we won't in fact
868     + * write data until we see the store from userspace. So we simply don't
869     + * issue the data WRITE until we observe it. Be conservative for now.
870     + *
871     + * OTOH, D needs to be a full barrier since it separates the data READ
872     + * from the tail WRITE.
873     + *
874     + * For B a WMB is sufficient since it separates two WRITEs, and for C
875     + * an RMB is sufficient since it separates two READs.
876     + *
877     + * See perf_output_begin().
878     */
879     + smp_wmb();
880     rb->user_page->data_head = head;
881    
882     /*
883     @@ -154,9 +175,11 @@ int perf_output_begin(struct perf_output_handle *handle,
884     * Userspace could choose to issue a mb() before updating the
885     * tail pointer. So that all reads will be completed before the
886     * write is issued.
887     + *
888     + * See perf_output_put_handle().
889     */
890     tail = ACCESS_ONCE(rb->user_page->data_tail);
891     - smp_rmb();
892     + smp_mb();
893     offset = head = local_read(&rb->head);
894     head += size;
895     if (unlikely(!perf_output_space(rb, tail, offset, head)))
896     diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
897     index 0582a01a81e3..5546ae9c84f9 100644
898     --- a/kernel/trace/trace.c
899     +++ b/kernel/trace/trace.c
900     @@ -826,9 +826,12 @@ int trace_get_user(struct trace_parser *parser, const char __user *ubuf,
901     if (isspace(ch)) {
902     parser->buffer[parser->idx] = 0;
903     parser->cont = false;
904     - } else {
905     + } else if (parser->idx < parser->size - 1) {
906     parser->cont = true;
907     parser->buffer[parser->idx++] = ch;
908     + } else {
909     + ret = -EINVAL;
910     + goto out;
911     }
912    
913     *ppos += read;
914     diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
915     index 51aafd669cbb..f1cb1f56cda9 100644
916     --- a/net/batman-adv/main.c
917     +++ b/net/batman-adv/main.c
918     @@ -61,6 +61,7 @@ static int __init batadv_init(void)
919     batadv_recv_handler_init();
920    
921     batadv_iv_init();
922     + batadv_nc_init();
923    
924     batadv_event_workqueue = create_singlethread_workqueue("bat_events");
925    
926     @@ -138,7 +139,7 @@ int batadv_mesh_init(struct net_device *soft_iface)
927     if (ret < 0)
928     goto err;
929    
930     - ret = batadv_nc_init(bat_priv);
931     + ret = batadv_nc_mesh_init(bat_priv);
932     if (ret < 0)
933     goto err;
934    
935     @@ -163,7 +164,7 @@ void batadv_mesh_free(struct net_device *soft_iface)
936     batadv_vis_quit(bat_priv);
937    
938     batadv_gw_node_purge(bat_priv);
939     - batadv_nc_free(bat_priv);
940     + batadv_nc_mesh_free(bat_priv);
941     batadv_dat_free(bat_priv);
942     batadv_bla_free(bat_priv);
943    
944     diff --git a/net/batman-adv/network-coding.c b/net/batman-adv/network-coding.c
945     index e84629ece9b7..f97aeee2201c 100644
946     --- a/net/batman-adv/network-coding.c
947     +++ b/net/batman-adv/network-coding.c
948     @@ -35,6 +35,20 @@ static int batadv_nc_recv_coded_packet(struct sk_buff *skb,
949     struct batadv_hard_iface *recv_if);
950    
951     /**
952     + * batadv_nc_init - one-time initialization for network coding
953     + */
954     +int __init batadv_nc_init(void)
955     +{
956     + int ret;
957     +
958     + /* Register our packet type */
959     + ret = batadv_recv_handler_register(BATADV_CODED,
960     + batadv_nc_recv_coded_packet);
961     +
962     + return ret;
963     +}
964     +
965     +/**
966     * batadv_nc_start_timer - initialise the nc periodic worker
967     * @bat_priv: the bat priv with all the soft interface information
968     */
969     @@ -45,10 +59,10 @@ static void batadv_nc_start_timer(struct batadv_priv *bat_priv)
970     }
971    
972     /**
973     - * batadv_nc_init - initialise coding hash table and start house keeping
974     + * batadv_nc_mesh_init - initialise coding hash table and start house keeping
975     * @bat_priv: the bat priv with all the soft interface information
976     */
977     -int batadv_nc_init(struct batadv_priv *bat_priv)
978     +int batadv_nc_mesh_init(struct batadv_priv *bat_priv)
979     {
980     bat_priv->nc.timestamp_fwd_flush = jiffies;
981     bat_priv->nc.timestamp_sniffed_purge = jiffies;
982     @@ -70,11 +84,6 @@ int batadv_nc_init(struct batadv_priv *bat_priv)
983     batadv_hash_set_lock_class(bat_priv->nc.coding_hash,
984     &batadv_nc_decoding_hash_lock_class_key);
985    
986     - /* Register our packet type */
987     - if (batadv_recv_handler_register(BATADV_CODED,
988     - batadv_nc_recv_coded_packet) < 0)
989     - goto err;
990     -
991     INIT_DELAYED_WORK(&bat_priv->nc.work, batadv_nc_worker);
992     batadv_nc_start_timer(bat_priv);
993    
994     @@ -1722,12 +1731,11 @@ free_nc_packet:
995     }
996    
997     /**
998     - * batadv_nc_free - clean up network coding memory
999     + * batadv_nc_mesh_free - clean up network coding memory
1000     * @bat_priv: the bat priv with all the soft interface information
1001     */
1002     -void batadv_nc_free(struct batadv_priv *bat_priv)
1003     +void batadv_nc_mesh_free(struct batadv_priv *bat_priv)
1004     {
1005     - batadv_recv_handler_unregister(BATADV_CODED);
1006     cancel_delayed_work_sync(&bat_priv->nc.work);
1007    
1008     batadv_nc_purge_paths(bat_priv, bat_priv->nc.coding_hash, NULL);
1009     diff --git a/net/batman-adv/network-coding.h b/net/batman-adv/network-coding.h
1010     index 4fa6d0caddbd..bd4295fb960f 100644
1011     --- a/net/batman-adv/network-coding.h
1012     +++ b/net/batman-adv/network-coding.h
1013     @@ -22,8 +22,9 @@
1014    
1015     #ifdef CONFIG_BATMAN_ADV_NC
1016    
1017     -int batadv_nc_init(struct batadv_priv *bat_priv);
1018     -void batadv_nc_free(struct batadv_priv *bat_priv);
1019     +int batadv_nc_init(void);
1020     +int batadv_nc_mesh_init(struct batadv_priv *bat_priv);
1021     +void batadv_nc_mesh_free(struct batadv_priv *bat_priv);
1022     void batadv_nc_update_nc_node(struct batadv_priv *bat_priv,
1023     struct batadv_orig_node *orig_node,
1024     struct batadv_orig_node *orig_neigh_node,
1025     @@ -47,12 +48,17 @@ int batadv_nc_init_debugfs(struct batadv_priv *bat_priv);
1026    
1027     #else /* ifdef CONFIG_BATMAN_ADV_NC */
1028    
1029     -static inline int batadv_nc_init(struct batadv_priv *bat_priv)
1030     +static inline int batadv_nc_init(void)
1031     {
1032     return 0;
1033     }
1034    
1035     -static inline void batadv_nc_free(struct batadv_priv *bat_priv)
1036     +static inline int batadv_nc_mesh_init(struct batadv_priv *bat_priv)
1037     +{
1038     + return 0;
1039     +}
1040     +
1041     +static inline void batadv_nc_mesh_free(struct batadv_priv *bat_priv)
1042     {
1043     return;
1044     }
1045     diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
1046     index 44db78ae6a65..f97101b4d373 100644
1047     --- a/net/core/flow_dissector.c
1048     +++ b/net/core/flow_dissector.c
1049     @@ -40,7 +40,7 @@ again:
1050     struct iphdr _iph;
1051     ip:
1052     iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph);
1053     - if (!iph)
1054     + if (!iph || iph->ihl < 5)
1055     return false;
1056    
1057     if (ip_is_fragment(iph))
1058     diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
1059     index c52fee0976da..64e4e98c8786 100644
1060     --- a/net/ipv4/ip_gre.c
1061     +++ b/net/ipv4/ip_gre.c
1062     @@ -335,7 +335,7 @@ static int ipgre_rcv(struct sk_buff *skb)
1063     iph->saddr, iph->daddr, tpi.key);
1064    
1065     if (tunnel) {
1066     - ip_tunnel_rcv(tunnel, skb, &tpi, log_ecn_error);
1067     + ip_tunnel_rcv(tunnel, skb, &tpi, hdr_len, log_ecn_error);
1068     return 0;
1069     }
1070     icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);
1071     diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
1072     index 92d2f0f5d7bf..46dcf32c012e 100644
1073     --- a/net/ipv4/ip_tunnel.c
1074     +++ b/net/ipv4/ip_tunnel.c
1075     @@ -402,7 +402,7 @@ static struct ip_tunnel *ip_tunnel_create(struct net *net,
1076     }
1077    
1078     int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb,
1079     - const struct tnl_ptk_info *tpi, bool log_ecn_error)
1080     + const struct tnl_ptk_info *tpi, int hdr_len, bool log_ecn_error)
1081     {
1082     struct pcpu_tstats *tstats;
1083     const struct iphdr *iph = ip_hdr(skb);
1084     @@ -413,7 +413,7 @@ int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb,
1085     skb->protocol = tpi->proto;
1086    
1087     skb->mac_header = skb->network_header;
1088     - __pskb_pull(skb, tunnel->hlen);
1089     + __pskb_pull(skb, hdr_len);
1090     skb_postpull_rcsum(skb, skb_transport_header(skb), tunnel->hlen);
1091     #ifdef CONFIG_NET_IPGRE_BROADCAST
1092     if (ipv4_is_multicast(iph->daddr)) {
1093     diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
1094     index 7cfc45624b6d..f5cc7b331511 100644
1095     --- a/net/ipv4/ipip.c
1096     +++ b/net/ipv4/ipip.c
1097     @@ -195,7 +195,7 @@ static int ipip_rcv(struct sk_buff *skb)
1098     if (tunnel) {
1099     if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb))
1100     goto drop;
1101     - return ip_tunnel_rcv(tunnel, skb, &tpi, log_ecn_error);
1102     + return ip_tunnel_rcv(tunnel, skb, &tpi, 0, log_ecn_error);
1103     }
1104    
1105     return -1;
1106     diff --git a/net/ipv6/route.c b/net/ipv6/route.c
1107     index 3c1f493ccc63..548a1f7c1a29 100644
1108     --- a/net/ipv6/route.c
1109     +++ b/net/ipv6/route.c
1110     @@ -1084,10 +1084,13 @@ static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie)
1111     if (rt->rt6i_genid != rt_genid(dev_net(rt->dst.dev)))
1112     return NULL;
1113    
1114     - if (rt->rt6i_node && (rt->rt6i_node->fn_sernum == cookie))
1115     - return dst;
1116     + if (!rt->rt6i_node || (rt->rt6i_node->fn_sernum != cookie))
1117     + return NULL;
1118    
1119     - return NULL;
1120     + if (rt6_check_expired(rt))
1121     + return NULL;
1122     +
1123     + return dst;
1124     }
1125    
1126     static struct dst_entry *ip6_negative_advice(struct dst_entry *dst)
1127     diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
1128     index aecf088f40af..b93799201578 100644
1129     --- a/sound/pci/hda/patch_hdmi.c
1130     +++ b/sound/pci/hda/patch_hdmi.c
1131     @@ -738,9 +738,10 @@ static int hdmi_manual_setup_channel_mapping(struct hda_codec *codec,
1132     static void hdmi_setup_fake_chmap(unsigned char *map, int ca)
1133     {
1134     int i;
1135     + int ordered_ca = get_channel_allocation_order(ca);
1136     for (i = 0; i < 8; i++) {
1137     - if (i < channel_allocations[ca].channels)
1138     - map[i] = from_cea_slot((hdmi_channel_mapping[ca][i] >> 4) & 0x0f);
1139     + if (i < channel_allocations[ordered_ca].channels)
1140     + map[i] = from_cea_slot(hdmi_channel_mapping[ca][i] & 0x0f);
1141     else
1142     map[i] = 0;
1143     }