Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3594654iob; Tue, 17 May 2022 03:30:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlKfsE7gIiVQQ0GngzUD+uG4WBPg0MsanrVAmZfkc9gKvHaKXsmuZ1o5YK2o6oj1d4Ywe8 X-Received: by 2002:a17:907:6e05:b0:6fe:2f42:449e with SMTP id sd5-20020a1709076e0500b006fe2f42449emr9333167ejc.164.1652783447154; Tue, 17 May 2022 03:30:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652783447; cv=none; d=google.com; s=arc-20160816; b=pLn2a35ckHmRgAaxmqtHELh4ZGYe+bDmvb8nm5b/5OGuhNrgrVpUq3AFGIh/x014s3 qE05FVMmRNzThEgEy0n33CvwDjVeyGm/RIqw+LBQ7w3reG+MWUrTtY5tKNpPS65TiPtE qNQvlpcpFpTiKveFH7ONpkAVLxPJFF30x8YzsGUcL1IuSguJ/ESoyopNC8AWFPg+8RxS JzdNR6Sipb/jesZKBN107xCg0IbGbbTQtwu9JGicFUeg140FL/PzzcbBcZRUFqVq8Gyl Izyg0EezQfO0pRCzKydh83KOKVQwr5zAT8BdrRnjUtPmGOkV+ucmEjLISjho0+l1rDQi 9p+Q== 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=t692gPEZQUXylA+Is22XiFe5uuEz8idDOqQfF1E7FLY=; b=KxlK2BrpnoJ53xrzSzOh3wGRLgyYqXp/ARBY0wlE04mP89/gszs7xYtQ+UJT7sx31p fUXwDtlG8r00g2SutRFbCz7vDhQD171GEY2grNp6JAmLlzA0bsi7+kzJEbIoPWyYze9/ MpxEbg8uynazlNhTgEUw6dIGhnuv2G3nfCeyVwBWxWCyMNVhYC0hC1RiLC6kJsWpt3i0 GrIqA0Odx1LLJcG6g7oaLFxqUbxG+nTguR4aIVPibA7oSQ2uzBnG3AF4Z5Z7pKbW9Zpv yIVWUG9EKFVOW4G6rVNYUwcrGAeaD+kRxHjVfl2fGo/ImNGb+ey4tQXf9kheHbx2qJHB LIFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NGObXw26; 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 w23-20020aa7cb57000000b0042aaae56f1fsi6810187edt.437.2022.05.17.03.30.20; Tue, 17 May 2022 03:30:47 -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=NGObXw26; 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 S1346152AbiEPTr1 (ORCPT + 99 others); Mon, 16 May 2022 15:47:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345979AbiEPTnQ (ORCPT ); Mon, 16 May 2022 15:43:16 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A19EC3FD84; Mon, 16 May 2022 12:42:23 -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 ams.source.kernel.org (Postfix) with ESMTPS id 4FA60B81609; Mon, 16 May 2022 19:42:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 958D0C385AA; Mon, 16 May 2022 19:42:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652730141; bh=UpC0tQdo81iZrDFH8c2hiKSi7meuaYZI9mUM8n0sqGo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NGObXw26kbPFTaWk7hfzYvJT4IHwNcFJDjshI0d6F2MNOuUFAQWM8rVcv94aAiodd 3BSWD4FhZ49GEAfw1GT0ODyWg0/qFs/qAnOGoPf/fPziwos135jv40edhOzpJk7Btf 2sGy47GXCnsj1XY5mFT9mKezRxyvJFcO4XiMQ17w= 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 5.4 12/43] s390/ctcm: fix potential memory leak Date: Mon, 16 May 2022 21:36:23 +0200 Message-Id: <20220516193615.081329510@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220516193614.714657361@linuxfoundation.org> References: <20220516193614.714657361@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 ab316baa8284..d766002bc5be 100644 --- a/drivers/s390/net/ctcm_mpc.c +++ b/drivers/s390/net/ctcm_mpc.c @@ -626,8 +626,6 @@ static void mpc_rcvd_sweep_resp(struct mpcg_info *mpcginfo) ctcm_clear_busy_do(dev); } - kfree(mpcginfo); - return; } @@ -1206,10 +1204,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