Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp883145pxk; Thu, 17 Sep 2020 20:16:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmQAtXa/AlH84VdRBCY+XgWFkaszSWrsarDTiF0lievTqGr0hzstUS171wLeZIlAExfpAA X-Received: by 2002:a50:fc91:: with SMTP id f17mr37769433edq.319.1600398964405; Thu, 17 Sep 2020 20:16:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600398964; cv=none; d=google.com; s=arc-20160816; b=WY2H5A6UJxjY4W6k3/Ode8Tb0sucesiPzjLURoqWFZWTxDBuLiN6QCXI1K9rLH6ZaC R14o5EkWQo611hDsAF0Lwcf/cnoy0hn4R3u4be2/Sg9lRvaZMapspKBnXuEwrKc7nQgT zeTa1liGWlrhxS7MXkvIBHI+3XtmAEvyg5E0dAAovovOBI8jI4IQr5rwbl+P15jyI2Fs roOgsbEXmCN4EKGD90DLgQjgoq6JVTqdHhbYygNHBb6nu78epxA3lITag+LNLDrKZpvS bGi/cGJ/nEREzyrSEV8FVbjJ9AIzuOc7e87mVohz/u9hCuMB8GsO9fnMw6WFaZjoZTh1 FKgQ== 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=Nu+nVGtLazc7I8KIE2/8lAPgjqT4vU4E4D1oi0Casbk=; b=wEtAqTD9ScOPseq0yigNGMVcmT5thBJhvee8UeBAdK5BQ5nCK5uFDoH+MVIC2mCqj7 bG1XbgBU2i/3u1Qcifyob3MbJhM92h9TfPVnVVVxdutdrg1Vm0/j2c5tHT+ZGxHgfzP8 f6TiPeEJHnE9/bhuGBCuL8vcbINnmFLjiJCZSv0HaQt8ufBaKHnUAxWIJa4KtmPz+22N iOaPaC5LVuIqVzKejCqyhJB14j66ouuZFJJs0JHGkVAqRE8ahWhbnZzos5282cA1dDON pPyFnvcv8+D/i/eALw0e/+g6lb8wc1v/xBSmc7XjYTYnAhDlx90yx58uuaOplJC2m2cr 8tGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NXt9D1Bc; 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 oo24si1222157ejb.136.2020.09.17.20.15.41; Thu, 17 Sep 2020 20:16:04 -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=NXt9D1Bc; 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 S1730562AbgIRDMT (ORCPT + 99 others); Thu, 17 Sep 2020 23:12:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:47126 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726617AbgIRCCK (ORCPT ); Thu, 17 Sep 2020 22:02:10 -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 2B53F2311B; Fri, 18 Sep 2020 02:02:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394529; bh=4UkWMQ5lkT97tKJhnYAj2X2rEuvziKSV5SVl6Ys3b9M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NXt9D1BcKODDPERxjf0datc1N7yczDhbg0szgjKuDZ9SM6yROZPcHyrHT5+r5SThi AdiIl87YwBuvR5ouPTQxg9nZNQNBnw7R2viDX29Lfnkzw5JeLzxYMxNUAapaxOd+Hq +uzCdFGjimqC4O0cQkX6RsXeTM+4d2GiWnpkk89Q= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Pan Bian , Jason Gunthorpe , Sasha Levin , linux-rdma@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 049/330] RDMA/i40iw: Fix potential use after free Date: Thu, 17 Sep 2020 21:56:29 -0400 Message-Id: <20200918020110.2063155-49-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 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 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 b1df93b69df44..fa7a5ff498c73 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_cm.c +++ b/drivers/infiniband/hw/i40iw/i40iw_cm.c @@ -2074,9 +2074,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; } -- 2.25.1