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
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;
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_);
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);
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;
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;
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;
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;
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)
{
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;
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;
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;