aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@shinybook.infradead.org>2004-08-10 17:25:01 +0100
committerDavid Woodhouse <dwmw2@shinybook.infradead.org>2004-08-10 17:25:01 +0100
commit1a214ee6e3ef540013e5978504eaa831efc5921c (patch)
tree01ad624f3f15ce693caad8aec58050ed0fb482d8 /include
parent4ab06c9ab4babac5cea0ff25b399c216ac166df1 (diff)
downloadhistory-1a214ee6e3ef540013e5978504eaa831efc5921c.tar.gz
Fix use-after-free bug in MTD partitioning code.
Define callback wrapper function mtd_erase_callback() to handle partition offsets during the callback, rather than attempting to fix them up in the freed erase_info structure after the callback has already happened.
Diffstat (limited to 'include')
-rw-r--r--include/linux/mtd/mtd.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index fd7b15d077b311..b3d134392b3128 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -1,5 +1,5 @@
/*
- * $Id: mtd.h,v 1.54 2004/07/15 01:13:12 dwmw2 Exp $
+ * $Id: mtd.h,v 1.56 2004/08/09 18:46:04 dmarlin Exp $
*
* Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al.
*
@@ -19,6 +19,7 @@
#include <linux/module.h>
#include <linux/uio.h>
+#include <linux/mtd/compatmac.h>
#include <mtd/mtd-abi.h>
#define MTD_CHAR_MAJOR 90
@@ -192,6 +193,17 @@ int default_mtd_readv(struct mtd_info *mtd, struct kvec *vecs,
#define MTD_WRITEOOB(mtd, args...) (*(mtd->write_oob))(mtd, args)
#define MTD_SYNC(mtd) do { if (mtd->sync) (*(mtd->sync))(mtd); } while (0)
+
+#ifdef CONFIG_MTD_PARTITIONS
+void mtd_erase_callback(struct erase_info *instr);
+#else
+static inline void mtd_erase_callback(struct erase_info *instr)
+{
+ if (instr->callback)
+ instr->callback(instr);
+}
+#endif
+
/*
* Debugging macro and defines
*/