It sounds like you have installed an app that affects the camera.
The flashlight is part of the camera system.
Check your device administers.
Settings
Security
Device administers
Also, it's possible that if you are using a different camera app than stock, you are getting interference.
Check your quick settings tiles, and go to the editing section.
Look for more than one flashlight icon.
If there is another one, switch it out for the one you have.
This would occur if you are using a camera app of your own, rather than the stock one.
After you make any changes, and turn off any apps that control the camera (or restrict control of it), restart the device and then try the flashlight again.