Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1044225pxb; Wed, 6 Apr 2022 07:24:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCVH3zHb94hklb/RwDxHH9V/lz/Z7rfJ7GLSiSX7ZAYkJYmPhk1mR+VGmswPoPGOsQ61m6 X-Received: by 2002:a17:902:da84:b0:154:3b08:4523 with SMTP id j4-20020a170902da8400b001543b084523mr9122451plx.65.1649255066927; Wed, 06 Apr 2022 07:24:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649255066; cv=none; d=google.com; s=arc-20160816; b=yCTmSmJjtUVOtBWFSCW+/Ll2hTCxAacWEiqs1gCeM/WFgNFCERFJ49DPeCueJ2Q/AC f+T5DIjG2G5Cqwt40cyiA63R+A5j12jZ4A3GMPFJZp8RxBB3n+//FRUt5ocf4wxebdQp GmSwf8ghofmqv6TrVoJv1+VGcZwUucyZXUjkKtgMO8o0OEMFNtyVbxLttsb6GPQZ1f4y WvY7HR6bV7F+GOr3TQKr+vSrXTSV5r2+8qGhrZ6r+fK/DQiTRQHx+Tro93KpJVFG7u6E GiFDrd42o+BcAfxgHIaA+PkPx7fRSIozuaDmJqnOdR6XoeNKl2mvEJmrbnlT/Uh4sx70 w9Cg== 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=cYDRD04+rL7X6m2/FXQd8xCSH0PGeIAvrw1+A1F6JHw=; b=bG6O8tmNraUDmsh5TIrxdLSwij94NOguALwJjve/mwnsV4Z2GrCm8uzmKsK/l6QbEa exwNLsWwSyhK9XtfS4vDJl7VjqI27f4UFrNvFaGa+OIAA3opGTxRTY07NZ78lYpYlyc1 tDxXDRcmHD4o0c3d2czbRCpM28LBZsfj8BohGyMaqEJQ+3MaIg7e8+58KQbKkNTUeKSk 8xVQIJuhjSlLhDcAtEGxVWjYJjiKl2WG3ZaMcirtrSJqidGowfwlBsrsVAyIbai5+810 sHEfBrHkoTPL8fhWGjPMwZf6zFii3MWEADRLYuZUGdVM+higLhNyowQVJjfRQIWtl7L7 7g/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WYGylumE; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id 78-20020a630251000000b003816043ef25si8618758pgc.282.2022.04.06.07.24.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 07:24:26 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WYGylumE; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5960165D1F1; Wed, 6 Apr 2022 05:33:54 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351460AbiDEUfA (ORCPT + 99 others); Tue, 5 Apr 2022 16:35:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348814AbiDEJsj (ORCPT ); Tue, 5 Apr 2022 05:48:39 -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 3E5C3A9976; Tue, 5 Apr 2022 02:36:07 -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 D188F616AE; Tue, 5 Apr 2022 09:36:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA264C385A0; Tue, 5 Apr 2022 09:36:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151366; bh=mMs8cEwxxXca6Fv/Ju+e15x+v/0X/GOCyC5VUwCK5YA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WYGylumEDuUPDPO4QnHCQOAtSt+tUr5qFcLBVJvzPEyJrkbNlC1QaUEX4+8rrjn1g x4Z8nVFFv+vGx1oDf3IOpouK0NLSBwv0XLaJsSEhhsnaeSwr3dE0ABFiBhl4z9P+oZ dFMvJFbSMTsDN6zNsVRsDO5NcmobCxSI7QjfbVBc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= , Daniel Vetter , Sasha Levin Subject: [PATCH 5.15 389/913] drm/selftests/test-drm_dp_mst_helper: Fix memory leak in sideband_msg_req_encode_decode Date: Tue, 5 Apr 2022 09:24:11 +0200 Message-Id: <20220405070351.508314271@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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: José Expósito [ Upstream commit ba3a5ddcf1e5df31f2291006d5297ca62035584f ] Avoid leaking the "out" variable if it is not possible to allocate the "txmsg" variable. Fixes: 09234b88ef55 ("drm/selftests/test-drm_dp_mst_helper: Move 'sideband_msg_req_encode_decode' onto the heap") Addresses-Coverity-ID: 1475685 ("Resource leak") Signed-off-by: José Expósito Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20220108165812.46797-1-jose.exposito89@gmail.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c b/drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c index 6b4759ed6bfd..c491429f1a02 100644 --- a/drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c +++ b/drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c @@ -131,8 +131,10 @@ sideband_msg_req_encode_decode(struct drm_dp_sideband_msg_req_body *in) return false; txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL); - if (!txmsg) + if (!txmsg) { + kfree(out); return false; + } drm_dp_encode_sideband_req(in, txmsg); ret = drm_dp_decode_sideband_req(txmsg, out); -- 2.34.1