OpenCloudOS-Kernel/drivers/nvdimm
Dmitry Monakhov b1fb2c52b2 block: guard bvec iteration logic
Currently if some one try to advance bvec beyond it's size we simply
dump WARN_ONCE and continue to iterate beyond bvec array boundaries.
This simply means that we endup dereferencing/corrupting random memory
region.

Sane reaction would be to propagate error back to calling context
But bvec_iter_advance's calling context is not always good for error
handling. For safity reason let truncate iterator size to zero which
will break external iteration loop which prevent us from unpredictable
memory range corruption. And even it caller ignores an error, it will
corrupt it's own bvecs, not others.

This patch does:
- Return error back to caller with hope that it will react on this
- Truncate iterator size

Code was added long time ago here 4550dd6c, luckily no one hit it
in real life :)

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
[hch: switch to true/false returns instead of errno values]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2017-07-03 16:56:26 -06:00
..
Kconfig pmem: add dax_operations support 2017-04-19 15:14:35 -07:00
Makefile libnvdimm, dax: introduce device-dax infrastructure 2016-05-09 15:35:42 -07:00
blk.c block: guard bvec iteration logic 2017-07-03 16:56:26 -06:00
btt.c block: guard bvec iteration logic 2017-07-03 16:56:26 -06:00
btt.h libnvdimm, btt: consolidate arena validation 2015-08-14 13:43:04 -04:00
btt_devs.c uuid: hoist uuid_is_null() helper from libnvdimm 2017-06-05 16:59:05 +02:00
bus.c libnvdimm: rework region badblocks clearing 2017-04-29 15:24:03 -07:00
claim.c libnvdimm: add an atomic vs process context flag to rw_bytes 2017-05-10 21:46:22 -07:00
core.c libnvdimm: fix clear poison locking with spinlock and GFP_NOWAIT allocation 2017-04-13 14:23:51 -07:00
dax_devs.c libnvdimm: fix nvdimm_bus_lock() vs device_lock() ordering 2017-05-01 08:29:37 -07:00
dimm.c libnvdimm: handle locked label storage areas 2017-05-04 15:41:39 -07:00
dimm_devs.c treewide: use kv[mz]alloc* rather than opencoded variants 2017-05-08 17:15:13 -07:00
e820.c libnvdimm, e820: use module_platform_driver 2016-12-05 08:52:21 -08:00
label.c nvdimm: use the right length of "pmem" 2016-11-11 20:37:42 -08:00
label.h libnvdimm: write blk label set 2015-06-24 21:24:10 -04:00
namespace_devs.c libnvdimm: handle locked label storage areas 2017-05-04 15:41:39 -07:00
nd-core.h libnvdimm: fix clear poison locking with spinlock and GFP_NOWAIT allocation 2017-04-13 14:23:51 -07:00
nd.h libnvdimm: add an atomic vs process context flag to rw_bytes 2017-05-10 21:46:22 -07:00
pfn.h libnvdimm, dax: autodetect support 2016-05-20 22:02:57 -07:00
pfn_devs.c libnvdimm: add an atomic vs process context flag to rw_bytes 2017-05-10 21:46:22 -07:00
pmem.c block: don't bother with bounce limits for make_request drivers 2017-06-27 12:13:45 -06:00
pmem.h pmem: add dax_operations support 2017-04-19 15:14:35 -07:00
region.c libnvdimm: rework region badblocks clearing 2017-04-29 15:24:03 -07:00
region_devs.c libnvdimm: convert NDD_ flags to use bitops, introduce NDD_LOCKED 2017-05-04 14:01:24 -07:00