mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-04 13:49:08 +00:00
wireless: gs2200m: Fix recvfrom_reques() in gs2200m_main.c
Summary: - During Wi-Fi stress test, I noticed ASSERT happens in gs2200m_main.c - Actually, req->max_buflen was 0 but the case was not handled correctly - This commit fixes this issue Impact: - Affects read/recvfrom with len=0 cases Testing: - Tested with spresense:wifi_smp - Run nxplayer for audio streaming - Run ps/free/ifconfig commands via telnet - Run smp command via telnet Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
This commit is contained in:
parent
f65b16bb2e
commit
f4b0f9e290
1 changed files with 9 additions and 6 deletions
|
|
@ -847,16 +847,19 @@ static int recvfrom_request(int fd, FAR struct gs2200m_s *priv,
|
|||
goto prepare;
|
||||
}
|
||||
|
||||
rmsg.buf = calloc(1, req->max_buflen);
|
||||
ASSERT(rmsg.buf);
|
||||
|
||||
rmsg.cid = usock->cid;
|
||||
rmsg.reqlen = req->max_buflen;
|
||||
rmsg.is_tcp = (usock->type == SOCK_STREAM) ? true : false;
|
||||
rmsg.flags = req->flags;
|
||||
|
||||
ret = ioctl(priv->gsfd, GS2200M_IOC_RECV,
|
||||
(unsigned long)&rmsg);
|
||||
if (0 < req->max_buflen)
|
||||
{
|
||||
rmsg.buf = calloc(1, req->max_buflen);
|
||||
ASSERT(rmsg.buf);
|
||||
|
||||
ret = ioctl(priv->gsfd, GS2200M_IOC_RECV,
|
||||
(unsigned long)&rmsg);
|
||||
}
|
||||
|
||||
if (0 == ret)
|
||||
{
|
||||
|
|
@ -891,7 +894,7 @@ prepare:
|
|||
resp.valuelen = MIN(resp.valuelen_nontrunc,
|
||||
req->max_addrlen);
|
||||
|
||||
if (0 == rmsg.len)
|
||||
if ((0 == rmsg.len) && (0 != rmsg.reqlen))
|
||||
{
|
||||
usock_send_event(fd, priv, usock,
|
||||
USRSOCK_EVENT_REMOTE_CLOSED
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue