Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp883261pxk; Thu, 17 Sep 2020 20:16:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcZiWS0CDddC4lttBHuoNuD8pzo1O70uWY0jWoev9fNeBAQB0S0k6YCxswy0kGzG5jHRNQ X-Received: by 2002:aa7:dc16:: with SMTP id b22mr35932349edu.252.1600398975547; Thu, 17 Sep 2020 20:16:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600398975; cv=none; d=google.com; s=arc-20160816; b=zN93l2Es2Gx8RQ2iYgm2uSDAxI9oBuaXheTc/Jwpk+S6fTr/bJ0eGaYOD/rKZXJ72H wJCQ7cYEKA0tOlZF6VQ2+0Z4mH7t73BTOdcKyR0NvoNIoJ1Oxpe2an30hjJGBj5xNfI4 BO0d55n0WPPSU3vF+/+IAJryUGFeFeKxw7onbabgWVSGcP4mvm6f9E1cqHhU/T9T/WSY MLDdidGFIIaRIZhfm123dDo6g7Ivq1g+VmGVssYn77EjxjS31O/9IzkeQLWqD+ryTQDX AQnzcjpo4oQqNvGJcPz/uGGWCbfPsqv8ogmTIme6QwZ3MZhuxJsZqVEMuATgDJZfTEY1 3l5Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WJlUXAUDPI9dl7g/cuhNvakK+TGi31pVuVO5zS78NZ8=; b=cYur6YGQEaQQF8TLanXGnm3d28YWg9V0TnJTszljTATzADzRH2MduFnDowLenfUmt3 TYPuf96NjoC3SqHLODdtg6dYBTCsc7kHhFmO63qzwm8NaKgp8YE3xCyH3m2AfYA6U9v8 P9YAifRRaUPHChhd4BeT/71CBoR1PrZKpqbf07aEUgeWnwCOOErvW3PJbKJavL7LYHFO vB0/yIa4P/F4lmU7e4/stkSb1RnN6lMFejMYE1YR/CWnf4yD/yWuER7zXjNqzaMB4DrO NUkFXHkLMrCo3Lsok6NrDgFsqYrH8dNXyIpwYuX7EB5hhQjNRcX7tWwDIYG+TsInviYh 0AGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=R6BZVghQ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w4si1098628edi.512.2020.09.17.20.15.52; Thu, 17 Sep 2020 20:16:15 -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=R6BZVghQ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729007AbgIRDM3 (ORCPT + 99 others); Thu, 17 Sep 2020 23:12:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:47096 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726660AbgIRCCJ (ORCPT ); Thu, 17 Sep 2020 22:02:09 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 060E523119; Fri, 18 Sep 2020 02:02:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394528; bh=IG69orGZizecW30f5Fn2mdLJYq0+6DQXjUuszz2XqGg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R6BZVghQlTeGsAZS2PRT7TiwEgNtMv/ls4UKYMzsMR+RTyda1Y2I5UWkhzUxIYsrs 7dqD6Rb22xVIyJvyiOXqJJeTQrKuY0pfq6trUST7znIZp6L7NzoeyNt30XdPiSfeTL QqFUPiVq7iwmnKbwYz46eTcNKPC22HMT7cc8cRiY= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Pan Bian , =?UTF-8?q?Michal=20Kalderon=C2=A0?= , Jason Gunthorpe , Sasha Levin , linux-rdma@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 048/330] RDMA/qedr: Fix potential use after free Date: Thu, 17 Sep 2020 21:56:28 -0400 Message-Id: <20200918020110.2063155-48-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore 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