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
@ -847,16 +847,19 @@ static int recvfrom_request(int fd, FAR struct gs2200m_s *priv,
|
|||||||
goto prepare;
|
goto prepare;
|
||||||
}
|
}
|
||||||
|
|
||||||
rmsg.buf = calloc(1, req->max_buflen);
|
|
||||||
ASSERT(rmsg.buf);
|
|
||||||
|
|
||||||
rmsg.cid = usock->cid;
|
rmsg.cid = usock->cid;
|
||||||
rmsg.reqlen = req->max_buflen;
|
rmsg.reqlen = req->max_buflen;
|
||||||
rmsg.is_tcp = (usock->type == SOCK_STREAM) ? true : false;
|
rmsg.is_tcp = (usock->type == SOCK_STREAM) ? true : false;
|
||||||
rmsg.flags = req->flags;
|
rmsg.flags = req->flags;
|
||||||
|
|
||||||
ret = ioctl(priv->gsfd, GS2200M_IOC_RECV,
|
if (0 < req->max_buflen)
|
||||||
(unsigned long)&rmsg);
|
{
|
||||||
|
rmsg.buf = calloc(1, req->max_buflen);
|
||||||
|
ASSERT(rmsg.buf);
|
||||||
|
|
||||||
|
ret = ioctl(priv->gsfd, GS2200M_IOC_RECV,
|
||||||
|
(unsigned long)&rmsg);
|
||||||
|
}
|
||||||
|
|
||||||
if (0 == ret)
|
if (0 == ret)
|
||||||
{
|
{
|
||||||
@ -891,7 +894,7 @@ prepare:
|
|||||||
resp.valuelen = MIN(resp.valuelen_nontrunc,
|
resp.valuelen = MIN(resp.valuelen_nontrunc,
|
||||||
req->max_addrlen);
|
req->max_addrlen);
|
||||||
|
|
||||||
if (0 == rmsg.len)
|
if ((0 == rmsg.len) && (0 != rmsg.reqlen))
|
||||||
{
|
{
|
||||||
usock_send_event(fd, priv, usock,
|
usock_send_event(fd, priv, usock,
|
||||||
USRSOCK_EVENT_REMOTE_CLOSED
|
USRSOCK_EVENT_REMOTE_CLOSED
|
||||||
|
Loading…
Reference in New Issue
Block a user