* [PATCH 3.18 18/52] HID: i2c-hid: fix size check and type usage
[not found] ` <trinity-bff38853-2a86-4917-a956-4688923718e1-1524949392271@3c-app-gmx-bs13>
@ 2018-04-28 21:09 ` John Smith
2018-04-28 21:30 ` John Smith
2018-04-29 5:27 ` Greg KH
0 siblings, 2 replies; 6+ messages in thread
From: John Smith @ 2018-04-28 21:09 UTC (permalink / raw)
To: stable
> - if (ret_size > size) {
> + if ((ret_size > size) || (ret_size <= 2)) {
> dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n",
> __func__, size, ret_size);
> return;
This change spams in the dmesg output. Could you please undo this change? Or
- if ((ret_size > size) || (ret_size <= 2)) {
+ if ((ret_size > size) || (ret_size < 2)) {
$ dmesg
[ 1781.266353] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
[ 1781.273898] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
[ 1781.281464] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
[ 1781.289064] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
[ 1781.296607] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
[ 1781.304131] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
[ 1781.311751] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
[ 1781.319315] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
[ 1781.326882] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3.18 18/52] HID: i2c-hid: fix size check and type usage
2018-04-28 21:09 ` [PATCH 3.18 18/52] HID: i2c-hid: fix size check and type usage John Smith
@ 2018-04-28 21:30 ` John Smith
2018-04-29 5:27 ` Greg KH
1 sibling, 0 replies; 6+ messages in thread
From: John Smith @ 2018-04-28 21:30 UTC (permalink / raw)
To: linux-kernel
> - if (ret_size > size) {
> + if ((ret_size > size) || (ret_size <= 2)) {
> dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n",
> __func__, size, ret_size);
> return;
This change spams in the dmesg output. Could you please undo this change? Or
- if ((ret_size > size) || (ret_size <= 2)) {
+ if ((ret_size > size) || (ret_size < 2)) {
$ dmesg
[ 1781.266353] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
[ 1781.273898] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
[ 1781.281464] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
[ 1781.289064] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
[ 1781.296607] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
[ 1781.304131] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
[ 1781.311751] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
[ 1781.319315] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
[ 1781.326882] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3.18 18/52] HID: i2c-hid: fix size check and type usage
2018-04-28 21:09 ` [PATCH 3.18 18/52] HID: i2c-hid: fix size check and type usage John Smith
2018-04-28 21:30 ` John Smith
@ 2018-04-29 5:27 ` Greg KH
2018-04-29 10:54 ` Aw: " John Smith
1 sibling, 1 reply; 6+ messages in thread
From: Greg KH @ 2018-04-29 5:27 UTC (permalink / raw)
To: John Smith; +Cc: stable
On Sat, Apr 28, 2018 at 11:09:00PM +0200, John Smith wrote:
> > - if (ret_size > size) {
> > + if ((ret_size > size) || (ret_size <= 2)) {
> > dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n",
> > __func__, size, ret_size);
> > return;
>
>
> This change spams in the dmesg output. Could you please undo this change? Or
>
> - if ((ret_size > size) || (ret_size <= 2)) {
> + if ((ret_size > size) || (ret_size < 2)) {
>
>
> $ dmesg
>
> [ 1781.266353] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
> [ 1781.273898] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
> [ 1781.281464] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
> [ 1781.289064] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
> [ 1781.296607] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
> [ 1781.304131] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
> [ 1781.311751] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
> [ 1781.319315] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
> [ 1781.326882] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
Does this happen in newer kernels as well? Is there a patch there that
I need to just backport to 3.18.y to remove this "noise"?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Aw: Re: [PATCH 3.18 18/52] HID: i2c-hid: fix size check and type usage
2018-04-29 5:27 ` Greg KH
@ 2018-04-29 10:54 ` John Smith
2018-04-29 19:35 ` Greg KH
0 siblings, 1 reply; 6+ messages in thread
From: John Smith @ 2018-04-29 10:54 UTC (permalink / raw)
To: Greg KH; +Cc: stable
[-- Attachment #1: Type: text/plain, Size: 1694 bytes --]
Issue happens on 4.16.5 as well.
Thanks.
Best John
Gesendet: Sonntag, 29. April 2018 um 07:27 Uhr
Von: "Greg KH" <gregkh@linuxfoundation.org>
An: "John Smith" <john-s-84@gmx.net>
Cc: stable@vger.kernel.org
Betreff: Re: [PATCH 3.18 18/52] HID: i2c-hid: fix size check and type usage
On Sat, Apr 28, 2018 at 11:09:00PM +0200, John Smith wrote:
> > - if (ret_size > size) {
> > + if ((ret_size > size) || (ret_size <= 2)) {
> > dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n",
> > __func__, size, ret_size);
> > return;
>
>
> This change spams in the dmesg output. Could you please undo this change? Or
>
> - if ((ret_size > size) || (ret_size <= 2)) {
> + if ((ret_size > size) || (ret_size < 2)) {
>
>
> $ dmesg
>
> [ 1781.266353] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
> [ 1781.273898] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
> [ 1781.281464] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
> [ 1781.289064] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
> [ 1781.296607] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
> [ 1781.304131] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
> [ 1781.311751] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
> [ 1781.319315] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
> [ 1781.326882] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
Does this happen in newer kernels as well? Is there a patch there that
I need to just backport to 3.18.y to remove this "noise"?
thanks,
greg k-h
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: i2c_hid.patch --]
[-- Type: text/x-patch, Size: 512 bytes --]
diff -uNr linux-4.16.5/drivers/hid/i2c-hid/i2c-hid.c linux-4.16.5_patch2/drivers/hid/i2c-hid/i2c-hid.c
--- linux-4.16.5/drivers/hid/i2c-hid/i2c-hid.c 2018-04-26 11:00:39.000000000 +0200
+++ linux-4.16.5_patch2/drivers/hid/i2c-hid/i2c-hid.c 2018-04-29 12:42:53.867780866 +0200
@@ -484,7 +484,7 @@
return;
}
- if ((ret_size > size) || (ret_size <= 2)) {
+ if ((ret_size > size) || (ret_size < 2)) {
dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n",
__func__, size, ret_size);
return;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Re: [PATCH 3.18 18/52] HID: i2c-hid: fix size check and type usage
2018-04-29 10:54 ` Aw: " John Smith
@ 2018-04-29 19:35 ` Greg KH
0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2018-04-29 19:35 UTC (permalink / raw)
To: John Smith; +Cc: stable
On Sun, Apr 29, 2018 at 12:54:22PM +0200, John Smith wrote:
> Issue happens on 4.16.5 as well.
Great, please report this to the i2c and hid developers on their mailing
lists and they will be glad to help you out.
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3.18 18/52] HID: i2c-hid: fix size check and type usage
2018-04-22 13:53 [PATCH 3.18 00/52] 3.18.106-stable review Greg Kroah-Hartman
@ 2018-04-22 13:53 ` Greg Kroah-Hartman
0 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2018-04-22 13:53 UTC (permalink / raw)
To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Aaron Ma, Jiri Kosina
3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Ma <aaron.ma@canonical.com>
commit ac75a041048b8c1f7418e27621ca5efda8571043 upstream.
When convert char array with signed int, if the inbuf[x] is negative then
upper bits will be set to 1. Fix this by using u8 instead of char.
ret_size has to be at least 3, hid_input_report use it after minus 2 bytes.
Cc: stable@vger.kernel.org
Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hid/i2c-hid/i2c-hid.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -136,10 +136,10 @@ struct i2c_hid {
* register of the HID
* descriptor. */
unsigned int bufsize; /* i2c buffer size */
- char *inbuf; /* Input buffer */
- char *rawbuf; /* Raw Input buffer */
- char *cmdbuf; /* Command buffer */
- char *argsbuf; /* Command arguments buffer */
+ u8 *inbuf; /* Input buffer */
+ u8 *rawbuf; /* Raw Input buffer */
+ u8 *cmdbuf; /* Command buffer */
+ u8 *argsbuf; /* Command arguments buffer */
unsigned long flags; /* device flags */
@@ -373,7 +373,8 @@ static int i2c_hid_hwreset(struct i2c_cl
static void i2c_hid_get_input(struct i2c_hid *ihid)
{
- int ret, ret_size;
+ int ret;
+ u32 ret_size;
int size = le16_to_cpu(ihid->hdesc.wMaxInputLength);
if (size > ihid->bufsize)
@@ -398,7 +399,7 @@ static void i2c_hid_get_input(struct i2c
return;
}
- if (ret_size > size) {
+ if ((ret_size > size) || (ret_size <= 2)) {
dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n",
__func__, size, ret_size);
return;
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-04-29 19:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <trinity-0dcac895-4529-4180-924f-ccbb1284323c-1524949271985@3c-app-gmx-bs13>
[not found] ` <trinity-bff38853-2a86-4917-a956-4688923718e1-1524949392271@3c-app-gmx-bs13>
2018-04-28 21:09 ` [PATCH 3.18 18/52] HID: i2c-hid: fix size check and type usage John Smith
2018-04-28 21:30 ` John Smith
2018-04-29 5:27 ` Greg KH
2018-04-29 10:54 ` Aw: " John Smith
2018-04-29 19:35 ` Greg KH
2018-04-22 13:53 [PATCH 3.18 00/52] 3.18.106-stable review Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 3.18 18/52] HID: i2c-hid: fix size check and type usage Greg Kroah-Hartman
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.