Message ID | 1479922764-13091-2-git-send-email-andrew.boyer@dell.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
> diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c > index 46f0628..252b4d6 100644 > --- a/drivers/infiniband/sw/rxe/rxe_recv.c > +++ b/drivers/infiniband/sw/rxe/rxe_recv.c > @@ -391,16 +391,15 @@ int rxe_rcv(struct sk_buff *skb) > payload_size(pkt)); > calc_icrc = cpu_to_be32(~calc_icrc); > if (unlikely(calc_icrc != pack_icrc)) { > - char saddr[sizeof(struct in6_addr)]; > - > if (skb->protocol == htons(ETH_P_IPV6)) > - sprintf(saddr, "%pI6", &ipv6_hdr(skb)->saddr); > + pr_warn_ratelimited("bad ICRC from %pI6c\n", > + &ipv6_hdr(skb)->saddr); > else if (skb->protocol == htons(ETH_P_IP)) > - sprintf(saddr, "%pI4", &ip_hdr(skb)->saddr); > + pr_warn_ratelimited("bad ICRC from %pI4\n", > + &ip_hdr(skb)->saddr); > else > - sprintf(saddr, "unknown"); > + pr_warn_ratelimited("bad ICRC from unknown\n"); > > - pr_warn_ratelimited("bad ICRC from %s\n", saddr); > goto drop; > } Have you considered Bart's suggestion to use %pIS instead of %pI4 and %pI6 https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=1067964305df -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c index 46f0628..252b4d6 100644 --- a/drivers/infiniband/sw/rxe/rxe_recv.c +++ b/drivers/infiniband/sw/rxe/rxe_recv.c @@ -391,16 +391,15 @@ int rxe_rcv(struct sk_buff *skb) payload_size(pkt)); calc_icrc = cpu_to_be32(~calc_icrc); if (unlikely(calc_icrc != pack_icrc)) { - char saddr[sizeof(struct in6_addr)]; - if (skb->protocol == htons(ETH_P_IPV6)) - sprintf(saddr, "%pI6", &ipv6_hdr(skb)->saddr); + pr_warn_ratelimited("bad ICRC from %pI6c\n", + &ipv6_hdr(skb)->saddr); else if (skb->protocol == htons(ETH_P_IP)) - sprintf(saddr, "%pI4", &ip_hdr(skb)->saddr); + pr_warn_ratelimited("bad ICRC from %pI4\n", + &ip_hdr(skb)->saddr); else - sprintf(saddr, "unknown"); + pr_warn_ratelimited("bad ICRC from unknown\n"); - pr_warn_ratelimited("bad ICRC from %s\n", saddr); goto drop; }
Avoid smashing the stack when an ICRC error occurs on an IPv6 network. Signed-off-by: Andrew Boyer <andrew.boyer@dell.com> --- drivers/infiniband/sw/rxe/rxe_recv.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)