Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2411991pxb; Sun, 30 Jan 2022 15:41:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJxEJERffIs30KUt1NlPvjZiKxkhftYQTSjoEamI5si2a9G1FeHMfslDYfSnv7DMyOaJy4eM X-Received: by 2002:a05:6402:5215:: with SMTP id s21mr18174788edd.387.1643585997959; Sun, 30 Jan 2022 15:39:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643585997; cv=none; d=google.com; s=arc-20160816; b=C4TV6wmh1Zfg6QnBhpGBQvaqca22cwZLCzPl4fZHQL0NPDVu8xNgxZ2XOWS0DcG2hm IyeZr/pHSSLgYSykHLfNaoNSURVEKDHqBzP2DtKJ6y9yfapjYzidyKs9hAlK6L5d7u+x K0FUIvFz1QbpEfK7Ddwdf6b+4nJ38MqZCWJpR88bGyVavs9Dz5N/nRE38eEpH1rdx6Jy 5ym8aFADyZZNkmW/zy2FhtccgbghKIbK9EjjJ1apPI5/3coBJsvvy607XnDSb9coTGNB 9uVizFG+1DaBVh73mLvqymkMvK3pfTjrrXLcJW5sqULKrlv1PrNFfUDoAjF1ZHZaObkB /zpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=2OZmhASreW81QrA+oA7iz2hTbVpl+hgaO3fpu2pzyEo=; b=mdgRXKhaDZ3TG/jakZ16BdATPptnVQX++9zllTN1kfDLlx6f0M2BOKhUR/oF9Y0uFE 6oshhZJeTvfXfTL7NfTV1AW1/MeExzHDB9Wl7vB+LwJwqcForrk526A/XrlL9Tmmt72y VJk8kznsZyoBngtyt4CQclaqbb4/GcgZEFY2ebKNfpGpg2A8/y9v2KkuO7Niv1dfD8xV 60s0NEiAjcfE72/xHlqj4rC7XBqDUmJEqig7RGIF2bo+CeOv5FXD2+8raSICgNeG1JUx WowlgUXSFlHfSTA1XKfub8UM/J26GGSPgfzxwHwYdg945dBpGvF5Xz9WHYyPQcX6VzTu foUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A9rGfzrw; 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 f30si6616539ejl.531.2022.01.30.15.39.23; Sun, 30 Jan 2022 15:39:57 -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=A9rGfzrw; 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 S1344358AbiA1KRx (ORCPT + 99 others); Fri, 28 Jan 2022 05:17:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347813AbiA1KRn (ORCPT ); Fri, 28 Jan 2022 05:17:43 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C162C06175C; Fri, 28 Jan 2022 02:17:43 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1AE1261E45; Fri, 28 Jan 2022 10:17:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7FE2C340E0; Fri, 28 Jan 2022 10:17:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643365062; bh=55Yrs/fyGEbyWpCkjmNkgtBfGfMz8DsMaElA9YrhRoM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=A9rGfzrwztkrVnLvQ5llmUSVejcD4H7+DZNjbtlQ+vDdqG9GiCFMUAIcbSVT+4LOt Rj7Gc0KfNMgoIgXHF0mGzbfNJRV0C1u2lnXzeugSzGUXEIRNPXXOXTJR46ZMjPJ4cd y2eHc8d7Y9VhIGiwM5ZoJKu8XhcbxnnEr+fCIMag= Date: Fri, 28 Jan 2022 11:17:36 +0100 From: Greg KH To: Zhou Qingyang Cc: kjlu@umn.edu, Mauro Carvalho Chehab , Zhen Lei , Laurent Pinchart , Arnd Bergmann , Robert Fitzsimons , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] media: bttv: Fix a NULL pointer dereference in bttv_overlay() Message-ID: References: <20220124172626.64077-1-zhou1615@umn.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220124172626.64077-1-zhou1615@umn.edu> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 25, 2022 at 01:26:24AM +0800, Zhou Qingyang wrote: > In bttv_overlay(), the return value of videobuf_sg_alloc() is assigned > to variable new and there is a dereference of it after that. the return > value of videobuf_sg_alloc() could be NULL on failure of allocation, > which could lead to a NULL pointer dereference. > > Fix this bug by adding a NULL check of new. > > This bug was found by a static analyzer. > > Builds with 'make allyesconfig' show no new warnings, > and our static analyzer no longer warns about this code. > > Fixes: 7c018804c090 ("V4L/DVB (7197): bttv: Fix overlay divide error") > Signed-off-by: Zhou Qingyang > --- > The analysis employs differential checking to identify inconsistent > security operations (e.g., checks or kfrees) between two code paths > and confirms that the inconsistent operations are not recovered in the > current function or the callers, so they constitute bugs. > > Note that, as a bug found by static analysis, it can be a false > positive or hard to trigger. Multiple researchers have cross-reviewed > the bug. > > drivers/media/pci/bt8xx/bttv-driver.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c > index 6338f98d845d..5aa46593ddc6 100644 > --- a/drivers/media/pci/bt8xx/bttv-driver.c > +++ b/drivers/media/pci/bt8xx/bttv-driver.c > @@ -2552,6 +2552,8 @@ static int bttv_overlay(struct file *file, void *f, unsigned int on) > if (on) { > fh->ov.tvnorm = btv->tvnorm; > new = videobuf_sg_alloc(sizeof(*new)); > + if (!new) > + return -ENOMEM; > new->crop = btv->crop[!!fh->do_crop].rect; > bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); > } else { > -- > 2.25.1 > As stated before, umn.edu is still not allowed to contribute to the Linux kernel. Please work with your administration to resolve this issue.