IB/mlx5: Fix stack info leak in mlx5_ib_alloc_ucontext()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 25 Jul 2013 17:04:36 +0000 (20:04 +0300)
committerRoland Dreier <roland@purestorage.com>
Wed, 31 Jul 2013 21:12:08 +0000 (14:12 -0700)
We don't set "resp.reserved".  Since it's at the end of the struct
that means we don't have to copy it to the user.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Eli Cohen <eli@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/hw/mlx5/main.c

index b1cbf338bcf6f4ae6eb58e75f6e0fabb1285c88e..3f831de9a4d8a901607afc26c81827cc5c1e3bd5 100644 (file)
@@ -619,7 +619,8 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev,
 
        resp.tot_uuars = req.total_num_uuars;
        resp.num_ports = dev->mdev.caps.num_ports;
-       err = ib_copy_to_udata(udata, &resp, sizeof(resp));
+       err = ib_copy_to_udata(udata, &resp,
+                              sizeof(resp) - sizeof(resp.reserved));
        if (err)
                goto out_uars;