aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-20 23:00:43 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-20 23:00:43 -0500
commit4c9a44aebeaef35570a67aed17b72a2cf8d0b219 (patch)
treeabb874fe7f50671627b282f6c7fb58db5e75a2e3
parent1f0377ff088ed2971c57debc9b0c3b846ec431fd (diff)
parentcfde819088422503b5c69e03ab7bb90f87121d4d (diff)
Merge branch 'akpm' (Andrew's patch-bomb)
Merge the rest of Andrew's patches for -rc1: "A bunch of fixes and misc missed-out-on things. That'll do for -rc1. I still have a batch of IPC patches which still have a possible bug report which I'm chasing down." * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (25 commits) keys: use keyring_alloc() to create module signing keyring keys: fix unreachable code sendfile: allows bypassing of notifier events SGI-XP: handle non-fatal traps fat: fix incorrect function comment Documentation: ABI: remove testing/sysfs-devices-node proc: fix inconsistent lock state linux/kernel.h: fix DIV_ROUND_CLOSEST with unsigned divisors memcg: don't register hotcpu notifier from ->css_alloc() checkpatch: warn on uapi #includes that #include <uapi/... revert "rtc: recycle id when unloading a rtc driver" mm: clean up transparent hugepage sysfs error messages hfsplus: add error message for the case of failure of sync fs in delayed_sync_fs() method hfsplus: rework processing of hfs_btree_write() returned error hfsplus: rework processing errors in hfsplus_free_extents() hfsplus: avoid crash on failed block map free kcmp: include linux/ptrace.h drivers/rtc/rtc-imxdi.c: must include <linux/spinlock.h> mm: cma: WARN if freed memory is still in use exec: do not leave bprm->interp on stack ...
-rw-r--r--Documentation/ABI/testing/sysfs-devices-node7
-rw-r--r--Documentation/kernel-parameters.txt6
-rw-r--r--drivers/firmware/dmi_scan.c78
-rw-r--r--drivers/misc/sgi-xp/xpc_main.c34
-rw-r--r--drivers/rtc/class.c1
-rw-r--r--drivers/rtc/rtc-imxdi.c1
-rw-r--r--fs/binfmt_misc.c5
-rw-r--r--fs/binfmt_script.c4
-rw-r--r--fs/exec.c15
-rw-r--r--fs/fat/dir.c5
-rw-r--r--fs/fat/inode.c2
-rw-r--r--fs/fat/misc.c4
-rw-r--r--fs/hfsplus/bitmap.c13
-rw-r--r--fs/hfsplus/btree.c5
-rw-r--r--fs/hfsplus/extents.c24
-rw-r--r--fs/hfsplus/hfsplus_fs.h2
-rw-r--r--fs/hfsplus/super.c15
-rw-r--r--fs/proc/generic.c12
-rw-r--r--fs/read_write.c2
-rw-r--r--include/linux/binfmts.h1
-rw-r--r--include/linux/kernel.h6
-rw-r--r--kernel/kcmp.c1
-rw-r--r--kernel/modsign_pubkey.c15
-rw-r--r--mm/compaction.c26
-rw-r--r--mm/huge_memory.c6
-rw-r--r--mm/memcontrol.c14
-rw-r--r--mm/page-writeback.c25
-rw-r--r--mm/page_alloc.c11
-rwxr-xr-xscripts/checkpatch.pl7
-rw-r--r--security/keys/process_keys.c2
30 files changed, 261 insertions, 88 deletions
diff --git a/Documentation/ABI/testing/sysfs-devices-node b/Documentation/ABI/testing/sysfs-devices-node
deleted file mode 100644
index 453a210c3ceb..000000000000
--- a/Documentation/ABI/testing/sysfs-devices-node
+++ /dev/null
@@ -1,7 +0,0 @@
1What: /sys/devices/system/node/nodeX/compact
2Date: February 2010
3Contact: Mel Gorman <mel@csn.ul.ie>
4Description:
5 When this file is written to, all memory within that node
6 will be compacted. When it completes, memory will be freed
7 into blocks which have as many contiguous pages as possible
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index ddd84d627185..363e348bff9b 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -446,12 +446,6 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
446 possible to determine what the correct size should be. 446 possible to determine what the correct size should be.
447 This option provides an override for these situations. 447 This option provides an override for these situations.
448 448
449 capability.disable=
450 [SECURITY] Disable capabilities. This would normally
451 be used only if an alternative security model is to be
452 configured. Potentially dangerous and should only be
453 used if you are entirely sure of the consequences.
454
455 ccw_timeout_log [S390] 449 ccw_timeout_log [S390]
456 See Documentation/s390/CommonIO for details. 450 See Documentation/s390/CommonIO for details.
457 451
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index b298158cb922..fd3ae6290d71 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -16,6 +16,7 @@
16 */ 16 */
17static char dmi_empty_string[] = " "; 17static char dmi_empty_string[] = " ";
18 18
19static u16 __initdata dmi_ver;
19/* 20/*
20 * Catch too early calls to dmi_check_system(): 21 * Catch too early calls to dmi_check_system():
21 */ 22 */
@@ -118,12 +119,12 @@ static int __init dmi_walk_early(void (*decode)(const struct dmi_header *,
118 return 0; 119 return 0;
119} 120}
120 121
121static int __init dmi_checksum(const u8 *buf) 122static int __init dmi_checksum(const u8 *buf, u8 len)
122{ 123{
123 u8 sum = 0; 124 u8 sum = 0;
124 int a; 125 int a;
125 126
126 for (a = 0; a < 15; a++) 127 for (a = 0; a < len; a++)
127 sum += buf[a]; 128 sum += buf[a];
128 129
129 return sum == 0; 130 return sum == 0;
@@ -161,8 +162,10 @@ static void __init dmi_save_uuid(const struct dmi_header *dm, int slot, int inde
161 return; 162 return;
162 163
163 for (i = 0; i < 16 && (is_ff || is_00); i++) { 164 for (i = 0; i < 16 && (is_ff || is_00); i++) {
164 if(d[i] != 0x00) is_ff = 0; 165 if (d[i] != 0x00)
165 if(d[i] != 0xFF) is_00 = 0; 166 is_00 = 0;
167 if (d[i] != 0xFF)
168 is_ff = 0;
166 } 169 }
167 170
168 if (is_ff || is_00) 171 if (is_ff || is_00)
@@ -172,7 +175,15 @@ static void __init dmi_save_uuid(const struct dmi_header *dm, int slot, int inde
172 if (!s) 175 if (!s)
173 return; 176 return;
174 177
175 sprintf(s, "%pUB", d); 178 /*
179 * As of version 2.6 of the SMBIOS specification, the first 3 fields of
180 * the UUID are supposed to be little-endian encoded. The specification
181 * says that this is the defacto standard.
182 */
183 if (dmi_ver >= 0x0206)
184 sprintf(s, "%pUL", d);
185 else
186 sprintf(s, "%pUB", d);
176 187
177 dmi_ident[slot] = s; 188 dmi_ident[slot] = s;
178} 189}
@@ -404,29 +415,57 @@ static int __init dmi_present(const char __iomem *p)
404 u8 buf[15]; 415 u8 buf[15];
405 416
406 memcpy_fromio(buf, p, 15); 417 memcpy_fromio(buf, p, 15);
407 if ((memcmp(buf, "_DMI_", 5) == 0) && dmi_checksum(buf)) { 418 if (dmi_checksum(buf, 15)) {
408 dmi_num = (buf[13] << 8) | buf[12]; 419 dmi_num = (buf[13] << 8) | buf[12];
409 dmi_len = (buf[7] << 8) | buf[6]; 420 dmi_len = (buf[7] << 8) | buf[6];
410 dmi_base = (buf[11] << 24) | (buf[10] << 16) | 421 dmi_base = (buf[11] << 24) | (buf[10] << 16) |
411 (buf[9] << 8) | buf[8]; 422 (buf[9] << 8) | buf[8];
412 423
413 /*
414 * DMI version 0.0 means that the real version is taken from
415 * the SMBIOS version, which we don't know at this point.
416 */
417 if (buf[14] != 0)
418 printk(KERN_INFO "DMI %d.%d present.\n",
419 buf[14] >> 4, buf[14] & 0xF);
420 else
421 printk(KERN_INFO "DMI present.\n");
422 if (dmi_walk_early(dmi_decode) == 0) { 424 if (dmi_walk_early(dmi_decode) == 0) {
425 if (dmi_ver)
426 pr_info("SMBIOS %d.%d present.\n",
427 dmi_ver >> 8, dmi_ver & 0xFF);
428 else {
429 dmi_ver = (buf[14] & 0xF0) << 4 |
430 (buf[14] & 0x0F);
431 pr_info("Legacy DMI %d.%d present.\n",
432 dmi_ver >> 8, dmi_ver & 0xFF);
433 }
423 dmi_dump_ids(); 434 dmi_dump_ids();
424 return 0; 435 return 0;
425 } 436 }
426 } 437 }
438 dmi_ver = 0;
427 return 1; 439 return 1;
428} 440}
429 441
442static int __init smbios_present(const char __iomem *p)
443{
444 u8 buf[32];
445 int offset = 0;
446
447 memcpy_fromio(buf, p, 32);
448 if ((buf[5] < 32) && dmi_checksum(buf, buf[5])) {
449 dmi_ver = (buf[6] << 8) + buf[7];
450
451 /* Some BIOS report weird SMBIOS version, fix that up */
452 switch (dmi_ver) {
453 case 0x021F:
454 case 0x0221:
455 pr_debug("SMBIOS version fixup(2.%d->2.%d)\n",
456 dmi_ver & 0xFF, 3);
457 dmi_ver = 0x0203;
458 break;
459 case 0x0233:
460 pr_debug("SMBIOS version fixup(2.%d->2.%d)\n", 51, 6);
461 dmi_ver = 0x0206;
462 break;
463 }
464 offset = 16;
465 }
466 return dmi_present(buf + offset);
467}
468
430void __init dmi_scan_machine(void) 469void __init dmi_scan_machine(void)
431{ 470{
432 char __iomem *p, *q; 471 char __iomem *p, *q;
@@ -444,7 +483,7 @@ void __init dmi_scan_machine(void)
444 if (p == NULL) 483 if (p == NULL)
445 goto error; 484 goto error;
446 485
447 rc = dmi_present(p + 0x10); /* offset of _DMI_ string */ 486 rc = smbios_present(p);
448 dmi_iounmap(p, 32); 487 dmi_iounmap(p, 32);
449 if (!rc) { 488 if (!rc) {
450 dmi_available = 1; 489 dmi_available = 1;
@@ -462,7 +501,12 @@ void __init dmi_scan_machine(void)
462 goto error; 501 goto error;
463 502
464 for (q = p; q < p + 0x10000; q += 16) { 503 for (q = p; q < p + 0x10000; q += 16) {
465 rc = dmi_present(q); 504 if (memcmp(q, "_SM_", 4) == 0 && q - p <= 0xFFE0)
505 rc = smbios_present(q);
506 else if (memcmp(q, "_DMI_", 5) == 0)
507 rc = dmi_present(q);
508 else
509 continue;
466 if (!rc) { 510 if (!rc) {
467 dmi_available = 1; 511 dmi_available = 1;
468 dmi_iounmap(p, 0x10000); 512 dmi_iounmap(p, 0x10000);
diff --git a/drivers/misc/sgi-xp/xpc_main.c b/drivers/misc/sgi-xp/xpc_main.c
index 8d082b46426b..d971817182f7 100644
--- a/drivers/misc/sgi-xp/xpc_main.c
+++ b/drivers/misc/sgi-xp/xpc_main.c
@@ -53,6 +53,10 @@
53#include <linux/kthread.h> 53#include <linux/kthread.h>
54#include "xpc.h" 54#include "xpc.h"
55 55
56#ifdef CONFIG_X86_64
57#include <asm/traps.h>
58#endif
59
56/* define two XPC debug device structures to be used with dev_dbg() et al */ 60/* define two XPC debug device structures to be used with dev_dbg() et al */
57 61
58struct device_driver xpc_dbg_name = { 62struct device_driver xpc_dbg_name = {
@@ -1079,6 +1083,9 @@ xpc_system_reboot(struct notifier_block *nb, unsigned long event, void *unused)
1079 return NOTIFY_DONE; 1083 return NOTIFY_DONE;
1080} 1084}
1081 1085
1086/* Used to only allow one cpu to complete disconnect */
1087static unsigned int xpc_die_disconnecting;
1088
1082/* 1089/*
1083 * Notify other partitions to deactivate from us by first disengaging from all 1090 * Notify other partitions to deactivate from us by first disengaging from all
1084 * references to our memory. 1091 * references to our memory.
@@ -1092,6 +1099,9 @@ xpc_die_deactivate(void)
1092 long keep_waiting; 1099 long keep_waiting;
1093 long wait_to_print; 1100 long wait_to_print;
1094 1101
1102 if (cmpxchg(&xpc_die_disconnecting, 0, 1))
1103 return;
1104
1095 /* keep xpc_hb_checker thread from doing anything (just in case) */ 1105 /* keep xpc_hb_checker thread from doing anything (just in case) */
1096 xpc_exiting = 1; 1106 xpc_exiting = 1;
1097 1107
@@ -1159,7 +1169,7 @@ xpc_die_deactivate(void)
1159 * about the lack of a heartbeat. 1169 * about the lack of a heartbeat.
1160 */ 1170 */
1161static int 1171static int
1162xpc_system_die(struct notifier_block *nb, unsigned long event, void *unused) 1172xpc_system_die(struct notifier_block *nb, unsigned long event, void *_die_args)
1163{ 1173{
1164#ifdef CONFIG_IA64 /* !!! temporary kludge */ 1174#ifdef CONFIG_IA64 /* !!! temporary kludge */
1165 switch (event) { 1175 switch (event) {
@@ -1191,7 +1201,27 @@ xpc_system_die(struct notifier_block *nb, unsigned long event, void *unused)
1191 break; 1201 break;
1192 } 1202 }
1193#else 1203#else
1194 xpc_die_deactivate(); 1204 struct die_args *die_args = _die_args;
1205
1206 switch (event) {
1207 case DIE_TRAP:
1208 if (die_args->trapnr == X86_TRAP_DF)
1209 xpc_die_deactivate();
1210
1211 if (((die_args->trapnr == X86_TRAP_MF) ||
1212 (die_args->trapnr == X86_TRAP_XF)) &&
1213 !user_mode_vm(die_args->regs))
1214 xpc_die_deactivate();
1215
1216 break;
1217 case DIE_INT3:
1218 case DIE_DEBUG:
1219 break;
1220 case DIE_OOPS:
1221 case DIE_GPF:
1222 default:
1223 xpc_die_deactivate();
1224 }
1195#endif 1225#endif
1196 1226
1197 return NOTIFY_DONE; 1227 return NOTIFY_DONE;
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
index f8a0aab218cb..5143629dedbd 100644
--- a/drivers/rtc/class.c
+++ b/drivers/rtc/class.c
@@ -244,7 +244,6 @@ void rtc_device_unregister(struct rtc_device *rtc)
244 rtc_proc_del_device(rtc); 244 rtc_proc_del_device(rtc);
245 device_unregister(&rtc->dev); 245 device_unregister(&rtc->dev);
246 rtc->ops = NULL; 246 rtc->ops = NULL;
247 ida_simple_remove(&rtc_ida, rtc->id);
248 mutex_unlock(&rtc->ops_lock); 247 mutex_unlock(&rtc->ops_lock);
249 put_device(&rtc->dev); 248 put_device(&rtc->dev);
250 } 249 }
diff --git a/drivers/rtc/rtc-imxdi.c b/drivers/rtc/rtc-imxdi.c
index 18a4f0dd78a3..8da7a5cf83c6 100644
--- a/drivers/rtc/rtc-imxdi.c
+++ b/drivers/rtc/rtc-imxdi.c
@@ -36,6 +36,7 @@
36#include <linux/platform_device.h> 36#include <linux/platform_device.h>
37#include <linux/rtc.h> 37#include <linux/rtc.h>
38#include <linux/sched.h> 38#include <linux/sched.h>
39#include <linux/spinlock.h>
39#include <linux/workqueue.h> 40#include <linux/workqueue.h>
40#include <linux/of.h> 41#include <linux/of.h>
41 42
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index 9be335fb8a7c..0c8869fdd14e 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -172,7 +172,10 @@ static int load_misc_binary(struct linux_binprm *bprm)
172 goto _error; 172 goto _error;
173 bprm->argc ++; 173 bprm->argc ++;
174 174
175 bprm->interp = iname; /* for binfmt_script */ 175 /* Update interp in case binfmt_script needs it. */
176 retval = bprm_change_interp(iname, bprm);
177 if (retval < 0)
178 goto _error;
176 179
177 interp_file = open_exec (iname); 180 interp_file = open_exec (iname);
178 retval = PTR_ERR (interp_file); 181 retval = PTR_ERR (interp_file);
diff --git a/fs/binfmt_script.c b/fs/binfmt_script.c
index 1610a91637e5..5027a3e14922 100644
--- a/fs/binfmt_script.c
+++ b/fs/binfmt_script.c
@@ -80,7 +80,9 @@ static int load_script(struct linux_binprm *bprm)
80 retval = copy_strings_kernel(1, &i_name, bprm); 80 retval = copy_strings_kernel(1, &i_name, bprm);
81 if (retval) return retval; 81 if (retval) return retval;
82 bprm->argc++; 82 bprm->argc++;
83 bprm->interp = interp; 83 retval = bprm_change_interp(interp, bprm);
84 if (retval < 0)
85 return retval;
84 86
85 /* 87 /*
86 * OK, now restart the process with the interpreter's dentry. 88 * OK, now restart the process with the interpreter's dentry.
diff --git a/fs/exec.c b/fs/exec.c
index af8ec80f816d..18c45cac368f 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1175,9 +1175,24 @@ void free_bprm(struct linux_binprm *bprm)
1175 mutex_unlock(&current->signal->cred_guard_mutex); 1175 mutex_unlock(&current->signal->cred_guard_mutex);
1176 abort_creds(bprm->cred); 1176 abort_creds(bprm->cred);
1177 } 1177 }
1178 /* If a binfmt changed the interp, free it. */
1179 if (bprm->interp != bprm->filename)
1180 kfree(bprm->interp);
1178 kfree(bprm); 1181 kfree(bprm);
1179} 1182}
1180 1183
1184int bprm_change_interp(char *interp, struct linux_binprm *bprm)
1185{
1186 /* If a binfmt changed the interp, free it first. */
1187 if (bprm->interp != bprm->filename)
1188 kfree(bprm->interp);
1189 bprm->interp = kstrdup(interp, GFP_KERNEL);
1190 if (!bprm->interp)
1191 return -ENOMEM;
1192 return 0;
1193}
1194EXPORT_SYMBOL(bprm_change_interp);
1195
1181/* 1196/*
1182 * install the new credentials for this executable 1197 * install the new credentials for this executable
1183 */ 1198 */
diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 2a182342442e..58bf744dbf39 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -461,8 +461,7 @@ static int fat_parse_short(struct super_block *sb,
461} 461}
462 462
463/* 463/*
464 * Return values: negative -> error, 0 -> not found, positive -> found, 464 * Return values: negative -> error/not found, 0 -> found.
465 * value is the total amount of slots, including the shortname entry.
466 */ 465 */
467int fat_search_long(struct inode *inode, const unsigned char *name, 466int fat_search_long(struct inode *inode, const unsigned char *name,
468 int name_len, struct fat_slot_info *sinfo) 467 int name_len, struct fat_slot_info *sinfo)
@@ -1255,7 +1254,7 @@ int fat_add_entries(struct inode *dir, void *slots, int nr_slots,
1255 1254
1256 sinfo->nr_slots = nr_slots; 1255 sinfo->nr_slots = nr_slots;
1257 1256
1258 /* First stage: search free direcotry entries */ 1257 /* First stage: search free directory entries */
1259 free_slots = nr_bhs = 0; 1258 free_slots = nr_bhs = 0;
1260 bh = prev = NULL; 1259 bh = prev = NULL;
1261 pos = 0; 1260 pos = 0;
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 35806813ea4e..f8f491677a4a 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -1344,7 +1344,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat,
1344 sbi->dir_entries = get_unaligned_le16(&b->dir_entries); 1344 sbi->dir_entries = get_unaligned_le16(&b->dir_entries);
1345 if (sbi->dir_entries & (sbi->dir_per_block - 1)) { 1345 if (sbi->dir_entries & (sbi->dir_per_block - 1)) {
1346 if (!silent) 1346 if (!silent)
1347 fat_msg(sb, KERN_ERR, "bogus directroy-entries per block" 1347 fat_msg(sb, KERN_ERR, "bogus directory-entries per block"
1348 " (%u)", sbi->dir_entries); 1348 " (%u)", sbi->dir_entries);
1349 brelse(bh); 1349 brelse(bh);
1350 goto out_invalid; 1350 goto out_invalid;
diff --git a/fs/fat/misc.c b/fs/fat/misc.c
index 5eb600dc43a9..359d307b5507 100644
--- a/fs/fat/misc.c
+++ b/fs/fat/misc.c
@@ -135,6 +135,10 @@ int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster)
135 } 135 }
136 if (ret < 0) 136 if (ret < 0)
137 return ret; 137 return ret;
138 /*
139 * FIXME:Although we can add this cache, fat_cache_add() is
140 * assuming to be called after linear search with fat_cache_id.
141 */
138// fat_cache_add(inode, new_fclus, new_dclus); 142// fat_cache_add(inode, new_fclus, new_dclus);
139 } else { 143 } else {
140 MSDOS_I(inode)->i_start = new_dclus; 144 MSDOS_I(inode)->i_start = new_dclus;
diff --git a/fs/hfsplus/bitmap.c b/fs/hfsplus/bitmap.c
index 4cfbe2edd296..6feefc0cb48a 100644
--- a/fs/hfsplus/bitmap.c
+++ b/fs/hfsplus/bitmap.c
@@ -176,12 +176,14 @@ int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count)
176 dprint(DBG_BITMAP, "block_free: %u,%u\n", offset, count); 176 dprint(DBG_BITMAP, "block_free: %u,%u\n", offset, count);
177 /* are all of the bits in range? */ 177 /* are all of the bits in range? */
178 if ((offset + count) > sbi->total_blocks) 178 if ((offset + count) > sbi->total_blocks)
179 return -2; 179 return -ENOENT;
180 180
181 mutex_lock(&sbi->alloc_mutex); 181 mutex_lock(&sbi->alloc_mutex);
182 mapping = sbi->alloc_file->i_mapping; 182 mapping = sbi->alloc_file->i_mapping;
183 pnr = offset / PAGE_CACHE_BITS; 183 pnr = offset / PAGE_CACHE_BITS;
184 page = read_mapping_page(mapping, pnr, NULL); 184 page = read_mapping_page(mapping, pnr, NULL);
185 if (IS_ERR(page))
186 goto kaboom;
185 pptr = kmap(page); 187 pptr = kmap(page);
186 curr = pptr + (offset & (PAGE_CACHE_BITS - 1)) / 32; 188 curr = pptr + (offset & (PAGE_CACHE_BITS - 1)) / 32;
187 end = pptr + PAGE_CACHE_BITS / 32; 189 end = pptr + PAGE_CACHE_BITS / 32;
@@ -214,6 +216,8 @@ int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count)
214 set_page_dirty(page); 216 set_page_dirty(page);
215 kunmap(page); 217 kunmap(page);
216 page = read_mapping_page(mapping, ++pnr, NULL); 218 page = read_mapping_page(mapping, ++pnr, NULL);
219 if (IS_ERR(page))
220 goto kaboom;
217 pptr = kmap(page); 221 pptr = kmap(page);
218 curr = pptr; 222 curr = pptr;
219 end = pptr + PAGE_CACHE_BITS / 32; 223 end = pptr + PAGE_CACHE_BITS / 32;
@@ -232,4 +236,11 @@ out:
232 mutex_unlock(&sbi->alloc_mutex); 236 mutex_unlock(&sbi->alloc_mutex);
233 237
234 return 0; 238 return 0;
239
240kaboom:
241 printk(KERN_CRIT "hfsplus: unable to mark blocks free: error %ld\n",
242 PTR_ERR(page));
243 mutex_unlock(&sbi->alloc_mutex);
244
245 return -EIO;
235} 246}
diff --git a/fs/hfsplus/btree.c b/fs/hfsplus/btree.c
index 21023d9f8ff3..685d07d0ed18 100644
--- a/fs/hfsplus/btree.c
+++ b/fs/hfsplus/btree.c
@@ -159,7 +159,7 @@ void hfs_btree_close(struct hfs_btree *tree)
159 kfree(tree); 159 kfree(tree);
160} 160}
161 161
162void hfs_btree_write(struct hfs_btree *tree) 162int hfs_btree_write(struct hfs_btree *tree)
163{ 163{
164 struct hfs_btree_header_rec *head; 164 struct hfs_btree_header_rec *head;
165 struct hfs_bnode *node; 165 struct hfs_bnode *node;
@@ -168,7 +168,7 @@ void hfs_btree_write(struct hfs_btree *tree)
168 node = hfs_bnode_find(tree, 0); 168 node = hfs_bnode_find(tree, 0);
169 if (IS_ERR(node)) 169 if (IS_ERR(node))
170 /* panic? */ 170 /* panic? */
171 return; 171 return -EIO;
172 /* Load the header */ 172 /* Load the header */
173 page = node->page[0]; 173 page = node->page[0];
174 head = (struct hfs_btree_header_rec *)(kmap(page) + 174 head = (struct hfs_btree_header_rec *)(kmap(page) +
@@ -186,6 +186,7 @@ void hfs_btree_write(struct hfs_btree *tree)
186 kunmap(page); 186 kunmap(page);
187 set_page_dirty(page); 187 set_page_dirty(page);
188 hfs_bnode_put(node); 188 hfs_bnode_put(node);
189 return 0;
189} 190}
190 191
191static struct hfs_bnode *hfs_bmap_new_bmap(struct hfs_bnode *prev, u32 idx) 192static struct hfs_bnode *hfs_bmap_new_bmap(struct hfs_bnode *prev, u32 idx)
diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c
index 5849e3ef35cc..eba76eab6d62 100644
--- a/fs/hfsplus/extents.c
+++ b/fs/hfsplus/extents.c
@@ -329,6 +329,7 @@ static int hfsplus_free_extents(struct super_block *sb,
329{ 329{
330 u32 count, start; 330 u32 count, start;
331 int i; 331 int i;
332 int err = 0;
332 333
333 hfsplus_dump_extent(extent); 334 hfsplus_dump_extent(extent);
334 for (i = 0; i < 8; extent++, i++) { 335 for (i = 0; i < 8; extent++, i++) {
@@ -345,18 +346,33 @@ found:
345 for (;;) { 346 for (;;) {
346 start = be32_to_cpu(extent->start_block); 347 start = be32_to_cpu(extent->start_block);
347 if (count <= block_nr) { 348 if (count <= block_nr) {
348 hfsplus_block_free(sb, start, count); 349 err = hfsplus_block_free(sb, start, count);
350 if (err) {
351 printk(KERN_ERR "hfs: can't free extent\n");
352 dprint(DBG_EXTENT, " start: %u count: %u\n",
353 start, count);
354 }
349 extent->block_count = 0; 355 extent->block_count = 0;
350 extent->start_block = 0; 356 extent->start_block = 0;
351 block_nr -= count; 357 block_nr -= count;
352 } else { 358 } else {
353 count -= block_nr; 359 count -= block_nr;
354 hfsplus_block_free(sb, start + count, block_nr); 360 err = hfsplus_block_free(sb, start + count, block_nr);
361 if (err) {
362 printk(KERN_ERR "hfs: can't free extent\n");
363 dprint(DBG_EXTENT, " start: %u count: %u\n",
364 start, count);
365 }
355 extent->block_count = cpu_to_be32(count); 366 extent->block_count = cpu_to_be32(count);
356 block_nr = 0; 367 block_nr = 0;
357 } 368 }
358 if (!block_nr || !i) 369 if (!block_nr || !i) {
359 return 0; 370 /*
371 * Try to free all extents and
372 * return only last error
373 */
374 return err;
375 }
360 i--; 376 i--;
361 extent--; 377 extent--;
362 count = be32_to_cpu(extent->block_count); 378 count = be32_to_cpu(extent->block_count);
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h
index c571de224b15..a6da86b1b4c1 100644
--- a/fs/hfsplus/hfsplus_fs.h
+++ b/fs/hfsplus/hfsplus_fs.h
@@ -335,7 +335,7 @@ int hfsplus_block_free(struct super_block *, u32, u32);
335/* btree.c */ 335/* btree.c */
336struct hfs_btree *hfs_btree_open(struct super_block *, u32); 336struct hfs_btree *hfs_btree_open(struct super_block *, u32);
337void hfs_btree_close(struct hfs_btree *); 337void hfs_btree_close(struct hfs_btree *);
338void hfs_btree_write(struct hfs_btree *); 338int hfs_btree_write(struct hfs_btree *);
339struct hfs_bnode *hfs_bmap_alloc(struct hfs_btree *); 339struct hfs_bnode *hfs_bmap_alloc(struct hfs_btree *);
340void hfs_bmap_free(struct hfs_bnode *); 340void hfs_bmap_free(struct hfs_bnode *);
341 341
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index 811a84d2d964..796198d26553 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -127,8 +127,14 @@ static int hfsplus_system_write_inode(struct inode *inode)
127 hfsplus_mark_mdb_dirty(inode->i_sb); 127 hfsplus_mark_mdb_dirty(inode->i_sb);
128 } 128 }
129 hfsplus_inode_write_fork(inode, fork); 129 hfsplus_inode_write_fork(inode, fork);
130 if (tree) 130 if (tree) {
131 hfs_btree_write(tree); 131 int err = hfs_btree_write(tree);
132 if (err) {
133 printk(KERN_ERR "hfs: b-tree write err: %d, ino %lu\n",
134 err, inode->i_ino);
135 return err;
136 }
137 }
132 return 0; 138 return 0;
133} 139}
134 140
@@ -226,6 +232,7 @@ out:
226 232
227static void delayed_sync_fs(struct work_struct *work) 233static void delayed_sync_fs(struct work_struct *work)
228{ 234{
235 int err;
229 struct hfsplus_sb_info *sbi; 236 struct hfsplus_sb_info *sbi;
230 237
231 sbi = container_of(work, struct hfsplus_sb_info, sync_work.work); 238 sbi = container_of(work, struct hfsplus_sb_info, sync_work.work);
@@ -234,7 +241,9 @@ static void delayed_sync_fs(struct work_struct *work)
234 sbi->work_queued = 0; 241 sbi->work_queued = 0;
235 spin_unlock(&sbi->work_lock); 242 spin_unlock(&sbi->work_lock);
236 243
237 hfsplus_sync_fs(sbi->alloc_file->i_sb, 1); 244 err = hfsplus_sync_fs(sbi->alloc_file->i_sb, 1);
245 if (err)
246 printk(KERN_ERR "hfs: delayed sync fs err %d\n", err);
238} 247}
239 248
240void hfsplus_mark_mdb_dirty(struct super_block *sb) 249void hfsplus_mark_mdb_dirty(struct super_block *sb)
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 2e4ed13b9eed..e064f562b1f7 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -352,18 +352,18 @@ retry:
352 if (!ida_pre_get(&proc_inum_ida, GFP_KERNEL)) 352 if (!ida_pre_get(&proc_inum_ida, GFP_KERNEL))
353 return -ENOMEM; 353 return -ENOMEM;
354 354
355 spin_lock(&proc_inum_lock); 355 spin_lock_bh(&proc_inum_lock);
356 error = ida_get_new(&proc_inum_ida, &i); 356 error = ida_get_new(&proc_inum_ida, &i);
357 spin_unlock(&proc_inum_lock); 357 spin_unlock_bh(&proc_inum_lock);
358 if (error == -EAGAIN) 358 if (error == -EAGAIN)
359 goto retry; 359 goto retry;
360 else if (error) 360 else if (error)
361 return error; 361 return error;
362 362
363 if (i > UINT_MAX - PROC_DYNAMIC_FIRST) { 363 if (i > UINT_MAX - PROC_DYNAMIC_FIRST) {
364 spin_lock(&proc_inum_lock); 364 spin_lock_bh(&proc_inum_lock);
365 ida_remove(&proc_inum_ida, i); 365 ida_remove(&proc_inum_ida, i);
366 spin_unlock(&proc_inum_lock); 366 spin_unlock_bh(&proc_inum_lock);
367 return -ENOSPC; 367 return -ENOSPC;
368 } 368 }
369 *inum = PROC_DYNAMIC_FIRST + i; 369 *inum = PROC_DYNAMIC_FIRST + i;
@@ -372,9 +372,9 @@ retry:
372 372
373void proc_free_inum(unsigned int inum) 373void proc_free_inum(unsigned int inum)
374{ 374{
375 spin_lock(&proc_inum_lock); 375 spin_lock_bh(&proc_inum_lock);
376 ida_remove(&proc_inum_ida, inum - PROC_DYNAMIC_FIRST); 376 ida_remove(&proc_inum_ida, inum - PROC_DYNAMIC_FIRST);
377 spin_unlock(&proc_inum_lock); 377 spin_unlock_bh(&proc_inum_lock);
378} 378}
379 379
380static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd) 380static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd)
diff --git a/fs/read_write.c b/fs/read_write.c
index 1edaf099ddd7..bb34af315280 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -935,6 +935,8 @@ ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, size_t count,
935 if (retval > 0) { 935 if (retval > 0) {
936 add_rchar(current, retval); 936 add_rchar(current, retval);
937 add_wchar(current, retval); 937 add_wchar(current, retval);
938 fsnotify_access(in.file);
939 fsnotify_modify(out.file);
938 } 940 }
939 941
940 inc_syscr(current); 942 inc_syscr(current);
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index cf3eae0b4f59..0530b9860359 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -112,6 +112,7 @@ extern int setup_arg_pages(struct linux_binprm * bprm,
112 unsigned long stack_top, 112 unsigned long stack_top,
113 int executable_stack); 113 int executable_stack);
114extern int bprm_mm_init(struct linux_binprm *bprm); 114extern int bprm_mm_init(struct linux_binprm *bprm);
115extern int bprm_change_interp(char *interp, struct linux_binprm *bprm);
115extern int copy_strings_kernel(int argc, const char *const *argv, 116extern int copy_strings_kernel(int argc, const char *const *argv,
116 struct linux_binprm *bprm); 117 struct linux_binprm *bprm);
117extern int prepare_bprm_creds(struct linux_binprm *bprm); 118extern int prepare_bprm_creds(struct linux_binprm *bprm);
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index d140e8fb075f..c566927efcbd 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -77,13 +77,15 @@
77 77
78/* 78/*
79 * Divide positive or negative dividend by positive divisor and round 79 * Divide positive or negative dividend by positive divisor and round
80 * to closest integer. Result is undefined for negative divisors. 80 * to closest integer. Result is undefined for negative divisors and
81 * for negative dividends if the divisor variable type is unsigned.
81 */ 82 */
82#define DIV_ROUND_CLOSEST(x, divisor)( \ 83#define DIV_ROUND_CLOSEST(x, divisor)( \
83{ \ 84{ \
84 typeof(x) __x = x; \ 85 typeof(x) __x = x; \
85 typeof(divisor) __d = divisor; \ 86 typeof(divisor) __d = divisor; \
86 (((typeof(x))-1) > 0 || (__x) > 0) ? \ 87 (((typeof(x))-1) > 0 || \
88 ((typeof(divisor))-1) > 0 || (__x) > 0) ? \
87 (((__x) + ((__d) / 2)) / (__d)) : \ 89 (((__x) + ((__d) / 2)) / (__d)) : \
88 (((__x) - ((__d) / 2)) / (__d)); \ 90 (((__x) - ((__d) / 2)) / (__d)); \
89} \ 91} \
diff --git a/kernel/kcmp.c b/kernel/kcmp.c
index 30b7b225306c..e30ac0fe61c3 100644
--- a/kernel/kcmp.c
+++ b/kernel/kcmp.c
@@ -4,6 +4,7 @@
4#include <linux/string.h> 4#include <linux/string.h>
5#include <linux/random.h> 5#include <linux/random.h>
6#include <linux/module.h> 6#include <linux/module.h>
7#include <linux/ptrace.h>
7#include <linux/init.h> 8#include <linux/init.h>
8#include <linux/errno.h> 9#include <linux/errno.h>
9#include <linux/cache.h> 10#include <linux/cache.h>
diff --git a/kernel/modsign_pubkey.c b/kernel/modsign_pubkey.c
index 045504fffbb2..2b6e69909c39 100644
--- a/kernel/modsign_pubkey.c
+++ b/kernel/modsign_pubkey.c
@@ -34,18 +34,15 @@ static __init int module_verify_init(void)
34{ 34{
35 pr_notice("Initialise module verification\n"); 35 pr_notice("Initialise module verification\n");
36 36
37 modsign_keyring = key_alloc(&key_type_keyring, ".module_sign", 37 modsign_keyring = keyring_alloc(".module_sign",
38 KUIDT_INIT(0), KGIDT_INIT(0), 38 KUIDT_INIT(0), KGIDT_INIT(0),
39 current_cred(), 39 current_cred(),
40 (KEY_POS_ALL & ~KEY_POS_SETATTR) | 40 ((KEY_POS_ALL & ~KEY_POS_SETATTR) |
41 KEY_USR_VIEW | KEY_USR_READ, 41 KEY_USR_VIEW | KEY_USR_READ),
42 KEY_ALLOC_NOT_IN_QUOTA); 42 KEY_ALLOC_NOT_IN_QUOTA, NULL);
43 if (IS_ERR(modsign_keyring)) 43 if (IS_ERR(modsign_keyring))
44 panic("Can't allocate module signing keyring\n"); 44 panic("Can't allocate module signing keyring\n");
45 45
46 if (key_instantiate_and_link(modsign_keyring, NULL, 0, NULL, NULL) < 0)
47 panic("Can't instantiate module signing keyring\n");
48
49 return 0; 46 return 0;
50} 47}
51 48
diff --git a/mm/compaction.c b/mm/compaction.c
index 5ad7f4f4d6f7..6b807e466497 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -17,6 +17,21 @@
17#include <linux/balloon_compaction.h> 17#include <linux/balloon_compaction.h>
18#include "internal.h" 18#include "internal.h"
19 19
20#ifdef CONFIG_COMPACTION
21static inline void count_compact_event(enum vm_event_item item)
22{
23 count_vm_event(item);
24}
25
26static inline void count_compact_events(enum vm_event_item item, long delta)
27{
28 count_vm_events(item, delta);
29}
30#else
31#define count_compact_event(item) do { } while (0)
32#define count_compact_events(item, delta) do { } while (0)
33#endif
34
20#if defined CONFIG_COMPACTION || defined CONFIG_CMA 35#if defined CONFIG_COMPACTION || defined CONFIG_CMA
21 36
22#define CREATE_TRACE_POINTS 37#define CREATE_TRACE_POINTS
@@ -303,10 +318,9 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
303 if (blockpfn == end_pfn) 318 if (blockpfn == end_pfn)
304 update_pageblock_skip(cc, valid_page, total_isolated, false); 319 update_pageblock_skip(cc, valid_page, total_isolated, false);
305 320
306 count_vm_events(COMPACTFREE_SCANNED, nr_scanned); 321 count_compact_events(COMPACTFREE_SCANNED, nr_scanned);
307 if (total_isolated) 322 if (total_isolated)
308 count_vm_events(COMPACTISOLATED, total_isolated); 323 count_compact_events(COMPACTISOLATED, total_isolated);
309
310 return total_isolated; 324 return total_isolated;
311} 325}
312 326
@@ -613,9 +627,9 @@ next_pageblock:
613 627
614 trace_mm_compaction_isolate_migratepages(nr_scanned, nr_isolated); 628 trace_mm_compaction_isolate_migratepages(nr_scanned, nr_isolated);
615 629
616 count_vm_events(COMPACTMIGRATE_SCANNED, nr_scanned); 630 count_compact_events(COMPACTMIGRATE_SCANNED, nr_scanned);
617 if (nr_isolated) 631 if (nr_isolated)
618 count_vm_events(COMPACTISOLATED, nr_isolated); 632 count_compact_events(COMPACTISOLATED, nr_isolated);
619 633
620 return low_pfn; 634 return low_pfn;
621} 635}
@@ -1110,7 +1124,7 @@ unsigned long try_to_compact_pages(struct zonelist *zonelist,
1110 if (!order || !may_enter_fs || !may_perform_io) 1124 if (!order || !may_enter_fs || !may_perform_io)
1111 return rc; 1125 return rc;
1112 1126
1113 count_vm_event(COMPACTSTALL); 1127 count_compact_event(COMPACTSTALL);
1114 1128
1115#ifdef CONFIG_CMA 1129#ifdef CONFIG_CMA
1116 if (allocflags_to_migratetype(gfp_mask) == MIGRATE_MOVABLE) 1130 if (allocflags_to_migratetype(gfp_mask) == MIGRATE_MOVABLE)
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 32754eece63e..9e894edc7811 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -574,19 +574,19 @@ static int __init hugepage_init_sysfs(struct kobject **hugepage_kobj)
574 574
575 *hugepage_kobj = kobject_create_and_add("transparent_hugepage", mm_kobj); 575 *hugepage_kobj = kobject_create_and_add("transparent_hugepage", mm_kobj);
576 if (unlikely(!*hugepage_kobj)) { 576 if (unlikely(!*hugepage_kobj)) {
577 printk(KERN_ERR "hugepage: failed kobject create\n"); 577 printk(KERN_ERR "hugepage: failed to create transparent hugepage kobject\n");
578 return -ENOMEM; 578 return -ENOMEM;
579 } 579 }
580 580
581 err = sysfs_create_group(*hugepage_kobj, &hugepage_attr_group); 581 err = sysfs_create_group(*hugepage_kobj, &hugepage_attr_group);
582 if (err) { 582 if (err) {
583 printk(KERN_ERR "hugepage: failed register hugeage group\n"); 583 printk(KERN_ERR "hugepage: failed to register transparent hugepage group\n");
584 goto delete_obj; 584 goto delete_obj;
585 } 585 }
586 586
587 err = sysfs_create_group(*hugepage_kobj, &khugepaged_attr_group); 587 err = sysfs_create_group(*hugepage_kobj, &khugepaged_attr_group);
588 if (err) { 588 if (err) {
589 printk(KERN_ERR "hugepage: failed register hugeage group\n"); 589 printk(KERN_ERR "hugepage: failed to register transparent hugepage group\n");
590 goto remove_hp_group; 590 goto remove_hp_group;
591 } 591 }
592 592
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index f3009b4bae51..09255ec8159c 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -6090,7 +6090,6 @@ mem_cgroup_css_alloc(struct cgroup *cont)
6090 &per_cpu(memcg_stock, cpu); 6090 &per_cpu(memcg_stock, cpu);
6091 INIT_WORK(&stock->work, drain_local_stock); 6091 INIT_WORK(&stock->work, drain_local_stock);
6092 } 6092 }
6093 hotcpu_notifier(memcg_cpu_hotplug_callback, 0);
6094 } else { 6093 } else {
6095 parent = mem_cgroup_from_cont(cont->parent); 6094 parent = mem_cgroup_from_cont(cont->parent);
6096 memcg->use_hierarchy = parent->use_hierarchy; 6095 memcg->use_hierarchy = parent->use_hierarchy;
@@ -6756,6 +6755,19 @@ struct cgroup_subsys mem_cgroup_subsys = {
6756 .use_id = 1, 6755 .use_id = 1,
6757}; 6756};
6758 6757
6758/*
6759 * The rest of init is performed during ->css_alloc() for root css which
6760 * happens before initcalls. hotcpu_notifier() can't be done together as
6761 * it would introduce circular locking by adding cgroup_lock -> cpu hotplug
6762 * dependency. Do it from a subsys_initcall().
6763 */
6764static int __init mem_cgroup_init(void)
6765{
6766 hotcpu_notifier(memcg_cpu_hotplug_callback, 0);
6767 return 0;
6768}
6769subsys_initcall(mem_cgroup_init);
6770
6759#ifdef CONFIG_MEMCG_SWAP 6771#ifdef CONFIG_MEMCG_SWAP
6760static int __init enable_swap_account(char *s) 6772static int __init enable_swap_account(char *s)
6761{ 6773{
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 6f4271224493..0713bfbf0954 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -201,6 +201,18 @@ static unsigned long highmem_dirtyable_memory(unsigned long total)
201 zone_reclaimable_pages(z) - z->dirty_balance_reserve; 201 zone_reclaimable_pages(z) - z->dirty_balance_reserve;
202 } 202 }
203 /* 203 /*
204 * Unreclaimable memory (kernel memory or anonymous memory
205 * without swap) can bring down the dirtyable pages below
206 * the zone's dirty balance reserve and the above calculation
207 * will underflow. However we still want to add in nodes
208 * which are below threshold (negative values) to get a more
209 * accurate calculation but make sure that the total never
210 * underflows.
211 */
212 if ((long)x < 0)
213 x = 0;
214
215 /*
204 * Make sure that the number of highmem pages is never larger 216 * Make sure that the number of highmem pages is never larger
205 * than the number of the total dirtyable memory. This can only 217 * than the number of the total dirtyable memory. This can only
206 * occur in very strange VM situations but we want to make sure 218 * occur in very strange VM situations but we want to make sure
@@ -222,8 +234,8 @@ static unsigned long global_dirtyable_memory(void)
222{ 234{
223 unsigned long x; 235 unsigned long x;
224 236
225 x = global_page_state(NR_FREE_PAGES) + global_reclaimable_pages() - 237 x = global_page_state(NR_FREE_PAGES) + global_reclaimable_pages();
226 dirty_balance_reserve; 238 x -= min(x, dirty_balance_reserve);
227 239
228 if (!vm_highmem_is_dirtyable) 240 if (!vm_highmem_is_dirtyable)
229 x -= highmem_dirtyable_memory(x); 241 x -= highmem_dirtyable_memory(x);
@@ -290,9 +302,12 @@ static unsigned long zone_dirtyable_memory(struct zone *zone)
290 * highmem zone can hold its share of dirty pages, so we don't 302 * highmem zone can hold its share of dirty pages, so we don't
291 * care about vm_highmem_is_dirtyable here. 303 * care about vm_highmem_is_dirtyable here.
292 */ 304 */
293 return zone_page_state(zone, NR_FREE_PAGES) + 305 unsigned long nr_pages = zone_page_state(zone, NR_FREE_PAGES) +
294 zone_reclaimable_pages(zone) - 306 zone_reclaimable_pages(zone);
295 zone->dirty_balance_reserve; 307
308 /* don't allow this to underflow */
309 nr_pages -= min(nr_pages, zone->dirty_balance_reserve);
310 return nr_pages;
296} 311}
297 312
298/** 313/**
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 2ad2ad168efe..4ba5e37127fc 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5978,8 +5978,15 @@ done:
5978 5978
5979void free_contig_range(unsigned long pfn, unsigned nr_pages) 5979void free_contig_range(unsigned long pfn, unsigned nr_pages)
5980{ 5980{
5981 for (; nr_pages--; ++pfn) 5981 unsigned int count = 0;
5982 __free_page(pfn_to_page(pfn)); 5982
5983 for (; nr_pages--; pfn++) {
5984 struct page *page = pfn_to_page(pfn);
5985
5986 count += page_count(page) != 1;
5987 __free_page(page);
5988 }
5989 WARN(count != 0, "%d pages are still in use!\n", count);
5983} 5990}
5984#endif 5991#endif
5985 5992
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 1d6e4c541370..4d2c7dfdaabd 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2226,8 +2226,11 @@ sub process {
2226 my $path = $1; 2226 my $path = $1;
2227 if ($path =~ m{//}) { 2227 if ($path =~ m{//}) {
2228 ERROR("MALFORMED_INCLUDE", 2228 ERROR("MALFORMED_INCLUDE",
2229 "malformed #include filename\n" . 2229 "malformed #include filename\n" . $herecurr);
2230 $herecurr); 2230 }
2231 if ($path =~ "^uapi/" && $realfile =~ m@\binclude/uapi/@) {
2232 ERROR("UAPI_INCLUDE",
2233 "No #include in ...include/uapi/... should use a uapi/ path prefix\n" . $herecurr);
2231 } 2234 }
2232 } 2235 }
2233 2236
diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
index 58dfe0890947..20e4bf57aec8 100644
--- a/security/keys/process_keys.c
+++ b/security/keys/process_keys.c
@@ -367,8 +367,6 @@ key_ref_t search_my_process_keyrings(struct key_type *type,
367 367
368 switch (PTR_ERR(key_ref)) { 368 switch (PTR_ERR(key_ref)) {
369 case -EAGAIN: /* no key */ 369 case -EAGAIN: /* no key */
370 if (ret)
371 break;
372 case -ENOKEY: /* negative key */ 370 case -ENOKEY: /* negative key */
373 ret = key_ref; 371 ret = key_ref;
374 break; 372 break;