From aa722fc34f2dc4599f520e1eaf5b97dcb1a14778 Mon Sep 17 00:00:00 2001 From: fef Date: Sun, 1 Aug 2021 23:51:19 +0200 Subject: [PATCH] serial_write_dma: prevent memory leak when busy --- arch/at91sam3x8e/serial.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/at91sam3x8e/serial.c b/arch/at91sam3x8e/serial.c index ca14e9f..715d149 100644 --- a/arch/at91sam3x8e/serial.c +++ b/arch/at91sam3x8e/serial.c @@ -99,11 +99,11 @@ ssize_t serial_write_dma(struct serial_device *dev, struct dmabuf *buf) uint16_t len; struct arch_serial_device *arch_dev = to_arch_serial_device(dev); - dmabuf_get(buf); - if (arch_dev->tx_next != NULL) return -EBUSY; + dmabuf_get(buf); + if (buf->len >= 0xffff) len = 0xffff; else