From: Jeffrey Carlyle Date: Mon, 30 Aug 2010 17:55:09 +0000 (+0200) Subject: scatterlist: prevent invalid free when alloc fails X-Git-Tag: v2.6.36-rc4~19^2~1 X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=edce6820a9fdda85521211cb334a183e34cc455e;p=pandora-kernel.git scatterlist: prevent invalid free when alloc fails When alloc fails, free_table is being called. Depending on the number of bytes requested, we determine if we are going to call _get_free_page() or kmalloc(). When alloc fails, our math is wrong (due to sg_size - 1), and the last buffer is wrongfully assumed to have been allocated by kmalloc. Hence, kfree gets called and a panic occurs. Signed-off-by: Jeffrey Carlyle Signed-off-by: Olusanya Soyannwo Acked-by: Tejun Heo Signed-off-by: Jens Axboe --- Reading git-diff-tree failed