The situation arose after the Court of Appeal on Tuesday struck down part of Ireland's 1977 Misuse of Drugs Act following a legal challenge.
The upper house passed the laws after the lower house sat late into the night on Tuesday to vote.
The legislation will be signed by Irish President Michael D. Higgins and is to be enacted by Thursday.
"The bill aims to deal with the fallout of the judgement by reinstating the status quo ante in relation to substances controlled by government order," Health Minister Leo Varadkar told senators.
Also Read
Methylethcathinone was added to the list of banned substances in 2011 after a government crackdown.
But the judges found the stimulant's addition to the list was unconstitutional as parliament had not been consulted.
As a knock-on effect, over 100 drugs restricted by that part of the law have no longer been illegal to possess since Tuesday.
The loophole did not affect existing laws regarding the supply, possession or the sale of older drugs such as heroin, cocaine and cannabis.
In a headline, British daily The Times joked "Irish MPs up all night after ecstasy legalised".
Irish media speculated that dozens of ongoing prosecutions for drug possession could now be in doubt because of the ruling.