提交 86cdfd63 编写于 作者: J Jeremy Kerr 提交者: Jakub Kicinski

mctp: add address validity checking for packet receive

This change adds some basic sanity checks for the source and dest
headers of packets on initial receive.
Signed-off-by: NJeremy Kerr <jk@codeconstruct.com.au>
Signed-off-by: NJakub Kicinski <kuba@kernel.org>
上级 cb196b72
...@@ -1092,6 +1092,17 @@ static int mctp_pkttype_receive(struct sk_buff *skb, struct net_device *dev, ...@@ -1092,6 +1092,17 @@ static int mctp_pkttype_receive(struct sk_buff *skb, struct net_device *dev,
if (mh->ver < MCTP_VER_MIN || mh->ver > MCTP_VER_MAX) if (mh->ver < MCTP_VER_MIN || mh->ver > MCTP_VER_MAX)
goto err_drop; goto err_drop;
/* source must be valid unicast or null; drop reserved ranges and
* broadcast
*/
if (!(mctp_address_unicast(mh->src) || mctp_address_null(mh->src)))
goto err_drop;
/* dest address: as above, but allow broadcast */
if (!(mctp_address_unicast(mh->dest) || mctp_address_null(mh->dest) ||
mctp_address_broadcast(mh->dest)))
goto err_drop;
/* MCTP drivers must populate halen/haddr */ /* MCTP drivers must populate halen/haddr */
if (dev->type == ARPHRD_MCTP) { if (dev->type == ARPHRD_MCTP) {
cb = mctp_cb(skb); cb = mctp_cb(skb);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册