Always return valid bad_wr on error from ibv_post_{send,recv,srq_recv}

There are error cases in the kernel's uverbs work request posting
functions where the return value is negative (i.e., an error) and yet a
non-zero resp.bad_wr is not written back to userspace.  In this case,
ibv_cmd_post_send() should still set the bad_wr pointer.

Bug pointed out in ibv_post_send() by Ralph Campbell
<ralph.campbell@qlogic.com>, and noticed elsewhere by Dotan Barak
<dotanb@dev.mellanox.co.il>.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
1 file changed