Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3327513iob; Mon, 16 May 2022 19:32:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwi7Q6tkYyX+1STPUsgbT0JlkpJfpmSngZ3meARJAMtHG27FM4uOV+E/JlGoJXS5cNs7FG6 X-Received: by 2002:a05:6402:4396:b0:427:f2dc:b11 with SMTP id o22-20020a056402439600b00427f2dc0b11mr16592991edc.298.1652754736984; Mon, 16 May 2022 19:32:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652754736; cv=none; d=google.com; s=arc-20160816; b=UxJIMuOhwD6SIKQ6scRE4cNISztI7kwkBqYp3vq73oPchksap6PlsKGCJcoiYco94r CWQ0pKRddJVS9QAwpAQBVQC56oSC2BHHM6f4plfcj+HYRquWzx91wl+2krIeV+pvnSkg N7cELj7lzjWVWPPXbwm7har5p45Oyf9imlGufe1VcE8M/aLFS+fLaR2FSn4mIZhjPajt qTzZRCm1w+iUf5M/qulaBmnnzrUSRx9ybZiJzTD1VdEQntAfiSGaQrALSYWtkzs6cGx7 gETn09CVQ/2fINLDGF+r2xx2E6oGaOuU8aOP3edlZjSxtHNEBDV+1Gnb++cAqYLyTVdO GUxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=h7C+PhQ/7DlIA9fn8qxRoN5X6XKx/Waeuxd3K3NASKw=; b=KorVSzf01rbZKpv7bVF0t9INg5O/K16E8DXLOoom3JhnPLZMYeiDdD/youdC/qcTXY sO+FvAab/bgz6xTRFlzRQyrODkGtClhH/D1MSLC3vZuQUQVXsnuadUx5wQmpWljUIGh/ rpu6q56m6f1XMU1abytEcKXvED74ZjlWCfaGLh8QM6UUZkj0NC7UidpRpoYAURsXJQwh zar/wHRLApwM95WtV7C7dLUgxttulNgFbzhoXvz3sJEDSm06lrINU7BhQXKQwSZRrKn0 19XOW1dN60TVQD6YkM8H1HgstRpnQD5K3Lpk8ndIkFQv5xYREyqNWvf5Fc58+6iWypro MEpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XsqmsGVo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qx9-20020a170906fcc900b006e893bdaefesi867069ejb.884.2022.05.16.19.31.51; Mon, 16 May 2022 19:32:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XsqmsGVo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343841AbiEPTp1 (ORCPT + 99 others); Mon, 16 May 2022 15:45:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346089AbiEPTmu (ORCPT ); Mon, 16 May 2022 15:42:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D8763F88F; Mon, 16 May 2022 12:41:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CE0DF61551; Mon, 16 May 2022 19:41:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C24A2C385AA; Mon, 16 May 2022 19:41:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652730088; bh=EUKmFJo7bK41wq6UsNj86tOlUmXEXrc/8iptNfF0V6U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XsqmsGVoUKky1XubzEOSuQ0mOygHKLtNSoZGntiOOYmFZkXK4+dUHI6Bzujqq8p2B qn3+EYCbAoRbwwCBQ4+1/imNDoMQvaSzauF+JTjpGrLDeRFDG/KD19fTklrRjqGZIb LxhN26+xcMFLmz+LSUpSOaEKX200CtAVrryZfwUI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexandra Winter , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 09/32] s390/ctcm: fix potential memory leak Date: Mon, 16 May 2022 21:36:23 +0200 Message-Id: <20220516193615.053983875@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220516193614.773450018@linuxfoundation.org> References: <20220516193614.773450018@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexandra Winter [ Upstream commit 0c0b20587b9f25a2ad14db7f80ebe49bdf29920a ] smatch complains about drivers/s390/net/ctcm_mpc.c:1210 ctcmpc_unpack_skb() warn: possible memory leak of 'mpcginfo' mpc_action_discontact() did not free mpcginfo. Consolidate the freeing in ctcmpc_unpack_skb(). Fixes: 293d984f0e36 ("ctcm: infrastructure for replaced ctc driver") Signed-off-by: Alexandra Winter Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/s390/net/ctcm_mpc.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/s390/net/ctcm_mpc.c b/drivers/s390/net/ctcm_mpc.c index e02f295d38a9..07d9668137df 100644 --- a/drivers/s390/net/ctcm_mpc.c +++ b/drivers/s390/net/ctcm_mpc.c @@ -625,8 +625,6 @@ static void mpc_rcvd_sweep_resp(struct mpcg_info *mpcginfo) ctcm_clear_busy_do(dev); } - kfree(mpcginfo); - return; } @@ -1205,10 +1203,10 @@ static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) CTCM_FUNTAIL, dev->name); priv->stats.rx_dropped++; /* mpcginfo only used for non-data transfers */ - kfree(mpcginfo); if (do_debug_data) ctcmpc_dump_skb(pskb, -8); } + kfree(mpcginfo); } done: @@ -1991,7 +1989,6 @@ static void mpc_action_rcvd_xid0(fsm_instance *fsm, int event, void *arg) } break; } - kfree(mpcginfo); CTCM_PR_DEBUG("ctcmpc:%s() %s xid2:%i xid7:%i xidt_p2:%i \n", __func__, ch->id, grp->outstanding_xid2, @@ -2052,7 +2049,6 @@ static void mpc_action_rcvd_xid7(fsm_instance *fsm, int event, void *arg) mpc_validate_xid(mpcginfo); break; } - kfree(mpcginfo); return; } -- 2.35.1