mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
block: reject dma-bufs larger than 4GiB
The dma-buf offset is set in the 32-bit bvec_iter bi_offset. Reject
buffers that can carry an offset that would wrap.
Fixes: 839231d193 ("block: add dma-buf support for raw bdev")
Signed-off-by: Keith Busch <kbusch@kernel.org>
Link: https://patch.msgid.link/20261021184658.644645-2-kbusch@meta.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
f57b957778
commit
bcbd808652
|
|
@ -19,6 +19,7 @@
|
|||
#include <linux/iomap.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/io_uring/cmd.h>
|
||||
#include <linux/dma-buf-io.h>
|
||||
#include "blk.h"
|
||||
|
||||
static inline struct inode *bdev_file_inode(struct file *file)
|
||||
|
|
@ -942,6 +943,8 @@ static int blkdev_init_dma_buf_io_ctx(struct file *file,
|
|||
|
||||
if (!(file->f_flags & O_DIRECT))
|
||||
return -EINVAL;
|
||||
if (ctx->dmabuf->size > UINT_MAX)
|
||||
return -EINVAL;
|
||||
if (!disk->fops->init_dma_buf_io_ctx)
|
||||
return -EOPNOTSUPP;
|
||||
if (bdev_has_integrity_csum(bdev))
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user