Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3743359pxk; Tue, 29 Sep 2020 05:18:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3Wmx1IdFHvk8zDENKBM3OaJF3naaXw31idvbIlic5i4JZtVWisjr6VKPwmI2OXPtxyifP X-Received: by 2002:aa7:cc8d:: with SMTP id p13mr3073385edt.136.1601381918265; Tue, 29 Sep 2020 05:18:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601381918; cv=none; d=google.com; s=arc-20160816; b=kHPmrl5kLF6kOQzHpy9Wh155oFSURiOV+NkXCk768ZZoWb1Woy8k+8JLe3FS0OC9kN VsM34vX+9NvqRw+i8pbxong6IyDkdihUi1G2Elo68/pV2NVHMY7DBVorEVU29fcfJD5r DHcdnsaf+J6k91unC6tkFGU0zntwHBLSyIplB2+KKgxoksyP8k5Y6UHUsu2Gv+8MgIiV xtSTuDumB0TjYlq9T7fIiswL/9rY7foKYv4YDkkmOSntWU2d0anugYfd8wH94u31v0Ae ujh+lAxW+ld6/glCyzhioKU6Oq1amESCcvROD6c+gFkk7S5vs5BHvCYhOFvFf3ZCMwrw 8lPQ== 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=WJlUXAUDPI9dl7g/cuhNvakK+TGi31pVuVO5zS78NZ8=; b=Ktawea+ZkHIP91Zzp9pIChF7Rvrw5OHvjVFxWr9Ks+gMXvt4Fc7rWkoeOnT6Wkig6R qW+00gPHZ8pcCabyHH9AkjTDmdM4Je2FK8QWltDXNJDuPifLWokx82mEitow6D1WcTml ktlmKrvlp+ETRSu9QNbwH7/CFlkpSobsp9ZxbqmM/JQtXjiyXGql9Y6Z0T23o9ZfAas0 q+Qn/kZIokXO6wlYI79RikdLxYTsn7B/jhMx7SO5FsTkg+hWiftm77bFpzUrFaW5vSQk wKNmM8xwb/EMUWzCSmVv1oBrAC3+PH0zUmhg7FiP+g5VtdCMKRRHRC33d9REyH5IrG7q fvXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GeDib49Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n18si2741210edt.207.2020.09.29.05.18.14; Tue, 29 Sep 2020 05:18:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GeDib49Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728319AbgI2MQw (ORCPT + 99 others); Tue, 29 Sep 2020 08:16:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:50296 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730051AbgI2LhA (ORCPT ); Tue, 29 Sep 2020 07:37:00 -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 88CAC23ED2; Tue, 29 Sep 2020 11:32:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601379174; bh=IG69orGZizecW30f5Fn2mdLJYq0+6DQXjUuszz2XqGg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GeDib49Q1GljPSbRyaIiTy3EGODc4Co2rkeenqTuLnDkxwAyy+D2dNW0hQSbxyaWJ jilEB1feHG9ibW40+Os+sWxC/VgMEYUdJsVrCbcXthVGZQRmvxiJdG3ONqhT1YkfES AIVs6JJCreVwzOKkvDBpcbNtXbrJa9HA4VSWOB1o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pan Bian , =?UTF-8?q?Michal=20Kalderon=C2=A0?= , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.4 045/388] RDMA/qedr: Fix potential use after free Date: Tue, 29 Sep 2020 12:56:16 +0200 Message-Id: <20200929110012.669519663@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929110010.467764689@linuxfoundation.org> References: <20200929110010.467764689@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: Pan Bian [ Upstream commit 960657b732e1ce21b07be5ab48a7ad3913d72ba4 ] Move the release operation after error log to avoid possible use after free. Link: https://lore.kernel.org/r/1573021434-18768-1-git-send-email-bianpan2016@163.com Signed-off-by: Pan Bian Acked-by: Michal KalderonĀ  Reviewed-by: Jason Gunthorpe Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/hw/qedr/qedr_iw_cm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/qedr/qedr_iw_cm.c b/drivers/infiniband/hw/qedr/qedr_iw_cm.c index a7a926b7b5628..6dea49e11f5f0 100644 --- a/drivers/infiniband/hw/qedr/qedr_iw_cm.c +++ b/drivers/infiniband/hw/qedr/qedr_iw_cm.c @@ -490,10 +490,10 @@ qedr_addr6_resolve(struct qedr_dev *dev, if ((!dst) || dst->error) { if (dst) { - dst_release(dst); DP_ERR(dev, "ip6_route_output returned dst->error = %d\n", dst->error); + dst_release(dst); } return -EINVAL; } -- 2.25.1