The LM317 is a "floating regulator", as such, you just have to be sure that the voltage across the input and output leads never exceeds 37 Volts (the MAX rated voltage). If you are sure that the batteries will never drop low enough to cause 37 volts to appear across the LM317, then you can get away with it, but that wouldn't be a good design for production. The reason is you will not have short-circuit protection or current limiting below a certain voltage -- because below that voltage, there will be more than 37V across the LM317 and it will fry (in other words if you are making this for you own purposes, then you only have yourself to answer to
Now, there are a couple of ways to fix this:
1. put a fuse (around 2.0 amp -- but experimentation may be necessary) in series with the input of the LM317 (between the smaller input cap, typically 0.1uF and any larger filter caps [because the inrush current could blow the fuse]) and then put a 36V 1Watt zener from the input to the output of the LM317 with the cathode facing the input. Thus, if the voltage reaches 36V, the zener will conduct and blow the fuse (this is called a "crowbar" protection circuit).
2. Check out the Figure 5 (Tracking Preregulator Circuit) in the following document (or look up the TI datasheet for the LM317):
www.ti.com/lit/ds/symlink/lm317.pdf
By putting a second regulator in series you have nearly double the input voltage capability, with full current limiting and short circuit protection.
BTW: an 8V zener in the adj leg of the LM317 will not solve the current limiting problem for cases where the output voltage is pulled down low enough for there to be greater than 37V across the LM317.