From b96be097c6139a644fa2778cbcadb01e5cc1ae0a Mon Sep 17 00:00:00 2001 From: mlelstv Date: Sat, 16 Nov 2019 22:06:49 +0000 Subject: [PATCH] Don't wait in interrupt context. --- sys/dev/bluetooth/bth5.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sys/dev/bluetooth/bth5.c b/sys/dev/bluetooth/bth5.c index 10d78929559a..030adc07151d 100644 --- a/sys/dev/bluetooth/bth5.c +++ b/sys/dev/bluetooth/bth5.c @@ -1,4 +1,4 @@ -/* $NetBSD: bth5.c,v 1.5 2017/09/03 23:11:19 nat Exp $ */ +/* $NetBSD: bth5.c,v 1.6 2019/11/16 22:06:49 mlelstv Exp $ */ /* * Copyright (c) 2017 Nathanial Sloss * All rights reserved. @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: bth5.c,v 1.5 2017/09/03 23:11:19 nat Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bth5.c,v 1.6 2019/11/16 22:06:49 mlelstv Exp $"); #include #include @@ -1230,7 +1230,7 @@ bth5_tx_reliable_pkt(struct bth5_softc *sc, struct mbuf *m, u_int protocol_id) #endif sc->sc_seq_winspace--; - _retrans = m_copym(m, 0, M_COPYALL, M_WAIT); + _retrans = m_copym(m, 0, M_COPYALL, M_DONTWAIT); if (_retrans == NULL) { aprint_error_dev(sc->sc_dev, "out of memory\n"); goto out; @@ -1488,7 +1488,12 @@ bth5_start_le(struct bth5_softc *sc) if (!sc->sc_le_muzzled) { struct mbuf *m; - m = m_gethdr(M_WAIT, MT_DATA); + m = m_gethdr(M_DONTWAIT, MT_DATA); + if (m == NULL) { + aprint_error_dev(sc->sc_dev, + "le-packet transmit out of memory\n"); + return ENOMEM; + } m->m_pkthdr.len = m->m_len = 0; m_copyback(m, 0, sizeof(sync), sync); if (!bth5_tx_unreliable_pkt(sc, m, BTH5_CHANNEL_LE)) {