IB/core: Fix user mode post wr corruption
authorMike Marciniszyn <mike.marciniszyn@intel.com>
Tue, 1 Dec 2015 15:13:51 +0000 (10:13 -0500)
committerDoug Ledford <dledford@redhat.com>
Mon, 7 Dec 2015 21:22:14 +0000 (16:22 -0500)
commit1d784b890c0101db2556b981e864c2282a3c1b02
treebab111790d5f179664d016465780eaee8ae8fc9b
parent785f742223c03ec70f9dcf36b87f59e9df2067e0
IB/core: Fix user mode post wr corruption

Commit e622f2f4ad21 ("IB: split struct ib_send_wr")
introduced a regression for HCAs whose user mode post
sends go through ib_uverbs_post_send().

The code didn't account for the fact that the first sge is
offset by an operation dependent length.  The allocation did,
but the pointer to the destination sge list is computed without
that knowledge.  The sge list copy_from_user() then corrupts
fields in the work request

Store the operation dependent length in a local variable and
compute the sge list copy_from_user() destination using that length.

Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/core/uverbs_cmd.c