From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cornelia Huck Subject: [PULL 1/1] s390: vfio-ccw: Do not attempt to free no-op, test and tic cda. Date: Thu, 9 Nov 2017 17:21:20 +0100 Message-ID: <20171109162120.27453-2-cohuck@redhat.com> References: <20171109162120.27453-1-cohuck@redhat.com> Cc: bjsdjshi@linux.vnet.ibm.com, borntraeger@de.ibm.com, linux-s390@vger.kernel.org, kvm@vger.kernel.org, "Jason J. Herne" , Cornelia Huck To: schwidefsky@de.ibm.com Return-path: Received: from mx1.redhat.com ([209.132.183.28]:42622 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752649AbdKIQV1 (ORCPT ); Thu, 9 Nov 2017 11:21:27 -0500 In-Reply-To: <20171109162120.27453-1-cohuck@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: From: "Jason J. Herne" Because we do not make use of the cda (channel data address) for test, no-op ccws no address translation takes place. This means cda could contain a guest address which we do not want to attempt to free. Let's check the command type and skip cda free when it is not needed. For a TIC ccw, ccw->cda points to either a ccw in an existing chain or it points to a whole new allocated chain. In either case the data will be freed when the owning chain is freed. Signed-off-by: Jason J. Herne Reviewed-by: Dong Jia Shi Reviewed-by: Pierre Morel Message-Id: <1510068152-21988-1-git-send-email-jjherne@linux.vnet.ibm.com> Reviewed-by: Halil Pasic Acked-by: Christian Borntraeger Signed-off-by: Cornelia Huck --- drivers/s390/cio/vfio_ccw_cp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_cp.c index d8f98ad9b029..7ebbd8b482f5 100644 --- a/drivers/s390/cio/vfio_ccw_cp.c +++ b/drivers/s390/cio/vfio_ccw_cp.c @@ -332,6 +332,8 @@ static void ccwchain_cda_free(struct ccwchain *chain, int idx) { struct ccw1 *ccw = chain->ch_ccw + idx; + if (ccw_is_test(ccw) || ccw_is_noop(ccw) || ccw_is_tic(ccw)) + return; if (!ccw->count) return; -- 2.13.6