The S in Linux ditto.
Linux has a far wider attack surface than my baremetal embedded firmware. Like 10^6 wider. There's a single mqtts service mostly, or just passive senders (sensors, controllers). Zero attack surface.
Linux is way too big, with thousands of drivers, services and patches.