Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2087285rdb; Mon, 20 Nov 2023 01:13:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IHP03+iDuKqkyZ1mJETegSPs9dLyG525I/er6cadTfv1dod1zVhVZBqF8tSO3lhDriyeife X-Received: by 2002:a05:6871:7398:b0:1f5:994:9853 with SMTP id na24-20020a056871739800b001f509949853mr8560532oac.22.1700471638857; Mon, 20 Nov 2023 01:13:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700471638; cv=none; d=google.com; s=arc-20160816; b=s6zKuKNGG3zfPQIzcKFnC97YgwthNfSTmDaIntXBxTNkPOqrnK7Qrqer0KZXas0Wup SjaftsJOZVbPw95Xd4H2bDbENMOyWbp8jFuJHszvLAuambbjFJ5jUkB39cO6/u2/8jr9 Y77zdFtOLXAnnUxJXwS5fSSNeR3HWxJ4YzS8FTmyoTslmi69GAI/wBqE1GYA5pKauT49 QUfSb04Cvb6K64H+MjY1qQ6Xq4gTxJgYCHE7yp0HcYs91uYxF37mkkGaTPAogsT3vm3g ugRSBIYWoGS1XDPXqbzjKatSwFapTEk9o78uSSNSFD5UAuiDpwZ0hsbLYAZxlktl1EG/ Dw7g== 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 :message-id:date:subject:cc:to:from; bh=sVvAsYFdog6M3Vmr4LBN9S0WmJw/M+uUCe2wKIocPqE=; fh=wJqOXXQ86m+60YyrQhtQZC8vGGsoRN7PUYcvq/RWdxw=; b=XxCAOaPCxentS2GWWPyzSlDyAuQ4n0Jf/YxVy1Iq0pBJPRwTHk+qSKE7up+YBtskQ8 xmNvIDbrBU2YBvCNmACNxxmahGc7pEfaTBisXgQ5SOr+3os7Ely4eQOK40LZ0idS2Dcw pArCUGjmi6h2o4Wwss6Wd9P7GF0FVf4oAeqFNeOG1Hc8F+imGV3HLpkLT+frelxqezPE nP7Nj9uRHzyHQFt8X8wcYLIOROd2mvwgJ7eqTiaXyUIjkvGdXlWqNG7gi8It1PhMOJeQ z9xLfuIKtvgDFijxBgKM0QB0CcpHFC0PqIZ5oS2I2zCiAeJCRI6wk8iBONkO0XHCmKCw KJlw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id y5-20020a633205000000b005bdbda280c2si7761324pgy.364.2023.11.20.01.13.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 01:13:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 130CE806290E; Mon, 20 Nov 2023 01:08:24 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232349AbjKTJIW (ORCPT + 99 others); Mon, 20 Nov 2023 04:08:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232176AbjKTJIU (ORCPT ); Mon, 20 Nov 2023 04:08:20 -0500 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EE8FB8 for ; Mon, 20 Nov 2023 01:08:13 -0800 (PST) X-UUID: a9430cdac30a41a1804c6ba6df71fe60-20231120 X-CID-O-RULE: Release_Ham X-CID-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.32,REQID:b82c19e5-d93e-450f-80f3-6122677b0c13,IP:10, URL:0,TC:0,Content:0,EDM:25,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACT ION:release,TS:20 X-CID-INFO: VERSION:1.1.32,REQID:b82c19e5-d93e-450f-80f3-6122677b0c13,IP:10,UR L:0,TC:0,Content:0,EDM:25,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:20 X-CID-META: VersionHash:5f78ec9,CLOUDID:f336da72-1bd3-4f48-b671-ada88705968c,B ulkID:23112017080368A5O3NH,BulkQuantity:0,Recheck:0,SF:17|19|44|66|38|24|1 02,TC:nil,Content:0,EDM:5,IP:-2,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL :0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD,TF_CID_SPAM_FSI X-UUID: a9430cdac30a41a1804c6ba6df71fe60-20231120 X-User: gehao@kylinos.cn Received: from localhost.localdomain [(116.128.244.171)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 1345845564; Mon, 20 Nov 2023 17:08:01 +0800 From: Hao Ge To: vadim.fedorenko@linux.dev, arkadiusz.kubalewski@intel.com Cc: michal.michalik@intel.com, davem@davemloft.net, linux-kernel@vger.kernel.org, gehao618@163.com, Hao Ge Subject: [PATCH] dpll: Fix potential msg memleak in dpll_nl_pin_id_get_doit Date: Mon, 20 Nov 2023 17:07:58 +0800 Message-Id: <20231120090758.31378-1-gehao@kylinos.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 20 Nov 2023 01:08:24 -0800 (PST) We should clean the skb resource if genlmsg_put_reply failed. Fixes: 9d71b54b65b1 ("dpll: netlink: Add DPLL framework base functions") Signed-off-by: Hao Ge --- drivers/dpll/dpll_netlink.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/dpll/dpll_netlink.c b/drivers/dpll/dpll_netlink.c index a6dc3997bf5c..54051cd34d43 100644 --- a/drivers/dpll/dpll_netlink.c +++ b/drivers/dpll/dpll_netlink.c @@ -1093,9 +1093,10 @@ int dpll_nl_pin_id_get_doit(struct sk_buff *skb, struct genl_info *info) return -ENOMEM; hdr = genlmsg_put_reply(msg, info, &dpll_nl_family, 0, DPLL_CMD_PIN_ID_GET); - if (!hdr) + if (!hdr) { + nlmsg_free(msg); return -EMSGSIZE; - + } pin = dpll_pin_find_from_nlattr(info); if (!IS_ERR(pin)) { ret = dpll_msg_add_pin_handle(msg, pin); -- 2.25.1