DIR-300 B6 overheats

At the moment I have an old router DIR-300 B6 with the latest available LEDE firmware version 17.01.7 installed.

When using the network, the router overheats and either freezes or disables the WAN and Wi-Fi. It doesn't happen with the stock firmware, but with all the custom firmwares available including LEDE.

Is there any way to fix this? I had an idea to just lower the CPU frequency.