From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BA0CBC433F5 for ; Tue, 14 Dec 2021 14:19:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=L56Nj26y9UuzVjCIOA28Jv5s391nEzBtsTXUgajCPCQ=; b=gUi5SV85QpwRPp UHRJeZZcrwQ33Og58uoxrW4emFwXy2KNZU0jqGG8TNUZcvkKPTi5lqnObrPZyn8FmJXH4cn1Mfbj2 T6ugXYMVDmmmSh+0EWccy2o5YJghjqUPH5v2owsbTP5bxbIW1318H+2PYO/vDM7g1edYiVtFU57GU GabthIJz7J8LjpX4EYwnMy7CjxVEwPuE0UYWQhmRZ3cpHdsHLCAQPFshF5CcAQPVnKNZc3m7mSXcS ZtAgB9YWF2FaqsYKyEw3p9Hxt+lEVNsRCxL/1H2d73bwu2PPffHy/r5fL+0/BOX6WHlriffrp5U+9 AwQf8qGK53nk7s5A9SAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mx8d3-00EL5B-PC; Tue, 14 Dec 2021 14:18:05 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mx8bk-00EKWC-Cn; Tue, 14 Dec 2021 14:16:46 +0000 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 ams.source.kernel.org (Postfix) with ESMTPS id 4A9B7B819D2; Tue, 14 Dec 2021 14:16:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67C28C34601; Tue, 14 Dec 2021 14:16:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1639491401; bh=eG4XEiffsdd9Bx5G2ry7thk1JeTMHFrMPaP5u8+EqRA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fQTCcOgPw6gH/kBZwktjgf09OpSiut+qSjaBqz2WUMy2okynRswPgHAKGjbKvF+iI FtX82dnym5G3ql/JfVKm6uL7qWTRR5vSxFbFEjKsFBjvhIRfDGGnZINeW/FlRpqSUf vlBx7ymrw6Ezr0L344OT1ggmBFPtihLJpYNj+X8U= Date: Tue, 14 Dec 2021 15:16:38 +0100 From: Greg Kroah-Hartman To: Mauro Carvalho Chehab Cc: Zhou Qingyang , kjlu@umn.edu, Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Hans Verkuil , Maxime Jourdan , linux-media@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] media: meson: vdec: Fix a NULL pointer dereference in amvdec_add_ts() Message-ID: References: <20211201084108.GE9522@kadam> <20211202160357.75173-1-zhou1615@umn.edu> <20211214144613.35fec82a@coco.lan> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211214144613.35fec82a@coco.lan> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211214_061644_655665_2EC67EB4 X-CRM114-Status: GOOD ( 31.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Dec 14, 2021 at 02:46:13PM +0100, Mauro Carvalho Chehab wrote: > Em Fri, 3 Dec 2021 00:03:57 +0800 > Zhou Qingyang escreveu: > > > In amvdec_add_ts(), there is a dereference of kzalloc(), which could lead > > to a NULL pointer dereference on failure of kzalloc(). > > > > I fix this bug by adding a NULL check of new_ts. > > > > This bug was found by a static analyzer. 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. > > > > Builds with CONFIG_VIDEO_MESON_VDEC=m show no new warnings, > > and our static analyzer no longer warns about this code. > > > > Fixes: 876f123b8956 ("media: meson: vdec: bring up to compliance") > > Signed-off-by: Zhou Qingyang > > --- > > Changes in v2: > > - Delete dev_err() message > > > > drivers/staging/media/meson/vdec/vdec_helpers.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.c b/drivers/staging/media/meson/vdec/vdec_helpers.c > > index b9125c295d1d..ac60514c475b 100644 > > --- a/drivers/staging/media/meson/vdec/vdec_helpers.c > > +++ b/drivers/staging/media/meson/vdec/vdec_helpers.c > > @@ -234,6 +234,9 @@ void amvdec_add_ts(struct amvdec_session *sess, u64 ts, > > unsigned long flags; > > > > new_ts = kzalloc(sizeof(*new_ts), GFP_KERNEL); > > + if (!new_ts) > > + return; > > + > > new_ts->ts = ts; > > new_ts->tc = tc; > > new_ts->offset = offset; > > I don't think this change is ok. Sure, it needs to check if > kzalloc() fails, but it should return -ENOMEM and the caller > should check if it returns an error. So, I would expect > that this patch would also touch the caller function at > drivers/staging/media/meson/vdec/esparser.c. This is why umn.edu emails still are in my black-hole :( _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel