[PATCH 4.9 059/212] mtd: properly check all write ioctls for permissions