My son's passport expiry is 7 months at time of visa stamping. What will be visa validity?

My son’s passport is expiring in August 2018. I am planning to go to India in December 2017 and will be coming back in Jan 2018. I will be going for Visa stamping. My question is what will be the validity of his visa? Is it till passport expiry or my petition expiry? I have already taken visa appointment. Please let me know if there can be any hassle in my son’s travel back to US?

Visa expiration dates are linked to petitions, other document approvals, foreign engagement dates etc and not to the passport expiry date

The visa stamp will be issued as per petition, until petition expiry. It is at the point of entry here in immigration, where they will grant your I-94 validity only until Aug 2018(as your passport expires). The immigration cannot grant you to stay legally inside USA after the passport expires. I personally was issued the I-94 until the expiry of my passport even though my visa/petition had 3 year validity at the immigration.

After you return from India, you will have to file for extension of stay again to extend your stay after Aug 2018 along with the approved petition and new passport documents, styating that you have a renewed passport. USCIS will approve and send your new I-94 along with the approval notice.

So, it is good that you apply for a new passport now and then have the visa stamped.