eCryptfs: Sanitize write counts of /dev/ecryptfs
commit22b1c8706204fc3b225fa2ee99b3f71d3203d146
authorTyler Hicks <tyhicks@canonical.com>
Thu, 12 Jan 2012 10:30:44 +0000 (12 11:30 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Feb 2012 17:26:49 +0000 (3 09:26 -0800)
tree5a96ffe7a5023915f52865719263276778bbd2de
parentb16a92f96f9207e75b2562fec37be24d1f452b8a
eCryptfs: Sanitize write counts of /dev/ecryptfs

commit db10e556518eb9d21ee92ff944530d84349684f4 upstream.

A malicious count value specified when writing to /dev/ecryptfs may
result in a a very large kernel memory allocation.

This patch peeks at the specified packet payload size, adds that to the
size of the packet headers and compares the result with the write count
value. The resulting maximum memory allocation size is approximately 532
bytes.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Reported-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ecryptfs/miscdev.c