[30/66] wext: fix potential private ioctl memory content leak

From: Greg KH
Date: Fri Oct 22 2010 - 14:51:10 EST


2.6.32-stable review patch. If anyone has any objections, please let us know.

------------------

From: Johannes Berg <johannes.berg@xxxxxxxxx>

commit df6d02300f7c2fbd0fbe626d819c8e5237d72c62 upstream.

When a driver doesn't fill the entire buffer, old
heap contents may remain, and if it also doesn't
update the length properly, this old heap content
will be copied back to userspace.

It is very unlikely that this happens in any of
the drivers using private ioctls since it would
show up as junk being reported by iwpriv, but it
seems better to be safe here, so use kzalloc.

Reported-by: Jeff Mahoney <jeffm@xxxxxxxx>
Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx>
Signed-off-by: John W. Linville <linville@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---
net/wireless/wext.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/wireless/wext.c
+++ b/net/wireless/wext.c
@@ -1029,7 +1029,7 @@ static int ioctl_private_iw_point(struct
} else if (!iwp->pointer)
return -EFAULT;

- extra = kmalloc(extra_size, GFP_KERNEL);
+ extra = kzalloc(extra_size, GFP_KERNEL);
if (!extra)
return -ENOMEM;



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/