Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp215466ybx; Tue, 5 Nov 2019 22:40:57 -0800 (PST) X-Google-Smtp-Source: APXvYqxhe/tiVgQUpYLBv+i+i3cDw+f1Nj8aL0A/+m99+fhPe/ddqwcm2HB/lrCP1hIyrsn1LOW3 X-Received: by 2002:aa7:df87:: with SMTP id b7mr893099edy.296.1573022457649; Tue, 05 Nov 2019 22:40:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573022457; cv=none; d=google.com; s=arc-20160816; b=ebwjrbJe4q94GYO1UW/1JDN9k+BxSLJf37VuEMGXBqaebs9amQfbTHJ6PGvzcem28N 8AK3XGNW/4KsJcAINf4PRJ6nMu6YegfMOm1ShpJEHAuvcOD2rl3BtDigGOuFS5rXhASo 0+yl1f3j6nbAYC5mGnfNeAreTibLFSuGk5yEgRHVe5wXHwX6DjIydJLPHAXzMnHxvRYL B+26FI/ApPPT6+cFkSs6BUP/pUNcZ9E2Im6E7t6dwPaFzmqx8YmSdSdt6RudYJhxD4/R U0+Q5n0KU7kp/mShYvh1W28GcvA3/KIMjW9BBxRWFLEilT8L+gfscto8fqSXRH5J568E mQeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=ZW7ADXOpY7jtfDW7OGJksEYT6Hht/9ZWqeFWJehNnHY=; b=LSbeXIXc/A0Pbfhn6GV/2l9JhjqIojvw1MQnFkvq44v7CGmU75bNhsOBU7jAbKsAgb IQQcf6KQk+RVVViZDH/+cnUqFSt2obKuR0biqKfleExzBPb4Naw7cyaBrecqQWr7qrX1 i1EZFQLGD8bRXVSRoNXuWE2jsDVI+p2MQa5tpL5oqQ8CsTtUACWX6U5yj6pZP+3RxuX7 XwKmHShQNZbn2I/ffTQUAUxy8Gnzbd5N4kL/Wm1lfKFSk1B3MJ8SFfiMcis5c/ahp3w5 KFg+W1bfQB/VQ6lXCTrdcPFEaYFUxZlCH/CBVz1NbPDpm6FDLqkEWl9gJaF+e4nSCcSh 0QvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=faHvyNdh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d15si15600653ejw.269.2019.11.05.22.40.33; Tue, 05 Nov 2019 22:40:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=faHvyNdh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729935AbfKFGjk (ORCPT + 99 others); Wed, 6 Nov 2019 01:39:40 -0500 Received: from mail-m973.mail.163.com ([123.126.97.3]:41070 "EHLO mail-m973.mail.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729470AbfKFGjk (ORCPT ); Wed, 6 Nov 2019 01:39:40 -0500 X-Greylist: delayed 907 seconds by postgrey-1.27 at vger.kernel.org; Wed, 06 Nov 2019 01:39:39 EST DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=ZW7ADXOpY7jtfDW7OG JksEYT6Hht/9ZWqeFWJehNnHY=; b=faHvyNdhd7HbjtZqDveFTPKZ6/7nMDwot0 h+rK3VdRd0Nctm7wLwWcCulsbK3FOo/YRIMw2+0E+r1ZfhS63ps9uC3HZHchprB3 792N0sCnIwhccWH0zZ1o6PZa7ivrhAFpYb0SoMrxUEOhBuc9erjxA4iyuAADB0cZ hZ5f9TeCw= Received: from localhost.localdomain (unknown [202.112.113.212]) by smtp3 (Coremail) with SMTP id G9xpCgAXbAsCZ8JdsYANHw--.188S3; Wed, 06 Nov 2019 14:24:24 +0800 (CST) From: Pan Bian To: Michal Kalderon , Ariel Elior , Doug Ledford , Jason Gunthorpe Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Pan Bian Subject: [PATCH] RDMA/qedr: fix potential use after free Date: Wed, 6 Nov 2019 14:23:54 +0800 Message-Id: <1573021434-18768-1-git-send-email-bianpan2016@163.com> X-Mailer: git-send-email 2.7.4 X-CM-TRANSID: G9xpCgAXbAsCZ8JdsYANHw--.188S3 X-Coremail-Antispam: 1Uf129KBjvdXoWrZFyfJrW5ur1ktw1rAw13urg_yoW3Gwb_Ca yq9w1xXw1UCF1Fk34UWr13ZFWIqayq9wn5Xwnxt3W3CryYyF9xJ3s5Zrn5u397J34kGFZx Jr4UK3s7Ar4rGjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU14xRPUUUUU== X-Originating-IP: [202.112.113.212] X-CM-SenderInfo: held01tdqsiiqw6rljoofrz/1tbiQBhlclSIdH7ERgAAsb Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move the release operation after error log to avoid possible use after free. Signed-off-by: Pan Bian --- 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 22881d4442b9..eedc32b72ff2 100644 --- a/drivers/infiniband/hw/qedr/qedr_iw_cm.c +++ b/drivers/infiniband/hw/qedr/qedr_iw_cm.c @@ -451,10 +451,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.7.4