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 ...
Unified · Split
| @@ -1,7 +0,0 @@ | ||
| 1 | −What: /sys/devices/system/node/nodeX/compact | |
| 2 | −Date: February 2010 | |
| 3 | −Contact: Mel Gorman <mel@csn.ul.ie> | |
| 4 | −Description: | |
| 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 | |
| @@ -446,12 +446,6 @@ bytes respectively. Such letter suffixes can also be entirely omitted. · 445 unmodified lines | ||
| 446 | 446 | possible to determine what the correct size should be. |
| 447 | 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 | 449 | ccw_timeout_log [S390] |
| 456 | 450 | See Documentation/s390/CommonIO for details. |
| 457 | 451 | |
| @@ -16,6 +16,7 @@ · 15 unmodified lines | ||
| 16 | 16 | */ |
| 17 | 17 | static char dmi_empty_string[] = " "; |
| 18 | 18 | |
| 19 | +static u16 __initdata dmi_ver; | |
| 19 | 20 | /* |
| 20 | 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 *, · 96 unmodified lines | ||
| 118 | 119 | return 0; |
| 119 | 120 | } |
| 120 | 121 | |
| 121 | −static int __init dmi_checksum(const u8 *buf) | |
| 122 | +static int __init dmi_checksum(const u8 *buf, u8 len) | |
| 122 | 123 | { |
| 123 | 124 | u8 sum = 0; |
| 124 | 125 | int a; |
| 125 | 126 | |
| 126 | − for (a = 0; a < 15; a++) | |
| 127 | + for (a = 0; a < len; a++) | |
| 127 | 128 | sum += buf[a]; |
| 128 | 129 | |
| 129 | 130 | return sum == 0; |
| @@ -161,8 +162,10 @@ static void __init dmi_save_uuid(const struct dmi_header *dm, int slot, int inde · 31 unmodified lines | ||
| 161 | 162 | return; |
| 162 | 163 | |
| 163 | 164 | for (i = 0; i < 16 && (is_ff || is_00); i++) { |
| 164 | − if(d[i] != 0x00) is_ff = 0; | |
| 165 | − if(d[i] != 0xFF) is_00 = 0; | |
| 165 | + if (d[i] != 0x00) | |
| 166 | + is_00 = 0; | |
| 167 | + if (d[i] != 0xFF) | |
| 168 | + is_ff = 0; | |
| 166 | 169 | } |
| 167 | 170 | |
| 168 | 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 · 3 unmodified lines | ||
| 172 | 175 | if (!s) |
| 173 | 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 | 188 | dmi_ident[slot] = s; |
| 178 | 189 | } |
| @@ -404,29 +415,57 @@ static int __init dmi_present(const char __iomem *p) · 225 unmodified lines | ||
| 404 | 415 | u8 buf[15]; |
| 405 | 416 | |
| 406 | 417 | memcpy_fromio(buf, p, 15); |
| 407 | − if ((memcmp(buf, "_DMI_", 5) == 0) && dmi_checksum(buf)) { | |
| 418 | + if (dmi_checksum(buf, 15)) { | |
| 408 | 419 | dmi_num = (buf[13] << 8) | buf[12]; |
| 409 | 420 | dmi_len = (buf[7] << 8) | buf[6]; |
| 410 | 421 | dmi_base = (buf[11] << 24) | (buf[10] << 16) | |
| 411 | 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 | 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 | 434 | dmi_dump_ids(); |
| 424 | 435 | return 0; |
| 425 | 436 | } |
| 426 | 437 | } |
| 438 | + dmi_ver = 0; | |
| 427 | 439 | return 1; |
| 428 | 440 | } |
| 429 | 441 | |
| 442 | +static 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 | + | |
| 430 | 469 | void __init dmi_scan_machine(void) |
| 431 | 470 | { |
| 432 | 471 | char __iomem *p, *q; |
| @@ -444,7 +483,7 @@ void __init dmi_scan_machine(void) · 11 unmodified lines | ||
| 444 | 483 | if (p == NULL) |
| 445 | 484 | goto error; |
| 446 | 485 | |
| 447 | − rc = dmi_present(p + 0x10); /* offset of _DMI_ string */ | |
| 486 | + rc = smbios_present(p); | |
| 448 | 487 | dmi_iounmap(p, 32); |
| 449 | 488 | if (!rc) { |
| 450 | 489 | dmi_available = 1; |
| @@ -462,7 +501,12 @@ void __init dmi_scan_machine(void) · 11 unmodified lines | ||
| 462 | 501 | goto error; |
| 463 | 502 | |
| 464 | 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 | 510 | if (!rc) { |
| 467 | 511 | dmi_available = 1; |
| 468 | 512 | dmi_iounmap(p, 0x10000); |
| @@ -53,6 +53,10 @@ · 52 unmodified lines | ||
| 53 | 53 | #include <linux/kthread.h> |
| 54 | 54 | #include "xpc.h" |
| 55 | 55 | |
| 56 | +#ifdef CONFIG_X86_64 | |
| 57 | +#include <asm/traps.h> | |
| 58 | +#endif | |
| 59 | + | |
| 56 | 60 | /* define two XPC debug device structures to be used with dev_dbg() et al */ |
| 57 | 61 | |
| 58 | 62 | struct device_driver xpc_dbg_name = { |
| @@ -1079,6 +1083,9 @@ xpc_system_reboot(struct notifier_block *nb, unsigned long event, void *unused) · 1020 unmodified lines | ||
| 1079 | 1083 | return NOTIFY_DONE; |
| 1080 | 1084 | } |
| 1081 | 1085 | |
| 1086 | +/* Used to only allow one cpu to complete disconnect */ | |
| 1087 | +static unsigned int xpc_die_disconnecting; | |
| 1088 | + | |
| 1082 | 1089 | /* |
| 1083 | 1090 | * Notify other partitions to deactivate from us by first disengaging from all |
| 1084 | 1091 | * references to our memory. |
| @@ -1092,6 +1099,9 @@ xpc_die_deactivate(void) · 7 unmodified lines | ||
| 1092 | 1099 | long keep_waiting; |
| 1093 | 1100 | long wait_to_print; |
| 1094 | 1101 | |
| 1102 | + if (cmpxchg(&xpc_die_disconnecting, 0, 1)) | |
| 1103 | + return; | |
| 1104 | + | |
| 1095 | 1105 | /* keep xpc_hb_checker thread from doing anything (just in case) */ |
| 1096 | 1106 | xpc_exiting = 1; |
| 1097 | 1107 | |
| @@ -1159,7 +1169,7 @@ xpc_die_deactivate(void) · 61 unmodified lines | ||
| 1159 | 1169 | * about the lack of a heartbeat. |
| 1160 | 1170 | */ |
| 1161 | 1171 | static int |
| 1162 | −xpc_system_die(struct notifier_block *nb, unsigned long event, void *unused) | |
| 1172 | +xpc_system_die(struct notifier_block *nb, unsigned long event, void *_die_args) | |
| 1163 | 1173 | { |
| 1164 | 1174 | #ifdef CONFIG_IA64 /* !!! temporary kludge */ |
| 1165 | 1175 | switch (event) { |
| @@ -1191,7 +1201,27 @@ xpc_system_die(struct notifier_block *nb, unsigned long event, void *unused) · 25 unmodified lines | ||
| 1191 | 1201 | break; |
| 1192 | 1202 | } |
| 1193 | 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 | 1225 | #endif |
| 1196 | 1226 | |
| 1197 | 1227 | return NOTIFY_DONE; |
| @@ -244,7 +244,6 @@ void rtc_device_unregister(struct rtc_device *rtc) · 243 unmodified lines | ||
| 244 | 244 | rtc_proc_del_device(rtc); |
| 245 | 245 | device_unregister(&rtc->dev); |
| 246 | 246 | rtc->ops = NULL; |
| 247 | − ida_simple_remove(&rtc_ida, rtc->id); | |
| 248 | 247 | mutex_unlock(&rtc->ops_lock); |
| 249 | 248 | put_device(&rtc->dev); |
| 250 | 249 | } |
| @@ -36,6 +36,7 @@ · 35 unmodified lines | ||
| 36 | 36 | #include <linux/platform_device.h> |
| 37 | 37 | #include <linux/rtc.h> |
| 38 | 38 | #include <linux/sched.h> |
| 39 | +#include <linux/spinlock.h> | |
| 39 | 40 | #include <linux/workqueue.h> |
| 40 | 41 | #include <linux/of.h> |
| 41 | 42 | |
| @@ -172,7 +172,10 @@ static int load_misc_binary(struct linux_binprm *bprm) · 171 unmodified lines | ||
| 172 | 172 | goto _error; |
| 173 | 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 | 180 | interp_file = open_exec (iname); |
| 178 | 181 | retval = PTR_ERR (interp_file); |
| @@ -80,7 +80,9 @@ static int load_script(struct linux_binprm *bprm) · 79 unmodified lines | ||
| 80 | 80 | retval = copy_strings_kernel(1, &i_name, bprm); |
| 81 | 81 | if (retval) return retval; |
| 82 | 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 | 88 | * OK, now restart the process with the interpreter's dentry. |
| @@ -1175,9 +1175,24 @@ void free_bprm(struct linux_binprm *bprm) · 1174 unmodified lines | ||
| 1175 | 1175 | mutex_unlock(¤t->signal->cred_guard_mutex); |
| 1176 | 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 | 1181 | kfree(bprm); |
| 1179 | 1182 | } |
| 1180 | 1183 | |
| 1184 | +int 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 | +} | |
| 1194 | +EXPORT_SYMBOL(bprm_change_interp); | |
| 1195 | + | |
| 1181 | 1196 | /* |
| 1182 | 1197 | * install the new credentials for this executable |
| 1183 | 1198 | */ |
| @@ -461,8 +461,7 @@ static int fat_parse_short(struct super_block *sb, · 460 unmodified lines | ||
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | /* |
| 464 | − * Return values: negative -> error, 0 -> not found, positive -> found, | |
| 465 | − * value is the total amount of slots, including the shortname entry. | |
| 464 | + * Return values: negative -> error/not found, 0 -> found. | |
| 466 | 465 | */ |
| 467 | 466 | int fat_search_long(struct inode *inode, const unsigned char *name, |
| 468 | 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, · 786 unmodified lines | ||
| 1255 | 1254 | |
| 1256 | 1255 | sinfo->nr_slots = nr_slots; |
| 1257 | 1256 | |
| 1258 | − /* First stage: search free direcotry entries */ | |
| 1257 | + /* First stage: search free directory entries */ | |
| 1259 | 1258 | free_slots = nr_bhs = 0; |
| 1260 | 1259 | bh = prev = NULL; |
| 1261 | 1260 | pos = 0; |
| @@ -1344,7 +1344,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat, · 1343 unmodified lines | ||
| 1344 | 1344 | sbi->dir_entries = get_unaligned_le16(&b->dir_entries); |
| 1345 | 1345 | if (sbi->dir_entries & (sbi->dir_per_block - 1)) { |
| 1346 | 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 | 1348 | " (%u)", sbi->dir_entries); |
| 1349 | 1349 | brelse(bh); |
| 1350 | 1350 | goto out_invalid; |
| @@ -135,6 +135,10 @@ int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster) · 134 unmodified lines | ||
| 135 | 135 | } |
| 136 | 136 | if (ret < 0) |
| 137 | 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 | 142 | // fat_cache_add(inode, new_fclus, new_dclus); |
| 139 | 143 | } else { |
| 140 | 144 | MSDOS_I(inode)->i_start = new_dclus; |
| @@ -176,12 +176,14 @@ int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count) · 175 unmodified lines | ||
| 176 | 176 | dprint(DBG_BITMAP, "block_free: %u,%u\n", offset, count); |
| 177 | 177 | /* are all of the bits in range? */ |
| 178 | 178 | if ((offset + count) > sbi->total_blocks) |
| 179 | − return -2; | |
| 179 | + return -ENOENT; | |
| 180 | 180 | |
| 181 | 181 | mutex_lock(&sbi->alloc_mutex); |
| 182 | 182 | mapping = sbi->alloc_file->i_mapping; |
| 183 | 183 | pnr = offset / PAGE_CACHE_BITS; |
| 184 | 184 | page = read_mapping_page(mapping, pnr, NULL); |
| 185 | + if (IS_ERR(page)) | |
| 186 | + goto kaboom; | |
| 185 | 187 | pptr = kmap(page); |
| 186 | 188 | curr = pptr + (offset & (PAGE_CACHE_BITS - 1)) / 32; |
| 187 | 189 | end = pptr + PAGE_CACHE_BITS / 32; |
| @@ -214,6 +216,8 @@ int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count) · 26 unmodified lines | ||
| 214 | 216 | set_page_dirty(page); |
| 215 | 217 | kunmap(page); |
| 216 | 218 | page = read_mapping_page(mapping, ++pnr, NULL); |
| 219 | + if (IS_ERR(page)) | |
| 220 | + goto kaboom; | |
| 217 | 221 | pptr = kmap(page); |
| 218 | 222 | curr = pptr; |
| 219 | 223 | end = pptr + PAGE_CACHE_BITS / 32; |
| @@ -232,4 +236,11 @@ out: · 12 unmodified lines | ||
| 232 | 236 | mutex_unlock(&sbi->alloc_mutex); |
| 233 | 237 | |
| 234 | 238 | return 0; |
| 239 | + | |
| 240 | +kaboom: | |
| 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 | } |
| @@ -159,7 +159,7 @@ void hfs_btree_close(struct hfs_btree *tree) · 158 unmodified lines | ||
| 159 | 159 | kfree(tree); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | −void hfs_btree_write(struct hfs_btree *tree) | |
| 162 | +int hfs_btree_write(struct hfs_btree *tree) | |
| 163 | 163 | { |
| 164 | 164 | struct hfs_btree_header_rec *head; |
| 165 | 165 | struct hfs_bnode *node; |
| @@ -168,7 +168,7 @@ void hfs_btree_write(struct hfs_btree *tree) · 2 unmodified lines | ||
| 168 | 168 | node = hfs_bnode_find(tree, 0); |
| 169 | 169 | if (IS_ERR(node)) |
| 170 | 170 | /* panic? */ |
| 171 | − return; | |
| 171 | + return -EIO; | |
| 172 | 172 | /* Load the header */ |
| 173 | 173 | page = node->page[0]; |
| 174 | 174 | head = (struct hfs_btree_header_rec *)(kmap(page) + |
| @@ -186,6 +186,7 @@ void hfs_btree_write(struct hfs_btree *tree) · 11 unmodified lines | ||
| 186 | 186 | kunmap(page); |
| 187 | 187 | set_page_dirty(page); |
| 188 | 188 | hfs_bnode_put(node); |
| 189 | + return 0; | |
| 189 | 190 | } |
| 190 | 191 | |
| 191 | 192 | static struct hfs_bnode *hfs_bmap_new_bmap(struct hfs_bnode *prev, u32 idx) |
| @@ -329,6 +329,7 @@ static int hfsplus_free_extents(struct super_block *sb, · 328 unmodified lines | ||
| 329 | 329 | { |
| 330 | 330 | u32 count, start; |
| 331 | 331 | int i; |
| 332 | + int err = 0; | |
| 332 | 333 | |
| 333 | 334 | hfsplus_dump_extent(extent); |
| 334 | 335 | for (i = 0; i < 8; extent++, i++) { |
| @@ -345,18 +346,33 @@ found: · 10 unmodified lines | ||
| 345 | 346 | for (;;) { |
| 346 | 347 | start = be32_to_cpu(extent->start_block); |
| 347 | 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 | 355 | extent->block_count = 0; |
| 350 | 356 | extent->start_block = 0; |
| 351 | 357 | block_nr -= count; |
| 352 | 358 | } else { |
| 353 | 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 | 366 | extent->block_count = cpu_to_be32(count); |
| 356 | 367 | block_nr = 0; |
| 357 | 368 | } |
| 358 | − if (!block_nr || !i) | |
| 359 | − return 0; | |
| 369 | + if (!block_nr || !i) { | |
| 370 | + /* | |
| 371 | + * Try to free all extents and | |
| 372 | + * return only last error | |
| 373 | + */ | |
| 374 | + return err; | |
| 375 | + } | |
| 360 | 376 | i--; |
| 361 | 377 | extent--; |
| 362 | 378 | count = be32_to_cpu(extent->block_count); |
| @@ -335,7 +335,7 @@ int hfsplus_block_free(struct super_block *, u32, u32); · 334 unmodified lines | ||
| 335 | 335 | /* btree.c */ |
| 336 | 336 | struct hfs_btree *hfs_btree_open(struct super_block *, u32); |
| 337 | 337 | void hfs_btree_close(struct hfs_btree *); |
| 338 | −void hfs_btree_write(struct hfs_btree *); | |
| 338 | +int hfs_btree_write(struct hfs_btree *); | |
| 339 | 339 | struct hfs_bnode *hfs_bmap_alloc(struct hfs_btree *); |
| 340 | 340 | void hfs_bmap_free(struct hfs_bnode *); |
| 341 | 341 | |
| @@ -127,8 +127,14 @@ static int hfsplus_system_write_inode(struct inode *inode) · 126 unmodified lines | ||
| 127 | 127 | hfsplus_mark_mdb_dirty(inode->i_sb); |
| 128 | 128 | } |
| 129 | 129 | hfsplus_inode_write_fork(inode, fork); |
| 130 | − if (tree) | |
| 131 | − hfs_btree_write(tree); | |
| 130 | + if (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 | 138 | return 0; |
| 133 | 139 | } |
| 134 | 140 | |
| @@ -226,6 +232,7 @@ out: · 91 unmodified lines | ||
| 226 | 232 | |
| 227 | 233 | static void delayed_sync_fs(struct work_struct *work) |
| 228 | 234 | { |
| 235 | + int err; | |
| 229 | 236 | struct hfsplus_sb_info *sbi; |
| 230 | 237 | |
| 231 | 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) · 2 unmodified lines | ||
| 234 | 241 | sbi->work_queued = 0; |
| 235 | 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 | |
| 240 | 249 | void hfsplus_mark_mdb_dirty(struct super_block *sb) |
| @@ -352,18 +352,18 @@ retry: · 351 unmodified lines | ||
| 352 | 352 | if (!ida_pre_get(&proc_inum_ida, GFP_KERNEL)) |
| 353 | 353 | return -ENOMEM; |
| 354 | 354 | |
| 355 | − spin_lock(&proc_inum_lock); | |
| 355 | + spin_lock_bh(&proc_inum_lock); | |
| 356 | 356 | error = ida_get_new(&proc_inum_ida, &i); |
| 357 | − spin_unlock(&proc_inum_lock); | |
| 357 | + spin_unlock_bh(&proc_inum_lock); | |
| 358 | 358 | if (error == -EAGAIN) |
| 359 | 359 | goto retry; |
| 360 | 360 | else if (error) |
| 361 | 361 | return error; |
| 362 | 362 | |
| 363 | 363 | if (i > UINT_MAX - PROC_DYNAMIC_FIRST) { |
| 364 | − spin_lock(&proc_inum_lock); | |
| 364 | + spin_lock_bh(&proc_inum_lock); | |
| 365 | 365 | ida_remove(&proc_inum_ida, i); |
| 366 | − spin_unlock(&proc_inum_lock); | |
| 366 | + spin_unlock_bh(&proc_inum_lock); | |
| 367 | 367 | return -ENOSPC; |
| 368 | 368 | } |
| 369 | 369 | *inum = PROC_DYNAMIC_FIRST + i; |
| @@ -372,9 +372,9 @@ retry: · 2 unmodified lines | ||
| 372 | 372 | |
| 373 | 373 | void proc_free_inum(unsigned int inum) |
| 374 | 374 | { |
| 375 | − spin_lock(&proc_inum_lock); | |
| 375 | + spin_lock_bh(&proc_inum_lock); | |
| 376 | 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 | |
| 380 | 380 | static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd) |
| @@ -935,6 +935,8 @@ ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, size_t count, · 934 unmodified lines | ||
| 935 | 935 | if (retval > 0) { |
| 936 | 936 | add_rchar(current, retval); |
| 937 | 937 | add_wchar(current, retval); |
| 938 | + fsnotify_access(in.file); | |
| 939 | + fsnotify_modify(out.file); | |
| 938 | 940 | } |
| 939 | 941 | |
| 940 | 942 | inc_syscr(current); |
| @@ -112,6 +112,7 @@ extern int setup_arg_pages(struct linux_binprm * bprm, · 111 unmodified lines | ||
| 112 | 112 | unsigned long stack_top, |
| 113 | 113 | int executable_stack); |
| 114 | 114 | extern int bprm_mm_init(struct linux_binprm *bprm); |
| 115 | +extern int bprm_change_interp(char *interp, struct linux_binprm *bprm); | |
| 115 | 116 | extern int copy_strings_kernel(int argc, const char *const *argv, |
| 116 | 117 | struct linux_binprm *bprm); |
| 117 | 118 | extern int prepare_bprm_creds(struct linux_binprm *bprm); |
| @@ -77,13 +77,15 @@ · 76 unmodified lines | ||
| 77 | 77 | |
| 78 | 78 | /* |
| 79 | 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 | 83 | #define DIV_ROUND_CLOSEST(x, divisor)( \ |
| 83 | 84 | { \ |
| 84 | 85 | typeof(x) __x = x; \ |
| 85 | 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 | 89 | (((__x) + ((__d) / 2)) / (__d)) : \ |
| 88 | 90 | (((__x) - ((__d) / 2)) / (__d)); \ |
| 89 | 91 | } \ |
| @@ -4,6 +4,7 @@ · 3 unmodified lines | ||
| 4 | 4 | #include <linux/string.h> |
| 5 | 5 | #include <linux/random.h> |
| 6 | 6 | #include <linux/module.h> |
| 7 | +#include <linux/ptrace.h> | |
| 7 | 8 | #include <linux/init.h> |
| 8 | 9 | #include <linux/errno.h> |
| 9 | 10 | #include <linux/cache.h> |
| @@ -34,18 +34,15 @@ static __init int module_verify_init(void) · 33 unmodified lines | ||
| 34 | 34 | { |
| 35 | 35 | pr_notice("Initialise module verification\n"); |
| 36 | 36 | |
| 37 | − modsign_keyring = key_alloc(&key_type_keyring, ".module_sign", | |
| 38 | − KUIDT_INIT(0), KGIDT_INIT(0), | |
| 39 | − current_cred(), | |
| 40 | − (KEY_POS_ALL & ~KEY_POS_SETATTR) | | |
| 41 | − KEY_USR_VIEW | KEY_USR_READ, | |
| 42 | − KEY_ALLOC_NOT_IN_QUOTA); | |
| 37 | + modsign_keyring = keyring_alloc(".module_sign", | |
| 38 | + KUIDT_INIT(0), KGIDT_INIT(0), | |
| 39 | + current_cred(), | |
| 40 | + ((KEY_POS_ALL & ~KEY_POS_SETATTR) | | |
| 41 | + KEY_USR_VIEW | KEY_USR_READ), | |
| 42 | + KEY_ALLOC_NOT_IN_QUOTA, NULL); | |
| 43 | 43 | if (IS_ERR(modsign_keyring)) |
| 44 | 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 | 46 | return 0; |
| 50 | 47 | } |
| 51 | 48 | |
| @@ -17,6 +17,21 @@ · 16 unmodified lines | ||
| 17 | 17 | #include <linux/balloon_compaction.h> |
| 18 | 18 | #include "internal.h" |
| 19 | 19 | |
| 20 | +#ifdef CONFIG_COMPACTION | |
| 21 | +static inline void count_compact_event(enum vm_event_item item) | |
| 22 | +{ | |
| 23 | + count_vm_event(item); | |
| 24 | +} | |
| 25 | + | |
| 26 | +static 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 | 35 | #if defined CONFIG_COMPACTION || defined CONFIG_CMA |
| 21 | 36 | |
| 22 | 37 | #define CREATE_TRACE_POINTS |
| @@ -303,10 +318,9 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, · 280 unmodified lines | ||
| 303 | 318 | if (blockpfn == end_pfn) |
| 304 | 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 | 322 | if (total_isolated) |
| 308 | − count_vm_events(COMPACTISOLATED, total_isolated); | |
| 309 | − | |
| 323 | + count_compact_events(COMPACTISOLATED, total_isolated); | |
| 310 | 324 | return total_isolated; |
| 311 | 325 | } |
| 312 | 326 | |
| @@ -613,9 +627,9 @@ next_pageblock: · 300 unmodified lines | ||
| 613 | 627 | |
| 614 | 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 | 631 | if (nr_isolated) |
| 618 | − count_vm_events(COMPACTISOLATED, nr_isolated); | |
| 632 | + count_compact_events(COMPACTISOLATED, nr_isolated); | |
| 619 | 633 | |
| 620 | 634 | return low_pfn; |
| 621 | 635 | } |
| @@ -1110,7 +1124,7 @@ unsigned long try_to_compact_pages(struct zonelist *zonelist, · 488 unmodified lines | ||
| 1110 | 1124 | if (!order || !may_enter_fs || !may_perform_io) |
| 1111 | 1125 | return rc; |
| 1112 | 1126 | |
| 1113 | − count_vm_event(COMPACTSTALL); | |
| 1127 | + count_compact_event(COMPACTSTALL); | |
| 1114 | 1128 | |
| 1115 | 1129 | #ifdef CONFIG_CMA |
| 1116 | 1130 | if (allocflags_to_migratetype(gfp_mask) == MIGRATE_MOVABLE) |
| @@ -574,19 +574,19 @@ static int __init hugepage_init_sysfs(struct kobject **hugepage_kobj) · 573 unmodified lines | ||
| 574 | 574 | |
| 575 | 575 | *hugepage_kobj = kobject_create_and_add("transparent_hugepage", mm_kobj); |
| 576 | 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 | 578 | return -ENOMEM; |
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | err = sysfs_create_group(*hugepage_kobj, &hugepage_attr_group); |
| 582 | 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 | 584 | goto delete_obj; |
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | err = sysfs_create_group(*hugepage_kobj, &khugepaged_attr_group); |
| 588 | 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 | 590 | goto remove_hp_group; |
| 591 | 591 | } |
| 592 | 592 | |
| @@ -6090,7 +6090,6 @@ mem_cgroup_css_alloc(struct cgroup *cont) · 6089 unmodified lines | ||
| 6090 | 6090 | &per_cpu(memcg_stock, cpu); |
| 6091 | 6091 | INIT_WORK(&stock->work, drain_local_stock); |
| 6092 | 6092 | } |
| 6093 | − hotcpu_notifier(memcg_cpu_hotplug_callback, 0); | |
| 6094 | 6093 | } else { |
| 6095 | 6094 | parent = mem_cgroup_from_cont(cont->parent); |
| 6096 | 6095 | memcg->use_hierarchy = parent->use_hierarchy; |
| @@ -6756,6 +6755,19 @@ struct cgroup_subsys mem_cgroup_subsys = { · 659 unmodified lines | ||
| 6756 | 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 | + */ | |
| 6764 | +static int __init mem_cgroup_init(void) | |
| 6765 | +{ | |
| 6766 | + hotcpu_notifier(memcg_cpu_hotplug_callback, 0); | |
| 6767 | + return 0; | |
| 6768 | +} | |
| 6769 | +subsys_initcall(mem_cgroup_init); | |
| 6770 | + | |
| 6759 | 6771 | #ifdef CONFIG_MEMCG_SWAP |
| 6760 | 6772 | static int __init enable_swap_account(char *s) |
| 6761 | 6773 | { |
| @@ -200,6 +200,18 @@ static unsigned long highmem_dirtyable_memory(unsigned long total) · 199 unmodified lines | ||
| 200 | 200 | x += zone_page_state(z, NR_FREE_PAGES) + |
| 201 | 201 | zone_reclaimable_pages(z) - z->dirty_balance_reserve; |
| 202 | 202 | } |
| 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 | + | |
| 203 | 215 | /* |
| 204 | 216 | * Make sure that the number of highmem pages is never larger |
| 205 | 217 | * than the number of the total dirtyable memory. This can only |
| @@ -222,8 +234,8 @@ static unsigned long global_dirtyable_memory(void) · 16 unmodified lines | ||
| 222 | 234 | { |
| 223 | 235 | unsigned long x; |
| 224 | 236 | |
| 225 | − x = global_page_state(NR_FREE_PAGES) + global_reclaimable_pages() - | |
| 226 | − dirty_balance_reserve; | |
| 237 | + x = global_page_state(NR_FREE_PAGES) + global_reclaimable_pages(); | |
| 238 | + x -= min(x, dirty_balance_reserve); | |
| 227 | 239 | |
| 228 | 240 | if (!vm_highmem_is_dirtyable) |
| 229 | 241 | x -= highmem_dirtyable_memory(x); |
| @@ -290,9 +302,12 @@ static unsigned long zone_dirtyable_memory(struct zone *zone) · 60 unmodified lines | ||
| 290 | 302 | * highmem zone can hold its share of dirty pages, so we don't |
| 291 | 303 | * care about vm_highmem_is_dirtyable here. |
| 292 | 304 | */ |
| 293 | − return zone_page_state(zone, NR_FREE_PAGES) + | |
| 294 | − zone_reclaimable_pages(zone) - | |
| 295 | − zone->dirty_balance_reserve; | |
| 305 | + unsigned long nr_pages = zone_page_state(zone, NR_FREE_PAGES) + | |
| 306 | + zone_reclaimable_pages(zone); | |
| 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 | /** |
| @@ -5978,8 +5978,15 @@ done: · 5977 unmodified lines | ||
| 5978 | 5978 | |
| 5979 | 5979 | void free_contig_range(unsigned long pfn, unsigned nr_pages) |
| 5980 | 5980 | { |
| 5981 | − for (; nr_pages--; ++pfn) | |
| 5982 | − __free_page(pfn_to_page(pfn)); | |
| 5981 | + unsigned int count = 0; | |
| 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 | 5991 | #endif |
| 5985 | 5992 | |
| @@ -2226,8 +2226,11 @@ sub process { · 2225 unmodified lines | ||
| 2226 | 2226 | my $path = $1; |
| 2227 | 2227 | if ($path =~ m{//}) { |
| 2228 | 2228 | ERROR("MALFORMED_INCLUDE", |
| 2229 | − "malformed #include filename\n" . | |
| 2230 | − $herecurr); | |
| 2229 | + "malformed #include filename\n" . $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 | |
| @@ -367,8 +367,6 @@ key_ref_t search_my_process_keyrings(struct key_type *type, · 366 unmodified lines | ||
| 367 | 367 | |
| 368 | 368 | switch (PTR_ERR(key_ref)) { |
| 369 | 369 | case -EAGAIN: /* no key */ |
| 370 | − if (ret) | |
| 371 | − break; | |
| 372 | 370 | case -ENOKEY: /* negative key */ |
| 373 | 371 | ret = key_ref; |
| 374 | 372 | break; |