diff options
author | rwatson <rwatson@FreeBSD.org> | 2008-03-25 07:41:33 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2008-03-25 07:41:33 +0000 |
commit | 59900e5206efb55f5382482d47a2f300d8a2b972 (patch) | |
tree | c85c0805ea0ddbb0b3701788f484d9d602cc5942 /sys/net/bpf.c | |
parent | 9a9594d179e3c5f3f47d805d0479f17ee4475f84 (diff) | |
download | FreeBSD-src-59900e5206efb55f5382482d47a2f300d8a2b972.zip FreeBSD-src-59900e5206efb55f5382482d47a2f300d8a2b972.tar.gz |
Check for a NULL free buffer pointer in BPF before invoking
bpf_canfreebuf() in order to avoid potentially calling a non-inlinable
but trivial function in zero-copy buffer mode for every packet
received when we couldn't free the buffer anyway.
MFC after: 4 months
Diffstat (limited to 'sys/net/bpf.c')
-rw-r--r-- | sys/net/bpf.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 433cc7a..eef3241 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1676,7 +1676,7 @@ catchpacket(struct bpf_d *d, u_char *pkt, u_int pktlen, u_int snaplen, * run this check if we need the space), but for now it's a reliable * spot to do it. */ - if (bpf_canfreebuf(d)) { + if (d->bd_fbuf == NULL && bpf_canfreebuf(d)) { d->bd_fbuf = d->bd_hbuf; d->bd_hbuf = NULL; d->bd_hlen = 0; |