Li Qiang 7e55d65c56 9pfs: fix integer overflow issue in xattr read/write
The v9fs_xattr_read() and v9fs_xattr_write() are passed a guest
originated offset: they must ensure this offset does not go beyond
the size of the extended attribute that was set in v9fs_xattrcreate().
Unfortunately, the current code implement these checks with unsafe
calculations on 32 and 64 bit values, which may allow a malicious
guest to cause OOB access anyway.

Fix this by comparing the offset and the xattr size, which are
both uint64_t, before trying to compute the effective number of bytes
to read or write.

Suggested-by: Greg Kurz <groug@kaod.org>
Signed-off-by: Li Qiang <liqiang6-s@360.cn>
Reviewed-by: Greg Kurz <groug@kaod.org>
Reviewed-By: Guido Günther <agx@sigxcpu.org>
Signed-off-by: Greg Kurz <groug@kaod.org>
2016-11-01 12:03:01 +01:00
..
2016-10-04 13:28:07 +01:00
2016-10-28 15:51:27 +01:00
2016-10-31 12:35:39 +00:00
2016-10-24 15:46:10 +02:00
2016-10-31 12:35:39 +00:00
2016-06-17 16:33:48 +10:00
2016-10-31 12:35:39 +00:00
2016-10-28 15:51:27 +01:00
2016-10-31 15:29:12 +00:00
2016-05-18 15:04:27 +03:00
2016-10-24 15:27:20 +02:00
2016-10-28 17:54:21 -07:00
2016-10-31 11:58:30 +00:00
2016-07-29 00:07:09 +03:00
2016-01-29 15:07:25 +00:00
2016-10-31 15:29:12 +00:00
2016-10-31 10:10:16 +00:00
2016-09-22 18:13:08 +01:00
2016-09-15 15:32:22 +03:00
2016-09-29 11:43:22 +08:00
2016-10-28 18:17:24 +03:00
2016-09-15 15:32:22 +03:00
2016-10-31 12:35:39 +00:00
2016-10-28 17:54:49 -07:00
2016-10-24 15:27:20 +02:00
2016-10-04 13:28:07 +01:00