From patchwork Tue Sep 29 10:58:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 290936 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=-13.5 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 408CAC4741F for ; Tue, 29 Sep 2020 12:10:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E468E20759 for ; Tue, 29 Sep 2020 12:10:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601381409; bh=gQj01qDyAwAaQcwZQ5/a6f6D4fUtuinq65dyj/G7YxA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=sB25/SCJXxQZubTkVzf3rlUj73bm4eZSk0Ff2yrfcGP+3xakR55bxccI2IBbPBZZr SwulPrGrwXVi0dFtG8y+slstYtPjzPvm4a+SC0lwjePqfe2HPcSnTLJLeIGTpmDX7m QJvOHiB+UpMzzTv65AHFrtc7yo0SfZ9oB8MIjsXI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731666AbgI2MKI (ORCPT ); Tue, 29 Sep 2020 08:10:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:58078 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730194AbgI2Lhe (ORCPT ); Tue, 29 Sep 2020 07:37:34 -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 24EF823444; Tue, 29 Sep 2020 11:21:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601378493; bh=gQj01qDyAwAaQcwZQ5/a6f6D4fUtuinq65dyj/G7YxA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lgZQ763Jw63ze/G7wqdTtvilHWn2dOUVwR3nBTVrjTgGw/zMbMitQADMWhT8ujToq Qk5mE7OWapc6kJ3TCngNOMylRbKXGYDu5dz4nMFyj+DbAwCpUQzMCKrfm6DieNpaMs 0lHmN/BYeykBiPhNwzaECFnFiBPJb9S31Luw2s5c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pan Bian , Jason Gunthorpe , Sasha Levin Subject: [PATCH 4.19 033/245] RDMA/i40iw: Fix potential use after free Date: Tue, 29 Sep 2020 12:58:04 +0200 Message-Id: <20200929105948.617702186@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929105946.978650816@linuxfoundation.org> References: <20200929105946.978650816@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Pan Bian [ Upstream commit da046d5f895fca18d63b15ac8faebd5bf784e23a ] Release variable dst after logging dst->error to avoid possible use after free. Link: https://lore.kernel.org/r/1573022651-37171-1-git-send-email-bianpan2016@163.com Signed-off-by: Pan Bian Reviewed-by: Jason Gunthorpe Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/hw/i40iw/i40iw_cm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/i40iw/i40iw_cm.c b/drivers/infiniband/hw/i40iw/i40iw_cm.c index 4321b9e3dbb4b..0273d0404e740 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_cm.c +++ b/drivers/infiniband/hw/i40iw/i40iw_cm.c @@ -2071,9 +2071,9 @@ static int i40iw_addr_resolve_neigh_ipv6(struct i40iw_device *iwdev, dst = i40iw_get_dst_ipv6(&src_addr, &dst_addr); if (!dst || dst->error) { if (dst) { - dst_release(dst); i40iw_pr_err("ip6_route_output returned dst->error = %d\n", dst->error); + dst_release(dst); } return rc; }