diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Kconfig.debug | 20 | ||||
| -rw-r--r-- | lib/bcd.c | 8 | ||||
| -rw-r--r-- | lib/digsig.c | 6 | ||||
| -rw-r--r-- | lib/dynamic_debug.c | 56 | ||||
| -rw-r--r-- | lib/flex_proportions.c | 2 | ||||
| -rw-r--r-- | lib/kobject_uevent.c | 5 | ||||
| -rw-r--r-- | lib/nlattr.c | 4 | ||||
| -rw-r--r-- | lib/swiotlb.c | 33 |
8 files changed, 100 insertions, 34 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 2403a63b5da5..35c4565ee8fa 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
| @@ -452,7 +452,8 @@ config SLUB_STATS | |||
| 452 | config DEBUG_KMEMLEAK | 452 | config DEBUG_KMEMLEAK |
| 453 | bool "Kernel memory leak detector" | 453 | bool "Kernel memory leak detector" |
| 454 | depends on DEBUG_KERNEL && EXPERIMENTAL && \ | 454 | depends on DEBUG_KERNEL && EXPERIMENTAL && \ |
| 455 | (X86 || ARM || PPC || MIPS || S390 || SPARC64 || SUPERH || MICROBLAZE || TILE) | 455 | (X86 || ARM || PPC || MIPS || S390 || SPARC64 || SUPERH || \ |
| 456 | MICROBLAZE || TILE || ARM64) | ||
| 456 | 457 | ||
| 457 | select DEBUG_FS | 458 | select DEBUG_FS |
| 458 | select STACKTRACE if STACKTRACE_SUPPORT | 459 | select STACKTRACE if STACKTRACE_SUPPORT |
| @@ -629,6 +630,20 @@ config PROVE_RCU_REPEATEDLY | |||
| 629 | 630 | ||
| 630 | Say N if you are unsure. | 631 | Say N if you are unsure. |
| 631 | 632 | ||
| 633 | config PROVE_RCU_DELAY | ||
| 634 | bool "RCU debugging: preemptible RCU race provocation" | ||
| 635 | depends on DEBUG_KERNEL && PREEMPT_RCU | ||
| 636 | default n | ||
| 637 | help | ||
| 638 | There is a class of races that involve an unlikely preemption | ||
| 639 | of __rcu_read_unlock() just after ->rcu_read_lock_nesting has | ||
| 640 | been set to INT_MIN. This feature inserts a delay at that | ||
| 641 | point to increase the probability of these races. | ||
| 642 | |||
| 643 | Say Y to increase probability of preemption of __rcu_read_unlock(). | ||
| 644 | |||
| 645 | Say N if you are unsure. | ||
| 646 | |||
| 632 | config SPARSE_RCU_POINTER | 647 | config SPARSE_RCU_POINTER |
| 633 | bool "RCU debugging: sparse-based checks for pointer usage" | 648 | bool "RCU debugging: sparse-based checks for pointer usage" |
| 634 | default n | 649 | default n |
| @@ -739,7 +754,8 @@ config DEBUG_BUGVERBOSE | |||
| 739 | bool "Verbose BUG() reporting (adds 70K)" if DEBUG_KERNEL && EXPERT | 754 | bool "Verbose BUG() reporting (adds 70K)" if DEBUG_KERNEL && EXPERT |
| 740 | depends on BUG | 755 | depends on BUG |
| 741 | depends on ARM || AVR32 || M32R || M68K || SPARC32 || SPARC64 || \ | 756 | depends on ARM || AVR32 || M32R || M68K || SPARC32 || SPARC64 || \ |
| 742 | FRV || SUPERH || GENERIC_BUG || BLACKFIN || MN10300 || TILE | 757 | FRV || SUPERH || GENERIC_BUG || BLACKFIN || MN10300 || \ |
| 758 | TILE || ARM64 | ||
| 743 | default y | 759 | default y |
| 744 | help | 760 | help |
| 745 | Say Y here to make BUG() panics output the file name and line number | 761 | Say Y here to make BUG() panics output the file name and line number |
| @@ -1,14 +1,14 @@ | |||
| 1 | #include <linux/bcd.h> | 1 | #include <linux/bcd.h> |
| 2 | #include <linux/export.h> | 2 | #include <linux/export.h> |
| 3 | 3 | ||
| 4 | unsigned bcd2bin(unsigned char val) | 4 | unsigned _bcd2bin(unsigned char val) |
| 5 | { | 5 | { |
| 6 | return (val & 0x0f) + (val >> 4) * 10; | 6 | return (val & 0x0f) + (val >> 4) * 10; |
| 7 | } | 7 | } |
| 8 | EXPORT_SYMBOL(bcd2bin); | 8 | EXPORT_SYMBOL(_bcd2bin); |
| 9 | 9 | ||
| 10 | unsigned char bin2bcd(unsigned val) | 10 | unsigned char _bin2bcd(unsigned val) |
| 11 | { | 11 | { |
| 12 | return ((val / 10) << 4) + val % 10; | 12 | return ((val / 10) << 4) + val % 10; |
| 13 | } | 13 | } |
| 14 | EXPORT_SYMBOL(bin2bcd); | 14 | EXPORT_SYMBOL(_bin2bcd); |
diff --git a/lib/digsig.c b/lib/digsig.c index 286d558033e2..8c0e62975c88 100644 --- a/lib/digsig.c +++ b/lib/digsig.c | |||
| @@ -163,9 +163,11 @@ static int digsig_verify_rsa(struct key *key, | |||
| 163 | memcpy(out1 + head, p, l); | 163 | memcpy(out1 + head, p, l); |
| 164 | 164 | ||
| 165 | err = pkcs_1_v1_5_decode_emsa(out1, len, mblen, out2, &len); | 165 | err = pkcs_1_v1_5_decode_emsa(out1, len, mblen, out2, &len); |
| 166 | if (err) | ||
| 167 | goto err; | ||
| 166 | 168 | ||
| 167 | if (!err && len == hlen) | 169 | if (len != hlen || memcmp(out2, h, hlen)) |
| 168 | err = memcmp(out2, h, hlen); | 170 | err = -EINVAL; |
| 169 | 171 | ||
| 170 | err: | 172 | err: |
| 171 | mpi_free(in); | 173 | mpi_free(in); |
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 7ca29a0a3019..e7f7d993357a 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c | |||
| @@ -521,25 +521,25 @@ static char *dynamic_emit_prefix(const struct _ddebug *desc, char *buf) | |||
| 521 | int pos_after_tid; | 521 | int pos_after_tid; |
| 522 | int pos = 0; | 522 | int pos = 0; |
| 523 | 523 | ||
| 524 | pos += snprintf(buf + pos, remaining(pos), "%s", KERN_DEBUG); | 524 | *buf = '\0'; |
| 525 | |||
| 525 | if (desc->flags & _DPRINTK_FLAGS_INCL_TID) { | 526 | if (desc->flags & _DPRINTK_FLAGS_INCL_TID) { |
| 526 | if (in_interrupt()) | 527 | if (in_interrupt()) |
| 527 | pos += snprintf(buf + pos, remaining(pos), "%s ", | 528 | pos += snprintf(buf + pos, remaining(pos), "<intr> "); |
| 528 | "<intr>"); | ||
| 529 | else | 529 | else |
| 530 | pos += snprintf(buf + pos, remaining(pos), "[%d] ", | 530 | pos += snprintf(buf + pos, remaining(pos), "[%d] ", |
| 531 | task_pid_vnr(current)); | 531 | task_pid_vnr(current)); |
| 532 | } | 532 | } |
| 533 | pos_after_tid = pos; | 533 | pos_after_tid = pos; |
| 534 | if (desc->flags & _DPRINTK_FLAGS_INCL_MODNAME) | 534 | if (desc->flags & _DPRINTK_FLAGS_INCL_MODNAME) |
| 535 | pos += snprintf(buf + pos, remaining(pos), "%s:", | 535 | pos += snprintf(buf + pos, remaining(pos), "%s:", |
| 536 | desc->modname); | 536 | desc->modname); |
| 537 | if (desc->flags & _DPRINTK_FLAGS_INCL_FUNCNAME) | 537 | if (desc->flags & _DPRINTK_FLAGS_INCL_FUNCNAME) |
| 538 | pos += snprintf(buf + pos, remaining(pos), "%s:", | 538 | pos += snprintf(buf + pos, remaining(pos), "%s:", |
| 539 | desc->function); | 539 | desc->function); |
| 540 | if (desc->flags & _DPRINTK_FLAGS_INCL_LINENO) | 540 | if (desc->flags & _DPRINTK_FLAGS_INCL_LINENO) |
| 541 | pos += snprintf(buf + pos, remaining(pos), "%d:", | 541 | pos += snprintf(buf + pos, remaining(pos), "%d:", |
| 542 | desc->lineno); | 542 | desc->lineno); |
| 543 | if (pos - pos_after_tid) | 543 | if (pos - pos_after_tid) |
| 544 | pos += snprintf(buf + pos, remaining(pos), " "); | 544 | pos += snprintf(buf + pos, remaining(pos), " "); |
| 545 | if (pos >= PREFIX_SIZE) | 545 | if (pos >= PREFIX_SIZE) |
| @@ -559,9 +559,13 @@ int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...) | |||
| 559 | BUG_ON(!fmt); | 559 | BUG_ON(!fmt); |
| 560 | 560 | ||
| 561 | va_start(args, fmt); | 561 | va_start(args, fmt); |
| 562 | |||
| 562 | vaf.fmt = fmt; | 563 | vaf.fmt = fmt; |
| 563 | vaf.va = &args; | 564 | vaf.va = &args; |
| 564 | res = printk("%s%pV", dynamic_emit_prefix(descriptor, buf), &vaf); | 565 | |
| 566 | res = printk(KERN_DEBUG "%s%pV", | ||
| 567 | dynamic_emit_prefix(descriptor, buf), &vaf); | ||
| 568 | |||
| 565 | va_end(args); | 569 | va_end(args); |
| 566 | 570 | ||
| 567 | return res; | 571 | return res; |
| @@ -574,15 +578,26 @@ int __dynamic_dev_dbg(struct _ddebug *descriptor, | |||
| 574 | struct va_format vaf; | 578 | struct va_format vaf; |
| 575 | va_list args; | 579 | va_list args; |
| 576 | int res; | 580 | int res; |
| 577 | char buf[PREFIX_SIZE]; | ||
| 578 | 581 | ||
| 579 | BUG_ON(!descriptor); | 582 | BUG_ON(!descriptor); |
| 580 | BUG_ON(!fmt); | 583 | BUG_ON(!fmt); |
| 581 | 584 | ||
| 582 | va_start(args, fmt); | 585 | va_start(args, fmt); |
| 586 | |||
| 583 | vaf.fmt = fmt; | 587 | vaf.fmt = fmt; |
| 584 | vaf.va = &args; | 588 | vaf.va = &args; |
| 585 | res = __dev_printk(dynamic_emit_prefix(descriptor, buf), dev, &vaf); | 589 | |
| 590 | if (!dev) { | ||
| 591 | res = printk(KERN_DEBUG "(NULL device *): %pV", &vaf); | ||
| 592 | } else { | ||
| 593 | char buf[PREFIX_SIZE]; | ||
| 594 | |||
| 595 | res = dev_printk_emit(7, dev, "%s%s %s: %pV", | ||
| 596 | dynamic_emit_prefix(descriptor, buf), | ||
| 597 | dev_driver_string(dev), dev_name(dev), | ||
| 598 | &vaf); | ||
| 599 | } | ||
| 600 | |||
| 586 | va_end(args); | 601 | va_end(args); |
| 587 | 602 | ||
| 588 | return res; | 603 | return res; |
| @@ -592,20 +607,35 @@ EXPORT_SYMBOL(__dynamic_dev_dbg); | |||
| 592 | #ifdef CONFIG_NET | 607 | #ifdef CONFIG_NET |
| 593 | 608 | ||
| 594 | int __dynamic_netdev_dbg(struct _ddebug *descriptor, | 609 | int __dynamic_netdev_dbg(struct _ddebug *descriptor, |
| 595 | const struct net_device *dev, const char *fmt, ...) | 610 | const struct net_device *dev, const char *fmt, ...) |
| 596 | { | 611 | { |
| 597 | struct va_format vaf; | 612 | struct va_format vaf; |
| 598 | va_list args; | 613 | va_list args; |
| 599 | int res; | 614 | int res; |
| 600 | char buf[PREFIX_SIZE]; | ||
| 601 | 615 | ||
| 602 | BUG_ON(!descriptor); | 616 | BUG_ON(!descriptor); |
| 603 | BUG_ON(!fmt); | 617 | BUG_ON(!fmt); |
| 604 | 618 | ||
| 605 | va_start(args, fmt); | 619 | va_start(args, fmt); |
| 620 | |||
| 606 | vaf.fmt = fmt; | 621 | vaf.fmt = fmt; |
| 607 | vaf.va = &args; | 622 | vaf.va = &args; |
| 608 | res = __netdev_printk(dynamic_emit_prefix(descriptor, buf), dev, &vaf); | 623 | |
| 624 | if (dev && dev->dev.parent) { | ||
| 625 | char buf[PREFIX_SIZE]; | ||
| 626 | |||
| 627 | res = dev_printk_emit(7, dev->dev.parent, | ||
| 628 | "%s%s %s %s: %pV", | ||
| 629 | dynamic_emit_prefix(descriptor, buf), | ||
| 630 | dev_driver_string(dev->dev.parent), | ||
| 631 | dev_name(dev->dev.parent), | ||
| 632 | netdev_name(dev), &vaf); | ||
| 633 | } else if (dev) { | ||
| 634 | res = printk(KERN_DEBUG "%s: %pV", netdev_name(dev), &vaf); | ||
| 635 | } else { | ||
| 636 | res = printk(KERN_DEBUG "(NULL net_device): %pV", &vaf); | ||
| 637 | } | ||
| 638 | |||
| 609 | va_end(args); | 639 | va_end(args); |
| 610 | 640 | ||
| 611 | return res; | 641 | return res; |
diff --git a/lib/flex_proportions.c b/lib/flex_proportions.c index c785554f9523..ebf3bac460b0 100644 --- a/lib/flex_proportions.c +++ b/lib/flex_proportions.c | |||
| @@ -62,7 +62,7 @@ void fprop_global_destroy(struct fprop_global *p) | |||
| 62 | */ | 62 | */ |
| 63 | bool fprop_new_period(struct fprop_global *p, int periods) | 63 | bool fprop_new_period(struct fprop_global *p, int periods) |
| 64 | { | 64 | { |
| 65 | u64 events; | 65 | s64 events; |
| 66 | unsigned long flags; | 66 | unsigned long flags; |
| 67 | 67 | ||
| 68 | local_irq_save(flags); | 68 | local_irq_save(flags); |
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index 0401d2916d9f..52e5abbc41db 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c | |||
| @@ -375,14 +375,14 @@ static int uevent_net_init(struct net *net) | |||
| 375 | struct uevent_sock *ue_sk; | 375 | struct uevent_sock *ue_sk; |
| 376 | struct netlink_kernel_cfg cfg = { | 376 | struct netlink_kernel_cfg cfg = { |
| 377 | .groups = 1, | 377 | .groups = 1, |
| 378 | .flags = NL_CFG_F_NONROOT_RECV, | ||
| 378 | }; | 379 | }; |
| 379 | 380 | ||
| 380 | ue_sk = kzalloc(sizeof(*ue_sk), GFP_KERNEL); | 381 | ue_sk = kzalloc(sizeof(*ue_sk), GFP_KERNEL); |
| 381 | if (!ue_sk) | 382 | if (!ue_sk) |
| 382 | return -ENOMEM; | 383 | return -ENOMEM; |
| 383 | 384 | ||
| 384 | ue_sk->sk = netlink_kernel_create(net, NETLINK_KOBJECT_UEVENT, | 385 | ue_sk->sk = netlink_kernel_create(net, NETLINK_KOBJECT_UEVENT, &cfg); |
| 385 | THIS_MODULE, &cfg); | ||
| 386 | if (!ue_sk->sk) { | 386 | if (!ue_sk->sk) { |
| 387 | printk(KERN_ERR | 387 | printk(KERN_ERR |
| 388 | "kobject_uevent: unable to create netlink socket!\n"); | 388 | "kobject_uevent: unable to create netlink socket!\n"); |
| @@ -422,7 +422,6 @@ static struct pernet_operations uevent_net_ops = { | |||
| 422 | 422 | ||
| 423 | static int __init kobject_uevent_init(void) | 423 | static int __init kobject_uevent_init(void) |
| 424 | { | 424 | { |
| 425 | netlink_set_nonroot(NETLINK_KOBJECT_UEVENT, NL_NONROOT_RECV); | ||
| 426 | return register_pernet_subsys(&uevent_net_ops); | 425 | return register_pernet_subsys(&uevent_net_ops); |
| 427 | } | 426 | } |
| 428 | 427 | ||
diff --git a/lib/nlattr.c b/lib/nlattr.c index 4226dfeb5178..18eca7809b08 100644 --- a/lib/nlattr.c +++ b/lib/nlattr.c | |||
| @@ -22,6 +22,10 @@ static const u16 nla_attr_minlen[NLA_TYPE_MAX+1] = { | |||
| 22 | [NLA_U64] = sizeof(u64), | 22 | [NLA_U64] = sizeof(u64), |
| 23 | [NLA_MSECS] = sizeof(u64), | 23 | [NLA_MSECS] = sizeof(u64), |
| 24 | [NLA_NESTED] = NLA_HDRLEN, | 24 | [NLA_NESTED] = NLA_HDRLEN, |
| 25 | [NLA_S8] = sizeof(s8), | ||
| 26 | [NLA_S16] = sizeof(s16), | ||
| 27 | [NLA_S32] = sizeof(s32), | ||
| 28 | [NLA_S64] = sizeof(s64), | ||
| 25 | }; | 29 | }; |
| 26 | 30 | ||
| 27 | static int validate_nla(const struct nlattr *nla, int maxtype, | 31 | static int validate_nla(const struct nlattr *nla, int maxtype, |
diff --git a/lib/swiotlb.c b/lib/swiotlb.c index 45bc1f83a5ad..f114bf6a8e13 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c | |||
| @@ -170,7 +170,7 @@ void __init swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose) | |||
| 170 | * Statically reserve bounce buffer space and initialize bounce buffer data | 170 | * Statically reserve bounce buffer space and initialize bounce buffer data |
| 171 | * structures for the software IO TLB used to implement the DMA API. | 171 | * structures for the software IO TLB used to implement the DMA API. |
| 172 | */ | 172 | */ |
| 173 | void __init | 173 | static void __init |
| 174 | swiotlb_init_with_default_size(size_t default_size, int verbose) | 174 | swiotlb_init_with_default_size(size_t default_size, int verbose) |
| 175 | { | 175 | { |
| 176 | unsigned long bytes; | 176 | unsigned long bytes; |
| @@ -206,8 +206,9 @@ swiotlb_init(int verbose) | |||
| 206 | int | 206 | int |
| 207 | swiotlb_late_init_with_default_size(size_t default_size) | 207 | swiotlb_late_init_with_default_size(size_t default_size) |
| 208 | { | 208 | { |
| 209 | unsigned long i, bytes, req_nslabs = io_tlb_nslabs; | 209 | unsigned long bytes, req_nslabs = io_tlb_nslabs; |
| 210 | unsigned int order; | 210 | unsigned int order; |
| 211 | int rc = 0; | ||
| 211 | 212 | ||
| 212 | if (!io_tlb_nslabs) { | 213 | if (!io_tlb_nslabs) { |
| 213 | io_tlb_nslabs = (default_size >> IO_TLB_SHIFT); | 214 | io_tlb_nslabs = (default_size >> IO_TLB_SHIFT); |
| @@ -229,16 +230,32 @@ swiotlb_late_init_with_default_size(size_t default_size) | |||
| 229 | order--; | 230 | order--; |
| 230 | } | 231 | } |
| 231 | 232 | ||
| 232 | if (!io_tlb_start) | 233 | if (!io_tlb_start) { |
| 233 | goto cleanup1; | 234 | io_tlb_nslabs = req_nslabs; |
| 234 | 235 | return -ENOMEM; | |
| 236 | } | ||
| 235 | if (order != get_order(bytes)) { | 237 | if (order != get_order(bytes)) { |
| 236 | printk(KERN_WARNING "Warning: only able to allocate %ld MB " | 238 | printk(KERN_WARNING "Warning: only able to allocate %ld MB " |
| 237 | "for software IO TLB\n", (PAGE_SIZE << order) >> 20); | 239 | "for software IO TLB\n", (PAGE_SIZE << order) >> 20); |
| 238 | io_tlb_nslabs = SLABS_PER_PAGE << order; | 240 | io_tlb_nslabs = SLABS_PER_PAGE << order; |
| 239 | bytes = io_tlb_nslabs << IO_TLB_SHIFT; | ||
| 240 | } | 241 | } |
| 242 | rc = swiotlb_late_init_with_tbl(io_tlb_start, io_tlb_nslabs); | ||
| 243 | if (rc) | ||
| 244 | free_pages((unsigned long)io_tlb_start, order); | ||
| 245 | return rc; | ||
| 246 | } | ||
| 247 | |||
| 248 | int | ||
| 249 | swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs) | ||
| 250 | { | ||
| 251 | unsigned long i, bytes; | ||
| 252 | |||
| 253 | bytes = nslabs << IO_TLB_SHIFT; | ||
| 254 | |||
| 255 | io_tlb_nslabs = nslabs; | ||
| 256 | io_tlb_start = tlb; | ||
| 241 | io_tlb_end = io_tlb_start + bytes; | 257 | io_tlb_end = io_tlb_start + bytes; |
| 258 | |||
| 242 | memset(io_tlb_start, 0, bytes); | 259 | memset(io_tlb_start, 0, bytes); |
| 243 | 260 | ||
| 244 | /* | 261 | /* |
| @@ -288,10 +305,8 @@ cleanup3: | |||
| 288 | io_tlb_list = NULL; | 305 | io_tlb_list = NULL; |
| 289 | cleanup2: | 306 | cleanup2: |
| 290 | io_tlb_end = NULL; | 307 | io_tlb_end = NULL; |
| 291 | free_pages((unsigned long)io_tlb_start, order); | ||
| 292 | io_tlb_start = NULL; | 308 | io_tlb_start = NULL; |
| 293 | cleanup1: | 309 | io_tlb_nslabs = 0; |
| 294 | io_tlb_nslabs = req_nslabs; | ||
| 295 | return -ENOMEM; | 310 | return -ENOMEM; |
| 296 | } | 311 | } |
| 297 | 312 | ||
