RDS: Do not set op_active in r_m_copy_from_user().
Do not allocate sgs for data for 0-length datagrams Set data.op_active in rds_sendmsg() instead of rds_message_copy_from_user(). Signed-off-by: Andy Grover <andy.grover@oracle.com>
This commit is contained in:
parent
5b2366bd28
commit
372cd7dedf
|
@ -330,8 +330,6 @@ int rds_message_copy_from_user(struct rds_message *rm, struct iovec *first_iov,
|
||||||
sg++;
|
sg++;
|
||||||
}
|
}
|
||||||
|
|
||||||
rm->data.op_active = 1;
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -970,11 +970,14 @@ int rds_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
rm->data.op_sg = rds_message_alloc_sgs(rm, ceil(payload_len, PAGE_SIZE));
|
/* Attach data to the rm */
|
||||||
/* XXX fix this to not allocate memory */
|
if (payload_len) {
|
||||||
ret = rds_message_copy_from_user(rm, msg->msg_iov, payload_len);
|
rm->data.op_sg = rds_message_alloc_sgs(rm, ceil(payload_len, PAGE_SIZE));
|
||||||
if (ret)
|
ret = rds_message_copy_from_user(rm, msg->msg_iov, payload_len);
|
||||||
goto out;
|
if (ret)
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
rm->data.op_active = 1;
|
||||||
|
|
||||||
rm->m_daddr = daddr;
|
rm->m_daddr = daddr;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue