Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4faba98a authored by Bryan O'Sullivan's avatar Bryan O'Sullivan Committed by Linus Torvalds
Browse files

[PATCH] IB/ipath: disallow send of invalid packet sizes over UD



Signed-off-by: default avatarRalph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: default avatarBryan O'Sullivan <bryan.osullivan@qlogic.com>
Cc: "Michael S. Tsirkin" <mst@mellanox.co.il>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 57abad25
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -275,6 +275,11 @@ int ipath_post_ud_send(struct ipath_qp *qp, struct ib_send_wr *wr)
		len += wr->sg_list[i].length;
		len += wr->sg_list[i].length;
		ss.num_sge++;
		ss.num_sge++;
	}
	}
	/* Check for invalid packet size. */
	if (len > ipath_layer_get_ibmtu(dev->dd)) {
		ret = -EINVAL;
		goto bail;
	}
	extra_bytes = (4 - len) & 3;
	extra_bytes = (4 - len) & 3;
	nwords = (len + extra_bytes) >> 2;
	nwords = (len + extra_bytes) >> 2;