Skip to contentSkip to conversation

mtd: mtdchar: fix information leak to userland

PATCH Applied Vasiliy Kulikov 2 participants 2 messages Nov 6, 2010 – Nov 26, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: mtdchar: fix information leak to userland

Structure mtd_info_user is copied to userland with padding byted between "type" and "flags" fields uninitialized. It leads to leaking of contents of kernel stack memory.

---
Compile tested.

 drivers/mtd/mtdchar.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mtd/mtdchar.c +1 -1
index 3eff1e5..2a0bc9e 100644
@@ -601,6 +601,7 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg)
 	}
 
 	case MEMGETINFO:
+		memset(&info, 0, sizeof(info));
 		info.type	= mtd->type;
 		info.flags	= mtd->flags;
 		info.size	= mtd->size;
@@ -609,7 +610,6 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg)
 		info.oobsize	= mtd->oobsize;
 		/* The below fields are obsolete */
 		info.ecctype	= -1;
-		info.eccsize	= 0;
 		if (copy_to_user(argp, &info, sizeof(struct mtd_info_user)))
 			return -EFAULT;
 		break;
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 5 lines · Vasiliy Kulikov

Structure mtd_info_user is copied to userland with padding byted between "type" and "flags" fields uninitialized. It leads to leaking of contents of kernel stack memory.

Pushed to l2-mtd-2.6.git, thanks.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Артём Битюцкий)