vfio: ccw: fix cleanup if cp_prefetch fails
If the translation of a channel program fails, we may end up attempting to clean up (free, unpin) stuff that never got translated (and allocated, pinned) in the first place. By adjusting the lengths of the chains accordingly (so the element that failed, and all subsequent elements are excluded) cleanup activities based on false assumptions can be avoided. Let's make sure cp_free works properly after cp_prefetch returns with an error by setting ch_len of a ccw chain to the number of the translated CCWs on that chain. Cc: stable@vger.kernel.org #v4.12+ Acked-by: NPierre Morel <pmorel@linux.vnet.ibm.com> Reviewed-by: NDong Jia Shi <bjsdjshi@linux.vnet.ibm.com> Signed-off-by: NHalil Pasic <pasic@linux.vnet.ibm.com> Signed-off-by: NDong Jia Shi <bjsdjshi@linux.vnet.ibm.com> Message-Id: <20180423110113.59385-2-bjsdjshi@linux.vnet.ibm.com> [CH: fixed typos] Signed-off-by: NCornelia Huck <cohuck@redhat.com> Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
Showing
想要评论请 注册 或 登录