--- /dev/null
+From stable-bounces@linux.kernel.org Mon Mar 24 21:06:40 2008
+Date: Tue, 25 Mar 2008 02:40:08 GMT
+Message-Id: <200803250240.m2P2e8YV001193@hera.kernel.org>
+From: jejb@kernel.org
+To: jejb@kernel.org, stable@kernel.org
+Subject: kbuild: soften modpost checks when doing cross builds
+
+From: Sam Ravnborg <sam@uranus.ravnborg.org>
+
+upstream commit: 4ce6efed48d736e3384c39ff87bda723e1f8e041
+
+The module alias support in the kernel have a consistency
+check where it is checked that the size of a structure
+in the kernel and on the build host are the same.
+For cross builds this check does not make sense so detect
+when we do cross builds and silently skip the check in these
+situations.
+This fixes a build bug for a wireless driver when cross building
+for arm.
+
+Acked-by: Michael Buesch <mb@bu3sch.de>
+Tested-by: Gordon Farquharson <gordonfarquharson@gmail.com>
+Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
+[chrisw@sous-sol.org: backport to 2.6.24.4]
+Signed-off-by: Chris Wright <chrisw@sous-sol.org>
+---
+ Makefile | 2 +-
+ scripts/Makefile.modpost | 6 +++++-
+ scripts/mod/file2alias.c | 4 ++++
+ scripts/mod/modpost.c | 5 ++++-
+ scripts/mod/modpost.h | 1 +
+ 5 files changed, 15 insertions(+), 3 deletions(-)
+
+--- a/Makefile
++++ b/Makefile
+@@ -189,7 +189,7 @@ SUBARCH := $(shell uname -m | sed -e s/i
+ # Alternatively CROSS_COMPILE can be set in the environment.
+ # Default value for CROSS_COMPILE is not to prefix executables
+ # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
+-
++export KBUILD_BUILDHOST := $(SUBARCH)
+ ARCH ?= $(SUBARCH)
+ CROSS_COMPILE ?=
+
+--- a/scripts/Makefile.modpost
++++ b/scripts/Makefile.modpost
+@@ -53,6 +53,9 @@ modules := $(patsubst %.o,%.ko, $(wild
+ # Stop after building .o files if NOFINAL is set. Makes compile tests quicker
+ _modpost: $(if $(KBUILD_MODPOST_NOFINAL), $(modules:.ko:.o),$(modules))
+
++ifneq ($(KBUILD_BUILDHOST),$(ARCH))
++ cross_build := 1
++endif
+
+ # Step 2), invoke modpost
+ # Includes step 3,4
+@@ -62,7 +65,8 @@ modpost = scripts/mod/modpost
+ $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \
+ $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
+ $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
+- $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w)
++ $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) \
++ $(if $(cross_build),-c)
+
+ quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules
+ cmd_modpost = $(modpost) -s
+--- a/scripts/mod/file2alias.c
++++ b/scripts/mod/file2alias.c
+@@ -51,11 +51,13 @@ do {
+ sprintf(str + strlen(str), "*"); \
+ } while(0)
+
++unsigned int cross_build = 0;
+ /**
+ * Check that sizeof(device_id type) are consistent with size of section
+ * in .o file. If in-consistent then userspace and kernel does not agree
+ * on actual size which is a bug.
+ * Also verify that the final entry in the table is all zeros.
++ * Ignore both checks if build host differ from target host and size differs.
+ **/
+ static void device_id_check(const char *modname, const char *device_id,
+ unsigned long size, unsigned long id_size,
+@@ -64,6 +66,8 @@ static void device_id_check(const char *
+ int i;
+
+ if (size % id_size || size < id_size) {
++ if (cross_build != 0)
++ return;
+ fatal("%s: sizeof(struct %s_device_id)=%lu is not a modulo "
+ "of the size of section __mod_%s_device_table=%lu.\n"
+ "Fix definition of struct %s_device_id "
+--- a/scripts/mod/modpost.c
++++ b/scripts/mod/modpost.c
+@@ -1659,7 +1659,7 @@ int main(int argc, char **argv)
+ int opt;
+ int err;
+
+- while ((opt = getopt(argc, argv, "i:I:mso:aw")) != -1) {
++ while ((opt = getopt(argc, argv, "i:I:cmso:aw")) != -1) {
+ switch(opt) {
+ case 'i':
+ kernel_read = optarg;
+@@ -1668,6 +1668,9 @@ int main(int argc, char **argv)
+ module_read = optarg;
+ external_module = 1;
+ break;
++ case 'c':
++ cross_build = 1;
++ break;
+ case 'm':
+ modversions = 1;
+ break;
+--- a/scripts/mod/modpost.h
++++ b/scripts/mod/modpost.h
+@@ -130,6 +130,7 @@ struct elf_info {
+ };
+
+ /* file2alias.c */
++extern unsigned int cross_build;
+ void handle_moddevtable(struct module *mod, struct elf_info *info,
+ Elf_Sym *sym, const char *symname);
+ void add_moddevtable(struct buffer *buf, struct module *mod);
--- /dev/null
+From stable-bounces@linux.kernel.org Mon Mar 24 21:27:16 2008
+Date: Mon, 24 Mar 2008 21:21:26 -0700
+From: akpm@linux-foundation.org
+To: stable@kernel.org
+Message-Id: <20080324212126.ff160991.akpm@linux-foundation.org>
+Cc: Neil Brown <neilb@suse.de>
+Subject: md: remove the 'super' sysfs attribute from devices in an 'md' array
+
+From: NeilBrown <neilb@suse.de>
+
+upstream commit: 0e82989d95cc46cc58622381eafa54f7428ee679
+
+Exposing the binary blob which is the md 'super-block' via sysfs doesn't
+really fit with the whole sysfs model, and ever since commit
+8118a859dc7abd873193986c77a8d9bdb877adc8 ("sysfs: fix off-by-one error
+in fill_read_buffer()") it doesn't actually work at all (as the size of
+the blob is often one page).
+
+(akpm: as in, fs/sysfs/file.c:fill_read_buffer() goes BUG)
+
+So just remove it altogether. It isn't really useful.
+
+Signed-off-by: Neil Brown <neilb@suse.de>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Chris Wright <chrisw@sous-sol.org>
+---
+ drivers/md/md.c | 12 ------------
+ 1 file changed, 12 deletions(-)
+
+--- a/drivers/md/md.c
++++ b/drivers/md/md.c
+@@ -1847,17 +1847,6 @@ static struct rdev_sysfs_entry rdev_stat
+ __ATTR(state, S_IRUGO|S_IWUSR, state_show, state_store);
+
+ static ssize_t
+-super_show(mdk_rdev_t *rdev, char *page)
+-{
+- if (rdev->sb_loaded && rdev->sb_size) {
+- memcpy(page, page_address(rdev->sb_page), rdev->sb_size);
+- return rdev->sb_size;
+- } else
+- return 0;
+-}
+-static struct rdev_sysfs_entry rdev_super = __ATTR_RO(super);
+-
+-static ssize_t
+ errors_show(mdk_rdev_t *rdev, char *page)
+ {
+ return sprintf(page, "%d\n", atomic_read(&rdev->corrected_errors));
+@@ -1959,7 +1948,6 @@ __ATTR(size, S_IRUGO|S_IWUSR, rdev_size_
+
+ static struct attribute *rdev_default_attrs[] = {
+ &rdev_state.attr,
+- &rdev_super.attr,
+ &rdev_errors.attr,
+ &rdev_slot.attr,
+ &rdev_offset.attr,
--- /dev/null
+From stable-bounces@linux.kernel.org Mon Mar 24 21:07:31 2008
+Date: Tue, 25 Mar 2008 02:40:04 GMT
+Message-Id: <200803250240.m2P2e4YS001130@hera.kernel.org>
+From: jejb@kernel.org
+To: jejb@kernel.org, stable@kernel.org
+Subject: mtd: memory corruption in block2mtd.c
+
+From: Ingo van Lil <inguin@gmx.de>
+
+upstream commit: 2875fb65f8e40401c4b781ebc5002df10485f635
+
+The block2mtd driver (drivers/mtd/devices/block2mtd.c) will kfree an on-stack
+pointer when handling an invalid argument line (e.g.
+block2mtd=/dev/loop0,xxx).
+
+The kfree was added some time ago when "name" was dynamically allocated.
+
+Signed-off-by: Ingo van Lil <inguin@gmx.de>
+Acked-by: Joern Engel <joern@lazybastard.org>
+Cc: David Woodhouse <dwmw2@infradead.org>
+Cc: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Chris Wright <chrisw@sous-sol.org>
+---
+ drivers/mtd/devices/block2mtd.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/drivers/mtd/devices/block2mtd.c
++++ b/drivers/mtd/devices/block2mtd.c
+@@ -408,7 +408,6 @@ static int block2mtd_setup2(const char *
+ if (token[1]) {
+ ret = parse_num(&erase_size, token[1]);
+ if (ret) {
+- kfree(name);
+ parse_err("illegal erase size");
+ }
+ }