aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George2019-12-13 14:18:55 +1100
committerDamien George2019-12-13 14:45:21 +1100
commit71c6bfd08a91c942decbfd659cafd2773afb00b4 (patch)
tree4c554a97125893fd462c18e66971b12359f28676
parent624f4ca39bbbf9c89fce24f4051dcdd9417e59b1 (diff)
stm32/modusocket: Handle case of NULL NIC in socket ioctl.
-rw-r--r--ports/stm32/modusocket.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ports/stm32/modusocket.c b/ports/stm32/modusocket.c
index 46d7240ca..9af6e371f 100644
--- a/ports/stm32/modusocket.c
+++ b/ports/stm32/modusocket.c
@@ -369,6 +369,13 @@ mp_uint_t socket_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *
}
return 0;
}
+ if (self->nic == MP_OBJ_NULL) {
+ if (request == MP_STREAM_POLL) {
+ return MP_STREAM_POLL_NVAL;
+ }
+ *errcode = MP_EINVAL;
+ return MP_STREAM_ERROR;
+ }
return self->nic_type->ioctl(self, request, arg, errcode);
}