Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp801464imm; Mon, 21 May 2018 14:45:04 -0700 (PDT) X-Google-Smtp-Source: AB8JxZplkN9dho9sMK312ig5TPYmUcrmv6AernNpOKHlf77gB/m5NRFJkr273K8axxIHQ+FDTODN X-Received: by 2002:a63:744a:: with SMTP id e10-v6mr17042623pgn.275.1526939104093; Mon, 21 May 2018 14:45:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526939104; cv=none; d=google.com; s=arc-20160816; b=bdVYr0ePh/Emu8PYIv///tps77IFTqO10+cIsOswM8oUA0GGYYX8sXLeRL4s3RG3RO TEABnnR5eBmrOqBtmk3BMvLfa++utl8YcGxF8ZfY8nSZAdGBzUt13lCGQSo+PDRxKQv2 Xa5bUhevtWVFzb9E7vJd8dBSqainmB8aiFygkNVAqOjEoNPn7dXmzujenb2RlNbtea9I JrOOqTlOb2gHb4yn3r6x+rZxhACKX7kjtN7o5w8F5N9i6KcP1c6+MFD1zMUoCJqlqbA3 0rlvf4xjypRAT9J+Yyjl6EOFCIVmB8UBUZGyvPvuv5f/zOt933bYb6iWC48nLghlIhf0 671A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=o8PWWH9l28w2w/I/WJn6wozheaUESM1/9RB+99kvNmI=; b=M06r0y8KDpxAiDAX0QLWuOg+MVgouM1llZiF4XB5wEN++GesZLjrzUmxbQ6BejHDg8 ZfZjwkjQTxth67iLW4MG4kQjF4iZMVXnjFJ47XQVvXREduMeZmhgALSUS1J43oVBwCc4 XwTrtcL3F7USsTh5Z1zvW1h2FDJdtHDeRins/Ngi+fZpvY9njRa9BdCdihs4e+mLYhal +RjclZPuiNWA/438aU1CTFTPeSkeXpphGwggMtn1gSsz7+Q/9XIJrGzJ9VzoU4LEoOGn V7RQJStEAK3cMadXlmQG3ZR5nwaj3le8cCm7L79/dahTiZ/7oj+0leIeboDmpQ/ouO7M 0JdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NqGBV5Kp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c1-v6si13815939pld.103.2018.05.21.14.44.49; Mon, 21 May 2018 14:45:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NqGBV5Kp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932225AbeEUVYF (ORCPT + 99 others); Mon, 21 May 2018 17:24:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:38708 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932189AbeEUVXw (ORCPT ); Mon, 21 May 2018 17:23:52 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9006720853; Mon, 21 May 2018 21:23:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1526937831; bh=DxOYrTU4vhyTU8JGxp1BQxMkbzI36v/rOhJKtkg3sho=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NqGBV5KpJ1OqHjsRqE5QXYgW+QxoaQ0yNuXppkyglX7cytOPZcVrEiFc7knkz4FQh MBUyL+nGYbpNxN5Rc4nisk6ad5PjbTB7NvJbeCQWOoGPJDHpq5eDcTv+GpEwmRuBxJ Rx+d0O1FEoR2VQHsW5PaT5zk2dx050N2zI0hcan8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julian Wiedmann , Martin Schwidefsky Subject: [PATCH 4.16 042/110] s390/qdio: dont release memory in qdio_setup_irq() Date: Mon, 21 May 2018 23:11:39 +0200 Message-Id: <20180521210507.853502959@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180521210503.823249477@linuxfoundation.org> References: <20180521210503.823249477@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Julian Wiedmann commit 2e68adcd2fb21b7188ba449f0fab3bee2910e500 upstream. Calling qdio_release_memory() on error is just plain wrong. It frees the main qdio_irq struct, when following code still uses it. Also, no other error path in qdio_establish() does this. So trust callers to clean up via qdio_free() if some step of the QDIO initialization fails. Fixes: 779e6e1c724d ("[S390] qdio: new qdio driver.") Cc: #v2.6.27+ Signed-off-by: Julian Wiedmann Signed-off-by: Martin Schwidefsky Signed-off-by: Greg Kroah-Hartman --- drivers/s390/cio/qdio_setup.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) --- a/drivers/s390/cio/qdio_setup.c +++ b/drivers/s390/cio/qdio_setup.c @@ -456,7 +456,6 @@ int qdio_setup_irq(struct qdio_initializ { struct ciw *ciw; struct qdio_irq *irq_ptr = init_data->cdev->private->qdio_data; - int rc; memset(&irq_ptr->qib, 0, sizeof(irq_ptr->qib)); memset(&irq_ptr->siga_flag, 0, sizeof(irq_ptr->siga_flag)); @@ -493,16 +492,14 @@ int qdio_setup_irq(struct qdio_initializ ciw = ccw_device_get_ciw(init_data->cdev, CIW_TYPE_EQUEUE); if (!ciw) { DBF_ERROR("%4x NO EQ", irq_ptr->schid.sch_no); - rc = -EINVAL; - goto out_err; + return -EINVAL; } irq_ptr->equeue = *ciw; ciw = ccw_device_get_ciw(init_data->cdev, CIW_TYPE_AQUEUE); if (!ciw) { DBF_ERROR("%4x NO AQ", irq_ptr->schid.sch_no); - rc = -EINVAL; - goto out_err; + return -EINVAL; } irq_ptr->aqueue = *ciw; @@ -510,9 +507,6 @@ int qdio_setup_irq(struct qdio_initializ irq_ptr->orig_handler = init_data->cdev->handler; init_data->cdev->handler = qdio_int_handler; return 0; -out_err: - qdio_release_memory(irq_ptr); - return rc; } void qdio_print_subchannel_info(struct qdio_irq *irq_ptr,