Skip to contentSkip to conversation

s390/cio: Fix cleanup when unsupported IDA format is used

RFC PATCH New Eric Farman 1 participant 1 message Nov 9, 2018

Subsystems (3)
lore
Share & tools
lore

Eric Farman

author maintainer
#0 lore raw

RFC PATCH 2/10 s390/cio: Fix cleanup when unsupported IDA format is used

Direct returns from within a loop are rude, but it doesn't mean it gets to avoid releasing the memory acquired beforehand.

---
 drivers/s390/cio/vfio_ccw_cp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/s390/cio/vfio_ccw_cp.c +3 -1
index ef5ab45d94b3..70a006ba4d05 100644
@@ -387,8 +387,10 @@ static int ccwchain_calc_length(u64 iova, struct channel_program *cp)
 		 * orb specified one of the unsupported formats, we defer
 		 * checking for IDAWs in unsupported formats to here.
 		 */
-		if ((!cp->orb.cmd.c64 || cp->orb.cmd.i2k) && ccw_is_idal(ccw))
+		if ((!cp->orb.cmd.c64 || cp->orb.cmd.i2k) && ccw_is_idal(ccw)) {
+			kfree(p);
 			return -EOPNOTSUPP;
+		}
 
 		if ((!ccw_is_chain(ccw)) && (!ccw_is_tic(ccw)))
 			break;
Signature · 1 line
2.16.4