s390/cio: Fix cleanup of pfn_array alloc failure
authorEric Farman <farman@linux.ibm.com>
Fri, 9 Nov 2018 02:39:28 +0000 (03:39 +0100)
committerCornelia Huck <cohuck@redhat.com>
Tue, 13 Nov 2018 10:45:17 +0000 (11:45 +0100)
If pfn_array_alloc fails somehow, we need to release the pfn_array_table
that was malloc'd earlier.

Signed-off-by: Eric Farman <farman@linux.ibm.com>
Message-Id: <20181109023937.96105-2-farman@linux.ibm.com>
Acked-by: Halil Pasic <pasic@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
drivers/s390/cio/vfio_ccw_cp.c

index fd77e46eb3b21520f2bf155612aed0248e773884..ef5ab45d94b3b7385730220ab9049402e16e662e 100644 (file)
@@ -528,7 +528,7 @@ static int ccwchain_fetch_direct(struct ccwchain *chain,
 
        ret = pfn_array_alloc_pin(pat->pat_pa, cp->mdev, ccw->cda, ccw->count);
        if (ret < 0)
-               goto out_init;
+               goto out_unpin;
 
        /* Translate this direct ccw to a idal ccw. */
        idaws = kcalloc(ret, sizeof(*idaws), GFP_DMA | GFP_KERNEL);