Date: Sat, 9 Jul 2016 12:00:04 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302495 - in head/sys/dev/ntb: . if_ntb Message-ID: <201607091200.u69C04mT098501@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Sat Jul 9 12:00:04 2016 New Revision: 302495 URL: https://svnweb.freebsd.org/changeset/base/302495 Log: Improve memory allocation errors handling on receive. Modified: head/sys/dev/ntb/if_ntb/if_ntb.c head/sys/dev/ntb/ntb_transport.c Modified: head/sys/dev/ntb/if_ntb/if_ntb.c ============================================================================== --- head/sys/dev/ntb/if_ntb/if_ntb.c Sat Jul 9 11:58:59 2016 (r302494) +++ head/sys/dev/ntb/if_ntb/if_ntb.c Sat Jul 9 12:00:04 2016 (r302495) @@ -241,7 +241,12 @@ ntb_net_rx_handler(struct ntb_transport_ struct mbuf *m = data; struct ifnet *ifp = qp_data; - CTR0(KTR_NTB, "RX: rx handler"); + CTR1(KTR_NTB, "RX: rx handler (%d)", len); + if (len < 0) { + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); + return; + } + m->m_pkthdr.csum_flags = CSUM_IP_CHECKED | CSUM_IP_VALID; (*ifp->if_input)(ifp, m); } Modified: head/sys/dev/ntb/ntb_transport.c ============================================================================== --- head/sys/dev/ntb/ntb_transport.c Sat Jul 9 11:58:59 2016 (r302494) +++ head/sys/dev/ntb/ntb_transport.c Sat Jul 9 12:00:04 2016 (r302495) @@ -877,6 +877,8 @@ ntb_memcpy_rx(struct ntb_transport_qp *q CTR2(KTR_NTB, "RX: copying %d bytes from offset %p", len, offset); entry->buf = (void *)m_devget(offset, len, 0, ifp, NULL); + if (entry->buf == NULL) + entry->len = -ENOMEM; /* Ensure that the data is globally visible before clearing the flag */ wmb();
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607091200.u69C04mT098501>