Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp163974pxk; Wed, 9 Sep 2020 01:56:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxG8VsnUMV2QFS2KPq1IoX3SpnCDCYSWdvA/mre3EvD1A3mrvZv5dhI7L2G7bZG5ywz8/lE X-Received: by 2002:aa7:d6ce:: with SMTP id x14mr3050220edr.359.1599641788996; Wed, 09 Sep 2020 01:56:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599641788; cv=none; d=google.com; s=arc-20160816; b=odlGcVMQEF9ESJ9dlumbHq9rW1pvlcmDeF/DBUN5LYyPfcJVmvMyNx276rcfOB+DQZ JGpiv+Y1T+f+zggjYhV639tWxMJ8ZEqWPuseY22ZT6Ej1O3zJXCoIYMZIxk0kTLX/RxU 5mrsklKL2whVJI8cQAviMeFpWPoo61ub1LC/frdBFETZo+FH6grqKBz+hH8ddQ+eJmC4 0YxRE3FhzlHVE7zyjN13SnCSfHhol9Vh9mu3dylFs4VfUZKvyvuKU7usjqaVmhlO2KAC PV/Rnx7gH85H1Jy3J5i6CR01AfR14weR0z8paw/eOOH+WPqirH4THnSqsUYtvXTMAiwG q/GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=wsreRxBx5Miw+3zkpMjneqvgio8A6Q24sUdZZzBHRjg=; b=bxBSvYtgAnrn40Rk+K+lMTHVpRXLFwsOL1e/dTWQjvNG/2Hss0Z+ayppuueIeifx6e 4Lvx2PJfa5HuhIc3T7nGKot3jzY+l4ch6WOiUW1zurP+5AQMY0gwGVBw8A1+iVTYHJ0Y HPjT4GDzp6PED88A0PCDAIJ0jrUaByTV93/Y2zVPQvmfpbdmx1a8vqbsX12siLhNdYW0 pC+6NWB5BhMT2C5hPpJhGOyZfBQ8/opJOZWfVS0uI/lC9qYQZwlzu4AGLSb1YI1PCnps siPLV8DyWoEzG/OBuMB0sK4c0mV/any4entNRP2CpvAsGn4TYT1nsMd86AkuUvqSLLsA kS1A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h9si1121692edv.170.2020.09.09.01.56.06; Wed, 09 Sep 2020 01:56:28 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726605AbgIIIzL (ORCPT + 99 others); Wed, 9 Sep 2020 04:55:11 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:49940 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728617AbgIIIzI (ORCPT ); Wed, 9 Sep 2020 04:55:08 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 7E65C1C0B8A; Wed, 9 Sep 2020 10:55:05 +0200 (CEST) Date: Wed, 9 Sep 2020 10:55:04 +0200 From: Pavel Machek To: Sean Young Cc: Jia-Ju Bai , mchehab@kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] media: pci: ttpci: av7110: avoid compiler optimization of reading data[0] in debiirq() Message-ID: <20200909085504.GC10891@amd> References: <20200830082042.17462-1-baijiaju@tsinghua.edu.cn> <20200830083036.GA17715@gofer.mess.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="hOcCNbCCxyk/YU74" Content-Disposition: inline In-Reply-To: <20200830083036.GA17715@gofer.mess.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --hOcCNbCCxyk/YU74 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun 2020-08-30 09:30:36, Sean Young wrote: > On Sun, Aug 30, 2020 at 04:20:42PM +0800, Jia-Ju Bai wrote: > > In debiirq(), data_0 stores the value of data[0], but it can be dropped > > by compiler optimization. Thus, data[0] is read through READ_ONCE(). > >=20 > > Fixes: 6499a0db9b0f ("media: pci: ttpci: av7110: fix possible buffer ov= erflow caused by bad DMA value in debiirq()") > > Reported-by: Pavel Machek >=20 > Pavel reported that your patch was garbage, if you are trying to defend > against a malicious pci device. READ_ONCE() will not help here. I would not use exactly those words, but agreed; we should have some explanation that it is feasible to protect against malicious av7110 device, first. Best regards, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --hOcCNbCCxyk/YU74 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl9YmGgACgkQMOfwapXb+vJcyACdHNjDsWpkdnGiw1AzX4GVKKMq 9doAn3RKQdPt0oR/tMJKZAqP5cVJgjI9 =xtrY -----END PGP SIGNATURE----- --hOcCNbCCxyk/YU74--