From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0AFBC8300A for ; Tue, 27 Oct 2020 16:02:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9271B20657 for ; Tue, 27 Oct 2020 16:02:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603814521; bh=P05hMdmcCfZ6hsb/t3C3HolCK1kxPQigs2YlxUr23RU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=TYiXHDlLvtRTrA/QQ9j1YEUt/CHjgqxS1wVlWQwqaPOrMVaohJGsHapcHWtppbLKW 5v4rCodlYxVAPzsfwOPPGY2sDaCySS6g3kvU+/ilchTs19heE0mt7M4vUL/QkOj178 x3hLjywxT0uXBwUDlz60ISr6bNlyQ3mPktOkcBJs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1805686AbgJ0QBG (ORCPT ); Tue, 27 Oct 2020 12:01:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:60998 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1801427AbgJ0PlR (ORCPT ); Tue, 27 Oct 2020 11:41:17 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 2ECB3223B0; Tue, 27 Oct 2020 15:41:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603813276; bh=P05hMdmcCfZ6hsb/t3C3HolCK1kxPQigs2YlxUr23RU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=daKtbnfEtE2cTF86u4YN0JSpg0O8tBvE/94Z03gI6rjs/LecAcgjULlwBaFaQDnqE OS24uF/VEOIqZeXmhxDfOex4O2c7vJ+7XdinuNflh5Wd92VUh+9qGce9ugIvD1rsGp xkecDmWucxjOV08T+G1xwQLlfdQdX01HuidlJejg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jing Xiangfeng , Daniel Lezcano , Sasha Levin Subject: [PATCH 5.9 497/757] thermal: core: Adding missing nlmsg_free() in thermal_genl_sampling_temp() Date: Tue, 27 Oct 2020 14:52:27 +0100 Message-Id: <20201027135513.775287511@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135450.497324313@linuxfoundation.org> References: <20201027135450.497324313@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jing Xiangfeng [ Upstream commit 48b458591749d35c927351b4960b49e35af30fe6 ] thermal_genl_sampling_temp() misses to call nlmsg_free() in an error path. Jump to out_free to fix it. Fixes: 1ce50e7d408ef2 ("thermal: core: genetlink support for events/cmd/sampling") Signed-off-by: Jing Xiangfeng Signed-off-by: Daniel Lezcano Link: https://lore.kernel.org/r/20200929082652.59876-1-jingxiangfeng@huawei.com Signed-off-by: Sasha Levin --- drivers/thermal/thermal_netlink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/thermal/thermal_netlink.c b/drivers/thermal/thermal_netlink.c index af7b2383e8f6b..019f4812def6c 100644 --- a/drivers/thermal/thermal_netlink.c +++ b/drivers/thermal/thermal_netlink.c @@ -78,7 +78,7 @@ int thermal_genl_sampling_temp(int id, int temp) hdr = genlmsg_put(skb, 0, 0, &thermal_gnl_family, 0, THERMAL_GENL_SAMPLING_TEMP); if (!hdr) - return -EMSGSIZE; + goto out_free; if (nla_put_u32(skb, THERMAL_GENL_ATTR_TZ_ID, id)) goto out_cancel; @@ -93,6 +93,7 @@ int thermal_genl_sampling_temp(int id, int temp) return 0; out_cancel: genlmsg_cancel(skb, hdr); +out_free: nlmsg_free(skb); return -EMSGSIZE; -- 2.25.1