From: Greg Kroah-Hartman Date: Sat, 17 Aug 2013 04:38:21 +0000 (-0700) Subject: 3.0-stable patches X-Git-Tag: v3.0.92~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=54880287d11ad52f12a04d7e0c0d0d9eebd6a447;p=thirdparty%2Fkernel%2Fstable-queue.git 3.0-stable patches added patches: m68k-atari-aranym-fix-natfeat-module-support.patch --- diff --git a/queue-3.0/m68k-atari-aranym-fix-natfeat-module-support.patch b/queue-3.0/m68k-atari-aranym-fix-natfeat-module-support.patch new file mode 100644 index 00000000000..3ce071c7aef --- /dev/null +++ b/queue-3.0/m68k-atari-aranym-fix-natfeat-module-support.patch @@ -0,0 +1,80 @@ +From e8184e10f89736a23ea6eea8e24cd524c5c513d2 Mon Sep 17 00:00:00 2001 +From: Geert Uytterhoeven +Date: Fri, 26 Jul 2013 00:08:25 +0200 +Subject: m68k/atari: ARAnyM - Fix NatFeat module support + +From: Geert Uytterhoeven + +commit e8184e10f89736a23ea6eea8e24cd524c5c513d2 upstream. + +As pointed out by Andreas Schwab, pointers passed to ARAnyM NatFeat calls +should be physical addresses, not virtual addresses. + +Fortunately on Atari, physical and virtual kernel addresses are the same, +as long as normal kernel memory is concerned, so this usually worked fine +without conversion. + +But for modules, pointers to literal strings are located in vmalloc()ed +memory. Depending on the version of ARAnyM, this causes the nf_get_id() +call to just fail, or worse, crash ARAnyM itself with e.g. + + Gotcha! Illegal memory access. Atari PC = $968c + +This is a big issue for distro kernels, who want to have all drivers as +loadable modules in an initrd. + +Add a wrapper for nf_get_id() that copies the literal to the stack to +work around this issue. + +Reported-by: Thorsten Glaser +Signed-off-by: Geert Uytterhoeven +Signed-off-by: Greg Kroah-Hartman + +--- + arch/m68k/emu/natfeat.c | 23 +++++++++++++++++++---- + 1 file changed, 19 insertions(+), 4 deletions(-) + +--- a/arch/m68k/emu/natfeat.c ++++ b/arch/m68k/emu/natfeat.c +@@ -18,9 +18,11 @@ + #include + #include + ++extern long nf_get_id2(const char *feature_name); ++ + asm("\n" +-" .global nf_get_id,nf_call\n" +-"nf_get_id:\n" ++" .global nf_get_id2,nf_call\n" ++"nf_get_id2:\n" + " .short 0x7300\n" + " rts\n" + "nf_call:\n" +@@ -29,12 +31,25 @@ asm("\n" + "1: moveq.l #0,%d0\n" + " rts\n" + " .section __ex_table,\"a\"\n" +-" .long nf_get_id,1b\n" ++" .long nf_get_id2,1b\n" + " .long nf_call,1b\n" + " .previous"); +-EXPORT_SYMBOL_GPL(nf_get_id); + EXPORT_SYMBOL_GPL(nf_call); + ++long nf_get_id(const char *feature_name) ++{ ++ /* feature_name may be in vmalloc()ed memory, so make a copy */ ++ char name_copy[32]; ++ size_t n; ++ ++ n = strlcpy(name_copy, feature_name, sizeof(name_copy)); ++ if (n >= sizeof(name_copy)) ++ return 0; ++ ++ return nf_get_id2(name_copy); ++} ++EXPORT_SYMBOL_GPL(nf_get_id); ++ + void nfprint(const char *fmt, ...) + { + static char buf[256]; diff --git a/queue-3.0/series b/queue-3.0/series index 6afadca1d13..a31a648f9e7 100644 --- a/queue-3.0/series +++ b/queue-3.0/series @@ -7,3 +7,4 @@ usb-mos7720-fix-broken-control-requests.patch sparc32-add-ucmpdi2.patch sparc32-add-ucmpdi2.o-to-obj-y-instead-of-lib-y.patch powerpc-use-mtraceback-no.patch +m68k-atari-aranym-fix-natfeat-module-support.patch