Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4610239pxj; Wed, 12 May 2021 09:11:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUcec+cKU03Ud/9X8Ql2wpLdTgaZqRTKrKiStfFrY5syYZ4Q3cjuRVXtYV8i+XMwgxZUb4 X-Received: by 2002:a17:906:8307:: with SMTP id j7mr37312739ejx.420.1620835902310; Wed, 12 May 2021 09:11:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620835902; cv=none; d=google.com; s=arc-20160816; b=MO2e9J5lw0GCiKDC/aQXEqqL0w+yCpkHT6OLXf+m/CzsQ1GfuicsQYN2MCAlCg4E9r 5pdf8+1eZNzDFRyktXXh56bMM2vaSFfqHfOQsx0yuA8gudYzp2oREWI53QjqRHI7brp+ I3uFt6i8ZAu66+oZY1KDMOWNNm0MnOvc3Onu+Uk6/FcwVIHjqgGer+exRj/djMd0t2aC SX00bvgMTz1O4NkKcpY/9Uk937uqY/xZeO3KNi8yX+03qTn+J8BNJwhHA2Ps30zv4qkA dYft4i0dq09mSJiguWOE6akqIQ0q2BNRQcjpiDulKe+HQxFeOVxvCLqwLN6co9vCwMNz BtFA== 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=sJ/1u6LsMskmurZ1Bc1svaWlcpjeT9dXMU0mlwpZ4qI=; b=Z0CDiieqGXAXBzOcM5u05CypTBC/eVwbneB22ZOfksCL/DOZ2yEV4IZITNbvhbUf0l Q/NfcDU7Q/RnfyoEvzh0XU9p6acxL0QrVmUNI38gIKCsvJplU4lsk7ROvkps7HxeQvY8 SuJBaHdqwbBH6s1jeUXxUP4P2/VeqtDSZaIObZ1RwMOAXdSQM2s8ONGkJttG/GdtDMpF W3REqIhMSWA8GsVQXdaSoR2g+uRQk7RBIE1MKj85I08IY2hXdihUcRep1ZrsVHbCkXcS mAkPMt5hDcDJbWChMgQ+SRhm1N3QCjo+cvuVDQfVDl+UMfvAp/p/KhWAM25HzZTiDAo3 YEhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=euWsAl3T; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id um1si195302ejb.327.2021.05.12.09.11.17; Wed, 12 May 2021 09:11:42 -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=@linuxfoundation.org header.s=korg header.b=euWsAl3T; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239424AbhELQIB (ORCPT + 99 others); Wed, 12 May 2021 12:08:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:40742 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235688AbhELP2q (ORCPT ); Wed, 12 May 2021 11:28:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 76AAC61C30; Wed, 12 May 2021 15:14:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832479; bh=C1W3s0GCChNHbOLaOlh5T65OaBnmMHYZTBO7zgcdXTE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=euWsAl3T8Y78ZrW8kwa55MVlS6ZL4ko6c+kU0M2VrwTQ+cAHB5aAPwdr8HuhZ91ZW CbD3s+OnVG1PTj/PoY5MNH4POWrs4KjgpR+KmIdTPZnmHwPlurn2+pxZ6bfCljYDiP knE5lDhSdXJH1tDtlQIvSZqym3s0tVBnycC02Ezc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Andrea Parri , Wei Liu , Sasha Levin Subject: [PATCH 5.10 261/530] Drivers: hv: vmbus: Use after free in __vmbus_open() Date: Wed, 12 May 2021 16:46:11 +0200 Message-Id: <20210512144828.408935096@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@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: Dan Carpenter [ Upstream commit 3e9bf43f7f7a46f21ec071cb47be92d0874c48da ] The "open_info" variable is added to the &vmbus_connection.chn_msg_list, but the error handling frees "open_info" without removing it from the list. This will result in a use after free. First remove it from the list, and then free it. Fixes: 6f3d791f3006 ("Drivers: hv: vmbus: Fix rescind handling issues") Signed-off-by: Dan Carpenter Reviewed-by: Andrea Parri Link: https://lore.kernel.org/r/YHV3XLCot6xBS44r@mwanda Signed-off-by: Wei Liu Signed-off-by: Sasha Levin --- drivers/hv/channel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index fbdda9938039..f064fa6ef181 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c @@ -583,7 +583,7 @@ static int __vmbus_open(struct vmbus_channel *newchannel, if (newchannel->rescind) { err = -ENODEV; - goto error_free_info; + goto error_clean_msglist; } err = vmbus_post_msg(open_msg, -- 2.30.2