Gentoo Archives: gentoo-commits

From: Alice Ferrazzi <alicef@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.10 commit in: /
Date: Thu, 27 Apr 2017 09:42:45
Message-Id: 1493286125.ea4709ae5b6d7054a381c8c5ee5db3980e0e543f.alicef@gentoo
1 commit: ea4709ae5b6d7054a381c8c5ee5db3980e0e543f
2 Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
3 AuthorDate: Thu Apr 27 09:42:05 2017 +0000
4 Commit: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
5 CommitDate: Thu Apr 27 09:42:05 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=ea4709ae
7
8 Linux patch 4.10.13
9
10 0000_README | 4 +
11 1012_linux-4.10.13.patch | 814 +++++++++++++++++++++++++++++++++++++++++++++++
12 2 files changed, 818 insertions(+)
13
14 diff --git a/0000_README b/0000_README
15 index e55a9e7..0aa6665 100644
16 --- a/0000_README
17 +++ b/0000_README
18 @@ -91,6 +91,10 @@ Patch: 1011_linux-4.10.12.patch
19 From: http://www.kernel.org
20 Desc: Linux 4.10.12
21
22 +Patch: 1012_linux-4.10.13.patch
23 +From: http://www.kernel.org
24 +Desc: Linux 4.10.13
25 +
26 Patch: 1500_XATTR_USER_PREFIX.patch
27 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
28 Desc: Support for namespace user.pax.* on tmpfs.
29
30 diff --git a/1012_linux-4.10.13.patch b/1012_linux-4.10.13.patch
31 new file mode 100644
32 index 0000000..7c9db8c
33 --- /dev/null
34 +++ b/1012_linux-4.10.13.patch
35 @@ -0,0 +1,814 @@
36 +diff --git a/Makefile b/Makefile
37 +index 9689d3f644ea..8285f4de02d1 100644
38 +--- a/Makefile
39 ++++ b/Makefile
40 +@@ -1,6 +1,6 @@
41 + VERSION = 4
42 + PATCHLEVEL = 10
43 +-SUBLEVEL = 12
44 ++SUBLEVEL = 13
45 + EXTRAVERSION =
46 + NAME = Fearless Coyote
47 +
48 +diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
49 +index 6432d4bf08c8..767ef6d68c9e 100644
50 +--- a/arch/powerpc/kernel/entry_64.S
51 ++++ b/arch/powerpc/kernel/entry_64.S
52 +@@ -689,7 +689,7 @@ resume_kernel:
53 +
54 + addi r8,r1,INT_FRAME_SIZE /* Get the kprobed function entry */
55 +
56 +- lwz r3,GPR1(r1)
57 ++ ld r3,GPR1(r1)
58 + subi r3,r3,INT_FRAME_SIZE /* dst: Allocate a trampoline exception frame */
59 + mr r4,r1 /* src: current exception frame */
60 + mr r1,r3 /* Reroute the trampoline frame to r1 */
61 +@@ -703,8 +703,8 @@ resume_kernel:
62 + addi r6,r6,8
63 + bdnz 2b
64 +
65 +- /* Do real store operation to complete stwu */
66 +- lwz r5,GPR1(r1)
67 ++ /* Do real store operation to complete stdu */
68 ++ ld r5,GPR1(r1)
69 + std r8,0(r5)
70 +
71 + /* Clear _TIF_EMULATE_STACK_STORE flag */
72 +diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
73 +index 0362cd5fa187..0cea7026e4ff 100644
74 +--- a/arch/s390/include/asm/pgtable.h
75 ++++ b/arch/s390/include/asm/pgtable.h
76 +@@ -1029,6 +1029,8 @@ int get_guest_storage_key(struct mm_struct *mm, unsigned long addr,
77 + static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
78 + pte_t *ptep, pte_t entry)
79 + {
80 ++ if (pte_present(entry))
81 ++ pte_val(entry) &= ~_PAGE_UNUSED;
82 + if (mm_has_pgste(mm))
83 + ptep_set_pte_at(mm, addr, ptep, entry);
84 + else
85 +diff --git a/arch/x86/kernel/cpu/mcheck/mce-genpool.c b/arch/x86/kernel/cpu/mcheck/mce-genpool.c
86 +index 93d824ec3120..040af1939460 100644
87 +--- a/arch/x86/kernel/cpu/mcheck/mce-genpool.c
88 ++++ b/arch/x86/kernel/cpu/mcheck/mce-genpool.c
89 +@@ -85,7 +85,7 @@ void mce_gen_pool_process(void)
90 + head = llist_reverse_order(head);
91 + llist_for_each_entry_safe(node, tmp, head, llnode) {
92 + mce = &node->mce;
93 +- atomic_notifier_call_chain(&x86_mce_decoder_chain, 0, mce);
94 ++ blocking_notifier_call_chain(&x86_mce_decoder_chain, 0, mce);
95 + gen_pool_free(mce_evt_pool, (unsigned long)node, sizeof(*node));
96 + }
97 + }
98 +diff --git a/arch/x86/kernel/cpu/mcheck/mce-internal.h b/arch/x86/kernel/cpu/mcheck/mce-internal.h
99 +index cd74a3f00aea..de20902ecf23 100644
100 +--- a/arch/x86/kernel/cpu/mcheck/mce-internal.h
101 ++++ b/arch/x86/kernel/cpu/mcheck/mce-internal.h
102 +@@ -13,7 +13,7 @@ enum severity_level {
103 + MCE_PANIC_SEVERITY,
104 + };
105 +
106 +-extern struct atomic_notifier_head x86_mce_decoder_chain;
107 ++extern struct blocking_notifier_head x86_mce_decoder_chain;
108 +
109 + #define ATTR_LEN 16
110 + #define INITIAL_CHECK_INTERVAL 5 * 60 /* 5 minutes */
111 +diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
112 +index 036fc03aefbd..fcf8b8d6ebfb 100644
113 +--- a/arch/x86/kernel/cpu/mcheck/mce.c
114 ++++ b/arch/x86/kernel/cpu/mcheck/mce.c
115 +@@ -123,7 +123,7 @@ static void (*quirk_no_way_out)(int bank, struct mce *m, struct pt_regs *regs);
116 + * CPU/chipset specific EDAC code can register a notifier call here to print
117 + * MCE errors in a human-readable form.
118 + */
119 +-ATOMIC_NOTIFIER_HEAD(x86_mce_decoder_chain);
120 ++BLOCKING_NOTIFIER_HEAD(x86_mce_decoder_chain);
121 +
122 + /* Do initial initialization of a struct mce */
123 + void mce_setup(struct mce *m)
124 +@@ -223,7 +223,7 @@ void mce_register_decode_chain(struct notifier_block *nb)
125 + if (nb != &mce_srao_nb && nb->priority == INT_MAX)
126 + nb->priority -= 1;
127 +
128 +- atomic_notifier_chain_register(&x86_mce_decoder_chain, nb);
129 ++ blocking_notifier_chain_register(&x86_mce_decoder_chain, nb);
130 + }
131 + EXPORT_SYMBOL_GPL(mce_register_decode_chain);
132 +
133 +@@ -231,7 +231,7 @@ void mce_unregister_decode_chain(struct notifier_block *nb)
134 + {
135 + atomic_dec(&num_notifiers);
136 +
137 +- atomic_notifier_chain_unregister(&x86_mce_decoder_chain, nb);
138 ++ blocking_notifier_chain_unregister(&x86_mce_decoder_chain, nb);
139 + }
140 + EXPORT_SYMBOL_GPL(mce_unregister_decode_chain);
141 +
142 +@@ -324,18 +324,7 @@ static void __print_mce(struct mce *m)
143 +
144 + static void print_mce(struct mce *m)
145 + {
146 +- int ret = 0;
147 +-
148 + __print_mce(m);
149 +-
150 +- /*
151 +- * Print out human-readable details about the MCE error,
152 +- * (if the CPU has an implementation for that)
153 +- */
154 +- ret = atomic_notifier_call_chain(&x86_mce_decoder_chain, 0, m);
155 +- if (ret == NOTIFY_STOP)
156 +- return;
157 +-
158 + pr_emerg_ratelimited(HW_ERR "Run the above through 'mcelog --ascii'\n");
159 + }
160 +
161 +diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
162 +index a5fd137417a2..b44a25d77a84 100644
163 +--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
164 ++++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
165 +@@ -60,7 +60,7 @@ static const char * const th_names[] = {
166 + "load_store",
167 + "insn_fetch",
168 + "combined_unit",
169 +- "",
170 ++ "decode_unit",
171 + "northbridge",
172 + "execution_unit",
173 + };
174 +diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
175 +index fcd4ce6f78d5..1c2b846c5776 100644
176 +--- a/drivers/acpi/power.c
177 ++++ b/drivers/acpi/power.c
178 +@@ -200,6 +200,7 @@ static int acpi_power_get_list_state(struct list_head *list, int *state)
179 + return -EINVAL;
180 +
181 + /* The state of the list is 'on' IFF all resources are 'on'. */
182 ++ cur_state = 0;
183 + list_for_each_entry(entry, list, node) {
184 + struct acpi_power_resource *resource = entry->resource;
185 + acpi_handle handle = resource->device.handle;
186 +diff --git a/drivers/dax/Kconfig b/drivers/dax/Kconfig
187 +index 3e2ab3b14eea..9e95bf94eb13 100644
188 +--- a/drivers/dax/Kconfig
189 ++++ b/drivers/dax/Kconfig
190 +@@ -2,6 +2,7 @@ menuconfig DEV_DAX
191 + tristate "DAX: direct access to differentiated memory"
192 + default m if NVDIMM_DAX
193 + depends on TRANSPARENT_HUGEPAGE
194 ++ select SRCU
195 + help
196 + Support raw access to differentiated (persistence, bandwidth,
197 + latency...) memory via an mmap(2) capable character
198 +diff --git a/drivers/dax/dax.c b/drivers/dax/dax.c
199 +index 20ab6bf9d1c7..53a016c3dffa 100644
200 +--- a/drivers/dax/dax.c
201 ++++ b/drivers/dax/dax.c
202 +@@ -24,6 +24,7 @@
203 + #include "dax.h"
204 +
205 + static dev_t dax_devt;
206 ++DEFINE_STATIC_SRCU(dax_srcu);
207 + static struct class *dax_class;
208 + static DEFINE_IDA(dax_minor_ida);
209 + static int nr_dax = CONFIG_NR_DEV_DAX;
210 +@@ -59,7 +60,7 @@ struct dax_region {
211 + * @region - parent region
212 + * @dev - device backing the character device
213 + * @cdev - core chardev data
214 +- * @alive - !alive + rcu grace period == no new mappings can be established
215 ++ * @alive - !alive + srcu grace period == no new mappings can be established
216 + * @id - child id in the region
217 + * @num_resources - number of physical address extents in this device
218 + * @res - array of physical address ranges
219 +@@ -530,7 +531,7 @@ static int __dax_dev_pmd_fault(struct dax_dev *dax_dev,
220 + static int dax_dev_pmd_fault(struct vm_area_struct *vma, unsigned long addr,
221 + pmd_t *pmd, unsigned int flags)
222 + {
223 +- int rc;
224 ++ int rc, id;
225 + struct file *filp = vma->vm_file;
226 + struct dax_dev *dax_dev = filp->private_data;
227 +
228 +@@ -538,9 +539,9 @@ static int dax_dev_pmd_fault(struct vm_area_struct *vma, unsigned long addr,
229 + current->comm, (flags & FAULT_FLAG_WRITE)
230 + ? "write" : "read", vma->vm_start, vma->vm_end);
231 +
232 +- rcu_read_lock();
233 ++ id = srcu_read_lock(&dax_srcu);
234 + rc = __dax_dev_pmd_fault(dax_dev, vma, addr, pmd, flags);
235 +- rcu_read_unlock();
236 ++ srcu_read_unlock(&dax_srcu, id);
237 +
238 + return rc;
239 + }
240 +@@ -656,11 +657,11 @@ static void unregister_dax_dev(void *dev)
241 + * Note, rcu is not protecting the liveness of dax_dev, rcu is
242 + * ensuring that any fault handlers that might have seen
243 + * dax_dev->alive == true, have completed. Any fault handlers
244 +- * that start after synchronize_rcu() has started will abort
245 ++ * that start after synchronize_srcu() has started will abort
246 + * upon seeing dax_dev->alive == false.
247 + */
248 + dax_dev->alive = false;
249 +- synchronize_rcu();
250 ++ synchronize_srcu(&dax_srcu);
251 + unmap_mapping_range(dax_dev->inode->i_mapping, 0, 0, 1);
252 + cdev_del(cdev);
253 + device_unregister(dev);
254 +diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
255 +index 6ef4f2fcfe43..0611f082f392 100644
256 +--- a/drivers/hid/wacom_wac.c
257 ++++ b/drivers/hid/wacom_wac.c
258 +@@ -1798,7 +1798,7 @@ static void wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field
259 + return;
260 + case HID_DG_TOOLSERIALNUMBER:
261 + wacom_wac->serial[0] = (wacom_wac->serial[0] & ~0xFFFFFFFFULL);
262 +- wacom_wac->serial[0] |= value;
263 ++ wacom_wac->serial[0] |= (__u32)value;
264 + return;
265 + case WACOM_HID_WD_SENSE:
266 + wacom_wac->hid_data.sense_state = value;
267 +diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
268 +index db7d1d666ac1..7826994c45bf 100644
269 +--- a/drivers/input/mouse/elantech.c
270 ++++ b/drivers/input/mouse/elantech.c
271 +@@ -1118,6 +1118,7 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse,
272 + * Asus UX32VD 0x361f02 00, 15, 0e clickpad
273 + * Avatar AVIU-145A2 0x361f00 ? clickpad
274 + * Fujitsu LIFEBOOK E544 0x470f00 d0, 12, 09 2 hw buttons
275 ++ * Fujitsu LIFEBOOK E547 0x470f00 50, 12, 09 2 hw buttons
276 + * Fujitsu LIFEBOOK E554 0x570f01 40, 14, 0c 2 hw buttons
277 + * Fujitsu T725 0x470f01 05, 12, 09 2 hw buttons
278 + * Fujitsu H730 0x570f00 c0, 14, 0c 3 hw buttons (**)
279 +@@ -1524,6 +1525,13 @@ static const struct dmi_system_id elantech_dmi_force_crc_enabled[] = {
280 + },
281 + },
282 + {
283 ++ /* Fujitsu LIFEBOOK E547 does not work with crc_enabled == 0 */
284 ++ .matches = {
285 ++ DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
286 ++ DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E547"),
287 ++ },
288 ++ },
289 ++ {
290 + /* Fujitsu LIFEBOOK E554 does not work with crc_enabled == 0 */
291 + .matches = {
292 + DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
293 +diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
294 +index 73db08558e4d..0a634d23b2ef 100644
295 +--- a/drivers/mmc/host/dw_mmc.c
296 ++++ b/drivers/mmc/host/dw_mmc.c
297 +@@ -22,6 +22,7 @@
298 + #include <linux/ioport.h>
299 + #include <linux/module.h>
300 + #include <linux/platform_device.h>
301 ++#include <linux/pm_runtime.h>
302 + #include <linux/seq_file.h>
303 + #include <linux/slab.h>
304 + #include <linux/stat.h>
305 +@@ -1179,11 +1180,13 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot, bool force_clkinit)
306 + if ((clock != slot->__clk_old &&
307 + !test_bit(DW_MMC_CARD_NEEDS_POLL, &slot->flags)) ||
308 + force_clkinit) {
309 +- dev_info(&slot->mmc->class_dev,
310 +- "Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ div = %d)\n",
311 +- slot->id, host->bus_hz, clock,
312 +- div ? ((host->bus_hz / div) >> 1) :
313 +- host->bus_hz, div);
314 ++ /* Silent the verbose log if calling from PM context */
315 ++ if (!force_clkinit)
316 ++ dev_info(&slot->mmc->class_dev,
317 ++ "Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ div = %d)\n",
318 ++ slot->id, host->bus_hz, clock,
319 ++ div ? ((host->bus_hz / div) >> 1) :
320 ++ host->bus_hz, div);
321 +
322 + /*
323 + * If card is polling, display the message only
324 +@@ -1616,10 +1619,16 @@ static void dw_mci_init_card(struct mmc_host *mmc, struct mmc_card *card)
325 +
326 + if (card->type == MMC_TYPE_SDIO ||
327 + card->type == MMC_TYPE_SD_COMBO) {
328 +- set_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags);
329 ++ if (!test_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags)) {
330 ++ pm_runtime_get_noresume(mmc->parent);
331 ++ set_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags);
332 ++ }
333 + clk_en_a = clk_en_a_old & ~clken_low_pwr;
334 + } else {
335 +- clear_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags);
336 ++ if (test_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags)) {
337 ++ pm_runtime_put_noidle(mmc->parent);
338 ++ clear_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags);
339 ++ }
340 + clk_en_a = clk_en_a_old | clken_low_pwr;
341 + }
342 +
343 +diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
344 +index 7123ef96ed18..445fc47dc3e7 100644
345 +--- a/drivers/mmc/host/sdhci-esdhc-imx.c
346 ++++ b/drivers/mmc/host/sdhci-esdhc-imx.c
347 +@@ -830,6 +830,7 @@ static int esdhc_change_pinstate(struct sdhci_host *host,
348 +
349 + switch (uhs) {
350 + case MMC_TIMING_UHS_SDR50:
351 ++ case MMC_TIMING_UHS_DDR50:
352 + pinctrl = imx_data->pins_100mhz;
353 + break;
354 + case MMC_TIMING_UHS_SDR104:
355 +diff --git a/drivers/mtd/ubi/upd.c b/drivers/mtd/ubi/upd.c
356 +index 0134ba32a057..39712560b4c1 100644
357 +--- a/drivers/mtd/ubi/upd.c
358 ++++ b/drivers/mtd/ubi/upd.c
359 +@@ -148,11 +148,11 @@ int ubi_start_update(struct ubi_device *ubi, struct ubi_volume *vol,
360 + return err;
361 + }
362 +
363 +- if (bytes == 0) {
364 +- err = ubi_wl_flush(ubi, UBI_ALL, UBI_ALL);
365 +- if (err)
366 +- return err;
367 ++ err = ubi_wl_flush(ubi, UBI_ALL, UBI_ALL);
368 ++ if (err)
369 ++ return err;
370 +
371 ++ if (bytes == 0) {
372 + err = clear_update_marker(ubi, vol, 0);
373 + if (err)
374 + return err;
375 +diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
376 +index 7ea8a3393936..54a7d078a3a8 100644
377 +--- a/fs/cifs/cifsglob.h
378 ++++ b/fs/cifs/cifsglob.h
379 +@@ -933,7 +933,6 @@ struct cifs_tcon {
380 + bool use_persistent:1; /* use persistent instead of durable handles */
381 + #ifdef CONFIG_CIFS_SMB2
382 + bool print:1; /* set if connection to printer share */
383 +- bool bad_network_name:1; /* set if ret status STATUS_BAD_NETWORK_NAME */
384 + __le32 capabilities;
385 + __u32 share_flags;
386 + __u32 maximal_access;
387 +diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
388 +index fc537c29044e..87b87e091e8e 100644
389 +--- a/fs/cifs/smb1ops.c
390 ++++ b/fs/cifs/smb1ops.c
391 +@@ -1015,6 +1015,15 @@ cifs_dir_needs_close(struct cifsFileInfo *cfile)
392 + return !cfile->srch_inf.endOfSearch && !cfile->invalidHandle;
393 + }
394 +
395 ++static bool
396 ++cifs_can_echo(struct TCP_Server_Info *server)
397 ++{
398 ++ if (server->tcpStatus == CifsGood)
399 ++ return true;
400 ++
401 ++ return false;
402 ++}
403 ++
404 + struct smb_version_operations smb1_operations = {
405 + .send_cancel = send_nt_cancel,
406 + .compare_fids = cifs_compare_fids,
407 +@@ -1049,6 +1058,7 @@ struct smb_version_operations smb1_operations = {
408 + .get_dfs_refer = CIFSGetDFSRefer,
409 + .qfs_tcon = cifs_qfs_tcon,
410 + .is_path_accessible = cifs_is_path_accessible,
411 ++ .can_echo = cifs_can_echo,
412 + .query_path_info = cifs_query_path_info,
413 + .query_file_info = cifs_query_file_info,
414 + .get_srv_inum = cifs_get_srv_inum,
415 +diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
416 +index 7080dac3592c..802185386851 100644
417 +--- a/fs/cifs/smb2pdu.c
418 ++++ b/fs/cifs/smb2pdu.c
419 +@@ -1084,9 +1084,6 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
420 + else
421 + return -EIO;
422 +
423 +- if (tcon && tcon->bad_network_name)
424 +- return -ENOENT;
425 +-
426 + if ((tcon && tcon->seal) &&
427 + ((ses->server->capabilities & SMB2_GLOBAL_CAP_ENCRYPTION) == 0)) {
428 + cifs_dbg(VFS, "encryption requested but no server support");
429 +@@ -1188,8 +1185,6 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
430 + tcon_error_exit:
431 + if (rsp->hdr.Status == STATUS_BAD_NETWORK_NAME) {
432 + cifs_dbg(VFS, "BAD_NETWORK_NAME: %s\n", tree);
433 +- if (tcon)
434 +- tcon->bad_network_name = true;
435 + }
436 + goto tcon_exit;
437 + }
438 +diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
439 +index 528369f3e472..beaddaf52fba 100644
440 +--- a/fs/ubifs/dir.c
441 ++++ b/fs/ubifs/dir.c
442 +@@ -748,6 +748,11 @@ static int ubifs_link(struct dentry *old_dentry, struct inode *dir,
443 + goto out_fname;
444 +
445 + lock_2_inodes(dir, inode);
446 ++
447 ++ /* Handle O_TMPFILE corner case, it is allowed to link a O_TMPFILE. */
448 ++ if (inode->i_nlink == 0)
449 ++ ubifs_delete_orphan(c, inode->i_ino);
450 ++
451 + inc_nlink(inode);
452 + ihold(inode);
453 + inode->i_ctime = ubifs_current_time(inode);
454 +@@ -768,6 +773,8 @@ static int ubifs_link(struct dentry *old_dentry, struct inode *dir,
455 + dir->i_size -= sz_change;
456 + dir_ui->ui_size = dir->i_size;
457 + drop_nlink(inode);
458 ++ if (inode->i_nlink == 0)
459 ++ ubifs_add_orphan(c, inode->i_ino);
460 + unlock_2_inodes(dir, inode);
461 + ubifs_release_budget(c, &req);
462 + iput(inode);
463 +@@ -1316,9 +1323,6 @@ static int do_rename(struct inode *old_dir, struct dentry *old_dentry,
464 + unsigned int uninitialized_var(saved_nlink);
465 + struct fscrypt_name old_nm, new_nm;
466 +
467 +- if (flags & ~RENAME_NOREPLACE)
468 +- return -EINVAL;
469 +-
470 + /*
471 + * Budget request settings: deletion direntry, new direntry, removing
472 + * the old inode, and changing old and new parent directory inodes.
473 +diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
474 +index 8df48ccb8af6..79172c35c2b2 100644
475 +--- a/kernel/trace/ring_buffer.c
476 ++++ b/kernel/trace/ring_buffer.c
477 +@@ -3404,11 +3404,23 @@ EXPORT_SYMBOL_GPL(ring_buffer_iter_reset);
478 + int ring_buffer_iter_empty(struct ring_buffer_iter *iter)
479 + {
480 + struct ring_buffer_per_cpu *cpu_buffer;
481 ++ struct buffer_page *reader;
482 ++ struct buffer_page *head_page;
483 ++ struct buffer_page *commit_page;
484 ++ unsigned commit;
485 +
486 + cpu_buffer = iter->cpu_buffer;
487 +
488 +- return iter->head_page == cpu_buffer->commit_page &&
489 +- iter->head == rb_commit_index(cpu_buffer);
490 ++ /* Remember, trace recording is off when iterator is in use */
491 ++ reader = cpu_buffer->reader_page;
492 ++ head_page = cpu_buffer->head_page;
493 ++ commit_page = cpu_buffer->commit_page;
494 ++ commit = rb_page_commit(commit_page);
495 ++
496 ++ return ((iter->head_page == commit_page && iter->head == commit) ||
497 ++ (iter->head_page == reader && commit_page == head_page &&
498 ++ head_page->read == commit &&
499 ++ iter->head == rb_page_commit(cpu_buffer->reader_page)));
500 + }
501 + EXPORT_SYMBOL_GPL(ring_buffer_iter_empty);
502 +
503 +diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
504 +index 6ee340a43f18..f76ff14be517 100644
505 +--- a/kernel/trace/trace.c
506 ++++ b/kernel/trace/trace.c
507 +@@ -6740,11 +6740,13 @@ ftrace_trace_snapshot_callback(struct ftrace_hash *hash,
508 + return ret;
509 +
510 + out_reg:
511 +- ret = register_ftrace_function_probe(glob, ops, count);
512 ++ ret = alloc_snapshot(&global_trace);
513 ++ if (ret < 0)
514 ++ goto out;
515 +
516 +- if (ret >= 0)
517 +- alloc_snapshot(&global_trace);
518 ++ ret = register_ftrace_function_probe(glob, ops, count);
519 +
520 ++ out:
521 + return ret < 0 ? ret : 0;
522 + }
523 +
524 +diff --git a/mm/migrate.c b/mm/migrate.c
525 +index 87f4d0f81819..c509a92639f6 100644
526 +--- a/mm/migrate.c
527 ++++ b/mm/migrate.c
528 +@@ -183,9 +183,9 @@ void putback_movable_pages(struct list_head *l)
529 + unlock_page(page);
530 + put_page(page);
531 + } else {
532 +- putback_lru_page(page);
533 + dec_node_page_state(page, NR_ISOLATED_ANON +
534 + page_is_file_cache(page));
535 ++ putback_lru_page(page);
536 + }
537 + }
538 + }
539 +diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
540 +index 1109e60e9121..03476694a7c8 100644
541 +--- a/net/mac80211/rx.c
542 ++++ b/net/mac80211/rx.c
543 +@@ -208,6 +208,51 @@ ieee80211_rx_radiotap_hdrlen(struct ieee80211_local *local,
544 + return len;
545 + }
546 +
547 ++static void ieee80211_handle_mu_mimo_mon(struct ieee80211_sub_if_data *sdata,
548 ++ struct sk_buff *skb,
549 ++ int rtap_vendor_space)
550 ++{
551 ++ struct {
552 ++ struct ieee80211_hdr_3addr hdr;
553 ++ u8 category;
554 ++ u8 action_code;
555 ++ } __packed action;
556 ++
557 ++ if (!sdata)
558 ++ return;
559 ++
560 ++ BUILD_BUG_ON(sizeof(action) != IEEE80211_MIN_ACTION_SIZE + 1);
561 ++
562 ++ if (skb->len < rtap_vendor_space + sizeof(action) +
563 ++ VHT_MUMIMO_GROUPS_DATA_LEN)
564 ++ return;
565 ++
566 ++ if (!is_valid_ether_addr(sdata->u.mntr.mu_follow_addr))
567 ++ return;
568 ++
569 ++ skb_copy_bits(skb, rtap_vendor_space, &action, sizeof(action));
570 ++
571 ++ if (!ieee80211_is_action(action.hdr.frame_control))
572 ++ return;
573 ++
574 ++ if (action.category != WLAN_CATEGORY_VHT)
575 ++ return;
576 ++
577 ++ if (action.action_code != WLAN_VHT_ACTION_GROUPID_MGMT)
578 ++ return;
579 ++
580 ++ if (!ether_addr_equal(action.hdr.addr1, sdata->u.mntr.mu_follow_addr))
581 ++ return;
582 ++
583 ++ skb = skb_copy(skb, GFP_ATOMIC);
584 ++ if (!skb)
585 ++ return;
586 ++
587 ++ skb->pkt_type = IEEE80211_SDATA_QUEUE_TYPE_FRAME;
588 ++ skb_queue_tail(&sdata->skb_queue, skb);
589 ++ ieee80211_queue_work(&sdata->local->hw, &sdata->work);
590 ++}
591 ++
592 + /*
593 + * ieee80211_add_rx_radiotap_header - add radiotap header
594 + *
595 +@@ -515,7 +560,6 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
596 + struct net_device *prev_dev = NULL;
597 + int present_fcs_len = 0;
598 + unsigned int rtap_vendor_space = 0;
599 +- struct ieee80211_mgmt *mgmt;
600 + struct ieee80211_sub_if_data *monitor_sdata =
601 + rcu_dereference(local->monitor_sdata);
602 +
603 +@@ -553,6 +597,8 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
604 + return remove_monitor_info(local, origskb, rtap_vendor_space);
605 + }
606 +
607 ++ ieee80211_handle_mu_mimo_mon(monitor_sdata, origskb, rtap_vendor_space);
608 ++
609 + /* room for the radiotap header based on driver features */
610 + rt_hdrlen = ieee80211_rx_radiotap_hdrlen(local, status, origskb);
611 + needed_headroom = rt_hdrlen - rtap_vendor_space;
612 +@@ -618,23 +664,6 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
613 + ieee80211_rx_stats(sdata->dev, skb->len);
614 + }
615 +
616 +- mgmt = (void *)skb->data;
617 +- if (monitor_sdata &&
618 +- skb->len >= IEEE80211_MIN_ACTION_SIZE + 1 + VHT_MUMIMO_GROUPS_DATA_LEN &&
619 +- ieee80211_is_action(mgmt->frame_control) &&
620 +- mgmt->u.action.category == WLAN_CATEGORY_VHT &&
621 +- mgmt->u.action.u.vht_group_notif.action_code == WLAN_VHT_ACTION_GROUPID_MGMT &&
622 +- is_valid_ether_addr(monitor_sdata->u.mntr.mu_follow_addr) &&
623 +- ether_addr_equal(mgmt->da, monitor_sdata->u.mntr.mu_follow_addr)) {
624 +- struct sk_buff *mu_skb = skb_copy(skb, GFP_ATOMIC);
625 +-
626 +- if (mu_skb) {
627 +- mu_skb->pkt_type = IEEE80211_SDATA_QUEUE_TYPE_FRAME;
628 +- skb_queue_tail(&monitor_sdata->skb_queue, mu_skb);
629 +- ieee80211_queue_work(&local->hw, &monitor_sdata->work);
630 +- }
631 +- }
632 +-
633 + if (prev_dev) {
634 + skb->dev = prev_dev;
635 + netif_receive_skb(skb);
636 +@@ -3614,6 +3643,27 @@ static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx)
637 + !ether_addr_equal(bssid, hdr->addr1))
638 + return false;
639 + }
640 ++
641 ++ /*
642 ++ * 802.11-2016 Table 9-26 says that for data frames, A1 must be
643 ++ * the BSSID - we've checked that already but may have accepted
644 ++ * the wildcard (ff:ff:ff:ff:ff:ff).
645 ++ *
646 ++ * It also says:
647 ++ * The BSSID of the Data frame is determined as follows:
648 ++ * a) If the STA is contained within an AP or is associated
649 ++ * with an AP, the BSSID is the address currently in use
650 ++ * by the STA contained in the AP.
651 ++ *
652 ++ * So we should not accept data frames with an address that's
653 ++ * multicast.
654 ++ *
655 ++ * Accepting it also opens a security problem because stations
656 ++ * could encrypt it with the GTK and inject traffic that way.
657 ++ */
658 ++ if (ieee80211_is_data(hdr->frame_control) && multicast)
659 ++ return false;
660 ++
661 + return true;
662 + case NL80211_IFTYPE_WDS:
663 + if (bssid || !ieee80211_is_data(hdr->frame_control))
664 +diff --git a/security/keys/gc.c b/security/keys/gc.c
665 +index addf060399e0..9cb4fe4478a1 100644
666 +--- a/security/keys/gc.c
667 ++++ b/security/keys/gc.c
668 +@@ -46,7 +46,7 @@ static unsigned long key_gc_flags;
669 + * immediately unlinked.
670 + */
671 + struct key_type key_type_dead = {
672 +- .name = "dead",
673 ++ .name = ".dead",
674 + };
675 +
676 + /*
677 +diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
678 +index 04a764f71ec8..3c7f6897fd5b 100644
679 +--- a/security/keys/keyctl.c
680 ++++ b/security/keys/keyctl.c
681 +@@ -271,7 +271,8 @@ long keyctl_get_keyring_ID(key_serial_t id, int create)
682 + * Create and join an anonymous session keyring or join a named session
683 + * keyring, creating it if necessary. A named session keyring must have Search
684 + * permission for it to be joined. Session keyrings without this permit will
685 +- * be skipped over.
686 ++ * be skipped over. It is not permitted for userspace to create or join
687 ++ * keyrings whose name begin with a dot.
688 + *
689 + * If successful, the ID of the joined session keyring will be returned.
690 + */
691 +@@ -288,12 +289,16 @@ long keyctl_join_session_keyring(const char __user *_name)
692 + ret = PTR_ERR(name);
693 + goto error;
694 + }
695 ++
696 ++ ret = -EPERM;
697 ++ if (name[0] == '.')
698 ++ goto error_name;
699 + }
700 +
701 + /* join the session */
702 + ret = join_session_keyring(name);
703 ++error_name:
704 + kfree(name);
705 +-
706 + error:
707 + return ret;
708 + }
709 +@@ -1251,8 +1256,8 @@ long keyctl_reject_key(key_serial_t id, unsigned timeout, unsigned error,
710 + * Read or set the default keyring in which request_key() will cache keys and
711 + * return the old setting.
712 + *
713 +- * If a process keyring is specified then this will be created if it doesn't
714 +- * yet exist. The old setting will be returned if successful.
715 ++ * If a thread or process keyring is specified then it will be created if it
716 ++ * doesn't yet exist. The old setting will be returned if successful.
717 + */
718 + long keyctl_set_reqkey_keyring(int reqkey_defl)
719 + {
720 +@@ -1277,11 +1282,8 @@ long keyctl_set_reqkey_keyring(int reqkey_defl)
721 +
722 + case KEY_REQKEY_DEFL_PROCESS_KEYRING:
723 + ret = install_process_keyring_to_cred(new);
724 +- if (ret < 0) {
725 +- if (ret != -EEXIST)
726 +- goto error;
727 +- ret = 0;
728 +- }
729 ++ if (ret < 0)
730 ++ goto error;
731 + goto set;
732 +
733 + case KEY_REQKEY_DEFL_DEFAULT:
734 +diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
735 +index 918cddcd4516..855b94df1126 100644
736 +--- a/security/keys/process_keys.c
737 ++++ b/security/keys/process_keys.c
738 +@@ -127,13 +127,18 @@ int install_user_keyrings(void)
739 + }
740 +
741 + /*
742 +- * Install a fresh thread keyring directly to new credentials. This keyring is
743 +- * allowed to overrun the quota.
744 ++ * Install a thread keyring to the given credentials struct if it didn't have
745 ++ * one already. This is allowed to overrun the quota.
746 ++ *
747 ++ * Return: 0 if a thread keyring is now present; -errno on failure.
748 + */
749 + int install_thread_keyring_to_cred(struct cred *new)
750 + {
751 + struct key *keyring;
752 +
753 ++ if (new->thread_keyring)
754 ++ return 0;
755 ++
756 + keyring = keyring_alloc("_tid", new->uid, new->gid, new,
757 + KEY_POS_ALL | KEY_USR_VIEW,
758 + KEY_ALLOC_QUOTA_OVERRUN,
759 +@@ -146,7 +151,9 @@ int install_thread_keyring_to_cred(struct cred *new)
760 + }
761 +
762 + /*
763 +- * Install a fresh thread keyring, discarding the old one.
764 ++ * Install a thread keyring to the current task if it didn't have one already.
765 ++ *
766 ++ * Return: 0 if a thread keyring is now present; -errno on failure.
767 + */
768 + static int install_thread_keyring(void)
769 + {
770 +@@ -157,8 +164,6 @@ static int install_thread_keyring(void)
771 + if (!new)
772 + return -ENOMEM;
773 +
774 +- BUG_ON(new->thread_keyring);
775 +-
776 + ret = install_thread_keyring_to_cred(new);
777 + if (ret < 0) {
778 + abort_creds(new);
779 +@@ -169,17 +174,17 @@ static int install_thread_keyring(void)
780 + }
781 +
782 + /*
783 +- * Install a process keyring directly to a credentials struct.
784 ++ * Install a process keyring to the given credentials struct if it didn't have
785 ++ * one already. This is allowed to overrun the quota.
786 + *
787 +- * Returns -EEXIST if there was already a process keyring, 0 if one installed,
788 +- * and other value on any other error
789 ++ * Return: 0 if a process keyring is now present; -errno on failure.
790 + */
791 + int install_process_keyring_to_cred(struct cred *new)
792 + {
793 + struct key *keyring;
794 +
795 + if (new->process_keyring)
796 +- return -EEXIST;
797 ++ return 0;
798 +
799 + keyring = keyring_alloc("_pid", new->uid, new->gid, new,
800 + KEY_POS_ALL | KEY_USR_VIEW,
801 +@@ -193,11 +198,9 @@ int install_process_keyring_to_cred(struct cred *new)
802 + }
803 +
804 + /*
805 +- * Make sure a process keyring is installed for the current process. The
806 +- * existing process keyring is not replaced.
807 ++ * Install a process keyring to the current task if it didn't have one already.
808 + *
809 +- * Returns 0 if there is a process keyring by the end of this function, some
810 +- * error otherwise.
811 ++ * Return: 0 if a process keyring is now present; -errno on failure.
812 + */
813 + static int install_process_keyring(void)
814 + {
815 +@@ -211,14 +214,18 @@ static int install_process_keyring(void)
816 + ret = install_process_keyring_to_cred(new);
817 + if (ret < 0) {
818 + abort_creds(new);
819 +- return ret != -EEXIST ? ret : 0;
820 ++ return ret;
821 + }
822 +
823 + return commit_creds(new);
824 + }
825 +
826 + /*
827 +- * Install a session keyring directly to a credentials struct.
828 ++ * Install the given keyring as the session keyring of the given credentials
829 ++ * struct, replacing the existing one if any. If the given keyring is NULL,
830 ++ * then install a new anonymous session keyring.
831 ++ *
832 ++ * Return: 0 on success; -errno on failure.
833 + */
834 + int install_session_keyring_to_cred(struct cred *cred, struct key *keyring)
835 + {
836 +@@ -253,8 +260,11 @@ int install_session_keyring_to_cred(struct cred *cred, struct key *keyring)
837 + }
838 +
839 + /*
840 +- * Install a session keyring, discarding the old one. If a keyring is not
841 +- * supplied, an empty one is invented.
842 ++ * Install the given keyring as the session keyring of the current task,
843 ++ * replacing the existing one if any. If the given keyring is NULL, then
844 ++ * install a new anonymous session keyring.
845 ++ *
846 ++ * Return: 0 on success; -errno on failure.
847 + */
848 + static int install_session_keyring(struct key *keyring)
849 + {