net: socket: fix for e93d030058684f98894aafb5c4048b2c6d9d479f

The former fix for socket initialization was broken. This fixes the
"fix" by using the right exit condition for the loops.