All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Len Brown <len.brown@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-pm@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] PM / sysfs: return -EINVAL for bogus strings
Date: Mon, 10 Jul 2017 07:29:35 +0000	[thread overview]
Message-ID: <20170710072935.GA12630@amd> (raw)
In-Reply-To: <20170710072140.chms22ep35myvvbd@mwanda>

[-- Attachment #1: Type: text/plain, Size: 1013 bytes --]

On Mon 2017-07-10 10:21:40, Dan Carpenter wrote:
> In the current code, if the user accidentally writes a bogus command to
> this sysfs file, then we set the latency tolerance to an uninitialized
> variable.
> 
> Fixes: 2d984ad132a8 ("PM / QoS: Introcuce latency tolerance device PM QoS type")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Pavel Machek <pavel@ucw.cz>

I'd suggest this is a stable candidate. It only leaks 32 bits to
userspace, but still...

> @@ -272,6 +272,8 @@ static ssize_t pm_qos_latency_tolerance_store(struct device *dev,
>  			value = PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT;
>  		else if (!strcmp(buf, "any") || !strcmp(buf, "any\n"))
>  			value = PM_QOS_LATENCY_ANY;
> +		else
> +			return -EINVAL;
>  	}
>  	ret = dev_pm_qos_update_user_latency_tolerance(dev, value);
>  	return ret < 0 ? ret : n;

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Pavel Machek <pavel@ucw.cz>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Len Brown <len.brown@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-pm@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] PM / sysfs: return -EINVAL for bogus strings
Date: Mon, 10 Jul 2017 09:29:35 +0200	[thread overview]
Message-ID: <20170710072935.GA12630@amd> (raw)
In-Reply-To: <20170710072140.chms22ep35myvvbd@mwanda>

[-- Attachment #1: Type: text/plain, Size: 1013 bytes --]

On Mon 2017-07-10 10:21:40, Dan Carpenter wrote:
> In the current code, if the user accidentally writes a bogus command to
> this sysfs file, then we set the latency tolerance to an uninitialized
> variable.
> 
> Fixes: 2d984ad132a8 ("PM / QoS: Introcuce latency tolerance device PM QoS type")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Pavel Machek <pavel@ucw.cz>

I'd suggest this is a stable candidate. It only leaks 32 bits to
userspace, but still...

> @@ -272,6 +272,8 @@ static ssize_t pm_qos_latency_tolerance_store(struct device *dev,
>  			value = PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT;
>  		else if (!strcmp(buf, "any") || !strcmp(buf, "any\n"))
>  			value = PM_QOS_LATENCY_ANY;
> +		else
> +			return -EINVAL;
>  	}
>  	ret = dev_pm_qos_update_user_latency_tolerance(dev, value);
>  	return ret < 0 ? ret : n;

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

  reply	other threads:[~2017-07-10  7:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-10  7:21 [PATCH] PM / sysfs: return -EINVAL for bogus strings Dan Carpenter
2017-07-10  7:21 ` Dan Carpenter
2017-07-10  7:29 ` Pavel Machek [this message]
2017-07-10  7:29   ` Pavel Machek
2017-07-12 21:35   ` Rafael J. Wysocki
2017-07-12 21:35     ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170710072935.GA12630@amd \
    --to=pavel@ucw.cz \
    --cc=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=len.brown@intel.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.