From: Bryan O'Sullivan Date: Sat, 1 Jul 2006 11:36:06 +0000 (-0700) Subject: [PATCH] IB/ipath: disallow send of invalid packet sizes over UD X-Git-Tag: MMI-PSA29.97-13-9~48592 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4faba98a1a11a6129cbcc772422c9ffc0c11dd2e;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git [PATCH] IB/ipath: disallow send of invalid packet sizes over UD Signed-off-by: Ralph Campbell Signed-off-by: Bryan O'Sullivan Cc: "Michael S. Tsirkin" Cc: Roland Dreier Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/infiniband/hw/ipath/ipath_ud.c b/drivers/infiniband/hw/ipath/ipath_ud.c index eeff19800db7..3b6d00b9b8be 100644 --- a/drivers/infiniband/hw/ipath/ipath_ud.c +++ b/drivers/infiniband/hw/ipath/ipath_ud.c @@ -275,6 +275,11 @@ int ipath_post_ud_send(struct ipath_qp *qp, struct ib_send_wr *wr) len += wr->sg_list[i].length; 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; nwords = (len + extra_bytes) >> 2;