]> git.karo-electronics.de Git - karo-tx-linux.git/commit
ceph: avoid 32-bit page index overflow
authorAlex Elder <elder@inktank.com>
Tue, 2 Oct 2012 15:25:51 +0000 (10:25 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Nov 2012 08:56:50 +0000 (09:56 +0100)
commitb7639e25716afc0211bcc14006a4af4e9e9bc2b9
treec374b8f6ac9a5b2ce1bbb292cd2c6d34c985cffe
parent343c7f0dcb36f71bc4edfc602eb8c20faf88fa65
ceph: avoid 32-bit page index overflow

commit 6285bc231277419255f3498d3eb5ddc9f8e7fe79 upstream.

A pgoff_t is defined (by default) to have type (unsigned long).  On
architectures such as i686 that's a 32-bit type.  The ceph address
space code was attempting to produce 64 bit offsets by shifting a
page's index by PAGE_CACHE_SHIFT, but the result was not what was
desired because the shift occurred before the result got promoted
to 64 bits.

Fix this by converting all uses of page->index used in this way to
use the page_offset() macro, which ensures the 64-bit result has the
intended value.

This fixes http://tracker.newdream.net/issues/3112

Reported-by: Mohamed Pakkeer <pakkeer.mohideen@realimage.com>
Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ceph/addr.c