net: sockets: Store socket private data into its own variable

Do not try to re-use net_context.user_data field as in many places
(like in accept) it is expected to contain pointer to net_context.
Storing the socket flags will corrupt the value. To simplify and
make things less error prone, use socket specific field in net_context
to store the socket flags.

Fixes #19191

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2019-09-17 09:51:26 +03:00
commit e98f5d37f5
3 changed files with 9 additions and 3 deletions

View file

@ -257,6 +257,9 @@ struct net_context {
#endif /* CONFIG_NET_CONTEXT_SYNC_RECV */
#if defined(CONFIG_NET_SOCKETS)
/** BSD socket private data */
void *socket_data;
/** Per-socket packet or connection queues */
union {
struct k_fifo recv_q;