OSDN Git Service

mtd: properly check all write ioctls for permissions
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 Jul 2020 11:53:46 +0000 (13:53 +0200)
committerRichard Weinberger <richard@nod.at>
Fri, 24 Jul 2020 21:03:11 +0000 (23:03 +0200)
commitf7e6b19bc76471ba03725fe58e0c218a3d6266c3
tree7b99597d0d1f8e0a6eb9457076b2741a9f4fbbf1
parentd15be546031cf65a0fc34879beca02fd90fe7ac7
mtd: properly check all write ioctls for permissions

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.

Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: Vignesh Raghavendra <vigneshr@ti.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[rw: Fixed locking issue]
Signed-off-by: Richard Weinberger <richard@nod.at>
drivers/mtd/mtdchar.c