You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by je...@apache.org on 2020/10/09 06:47:21 UTC
[incubator-nuttx-apps] branch master updated: wireless: gs2200m:
Fix recvfrom_reques() in gs2200m_main.c
This is an automated email from the ASF dual-hosted git repository.
jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new f4b0f9e wireless: gs2200m: Fix recvfrom_reques() in gs2200m_main.c
f4b0f9e is described below
commit f4b0f9e2900a5ed277fd8d0466f3c38441d45e9b
Author: Masayuki Ishikawa <Ma...@jp.sony.com>
AuthorDate: Fri Oct 9 10:33:54 2020 +0900
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 <Ma...@jp.sony.com>
---
wireless/gs2200m/gs2200m_main.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/wireless/gs2200m/gs2200m_main.c b/wireless/gs2200m/gs2200m_main.c
index fe58160..bbb93ad 100644
--- a/wireless/gs2200m/gs2200m_main.c
+++ b/wireless/gs2200m/gs2200m_main.c
@@ -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