Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp463539ybl; Tue, 28 Jan 2020 06:22:11 -0800 (PST) X-Google-Smtp-Source: APXvYqwOHilEOHdCK9SM9+0/q6eXgNz/Bk5jiU+6WcHMn+t3RufGki0Cpl6DOPr+sYVEjeiGjx2W X-Received: by 2002:a05:6830:12d5:: with SMTP id a21mr9936370otq.296.1580221331597; Tue, 28 Jan 2020 06:22:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580221331; cv=none; d=google.com; s=arc-20160816; b=TVA93DWsp8DB0s7hliJd8fTGgtjyoLhVLMqdasZKFA/y4u4guLcpS/ver5RRlw5qjY yEoTsoXWpnt/i+mzzFtZer9JKs73U20VzgphyG9FC5Q9xiOW67pbQd4KcjhUcp+SPwDR LbrfGORIJBvZhlKSU1y+z1NsawULCV7FN7wr8AbPcfHmn12tmBhezJltL1VVHy7vida9 v513+jzs31O3w84sYjbcrTCZxA88E5YxfWs+Ih2JVfasN/6DVZY1pNS1xd0hVLsex76c E6pPP5liuNwpuAyXX4Sru+Vz+aHijjuS6qX3fkBmOI44QyFs6el42YcGJDe9SJXSkXvI RZ0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hQqedgvsj+qvaZW11cyRcZWJVf3I+kj5t90/3pTCpSU=; b=HLaHW9e1O0uSktAk2VvGC8wIAunrqdHCMZ/t6GBrl3U9mwNt5DDaAkmbKF/Y+Xpfaw L4HAa48gMqVKzwf6xIdXnS8pxe707wCBVLRwfqJm0SRqXr15L53IfvIZL9BJomxv1jNS TI9p155YRUMxyhtALfzGyVGieb2zeohJ3Ql1clh1IEnehN9OFeZfGxRUpqZ0OIJfeQjE JGxBoKFGMZo6qbH1wWAndlJywsdS3BeMH0zwDVa4Z+o9JsLpVMKYocue0OvDi2pJd5vo jaZFk43bb0xTSblXtE4Prvu3xuJ/Eam1EgY5OpLxKH5sD4t01+08kNqfK2Zb2C4GVkHM nrzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HoZE+r8A; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v13si1652357otp.273.2020.01.28.06.22.00; Tue, 28 Jan 2020 06:22:11 -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=@kernel.org header.s=default header.b=HoZE+r8A; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731206AbgA1OVI (ORCPT + 99 others); Tue, 28 Jan 2020 09:21:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:46230 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728034AbgA1OVE (ORCPT ); Tue, 28 Jan 2020 09:21:04 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6A7B52071E; Tue, 28 Jan 2020 14:21:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580221263; bh=Dxw+0f89/DOVqp441cgRJbzq3Pg2nRwQeSh2x1Rm7CE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HoZE+r8AR4gryiHedbfq8Y9lk1Ef2om1HcXWS4KKXeZX8adP9ji3nqUbYJIBAKjGp AakkT/JlO15H/o9gvsF4hZ1v15ADFFPt49N/Rxij6NxuHNmECNQVXzbpugvswBWA+A ITuY0qBHJqxQ9Ne2u6UJ1K8hwG1R8Uaq3vAvsNlI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YueHaibing , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.9 108/271] media: tw5864: Fix possible NULL pointer dereference in tw5864_handle_frame Date: Tue, 28 Jan 2020 15:04:17 +0100 Message-Id: <20200128135900.618848609@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135852.449088278@linuxfoundation.org> References: <20200128135852.449088278@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: YueHaibing [ Upstream commit 2e7682ebfc750177a4944eeb56e97a3f05734528 ] 'vb' null check should be done before dereferencing it in tw5864_handle_frame, otherwise a NULL pointer dereference may occur. Fixes: 34d1324edd31 ("[media] pci: Add tw5864 driver") Signed-off-by: YueHaibing Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/pci/tw5864/tw5864-video.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/pci/tw5864/tw5864-video.c b/drivers/media/pci/tw5864/tw5864-video.c index 1ddf80f85c248..27ff6e0d98453 100644 --- a/drivers/media/pci/tw5864/tw5864-video.c +++ b/drivers/media/pci/tw5864/tw5864-video.c @@ -1386,13 +1386,13 @@ static void tw5864_handle_frame(struct tw5864_h264_frame *frame) input->vb = NULL; spin_unlock_irqrestore(&input->slock, flags); - v4l2_buf = to_vb2_v4l2_buffer(&vb->vb.vb2_buf); - if (!vb) { /* Gone because of disabling */ dev_dbg(&dev->pci->dev, "vb is empty, dropping frame\n"); return; } + v4l2_buf = to_vb2_v4l2_buffer(&vb->vb.vb2_buf); + /* * Check for space. * Mind the overhead of startcode emulation prevention. -- 2.20.1