Atlast, the awaited userland jailbreak has been released by Comex by the name JailbreakMe 2.0 Star.
It could jailbreak the iPhone 3GS and 3G on 3.1.2, 3.1.3, 4.0 and 4.0.1 firmwares. But the more interesting and awaited thing is that it could jailbreak the iPhone 4 on iOS 4 and 4.0.1.

JailbreakMe 2.0 Star

It could not only jailbreak the iPhone, but the iPod Touch 1G, 2G and 3G on 3.1.2, 3.1.3, and 4.0 firmwares along with supporting the jailbreak of iPad 3.2 and 3.2.1 firmwares. To do the jailbreak, you just have to go to http://jailbreakme.com on your device and slide the slide to jailbreak button there and JailbreakMe 2.0 will do the rest.