Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:3.10 commit in: /
Date: Tue, 08 Jul 2014 00:24:05
Message-Id: 1404778926.1ea8ec206bb391ba233e18afe4f1517e31cef49e.mpagano@gentoo
1 commit: 1ea8ec206bb391ba233e18afe4f1517e31cef49e
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jul 8 00:22:06 2014 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Tue Jul 8 00:22:06 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/linux-patches.git;a=commit;h=1ea8ec20
7
8 Linux patch 3.10.47
9
10 ---
11 0000_README | 4 +
12 1046_linux-3.10.47.patch | 1412 ++++++++++++++++++++++++++++++++++++++++++++++
13 2 files changed, 1416 insertions(+)
14
15 diff --git a/0000_README b/0000_README
16 index 6ec8c6d..3f75e5c 100644
17 --- a/0000_README
18 +++ b/0000_README
19 @@ -226,6 +226,10 @@ Patch: 1045_linux-3.10.46.patch
20 From: http://www.kernel.org
21 Desc: Linux 3.10.46
22
23 +Patch: 1046_linux-3.10.47.patch
24 +From: http://www.kernel.org
25 +Desc: Linux 3.10.47
26 +
27 Patch: 1500_XATTR_USER_PREFIX.patch
28 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
29 Desc: Support for namespace user.pax.* on tmpfs.
30
31 diff --git a/1046_linux-3.10.47.patch b/1046_linux-3.10.47.patch
32 new file mode 100644
33 index 0000000..6bbab45
34 --- /dev/null
35 +++ b/1046_linux-3.10.47.patch
36 @@ -0,0 +1,1412 @@
37 +diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches
38 +index 6e97e73d87b5..4dbba7e100a1 100644
39 +--- a/Documentation/SubmittingPatches
40 ++++ b/Documentation/SubmittingPatches
41 +@@ -131,6 +131,20 @@ If you cannot condense your patch set into a smaller set of patches,
42 + then only post say 15 or so at a time and wait for review and integration.
43 +
44 +
45 ++If your patch fixes a bug in a specific commit, e.g. you found an issue using
46 ++git-bisect, please use the 'Fixes:' tag with the first 12 characters of the
47 ++SHA-1 ID, and the one line summary.
48 ++Example:
49 ++
50 ++ Fixes: e21d2170f366 ("video: remove unnecessary platform_set_drvdata()")
51 ++
52 ++The following git-config settings can be used to add a pretty format for
53 ++outputting the above style in the git log or git show commands
54 ++
55 ++ [core]
56 ++ abbrev = 12
57 ++ [pretty]
58 ++ fixes = Fixes: %h (\"%s\")
59 +
60 + 4) Style check your changes.
61 +
62 +@@ -420,7 +434,7 @@ person it names. This tag documents that potentially interested parties
63 + have been included in the discussion
64 +
65 +
66 +-14) Using Reported-by:, Tested-by:, Reviewed-by: and Suggested-by:
67 ++14) Using Reported-by:, Tested-by:, Reviewed-by:, Suggested-by: and Fixes:
68 +
69 + If this patch fixes a problem reported by somebody else, consider adding a
70 + Reported-by: tag to credit the reporter for their contribution. Please
71 +@@ -475,6 +489,12 @@ idea was not posted in a public forum. That said, if we diligently credit our
72 + idea reporters, they will, hopefully, be inspired to help us again in the
73 + future.
74 +
75 ++A Fixes: tag indicates that the patch fixes an issue in a previous commit. It
76 ++is used to make it easy to determine where a bug originated, which can help
77 ++review a bug fix. This tag also assists the stable kernel team in determining
78 ++which stable kernel versions should receive your fix. This is the preferred
79 ++method for indicating a bug fixed by the patch. See #2 above for more details.
80 ++
81 +
82 + 15) The canonical patch format
83 +
84 +diff --git a/Makefile b/Makefile
85 +index c226f110181d..6a3b46d1863c 100644
86 +--- a/Makefile
87 ++++ b/Makefile
88 +@@ -1,6 +1,6 @@
89 + VERSION = 3
90 + PATCHLEVEL = 10
91 +-SUBLEVEL = 46
92 ++SUBLEVEL = 47
93 + EXTRAVERSION =
94 + NAME = TOSSUG Baby Fish
95 +
96 +diff --git a/arch/mips/kernel/irq-msc01.c b/arch/mips/kernel/irq-msc01.c
97 +index fab40f7d2e03..ac9facc08694 100644
98 +--- a/arch/mips/kernel/irq-msc01.c
99 ++++ b/arch/mips/kernel/irq-msc01.c
100 +@@ -131,7 +131,7 @@ void __init init_msc_irqs(unsigned long icubase, unsigned int irqbase, msc_irqma
101 +
102 + board_bind_eic_interrupt = &msc_bind_eic_interrupt;
103 +
104 +- for (; nirq >= 0; nirq--, imp++) {
105 ++ for (; nirq > 0; nirq--, imp++) {
106 + int n = imp->im_irq;
107 +
108 + switch (imp->im_type) {
109 +diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c
110 +index 426345ac6f6e..2c7b3ade8ec0 100644
111 +--- a/arch/mips/kvm/kvm_mips.c
112 ++++ b/arch/mips/kvm/kvm_mips.c
113 +@@ -149,9 +149,7 @@ void kvm_mips_free_vcpus(struct kvm *kvm)
114 + if (kvm->arch.guest_pmap[i] != KVM_INVALID_PAGE)
115 + kvm_mips_release_pfn_clean(kvm->arch.guest_pmap[i]);
116 + }
117 +-
118 +- if (kvm->arch.guest_pmap)
119 +- kfree(kvm->arch.guest_pmap);
120 ++ kfree(kvm->arch.guest_pmap);
121 +
122 + kvm_for_each_vcpu(i, vcpu, kvm) {
123 + kvm_arch_vcpu_free(vcpu);
124 +@@ -384,12 +382,9 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu)
125 +
126 + kvm_mips_dump_stats(vcpu);
127 +
128 +- if (vcpu->arch.guest_ebase)
129 +- kfree(vcpu->arch.guest_ebase);
130 +-
131 +- if (vcpu->arch.kseg0_commpage)
132 +- kfree(vcpu->arch.kseg0_commpage);
133 +-
134 ++ kfree(vcpu->arch.guest_ebase);
135 ++ kfree(vcpu->arch.kseg0_commpage);
136 ++ kfree(vcpu);
137 + }
138 +
139 + void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
140 +diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
141 +index 43523fe0d8b4..05fcdd826829 100644
142 +--- a/arch/powerpc/include/asm/systbl.h
143 ++++ b/arch/powerpc/include/asm/systbl.h
144 +@@ -190,7 +190,7 @@ SYSCALL_SPU(getcwd)
145 + SYSCALL_SPU(capget)
146 + SYSCALL_SPU(capset)
147 + COMPAT_SYS(sigaltstack)
148 +-COMPAT_SYS_SPU(sendfile)
149 ++SYSX_SPU(sys_sendfile64,compat_sys_sendfile,sys_sendfile)
150 + SYSCALL(ni_syscall)
151 + SYSCALL(ni_syscall)
152 + PPC_SYS(vfork)
153 +diff --git a/arch/powerpc/include/uapi/asm/cputable.h b/arch/powerpc/include/uapi/asm/cputable.h
154 +index 5b7657959faa..de2c0e4ee1aa 100644
155 +--- a/arch/powerpc/include/uapi/asm/cputable.h
156 ++++ b/arch/powerpc/include/uapi/asm/cputable.h
157 +@@ -41,5 +41,6 @@
158 + #define PPC_FEATURE2_EBB 0x10000000
159 + #define PPC_FEATURE2_ISEL 0x08000000
160 + #define PPC_FEATURE2_TAR 0x04000000
161 ++#define PPC_FEATURE2_VEC_CRYPTO 0x02000000
162 +
163 + #endif /* _UAPI__ASM_POWERPC_CPUTABLE_H */
164 +diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
165 +index 2a45d0f04385..b2dc45522850 100644
166 +--- a/arch/powerpc/kernel/cputable.c
167 ++++ b/arch/powerpc/kernel/cputable.c
168 +@@ -105,7 +105,8 @@ extern void __restore_cpu_e6500(void);
169 + PPC_FEATURE_PSERIES_PERFMON_COMPAT)
170 + #define COMMON_USER2_POWER8 (PPC_FEATURE2_ARCH_2_07 | \
171 + PPC_FEATURE2_HTM_COMP | PPC_FEATURE2_DSCR | \
172 +- PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR)
173 ++ PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR | \
174 ++ PPC_FEATURE2_VEC_CRYPTO)
175 + #define COMMON_USER_PA6T (COMMON_USER_PPC64 | PPC_FEATURE_PA6T |\
176 + PPC_FEATURE_TRUE_LE | \
177 + PPC_FEATURE_HAS_ALTIVEC_COMP)
178 +diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
179 +index 5fc29ad7e26f..57fd5c1e8e89 100644
180 +--- a/arch/powerpc/kernel/time.c
181 ++++ b/arch/powerpc/kernel/time.c
182 +@@ -512,7 +512,7 @@ void timer_interrupt(struct pt_regs * regs)
183 +
184 + __get_cpu_var(irq_stat).timer_irqs++;
185 +
186 +-#if defined(CONFIG_PPC32) && defined(CONFIG_PMAC)
187 ++#if defined(CONFIG_PPC32) && defined(CONFIG_PPC_PMAC)
188 + if (atomic_read(&ppc_n_lost_interrupts) != 0)
189 + do_IRQ(regs);
190 + #endif
191 +diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
192 +index e15c521846ca..08490ecc465e 100644
193 +--- a/arch/powerpc/lib/sstep.c
194 ++++ b/arch/powerpc/lib/sstep.c
195 +@@ -1395,7 +1395,7 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
196 + regs->gpr[rd] = byterev_4(val);
197 + goto ldst_done;
198 +
199 +-#ifdef CONFIG_PPC_CPU
200 ++#ifdef CONFIG_PPC_FPU
201 + case 535: /* lfsx */
202 + case 567: /* lfsux */
203 + if (!(regs->msr & MSR_FP))
204 +diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c
205 +index b456b157d33d..68f97d5a4679 100644
206 +--- a/arch/powerpc/platforms/pseries/eeh_pseries.c
207 ++++ b/arch/powerpc/platforms/pseries/eeh_pseries.c
208 +@@ -400,6 +400,7 @@ static int pseries_eeh_get_state(struct eeh_pe *pe, int *state)
209 + } else {
210 + result = EEH_STATE_NOT_SUPPORT;
211 + }
212 ++ break;
213 + default:
214 + result = EEH_STATE_NOT_SUPPORT;
215 + }
216 +diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
217 +index 942a08623a1a..68e9f007cd4a 100644
218 +--- a/arch/x86/include/asm/ptrace.h
219 ++++ b/arch/x86/include/asm/ptrace.h
220 +@@ -232,6 +232,22 @@ static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
221 +
222 + #define ARCH_HAS_USER_SINGLE_STEP_INFO
223 +
224 ++/*
225 ++ * When hitting ptrace_stop(), we cannot return using SYSRET because
226 ++ * that does not restore the full CPU state, only a minimal set. The
227 ++ * ptracer can change arbitrary register values, which is usually okay
228 ++ * because the usual ptrace stops run off the signal delivery path which
229 ++ * forces IRET; however, ptrace_event() stops happen in arbitrary places
230 ++ * in the kernel and don't force IRET path.
231 ++ *
232 ++ * So force IRET path after a ptrace stop.
233 ++ */
234 ++#define arch_ptrace_stop_needed(code, info) \
235 ++({ \
236 ++ set_thread_flag(TIF_NOTIFY_RESUME); \
237 ++ false; \
238 ++})
239 ++
240 + struct user_desc;
241 + extern int do_get_thread_area(struct task_struct *p, int idx,
242 + struct user_desc __user *info);
243 +diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
244 +index 6e514583aa76..0d94e09221d9 100644
245 +--- a/drivers/block/mtip32xx/mtip32xx.c
246 ++++ b/drivers/block/mtip32xx/mtip32xx.c
247 +@@ -1493,6 +1493,37 @@ static inline void ata_swap_string(u16 *buf, unsigned int len)
248 + be16_to_cpus(&buf[i]);
249 + }
250 +
251 ++static void mtip_set_timeout(struct driver_data *dd,
252 ++ struct host_to_dev_fis *fis,
253 ++ unsigned int *timeout, u8 erasemode)
254 ++{
255 ++ switch (fis->command) {
256 ++ case ATA_CMD_DOWNLOAD_MICRO:
257 ++ *timeout = 120000; /* 2 minutes */
258 ++ break;
259 ++ case ATA_CMD_SEC_ERASE_UNIT:
260 ++ case 0xFC:
261 ++ if (erasemode)
262 ++ *timeout = ((*(dd->port->identify + 90) * 2) * 60000);
263 ++ else
264 ++ *timeout = ((*(dd->port->identify + 89) * 2) * 60000);
265 ++ break;
266 ++ case ATA_CMD_STANDBYNOW1:
267 ++ *timeout = 120000; /* 2 minutes */
268 ++ break;
269 ++ case 0xF7:
270 ++ case 0xFA:
271 ++ *timeout = 60000; /* 60 seconds */
272 ++ break;
273 ++ case ATA_CMD_SMART:
274 ++ *timeout = 15000; /* 15 seconds */
275 ++ break;
276 ++ default:
277 ++ *timeout = MTIP_IOCTL_COMMAND_TIMEOUT_MS;
278 ++ break;
279 ++ }
280 ++}
281 ++
282 + /*
283 + * Request the device identity information.
284 + *
285 +@@ -1602,6 +1633,7 @@ static int mtip_standby_immediate(struct mtip_port *port)
286 + int rv;
287 + struct host_to_dev_fis fis;
288 + unsigned long start;
289 ++ unsigned int timeout;
290 +
291 + /* Build the FIS. */
292 + memset(&fis, 0, sizeof(struct host_to_dev_fis));
293 +@@ -1609,6 +1641,8 @@ static int mtip_standby_immediate(struct mtip_port *port)
294 + fis.opts = 1 << 7;
295 + fis.command = ATA_CMD_STANDBYNOW1;
296 +
297 ++ mtip_set_timeout(port->dd, &fis, &timeout, 0);
298 ++
299 + start = jiffies;
300 + rv = mtip_exec_internal_command(port,
301 + &fis,
302 +@@ -1617,7 +1651,7 @@ static int mtip_standby_immediate(struct mtip_port *port)
303 + 0,
304 + 0,
305 + GFP_ATOMIC,
306 +- 15000);
307 ++ timeout);
308 + dbg_printk(MTIP_DRV_NAME "Time taken to complete standby cmd: %d ms\n",
309 + jiffies_to_msecs(jiffies - start));
310 + if (rv)
311 +@@ -2156,36 +2190,6 @@ static unsigned int implicit_sector(unsigned char command,
312 + }
313 + return rv;
314 + }
315 +-static void mtip_set_timeout(struct driver_data *dd,
316 +- struct host_to_dev_fis *fis,
317 +- unsigned int *timeout, u8 erasemode)
318 +-{
319 +- switch (fis->command) {
320 +- case ATA_CMD_DOWNLOAD_MICRO:
321 +- *timeout = 120000; /* 2 minutes */
322 +- break;
323 +- case ATA_CMD_SEC_ERASE_UNIT:
324 +- case 0xFC:
325 +- if (erasemode)
326 +- *timeout = ((*(dd->port->identify + 90) * 2) * 60000);
327 +- else
328 +- *timeout = ((*(dd->port->identify + 89) * 2) * 60000);
329 +- break;
330 +- case ATA_CMD_STANDBYNOW1:
331 +- *timeout = 120000; /* 2 minutes */
332 +- break;
333 +- case 0xF7:
334 +- case 0xFA:
335 +- *timeout = 60000; /* 60 seconds */
336 +- break;
337 +- case ATA_CMD_SMART:
338 +- *timeout = 15000; /* 15 seconds */
339 +- break;
340 +- default:
341 +- *timeout = MTIP_IOCTL_COMMAND_TIMEOUT_MS;
342 +- break;
343 +- }
344 +-}
345 +
346 + /*
347 + * Executes a taskfile
348 +@@ -4284,6 +4288,57 @@ static DEFINE_HANDLER(5);
349 + static DEFINE_HANDLER(6);
350 + static DEFINE_HANDLER(7);
351 +
352 ++static void mtip_disable_link_opts(struct driver_data *dd, struct pci_dev *pdev)
353 ++{
354 ++ int pos;
355 ++ unsigned short pcie_dev_ctrl;
356 ++
357 ++ pos = pci_find_capability(pdev, PCI_CAP_ID_EXP);
358 ++ if (pos) {
359 ++ pci_read_config_word(pdev,
360 ++ pos + PCI_EXP_DEVCTL,
361 ++ &pcie_dev_ctrl);
362 ++ if (pcie_dev_ctrl & (1 << 11) ||
363 ++ pcie_dev_ctrl & (1 << 4)) {
364 ++ dev_info(&dd->pdev->dev,
365 ++ "Disabling ERO/No-Snoop on bridge device %04x:%04x\n",
366 ++ pdev->vendor, pdev->device);
367 ++ pcie_dev_ctrl &= ~(PCI_EXP_DEVCTL_NOSNOOP_EN |
368 ++ PCI_EXP_DEVCTL_RELAX_EN);
369 ++ pci_write_config_word(pdev,
370 ++ pos + PCI_EXP_DEVCTL,
371 ++ pcie_dev_ctrl);
372 ++ }
373 ++ }
374 ++}
375 ++
376 ++static void mtip_fix_ero_nosnoop(struct driver_data *dd, struct pci_dev *pdev)
377 ++{
378 ++ /*
379 ++ * This workaround is specific to AMD/ATI chipset with a PCI upstream
380 ++ * device with device id 0x5aXX
381 ++ */
382 ++ if (pdev->bus && pdev->bus->self) {
383 ++ if (pdev->bus->self->vendor == PCI_VENDOR_ID_ATI &&
384 ++ ((pdev->bus->self->device & 0xff00) == 0x5a00)) {
385 ++ mtip_disable_link_opts(dd, pdev->bus->self);
386 ++ } else {
387 ++ /* Check further up the topology */
388 ++ struct pci_dev *parent_dev = pdev->bus->self;
389 ++ if (parent_dev->bus &&
390 ++ parent_dev->bus->parent &&
391 ++ parent_dev->bus->parent->self &&
392 ++ parent_dev->bus->parent->self->vendor ==
393 ++ PCI_VENDOR_ID_ATI &&
394 ++ (parent_dev->bus->parent->self->device &
395 ++ 0xff00) == 0x5a00) {
396 ++ mtip_disable_link_opts(dd,
397 ++ parent_dev->bus->parent->self);
398 ++ }
399 ++ }
400 ++ }
401 ++}
402 ++
403 + /*
404 + * Called for each supported PCI device detected.
405 + *
406 +@@ -4435,6 +4490,8 @@ static int mtip_pci_probe(struct pci_dev *pdev,
407 + goto block_initialize_err;
408 + }
409 +
410 ++ mtip_fix_ero_nosnoop(dd, pdev);
411 ++
412 + /* Initialize the block layer. */
413 + rv = mtip_block_initialize(dd);
414 + if (rv < 0) {
415 +@@ -4727,13 +4784,13 @@ static int __init mtip_init(void)
416 + */
417 + static void __exit mtip_exit(void)
418 + {
419 +- debugfs_remove_recursive(dfs_parent);
420 +-
421 + /* Release the allocated major block device number. */
422 + unregister_blkdev(mtip_major, MTIP_DRV_NAME);
423 +
424 + /* Unregister the PCI driver. */
425 + pci_unregister_driver(&mtip_pci_driver);
426 ++
427 ++ debugfs_remove_recursive(dfs_parent);
428 + }
429 +
430 + MODULE_AUTHOR("Micron Technology, Inc");
431 +diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
432 +index b56bdaa27d4b..9966fc0a527f 100644
433 +--- a/drivers/extcon/extcon-max77693.c
434 ++++ b/drivers/extcon/extcon-max77693.c
435 +@@ -1180,7 +1180,7 @@ static int max77693_muic_probe(struct platform_device *pdev)
436 +
437 +
438 + /* Initialize MUIC register by using platform data or default data */
439 +- if (pdata->muic_data) {
440 ++ if (pdata && pdata->muic_data) {
441 + init_data = pdata->muic_data->init_data;
442 + num_init_data = pdata->muic_data->num_init_data;
443 + } else {
444 +@@ -1213,7 +1213,7 @@ static int max77693_muic_probe(struct platform_device *pdev)
445 + = init_data[i].data;
446 + }
447 +
448 +- if (pdata->muic_data) {
449 ++ if (pdata && pdata->muic_data) {
450 + struct max77693_muic_platform_data *muic_pdata = pdata->muic_data;
451 +
452 + /*
453 +diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
454 +index f0d588f8859e..1acb99100556 100644
455 +--- a/drivers/infiniband/core/user_mad.c
456 ++++ b/drivers/infiniband/core/user_mad.c
457 +@@ -98,7 +98,7 @@ struct ib_umad_port {
458 +
459 + struct ib_umad_device {
460 + int start_port, end_port;
461 +- struct kref ref;
462 ++ struct kobject kobj;
463 + struct ib_umad_port port[0];
464 + };
465 +
466 +@@ -134,14 +134,18 @@ static DECLARE_BITMAP(dev_map, IB_UMAD_MAX_PORTS);
467 + static void ib_umad_add_one(struct ib_device *device);
468 + static void ib_umad_remove_one(struct ib_device *device);
469 +
470 +-static void ib_umad_release_dev(struct kref *ref)
471 ++static void ib_umad_release_dev(struct kobject *kobj)
472 + {
473 + struct ib_umad_device *dev =
474 +- container_of(ref, struct ib_umad_device, ref);
475 ++ container_of(kobj, struct ib_umad_device, kobj);
476 +
477 + kfree(dev);
478 + }
479 +
480 ++static struct kobj_type ib_umad_dev_ktype = {
481 ++ .release = ib_umad_release_dev,
482 ++};
483 ++
484 + static int hdr_size(struct ib_umad_file *file)
485 + {
486 + return file->use_pkey_index ? sizeof (struct ib_user_mad_hdr) :
487 +@@ -780,27 +784,19 @@ static int ib_umad_open(struct inode *inode, struct file *filp)
488 + {
489 + struct ib_umad_port *port;
490 + struct ib_umad_file *file;
491 +- int ret;
492 ++ int ret = -ENXIO;
493 +
494 + port = container_of(inode->i_cdev, struct ib_umad_port, cdev);
495 +- if (port)
496 +- kref_get(&port->umad_dev->ref);
497 +- else
498 +- return -ENXIO;
499 +
500 + mutex_lock(&port->file_mutex);
501 +
502 +- if (!port->ib_dev) {
503 +- ret = -ENXIO;
504 ++ if (!port->ib_dev)
505 + goto out;
506 +- }
507 +
508 ++ ret = -ENOMEM;
509 + file = kzalloc(sizeof *file, GFP_KERNEL);
510 +- if (!file) {
511 +- kref_put(&port->umad_dev->ref, ib_umad_release_dev);
512 +- ret = -ENOMEM;
513 ++ if (!file)
514 + goto out;
515 +- }
516 +
517 + mutex_init(&file->mutex);
518 + spin_lock_init(&file->send_lock);
519 +@@ -814,6 +810,13 @@ static int ib_umad_open(struct inode *inode, struct file *filp)
520 + list_add_tail(&file->port_list, &port->file_list);
521 +
522 + ret = nonseekable_open(inode, filp);
523 ++ if (ret) {
524 ++ list_del(&file->port_list);
525 ++ kfree(file);
526 ++ goto out;
527 ++ }
528 ++
529 ++ kobject_get(&port->umad_dev->kobj);
530 +
531 + out:
532 + mutex_unlock(&port->file_mutex);
533 +@@ -852,7 +855,7 @@ static int ib_umad_close(struct inode *inode, struct file *filp)
534 + mutex_unlock(&file->port->file_mutex);
535 +
536 + kfree(file);
537 +- kref_put(&dev->ref, ib_umad_release_dev);
538 ++ kobject_put(&dev->kobj);
539 +
540 + return 0;
541 + }
542 +@@ -880,10 +883,6 @@ static int ib_umad_sm_open(struct inode *inode, struct file *filp)
543 + int ret;
544 +
545 + port = container_of(inode->i_cdev, struct ib_umad_port, sm_cdev);
546 +- if (port)
547 +- kref_get(&port->umad_dev->ref);
548 +- else
549 +- return -ENXIO;
550 +
551 + if (filp->f_flags & O_NONBLOCK) {
552 + if (down_trylock(&port->sm_sem)) {
553 +@@ -898,17 +897,27 @@ static int ib_umad_sm_open(struct inode *inode, struct file *filp)
554 + }
555 +
556 + ret = ib_modify_port(port->ib_dev, port->port_num, 0, &props);
557 +- if (ret) {
558 +- up(&port->sm_sem);
559 +- goto fail;
560 +- }
561 ++ if (ret)
562 ++ goto err_up_sem;
563 +
564 + filp->private_data = port;
565 +
566 +- return nonseekable_open(inode, filp);
567 ++ ret = nonseekable_open(inode, filp);
568 ++ if (ret)
569 ++ goto err_clr_sm_cap;
570 ++
571 ++ kobject_get(&port->umad_dev->kobj);
572 ++
573 ++ return 0;
574 ++
575 ++err_clr_sm_cap:
576 ++ swap(props.set_port_cap_mask, props.clr_port_cap_mask);
577 ++ ib_modify_port(port->ib_dev, port->port_num, 0, &props);
578 ++
579 ++err_up_sem:
580 ++ up(&port->sm_sem);
581 +
582 + fail:
583 +- kref_put(&port->umad_dev->ref, ib_umad_release_dev);
584 + return ret;
585 + }
586 +
587 +@@ -927,7 +936,7 @@ static int ib_umad_sm_close(struct inode *inode, struct file *filp)
588 +
589 + up(&port->sm_sem);
590 +
591 +- kref_put(&port->umad_dev->ref, ib_umad_release_dev);
592 ++ kobject_put(&port->umad_dev->kobj);
593 +
594 + return ret;
595 + }
596 +@@ -995,6 +1004,7 @@ static int find_overflow_devnum(void)
597 + }
598 +
599 + static int ib_umad_init_port(struct ib_device *device, int port_num,
600 ++ struct ib_umad_device *umad_dev,
601 + struct ib_umad_port *port)
602 + {
603 + int devnum;
604 +@@ -1027,6 +1037,7 @@ static int ib_umad_init_port(struct ib_device *device, int port_num,
605 +
606 + cdev_init(&port->cdev, &umad_fops);
607 + port->cdev.owner = THIS_MODULE;
608 ++ port->cdev.kobj.parent = &umad_dev->kobj;
609 + kobject_set_name(&port->cdev.kobj, "umad%d", port->dev_num);
610 + if (cdev_add(&port->cdev, base, 1))
611 + goto err_cdev;
612 +@@ -1045,6 +1056,7 @@ static int ib_umad_init_port(struct ib_device *device, int port_num,
613 + base += IB_UMAD_MAX_PORTS;
614 + cdev_init(&port->sm_cdev, &umad_sm_fops);
615 + port->sm_cdev.owner = THIS_MODULE;
616 ++ port->sm_cdev.kobj.parent = &umad_dev->kobj;
617 + kobject_set_name(&port->sm_cdev.kobj, "issm%d", port->dev_num);
618 + if (cdev_add(&port->sm_cdev, base, 1))
619 + goto err_sm_cdev;
620 +@@ -1138,7 +1150,7 @@ static void ib_umad_add_one(struct ib_device *device)
621 + if (!umad_dev)
622 + return;
623 +
624 +- kref_init(&umad_dev->ref);
625 ++ kobject_init(&umad_dev->kobj, &ib_umad_dev_ktype);
626 +
627 + umad_dev->start_port = s;
628 + umad_dev->end_port = e;
629 +@@ -1146,7 +1158,8 @@ static void ib_umad_add_one(struct ib_device *device)
630 + for (i = s; i <= e; ++i) {
631 + umad_dev->port[i - s].umad_dev = umad_dev;
632 +
633 +- if (ib_umad_init_port(device, i, &umad_dev->port[i - s]))
634 ++ if (ib_umad_init_port(device, i, umad_dev,
635 ++ &umad_dev->port[i - s]))
636 + goto err;
637 + }
638 +
639 +@@ -1158,7 +1171,7 @@ err:
640 + while (--i >= s)
641 + ib_umad_kill_port(&umad_dev->port[i - s]);
642 +
643 +- kref_put(&umad_dev->ref, ib_umad_release_dev);
644 ++ kobject_put(&umad_dev->kobj);
645 + }
646 +
647 + static void ib_umad_remove_one(struct ib_device *device)
648 +@@ -1172,7 +1185,7 @@ static void ib_umad_remove_one(struct ib_device *device)
649 + for (i = 0; i <= umad_dev->end_port - umad_dev->start_port; ++i)
650 + ib_umad_kill_port(&umad_dev->port[i]);
651 +
652 +- kref_put(&umad_dev->ref, ib_umad_release_dev);
653 ++ kobject_put(&umad_dev->kobj);
654 + }
655 +
656 + static char *umad_devnode(struct device *dev, umode_t *mode)
657 +diff --git a/drivers/infiniband/hw/ipath/ipath_diag.c b/drivers/infiniband/hw/ipath/ipath_diag.c
658 +index e2f9a51f4a38..45802e97332e 100644
659 +--- a/drivers/infiniband/hw/ipath/ipath_diag.c
660 ++++ b/drivers/infiniband/hw/ipath/ipath_diag.c
661 +@@ -346,6 +346,10 @@ static ssize_t ipath_diagpkt_write(struct file *fp,
662 + ret = -EFAULT;
663 + goto bail;
664 + }
665 ++ dp.len = odp.len;
666 ++ dp.unit = odp.unit;
667 ++ dp.data = odp.data;
668 ++ dp.pbc_wd = 0;
669 + } else {
670 + ret = -EINVAL;
671 + goto bail;
672 +diff --git a/drivers/infiniband/hw/qib/qib_mad.c b/drivers/infiniband/hw/qib/qib_mad.c
673 +index ccb119143d20..1dd9fcbb7c9a 100644
674 +--- a/drivers/infiniband/hw/qib/qib_mad.c
675 ++++ b/drivers/infiniband/hw/qib/qib_mad.c
676 +@@ -1028,7 +1028,7 @@ static int set_pkeys(struct qib_devdata *dd, u8 port, u16 *pkeys)
677 +
678 + event.event = IB_EVENT_PKEY_CHANGE;
679 + event.device = &dd->verbs_dev.ibdev;
680 +- event.element.port_num = 1;
681 ++ event.element.port_num = port;
682 + ib_dispatch_event(&event);
683 + }
684 + return 0;
685 +diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
686 +index 793ac5dcee71..1954daac0b59 100644
687 +--- a/drivers/infiniband/ulp/srp/ib_srp.c
688 ++++ b/drivers/infiniband/ulp/srp/ib_srp.c
689 +@@ -1409,6 +1409,12 @@ err_unmap:
690 + err_iu:
691 + srp_put_tx_iu(target, iu, SRP_IU_CMD);
692 +
693 ++ /*
694 ++ * Avoid that the loops that iterate over the request ring can
695 ++ * encounter a dangling SCSI command pointer.
696 ++ */
697 ++ req->scmnd = NULL;
698 ++
699 + spin_lock_irqsave(&target->lock, flags);
700 + list_add(&req->list, &target->free_reqs);
701 +
702 +diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
703 +index 76f1d37ac0ff..1913301df08f 100644
704 +--- a/drivers/input/mouse/elantech.c
705 ++++ b/drivers/input/mouse/elantech.c
706 +@@ -473,8 +473,15 @@ static void elantech_report_absolute_v3(struct psmouse *psmouse,
707 + input_report_key(dev, BTN_TOOL_FINGER, fingers == 1);
708 + input_report_key(dev, BTN_TOOL_DOUBLETAP, fingers == 2);
709 + input_report_key(dev, BTN_TOOL_TRIPLETAP, fingers == 3);
710 +- input_report_key(dev, BTN_LEFT, packet[0] & 0x01);
711 +- input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);
712 ++
713 ++ /* For clickpads map both buttons to BTN_LEFT */
714 ++ if (etd->fw_version & 0x001000) {
715 ++ input_report_key(dev, BTN_LEFT, packet[0] & 0x03);
716 ++ } else {
717 ++ input_report_key(dev, BTN_LEFT, packet[0] & 0x01);
718 ++ input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);
719 ++ }
720 ++
721 + input_report_abs(dev, ABS_PRESSURE, pres);
722 + input_report_abs(dev, ABS_TOOL_WIDTH, width);
723 +
724 +@@ -484,10 +491,17 @@ static void elantech_report_absolute_v3(struct psmouse *psmouse,
725 + static void elantech_input_sync_v4(struct psmouse *psmouse)
726 + {
727 + struct input_dev *dev = psmouse->dev;
728 ++ struct elantech_data *etd = psmouse->private;
729 + unsigned char *packet = psmouse->packet;
730 +
731 +- input_report_key(dev, BTN_LEFT, packet[0] & 0x01);
732 +- input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);
733 ++ /* For clickpads map both buttons to BTN_LEFT */
734 ++ if (etd->fw_version & 0x001000) {
735 ++ input_report_key(dev, BTN_LEFT, packet[0] & 0x03);
736 ++ } else {
737 ++ input_report_key(dev, BTN_LEFT, packet[0] & 0x01);
738 ++ input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);
739 ++ }
740 ++
741 + input_mt_report_pointer_emulation(dev, true);
742 + input_sync(dev);
743 + }
744 +@@ -805,7 +819,7 @@ static int elantech_set_absolute_mode(struct psmouse *psmouse)
745 + if (etd->set_hw_resolution)
746 + etd->reg_10 = 0x0b;
747 + else
748 +- etd->reg_10 = 0x03;
749 ++ etd->reg_10 = 0x01;
750 +
751 + if (elantech_write_reg(psmouse, 0x10, etd->reg_10))
752 + rc = -1;
753 +@@ -1306,7 +1320,8 @@ static int elantech_reconnect(struct psmouse *psmouse)
754 + }
755 +
756 + /*
757 +- * Some hw_version 3 models go into error state when we try to set bit 3 of r10
758 ++ * Some hw_version 3 models go into error state when we try to set
759 ++ * bit 3 and/or bit 1 of r10.
760 + */
761 + static const struct dmi_system_id no_hw_res_dmi_table[] = {
762 + #if defined(CONFIG_DMI) && defined(CONFIG_X86)
763 +diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c
764 +index 06311c5ada36..297cc10a26da 100644
765 +--- a/drivers/misc/mei/hw-me.c
766 ++++ b/drivers/misc/mei/hw-me.c
767 +@@ -164,6 +164,9 @@ static void mei_me_hw_reset_release(struct mei_device *dev)
768 + hcsr |= H_IG;
769 + hcsr &= ~H_RST;
770 + mei_hcsr_set(hw, hcsr);
771 ++
772 ++ /* complete this write before we set host ready on another CPU */
773 ++ mmiowb();
774 + }
775 + /**
776 + * mei_me_hw_reset - resets fw via mei csr register.
777 +@@ -186,7 +189,19 @@ static void mei_me_hw_reset(struct mei_device *dev, bool intr_enable)
778 + dev->recvd_hw_ready = false;
779 + mei_me_reg_write(hw, H_CSR, hcsr);
780 +
781 +- if (dev->dev_state == MEI_DEV_POWER_DOWN)
782 ++ /*
783 ++ * Host reads the H_CSR once to ensure that the
784 ++ * posted write to H_CSR completes.
785 ++ */
786 ++ hcsr = mei_hcsr_read(hw);
787 ++
788 ++ if ((hcsr & H_RST) == 0)
789 ++ dev_warn(&dev->pdev->dev, "H_RST is not set = 0x%08X", hcsr);
790 ++
791 ++ if ((hcsr & H_RDY) == H_RDY)
792 ++ dev_warn(&dev->pdev->dev, "H_RDY is not cleared 0x%08X", hcsr);
793 ++
794 ++ if (intr_enable == false)
795 + mei_me_hw_reset_release(dev);
796 +
797 + dev_dbg(&dev->pdev->dev, "current HCSR = 0x%08x.\n", mei_hcsr_read(hw));
798 +@@ -202,6 +217,7 @@ static void mei_me_hw_reset(struct mei_device *dev, bool intr_enable)
799 + static void mei_me_host_set_ready(struct mei_device *dev)
800 + {
801 + struct mei_me_hw *hw = to_me_hw(dev);
802 ++ hw->host_hw_state = mei_hcsr_read(hw);
803 + hw->host_hw_state |= H_IE | H_IG | H_RDY;
804 + mei_hcsr_set(hw, hw->host_hw_state);
805 + }
806 +@@ -494,19 +510,15 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)
807 + /* check if we need to start the dev */
808 + if (!mei_host_is_ready(dev)) {
809 + if (mei_hw_is_ready(dev)) {
810 ++ mei_me_hw_reset_release(dev);
811 + dev_dbg(&dev->pdev->dev, "we need to start the dev.\n");
812 +
813 + dev->recvd_hw_ready = true;
814 + wake_up_interruptible(&dev->wait_hw_ready);
815 +-
816 +- mutex_unlock(&dev->device_lock);
817 +- return IRQ_HANDLED;
818 + } else {
819 +- dev_dbg(&dev->pdev->dev, "Reset Completed.\n");
820 +- mei_me_hw_reset_release(dev);
821 +- mutex_unlock(&dev->device_lock);
822 +- return IRQ_HANDLED;
823 ++ dev_dbg(&dev->pdev->dev, "Spurious Interrupt\n");
824 + }
825 ++ goto end;
826 + }
827 + /* check slots available for reading */
828 + slots = mei_count_full_read_slots(dev);
829 +diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
830 +index f30acaa84037..d6ceb2e45c59 100644
831 +--- a/drivers/pci/pci.c
832 ++++ b/drivers/pci/pci.c
833 +@@ -3659,7 +3659,7 @@ int pci_set_vga_state(struct pci_dev *dev, bool decode,
834 + u16 cmd;
835 + int rc;
836 +
837 +- WARN_ON((flags & PCI_VGA_STATE_CHANGE_DECODES) & (command_bits & ~(PCI_COMMAND_IO|PCI_COMMAND_MEMORY)));
838 ++ WARN_ON((flags & PCI_VGA_STATE_CHANGE_DECODES) && (command_bits & ~(PCI_COMMAND_IO|PCI_COMMAND_MEMORY)));
839 +
840 + /* ARCH specific VGA enables */
841 + rc = pci_set_vga_state_arch(dev, decode, command_bits, flags);
842 +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
843 +index df4655c5c138..4510279e28dc 100644
844 +--- a/drivers/pci/quirks.c
845 ++++ b/drivers/pci/quirks.c
846 +@@ -2930,6 +2930,7 @@ static void disable_igfx_irq(struct pci_dev *dev)
847 + }
848 + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0102, disable_igfx_irq);
849 + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq);
850 ++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0152, disable_igfx_irq);
851 +
852 + /*
853 + * Some devices may pass our check in pci_intx_mask_supported if
854 +diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
855 +index 72663ba228dc..799f84e686b5 100644
856 +--- a/drivers/target/iscsi/iscsi_target.c
857 ++++ b/drivers/target/iscsi/iscsi_target.c
858 +@@ -1313,7 +1313,7 @@ iscsit_check_dataout_hdr(struct iscsi_conn *conn, unsigned char *buf,
859 + if (cmd->data_direction != DMA_TO_DEVICE) {
860 + pr_err("Command ITT: 0x%08x received DataOUT for a"
861 + " NON-WRITE command.\n", cmd->init_task_tag);
862 +- return iscsit_reject_cmd(cmd, ISCSI_REASON_PROTOCOL_ERROR, buf);
863 ++ return iscsit_dump_data_payload(conn, payload_length, 1);
864 + }
865 + se_cmd = &cmd->se_cmd;
866 + iscsit_mod_dataout_timer(cmd);
867 +diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c
868 +index 77dad2474c8c..c9790f6fdd89 100644
869 +--- a/drivers/target/iscsi/iscsi_target_util.c
870 ++++ b/drivers/target/iscsi/iscsi_target_util.c
871 +@@ -1288,6 +1288,8 @@ int iscsit_tx_login_rsp(struct iscsi_conn *conn, u8 status_class, u8 status_deta
872 + login->login_failed = 1;
873 + iscsit_collect_login_stats(conn, status_class, status_detail);
874 +
875 ++ memset(&login->rsp[0], 0, ISCSI_HDR_LEN);
876 ++
877 + hdr = (struct iscsi_login_rsp *)&login->rsp[0];
878 + hdr->opcode = ISCSI_OP_LOGIN_RSP;
879 + hdr->status_class = status_class;
880 +diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
881 +index 8032917b6636..68398753eb82 100644
882 +--- a/drivers/target/target_core_device.c
883 ++++ b/drivers/target/target_core_device.c
884 +@@ -614,6 +614,7 @@ void core_dev_unexport(
885 + dev->export_count--;
886 + spin_unlock(&hba->device_lock);
887 +
888 ++ lun->lun_sep = NULL;
889 + lun->lun_se_dev = NULL;
890 + }
891 +
892 +diff --git a/drivers/watchdog/ath79_wdt.c b/drivers/watchdog/ath79_wdt.c
893 +index 37cb09b27b63..c97a47ca8971 100644
894 +--- a/drivers/watchdog/ath79_wdt.c
895 ++++ b/drivers/watchdog/ath79_wdt.c
896 +@@ -20,6 +20,7 @@
897 + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
898 +
899 + #include <linux/bitops.h>
900 ++#include <linux/delay.h>
901 + #include <linux/errno.h>
902 + #include <linux/fs.h>
903 + #include <linux/init.h>
904 +@@ -91,6 +92,15 @@ static inline void ath79_wdt_keepalive(void)
905 + static inline void ath79_wdt_enable(void)
906 + {
907 + ath79_wdt_keepalive();
908 ++
909 ++ /*
910 ++ * Updating the TIMER register requires a few microseconds
911 ++ * on the AR934x SoCs at least. Use a small delay to ensure
912 ++ * that the TIMER register is updated within the hardware
913 ++ * before enabling the watchdog.
914 ++ */
915 ++ udelay(2);
916 ++
917 + ath79_wdt_wr(WDOG_REG_CTRL, WDOG_CTRL_ACTION_FCR);
918 + /* flush write */
919 + ath79_wdt_rr(WDOG_REG_CTRL);
920 +diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c
921 +index 8872642505c0..e42118213ba5 100644
922 +--- a/drivers/watchdog/sp805_wdt.c
923 ++++ b/drivers/watchdog/sp805_wdt.c
924 +@@ -60,7 +60,6 @@
925 + * @adev: amba device structure of wdt
926 + * @status: current status of wdt
927 + * @load_val: load value to be set for current timeout
928 +- * @timeout: current programmed timeout
929 + */
930 + struct sp805_wdt {
931 + struct watchdog_device wdd;
932 +@@ -69,7 +68,6 @@ struct sp805_wdt {
933 + struct clk *clk;
934 + struct amba_device *adev;
935 + unsigned int load_val;
936 +- unsigned int timeout;
937 + };
938 +
939 + static bool nowayout = WATCHDOG_NOWAYOUT;
940 +@@ -99,7 +97,7 @@ static int wdt_setload(struct watchdog_device *wdd, unsigned int timeout)
941 + spin_lock(&wdt->lock);
942 + wdt->load_val = load;
943 + /* roundup timeout to closest positive integer value */
944 +- wdt->timeout = div_u64((load + 1) * 2 + (rate / 2), rate);
945 ++ wdd->timeout = div_u64((load + 1) * 2 + (rate / 2), rate);
946 + spin_unlock(&wdt->lock);
947 +
948 + return 0;
949 +diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
950 +index c1c7a9d78722..cd4b9073dd20 100644
951 +--- a/fs/nfs/inode.c
952 ++++ b/fs/nfs/inode.c
953 +@@ -1382,18 +1382,20 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
954 + inode->i_version = fattr->change_attr;
955 + }
956 + } else if (server->caps & NFS_CAP_CHANGE_ATTR)
957 +- invalid |= save_cache_validity;
958 ++ nfsi->cache_validity |= save_cache_validity;
959 +
960 + if (fattr->valid & NFS_ATTR_FATTR_MTIME) {
961 + memcpy(&inode->i_mtime, &fattr->mtime, sizeof(inode->i_mtime));
962 + } else if (server->caps & NFS_CAP_MTIME)
963 +- invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
964 ++ nfsi->cache_validity |= save_cache_validity &
965 ++ (NFS_INO_INVALID_ATTR
966 + | NFS_INO_REVAL_FORCED);
967 +
968 + if (fattr->valid & NFS_ATTR_FATTR_CTIME) {
969 + memcpy(&inode->i_ctime, &fattr->ctime, sizeof(inode->i_ctime));
970 + } else if (server->caps & NFS_CAP_CTIME)
971 +- invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
972 ++ nfsi->cache_validity |= save_cache_validity &
973 ++ (NFS_INO_INVALID_ATTR
974 + | NFS_INO_REVAL_FORCED);
975 +
976 + /* Check if our cached file size is stale */
977 +@@ -1416,7 +1418,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
978 + (long long)new_isize);
979 + }
980 + } else
981 +- invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
982 ++ nfsi->cache_validity |= save_cache_validity &
983 ++ (NFS_INO_INVALID_ATTR
984 + | NFS_INO_REVAL_PAGECACHE
985 + | NFS_INO_REVAL_FORCED);
986 +
987 +@@ -1424,7 +1427,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
988 + if (fattr->valid & NFS_ATTR_FATTR_ATIME)
989 + memcpy(&inode->i_atime, &fattr->atime, sizeof(inode->i_atime));
990 + else if (server->caps & NFS_CAP_ATIME)
991 +- invalid |= save_cache_validity & (NFS_INO_INVALID_ATIME
992 ++ nfsi->cache_validity |= save_cache_validity &
993 ++ (NFS_INO_INVALID_ATIME
994 + | NFS_INO_REVAL_FORCED);
995 +
996 + if (fattr->valid & NFS_ATTR_FATTR_MODE) {
997 +@@ -1435,7 +1439,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
998 + invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL;
999 + }
1000 + } else if (server->caps & NFS_CAP_MODE)
1001 +- invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
1002 ++ nfsi->cache_validity |= save_cache_validity &
1003 ++ (NFS_INO_INVALID_ATTR
1004 + | NFS_INO_INVALID_ACCESS
1005 + | NFS_INO_INVALID_ACL
1006 + | NFS_INO_REVAL_FORCED);
1007 +@@ -1446,7 +1451,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
1008 + inode->i_uid = fattr->uid;
1009 + }
1010 + } else if (server->caps & NFS_CAP_OWNER)
1011 +- invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
1012 ++ nfsi->cache_validity |= save_cache_validity &
1013 ++ (NFS_INO_INVALID_ATTR
1014 + | NFS_INO_INVALID_ACCESS
1015 + | NFS_INO_INVALID_ACL
1016 + | NFS_INO_REVAL_FORCED);
1017 +@@ -1457,7 +1463,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
1018 + inode->i_gid = fattr->gid;
1019 + }
1020 + } else if (server->caps & NFS_CAP_OWNER_GROUP)
1021 +- invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
1022 ++ nfsi->cache_validity |= save_cache_validity &
1023 ++ (NFS_INO_INVALID_ATTR
1024 + | NFS_INO_INVALID_ACCESS
1025 + | NFS_INO_INVALID_ACL
1026 + | NFS_INO_REVAL_FORCED);
1027 +@@ -1470,7 +1477,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
1028 + set_nlink(inode, fattr->nlink);
1029 + }
1030 + } else if (server->caps & NFS_CAP_NLINK)
1031 +- invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
1032 ++ nfsi->cache_validity |= save_cache_validity &
1033 ++ (NFS_INO_INVALID_ATTR
1034 + | NFS_INO_REVAL_FORCED);
1035 +
1036 + if (fattr->valid & NFS_ATTR_FATTR_SPACE_USED) {
1037 +diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
1038 +index 22d10623f5ee..b039f7f26d95 100644
1039 +--- a/fs/nfs/nfs4filelayout.c
1040 ++++ b/fs/nfs/nfs4filelayout.c
1041 +@@ -1300,7 +1300,7 @@ filelayout_alloc_layout_hdr(struct inode *inode, gfp_t gfp_flags)
1042 + struct nfs4_filelayout *flo;
1043 +
1044 + flo = kzalloc(sizeof(*flo), gfp_flags);
1045 +- return &flo->generic_hdr;
1046 ++ return flo != NULL ? &flo->generic_hdr : NULL;
1047 + }
1048 +
1049 + static void
1050 +diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
1051 +index ae6a50b7a617..bdff771057d3 100644
1052 +--- a/fs/nfsd/nfs4state.c
1053 ++++ b/fs/nfsd/nfs4state.c
1054 +@@ -3608,7 +3608,7 @@ nfsd4_free_lock_stateid(struct nfs4_ol_stateid *stp)
1055 + * correspondance, and we have to delete the lockowner when we
1056 + * delete the lock stateid:
1057 + */
1058 +- unhash_lockowner(lo);
1059 ++ release_lockowner(lo);
1060 + return nfs_ok;
1061 + }
1062 +
1063 +diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
1064 +index 5188a38fef06..d4890a96421e 100644
1065 +--- a/fs/nfsd/nfs4xdr.c
1066 ++++ b/fs/nfsd/nfs4xdr.c
1067 +@@ -2035,8 +2035,8 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
1068 + err = vfs_getattr(&path, &stat);
1069 + if (err)
1070 + goto out_nfserr;
1071 +- if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL |
1072 +- FATTR4_WORD0_MAXNAME)) ||
1073 ++ if ((bmval0 & (FATTR4_WORD0_FILES_AVAIL | FATTR4_WORD0_FILES_FREE |
1074 ++ FATTR4_WORD0_FILES_TOTAL | FATTR4_WORD0_MAXNAME)) ||
1075 + (bmval1 & (FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE |
1076 + FATTR4_WORD1_SPACE_TOTAL))) {
1077 + err = vfs_statfs(&path, &statfs);
1078 +diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c
1079 +index ec8d97ddc635..e5e4675b7e75 100644
1080 +--- a/fs/nfsd/nfscache.c
1081 ++++ b/fs/nfsd/nfscache.c
1082 +@@ -129,13 +129,6 @@ nfsd_reply_cache_alloc(void)
1083 + }
1084 +
1085 + static void
1086 +-nfsd_reply_cache_unhash(struct svc_cacherep *rp)
1087 +-{
1088 +- hlist_del_init(&rp->c_hash);
1089 +- list_del_init(&rp->c_lru);
1090 +-}
1091 +-
1092 +-static void
1093 + nfsd_reply_cache_free_locked(struct svc_cacherep *rp)
1094 + {
1095 + if (rp->c_type == RC_REPLBUFF && rp->c_replvec.iov_base) {
1096 +@@ -228,13 +221,6 @@ hash_refile(struct svc_cacherep *rp)
1097 + hlist_add_head(&rp->c_hash, cache_hash + hash_32(rp->c_xid, maskbits));
1098 + }
1099 +
1100 +-static inline bool
1101 +-nfsd_cache_entry_expired(struct svc_cacherep *rp)
1102 +-{
1103 +- return rp->c_state != RC_INPROG &&
1104 +- time_after(jiffies, rp->c_timestamp + RC_EXPIRE);
1105 +-}
1106 +-
1107 + /*
1108 + * Walk the LRU list and prune off entries that are older than RC_EXPIRE.
1109 + * Also prune the oldest ones when the total exceeds the max number of entries.
1110 +@@ -245,8 +231,14 @@ prune_cache_entries(void)
1111 + struct svc_cacherep *rp, *tmp;
1112 +
1113 + list_for_each_entry_safe(rp, tmp, &lru_head, c_lru) {
1114 +- if (!nfsd_cache_entry_expired(rp) &&
1115 +- num_drc_entries <= max_drc_entries)
1116 ++ /*
1117 ++ * Don't free entries attached to calls that are still
1118 ++ * in-progress, but do keep scanning the list.
1119 ++ */
1120 ++ if (rp->c_state == RC_INPROG)
1121 ++ continue;
1122 ++ if (num_drc_entries <= max_drc_entries &&
1123 ++ time_before(jiffies, rp->c_timestamp + RC_EXPIRE))
1124 + break;
1125 + nfsd_reply_cache_free_locked(rp);
1126 + }
1127 +@@ -402,22 +394,8 @@ nfsd_cache_lookup(struct svc_rqst *rqstp)
1128 +
1129 + /*
1130 + * Since the common case is a cache miss followed by an insert,
1131 +- * preallocate an entry. First, try to reuse the first entry on the LRU
1132 +- * if it works, then go ahead and prune the LRU list.
1133 ++ * preallocate an entry.
1134 + */
1135 +- spin_lock(&cache_lock);
1136 +- if (!list_empty(&lru_head)) {
1137 +- rp = list_first_entry(&lru_head, struct svc_cacherep, c_lru);
1138 +- if (nfsd_cache_entry_expired(rp) ||
1139 +- num_drc_entries >= max_drc_entries) {
1140 +- nfsd_reply_cache_unhash(rp);
1141 +- prune_cache_entries();
1142 +- goto search_cache;
1143 +- }
1144 +- }
1145 +-
1146 +- /* No expired ones available, allocate a new one. */
1147 +- spin_unlock(&cache_lock);
1148 + rp = nfsd_reply_cache_alloc();
1149 + spin_lock(&cache_lock);
1150 + if (likely(rp)) {
1151 +@@ -425,7 +403,9 @@ nfsd_cache_lookup(struct svc_rqst *rqstp)
1152 + drc_mem_usage += sizeof(*rp);
1153 + }
1154 +
1155 +-search_cache:
1156 ++ /* go ahead and prune the cache */
1157 ++ prune_cache_entries();
1158 ++
1159 + found = nfsd_cache_search(rqstp, csum);
1160 + if (found) {
1161 + if (likely(rp))
1162 +@@ -439,15 +419,6 @@ search_cache:
1163 + goto out;
1164 + }
1165 +
1166 +- /*
1167 +- * We're keeping the one we just allocated. Are we now over the
1168 +- * limit? Prune one off the tip of the LRU in trade for the one we
1169 +- * just allocated if so.
1170 +- */
1171 +- if (num_drc_entries >= max_drc_entries)
1172 +- nfsd_reply_cache_free_locked(list_first_entry(&lru_head,
1173 +- struct svc_cacherep, c_lru));
1174 +-
1175 + nfsdstats.rcmisses++;
1176 + rqstp->rq_cacherep = rp;
1177 + rp->c_state = RC_INPROG;
1178 +diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
1179 +index f844533792ee..36166443bc45 100644
1180 +--- a/fs/reiserfs/inode.c
1181 ++++ b/fs/reiserfs/inode.c
1182 +@@ -3211,8 +3211,14 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
1183 + attr->ia_size != i_size_read(inode)) {
1184 + error = inode_newsize_ok(inode, attr->ia_size);
1185 + if (!error) {
1186 ++ /*
1187 ++ * Could race against reiserfs_file_release
1188 ++ * if called from NFS, so take tailpack mutex.
1189 ++ */
1190 ++ mutex_lock(&REISERFS_I(inode)->tailpack);
1191 + truncate_setsize(inode, attr->ia_size);
1192 +- reiserfs_vfs_truncate_file(inode);
1193 ++ reiserfs_truncate_file(inode, 1);
1194 ++ mutex_unlock(&REISERFS_I(inode)->tailpack);
1195 + }
1196 + }
1197 +
1198 +diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
1199 +index 14374530784c..881324c08430 100644
1200 +--- a/fs/ubifs/file.c
1201 ++++ b/fs/ubifs/file.c
1202 +@@ -1524,8 +1524,7 @@ static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma,
1203 + }
1204 +
1205 + wait_for_stable_page(page);
1206 +- unlock_page(page);
1207 +- return 0;
1208 ++ return VM_FAULT_LOCKED;
1209 +
1210 + out_unlock:
1211 + unlock_page(page);
1212 +diff --git a/fs/ubifs/shrinker.c b/fs/ubifs/shrinker.c
1213 +index 9e1d05666fed..e0a7a764a903 100644
1214 +--- a/fs/ubifs/shrinker.c
1215 ++++ b/fs/ubifs/shrinker.c
1216 +@@ -128,7 +128,6 @@ static int shrink_tnc(struct ubifs_info *c, int nr, int age, int *contention)
1217 + freed = ubifs_destroy_tnc_subtree(znode);
1218 + atomic_long_sub(freed, &ubifs_clean_zn_cnt);
1219 + atomic_long_sub(freed, &c->clean_zn_cnt);
1220 +- ubifs_assert(atomic_long_read(&c->clean_zn_cnt) >= 0);
1221 + total_freed += freed;
1222 + znode = zprev;
1223 + }
1224 +diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
1225 +index 2e99b8e08770..bb980ae6d9d3 100644
1226 +--- a/include/linux/ptrace.h
1227 ++++ b/include/linux/ptrace.h
1228 +@@ -337,6 +337,9 @@ static inline void user_single_step_siginfo(struct task_struct *tsk,
1229 + * calling arch_ptrace_stop() when it would be superfluous. For example,
1230 + * if the thread has not been back to user mode since the last stop, the
1231 + * thread state might indicate that nothing needs to be done.
1232 ++ *
1233 ++ * This is guaranteed to be invoked once before a task stops for ptrace and
1234 ++ * may include arch-specific operations necessary prior to a ptrace stop.
1235 + */
1236 + #define arch_ptrace_stop_needed(code, info) (0)
1237 + #endif
1238 +diff --git a/include/trace/syscall.h b/include/trace/syscall.h
1239 +index 84bc4197e736..0a5b4952aa30 100644
1240 +--- a/include/trace/syscall.h
1241 ++++ b/include/trace/syscall.h
1242 +@@ -4,6 +4,7 @@
1243 + #include <linux/tracepoint.h>
1244 + #include <linux/unistd.h>
1245 + #include <linux/ftrace_event.h>
1246 ++#include <linux/thread_info.h>
1247 +
1248 + #include <asm/ptrace.h>
1249 +
1250 +@@ -31,4 +32,18 @@ struct syscall_metadata {
1251 + struct ftrace_event_call *exit_event;
1252 + };
1253 +
1254 ++#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
1255 ++static inline void syscall_tracepoint_update(struct task_struct *p)
1256 ++{
1257 ++ if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
1258 ++ set_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT);
1259 ++ else
1260 ++ clear_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT);
1261 ++}
1262 ++#else
1263 ++static inline void syscall_tracepoint_update(struct task_struct *p)
1264 ++{
1265 ++}
1266 ++#endif
1267 ++
1268 + #endif /* _TRACE_SYSCALL_H */
1269 +diff --git a/kernel/fork.c b/kernel/fork.c
1270 +index 270c1dab674a..814363a69b80 100644
1271 +--- a/kernel/fork.c
1272 ++++ b/kernel/fork.c
1273 +@@ -1479,7 +1479,9 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1274 +
1275 + total_forks++;
1276 + spin_unlock(&current->sighand->siglock);
1277 ++ syscall_tracepoint_update(p);
1278 + write_unlock_irq(&tasklist_lock);
1279 ++
1280 + proc_fork_connector(p);
1281 + cgroup_post_fork(p);
1282 + if (clone_flags & CLONE_THREAD)
1283 +diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
1284 +index 6dbdf277c8fe..60f49637b4d5 100644
1285 +--- a/kernel/trace/trace.c
1286 ++++ b/kernel/trace/trace.c
1287 +@@ -1400,12 +1400,12 @@ static void tracing_stop_tr(struct trace_array *tr)
1288 +
1289 + void trace_stop_cmdline_recording(void);
1290 +
1291 +-static void trace_save_cmdline(struct task_struct *tsk)
1292 ++static int trace_save_cmdline(struct task_struct *tsk)
1293 + {
1294 + unsigned pid, idx;
1295 +
1296 + if (!tsk->pid || unlikely(tsk->pid > PID_MAX_DEFAULT))
1297 +- return;
1298 ++ return 0;
1299 +
1300 + /*
1301 + * It's not the end of the world if we don't get
1302 +@@ -1414,7 +1414,7 @@ static void trace_save_cmdline(struct task_struct *tsk)
1303 + * so if we miss here, then better luck next time.
1304 + */
1305 + if (!arch_spin_trylock(&trace_cmdline_lock))
1306 +- return;
1307 ++ return 0;
1308 +
1309 + idx = map_pid_to_cmdline[tsk->pid];
1310 + if (idx == NO_CMDLINE_MAP) {
1311 +@@ -1439,6 +1439,8 @@ static void trace_save_cmdline(struct task_struct *tsk)
1312 + memcpy(&saved_cmdlines[idx], tsk->comm, TASK_COMM_LEN);
1313 +
1314 + arch_spin_unlock(&trace_cmdline_lock);
1315 ++
1316 ++ return 1;
1317 + }
1318 +
1319 + void trace_find_cmdline(int pid, char comm[])
1320 +@@ -1480,9 +1482,8 @@ void tracing_record_cmdline(struct task_struct *tsk)
1321 + if (!__this_cpu_read(trace_cmdline_save))
1322 + return;
1323 +
1324 +- __this_cpu_write(trace_cmdline_save, false);
1325 +-
1326 +- trace_save_cmdline(tsk);
1327 ++ if (trace_save_cmdline(tsk))
1328 ++ __this_cpu_write(trace_cmdline_save, false);
1329 + }
1330 +
1331 + void
1332 +diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c
1333 +index 32b0e978c8e0..f8629c04f35b 100644
1334 +--- a/net/ipv4/netfilter/ipt_ULOG.c
1335 ++++ b/net/ipv4/netfilter/ipt_ULOG.c
1336 +@@ -220,6 +220,7 @@ static void ipt_ulog_packet(struct net *net,
1337 + ub->qlen++;
1338 +
1339 + pm = nlmsg_data(nlh);
1340 ++ memset(pm, 0, sizeof(*pm));
1341 +
1342 + /* We might not have a timestamp, get one */
1343 + if (skb->tstamp.tv64 == 0)
1344 +@@ -238,8 +239,6 @@ static void ipt_ulog_packet(struct net *net,
1345 + }
1346 + else if (loginfo->prefix[0] != '\0')
1347 + strncpy(pm->prefix, loginfo->prefix, sizeof(pm->prefix));
1348 +- else
1349 +- *(pm->prefix) = '\0';
1350 +
1351 + if (in && in->hard_header_len > 0 &&
1352 + skb->mac_header != skb->network_header &&
1353 +@@ -251,13 +250,9 @@ static void ipt_ulog_packet(struct net *net,
1354 +
1355 + if (in)
1356 + strncpy(pm->indev_name, in->name, sizeof(pm->indev_name));
1357 +- else
1358 +- pm->indev_name[0] = '\0';
1359 +
1360 + if (out)
1361 + strncpy(pm->outdev_name, out->name, sizeof(pm->outdev_name));
1362 +- else
1363 +- pm->outdev_name[0] = '\0';
1364 +
1365 + /* copy_len <= skb->len, so can't fail. */
1366 + if (skb_copy_bits(skb, 0, pm->payload, copy_len) < 0)
1367 +diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
1368 +index 21a3a475d7cd..663042e84e81 100644
1369 +--- a/net/netfilter/ipvs/ip_vs_core.c
1370 ++++ b/net/netfilter/ipvs/ip_vs_core.c
1371 +@@ -1384,15 +1384,19 @@ ip_vs_in_icmp(struct sk_buff *skb, int *related, unsigned int hooknum)
1372 +
1373 + if (ipip) {
1374 + __be32 info = ic->un.gateway;
1375 ++ __u8 type = ic->type;
1376 ++ __u8 code = ic->code;
1377 +
1378 + /* Update the MTU */
1379 + if (ic->type == ICMP_DEST_UNREACH &&
1380 + ic->code == ICMP_FRAG_NEEDED) {
1381 + struct ip_vs_dest *dest = cp->dest;
1382 + u32 mtu = ntohs(ic->un.frag.mtu);
1383 ++ __be16 frag_off = cih->frag_off;
1384 +
1385 + /* Strip outer IP and ICMP, go to IPIP header */
1386 +- __skb_pull(skb, ihl + sizeof(_icmph));
1387 ++ if (pskb_pull(skb, ihl + sizeof(_icmph)) == NULL)
1388 ++ goto ignore_ipip;
1389 + offset2 -= ihl + sizeof(_icmph);
1390 + skb_reset_network_header(skb);
1391 + IP_VS_DBG(12, "ICMP for IPIP %pI4->%pI4: mtu=%u\n",
1392 +@@ -1400,7 +1404,7 @@ ip_vs_in_icmp(struct sk_buff *skb, int *related, unsigned int hooknum)
1393 + ipv4_update_pmtu(skb, dev_net(skb->dev),
1394 + mtu, 0, 0, 0, 0);
1395 + /* Client uses PMTUD? */
1396 +- if (!(cih->frag_off & htons(IP_DF)))
1397 ++ if (!(frag_off & htons(IP_DF)))
1398 + goto ignore_ipip;
1399 + /* Prefer the resulting PMTU */
1400 + if (dest) {
1401 +@@ -1419,12 +1423,13 @@ ip_vs_in_icmp(struct sk_buff *skb, int *related, unsigned int hooknum)
1402 + /* Strip outer IP, ICMP and IPIP, go to IP header of
1403 + * original request.
1404 + */
1405 +- __skb_pull(skb, offset2);
1406 ++ if (pskb_pull(skb, offset2) == NULL)
1407 ++ goto ignore_ipip;
1408 + skb_reset_network_header(skb);
1409 + IP_VS_DBG(12, "Sending ICMP for %pI4->%pI4: t=%u, c=%u, i=%u\n",
1410 + &ip_hdr(skb)->saddr, &ip_hdr(skb)->daddr,
1411 +- ic->type, ic->code, ntohl(info));
1412 +- icmp_send(skb, ic->type, ic->code, info);
1413 ++ type, code, ntohl(info));
1414 ++ icmp_send(skb, type, code, info);
1415 + /* ICMP can be shorter but anyways, account it */
1416 + ip_vs_out_stats(cp, skb);
1417 +
1418 +diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
1419 +index 80a6640f329b..b9aad4723a9d 100644
1420 +--- a/net/sunrpc/svc_xprt.c
1421 ++++ b/net/sunrpc/svc_xprt.c
1422 +@@ -730,6 +730,8 @@ static int svc_handle_xprt(struct svc_rqst *rqstp, struct svc_xprt *xprt)
1423 + newxpt = xprt->xpt_ops->xpo_accept(xprt);
1424 + if (newxpt)
1425 + svc_add_new_temp_xprt(serv, newxpt);
1426 ++ else
1427 ++ module_put(xprt->xpt_class->xcl_owner);
1428 + } else if (xprt->xpt_ops->xpo_has_wspace(xprt)) {
1429 + /* XPT_DATA|XPT_DEFERRED case: */
1430 + dprintk("svc: server %p, pool %u, transport %p, inuse=%d\n",
1431 +diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h
1432 +index 9d1421e63ff8..49b582a225b0 100644
1433 +--- a/scripts/recordmcount.h
1434 ++++ b/scripts/recordmcount.h
1435 +@@ -163,11 +163,11 @@ static int mcount_adjust = 0;
1436 +
1437 + static int MIPS_is_fake_mcount(Elf_Rel const *rp)
1438 + {
1439 +- static Elf_Addr old_r_offset;
1440 ++ static Elf_Addr old_r_offset = ~(Elf_Addr)0;
1441 + Elf_Addr current_r_offset = _w(rp->r_offset);
1442 + int is_fake;
1443 +
1444 +- is_fake = old_r_offset &&
1445 ++ is_fake = (old_r_offset != ~(Elf_Addr)0) &&
1446 + (current_r_offset - old_r_offset == MIPS_FAKEMCOUNT_OFFSET);
1447 + old_r_offset = current_r_offset;
1448 +