Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp4465433pxa; Mon, 10 Aug 2020 09:39:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6XvENA5WMai5eu4/MTJo+rYsL4ZYruSt5msQEOAHoqP2g4gd7xf2PgX8zjTqY8FCVHs29 X-Received: by 2002:a17:906:f9d7:: with SMTP id lj23mr23777441ejb.500.1597077598206; Mon, 10 Aug 2020 09:39:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597077598; cv=none; d=google.com; s=arc-20160816; b=NSg4PJj+s1P7n3hIn2/B1UqUTvT41NTUYZtRfwq0wOZuwAOsTMte2gh3ihDoCCE2GB YLhAmvXHYIY/jNdu9rxnoEmfx1E2CRPJle01zazqQmBi9noV/9c10PCRqOe/DStvftdV JCYxv9zdguXlaep+Fl1ip6qq32zY5em/c2LvicMVz5yy3iXhekvH5R6sCCP3/iMI/4/z lHZ3wnCWZuREZG+Md0OAUakNlDG34jm/nHd1C/oljS9XFLPDaf0W35g3GOIEirxA7lQ8 oPBsIGemlqx7doVitcfqjoT9dUg01oylOcSDaYxUB0NRWF4ZqEEacILI0NNkYKrba5L6 3bXA== 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=788I2hqQYG6J6Nc6icV5DUde9kvhAXolGpv+nLsEIlQ=; b=JmuDR24ak7giJV0spAJDgmKDFGCvXIbheq57qkAxrU01PhZZ5a8FKznuA3yty6XB24 jCHU9fudAArmGoOS7By+cOHd0Y0QSuOWGK8kh3J6AySCOsRgDWKvTAd2OmvjVIqGHMf3 o1gy1I/dnCt/XRzBqso9Q7sNIy/4vNsLWoHwPbocTeBuKBD6MCQ4R5ASGIupoG110Di3 +SKTJicTkl8yaUjxgLZ7ErkMC/beebL9vZCM7w2KHHW8qt27z2tHKTZRBvN0TEPAUSt7 Q9dWYjTNxGBAbDoO5WVPQTPx/qWSJMnlB85KkO9yfG2zlnvukAh11/WDC3gyfnbw6pv4 eqmA== 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 w13si10301831ejk.175.2020.08.10.09.39.35; Mon, 10 Aug 2020 09:39:58 -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 S1727053AbgHJQiz (ORCPT + 99 others); Mon, 10 Aug 2020 12:38:55 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:47544 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725873AbgHJQiz (ORCPT ); Mon, 10 Aug 2020 12:38:55 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 6A29D1C0BD6; Mon, 10 Aug 2020 18:38:52 +0200 (CEST) Date: Mon, 10 Aug 2020 18:38:51 +0200 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , stable Subject: Re: [PATCH 4.19 14/48] mtd: properly check all write ioctls for permissions Message-ID: <20200810163851.GB24408@amd> References: <20200810151804.199494191@linuxfoundation.org> <20200810151804.911709325@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cmJC7u66zC7hs+87" Content-Disposition: inline In-Reply-To: <20200810151804.911709325@linuxfoundation.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 --cmJC7u66zC7hs+87 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > From: Greg Kroah-Hartman >=20 > commit f7e6b19bc76471ba03725fe58e0c218a3d6266c3 upstream. >=20 > When doing a "write" ioctl call, properly check that we have permissions > to do so before copying anything from userspace or anything else so we > can "fail fast". This includes also covering the MEMWRITE ioctl which > previously missed checking for this. > + /* "safe" commands */ > + case MEMGETREGIONCOUNT: I wonder if MEMSETBADBLOCK, MEMLOCK/MEMUNLOCK, BLKPG, OTPLOCK and MTDFILEMODE should be in the list of "safe" commands? Sounds like they can do at least as much damage as average MEMWRITE... Best regards, Pavel --=20 DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany --cmJC7u66zC7hs+87 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl8xeBsACgkQMOfwapXb+vJbGACePOFn4WrVSn4NiT5nFyGDhvHL SBsAoLYnI0NTUWIrbjb1V+LMMOLvPDJr =asrN -----END PGP SIGNATURE----- --cmJC7u66zC7hs+87--