Magellan Linux

Annotation of /trunk/kernel-alx/patches-3.18/0119-3.18.20-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2690 - (hide annotations) (download)
Mon Aug 31 12:19:39 2015 UTC (8 years, 8 months ago) by niro
File size: 60551 byte(s)
-linux-3.18.20
1 niro 2690 diff --git a/Documentation/devicetree/bindings/spi/spi_pl022.txt b/Documentation/devicetree/bindings/spi/spi_pl022.txt
2     index 22ed6797216d..4d1673ca8cf8 100644
3     --- a/Documentation/devicetree/bindings/spi/spi_pl022.txt
4     +++ b/Documentation/devicetree/bindings/spi/spi_pl022.txt
5     @@ -4,9 +4,9 @@ Required properties:
6     - compatible : "arm,pl022", "arm,primecell"
7     - reg : Offset and length of the register set for the device
8     - interrupts : Should contain SPI controller interrupt
9     +- num-cs : total number of chipselects
10    
11     Optional properties:
12     -- num-cs : total number of chipselects
13     - cs-gpios : should specify GPIOs used for chipselects.
14     The gpios will be referred to as reg = <index> in the SPI child nodes.
15     If unspecified, a single SPI device without a chip select can be used.
16     diff --git a/Makefile b/Makefile
17     index eab97c3d462d..3ef589539cca 100644
18     --- a/Makefile
19     +++ b/Makefile
20     @@ -1,6 +1,6 @@
21     VERSION = 3
22     PATCHLEVEL = 18
23     -SUBLEVEL = 19
24     +SUBLEVEL = 20
25     EXTRAVERSION =
26     NAME = Diseased Newt
27    
28     diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
29     index 2de9d2e59d96..0eeb4f0930a0 100644
30     --- a/arch/arm64/mm/hugetlbpage.c
31     +++ b/arch/arm64/mm/hugetlbpage.c
32     @@ -40,13 +40,13 @@ int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
33    
34     int pmd_huge(pmd_t pmd)
35     {
36     - return !(pmd_val(pmd) & PMD_TABLE_BIT);
37     + return pmd_val(pmd) && !(pmd_val(pmd) & PMD_TABLE_BIT);
38     }
39    
40     int pud_huge(pud_t pud)
41     {
42     #ifndef __PAGETABLE_PMD_FOLDED
43     - return !(pud_val(pud) & PUD_TABLE_BIT);
44     + return pud_val(pud) && !(pud_val(pud) & PUD_TABLE_BIT);
45     #else
46     return 0;
47     #endif
48     diff --git a/block/blk-mq.c b/block/blk-mq.c
49     index 849479debac3..691959ecb80f 100644
50     --- a/block/blk-mq.c
51     +++ b/block/blk-mq.c
52     @@ -1473,22 +1473,6 @@ static int blk_mq_hctx_cpu_offline(struct blk_mq_hw_ctx *hctx, int cpu)
53     return NOTIFY_OK;
54     }
55    
56     -static int blk_mq_hctx_cpu_online(struct blk_mq_hw_ctx *hctx, int cpu)
57     -{
58     - struct request_queue *q = hctx->queue;
59     - struct blk_mq_tag_set *set = q->tag_set;
60     -
61     - if (set->tags[hctx->queue_num])
62     - return NOTIFY_OK;
63     -
64     - set->tags[hctx->queue_num] = blk_mq_init_rq_map(set, hctx->queue_num);
65     - if (!set->tags[hctx->queue_num])
66     - return NOTIFY_STOP;
67     -
68     - hctx->tags = set->tags[hctx->queue_num];
69     - return NOTIFY_OK;
70     -}
71     -
72     static int blk_mq_hctx_notify(void *data, unsigned long action,
73     unsigned int cpu)
74     {
75     @@ -1496,8 +1480,11 @@ static int blk_mq_hctx_notify(void *data, unsigned long action,
76    
77     if (action == CPU_DEAD || action == CPU_DEAD_FROZEN)
78     return blk_mq_hctx_cpu_offline(hctx, cpu);
79     - else if (action == CPU_ONLINE || action == CPU_ONLINE_FROZEN)
80     - return blk_mq_hctx_cpu_online(hctx, cpu);
81     +
82     + /*
83     + * In case of CPU online, tags may be reallocated
84     + * in blk_mq_map_swqueue() after mapping is updated.
85     + */
86    
87     return NOTIFY_OK;
88     }
89     @@ -1682,6 +1669,7 @@ static void blk_mq_map_swqueue(struct request_queue *q)
90     unsigned int i;
91     struct blk_mq_hw_ctx *hctx;
92     struct blk_mq_ctx *ctx;
93     + struct blk_mq_tag_set *set = q->tag_set;
94    
95     queue_for_each_hw_ctx(q, hctx, i) {
96     cpumask_clear(hctx->cpumask);
97     @@ -1708,16 +1696,20 @@ static void blk_mq_map_swqueue(struct request_queue *q)
98     * disable it and free the request entries.
99     */
100     if (!hctx->nr_ctx) {
101     - struct blk_mq_tag_set *set = q->tag_set;
102     -
103     if (set->tags[i]) {
104     blk_mq_free_rq_map(set, set->tags[i], i);
105     set->tags[i] = NULL;
106     - hctx->tags = NULL;
107     }
108     + hctx->tags = NULL;
109     continue;
110     }
111    
112     + /* unmapped hw queue can be remapped after CPU topo changed */
113     + if (!set->tags[i])
114     + set->tags[i] = blk_mq_init_rq_map(set, i);
115     + hctx->tags = set->tags[i];
116     + WARN_ON(!hctx->tags);
117     +
118     /*
119     * Initialize batch roundrobin counts
120     */
121     diff --git a/drivers/acpi/acpica/utxfinit.c b/drivers/acpi/acpica/utxfinit.c
122     index 13380d818462..64f8f307243b 100644
123     --- a/drivers/acpi/acpica/utxfinit.c
124     +++ b/drivers/acpi/acpica/utxfinit.c
125     @@ -175,10 +175,12 @@ acpi_status __init acpi_enable_subsystem(u32 flags)
126     * Obtain a permanent mapping for the FACS. This is required for the
127     * Global Lock and the Firmware Waking Vector
128     */
129     - status = acpi_tb_initialize_facs();
130     - if (ACPI_FAILURE(status)) {
131     - ACPI_WARNING((AE_INFO, "Could not map the FACS table"));
132     - return_ACPI_STATUS(status);
133     + if (!(flags & ACPI_NO_FACS_INIT)) {
134     + status = acpi_tb_initialize_facs();
135     + if (ACPI_FAILURE(status)) {
136     + ACPI_WARNING((AE_INFO, "Could not map the FACS table"));
137     + return_ACPI_STATUS(status);
138     + }
139     }
140     #endif /* !ACPI_REDUCED_HARDWARE */
141    
142     diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
143     index 64af3bf2b4c7..98dc0dc605bc 100644
144     --- a/drivers/ata/libata-core.c
145     +++ b/drivers/ata/libata-core.c
146     @@ -4174,9 +4174,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
147     { "ST3320[68]13AS", "SD1[5-9]", ATA_HORKAGE_NONCQ |
148     ATA_HORKAGE_FIRMWARE_WARN },
149    
150     - /* Seagate Momentus SpinPoint M8 seem to have FPMDA_AA issues */
151     + /* drives which fail FPDMA_AA activation (some may freeze afterwards) */
152     { "ST1000LM024 HN-M101MBB", "2AR10001", ATA_HORKAGE_BROKEN_FPDMA_AA },
153     { "ST1000LM024 HN-M101MBB", "2BA30001", ATA_HORKAGE_BROKEN_FPDMA_AA },
154     + { "VB0250EAVER", "HPG7", ATA_HORKAGE_BROKEN_FPDMA_AA },
155    
156     /* Blacklist entries taken from Silicon Image 3124/3132
157     Windows driver .inf file - also several Linux problem reports */
158     @@ -4230,6 +4231,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
159     { "Micron_M550*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, },
160     { "Crucial_CT*M550SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, },
161    
162     + /* devices that don't properly handle TRIM commands */
163     + { "SuperSSpeed S238*", NULL, ATA_HORKAGE_NOTRIM, },
164     +
165     /*
166     * Some WD SATA-I drives spin up and down erratically when the link
167     * is put into the slumber mode. We don't have full list of the
168     @@ -4467,7 +4471,8 @@ static unsigned int ata_dev_set_xfermode(struct ata_device *dev)
169     else /* In the ancient relic department - skip all of this */
170     return 0;
171    
172     - err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
173     + /* On some disks, this command causes spin-up, so we need longer timeout */
174     + err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 15000);
175    
176     DPRINTK("EXIT, err_mask=%x\n", err_mask);
177     return err_mask;
178     diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
179     index 0586f66d70fa..d6ff64248c23 100644
180     --- a/drivers/ata/libata-scsi.c
181     +++ b/drivers/ata/libata-scsi.c
182     @@ -2514,7 +2514,8 @@ static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf)
183     rbuf[14] = (lowest_aligned >> 8) & 0x3f;
184     rbuf[15] = lowest_aligned;
185    
186     - if (ata_id_has_trim(args->id)) {
187     + if (ata_id_has_trim(args->id) &&
188     + !(dev->horkage & ATA_HORKAGE_NOTRIM)) {
189     rbuf[14] |= 0x80; /* TPE */
190    
191     if (ata_id_has_zero_after_trim(args->id))
192     diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
193     index 3d785ebb48d3..50e8bd00e431 100644
194     --- a/drivers/base/firmware_class.c
195     +++ b/drivers/base/firmware_class.c
196     @@ -545,10 +545,8 @@ static void fw_dev_release(struct device *dev)
197     kfree(fw_priv);
198     }
199    
200     -static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env)
201     +static int do_firmware_uevent(struct firmware_priv *fw_priv, struct kobj_uevent_env *env)
202     {
203     - struct firmware_priv *fw_priv = to_firmware_priv(dev);
204     -
205     if (add_uevent_var(env, "FIRMWARE=%s", fw_priv->buf->fw_id))
206     return -ENOMEM;
207     if (add_uevent_var(env, "TIMEOUT=%i", loading_timeout))
208     @@ -559,6 +557,18 @@ static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env)
209     return 0;
210     }
211    
212     +static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env)
213     +{
214     + struct firmware_priv *fw_priv = to_firmware_priv(dev);
215     + int err = 0;
216     +
217     + mutex_lock(&fw_lock);
218     + if (fw_priv->buf)
219     + err = do_firmware_uevent(fw_priv, env);
220     + mutex_unlock(&fw_lock);
221     + return err;
222     +}
223     +
224     static struct class firmware_class = {
225     .name = "firmware",
226     .class_attrs = firmware_class_attrs,
227     diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
228     index b7f101b52d81..0cd6e0d7dd1a 100644
229     --- a/drivers/gpu/drm/drm_crtc.c
230     +++ b/drivers/gpu/drm/drm_crtc.c
231     @@ -2555,8 +2555,11 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
232     if (!drm_core_check_feature(dev, DRIVER_MODESET))
233     return -EINVAL;
234    
235     - /* For some reason crtc x/y offsets are signed internally. */
236     - if (crtc_req->x > INT_MAX || crtc_req->y > INT_MAX)
237     + /*
238     + * Universal plane src offsets are only 16.16, prevent havoc for
239     + * drivers using universal plane code internally.
240     + */
241     + if (crtc_req->x & 0xffff0000 || crtc_req->y & 0xffff0000)
242     return -ERANGE;
243    
244     drm_modeset_lock_all(dev);
245     diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
246     index 534edaa77940..c6ad8a9f1452 100644
247     --- a/drivers/gpu/drm/radeon/si_dpm.c
248     +++ b/drivers/gpu/drm/radeon/si_dpm.c
249     @@ -2922,6 +2922,7 @@ static struct si_dpm_quirk si_dpm_quirk_list[] = {
250     /* PITCAIRN - https://bugs.freedesktop.org/show_bug.cgi?id=76490 */
251     { PCI_VENDOR_ID_ATI, 0x6810, 0x1462, 0x3036, 0, 120000 },
252     { PCI_VENDOR_ID_ATI, 0x6811, 0x174b, 0xe271, 0, 120000 },
253     + { PCI_VENDOR_ID_ATI, 0x6810, 0x174b, 0xe271, 85000, 90000 },
254     { 0, 0, 0, 0 },
255     };
256    
257     diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
258     index ff61ae55dd3f..0047db49ee5e 100644
259     --- a/drivers/iio/adc/at91_adc.c
260     +++ b/drivers/iio/adc/at91_adc.c
261     @@ -182,7 +182,7 @@ struct at91_adc_caps {
262     u8 ts_pen_detect_sensitivity;
263    
264     /* startup time calculate function */
265     - u32 (*calc_startup_ticks)(u8 startup_time, u32 adc_clk_khz);
266     + u32 (*calc_startup_ticks)(u32 startup_time, u32 adc_clk_khz);
267    
268     u8 num_channels;
269     struct at91_adc_reg_desc registers;
270     @@ -201,7 +201,7 @@ struct at91_adc_state {
271     u8 num_channels;
272     void __iomem *reg_base;
273     struct at91_adc_reg_desc *registers;
274     - u8 startup_time;
275     + u32 startup_time;
276     u8 sample_hold_time;
277     bool sleep_mode;
278     struct iio_trigger **trig;
279     @@ -780,7 +780,7 @@ ret:
280     return ret;
281     }
282    
283     -static u32 calc_startup_ticks_9260(u8 startup_time, u32 adc_clk_khz)
284     +static u32 calc_startup_ticks_9260(u32 startup_time, u32 adc_clk_khz)
285     {
286     /*
287     * Number of ticks needed to cover the startup time of the ADC
288     @@ -791,7 +791,7 @@ static u32 calc_startup_ticks_9260(u8 startup_time, u32 adc_clk_khz)
289     return round_up((startup_time * adc_clk_khz / 1000) - 1, 8) / 8;
290     }
291    
292     -static u32 calc_startup_ticks_9x5(u8 startup_time, u32 adc_clk_khz)
293     +static u32 calc_startup_ticks_9x5(u32 startup_time, u32 adc_clk_khz)
294     {
295     /*
296     * For sama5d3x and at91sam9x5, the formula changes to:
297     diff --git a/drivers/iio/dac/ad5624r_spi.c b/drivers/iio/dac/ad5624r_spi.c
298     index 61bb9d4239ea..e98428df0d44 100644
299     --- a/drivers/iio/dac/ad5624r_spi.c
300     +++ b/drivers/iio/dac/ad5624r_spi.c
301     @@ -22,7 +22,7 @@
302     #include "ad5624r.h"
303    
304     static int ad5624r_spi_write(struct spi_device *spi,
305     - u8 cmd, u8 addr, u16 val, u8 len)
306     + u8 cmd, u8 addr, u16 val, u8 shift)
307     {
308     u32 data;
309     u8 msg[3];
310     @@ -35,7 +35,7 @@ static int ad5624r_spi_write(struct spi_device *spi,
311     * 14-, 12-bit input code followed by 0, 2, or 4 don't care bits,
312     * for the AD5664R, AD5644R, and AD5624R, respectively.
313     */
314     - data = (0 << 22) | (cmd << 19) | (addr << 16) | (val << (16 - len));
315     + data = (0 << 22) | (cmd << 19) | (addr << 16) | (val << shift);
316     msg[0] = data >> 16;
317     msg[1] = data >> 8;
318     msg[2] = data;
319     diff --git a/drivers/iio/temperature/tmp006.c b/drivers/iio/temperature/tmp006.c
320     index 84a0789c3d96..7a8050996b4e 100644
321     --- a/drivers/iio/temperature/tmp006.c
322     +++ b/drivers/iio/temperature/tmp006.c
323     @@ -132,6 +132,9 @@ static int tmp006_write_raw(struct iio_dev *indio_dev,
324     struct tmp006_data *data = iio_priv(indio_dev);
325     int i;
326    
327     + if (mask != IIO_CHAN_INFO_SAMP_FREQ)
328     + return -EINVAL;
329     +
330     for (i = 0; i < ARRAY_SIZE(tmp006_freqs); i++)
331     if ((val == tmp006_freqs[i][0]) &&
332     (val2 == tmp006_freqs[i][1])) {
333     diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
334     index 02c494a8d111..7b8c29b295ac 100644
335     --- a/drivers/infiniband/ulp/isert/ib_isert.c
336     +++ b/drivers/infiniband/ulp/isert/ib_isert.c
337     @@ -220,7 +220,7 @@ fail:
338     static void
339     isert_free_rx_descriptors(struct isert_conn *isert_conn)
340     {
341     - struct ib_device *ib_dev = isert_conn->conn_cm_id->device;
342     + struct ib_device *ib_dev = isert_conn->conn_device->ib_device;
343     struct iser_rx_desc *rx_desc;
344     int i;
345    
346     @@ -742,9 +742,9 @@ out:
347     static void
348     isert_connect_release(struct isert_conn *isert_conn)
349     {
350     - struct ib_device *ib_dev = isert_conn->conn_cm_id->device;
351     struct isert_device *device = isert_conn->conn_device;
352     int cq_index;
353     + struct ib_device *ib_dev = device->ib_device;
354    
355     pr_debug("Entering isert_connect_release(): >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
356    
357     @@ -752,7 +752,8 @@ isert_connect_release(struct isert_conn *isert_conn)
358     isert_conn_free_fastreg_pool(isert_conn);
359    
360     isert_free_rx_descriptors(isert_conn);
361     - rdma_destroy_id(isert_conn->conn_cm_id);
362     + if (isert_conn->conn_cm_id)
363     + rdma_destroy_id(isert_conn->conn_cm_id);
364    
365     if (isert_conn->conn_qp) {
366     cq_index = ((struct isert_cq_desc *)
367     @@ -924,12 +925,15 @@ out:
368     return 0;
369     }
370    
371     -static void
372     +static int
373     isert_connect_error(struct rdma_cm_id *cma_id)
374     {
375     struct isert_conn *isert_conn = cma_id->qp->qp_context;
376    
377     + isert_conn->conn_cm_id = NULL;
378     isert_put_conn(isert_conn);
379     +
380     + return -1;
381     }
382    
383     static int
384     @@ -959,7 +963,7 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
385     case RDMA_CM_EVENT_REJECTED: /* FALLTHRU */
386     case RDMA_CM_EVENT_UNREACHABLE: /* FALLTHRU */
387     case RDMA_CM_EVENT_CONNECT_ERROR:
388     - isert_connect_error(cma_id);
389     + ret = isert_connect_error(cma_id);
390     break;
391     default:
392     pr_err("Unhandled RDMA CMA event: %d\n", event->event);
393     diff --git a/drivers/md/md.c b/drivers/md/md.c
394     index 9233c71138f1..43390353d62f 100644
395     --- a/drivers/md/md.c
396     +++ b/drivers/md/md.c
397     @@ -6031,7 +6031,7 @@ static int update_array_info(struct mddev *mddev, mdu_array_info_t *info)
398     mddev->ctime != info->ctime ||
399     mddev->level != info->level ||
400     /* mddev->layout != info->layout || */
401     - !mddev->persistent != info->not_persistent||
402     + mddev->persistent != !info->not_persistent ||
403     mddev->chunk_sectors != info->chunk_size >> 9 ||
404     /* ignore bottom 8 bits of state, and allow SB_BITMAP_PRESENT to change */
405     ((state^info->state) & 0xfffffe00)
406     diff --git a/drivers/md/persistent-data/dm-btree-remove.c b/drivers/md/persistent-data/dm-btree-remove.c
407     index b88757cd0d1d..a03178e91a79 100644
408     --- a/drivers/md/persistent-data/dm-btree-remove.c
409     +++ b/drivers/md/persistent-data/dm-btree-remove.c
410     @@ -309,8 +309,8 @@ static void redistribute3(struct dm_btree_info *info, struct btree_node *parent,
411    
412     if (s < 0 && nr_center < -s) {
413     /* not enough in central node */
414     - shift(left, center, nr_center);
415     - s = nr_center - target;
416     + shift(left, center, -nr_center);
417     + s += nr_center;
418     shift(left, right, s);
419     nr_right += s;
420     } else
421     @@ -323,7 +323,7 @@ static void redistribute3(struct dm_btree_info *info, struct btree_node *parent,
422     if (s > 0 && nr_center < s) {
423     /* not enough in central node */
424     shift(center, right, nr_center);
425     - s = target - nr_center;
426     + s -= nr_center;
427     shift(left, right, s);
428     nr_left -= s;
429     } else
430     diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c
431     index 200ac12a1d40..fdd3793e22f9 100644
432     --- a/drivers/md/persistent-data/dm-btree.c
433     +++ b/drivers/md/persistent-data/dm-btree.c
434     @@ -255,7 +255,7 @@ int dm_btree_del(struct dm_btree_info *info, dm_block_t root)
435     int r;
436     struct del_stack *s;
437    
438     - s = kmalloc(sizeof(*s), GFP_KERNEL);
439     + s = kmalloc(sizeof(*s), GFP_NOIO);
440     if (!s)
441     return -ENOMEM;
442     s->info = info;
443     diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
444     index a19a18f0058a..10ecc0a0112b 100644
445     --- a/drivers/mmc/card/block.c
446     +++ b/drivers/mmc/card/block.c
447     @@ -205,6 +205,8 @@ static ssize_t power_ro_lock_show(struct device *dev,
448    
449     ret = snprintf(buf, PAGE_SIZE, "%d\n", locked);
450    
451     + mmc_blk_put(md);
452     +
453     return ret;
454     }
455    
456     @@ -1915,9 +1917,11 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc)
457     break;
458     case MMC_BLK_CMD_ERR:
459     ret = mmc_blk_cmd_err(md, card, brq, req, ret);
460     - if (!mmc_blk_reset(md, card->host, type))
461     - break;
462     - goto cmd_abort;
463     + if (mmc_blk_reset(md, card->host, type))
464     + goto cmd_abort;
465     + if (!ret)
466     + goto start_new_req;
467     + break;
468     case MMC_BLK_RETRY:
469     if (retry++ < 5)
470     break;
471     diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
472     index bb686e15102c..573b53b38af4 100644
473     --- a/drivers/net/can/dev.c
474     +++ b/drivers/net/can/dev.c
475     @@ -360,9 +360,6 @@ unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx)
476     struct can_frame *cf = (struct can_frame *)skb->data;
477     u8 dlc = cf->can_dlc;
478    
479     - if (!(skb->tstamp.tv64))
480     - __net_timestamp(skb);
481     -
482     netif_rx(priv->echo_skb[idx]);
483     priv->echo_skb[idx] = NULL;
484    
485     @@ -499,7 +496,6 @@ struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf)
486     if (unlikely(!skb))
487     return NULL;
488    
489     - __net_timestamp(skb);
490     skb->protocol = htons(ETH_P_CAN);
491     skb->pkt_type = PACKET_BROADCAST;
492     skb->ip_summed = CHECKSUM_UNNECESSARY;
493     @@ -528,7 +524,6 @@ struct sk_buff *alloc_canfd_skb(struct net_device *dev,
494     if (unlikely(!skb))
495     return NULL;
496    
497     - __net_timestamp(skb);
498     skb->protocol = htons(ETH_P_CANFD);
499     skb->pkt_type = PACKET_BROADCAST;
500     skb->ip_summed = CHECKSUM_UNNECESSARY;
501     diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
502     index cb6b4723af4a..acb5b92ace92 100644
503     --- a/drivers/net/can/slcan.c
504     +++ b/drivers/net/can/slcan.c
505     @@ -210,7 +210,6 @@ static void slc_bump(struct slcan *sl)
506     if (!skb)
507     return;
508    
509     - __net_timestamp(skb);
510     skb->dev = sl->dev;
511     skb->protocol = htons(ETH_P_CAN);
512     skb->pkt_type = PACKET_BROADCAST;
513     diff --git a/drivers/net/can/vcan.c b/drivers/net/can/vcan.c
514     index 30e4627a0c01..4e94057ef5cf 100644
515     --- a/drivers/net/can/vcan.c
516     +++ b/drivers/net/can/vcan.c
517     @@ -81,9 +81,6 @@ static void vcan_rx(struct sk_buff *skb, struct net_device *dev)
518     skb->dev = dev;
519     skb->ip_summed = CHECKSUM_UNNECESSARY;
520    
521     - if (!(skb->tstamp.tv64))
522     - __net_timestamp(skb);
523     -
524     netif_rx_ni(skb);
525     }
526    
527     diff --git a/drivers/of/base.c b/drivers/of/base.c
528     index 4c2ccde42427..469d2b7f47eb 100644
529     --- a/drivers/of/base.c
530     +++ b/drivers/of/base.c
531     @@ -88,7 +88,7 @@ EXPORT_SYMBOL(of_n_size_cells);
532     #ifdef CONFIG_NUMA
533     int __weak of_node_to_nid(struct device_node *np)
534     {
535     - return numa_node_id();
536     + return NUMA_NO_NODE;
537     }
538     #endif
539    
540     diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
541     index 233d2ee598a6..be945fff61c3 100644
542     --- a/drivers/platform/x86/dell-laptop.c
543     +++ b/drivers/platform/x86/dell-laptop.c
544     @@ -272,7 +272,6 @@ static const struct dmi_system_id dell_quirks[] __initconst = {
545     };
546    
547     static struct calling_interface_buffer *buffer;
548     -static struct page *bufferpage;
549     static DEFINE_MUTEX(buffer_mutex);
550    
551     static int hwswitch_state;
552     @@ -825,12 +824,11 @@ static int __init dell_init(void)
553     * Allocate buffer below 4GB for SMI data--only 32-bit physical addr
554     * is passed to SMI handler.
555     */
556     - bufferpage = alloc_page(GFP_KERNEL | GFP_DMA32);
557     - if (!bufferpage) {
558     + buffer = (void *)__get_free_page(GFP_KERNEL | GFP_DMA32);
559     + if (!buffer) {
560     ret = -ENOMEM;
561     goto fail_buffer;
562     }
563     - buffer = page_address(bufferpage);
564    
565     ret = dell_setup_rfkill();
566    
567     @@ -892,7 +890,7 @@ fail_backlight:
568     cancel_delayed_work_sync(&dell_rfkill_work);
569     dell_cleanup_rfkill();
570     fail_rfkill:
571     - free_page((unsigned long)bufferpage);
572     + free_page((unsigned long)buffer);
573     fail_buffer:
574     platform_device_del(platform_device);
575     fail_platform_device2:
576     diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
577     index 262ab837a704..9f77d23239a2 100644
578     --- a/drivers/scsi/scsi_devinfo.c
579     +++ b/drivers/scsi/scsi_devinfo.c
580     @@ -226,6 +226,7 @@ static struct {
581     {"PIONEER", "CD-ROM DRM-624X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
582     {"Promise", "VTrak E610f", NULL, BLIST_SPARSELUN | BLIST_NO_RSOC},
583     {"Promise", "", NULL, BLIST_SPARSELUN},
584     + {"QNAP", "iSCSI Storage", NULL, BLIST_MAX_1024},
585     {"QUANTUM", "XP34301", "1071", BLIST_NOTQ},
586     {"REGAL", "CDC-4X", NULL, BLIST_MAX5LUN | BLIST_SINGLELUN},
587     {"SanDisk", "ImageMate CF-SD1", NULL, BLIST_FORCELUN},
588     diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
589     index ba3f1e8d0d57..f49cb534a829 100644
590     --- a/drivers/scsi/scsi_scan.c
591     +++ b/drivers/scsi/scsi_scan.c
592     @@ -901,6 +901,12 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
593     */
594     if (*bflags & BLIST_MAX_512)
595     blk_queue_max_hw_sectors(sdev->request_queue, 512);
596     + /*
597     + * Max 1024 sector transfer length for targets that report incorrect
598     + * max/optimal lengths and relied on the old block layer safe default
599     + */
600     + else if (*bflags & BLIST_MAX_1024)
601     + blk_queue_max_hw_sectors(sdev->request_queue, 1024);
602    
603     /*
604     * Some devices may not want to have a start command automatically
605     diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
606     index 2eb6fa8e645e..3c5dd9762476 100644
607     --- a/drivers/target/iscsi/iscsi_target.c
608     +++ b/drivers/target/iscsi/iscsi_target.c
609     @@ -537,7 +537,7 @@ static struct iscsit_transport iscsi_target_transport = {
610    
611     static int __init iscsi_target_init_module(void)
612     {
613     - int ret = 0;
614     + int ret = 0, size;
615    
616     pr_debug("iSCSI-Target "ISCSIT_VERSION"\n");
617    
618     @@ -546,6 +546,7 @@ static int __init iscsi_target_init_module(void)
619     pr_err("Unable to allocate memory for iscsit_global\n");
620     return -1;
621     }
622     + spin_lock_init(&iscsit_global->ts_bitmap_lock);
623     mutex_init(&auth_id_lock);
624     spin_lock_init(&sess_idr_lock);
625     idr_init(&tiqn_idr);
626     @@ -555,15 +556,11 @@ static int __init iscsi_target_init_module(void)
627     if (ret < 0)
628     goto out;
629    
630     - ret = iscsi_thread_set_init();
631     - if (ret < 0)
632     + size = BITS_TO_LONGS(ISCSIT_BITMAP_BITS) * sizeof(long);
633     + iscsit_global->ts_bitmap = vzalloc(size);
634     + if (!iscsit_global->ts_bitmap) {
635     + pr_err("Unable to allocate iscsit_global->ts_bitmap\n");
636     goto configfs_out;
637     -
638     - if (iscsi_allocate_thread_sets(TARGET_THREAD_SET_COUNT) !=
639     - TARGET_THREAD_SET_COUNT) {
640     - pr_err("iscsi_allocate_thread_sets() returned"
641     - " unexpected value!\n");
642     - goto ts_out1;
643     }
644    
645     lio_qr_cache = kmem_cache_create("lio_qr_cache",
646     @@ -572,7 +569,7 @@ static int __init iscsi_target_init_module(void)
647     if (!lio_qr_cache) {
648     pr_err("nable to kmem_cache_create() for"
649     " lio_qr_cache\n");
650     - goto ts_out2;
651     + goto bitmap_out;
652     }
653    
654     lio_dr_cache = kmem_cache_create("lio_dr_cache",
655     @@ -616,10 +613,8 @@ dr_out:
656     kmem_cache_destroy(lio_dr_cache);
657     qr_out:
658     kmem_cache_destroy(lio_qr_cache);
659     -ts_out2:
660     - iscsi_deallocate_thread_sets();
661     -ts_out1:
662     - iscsi_thread_set_free();
663     +bitmap_out:
664     + vfree(iscsit_global->ts_bitmap);
665     configfs_out:
666     iscsi_target_deregister_configfs();
667     out:
668     @@ -629,8 +624,6 @@ out:
669    
670     static void __exit iscsi_target_cleanup_module(void)
671     {
672     - iscsi_deallocate_thread_sets();
673     - iscsi_thread_set_free();
674     iscsit_release_discovery_tpg();
675     iscsit_unregister_transport(&iscsi_target_transport);
676     kmem_cache_destroy(lio_qr_cache);
677     @@ -640,6 +633,7 @@ static void __exit iscsi_target_cleanup_module(void)
678    
679     iscsi_target_deregister_configfs();
680    
681     + vfree(iscsit_global->ts_bitmap);
682     kfree(iscsit_global);
683     }
684    
685     @@ -3680,17 +3674,16 @@ static int iscsit_send_reject(
686    
687     void iscsit_thread_get_cpumask(struct iscsi_conn *conn)
688     {
689     - struct iscsi_thread_set *ts = conn->thread_set;
690     int ord, cpu;
691     /*
692     - * thread_id is assigned from iscsit_global->ts_bitmap from
693     - * within iscsi_thread_set.c:iscsi_allocate_thread_sets()
694     + * bitmap_id is assigned from iscsit_global->ts_bitmap from
695     + * within iscsit_start_kthreads()
696     *
697     - * Here we use thread_id to determine which CPU that this
698     - * iSCSI connection's iscsi_thread_set will be scheduled to
699     + * Here we use bitmap_id to determine which CPU that this
700     + * iSCSI connection's RX/TX threads will be scheduled to
701     * execute upon.
702     */
703     - ord = ts->thread_id % cpumask_weight(cpu_online_mask);
704     + ord = conn->bitmap_id % cpumask_weight(cpu_online_mask);
705     for_each_online_cpu(cpu) {
706     if (ord-- == 0) {
707     cpumask_set_cpu(cpu, conn->conn_cpumask);
708     @@ -3879,7 +3872,7 @@ check_rsp_state:
709     switch (state) {
710     case ISTATE_SEND_LOGOUTRSP:
711     if (!iscsit_logout_post_handler(cmd, conn))
712     - goto restart;
713     + return -ECONNRESET;
714     /* fall through */
715     case ISTATE_SEND_STATUS:
716     case ISTATE_SEND_ASYNCMSG:
717     @@ -3907,8 +3900,6 @@ check_rsp_state:
718    
719     err:
720     return -1;
721     -restart:
722     - return -EAGAIN;
723     }
724    
725     static int iscsit_handle_response_queue(struct iscsi_conn *conn)
726     @@ -3935,21 +3926,13 @@ static int iscsit_handle_response_queue(struct iscsi_conn *conn)
727     int iscsi_target_tx_thread(void *arg)
728     {
729     int ret = 0;
730     - struct iscsi_conn *conn;
731     - struct iscsi_thread_set *ts = arg;
732     + struct iscsi_conn *conn = arg;
733     /*
734     * Allow ourselves to be interrupted by SIGINT so that a
735     * connection recovery / failure event can be triggered externally.
736     */
737     allow_signal(SIGINT);
738    
739     -restart:
740     - conn = iscsi_tx_thread_pre_handler(ts);
741     - if (!conn)
742     - goto out;
743     -
744     - ret = 0;
745     -
746     while (!kthread_should_stop()) {
747     /*
748     * Ensure that both TX and RX per connection kthreads
749     @@ -3958,11 +3941,9 @@ restart:
750     iscsit_thread_check_cpumask(conn, current, 1);
751    
752     wait_event_interruptible(conn->queues_wq,
753     - !iscsit_conn_all_queues_empty(conn) ||
754     - ts->status == ISCSI_THREAD_SET_RESET);
755     + !iscsit_conn_all_queues_empty(conn));
756    
757     - if ((ts->status == ISCSI_THREAD_SET_RESET) ||
758     - signal_pending(current))
759     + if (signal_pending(current))
760     goto transport_err;
761    
762     get_immediate:
763     @@ -3973,15 +3954,14 @@ get_immediate:
764     ret = iscsit_handle_response_queue(conn);
765     if (ret == 1)
766     goto get_immediate;
767     - else if (ret == -EAGAIN)
768     - goto restart;
769     + else if (ret == -ECONNRESET)
770     + goto out;
771     else if (ret < 0)
772     goto transport_err;
773     }
774    
775     transport_err:
776     iscsit_take_action_for_connection_exit(conn);
777     - goto restart;
778     out:
779     return 0;
780     }
781     @@ -4070,8 +4050,7 @@ int iscsi_target_rx_thread(void *arg)
782     int ret;
783     u8 buffer[ISCSI_HDR_LEN], opcode;
784     u32 checksum = 0, digest = 0;
785     - struct iscsi_conn *conn = NULL;
786     - struct iscsi_thread_set *ts = arg;
787     + struct iscsi_conn *conn = arg;
788     struct kvec iov;
789     /*
790     * Allow ourselves to be interrupted by SIGINT so that a
791     @@ -4079,11 +4058,6 @@ int iscsi_target_rx_thread(void *arg)
792     */
793     allow_signal(SIGINT);
794    
795     -restart:
796     - conn = iscsi_rx_thread_pre_handler(ts);
797     - if (!conn)
798     - goto out;
799     -
800     if (conn->conn_transport->transport_type == ISCSI_INFINIBAND) {
801     struct completion comp;
802     int rc;
803     @@ -4093,7 +4067,7 @@ restart:
804     if (rc < 0)
805     goto transport_err;
806    
807     - goto out;
808     + goto transport_err;
809     }
810    
811     while (!kthread_should_stop()) {
812     @@ -4169,8 +4143,6 @@ transport_err:
813     if (!signal_pending(current))
814     atomic_set(&conn->transport_failed, 1);
815     iscsit_take_action_for_connection_exit(conn);
816     - goto restart;
817     -out:
818     return 0;
819     }
820    
821     @@ -4232,7 +4204,24 @@ int iscsit_close_connection(
822     if (conn->conn_transport->transport_type == ISCSI_TCP)
823     complete(&conn->conn_logout_comp);
824    
825     - iscsi_release_thread_set(conn);
826     + if (!strcmp(current->comm, ISCSI_RX_THREAD_NAME)) {
827     + if (conn->tx_thread &&
828     + cmpxchg(&conn->tx_thread_active, true, false)) {
829     + send_sig(SIGINT, conn->tx_thread, 1);
830     + kthread_stop(conn->tx_thread);
831     + }
832     + } else if (!strcmp(current->comm, ISCSI_TX_THREAD_NAME)) {
833     + if (conn->rx_thread &&
834     + cmpxchg(&conn->rx_thread_active, true, false)) {
835     + send_sig(SIGINT, conn->rx_thread, 1);
836     + kthread_stop(conn->rx_thread);
837     + }
838     + }
839     +
840     + spin_lock(&iscsit_global->ts_bitmap_lock);
841     + bitmap_release_region(iscsit_global->ts_bitmap, conn->bitmap_id,
842     + get_order(1));
843     + spin_unlock(&iscsit_global->ts_bitmap_lock);
844    
845     iscsit_stop_timers_for_cmds(conn);
846     iscsit_stop_nopin_response_timer(conn);
847     @@ -4510,15 +4499,13 @@ static void iscsit_logout_post_handler_closesession(
848     struct iscsi_conn *conn)
849     {
850     struct iscsi_session *sess = conn->sess;
851     -
852     - iscsi_set_thread_clear(conn, ISCSI_CLEAR_TX_THREAD);
853     - iscsi_set_thread_set_signal(conn, ISCSI_SIGNAL_TX_THREAD);
854     + int sleep = cmpxchg(&conn->tx_thread_active, true, false);
855    
856     atomic_set(&conn->conn_logout_remove, 0);
857     complete(&conn->conn_logout_comp);
858    
859     iscsit_dec_conn_usage_count(conn);
860     - iscsit_stop_session(sess, 1, 1);
861     + iscsit_stop_session(sess, sleep, sleep);
862     iscsit_dec_session_usage_count(sess);
863     target_put_session(sess->se_sess);
864     }
865     @@ -4526,13 +4513,12 @@ static void iscsit_logout_post_handler_closesession(
866     static void iscsit_logout_post_handler_samecid(
867     struct iscsi_conn *conn)
868     {
869     - iscsi_set_thread_clear(conn, ISCSI_CLEAR_TX_THREAD);
870     - iscsi_set_thread_set_signal(conn, ISCSI_SIGNAL_TX_THREAD);
871     + int sleep = cmpxchg(&conn->tx_thread_active, true, false);
872    
873     atomic_set(&conn->conn_logout_remove, 0);
874     complete(&conn->conn_logout_comp);
875    
876     - iscsit_cause_connection_reinstatement(conn, 1);
877     + iscsit_cause_connection_reinstatement(conn, sleep);
878     iscsit_dec_conn_usage_count(conn);
879     }
880    
881     diff --git a/drivers/target/iscsi/iscsi_target_core.h b/drivers/target/iscsi/iscsi_target_core.h
882     index 302eb3b78715..2423f27e4670 100644
883     --- a/drivers/target/iscsi/iscsi_target_core.h
884     +++ b/drivers/target/iscsi/iscsi_target_core.h
885     @@ -602,6 +602,11 @@ struct iscsi_conn {
886     struct iscsi_session *sess;
887     /* Pointer to thread_set in use for this conn's threads */
888     struct iscsi_thread_set *thread_set;
889     + int bitmap_id;
890     + int rx_thread_active;
891     + struct task_struct *rx_thread;
892     + int tx_thread_active;
893     + struct task_struct *tx_thread;
894     /* list_head for session connection list */
895     struct list_head conn_list;
896     } ____cacheline_aligned;
897     @@ -872,10 +877,12 @@ struct iscsit_global {
898     /* Unique identifier used for the authentication daemon */
899     u32 auth_id;
900     u32 inactive_ts;
901     +#define ISCSIT_BITMAP_BITS 262144
902     /* Thread Set bitmap count */
903     int ts_bitmap_count;
904     /* Thread Set bitmap pointer */
905     unsigned long *ts_bitmap;
906     + spinlock_t ts_bitmap_lock;
907     /* Used for iSCSI discovery session authentication */
908     struct iscsi_node_acl discovery_acl;
909     struct iscsi_portal_group *discovery_tpg;
910     diff --git a/drivers/target/iscsi/iscsi_target_erl0.c b/drivers/target/iscsi/iscsi_target_erl0.c
911     index a0ae5fc0ad75..87f687258729 100644
912     --- a/drivers/target/iscsi/iscsi_target_erl0.c
913     +++ b/drivers/target/iscsi/iscsi_target_erl0.c
914     @@ -860,7 +860,10 @@ void iscsit_connection_reinstatement_rcfr(struct iscsi_conn *conn)
915     }
916     spin_unlock_bh(&conn->state_lock);
917    
918     - iscsi_thread_set_force_reinstatement(conn);
919     + if (conn->tx_thread && conn->tx_thread_active)
920     + send_sig(SIGINT, conn->tx_thread, 1);
921     + if (conn->rx_thread && conn->rx_thread_active)
922     + send_sig(SIGINT, conn->rx_thread, 1);
923    
924     sleep:
925     wait_for_completion(&conn->conn_wait_rcfr_comp);
926     @@ -885,10 +888,10 @@ void iscsit_cause_connection_reinstatement(struct iscsi_conn *conn, int sleep)
927     return;
928     }
929    
930     - if (iscsi_thread_set_force_reinstatement(conn) < 0) {
931     - spin_unlock_bh(&conn->state_lock);
932     - return;
933     - }
934     + if (conn->tx_thread && conn->tx_thread_active)
935     + send_sig(SIGINT, conn->tx_thread, 1);
936     + if (conn->rx_thread && conn->rx_thread_active)
937     + send_sig(SIGINT, conn->rx_thread, 1);
938    
939     atomic_set(&conn->connection_reinstatement, 1);
940     if (!sleep) {
941     diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c
942     index 18e2601527df..2d87abc6b38c 100644
943     --- a/drivers/target/iscsi/iscsi_target_login.c
944     +++ b/drivers/target/iscsi/iscsi_target_login.c
945     @@ -699,6 +699,51 @@ static void iscsi_post_login_start_timers(struct iscsi_conn *conn)
946     iscsit_start_nopin_timer(conn);
947     }
948    
949     +int iscsit_start_kthreads(struct iscsi_conn *conn)
950     +{
951     + int ret = 0;
952     +
953     + spin_lock(&iscsit_global->ts_bitmap_lock);
954     + conn->bitmap_id = bitmap_find_free_region(iscsit_global->ts_bitmap,
955     + ISCSIT_BITMAP_BITS, get_order(1));
956     + spin_unlock(&iscsit_global->ts_bitmap_lock);
957     +
958     + if (conn->bitmap_id < 0) {
959     + pr_err("bitmap_find_free_region() failed for"
960     + " iscsit_start_kthreads()\n");
961     + return -ENOMEM;
962     + }
963     +
964     + conn->tx_thread = kthread_run(iscsi_target_tx_thread, conn,
965     + "%s", ISCSI_TX_THREAD_NAME);
966     + if (IS_ERR(conn->tx_thread)) {
967     + pr_err("Unable to start iscsi_target_tx_thread\n");
968     + ret = PTR_ERR(conn->tx_thread);
969     + goto out_bitmap;
970     + }
971     + conn->tx_thread_active = true;
972     +
973     + conn->rx_thread = kthread_run(iscsi_target_rx_thread, conn,
974     + "%s", ISCSI_RX_THREAD_NAME);
975     + if (IS_ERR(conn->rx_thread)) {
976     + pr_err("Unable to start iscsi_target_rx_thread\n");
977     + ret = PTR_ERR(conn->rx_thread);
978     + goto out_tx;
979     + }
980     + conn->rx_thread_active = true;
981     +
982     + return 0;
983     +out_tx:
984     + kthread_stop(conn->tx_thread);
985     + conn->tx_thread_active = false;
986     +out_bitmap:
987     + spin_lock(&iscsit_global->ts_bitmap_lock);
988     + bitmap_release_region(iscsit_global->ts_bitmap, conn->bitmap_id,
989     + get_order(1));
990     + spin_unlock(&iscsit_global->ts_bitmap_lock);
991     + return ret;
992     +}
993     +
994     int iscsi_post_login_handler(
995     struct iscsi_np *np,
996     struct iscsi_conn *conn,
997     @@ -709,7 +754,7 @@ int iscsi_post_login_handler(
998     struct se_session *se_sess = sess->se_sess;
999     struct iscsi_portal_group *tpg = sess->tpg;
1000     struct se_portal_group *se_tpg = &tpg->tpg_se_tpg;
1001     - struct iscsi_thread_set *ts;
1002     + int rc;
1003    
1004     iscsit_inc_conn_usage_count(conn);
1005    
1006     @@ -724,7 +769,6 @@ int iscsi_post_login_handler(
1007     /*
1008     * SCSI Initiator -> SCSI Target Port Mapping
1009     */
1010     - ts = iscsi_get_thread_set();
1011     if (!zero_tsih) {
1012     iscsi_set_session_parameters(sess->sess_ops,
1013     conn->param_list, 0);
1014     @@ -751,9 +795,11 @@ int iscsi_post_login_handler(
1015     sess->sess_ops->InitiatorName);
1016     spin_unlock_bh(&sess->conn_lock);
1017    
1018     - iscsi_post_login_start_timers(conn);
1019     + rc = iscsit_start_kthreads(conn);
1020     + if (rc)
1021     + return rc;
1022    
1023     - iscsi_activate_thread_set(conn, ts);
1024     + iscsi_post_login_start_timers(conn);
1025     /*
1026     * Determine CPU mask to ensure connection's RX and TX kthreads
1027     * are scheduled on the same CPU.
1028     @@ -810,8 +856,11 @@ int iscsi_post_login_handler(
1029     " iSCSI Target Portal Group: %hu\n", tpg->nsessions, tpg->tpgt);
1030     spin_unlock_bh(&se_tpg->session_lock);
1031    
1032     + rc = iscsit_start_kthreads(conn);
1033     + if (rc)
1034     + return rc;
1035     +
1036     iscsi_post_login_start_timers(conn);
1037     - iscsi_activate_thread_set(conn, ts);
1038     /*
1039     * Determine CPU mask to ensure connection's RX and TX kthreads
1040     * are scheduled on the same CPU.
1041     diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
1042     index e500243803d8..a85eadff6bea 100644
1043     --- a/drivers/usb/core/devio.c
1044     +++ b/drivers/usb/core/devio.c
1045     @@ -513,7 +513,7 @@ static void async_completed(struct urb *urb)
1046     snoop(&urb->dev->dev, "urb complete\n");
1047     snoop_urb(urb->dev, as->userurb, urb->pipe, urb->actual_length,
1048     as->status, COMPLETE, NULL, 0);
1049     - if ((urb->transfer_flags & URB_DIR_MASK) == USB_DIR_IN)
1050     + if ((urb->transfer_flags & URB_DIR_MASK) == URB_DIR_IN)
1051     snoop_urb_data(urb, urb->actual_length);
1052    
1053     if (as->status < 0 && as->bulk_addr && as->status != -ECONNRESET &&
1054     @@ -1690,7 +1690,7 @@ static struct async *reap_as(struct usb_dev_state *ps)
1055     for (;;) {
1056     __set_current_state(TASK_INTERRUPTIBLE);
1057     as = async_getcompleted(ps);
1058     - if (as)
1059     + if (as || !connected(ps))
1060     break;
1061     if (signal_pending(current))
1062     break;
1063     @@ -1713,7 +1713,7 @@ static int proc_reapurb(struct usb_dev_state *ps, void __user *arg)
1064     }
1065     if (signal_pending(current))
1066     return -EINTR;
1067     - return -EIO;
1068     + return -ENODEV;
1069     }
1070    
1071     static int proc_reapurbnonblock(struct usb_dev_state *ps, void __user *arg)
1072     @@ -1722,10 +1722,11 @@ static int proc_reapurbnonblock(struct usb_dev_state *ps, void __user *arg)
1073     struct async *as;
1074    
1075     as = async_getcompleted(ps);
1076     - retval = -EAGAIN;
1077     if (as) {
1078     retval = processcompl(as, (void __user * __user *)arg);
1079     free_async(as);
1080     + } else {
1081     + retval = (connected(ps) ? -EAGAIN : -ENODEV);
1082     }
1083     return retval;
1084     }
1085     @@ -1855,7 +1856,7 @@ static int proc_reapurb_compat(struct usb_dev_state *ps, void __user *arg)
1086     }
1087     if (signal_pending(current))
1088     return -EINTR;
1089     - return -EIO;
1090     + return -ENODEV;
1091     }
1092    
1093     static int proc_reapurbnonblock_compat(struct usb_dev_state *ps, void __user *arg)
1094     @@ -1863,11 +1864,12 @@ static int proc_reapurbnonblock_compat(struct usb_dev_state *ps, void __user *ar
1095     int retval;
1096     struct async *as;
1097    
1098     - retval = -EAGAIN;
1099     as = async_getcompleted(ps);
1100     if (as) {
1101     retval = processcompl_compat(as, (void __user * __user *)arg);
1102     free_async(as);
1103     + } else {
1104     + retval = (connected(ps) ? -EAGAIN : -ENODEV);
1105     }
1106     return retval;
1107     }
1108     @@ -2039,7 +2041,8 @@ static int proc_get_capabilities(struct usb_dev_state *ps, void __user *arg)
1109     {
1110     __u32 caps;
1111    
1112     - caps = USBDEVFS_CAP_ZERO_PACKET | USBDEVFS_CAP_NO_PACKET_SIZE_LIM;
1113     + caps = USBDEVFS_CAP_ZERO_PACKET | USBDEVFS_CAP_NO_PACKET_SIZE_LIM |
1114     + USBDEVFS_CAP_REAP_AFTER_DISCONNECT;
1115     if (!ps->dev->bus->no_stop_on_short)
1116     caps |= USBDEVFS_CAP_BULK_CONTINUATION;
1117     if (ps->dev->bus->sg_tablesize)
1118     @@ -2139,6 +2142,32 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
1119     return -EPERM;
1120    
1121     usb_lock_device(dev);
1122     +
1123     + /* Reap operations are allowed even after disconnection */
1124     + switch (cmd) {
1125     + case USBDEVFS_REAPURB:
1126     + snoop(&dev->dev, "%s: REAPURB\n", __func__);
1127     + ret = proc_reapurb(ps, p);
1128     + goto done;
1129     +
1130     + case USBDEVFS_REAPURBNDELAY:
1131     + snoop(&dev->dev, "%s: REAPURBNDELAY\n", __func__);
1132     + ret = proc_reapurbnonblock(ps, p);
1133     + goto done;
1134     +
1135     +#ifdef CONFIG_COMPAT
1136     + case USBDEVFS_REAPURB32:
1137     + snoop(&dev->dev, "%s: REAPURB32\n", __func__);
1138     + ret = proc_reapurb_compat(ps, p);
1139     + goto done;
1140     +
1141     + case USBDEVFS_REAPURBNDELAY32:
1142     + snoop(&dev->dev, "%s: REAPURBNDELAY32\n", __func__);
1143     + ret = proc_reapurbnonblock_compat(ps, p);
1144     + goto done;
1145     +#endif
1146     + }
1147     +
1148     if (!connected(ps)) {
1149     usb_unlock_device(dev);
1150     return -ENODEV;
1151     @@ -2232,16 +2261,6 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
1152     inode->i_mtime = CURRENT_TIME;
1153     break;
1154    
1155     - case USBDEVFS_REAPURB32:
1156     - snoop(&dev->dev, "%s: REAPURB32\n", __func__);
1157     - ret = proc_reapurb_compat(ps, p);
1158     - break;
1159     -
1160     - case USBDEVFS_REAPURBNDELAY32:
1161     - snoop(&dev->dev, "%s: REAPURBNDELAY32\n", __func__);
1162     - ret = proc_reapurbnonblock_compat(ps, p);
1163     - break;
1164     -
1165     case USBDEVFS_IOCTL32:
1166     snoop(&dev->dev, "%s: IOCTL32\n", __func__);
1167     ret = proc_ioctl_compat(ps, ptr_to_compat(p));
1168     @@ -2253,16 +2272,6 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
1169     ret = proc_unlinkurb(ps, p);
1170     break;
1171    
1172     - case USBDEVFS_REAPURB:
1173     - snoop(&dev->dev, "%s: REAPURB\n", __func__);
1174     - ret = proc_reapurb(ps, p);
1175     - break;
1176     -
1177     - case USBDEVFS_REAPURBNDELAY:
1178     - snoop(&dev->dev, "%s: REAPURBNDELAY\n", __func__);
1179     - ret = proc_reapurbnonblock(ps, p);
1180     - break;
1181     -
1182     case USBDEVFS_DISCSIGNAL:
1183     snoop(&dev->dev, "%s: DISCSIGNAL\n", __func__);
1184     ret = proc_disconnectsignal(ps, p);
1185     @@ -2305,6 +2314,8 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
1186     ret = proc_free_streams(ps, p);
1187     break;
1188     }
1189     +
1190     + done:
1191     usb_unlock_device(dev);
1192     if (ret >= 0)
1193     inode->i_atime = CURRENT_TIME;
1194     diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
1195     index df38e7ef4976..bdc995da3420 100644
1196     --- a/drivers/usb/dwc3/ep0.c
1197     +++ b/drivers/usb/dwc3/ep0.c
1198     @@ -727,6 +727,10 @@ static int dwc3_ep0_std_request(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)
1199     dwc3_trace(trace_dwc3_ep0, "USB_REQ_SET_ISOCH_DELAY\n");
1200     ret = dwc3_ep0_set_isoch_delay(dwc, ctrl);
1201     break;
1202     + case USB_REQ_SET_INTERFACE:
1203     + dev_vdbg(dwc->dev, "USB_REQ_SET_INTERFACE\n");
1204     + dwc->start_config_issued = false;
1205     + /* Fall through */
1206     default:
1207     dwc3_trace(trace_dwc3_ep0, "Forwarding to gadget driver\n");
1208     ret = dwc3_ep0_delegate_req(dwc, ctrl);
1209     diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
1210     index 5cb3d7a10017..a67018eddf41 100644
1211     --- a/drivers/usb/host/xhci-mem.c
1212     +++ b/drivers/usb/host/xhci-mem.c
1213     @@ -1431,10 +1431,10 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
1214     /* Attempt to use the ring cache */
1215     if (virt_dev->num_rings_cached == 0)
1216     return -ENOMEM;
1217     + virt_dev->num_rings_cached--;
1218     virt_dev->eps[ep_index].new_ring =
1219     virt_dev->ring_cache[virt_dev->num_rings_cached];
1220     virt_dev->ring_cache[virt_dev->num_rings_cached] = NULL;
1221     - virt_dev->num_rings_cached--;
1222     xhci_reinit_cached_ring(xhci, virt_dev->eps[ep_index].new_ring,
1223     1, type);
1224     }
1225     diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c
1226     index 0241a3a0d63e..1e9bde4fe785 100644
1227     --- a/drivers/usb/musb/musb_virthub.c
1228     +++ b/drivers/usb/musb/musb_virthub.c
1229     @@ -273,9 +273,7 @@ static int musb_has_gadget(struct musb *musb)
1230     #ifdef CONFIG_USB_MUSB_HOST
1231     return 1;
1232     #else
1233     - if (musb->port_mode == MUSB_PORT_MODE_HOST)
1234     - return 1;
1235     - return musb->g.dev.driver != NULL;
1236     + return musb->port_mode == MUSB_PORT_MODE_HOST;
1237     #endif
1238     }
1239    
1240     diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
1241     index ffd739e31bfc..eac7ccaa3c85 100644
1242     --- a/drivers/usb/serial/cp210x.c
1243     +++ b/drivers/usb/serial/cp210x.c
1244     @@ -187,6 +187,7 @@ static const struct usb_device_id id_table[] = {
1245     { USB_DEVICE(0x1FB9, 0x0602) }, /* Lake Shore Model 648 Magnet Power Supply */
1246     { USB_DEVICE(0x1FB9, 0x0700) }, /* Lake Shore Model 737 VSM Controller */
1247     { USB_DEVICE(0x1FB9, 0x0701) }, /* Lake Shore Model 776 Hall Matrix */
1248     + { USB_DEVICE(0x2626, 0xEA60) }, /* Aruba Networks 7xxx USB Serial Console */
1249     { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */
1250     { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */
1251     { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */
1252     diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
1253     index efdcee15b520..c8c4e50ffee1 100644
1254     --- a/drivers/usb/serial/option.c
1255     +++ b/drivers/usb/serial/option.c
1256     @@ -1773,6 +1773,7 @@ static const struct usb_device_id option_ids[] = {
1257     { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x00, 0x00) },
1258     { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */
1259     { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */
1260     + { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) }, /* OLICARD300 - MT6225 */
1261     { USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) },
1262     { USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) },
1263     { } /* Terminating entry */
1264     diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
1265     index 19842370a07f..6fbfc8fc2f5d 100644
1266     --- a/drivers/usb/serial/usb-serial.c
1267     +++ b/drivers/usb/serial/usb-serial.c
1268     @@ -1290,6 +1290,7 @@ static void __exit usb_serial_exit(void)
1269     tty_unregister_driver(usb_serial_tty_driver);
1270     put_tty_driver(usb_serial_tty_driver);
1271     bus_unregister(&usb_serial_bus_type);
1272     + idr_destroy(&serial_minors);
1273     }
1274    
1275    
1276     diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
1277     index 3691b157516a..0c8868eceb4d 100644
1278     --- a/drivers/watchdog/omap_wdt.c
1279     +++ b/drivers/watchdog/omap_wdt.c
1280     @@ -132,6 +132,13 @@ static int omap_wdt_start(struct watchdog_device *wdog)
1281    
1282     pm_runtime_get_sync(wdev->dev);
1283    
1284     + /*
1285     + * Make sure the watchdog is disabled. This is unfortunately required
1286     + * because writing to various registers with the watchdog running has no
1287     + * effect.
1288     + */
1289     + omap_wdt_disable(wdev);
1290     +
1291     /* initialize prescaler */
1292     while (readl_relaxed(base + OMAP_WATCHDOG_WPS) & 0x01)
1293     cpu_relax();
1294     diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
1295     index 296482fc77a9..a2f6e9ae1a98 100644
1296     --- a/fs/9p/vfs_inode.c
1297     +++ b/fs/9p/vfs_inode.c
1298     @@ -540,8 +540,7 @@ static struct inode *v9fs_qid_iget(struct super_block *sb,
1299     unlock_new_inode(inode);
1300     return inode;
1301     error:
1302     - unlock_new_inode(inode);
1303     - iput(inode);
1304     + iget_failed(inode);
1305     return ERR_PTR(retval);
1306    
1307     }
1308     diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
1309     index 02b64f4e576a..092d20c643e5 100644
1310     --- a/fs/9p/vfs_inode_dotl.c
1311     +++ b/fs/9p/vfs_inode_dotl.c
1312     @@ -149,8 +149,7 @@ static struct inode *v9fs_qid_iget_dotl(struct super_block *sb,
1313     unlock_new_inode(inode);
1314     return inode;
1315     error:
1316     - unlock_new_inode(inode);
1317     - iput(inode);
1318     + iget_failed(inode);
1319     return ERR_PTR(retval);
1320    
1321     }
1322     diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c
1323     index 83d646bd2e4b..ed2de833dd18 100644
1324     --- a/fs/btrfs/inode-map.c
1325     +++ b/fs/btrfs/inode-map.c
1326     @@ -271,7 +271,7 @@ void btrfs_unpin_free_ino(struct btrfs_root *root)
1327     __btrfs_add_free_space(ctl, info->offset, count);
1328     free:
1329     rb_erase(&info->offset_index, rbroot);
1330     - kfree(info);
1331     + kmem_cache_free(btrfs_free_space_cachep, info);
1332     }
1333     }
1334    
1335     diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
1336     index 1cecf25fa14f..3d50f1ee51ba 100644
1337     --- a/fs/btrfs/ioctl.c
1338     +++ b/fs/btrfs/ioctl.c
1339     @@ -2959,7 +2959,7 @@ out_unlock:
1340     static long btrfs_ioctl_file_extent_same(struct file *file,
1341     struct btrfs_ioctl_same_args __user *argp)
1342     {
1343     - struct btrfs_ioctl_same_args *same;
1344     + struct btrfs_ioctl_same_args *same = NULL;
1345     struct btrfs_ioctl_same_extent_info *info;
1346     struct inode *src = file_inode(file);
1347     u64 off;
1348     @@ -2989,6 +2989,7 @@ static long btrfs_ioctl_file_extent_same(struct file *file,
1349    
1350     if (IS_ERR(same)) {
1351     ret = PTR_ERR(same);
1352     + same = NULL;
1353     goto out;
1354     }
1355    
1356     @@ -3059,6 +3060,7 @@ static long btrfs_ioctl_file_extent_same(struct file *file,
1357    
1358     out:
1359     mnt_drop_write_file(file);
1360     + kfree(same);
1361     return ret;
1362     }
1363    
1364     diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
1365     index 120824664d32..777f74370143 100644
1366     --- a/fs/ext4/inode.c
1367     +++ b/fs/ext4/inode.c
1368     @@ -1230,7 +1230,7 @@ static void ext4_da_page_release_reservation(struct page *page,
1369     unsigned int offset,
1370     unsigned int length)
1371     {
1372     - int to_release = 0;
1373     + int to_release = 0, contiguous_blks = 0;
1374     struct buffer_head *head, *bh;
1375     unsigned int curr_off = 0;
1376     struct inode *inode = page->mapping->host;
1377     @@ -1251,14 +1251,23 @@ static void ext4_da_page_release_reservation(struct page *page,
1378    
1379     if ((offset <= curr_off) && (buffer_delay(bh))) {
1380     to_release++;
1381     + contiguous_blks++;
1382     clear_buffer_delay(bh);
1383     + } else if (contiguous_blks) {
1384     + lblk = page->index <<
1385     + (PAGE_CACHE_SHIFT - inode->i_blkbits);
1386     + lblk += (curr_off >> inode->i_blkbits) -
1387     + contiguous_blks;
1388     + ext4_es_remove_extent(inode, lblk, contiguous_blks);
1389     + contiguous_blks = 0;
1390     }
1391     curr_off = next_off;
1392     } while ((bh = bh->b_this_page) != head);
1393    
1394     - if (to_release) {
1395     + if (contiguous_blks) {
1396     lblk = page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits);
1397     - ext4_es_remove_extent(inode, lblk, to_release);
1398     + lblk += (curr_off >> inode->i_blkbits) - contiguous_blks;
1399     + ext4_es_remove_extent(inode, lblk, contiguous_blks);
1400     }
1401    
1402     /* If we have released all the blocks belonging to a cluster, then we
1403     diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
1404     index dbfe15c2533c..99c8e38ffb7b 100644
1405     --- a/fs/ext4/mballoc.c
1406     +++ b/fs/ext4/mballoc.c
1407     @@ -4801,18 +4801,12 @@ do_more:
1408     /*
1409     * blocks being freed are metadata. these blocks shouldn't
1410     * be used until this transaction is committed
1411     + *
1412     + * We use __GFP_NOFAIL because ext4_free_blocks() is not allowed
1413     + * to fail.
1414     */
1415     - retry:
1416     - new_entry = kmem_cache_alloc(ext4_free_data_cachep, GFP_NOFS);
1417     - if (!new_entry) {
1418     - /*
1419     - * We use a retry loop because
1420     - * ext4_free_blocks() is not allowed to fail.
1421     - */
1422     - cond_resched();
1423     - congestion_wait(BLK_RW_ASYNC, HZ/50);
1424     - goto retry;
1425     - }
1426     + new_entry = kmem_cache_alloc(ext4_free_data_cachep,
1427     + GFP_NOFS|__GFP_NOFAIL);
1428     new_entry->efd_start_cluster = bit;
1429     new_entry->efd_group = block_group;
1430     new_entry->efd_count = count_clusters;
1431     diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c
1432     index a432634f2e6a..876b984f1a75 100644
1433     --- a/fs/ext4/migrate.c
1434     +++ b/fs/ext4/migrate.c
1435     @@ -620,6 +620,7 @@ int ext4_ind_migrate(struct inode *inode)
1436     struct ext4_inode_info *ei = EXT4_I(inode);
1437     struct ext4_extent *ex;
1438     unsigned int i, len;
1439     + ext4_lblk_t start, end;
1440     ext4_fsblk_t blk;
1441     handle_t *handle;
1442     int ret;
1443     @@ -633,6 +634,14 @@ int ext4_ind_migrate(struct inode *inode)
1444     EXT4_FEATURE_RO_COMPAT_BIGALLOC))
1445     return -EOPNOTSUPP;
1446    
1447     + /*
1448     + * In order to get correct extent info, force all delayed allocation
1449     + * blocks to be allocated, otherwise delayed allocation blocks may not
1450     + * be reflected and bypass the checks on extent header.
1451     + */
1452     + if (test_opt(inode->i_sb, DELALLOC))
1453     + ext4_alloc_da_blocks(inode);
1454     +
1455     handle = ext4_journal_start(inode, EXT4_HT_MIGRATE, 1);
1456     if (IS_ERR(handle))
1457     return PTR_ERR(handle);
1458     @@ -650,11 +659,13 @@ int ext4_ind_migrate(struct inode *inode)
1459     goto errout;
1460     }
1461     if (eh->eh_entries == 0)
1462     - blk = len = 0;
1463     + blk = len = start = end = 0;
1464     else {
1465     len = le16_to_cpu(ex->ee_len);
1466     blk = ext4_ext_pblock(ex);
1467     - if (len > EXT4_NDIR_BLOCKS) {
1468     + start = le32_to_cpu(ex->ee_block);
1469     + end = start + len - 1;
1470     + if (end >= EXT4_NDIR_BLOCKS) {
1471     ret = -EOPNOTSUPP;
1472     goto errout;
1473     }
1474     @@ -662,7 +673,7 @@ int ext4_ind_migrate(struct inode *inode)
1475    
1476     ext4_clear_inode_flag(inode, EXT4_INODE_EXTENTS);
1477     memset(ei->i_data, 0, sizeof(ei->i_data));
1478     - for (i=0; i < len; i++)
1479     + for (i = start; i <= end; i++)
1480     ei->i_data[i] = cpu_to_le32(blk++);
1481     ext4_mark_inode_dirty(handle, inode);
1482     errout:
1483     diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c
1484     index 8f4cbe7f4aa8..53853ca134e5 100644
1485     --- a/fs/nfs/nfs3xdr.c
1486     +++ b/fs/nfs/nfs3xdr.c
1487     @@ -1342,7 +1342,7 @@ static void nfs3_xdr_enc_setacl3args(struct rpc_rqst *req,
1488     if (args->npages != 0)
1489     xdr_write_pages(xdr, args->pages, 0, args->len);
1490     else
1491     - xdr_reserve_space(xdr, NFS_ACL_INLINE_BUFSIZE);
1492     + xdr_reserve_space(xdr, args->len);
1493    
1494     error = nfsacl_encode(xdr->buf, base, args->inode,
1495     (args->mask & NFS_ACL) ?
1496     diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
1497     index 93ef42245647..f6406e70ea4a 100644
1498     --- a/include/acpi/actypes.h
1499     +++ b/include/acpi/actypes.h
1500     @@ -573,6 +573,7 @@ typedef u64 acpi_integer;
1501     #define ACPI_NO_ACPI_ENABLE 0x10
1502     #define ACPI_NO_DEVICE_INIT 0x20
1503     #define ACPI_NO_OBJECT_INIT 0x40
1504     +#define ACPI_NO_FACS_INIT 0x80
1505    
1506     /*
1507     * Initialization state
1508     diff --git a/include/linux/libata.h b/include/linux/libata.h
1509     index b3a816f4c0c4..8f6a07441b85 100644
1510     --- a/include/linux/libata.h
1511     +++ b/include/linux/libata.h
1512     @@ -429,6 +429,7 @@ enum {
1513     ATA_HORKAGE_NO_NCQ_TRIM = (1 << 19), /* don't use queued TRIM */
1514     ATA_HORKAGE_NOLPM = (1 << 20), /* don't use LPM */
1515     ATA_HORKAGE_WD_BROKEN_LPM = (1 << 21), /* some WDs have broken LPM */
1516     + ATA_HORKAGE_NOTRIM = (1 << 24), /* don't use TRIM */
1517    
1518     /* DMA mask for user DMA control: User visible values; DO NOT
1519     renumber */
1520     diff --git a/include/linux/of.h b/include/linux/of.h
1521     index ce9f6a2b3532..4a6a489a7506 100644
1522     --- a/include/linux/of.h
1523     +++ b/include/linux/of.h
1524     @@ -593,7 +593,10 @@ static inline const char *of_prop_next_string(struct property *prop,
1525     #if defined(CONFIG_OF) && defined(CONFIG_NUMA)
1526     extern int of_node_to_nid(struct device_node *np);
1527     #else
1528     -static inline int of_node_to_nid(struct device_node *device) { return 0; }
1529     +static inline int of_node_to_nid(struct device_node *device)
1530     +{
1531     + return NUMA_NO_NODE;
1532     +}
1533     #endif
1534    
1535     static inline struct device_node *of_find_matching_node(
1536     diff --git a/include/scsi/scsi_devinfo.h b/include/scsi/scsi_devinfo.h
1537     index 183eaab7c380..96e3f56519e7 100644
1538     --- a/include/scsi/scsi_devinfo.h
1539     +++ b/include/scsi/scsi_devinfo.h
1540     @@ -36,5 +36,6 @@
1541     for sequential scan */
1542     #define BLIST_TRY_VPD_PAGES 0x10000000 /* Attempt to read VPD pages */
1543     #define BLIST_NO_RSOC 0x20000000 /* don't try to issue RSOC */
1544     +#define BLIST_MAX_1024 0x40000000 /* maximum 1024 sector cdb length */
1545    
1546     #endif
1547     diff --git a/include/uapi/linux/usbdevice_fs.h b/include/uapi/linux/usbdevice_fs.h
1548     index abe5f4bd4d82..019ba1e0799a 100644
1549     --- a/include/uapi/linux/usbdevice_fs.h
1550     +++ b/include/uapi/linux/usbdevice_fs.h
1551     @@ -128,11 +128,12 @@ struct usbdevfs_hub_portinfo {
1552     char port [127]; /* e.g. port 3 connects to device 27 */
1553     };
1554    
1555     -/* Device capability flags */
1556     +/* System and bus capability flags */
1557     #define USBDEVFS_CAP_ZERO_PACKET 0x01
1558     #define USBDEVFS_CAP_BULK_CONTINUATION 0x02
1559     #define USBDEVFS_CAP_NO_PACKET_SIZE_LIM 0x04
1560     #define USBDEVFS_CAP_BULK_SCATTER_GATHER 0x08
1561     +#define USBDEVFS_CAP_REAP_AFTER_DISCONNECT 0x10
1562    
1563     /* USBDEVFS_DISCONNECT_CLAIM flags & struct */
1564    
1565     diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
1566     index bf95fdad4d96..3b9f01ba363a 100644
1567     --- a/kernel/printk/printk.c
1568     +++ b/kernel/printk/printk.c
1569     @@ -487,11 +487,11 @@ static int check_syslog_permissions(int type, bool from_file)
1570     * already done the capabilities checks at open time.
1571     */
1572     if (from_file && type != SYSLOG_ACTION_OPEN)
1573     - return 0;
1574     + goto ok;
1575    
1576     if (syslog_action_restricted(type)) {
1577     if (capable(CAP_SYSLOG))
1578     - return 0;
1579     + goto ok;
1580     /*
1581     * For historical reasons, accept CAP_SYS_ADMIN too, with
1582     * a warning.
1583     @@ -501,10 +501,11 @@ static int check_syslog_permissions(int type, bool from_file)
1584     "CAP_SYS_ADMIN but no CAP_SYSLOG "
1585     "(deprecated).\n",
1586     current->comm, task_pid_nr(current));
1587     - return 0;
1588     + goto ok;
1589     }
1590     return -EPERM;
1591     }
1592     +ok:
1593     return security_syslog(type);
1594     }
1595    
1596     @@ -1266,10 +1267,6 @@ int do_syslog(int type, char __user *buf, int len, bool from_file)
1597     if (error)
1598     goto out;
1599    
1600     - error = security_syslog(type);
1601     - if (error)
1602     - return error;
1603     -
1604     switch (type) {
1605     case SYSLOG_ACTION_CLOSE: /* Close log */
1606     break;
1607     diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
1608     index 385391fb1d3b..5642436bf97e 100644
1609     --- a/kernel/trace/trace.h
1610     +++ b/kernel/trace/trace.h
1611     @@ -442,6 +442,7 @@ enum {
1612    
1613     TRACE_CONTROL_BIT,
1614    
1615     + TRACE_BRANCH_BIT,
1616     /*
1617     * Abuse of the trace_recursion.
1618     * As we need a way to maintain state if we are tracing the function
1619     diff --git a/kernel/trace/trace_branch.c b/kernel/trace/trace_branch.c
1620     index 697fb9bac8f0..60850b4fcb04 100644
1621     --- a/kernel/trace/trace_branch.c
1622     +++ b/kernel/trace/trace_branch.c
1623     @@ -37,9 +37,12 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect)
1624     struct trace_branch *entry;
1625     struct ring_buffer *buffer;
1626     unsigned long flags;
1627     - int cpu, pc;
1628     + int pc;
1629     const char *p;
1630    
1631     + if (current->trace_recursion & TRACE_BRANCH_BIT)
1632     + return;
1633     +
1634     /*
1635     * I would love to save just the ftrace_likely_data pointer, but
1636     * this code can also be used by modules. Ugly things can happen
1637     @@ -50,10 +53,10 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect)
1638     if (unlikely(!tr))
1639     return;
1640    
1641     - local_irq_save(flags);
1642     - cpu = raw_smp_processor_id();
1643     - data = per_cpu_ptr(tr->trace_buffer.data, cpu);
1644     - if (atomic_inc_return(&data->disabled) != 1)
1645     + raw_local_irq_save(flags);
1646     + current->trace_recursion |= TRACE_BRANCH_BIT;
1647     + data = this_cpu_ptr(tr->trace_buffer.data);
1648     + if (atomic_read(&data->disabled))
1649     goto out;
1650    
1651     pc = preempt_count();
1652     @@ -82,8 +85,8 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect)
1653     __buffer_unlock_commit(buffer, event);
1654    
1655     out:
1656     - atomic_dec(&data->disabled);
1657     - local_irq_restore(flags);
1658     + current->trace_recursion &= ~TRACE_BRANCH_BIT;
1659     + raw_local_irq_restore(flags);
1660     }
1661    
1662     static inline
1663     diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
1664     index 51afcb76d32b..357b1ddf088b 100644
1665     --- a/kernel/trace/trace_events_filter.c
1666     +++ b/kernel/trace/trace_events_filter.c
1667     @@ -1383,7 +1383,9 @@ static int check_preds(struct filter_parse_state *ps)
1668     continue;
1669     }
1670     n_normal_preds++;
1671     - WARN_ON_ONCE(cnt < 0);
1672     + /* all ops should have operands */
1673     + if (cnt < 0)
1674     + break;
1675     }
1676    
1677     if (cnt != 1 || !n_normal_preds || n_logical_preds >= n_normal_preds) {
1678     diff --git a/lib/bitmap.c b/lib/bitmap.c
1679     index b499ab6ada29..2ed91904e806 100644
1680     --- a/lib/bitmap.c
1681     +++ b/lib/bitmap.c
1682     @@ -610,12 +610,12 @@ static int __bitmap_parselist(const char *buf, unsigned int buflen,
1683     unsigned a, b;
1684     int c, old_c, totaldigits;
1685     const char __user __force *ubuf = (const char __user __force *)buf;
1686     - int exp_digit, in_range;
1687     + int at_start, in_range;
1688    
1689     totaldigits = c = 0;
1690     bitmap_zero(maskp, nmaskbits);
1691     do {
1692     - exp_digit = 1;
1693     + at_start = 1;
1694     in_range = 0;
1695     a = b = 0;
1696    
1697     @@ -644,11 +644,10 @@ static int __bitmap_parselist(const char *buf, unsigned int buflen,
1698     break;
1699    
1700     if (c == '-') {
1701     - if (exp_digit || in_range)
1702     + if (at_start || in_range)
1703     return -EINVAL;
1704     b = 0;
1705     in_range = 1;
1706     - exp_digit = 1;
1707     continue;
1708     }
1709    
1710     @@ -658,16 +657,18 @@ static int __bitmap_parselist(const char *buf, unsigned int buflen,
1711     b = b * 10 + (c - '0');
1712     if (!in_range)
1713     a = b;
1714     - exp_digit = 0;
1715     + at_start = 0;
1716     totaldigits++;
1717     }
1718     if (!(a <= b))
1719     return -EINVAL;
1720     if (b >= nmaskbits)
1721     return -ERANGE;
1722     - while (a <= b) {
1723     - set_bit(a, maskp);
1724     - a++;
1725     + if (!at_start) {
1726     + while (a <= b) {
1727     + set_bit(a, maskp);
1728     + a++;
1729     + }
1730     }
1731     } while (buflen && c == ',');
1732     return 0;
1733     diff --git a/net/9p/client.c b/net/9p/client.c
1734     index e86a9bea1d16..53fe98ee8a55 100644
1735     --- a/net/9p/client.c
1736     +++ b/net/9p/client.c
1737     @@ -850,7 +850,8 @@ static struct p9_req_t *p9_client_zc_rpc(struct p9_client *c, int8_t type,
1738     if (err < 0) {
1739     if (err == -EIO)
1740     c->status = Disconnected;
1741     - goto reterr;
1742     + if (err != -ERESTARTSYS)
1743     + goto reterr;
1744     }
1745     if (req->status == REQ_STATUS_ERROR) {
1746     p9_debug(P9_DEBUG_ERROR, "req_status error %d\n", req->t_err);
1747     diff --git a/net/can/af_can.c b/net/can/af_can.c
1748     index 9a3244941a5c..d6030d6949df 100644
1749     --- a/net/can/af_can.c
1750     +++ b/net/can/af_can.c
1751     @@ -313,12 +313,8 @@ int can_send(struct sk_buff *skb, int loop)
1752     return err;
1753     }
1754    
1755     - if (newskb) {
1756     - if (!(newskb->tstamp.tv64))
1757     - __net_timestamp(newskb);
1758     -
1759     + if (newskb)
1760     netif_rx_ni(newskb);
1761     - }
1762    
1763     /* update statistics */
1764     can_stats.tx_frames++;
1765     diff --git a/net/mac80211/main.c b/net/mac80211/main.c
1766     index 0de7c93bf62b..67943cb5df8a 100644
1767     --- a/net/mac80211/main.c
1768     +++ b/net/mac80211/main.c
1769     @@ -249,6 +249,7 @@ static void ieee80211_restart_work(struct work_struct *work)
1770     {
1771     struct ieee80211_local *local =
1772     container_of(work, struct ieee80211_local, restart_work);
1773     + struct ieee80211_sub_if_data *sdata;
1774    
1775     /* wait for scan work complete */
1776     flush_workqueue(local->workqueue);
1777     @@ -257,6 +258,8 @@ static void ieee80211_restart_work(struct work_struct *work)
1778     "%s called with hardware scan in progress\n", __func__);
1779    
1780     rtnl_lock();
1781     + list_for_each_entry(sdata, &local->interfaces, list)
1782     + flush_delayed_work(&sdata->dec_tailroom_needed_wk);
1783     ieee80211_scan_cancel(local);
1784     ieee80211_reconfig(local);
1785     rtnl_unlock();
1786     diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c
1787     index c5ee1a7c5e8a..4ada1a97a60b 100644
1788     --- a/security/integrity/evm/evm_main.c
1789     +++ b/security/integrity/evm/evm_main.c
1790     @@ -22,6 +22,7 @@
1791     #include <linux/xattr.h>
1792     #include <linux/integrity.h>
1793     #include <linux/evm.h>
1794     +#include <linux/magic.h>
1795     #include <crypto/hash.h>
1796     #include "evm.h"
1797    
1798     @@ -291,6 +292,17 @@ static int evm_protect_xattr(struct dentry *dentry, const char *xattr_name,
1799     iint = integrity_iint_find(dentry->d_inode);
1800     if (iint && (iint->flags & IMA_NEW_FILE))
1801     return 0;
1802     +
1803     + /* exception for pseudo filesystems */
1804     + if (dentry->d_inode->i_sb->s_magic == TMPFS_MAGIC
1805     + || dentry->d_inode->i_sb->s_magic == SYSFS_MAGIC)
1806     + return 0;
1807     +
1808     + integrity_audit_msg(AUDIT_INTEGRITY_METADATA,
1809     + dentry->d_inode, dentry->d_name.name,
1810     + "update_metadata",
1811     + integrity_status_msg[evm_status],
1812     + -EPERM, 0);
1813     }
1814     out:
1815     if (evm_status != INTEGRITY_PASS)
1816     diff --git a/security/keys/keyring.c b/security/keys/keyring.c
1817     index e72548b5897e..d33437007ad2 100644
1818     --- a/security/keys/keyring.c
1819     +++ b/security/keys/keyring.c
1820     @@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
1821     if (index_key->type == &key_type_keyring)
1822     up_write(&keyring_serialise_link_sem);
1823    
1824     - if (edit && !edit->dead_leaf) {
1825     - key_payload_reserve(keyring,
1826     - keyring->datalen - KEYQUOTA_LINK_BYTES);
1827     + if (edit) {
1828     + if (!edit->dead_leaf) {
1829     + key_payload_reserve(keyring,
1830     + keyring->datalen - KEYQUOTA_LINK_BYTES);
1831     + }
1832     assoc_array_cancel_edit(edit);
1833     }
1834     up_write(&keyring->sem);
1835     diff --git a/sound/soc/fsl/imx-wm8962.c b/sound/soc/fsl/imx-wm8962.c
1836     index 3a3d17ce6ba4..664452599497 100644
1837     --- a/sound/soc/fsl/imx-wm8962.c
1838     +++ b/sound/soc/fsl/imx-wm8962.c
1839     @@ -190,7 +190,7 @@ static int imx_wm8962_probe(struct platform_device *pdev)
1840     dev_err(&pdev->dev, "audmux internal port setup failed\n");
1841     return ret;
1842     }
1843     - imx_audmux_v2_configure_port(ext_port,
1844     + ret = imx_audmux_v2_configure_port(ext_port,
1845     IMX_AUDMUX_V2_PTCR_SYN,
1846     IMX_AUDMUX_V2_PDCR_RXDSEL(int_port));
1847     if (ret) {