mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 13:18:50 +08:00
net/tcp/tcp_send_buffered.c: Fix deadlock in iob_copyin when iob buffers are exhausted and network lock is taken.
This commit is contained in:
parent
aa18720d14
commit
d3cedfb823
2 changed files with 20 additions and 0 deletions
|
@ -4,6 +4,12 @@ README.txt
|
|||
This directory holds a port of NuttX to the NXP/Freescale Sabre board
|
||||
featuring the iMX 6Quad CPU.
|
||||
|
||||
This is a minimal port, used primarily for verifying SMP operation. More
|
||||
recently, a port to the i.MX RT was added. This port has gotten more
|
||||
support since it is better aligned with usage in embedded systems. The
|
||||
i.MX6 and the i.MX6 share IOMUXing and some peripherals. It ought to be
|
||||
a simple matter to backport some of the common drivers from i.MXRT to i.MX6.
|
||||
|
||||
Contents
|
||||
========
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
#include <nuttx/net/netdev.h>
|
||||
#include <nuttx/net/arp.h>
|
||||
#include <nuttx/net/tcp.h>
|
||||
#include <nuttx/net/net.h>
|
||||
|
||||
#include "netdev/netdev.h"
|
||||
#include "devif/devif.h"
|
||||
|
@ -1175,7 +1176,20 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf,
|
|||
}
|
||||
else
|
||||
{
|
||||
int count;
|
||||
int blresult;
|
||||
|
||||
/* iob_copyin might wait for buffers to be freed, but if network is
|
||||
* locked this might never happen, since network driver is also locked,
|
||||
* therefore we need to break the lock
|
||||
*/
|
||||
|
||||
blresult = net_breaklock(&count);
|
||||
result = TCP_WBCOPYIN(wrb, (FAR uint8_t *)buf, len);
|
||||
if (blresult >= 0)
|
||||
{
|
||||
net_restorelock(count);
|
||||
}
|
||||
}
|
||||
|
||||
/* Dump I/O buffer chain */
|
||||
|
|
Loading…
Reference in a new issue