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 X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9746C433E0 for ; Mon, 10 Aug 2020 16:38:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 85B052076B for ; Mon, 10 Aug 2020 16:38:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727794AbgHJQiz (ORCPT ); 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--