Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

RDMA/mlx5: Use ib_copy_validate_udata_in() for MW

The userspace side on MW made a mistake and never actually used the udata
driver structure that was defined so it always passes 0 length. Keep the
kernel structure but this conversion has to permit 0 length as well.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>

authored by

Jason Gunthorpe and committed by
Leon Romanovsky
530b251b c8f9a7a9

+6 -9
+6 -9
drivers/infiniband/hw/mlx5/mr.c
··· 1774 1774 __u32 response_length; 1775 1775 } resp = {}; 1776 1776 1777 - err = ib_copy_from_udata(&req, udata, min(udata->inlen, sizeof(req))); 1778 - if (err) 1779 - return err; 1777 + if (udata->inlen) { 1778 + err = ib_copy_validate_udata_in_cm(udata, req, reserved2, 0); 1779 + if (err) 1780 + return err; 1781 + } 1780 1782 1781 - if (req.comp_mask || req.reserved1 || req.reserved2) 1782 - return -EOPNOTSUPP; 1783 - 1784 - if (udata->inlen > sizeof(req) && 1785 - !ib_is_udata_cleared(udata, sizeof(req), 1786 - udata->inlen - sizeof(req))) 1783 + if (req.reserved1 || req.reserved2) 1787 1784 return -EOPNOTSUPP; 1788 1785 1789 1786 ndescs = req.num_klms ? roundup(req.num_klms, 4) : roundup(1, 4);