Merge branch 'ep93xx-fixes' into ep93xx-for-next
Merge branch 'ep93xx-cleanup' into ep93xx-for-next
logfs: fix possible memory leak in logfs_mtd_can_write_buf()

buf has been allocated in this function and should be
freed before leaving from the error handling case.

spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com>
Merge branch 'ep93xx-fixes' into ep93xx-for-next
Merge branch 'ep93xx-fixes' into ep93xx-for-next
Merge branch 'ep93xx-fixes' into ep93xx-for-next
Fix the call to BUG() caused by no free segment found

When some incomplete write is detected during the mount, logfs try to recover
and look for a free segment but the list of free segment is populated only later.
This patch switch both function calls.

Signed-off-by: Tristan Lelong <tlelong@adeneo-embedded.com>
Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com>
Merge branch 'ep93xx-fixes' into ep93xx-for-next
do_mounts: constify name_to_dev_t parameter

Signed-off-by: Joern Engel <joern@logfs.org>
add blockconsole version 1.1

Console driver similar to netconsole, except it writes to a block
device.  Can be useful in a setup where netconsole, for whatever
reasons, is impractical.

Changes since version 1.0:
- Header format overhaul, addressing several annoyances when actually
  using blockconsole for production.
- Steve Hodgson added a panic notifier.
- Added improvements and cleanups from Borislav Petkov.

Signed-off-by: Steve Hodgson <steve@purestorage.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Joern Engel <joern@logfs.org>
printk: add CON_ALLDATA console flag

For consoles like netconsole and blockconsole the loglevel filtering
really doesn't make any sense.  If a line gets printed at all, please
send it down to that console, no questions asked.

For vga_con, it is a completely different matter, as the user sitting in
front of his console could get spammed by messages while trying to login
or similar.  So ignore_loglevel doesn't work as a one-size-fits-all
approach.  Add a per-console flag instead so that netconsole and
blockconsole can opt-in.

Signed-off-by: Joern Engel <joern@logfs.org>
netconsole: use CON_ALLDATA

Netconsole should really see every message ever printed.  The
alternative is to try debugging with information like this:
[166135.633974] Stack:
[166135.634016] Call Trace:
[166135.634029]  <IRQ>
[166135.634156]  <EOI>
[166135.634177] Code: 00 00 55 48 89 e5 0f 1f 44 00 00 ff 15 31 49 80 00 c9 c3 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 55 48 89 e5 0f 1f 44 00 00
[166135.634384]  48 8b 14 25 98 24 01 00 48 8d 14 92 48 8d 04 bd 00 00 00 00

Signed-off-by: Joern Engel <joern@logfs.org>
blockconsole: use CON_ALLDATA

Blockconsole should really see every message ever printed.  The
alternative is to try debugging with information like this:
[166135.633974] Stack:
[166135.634016] Call Trace:
[166135.634029]  <IRQ>
[166135.634156]  <EOI>
[166135.634177] Code: 00 00 55 48 89 e5 0f 1f 44 00 00 ff 15 31 49 80 00 c9 c3 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 55 48 89 e5 0f 1f 44 00 00
[166135.634384]  48 8b 14 25 98 24 01 00 48 8d 14 92 48 8d 04 bd 00 00 00 00

Signed-off-by: Joern Engel <joern@logfs.org>
bcon: add a release work struct

The final bcon_put() can be called from atomic context, by way of
bio_endio().  In that case we would sleep in invalidate_mapping_pages(),
with the usual unhappy results.

In nearly a year of production use, I have only seen a matching
backtrace once.  There was a second known issue that could be reproduced
by "yes h > /proc/sysrq-trigger" and concurrently pulling and replugging
the blockconsole device.  It took be somewhere around 30 pulls and sore
thumbs to reproduce and I never found the time to get to the bottom of
it.  Quite likely the two issues are identical.

Signed-off-by: Joern Engel <joern@logfs.org>
bcon: check for hdparm in bcon_tail

From: Borislav Petkov <bp@alien8.de>
Signed-off-by: Joern Engel <joern@logfs.org>
blockconsole: Allow to pass a device file path to bcon_tail

... instead of always looking through all devices.

Minor tweak: Moved the "CANDIDATES=" line below Takashi's new code.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Joern Engel <joern@logfs.org>
bcon: remove version 1.0 support

Very few machines ever ran with 1.0 format and by now I doubt whether a
single one still does.  No need to carry that code along.

Signed-off-by: Joern Engel <joern@logfs.org>
kdb: A fix for kdb command table expansion

When locally adding in some additional kdb commands, I stumbled
across an issue with the dynamic expansion of the kdb command table.
When the number of kdb commands exceeds the size of the statically
allocated kdb_base_commands[] array, additional space is allocated in
the kdb_register_repeat() routine.

The unused portion of the newly allocated array was not being initialized
to zero properly and this would result in segfaults when help '?' was
executed or when a search for a non-existing command would traverse the
command table beyond the end of valid command entries and then attempt
to use the non-zeroed area as actual command entries.

Signed-off-by: John Blackwood <john.blackwood@ccur.com>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
kgdb/kgdbts: support ppc64

We can't look up the address of the entry point of the function simply
via that function symbol for all architectures.

For PPC64 ABI, actually there is a function descriptors structure.

A function descriptor is a three doubleword data structure that contains
the following values:
	* The first doubleword contains the address of the entry point of
		the function.
	* The second doubleword contains the TOC base address for
		the function.
	* The third doubleword contains the environment pointer for
		languages such as Pascal and PL/1.

So we should call a wapperred dereference_function_descriptor() to get
the address of the entry point of the function.

Note this is also safe for other architecture after refer to
"include/asm-generic/sections.h" since:

dereference_function_descriptor(p) always is (p) if without arched definition.

Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
kdb: use ARRAY_SIZE where possible

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>