The specific offence of undertaking (or nearside undertake) was actually removed from the statute books with the introduction of the 1972 Road Traffic Act, and although the Highway Code advises against it, there is no specific law that prevents it.
The reason for this is in part due to the poor lane discipline experienced on Motorways. There are often many occasions (which many of you have probably experienced yourself) when lane 3 is stationary but lanes 1 and 2 are clear and so it is often easier to continue in the inside lanes and keep traffic flowing.
On other occasions drivers will catch up a vehicle doing say 50mph but remains in lane 2 whilst lane 1 is empty (late at night for example) and to go from lane 1 across to lane 3 is potentially just as dangerous, whereas remaining in lane 1 allows the vehicle to pass quite safely (I hope I explained that OK?)
However, whilst there is no specific offence of undertaking, we still have careless driving under section 3 of the 1988 Road Traffic Act, and a driver who undertakes dangerously or badly will find themselves before the court for either careless or in the worst cases dangerous (section 2 of the same act)
But, to obtain a conviction, the prosecution has to show that the standard of driving fell well below the standard expected of a reasonably competent driver, and the act of the nearside overtake would not in itself be sufficient to secure a conviction.
However, if as I saw yesterday, a vehicle shoots past in lane 2 on the undertake, then into lane 1, undertakes and then shoots out to lane 3 and then back to lane 3 (if you like, weaving from lane to lane) then that would probably be sufficient to get the conviction.
If like me on the same route, I had a vehicle doing 45 - 50 in lane 2 in an empty motorway, I went past at around 60 and a Police car followed me and then pulled over the centre lane hogger, then you know that the hogger is going to get done for driving without reasonable consideration for other road users (which is a sub section of careless driving).
I hope I explained that OK.
The other question I get asked a lot is what if the centre lane hogger then moves back to lane 1 as you are undertaking and a collision occurs?
Well, then centre lane hogger has a statutory duty of care to ensure it is safe to move back in just as much as they do when moving to an outside lane, and there have been a few cases in civil law where the hogger has been held 100% liable on the basis that with the evidence available they could have been in lane 1 in the first place, and so they committed the section 3 offence, and then failed to check it was safe to return to lane 1, and that the undertaking driver was acting perfectly reasonably for the circumstances.
So, in short, there is no offence, or specific offence, and if it is done sensibly, then nothing to worry about, but just be aware of the possibility of the hogger moving across back into the nearside lane.
I hope that answers the question for you?