CHICAGO (CBS) — It’s sadly said no good deed goes unpunished, but convicted felon Eric Grandberry at least managed to break even after working as a jailhouse lawyer.

WBBM Newsradio’s John Cody reports Grandberry, serving 20 years for selling cocaine, became such a good jailhouse lawyer even staff at Putnamville Correctional Facility in central Indiana sought out his help.

While the head inmate law clerk at Putnamville, Grandberry helped the prison’s librarian with a petition to stop child support payments, and another library staffer fill out forms for her daughter’s divorce case.

His help with those cases got him tossed in solitary confinement, and he lost 36 days of credit for good behavior for unauthorized use of an electronic device, because the warden said he was only supposed to help inmates with cases.

Grandberry challenged his punishment in federal court and lost, but a panel of the U.S. 7th Circuit Court of Appeals took up the matter, and ruled if jail library staffers gave Grandberry improper orders to help on cases, the penalty should fall on them, not Grandberry.

As a result, the appeals court restored Grandberry’s credit for 36 days of good behavior.

Grandberry is now housed at the Plainfield Correctional Facility just outside Indianapolis. His earliest possible release date is May 2015, according to records from the Indiana Department of Correction.