I don't know on how to validate the quantity, meaning if user add the quantity more than In stock, it should not allow the user to add more quantity than In stock(quantity available), I think it can be achieved in rules, but Im not sure to do that any pointer would be helpful!
commerce stock module check the quantity and prevent add max than stock,also if the stock be 0 it change
add to cart button to
out of stock.
Also if you want to implement it by yourself you can do it with rules