MIPS: O32/32-bit: Fix bug which can cause incorrect system call restarts

On 32-bit/O32, pt_regs has a padding area at the beginning into which the
syscall arguments passed via the user stack are copied. 4 arguments
totalling 16 bytes are copied to offset 16 bytes into this area, however
the area is only 24 bytes long. This means the last 2 arguments overwrite
pt_regs->regs[{0,1}].

If a syscall function returns an error, handle_sys stores the original
syscall number in pt_regs->regs[0] for syscall restart. signal.c checks
whether regs[0] is non-zero, if it is it will check whether the syscall
return value is one of the ERESTART* codes to see if it must be
restarted.

Should a syscall be made that results in a non-zero value being copied
off the user stack into regs[0], and then returns a positive (non-error)
value that matches one of the ERESTART* error codes, this can be mistaken
for requiring a syscall restart.

While the possibility for this to occur has always existed, it is made
much more likely to occur by commit 46e12c07b3b9 ("MIPS: O32 / 32-bit:
Always copy 4 stack arguments."), since now every syscall will copy 4
arguments and overwrite regs[0], rather than just those with 7 or 8
arguments.

Since that commit, booting Debian under a 32-bit MIPS kernel almost
always results in a hang early in boot, due to a wait4 syscall returning
a PID that matches one of the ERESTART* codes, which then causes an
incorrect restart of the syscall.

The problem is fixed by increasing the size of the padding area so that
arguments copied off the stack will not overwrite pt_regs->regs[{0,1}].

Signed-off-by: Alex Smith <alex.smith@imgtec.com>
Cc: <stable@vger.kernel.org> # v3.13+
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Tested-by: Aurelien Jarno <aurelien@aurel32.net>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/7454/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
fbcon: use kstrtouint instead of deprecated function simple_strtoul.
fbcon: continue parsing parameters after an error.
fbcon: optimize parameters parsing loop.
fbcon: add parameter to toggle bind on startup
fonts: Add 6x10 font

This font is suitable for framebuffer consoles on mobile devices with
a 320x240 screen, to get a reasonable number of characters (53x24)
that are still at a readable size.

The font is derived from the existing 6x11 font, but gets 3 extra lines
without sacrificing readability. Also I redesigned a some glyhps so they
are more distinct and better fill the available space.
Input: gpio_keys - Also send release events for ABS codes
Input: gpio_keys - Set ABS params when using axes
backlight: pwm-backlight: Allow to specify PWM polarity in pdata
backlight: pwm-backlight: Don't require the "power" regulator to run
watchdog: JZ4740: Remove dependency towards arch header timer.h

This allows this driver to be used for other JZ47xx platforms,
that won't provide this header.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
watchdog: Allow selection of jz4740-wdt driver on jz4770 archs
watchdog: JZ4740: Fix incorrect register write for stopping the watchdog

It was doing a 16-bit access to set the bit 16, so the value was never
written. Plus, only the bit 16 should be set, as setting other bits may
result in having other clocks started or stopped. Finally, it is not
possible to access the registers once the watchdog clock is stopped, so
we now stop it at the last moment.

This fixes commit 30c7a8d6
watchdog: JZ4770: Make use of the "wdt" clock
RTC: JZ4740: Use macro SIMPLE_DEV_PM_OPS to factorize code
rtc: rtc-jz4740: Add support for the RTC in the jz4770 SoC
net: wireless: Import regulatory DB

We typically update the kernel and the rootfs at the same time,
so there is no advantage for us to load the DB via user space.

Origin of the data:

git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-regdb.git
net: wireless: rtl8192cu: Import alternative driver

This is the driver from Realtek itself, with updates from various
people.

Source: https://github.com/dz0ny/rt8192cu/

Removed CR end-of-line characters and a few other unprintable
characters from the sources.
Selected CONFIG_PLATFORM_MIPS_JZ4760 in the Makefile.
Appended "_ALT" to the main config variable name "CONFIG_RTL8192CU", so
this driver can exist in the same source tree as the mainline driver.
Fixed usage of kthread_run.
net: wireless: rtl8192cu: Update for procfs changes in Linux 3.10

I didn't bother to stay compatible with older kernel versions.
net: wireless: rtl8192cu: Fixed out-of-bounds array init

This was reported as a warning by GCC 4.9.1.