Magellan Linux

Contents of /trunk/kernel-alx/patches-4.4/0126-4.4.27-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2862 - (show annotations) (download)
Mon Mar 27 13:49:07 2017 UTC (7 years, 1 month ago) by niro
File size: 30650 byte(s)
linux-4.4.27
1 diff --git a/Makefile b/Makefile
2 index a127b9ef9ebc..b6ee4ce561f8 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,6 +1,6 @@
6 VERSION = 4
7 PATCHLEVEL = 4
8 -SUBLEVEL = 26
9 +SUBLEVEL = 27
10 EXTRAVERSION =
11 NAME = Blurry Fish Butt
12
13 diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
14 index 1f9093e901da..3ad307ee6029 100644
15 --- a/block/cfq-iosched.c
16 +++ b/block/cfq-iosched.c
17 @@ -3003,7 +3003,6 @@ static struct request *cfq_check_fifo(struct cfq_queue *cfqq)
18 if (time_before(jiffies, rq->fifo_time))
19 rq = NULL;
20
21 - cfq_log_cfqq(cfqq->cfqd, cfqq, "fifo=%p", rq);
22 return rq;
23 }
24
25 @@ -3377,6 +3376,9 @@ static bool cfq_may_dispatch(struct cfq_data *cfqd, struct cfq_queue *cfqq)
26 {
27 unsigned int max_dispatch;
28
29 + if (cfq_cfqq_must_dispatch(cfqq))
30 + return true;
31 +
32 /*
33 * Drain async requests before we start sync IO
34 */
35 @@ -3468,15 +3470,20 @@ static bool cfq_dispatch_request(struct cfq_data *cfqd, struct cfq_queue *cfqq)
36
37 BUG_ON(RB_EMPTY_ROOT(&cfqq->sort_list));
38
39 + rq = cfq_check_fifo(cfqq);
40 + if (rq)
41 + cfq_mark_cfqq_must_dispatch(cfqq);
42 +
43 if (!cfq_may_dispatch(cfqd, cfqq))
44 return false;
45
46 /*
47 * follow expired path, else get first next available
48 */
49 - rq = cfq_check_fifo(cfqq);
50 if (!rq)
51 rq = cfqq->next_rq;
52 + else
53 + cfq_log_cfqq(cfqq->cfqd, cfqq, "fifo=%p", rq);
54
55 /*
56 * insert request into driver dispatch list
57 @@ -3944,7 +3951,7 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
58 * if the new request is sync, but the currently running queue is
59 * not, let the sync request have priority.
60 */
61 - if (rq_is_sync(rq) && !cfq_cfqq_sync(cfqq))
62 + if (rq_is_sync(rq) && !cfq_cfqq_sync(cfqq) && !cfq_cfqq_must_dispatch(cfqq))
63 return true;
64
65 if (new_cfqq->cfqg != cfqq->cfqg)
66 diff --git a/crypto/async_tx/async_pq.c b/crypto/async_tx/async_pq.c
67 index c0748bbd4c08..84f8d4d8b6bc 100644
68 --- a/crypto/async_tx/async_pq.c
69 +++ b/crypto/async_tx/async_pq.c
70 @@ -368,8 +368,6 @@ async_syndrome_val(struct page **blocks, unsigned int offset, int disks,
71
72 dma_set_unmap(tx, unmap);
73 async_tx_submit(chan, tx, submit);
74 -
75 - return tx;
76 } else {
77 struct page *p_src = P(blocks, disks);
78 struct page *q_src = Q(blocks, disks);
79 @@ -424,9 +422,11 @@ async_syndrome_val(struct page **blocks, unsigned int offset, int disks,
80 submit->cb_param = cb_param_orig;
81 submit->flags = flags_orig;
82 async_tx_sync_epilog(submit);
83 -
84 - return NULL;
85 + tx = NULL;
86 }
87 + dmaengine_unmap_put(unmap);
88 +
89 + return tx;
90 }
91 EXPORT_SYMBOL_GPL(async_syndrome_val);
92
93 diff --git a/crypto/ghash-generic.c b/crypto/ghash-generic.c
94 index bac70995e064..12ad3e3a84e3 100644
95 --- a/crypto/ghash-generic.c
96 +++ b/crypto/ghash-generic.c
97 @@ -14,24 +14,13 @@
98
99 #include <crypto/algapi.h>
100 #include <crypto/gf128mul.h>
101 +#include <crypto/ghash.h>
102 #include <crypto/internal/hash.h>
103 #include <linux/crypto.h>
104 #include <linux/init.h>
105 #include <linux/kernel.h>
106 #include <linux/module.h>
107
108 -#define GHASH_BLOCK_SIZE 16
109 -#define GHASH_DIGEST_SIZE 16
110 -
111 -struct ghash_ctx {
112 - struct gf128mul_4k *gf128;
113 -};
114 -
115 -struct ghash_desc_ctx {
116 - u8 buffer[GHASH_BLOCK_SIZE];
117 - u32 bytes;
118 -};
119 -
120 static int ghash_init(struct shash_desc *desc)
121 {
122 struct ghash_desc_ctx *dctx = shash_desc_ctx(desc);
123 diff --git a/drivers/base/dma-mapping.c b/drivers/base/dma-mapping.c
124 index d95c5971c225..a00f7b79202b 100644
125 --- a/drivers/base/dma-mapping.c
126 +++ b/drivers/base/dma-mapping.c
127 @@ -335,7 +335,7 @@ void dma_common_free_remap(void *cpu_addr, size_t size, unsigned long vm_flags)
128 return;
129 }
130
131 - unmap_kernel_range((unsigned long)cpu_addr, size);
132 + unmap_kernel_range((unsigned long)cpu_addr, PAGE_ALIGN(size));
133 vunmap(cpu_addr);
134 }
135 #endif
136 diff --git a/drivers/crypto/vmx/ghash.c b/drivers/crypto/vmx/ghash.c
137 index 2183a2e77641..9cb3a0b715e2 100644
138 --- a/drivers/crypto/vmx/ghash.c
139 +++ b/drivers/crypto/vmx/ghash.c
140 @@ -26,16 +26,13 @@
141 #include <linux/hardirq.h>
142 #include <asm/switch_to.h>
143 #include <crypto/aes.h>
144 +#include <crypto/ghash.h>
145 #include <crypto/scatterwalk.h>
146 #include <crypto/internal/hash.h>
147 #include <crypto/b128ops.h>
148
149 #define IN_INTERRUPT in_interrupt()
150
151 -#define GHASH_BLOCK_SIZE (16)
152 -#define GHASH_DIGEST_SIZE (16)
153 -#define GHASH_KEY_LEN (16)
154 -
155 void gcm_init_p8(u128 htable[16], const u64 Xi[2]);
156 void gcm_gmult_p8(u64 Xi[2], const u128 htable[16]);
157 void gcm_ghash_p8(u64 Xi[2], const u128 htable[16],
158 @@ -55,16 +52,11 @@ struct p8_ghash_desc_ctx {
159
160 static int p8_ghash_init_tfm(struct crypto_tfm *tfm)
161 {
162 - const char *alg;
163 + const char *alg = "ghash-generic";
164 struct crypto_shash *fallback;
165 struct crypto_shash *shash_tfm = __crypto_shash_cast(tfm);
166 struct p8_ghash_ctx *ctx = crypto_tfm_ctx(tfm);
167
168 - if (!(alg = crypto_tfm_alg_name(tfm))) {
169 - printk(KERN_ERR "Failed to get algorithm name.\n");
170 - return -ENOENT;
171 - }
172 -
173 fallback = crypto_alloc_shash(alg, 0, CRYPTO_ALG_NEED_FALLBACK);
174 if (IS_ERR(fallback)) {
175 printk(KERN_ERR
176 @@ -78,10 +70,18 @@ static int p8_ghash_init_tfm(struct crypto_tfm *tfm)
177 crypto_shash_set_flags(fallback,
178 crypto_shash_get_flags((struct crypto_shash
179 *) tfm));
180 - ctx->fallback = fallback;
181
182 - shash_tfm->descsize = sizeof(struct p8_ghash_desc_ctx)
183 - + crypto_shash_descsize(fallback);
184 + /* Check if the descsize defined in the algorithm is still enough. */
185 + if (shash_tfm->descsize < sizeof(struct p8_ghash_desc_ctx)
186 + + crypto_shash_descsize(fallback)) {
187 + printk(KERN_ERR
188 + "Desc size of the fallback implementation (%s) does not match the expected value: %lu vs %u\n",
189 + alg,
190 + shash_tfm->descsize - sizeof(struct p8_ghash_desc_ctx),
191 + crypto_shash_descsize(fallback));
192 + return -EINVAL;
193 + }
194 + ctx->fallback = fallback;
195
196 return 0;
197 }
198 @@ -113,7 +113,7 @@ static int p8_ghash_setkey(struct crypto_shash *tfm, const u8 *key,
199 {
200 struct p8_ghash_ctx *ctx = crypto_tfm_ctx(crypto_shash_tfm(tfm));
201
202 - if (keylen != GHASH_KEY_LEN)
203 + if (keylen != GHASH_BLOCK_SIZE)
204 return -EINVAL;
205
206 preempt_disable();
207 @@ -215,7 +215,8 @@ struct shash_alg p8_ghash_alg = {
208 .update = p8_ghash_update,
209 .final = p8_ghash_final,
210 .setkey = p8_ghash_setkey,
211 - .descsize = sizeof(struct p8_ghash_desc_ctx),
212 + .descsize = sizeof(struct p8_ghash_desc_ctx)
213 + + sizeof(struct ghash_desc_ctx),
214 .base = {
215 .cra_name = "ghash",
216 .cra_driver_name = "p8_ghash",
217 diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
218 index 2215bebe208e..979cc024bca7 100644
219 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
220 +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
221 @@ -10853,6 +10853,12 @@ static pci_ers_result_t i40e_pci_error_detected(struct pci_dev *pdev,
222
223 dev_info(&pdev->dev, "%s: error %d\n", __func__, error);
224
225 + if (!pf) {
226 + dev_info(&pdev->dev,
227 + "Cannot recover - error happened during device probe\n");
228 + return PCI_ERS_RESULT_DISCONNECT;
229 + }
230 +
231 /* shutdown all operations */
232 if (!test_bit(__I40E_SUSPENDED, &pf->state)) {
233 rtnl_lock();
234 diff --git a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
235 index deb5f78dcacc..71493d2af912 100644
236 --- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
237 +++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
238 @@ -2408,7 +2408,7 @@ static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si)
239 WL_BSS_INFO_MAX);
240 if (err) {
241 brcmf_err("Failed to get bss info (%d)\n", err);
242 - return;
243 + goto out_kfree;
244 }
245 si->filled |= BIT(NL80211_STA_INFO_BSS_PARAM);
246 si->bss_param.beacon_interval = le16_to_cpu(buf->bss_le.beacon_period);
247 @@ -2420,6 +2420,9 @@ static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si)
248 si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE;
249 if (capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)
250 si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
251 +
252 +out_kfree:
253 + kfree(buf);
254 }
255
256 static s32
257 diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
258 index 41f9a00e4f74..8db9f3a5844d 100644
259 --- a/drivers/scsi/arcmsr/arcmsr_hba.c
260 +++ b/drivers/scsi/arcmsr/arcmsr_hba.c
261 @@ -2297,15 +2297,23 @@ static int arcmsr_iop_message_xfer(struct AdapterControlBlock *acb,
262 }
263 case ARCMSR_MESSAGE_WRITE_WQBUFFER: {
264 unsigned char *ver_addr;
265 - int32_t user_len, cnt2end;
266 + uint32_t user_len;
267 + int32_t cnt2end;
268 uint8_t *pQbuffer, *ptmpuserbuffer;
269 +
270 + user_len = pcmdmessagefld->cmdmessage.Length;
271 + if (user_len > ARCMSR_API_DATA_BUFLEN) {
272 + retvalue = ARCMSR_MESSAGE_FAIL;
273 + goto message_out;
274 + }
275 +
276 ver_addr = kmalloc(ARCMSR_API_DATA_BUFLEN, GFP_ATOMIC);
277 if (!ver_addr) {
278 retvalue = ARCMSR_MESSAGE_FAIL;
279 goto message_out;
280 }
281 ptmpuserbuffer = ver_addr;
282 - user_len = pcmdmessagefld->cmdmessage.Length;
283 +
284 memcpy(ptmpuserbuffer,
285 pcmdmessagefld->messagedatabuffer, user_len);
286 spin_lock_irqsave(&acb->wqbuffer_lock, flags);
287 diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
288 index 6aa317c303e2..1f9f9e5af207 100644
289 --- a/drivers/scsi/ibmvscsi/ibmvfc.c
290 +++ b/drivers/scsi/ibmvscsi/ibmvfc.c
291 @@ -717,7 +717,6 @@ static int ibmvfc_reset_crq(struct ibmvfc_host *vhost)
292 spin_lock_irqsave(vhost->host->host_lock, flags);
293 vhost->state = IBMVFC_NO_CRQ;
294 vhost->logged_in = 0;
295 - ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_NONE);
296
297 /* Clean out the queue */
298 memset(crq->msgs, 0, PAGE_SIZE);
299 diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
300 index a5d319e4aae6..8435c3f204c1 100644
301 --- a/drivers/tty/serial/8250/8250_dw.c
302 +++ b/drivers/tty/serial/8250/8250_dw.c
303 @@ -440,7 +440,7 @@ static int dw8250_probe(struct platform_device *pdev)
304 }
305
306 data->pclk = devm_clk_get(&pdev->dev, "apb_pclk");
307 - if (IS_ERR(data->clk) && PTR_ERR(data->clk) == -EPROBE_DEFER) {
308 + if (IS_ERR(data->pclk) && PTR_ERR(data->pclk) == -EPROBE_DEFER) {
309 err = -EPROBE_DEFER;
310 goto err_clk;
311 }
312 diff --git a/fs/attr.c b/fs/attr.c
313 index 6530ced19697..d62f674a605f 100644
314 --- a/fs/attr.c
315 +++ b/fs/attr.c
316 @@ -202,6 +202,21 @@ int notify_change(struct dentry * dentry, struct iattr * attr, struct inode **de
317 return -EPERM;
318 }
319
320 + /*
321 + * If utimes(2) and friends are called with times == NULL (or both
322 + * times are UTIME_NOW), then we need to check for write permission
323 + */
324 + if (ia_valid & ATTR_TOUCH) {
325 + if (IS_IMMUTABLE(inode))
326 + return -EPERM;
327 +
328 + if (!inode_owner_or_capable(inode)) {
329 + error = inode_permission(inode, MAY_WRITE);
330 + if (error)
331 + return error;
332 + }
333 + }
334 +
335 if ((ia_valid & ATTR_MODE)) {
336 umode_t amode = attr->ia_mode;
337 /* Flag setting protected by i_mutex */
338 diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
339 index c473c42d7d6c..bae05c5c75ba 100644
340 --- a/fs/btrfs/compression.c
341 +++ b/fs/btrfs/compression.c
342 @@ -694,7 +694,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
343 ret = btrfs_map_bio(root, READ, comp_bio,
344 mirror_num, 0);
345 if (ret) {
346 - bio->bi_error = ret;
347 + comp_bio->bi_error = ret;
348 bio_endio(comp_bio);
349 }
350
351 @@ -723,7 +723,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
352
353 ret = btrfs_map_bio(root, READ, comp_bio, mirror_num, 0);
354 if (ret) {
355 - bio->bi_error = ret;
356 + comp_bio->bi_error = ret;
357 bio_endio(comp_bio);
358 }
359
360 diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
361 index 3a37bd3f9637..9d7a4a714907 100644
362 --- a/fs/dlm/lowcomms.c
363 +++ b/fs/dlm/lowcomms.c
364 @@ -1607,16 +1607,12 @@ void dlm_lowcomms_stop(void)
365 mutex_lock(&connections_lock);
366 dlm_allow_conn = 0;
367 foreach_conn(stop_conn);
368 + clean_writequeues();
369 + foreach_conn(free_conn);
370 mutex_unlock(&connections_lock);
371
372 work_stop();
373
374 - mutex_lock(&connections_lock);
375 - clean_writequeues();
376 -
377 - foreach_conn(free_conn);
378 -
379 - mutex_unlock(&connections_lock);
380 kmem_cache_destroy(con_cache);
381 }
382
383 diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
384 index 8eac7d586997..9da42ace762a 100644
385 --- a/fs/ext4/extents.c
386 +++ b/fs/ext4/extents.c
387 @@ -5738,6 +5738,9 @@ int ext4_insert_range(struct inode *inode, loff_t offset, loff_t len)
388 up_write(&EXT4_I(inode)->i_data_sem);
389 goto out_stop;
390 }
391 + } else {
392 + ext4_ext_drop_refs(path);
393 + kfree(path);
394 }
395
396 ret = ext4_es_remove_extent(inode, offset_lblk,
397 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
398 index 28702932a908..c71d2941a45b 100644
399 --- a/fs/ext4/inode.c
400 +++ b/fs/ext4/inode.c
401 @@ -3645,7 +3645,7 @@ int ext4_update_disksize_before_punch(struct inode *inode, loff_t offset,
402 }
403
404 /*
405 - * ext4_punch_hole: punches a hole in a file by releaseing the blocks
406 + * ext4_punch_hole: punches a hole in a file by releasing the blocks
407 * associated with the given offset and length
408 *
409 * @inode: File inode
410 @@ -3674,7 +3674,7 @@ int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length)
411 * Write out all dirty pages to avoid race conditions
412 * Then release them.
413 */
414 - if (mapping->nrpages && mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) {
415 + if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) {
416 ret = filemap_write_and_wait_range(mapping, offset,
417 offset + length - 1);
418 if (ret)
419 @@ -4549,14 +4549,14 @@ static int ext4_do_update_inode(handle_t *handle,
420 * Fix up interoperability with old kernels. Otherwise, old inodes get
421 * re-used with the upper 16 bits of the uid/gid intact
422 */
423 - if (!ei->i_dtime) {
424 + if (ei->i_dtime && list_empty(&ei->i_orphan)) {
425 + raw_inode->i_uid_high = 0;
426 + raw_inode->i_gid_high = 0;
427 + } else {
428 raw_inode->i_uid_high =
429 cpu_to_le16(high_16_bits(i_uid));
430 raw_inode->i_gid_high =
431 cpu_to_le16(high_16_bits(i_gid));
432 - } else {
433 - raw_inode->i_uid_high = 0;
434 - raw_inode->i_gid_high = 0;
435 }
436 } else {
437 raw_inode->i_uid_low = cpu_to_le16(fs_high2lowuid(i_uid));
438 diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
439 index 796ff0eafd3c..7861d801b048 100644
440 --- a/fs/ext4/move_extent.c
441 +++ b/fs/ext4/move_extent.c
442 @@ -598,6 +598,13 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp, __u64 orig_blk,
443 return -EOPNOTSUPP;
444 }
445
446 + if (ext4_encrypted_inode(orig_inode) ||
447 + ext4_encrypted_inode(donor_inode)) {
448 + ext4_msg(orig_inode->i_sb, KERN_ERR,
449 + "Online defrag not supported for encrypted files");
450 + return -EOPNOTSUPP;
451 + }
452 +
453 /* Protect orig and donor inodes against a truncate */
454 lock_two_nondirectories(orig_inode, donor_inode);
455
456 diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
457 index 38eb0c8e43b9..573b4cbb0cb9 100644
458 --- a/fs/ext4/namei.c
459 +++ b/fs/ext4/namei.c
460 @@ -2017,33 +2017,31 @@ static int make_indexed_dir(handle_t *handle, struct ext4_filename *fname,
461 frame->entries = entries;
462 frame->at = entries;
463 frame->bh = bh;
464 - bh = bh2;
465
466 retval = ext4_handle_dirty_dx_node(handle, dir, frame->bh);
467 if (retval)
468 goto out_frames;
469 - retval = ext4_handle_dirty_dirent_node(handle, dir, bh);
470 + retval = ext4_handle_dirty_dirent_node(handle, dir, bh2);
471 if (retval)
472 goto out_frames;
473
474 - de = do_split(handle,dir, &bh, frame, &fname->hinfo);
475 + de = do_split(handle,dir, &bh2, frame, &fname->hinfo);
476 if (IS_ERR(de)) {
477 retval = PTR_ERR(de);
478 goto out_frames;
479 }
480 - dx_release(frames);
481
482 - retval = add_dirent_to_buf(handle, fname, dir, inode, de, bh);
483 - brelse(bh);
484 - return retval;
485 + retval = add_dirent_to_buf(handle, fname, dir, inode, de, bh2);
486 out_frames:
487 /*
488 * Even if the block split failed, we have to properly write
489 * out all the changes we did so far. Otherwise we can end up
490 * with corrupted filesystem.
491 */
492 - ext4_mark_inode_dirty(handle, dir);
493 + if (retval)
494 + ext4_mark_inode_dirty(handle, dir);
495 dx_release(frames);
496 + brelse(bh2);
497 return retval;
498 }
499
500 diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
501 index 5e2e08712d3b..4b5f2c4e69c8 100644
502 --- a/fs/fuse/dir.c
503 +++ b/fs/fuse/dir.c
504 @@ -1697,14 +1697,46 @@ error:
505 static int fuse_setattr(struct dentry *entry, struct iattr *attr)
506 {
507 struct inode *inode = d_inode(entry);
508 + struct file *file = (attr->ia_valid & ATTR_FILE) ? attr->ia_file : NULL;
509 + int ret;
510
511 if (!fuse_allow_current_process(get_fuse_conn(inode)))
512 return -EACCES;
513
514 - if (attr->ia_valid & ATTR_FILE)
515 - return fuse_do_setattr(inode, attr, attr->ia_file);
516 - else
517 - return fuse_do_setattr(inode, attr, NULL);
518 + if (attr->ia_valid & (ATTR_KILL_SUID | ATTR_KILL_SGID)) {
519 + int kill;
520 +
521 + attr->ia_valid &= ~(ATTR_KILL_SUID | ATTR_KILL_SGID |
522 + ATTR_MODE);
523 + /*
524 + * ia_mode calculation may have used stale i_mode. Refresh and
525 + * recalculate.
526 + */
527 + ret = fuse_do_getattr(inode, NULL, file);
528 + if (ret)
529 + return ret;
530 +
531 + attr->ia_mode = inode->i_mode;
532 + kill = should_remove_suid(entry);
533 + if (kill & ATTR_KILL_SUID) {
534 + attr->ia_valid |= ATTR_MODE;
535 + attr->ia_mode &= ~S_ISUID;
536 + }
537 + if (kill & ATTR_KILL_SGID) {
538 + attr->ia_valid |= ATTR_MODE;
539 + attr->ia_mode &= ~S_ISGID;
540 + }
541 + }
542 + if (!attr->ia_valid)
543 + return 0;
544 +
545 + ret = fuse_do_setattr(inode, attr, file);
546 + if (!ret) {
547 + /* Directory mode changed, may need to revalidate access */
548 + if (d_is_dir(entry) && (attr->ia_valid & ATTR_MODE))
549 + fuse_invalidate_entry_cache(entry);
550 + }
551 + return ret;
552 }
553
554 static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry,
555 @@ -1797,6 +1829,23 @@ static ssize_t fuse_getxattr(struct dentry *entry, const char *name,
556 return ret;
557 }
558
559 +static int fuse_verify_xattr_list(char *list, size_t size)
560 +{
561 + size_t origsize = size;
562 +
563 + while (size) {
564 + size_t thislen = strnlen(list, size);
565 +
566 + if (!thislen || thislen == size)
567 + return -EIO;
568 +
569 + size -= thislen + 1;
570 + list += thislen + 1;
571 + }
572 +
573 + return origsize;
574 +}
575 +
576 static ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size)
577 {
578 struct inode *inode = d_inode(entry);
579 @@ -1832,6 +1881,8 @@ static ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size)
580 ret = fuse_simple_request(fc, &args);
581 if (!ret && !size)
582 ret = outarg.size;
583 + if (ret > 0 && size)
584 + ret = fuse_verify_xattr_list(list, ret);
585 if (ret == -ENOSYS) {
586 fc->no_listxattr = 1;
587 ret = -EOPNOTSUPP;
588 diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c
589 index 96a1bcf33db4..8f5ccdf81c25 100644
590 --- a/fs/reiserfs/file.c
591 +++ b/fs/reiserfs/file.c
592 @@ -260,10 +260,10 @@ const struct file_operations reiserfs_file_operations = {
593
594 const struct inode_operations reiserfs_file_inode_operations = {
595 .setattr = reiserfs_setattr,
596 - .setxattr = reiserfs_setxattr,
597 - .getxattr = reiserfs_getxattr,
598 + .setxattr = generic_setxattr,
599 + .getxattr = generic_getxattr,
600 .listxattr = reiserfs_listxattr,
601 - .removexattr = reiserfs_removexattr,
602 + .removexattr = generic_removexattr,
603 .permission = reiserfs_permission,
604 .get_acl = reiserfs_get_acl,
605 .set_acl = reiserfs_set_acl,
606 diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
607 index 47f96988fdd4..3ebc70167e41 100644
608 --- a/fs/reiserfs/namei.c
609 +++ b/fs/reiserfs/namei.c
610 @@ -1649,10 +1649,10 @@ const struct inode_operations reiserfs_dir_inode_operations = {
611 .mknod = reiserfs_mknod,
612 .rename = reiserfs_rename,
613 .setattr = reiserfs_setattr,
614 - .setxattr = reiserfs_setxattr,
615 - .getxattr = reiserfs_getxattr,
616 + .setxattr = generic_setxattr,
617 + .getxattr = generic_getxattr,
618 .listxattr = reiserfs_listxattr,
619 - .removexattr = reiserfs_removexattr,
620 + .removexattr = generic_removexattr,
621 .permission = reiserfs_permission,
622 .get_acl = reiserfs_get_acl,
623 .set_acl = reiserfs_set_acl,
624 @@ -1667,10 +1667,10 @@ const struct inode_operations reiserfs_symlink_inode_operations = {
625 .follow_link = page_follow_link_light,
626 .put_link = page_put_link,
627 .setattr = reiserfs_setattr,
628 - .setxattr = reiserfs_setxattr,
629 - .getxattr = reiserfs_getxattr,
630 + .setxattr = generic_setxattr,
631 + .getxattr = generic_getxattr,
632 .listxattr = reiserfs_listxattr,
633 - .removexattr = reiserfs_removexattr,
634 + .removexattr = generic_removexattr,
635 .permission = reiserfs_permission,
636 };
637
638 @@ -1679,10 +1679,10 @@ const struct inode_operations reiserfs_symlink_inode_operations = {
639 */
640 const struct inode_operations reiserfs_special_inode_operations = {
641 .setattr = reiserfs_setattr,
642 - .setxattr = reiserfs_setxattr,
643 - .getxattr = reiserfs_getxattr,
644 + .setxattr = generic_setxattr,
645 + .getxattr = generic_getxattr,
646 .listxattr = reiserfs_listxattr,
647 - .removexattr = reiserfs_removexattr,
648 + .removexattr = generic_removexattr,
649 .permission = reiserfs_permission,
650 .get_acl = reiserfs_get_acl,
651 .set_acl = reiserfs_set_acl,
652 diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
653 index 4a62fe8cc3bf..f9f3be50081a 100644
654 --- a/fs/reiserfs/super.c
655 +++ b/fs/reiserfs/super.c
656 @@ -190,7 +190,15 @@ static int remove_save_link_only(struct super_block *s,
657 static int reiserfs_quota_on_mount(struct super_block *, int);
658 #endif
659
660 -/* look for uncompleted unlinks and truncates and complete them */
661 +/*
662 + * Look for uncompleted unlinks and truncates and complete them
663 + *
664 + * Called with superblock write locked. If quotas are enabled, we have to
665 + * release/retake lest we call dquot_quota_on_mount(), proceed to
666 + * schedule_on_each_cpu() in invalidate_bdev() and deadlock waiting for the per
667 + * cpu worklets to complete flush_async_commits() that in turn wait for the
668 + * superblock write lock.
669 + */
670 static int finish_unfinished(struct super_block *s)
671 {
672 INITIALIZE_PATH(path);
673 @@ -237,7 +245,9 @@ static int finish_unfinished(struct super_block *s)
674 quota_enabled[i] = 0;
675 continue;
676 }
677 + reiserfs_write_unlock(s);
678 ret = reiserfs_quota_on_mount(s, i);
679 + reiserfs_write_lock(s);
680 if (ret < 0)
681 reiserfs_warning(s, "reiserfs-2500",
682 "cannot turn on journaled "
683 diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
684 index 66b26fdfff8d..a8dbc93e45eb 100644
685 --- a/fs/reiserfs/xattr.c
686 +++ b/fs/reiserfs/xattr.c
687 @@ -763,60 +763,6 @@ find_xattr_handler_prefix(const struct xattr_handler **handlers,
688 return xah;
689 }
690
691 -
692 -/*
693 - * Inode operation getxattr()
694 - */
695 -ssize_t
696 -reiserfs_getxattr(struct dentry * dentry, const char *name, void *buffer,
697 - size_t size)
698 -{
699 - const struct xattr_handler *handler;
700 -
701 - handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name);
702 -
703 - if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1)
704 - return -EOPNOTSUPP;
705 -
706 - return handler->get(handler, dentry, name, buffer, size);
707 -}
708 -
709 -/*
710 - * Inode operation setxattr()
711 - *
712 - * d_inode(dentry)->i_mutex down
713 - */
714 -int
715 -reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value,
716 - size_t size, int flags)
717 -{
718 - const struct xattr_handler *handler;
719 -
720 - handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name);
721 -
722 - if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1)
723 - return -EOPNOTSUPP;
724 -
725 - return handler->set(handler, dentry, name, value, size, flags);
726 -}
727 -
728 -/*
729 - * Inode operation removexattr()
730 - *
731 - * d_inode(dentry)->i_mutex down
732 - */
733 -int reiserfs_removexattr(struct dentry *dentry, const char *name)
734 -{
735 - const struct xattr_handler *handler;
736 -
737 - handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name);
738 -
739 - if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1)
740 - return -EOPNOTSUPP;
741 -
742 - return handler->set(handler, dentry, name, NULL, 0, XATTR_REPLACE);
743 -}
744 -
745 struct listxattr_buf {
746 struct dir_context ctx;
747 size_t size;
748 diff --git a/fs/reiserfs/xattr.h b/fs/reiserfs/xattr.h
749 index 15dde6262c00..613ff5aef94e 100644
750 --- a/fs/reiserfs/xattr.h
751 +++ b/fs/reiserfs/xattr.h
752 @@ -2,6 +2,7 @@
753 #include <linux/init.h>
754 #include <linux/list.h>
755 #include <linux/rwsem.h>
756 +#include <linux/xattr.h>
757
758 struct inode;
759 struct dentry;
760 @@ -18,12 +19,7 @@ int reiserfs_permission(struct inode *inode, int mask);
761
762 #ifdef CONFIG_REISERFS_FS_XATTR
763 #define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir)
764 -ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name,
765 - void *buffer, size_t size);
766 -int reiserfs_setxattr(struct dentry *dentry, const char *name,
767 - const void *value, size_t size, int flags);
768 ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
769 -int reiserfs_removexattr(struct dentry *dentry, const char *name);
770
771 int reiserfs_xattr_get(struct inode *, const char *, void *, size_t);
772 int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int);
773 @@ -92,10 +88,7 @@ static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
774
775 #else
776
777 -#define reiserfs_getxattr NULL
778 -#define reiserfs_setxattr NULL
779 #define reiserfs_listxattr NULL
780 -#define reiserfs_removexattr NULL
781
782 static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
783 {
784 diff --git a/fs/reiserfs/xattr_security.c b/fs/reiserfs/xattr_security.c
785 index ac659af431ae..60de069225ba 100644
786 --- a/fs/reiserfs/xattr_security.c
787 +++ b/fs/reiserfs/xattr_security.c
788 @@ -12,26 +12,24 @@ static int
789 security_get(const struct xattr_handler *handler, struct dentry *dentry,
790 const char *name, void *buffer, size_t size)
791 {
792 - if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX))
793 - return -EINVAL;
794 -
795 if (IS_PRIVATE(d_inode(dentry)))
796 return -EPERM;
797
798 - return reiserfs_xattr_get(d_inode(dentry), name, buffer, size);
799 + return reiserfs_xattr_get(d_inode(dentry),
800 + xattr_full_name(handler, name),
801 + buffer, size);
802 }
803
804 static int
805 security_set(const struct xattr_handler *handler, struct dentry *dentry,
806 const char *name, const void *buffer, size_t size, int flags)
807 {
808 - if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX))
809 - return -EINVAL;
810 -
811 if (IS_PRIVATE(d_inode(dentry)))
812 return -EPERM;
813
814 - return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags);
815 + return reiserfs_xattr_set(d_inode(dentry),
816 + xattr_full_name(handler, name),
817 + buffer, size, flags);
818 }
819
820 static size_t security_list(const struct xattr_handler *handler,
821 diff --git a/fs/reiserfs/xattr_trusted.c b/fs/reiserfs/xattr_trusted.c
822 index a338adf1b8b4..ebba1ebf28ad 100644
823 --- a/fs/reiserfs/xattr_trusted.c
824 +++ b/fs/reiserfs/xattr_trusted.c
825 @@ -11,26 +11,24 @@ static int
826 trusted_get(const struct xattr_handler *handler, struct dentry *dentry,
827 const char *name, void *buffer, size_t size)
828 {
829 - if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
830 - return -EINVAL;
831 -
832 if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry)))
833 return -EPERM;
834
835 - return reiserfs_xattr_get(d_inode(dentry), name, buffer, size);
836 + return reiserfs_xattr_get(d_inode(dentry),
837 + xattr_full_name(handler, name),
838 + buffer, size);
839 }
840
841 static int
842 trusted_set(const struct xattr_handler *handler, struct dentry *dentry,
843 const char *name, const void *buffer, size_t size, int flags)
844 {
845 - if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
846 - return -EINVAL;
847 -
848 if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry)))
849 return -EPERM;
850
851 - return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags);
852 + return reiserfs_xattr_set(d_inode(dentry),
853 + xattr_full_name(handler, name),
854 + buffer, size, flags);
855 }
856
857 static size_t trusted_list(const struct xattr_handler *handler,
858 diff --git a/fs/reiserfs/xattr_user.c b/fs/reiserfs/xattr_user.c
859 index 39c9667191c5..6ac8a8c8bd9c 100644
860 --- a/fs/reiserfs/xattr_user.c
861 +++ b/fs/reiserfs/xattr_user.c
862 @@ -10,24 +10,22 @@ static int
863 user_get(const struct xattr_handler *handler, struct dentry *dentry,
864 const char *name, void *buffer, size_t size)
865 {
866 -
867 - if (strlen(name) < sizeof(XATTR_USER_PREFIX))
868 - return -EINVAL;
869 if (!reiserfs_xattrs_user(dentry->d_sb))
870 return -EOPNOTSUPP;
871 - return reiserfs_xattr_get(d_inode(dentry), name, buffer, size);
872 + return reiserfs_xattr_get(d_inode(dentry),
873 + xattr_full_name(handler, name),
874 + buffer, size);
875 }
876
877 static int
878 user_set(const struct xattr_handler *handler, struct dentry *dentry,
879 const char *name, const void *buffer, size_t size, int flags)
880 {
881 - if (strlen(name) < sizeof(XATTR_USER_PREFIX))
882 - return -EINVAL;
883 -
884 if (!reiserfs_xattrs_user(dentry->d_sb))
885 return -EOPNOTSUPP;
886 - return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags);
887 + return reiserfs_xattr_set(d_inode(dentry),
888 + xattr_full_name(handler, name),
889 + buffer, size, flags);
890 }
891
892 static size_t user_list(const struct xattr_handler *handler,
893 diff --git a/fs/utimes.c b/fs/utimes.c
894 index aa138d64560a..cb771c30d102 100644
895 --- a/fs/utimes.c
896 +++ b/fs/utimes.c
897 @@ -87,20 +87,7 @@ static int utimes_common(struct path *path, struct timespec *times)
898 */
899 newattrs.ia_valid |= ATTR_TIMES_SET;
900 } else {
901 - /*
902 - * If times is NULL (or both times are UTIME_NOW),
903 - * then we need to check permissions, because
904 - * inode_change_ok() won't do it.
905 - */
906 - error = -EACCES;
907 - if (IS_IMMUTABLE(inode))
908 - goto mnt_drop_write_and_out;
909 -
910 - if (!inode_owner_or_capable(inode)) {
911 - error = inode_permission(inode, MAY_WRITE);
912 - if (error)
913 - goto mnt_drop_write_and_out;
914 - }
915 + newattrs.ia_valid |= ATTR_TOUCH;
916 }
917 retry_deleg:
918 mutex_lock(&inode->i_mutex);
919 @@ -112,7 +99,6 @@ retry_deleg:
920 goto retry_deleg;
921 }
922
923 -mnt_drop_write_and_out:
924 mnt_drop_write(path->mnt);
925 out:
926 return error;
927 diff --git a/include/crypto/ghash.h b/include/crypto/ghash.h
928 new file mode 100644
929 index 000000000000..2a61c9bbab8f
930 --- /dev/null
931 +++ b/include/crypto/ghash.h
932 @@ -0,0 +1,23 @@
933 +/*
934 + * Common values for GHASH algorithms
935 + */
936 +
937 +#ifndef __CRYPTO_GHASH_H__
938 +#define __CRYPTO_GHASH_H__
939 +
940 +#include <linux/types.h>
941 +#include <crypto/gf128mul.h>
942 +
943 +#define GHASH_BLOCK_SIZE 16
944 +#define GHASH_DIGEST_SIZE 16
945 +
946 +struct ghash_ctx {
947 + struct gf128mul_4k *gf128;
948 +};
949 +
950 +struct ghash_desc_ctx {
951 + u8 buffer[GHASH_BLOCK_SIZE];
952 + u32 bytes;
953 +};
954 +
955 +#endif
956 diff --git a/include/linux/fs.h b/include/linux/fs.h
957 index 0166582c4d78..e1a123760dbf 100644
958 --- a/include/linux/fs.h
959 +++ b/include/linux/fs.h
960 @@ -226,6 +226,7 @@ typedef void (dax_iodone_t)(struct buffer_head *bh_map, int uptodate);
961 #define ATTR_KILL_PRIV (1 << 14)
962 #define ATTR_OPEN (1 << 15) /* Truncating from open(O_TRUNC) */
963 #define ATTR_TIMES_SET (1 << 16)
964 +#define ATTR_TOUCH (1 << 17)
965
966 /*
967 * Whiteout is represented by a char device. The following constants define the
968 diff --git a/sound/soc/intel/atom/sst/sst_pvt.c b/sound/soc/intel/atom/sst/sst_pvt.c
969 index adb32fefd693..b1e6b8f34a6a 100644
970 --- a/sound/soc/intel/atom/sst/sst_pvt.c
971 +++ b/sound/soc/intel/atom/sst/sst_pvt.c
972 @@ -279,17 +279,15 @@ int sst_prepare_and_post_msg(struct intel_sst_drv *sst,
973
974 if (response) {
975 ret = sst_wait_timeout(sst, block);
976 - if (ret < 0) {
977 + if (ret < 0)
978 goto out;
979 - } else if(block->data) {
980 - if (!data)
981 - goto out;
982 - *data = kzalloc(block->size, GFP_KERNEL);
983 - if (!(*data)) {
984 +
985 + if (data && block->data) {
986 + *data = kmemdup(block->data, block->size, GFP_KERNEL);
987 + if (!*data) {
988 ret = -ENOMEM;
989 goto out;
990 - } else
991 - memcpy(data, (void *) block->data, block->size);
992 + }
993 }
994 }
995 out: