At the time the person enters the UK, their passport must be valid for at least two months beyond the expiry of their entry clearance.
If not, the Immigration Officer is entitled to curtail the person's entry clearance so that the above condition will be valid.
In your case, your visa expires in June and your passport expires in October, that's four months and so you meet the requirements of this particular rule.
The rule itself is in Paragraph 21 of the Immigration Rules.
The leave to enter or remain in the United Kingdom of the holder of a
passport or travel document whose permission to enter another country
has to be exercised before a given date may be restricted so as to
terminate at least 2 months before that date.