Skip to content

Commit 79a5b97

Browse files
sowminivdavem330
authored andcommitted
rds: rds_msg_zcopy should return error of null rm->data.op_mmp_znotifier
if either or both of MSG_ZEROCOPY and SOCK_ZEROCOPY have not been specified, the rm->data.op_mmp_znotifier allocation will be skipped. In this case, it is invalid ot pass down a cmsghdr with RDS_CMSG_ZCOPY_COOKIE, so return EINVAL from rds_msg_zcopy for this case. Reported-by: [email protected] Fixes: 0cebacc ("rds: zerocopy Tx support.") Signed-off-by: Sowmini Varadhan <[email protected]> Acked-by: Willem de Bruijn <[email protected]> Acked-by: Santosh Shilimkar <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9dbe789 commit 79a5b97

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/rds/send.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,8 @@ static int rds_cmsg_zcopy(struct rds_sock *rs, struct rds_message *rm,
941941
{
942942
u32 *cookie;
943943

944-
if (cmsg->cmsg_len < CMSG_LEN(sizeof(*cookie)))
944+
if (cmsg->cmsg_len < CMSG_LEN(sizeof(*cookie)) ||
945+
!rm->data.op_mmp_znotifier)
945946
return -EINVAL;
946947
cookie = CMSG_DATA(cmsg);
947948
rm->data.op_mmp_znotifier->z_cookie = *cookie;

0 commit comments

Comments
 (0)