From: Stricted Date: Wed, 21 Mar 2018 21:58:21 +0000 (+0100) Subject: Merge tag 'v3.10.103' into update X-Git-Url: https://git.stricted.de/?p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git;a=commitdiff_plain;h=b9e7bc93d665a989f62f385d6982dd8d92c0e7dd Merge tag 'v3.10.103' into update This is the 3.10.103 stable release --- b9e7bc93d665a989f62f385d6982dd8d92c0e7dd diff --cc drivers/mtd/ubi/build.c index 118cef7d1ecc,03331c173bd0..7269afce27c9 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c @@@ -1225,12 -1054,13 +1227,13 @@@ out_uif ubi_assert(ref); uif_close(ubi); out_detach: + ubi_devices[ubi_num] = NULL; ubi_wl_close(ubi); ubi_free_internal_volumes(ubi); - vfree(ubi->vtbl); + kfree(ubi->vtbl); out_free: - vfree(ubi->peb_buf); - vfree(ubi->fm_buf); + kfree(ubi->peb_buf); + kfree(ubi->fm_buf); if (ref) put_device(&ubi->dev); else diff --cc kernel/printk.c index 617bc0d08e2b,ee8f6be7d8a9..f23cbc5e9ea3 --- a/kernel/printk.c +++ b/kernel/printk.c @@@ -2131,14 -2033,8 +2131,15 @@@ void console_unlock(void static u64 seen_seq; unsigned long flags; bool wake_klogd = false; - bool retry; + bool do_cond_resched, retry; +#ifdef LOG_TOO_MUCH_WARNING + unsigned long total_log_size = 0; + unsigned long long t1 = 0, t2 = 0; + char aee_str[512]; + int org_loglevel = console_loglevel; +#endif + + if (console_suspended) { up(&console_sem); return; @@@ -2203,42 -2104,12 +2215,45 @@@ skip raw_spin_unlock(&logbuf_lock); stop_critical_timings(); /* don't trace print latency */ - call_console_drivers(level, text, len); - start_critical_timings(); +#ifdef LOG_TOO_MUCH_WARNING + /* + For uart console, 10us/per chars + 400,000 chars = need to wait 4.0 sec + normal case: 4sec + */ + if (log_in_resume) { + org_loglevel = console_loglevel; + console_loglevel = 4; + } + total_log_size += len; + if (total_log_size < console_log_max) + call_console_drivers(level, text, len); + else if (!already_skip_log) { + sprintf(aee_str, "PRINTK too much:%lu", total_log_size); + aee_kernel_warning(aee_str, "Need to shrink kernel log"); + already_skip_log = 1; + } + /**/ + start_critical_timings(); + /* For Resume log too much*/ + if (log_in_resume) { + t2 = sched_clock(); + console_loglevel = org_loglevel; + if (t2 - t1 > 100000000) { + sprintf( aee_str,"[RESUME CONSOLE too long:%lluns>100ms] s:%lluns, e:%lluns\n", t2 - t1, t1, t2); + aee_kernel_warning(aee_str, "Need to shrink kernel log"); + } + } + + /**/ +#else + start_critical_timings(); + call_console_drivers(level, text, len); +#endif local_irq_restore(flags); + + if (do_cond_resched) + cond_resched(); } console_locked = 0; mutex_release(&console_lock_dep_map, 1, _RET_IP_); diff --cc net/ipv4/netfilter/arp_tables.c index e4717743316e,95a5f261fe8a..bb1670b371d2 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c @@@ -465,24 -469,6 +469,23 @@@ static int mark_source_chains(const str return 1; } +static inline int check_entry(const struct arpt_entry *e) +{ + const struct xt_entry_target *t; + + if (!arp_checkentry(&e->arp)) + return -EINVAL; + + if (e->target_offset + sizeof(struct xt_entry_target) > e->next_offset) + return -EINVAL; + + t = arpt_get_target_c(e); + if (e->target_offset + t->u.target_size > e->next_offset) + return -EINVAL; + + return 0; +} + - static inline int check_target(struct arpt_entry *e, const char *name) { struct xt_entry_target *t = arpt_get_target(e); @@@ -572,7 -558,11 +575,8 @@@ static inline int check_entry_size_and_ return -EINVAL; } - if (!arp_checkentry(&e->arp)) - return -EINVAL; + err = check_entry(e); + - err = xt_check_entry_offsets(e, e->elems, e->target_offset, - e->next_offset); if (err) return err; @@@ -1233,8 -1195,11 +1209,9 @@@ check_compat_entry_size_and_hooks(struc return -EINVAL; } - if (!arp_checkentry(&e->arp)) - return -EINVAL; + /* For purposes of check_entry casting the compat entry is fine */ + ret = check_entry((struct arpt_entry *)e); + - ret = xt_compat_check_entry_offsets(e, e->elems, e->target_offset, - e->next_offset); if (ret) return ret; diff --cc net/ipv4/netfilter/ip_tables.c index e6cd22262ed1,92c8f2727ee9..8672b124e1cc --- a/net/ipv4/netfilter/ip_tables.c +++ b/net/ipv4/netfilter/ip_tables.c @@@ -734,7 -718,11 +738,8 @@@ check_entry_size_and_hooks(struct ipt_e return -EINVAL; } - if (!ip_checkentry(&e->ip)) - return -EINVAL; + err = check_entry(e); + - err = xt_check_entry_offsets(e, e->elems, e->target_offset, - e->next_offset); if (err) return err; @@@ -1498,8 -1447,11 +1464,9 @@@ check_compat_entry_size_and_hooks(struc return -EINVAL; } - if (!ip_checkentry(&e->ip)) - return -EINVAL; + /* For purposes of check_entry casting the compat entry is fine */ + ret = check_entry((struct ipt_entry *)e); + - ret = xt_compat_check_entry_offsets(e, e->elems, - e->target_offset, e->next_offset); if (ret) return ret; diff --cc net/ipv6/netfilter/ip6_tables.c index 2b3c29b2c5a3,e214222cd06f..beebca7c139b --- a/net/ipv6/netfilter/ip6_tables.c +++ b/net/ipv6/netfilter/ip6_tables.c @@@ -200,10 -200,9 +200,10 @@@ static inline bool unconditional(const static const struct ip6t_ip6 uncond; return e->target_offset == sizeof(struct ip6t_entry) && - memcmp(&e->ipv6, &uncond, sizeof(uncond)) == 0; + memcmp(&e->ipv6, &uncond, sizeof(uncond)) == 0; } + static inline const struct xt_entry_target * ip6t_get_target_c(const struct ip6t_entry *e) { @@@ -569,26 -572,6 +573,25 @@@ static void cleanup_match(struct xt_ent module_put(par.match->me); } +static int +check_entry(const struct ip6t_entry *e) +{ + const struct xt_entry_target *t; + + if (!ip6_checkentry(&e->ipv6)) + return -EINVAL; + + if (e->target_offset + sizeof(struct xt_entry_target) > + e->next_offset) + return -EINVAL; + + t = ip6t_get_target_c(e); + if (e->target_offset + t->u.target_size > e->next_offset) + return -EINVAL; + + return 0; +} + - static int check_match(struct xt_entry_match *m, struct xt_mtchk_param *par) { const struct ip6t_ip6 *ipv6 = par->entryinfo; @@@ -746,7 -729,11 +749,8 @@@ check_entry_size_and_hooks(struct ip6t_ return -EINVAL; } - if (!ip6_checkentry(&e->ipv6)) - return -EINVAL; + err = check_entry(e); + - err = xt_check_entry_offsets(e, e->elems, e->target_offset, - e->next_offset); if (err) return err; @@@ -1511,8 -1458,11 +1475,9 @@@ check_compat_entry_size_and_hooks(struc return -EINVAL; } - if (!ip6_checkentry(&e->ipv6)) - return -EINVAL; + /* For purposes of check_entry casting the compat entry is fine */ + ret = check_entry((struct ip6t_entry *)e); + - ret = xt_compat_check_entry_offsets(e, e->elems, - e->target_offset, e->next_offset); if (ret) return ret;