General Motors Co. is recalling more than one million late-model pickup trucks and large sport-utility vehicles in the U.S. for a steering defect, the latest example of a problem generated by the industry’s growing use of software to control a car’s mechanical functions.

The defect has been linked to 30 crashes and two injuries. The trucks can lose their electronically controlled power steering momentarily before it suddenly comes back on, causing the driver to have difficulty steering, GM said in a filing to federal safety...