From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH net] vhost_net: validate sock before trying to put its fd Date: Sat, 23 Jun 2018 10:24:35 +0900 (KST) Message-ID: <20180623.102435.440104910657366197.davem@davemloft.net> References: <1529557891-4828-1-git-send-email-jasowang@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, mst@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, dan.carpenter@oracle.com To: jasowang@redhat.com Return-path: In-Reply-To: <1529557891-4828-1-git-send-email-jasowang@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org List-Id: netdev.vger.kernel.org From: Jason Wang Date: Thu, 21 Jun 2018 13:11:31 +0800 > Sock will be NULL if we pass -1 to vhost_net_set_backend(), but when > we meet errors during ubuf allocation, the code does not check for > NULL before calling sockfd_put(), this will lead NULL > dereferencing. Fixing by checking sock pointer before. > > Fixes: bab632d69ee4 ("vhost: vhost TX zero-copy support") > Reported-by: Dan Carpenter > Signed-off-by: Jason Wang Applied and queued up for -stable, thanks Jason.