Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5075194pxb; Mon, 15 Feb 2021 08:52:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJwwZpN/ZEiCIrqKh6JxgOYjLDI4t7vNUXmtx1jX+MasN0ZEikET+6JUsnKRQrh55rIITTks X-Received: by 2002:a17:906:aad4:: with SMTP id kt20mr5335530ejb.200.1613407924338; Mon, 15 Feb 2021 08:52:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613407924; cv=none; d=google.com; s=arc-20160816; b=ha3UWoVYgf1m14YhBVEmUSQuEHIDbXqC+JMPf8UAvJqI4PLjJ7Y9/ZFhUyVLc+0iE6 BixUNmhbuzSJp2dMd1hgXy40CiwF+tsTF6AsUyKtmqpGmWDa4H9Qx0RhHG78hQoaRSrM ozqN9z7w4Slj0ggmQgvziTO356fzecQcB0dKEKkFkSJNcPwssfcOrIRU2/XSMH9jSmyG qFwE1FuC60xn14itOb09YipXYt5w9Pf5oe0ajg8wm+2poKdP8FBA9wLsBltKlNSam3/v yaZrct2LobdCmU83gJst0nRxojS7XU4HAd/5cIz8gEozpuhABk+EaFO01feuCDc14Lnv ixTw== 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=LLCt2Q4B4lpQs6cGHPPr56IDaT54Bz25njZyDoljpr4=; b=VPFSh4OyivPMs4dM/F3EEvNTD3DJEep7le+xho2GZ0XuO7u+hcKBx79uqIKvyVL5co BxnwwQb40HyrKXWlc0wxtuX5diJ3fqtGjEeVzDl8H6pQfOO1PvV+PWWI7mISQ8uT5Kvi PHnAjErKejoUznYyt/qNce2vSQpe+1Yh7SS772mzilOP0sHYbIqrhwNxIuoYcPuYEUGs c9pArlsQLcqIK5eha49be+GOZsb3B4a5BgYFo0rmo0kCsAsrVm/JF/4GC1foq/jF7yPV QclWZb6c4TZG/9fho9vvROPzc1LdQkLUJkKxICLmc7zg5dIBGUS1iAnIgFGm9yBDt1qO 9GPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GPF3qkRA; 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 a25si1955494edt.342.2021.02.15.08.51.41; Mon, 15 Feb 2021 08:52:04 -0800 (PST) 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=GPF3qkRA; 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 S229944AbhBOQsK (ORCPT + 99 others); Mon, 15 Feb 2021 11:48:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:50308 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230381AbhBOPiO (ORCPT ); Mon, 15 Feb 2021 10:38:14 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id F21A464EF8; Mon, 15 Feb 2021 15:34:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1613403273; bh=8yzTv+kmNL+oFvIi5QPN6VNeXCm398HTDlgtF/bf5rg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GPF3qkRAwM4nMFGVKQDaxdKOl4dWgUD0JioyLZ2duafepwQLy3emQ8PdLWxKR3goi z6AQCCKQyJW00oApnOm9LDZDDeVympqCpqMQLI8BGiw+npgp+G5Y+/d3P6NlWrl3KM nq9RfLj8DwUNNB52OTxE5NIETi+Dje2zOIgSZ8MY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Norbert Slusarek , Stefano Garzarella , Jakub Kicinski Subject: [PATCH 5.10 094/104] net/vmw_vsock: fix NULL pointer dereference Date: Mon, 15 Feb 2021 16:27:47 +0100 Message-Id: <20210215152722.496048614@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210215152719.459796636@linuxfoundation.org> References: <20210215152719.459796636@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: Norbert Slusarek commit 5d1cbcc990f18edaddddef26677073c4e6fad7b7 upstream. In vsock_stream_connect(), a thread will enter schedule_timeout(). While being scheduled out, another thread can enter vsock_stream_connect() as well and set vsk->transport to NULL. In case a signal was sent, the first thread can leave schedule_timeout() and vsock_transport_cancel_pkt() will be called right after. Inside vsock_transport_cancel_pkt(), a null dereference will happen on transport->cancel_pkt. Fixes: c0cfa2d8a788 ("vsock: add multi-transports support") Signed-off-by: Norbert Slusarek Reviewed-by: Stefano Garzarella Link: https://lore.kernel.org/r/trinity-c2d6cede-bfb1-44e2-85af-1fbc7f541715-1612535117028@3c-app-gmx-bap12 Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/vmw_vsock/af_vsock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c @@ -1216,7 +1216,7 @@ static int vsock_transport_cancel_pkt(st { const struct vsock_transport *transport = vsk->transport; - if (!transport->cancel_pkt) + if (!transport || !transport->cancel_pkt) return -EOPNOTSUPP; return transport->cancel_pkt(vsk);