Yevamot, Chapter Eleven, Mishnah Six
As we learned in chapter four, mishnah ten, a woman must wait three months between marriages in order to determine whether a subsequently born child is from the first or second husband. Our mishnah deals with a case where the woman did not wait and then bore a child seven months after being married to her second husband. In such a case it is unknown whether the child was a full-term child from the first husband or a prematurely born child from the second husband.
1) If a woman did not wait three months after [separation from] her husband, and married again and gave birth [to a son], and it is unknown whether it is a nine-months child by the first husband or a seven-months child by the second, if she had other sons by the first husband and other sons by the second, these must perform halitzah but may not contract yibbum.
a) So too he, with their widows performs halitzah but may not contract yibbum.
2) If he had brothers by the first and also brothers by the second, but not by the same mother, he may either perform halitzah or contract yibbum,
a) But as for them, one performs halitzah and the other may [then] contract yibbum.
Section one: In this scenario, it is unclear whether this boy is a paternal brother of the children of the first father or of the second father. He is a maternal brother to all of them, but only paternal brothers are obligated by the laws of yibbum. Therefore, should he die without children, his widow must receive halitzah from one brother from the first father and from one brother from the second husband. They may not perform yibbum lest he was not their paternal brother. In this case since he is there maternal brother, marrying the widow would be forbidden.
Similarly, if one of these brothers dies without children, the doubtful-son performs halitzah but not yibbum, lest he was not his brother.
Section two: If he had brothers from the first husband and the second husband but these brothers were not from his mother, he may have halitzah or yibbum with any of their widows. With regard to the first husbands sons widow, if the first husband was his father, then he is performing yibbum correctly. If the second husband was his father, then the widows of the children of the first husband are like strangers (non-relatives) to him, and he may marry them. Note that this is only so if there was only one other son to the first husband. If he had other sons, his widow must receive halitzah from one of them first, lest the doubtful son was really the son of the second husband. With regard to the second husbands sons widow the same is also true. Either she is his brothers widow or a stranger. In either case he may marry her. The difference between this case and that in section one is that these brothers do not share the same mother.
If he (the doubtful-son) dies, then one brother from one father must perform halitzah and then the other can have yibbum. The second one may have yibbum because if he was his brother, then she is his brothers widow, and yibbum is allowed. If he was not his brother, then she was not his brothers widow, but she is permitted since she has already received yibbum from her brother-in-law (the son of the other husband).