Skip to contentSkip to conversation

[linux-review:Mauro-Carvalho-Chehab/Don-t-use-stack-for-DMA-transers-on-media-usb-drivers/20161011-182408 3/31] drivers/media/usb/dvb-usb/cinergyT2-core.c:174:2-8: preceding lock on line 169

DISCUSSION Julia Lawall 2 participants 5 messages Oct 11, 2016 – Oct 12, 2016 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

It looks like a lock may be needed before line 174.

julia

---------- Forwarded message ----------
Date: Tue, 11 Oct 2016 21:06:18 +0800
From: kbuild test robot <[email protected]>
To: [email protected]
Cc: Julia Lawall <[email protected]>
Subject:

    [linux-review:Mauro-Carvalho-Chehab/Don-t-use-stack-for-DMA-transers-on-medi
    a-usb-drivers/20161011-182408 3/31]
    drivers/media/usb/dvb-usb/cinergyT2-core.c:174:2-8: preceding lock on line
    169

CC: [email protected]
TO: Mauro Carvalho Chehab <[email protected]>
CC: [email protected]
CC: 0day robot <[email protected]>

tree:   https://github.com/0day-ci/linux Mauro-Carvalho-Chehab/Don-t-use-stack-for-DMA-transers-on-media-usb-drivers/20161011-182408
head:   ff49f775552fe4ebe2944527cf882073679cb1e5
commit: b38d98275e144aaea9db69ba2dcba58466046d9b [3/31] cinergyT2-core: handle error code on RC query

:::::: branch date: 3 hours ago
:::::: commit date: 3 hours ago

Quoted 1 line
Quoted 1 line

drivers/media/usb/dvb-usb/cinergyT2-core.c:174:2-8: preceding lock on line 169

git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout b38d98275e144aaea9db69ba2dcba58466046d9b vim +174 drivers/media/usb/dvb-usb/cinergyT2-core.c

986bd1e5 drivers/media/dvb/dvb-usb/cinergyT2-core.c Tomi Orava            2008-09-19  163  {
7f987678 drivers/media/dvb/dvb-usb/cinergyT2-core.c Thierry MERLE         2008-09-19  164  	struct cinergyt2_state *st = d->priv;
b38d9827 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  165  	int i, ret;
7f987678 drivers/media/dvb/dvb-usb/cinergyT2-core.c Thierry MERLE         2008-09-19  166
986bd1e5 drivers/media/dvb/dvb-usb/cinergyT2-core.c Tomi Orava            2008-09-19  167  	*state = REMOTE_NO_KEY_PRESSED;
986bd1e5 drivers/media/dvb/dvb-usb/cinergyT2-core.c Tomi Orava            2008-09-19  168
48922468 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11 @169  	mutex_lock(&st->data_mutex);
48922468 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  170  	st->data[0] = CINERGYT2_EP1_GET_RC_EVENTS;
48922468 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  171
b38d9827 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  172  	ret = dvb_usb_generic_rw(d, st->data, 1, st->data, 5, 0);
b38d9827 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  173  	if (ret < 0)
b38d9827 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11 @174  		return ret;
48922468 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  175
48922468 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  176  	if (st->data[4] == 0xff) {
7f987678 drivers/media/dvb/dvb-usb/cinergyT2-core.c Thierry MERLE         2008-09-19  177  		/* key repeat */

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#1 lore raw
Quoted 1 line · Julia Lawall

It looks like a lock may be needed before line 174.

Sorry, an unlock.

Quoted 52 lines

julia

---------- Forwarded message ----------
Date: Tue, 11 Oct 2016 21:06:18 +0800
From: kbuild test robot <[email protected]>
To: [email protected]
Cc: Julia Lawall <[email protected]>
Subject:

    [linux-review:Mauro-Carvalho-Chehab/Don-t-use-stack-for-DMA-transers-on-medi
    a-usb-drivers/20161011-182408 3/31]
    drivers/media/usb/dvb-usb/cinergyT2-core.c:174:2-8: preceding lock on line
    169

CC: [email protected]
TO: Mauro Carvalho Chehab <[email protected]>
CC: [email protected]
CC: 0day robot <[email protected]>

tree:   https://github.com/0day-ci/linux Mauro-Carvalho-Chehab/Don-t-use-stack-for-DMA-transers-on-media-usb-drivers/20161011-182408
head:   ff49f775552fe4ebe2944527cf882073679cb1e5
commit: b38d98275e144aaea9db69ba2dcba58466046d9b [3/31] cinergyT2-core: handle error code on RC query

:::::: branch date: 3 hours ago
:::::: commit date: 3 hours ago

Quoted 1 line
Quoted 1 line

drivers/media/usb/dvb-usb/cinergyT2-core.c:174:2-8: preceding lock on line 169

git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout b38d98275e144aaea9db69ba2dcba58466046d9b vim +174 drivers/media/usb/dvb-usb/cinergyT2-core.c

986bd1e5 drivers/media/dvb/dvb-usb/cinergyT2-core.c Tomi Orava            2008-09-19  163  {
7f987678 drivers/media/dvb/dvb-usb/cinergyT2-core.c Thierry MERLE         2008-09-19  164  	struct cinergyt2_state *st = d->priv;
b38d9827 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  165  	int i, ret;
7f987678 drivers/media/dvb/dvb-usb/cinergyT2-core.c Thierry MERLE         2008-09-19  166
986bd1e5 drivers/media/dvb/dvb-usb/cinergyT2-core.c Tomi Orava            2008-09-19  167  	*state = REMOTE_NO_KEY_PRESSED;
986bd1e5 drivers/media/dvb/dvb-usb/cinergyT2-core.c Tomi Orava            2008-09-19  168
48922468 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11 @169  	mutex_lock(&st->data_mutex);
48922468 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  170  	st->data[0] = CINERGYT2_EP1_GET_RC_EVENTS;
48922468 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  171
b38d9827 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  172  	ret = dvb_usb_generic_rw(d, st->data, 1, st->data, 5, 0);
b38d9827 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  173  	if (ret < 0)
b38d9827 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11 @174  		return ret;
48922468 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  175
48922468 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  176  	if (st->data[4] == 0xff) {
7f987678 drivers/media/dvb/dvb-usb/cinergyT2-core.c Thierry MERLE         2008-09-19  177  		/* key repeat */

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#2 lore raw

Em Tue, 11 Oct 2016 15:16:24 +0200 (CEST)
Julia Lawall <[email protected]> escreveu:

Quoted 5 lines · Julia Lawall
Quoted 2 lines

It looks like a lock may be needed before line 174.

Sorry, an unlock.

I suspect that this is a false positive warning, as there is a mutex unlock on the same routine, at line 203. All exit conditions go to the unlock condition.

Am I missing something?

Quoted 55 lines
Quoted 53 lines

julia

---------- Forwarded message ----------
Date: Tue, 11 Oct 2016 21:06:18 +0800
From: kbuild test robot <[email protected]>
To: [email protected]
Cc: Julia Lawall <[email protected]>
Subject:

    [linux-review:Mauro-Carvalho-Chehab/Don-t-use-stack-for-DMA-transers-on-medi
    a-usb-drivers/20161011-182408 3/31]
    drivers/media/usb/dvb-usb/cinergyT2-core.c:174:2-8: preceding lock on line
    169

CC: [email protected]
TO: Mauro Carvalho Chehab <[email protected]>
CC: [email protected]
CC: 0day robot <[email protected]>

tree:   https://github.com/0day-ci/linux Mauro-Carvalho-Chehab/Don-t-use-stack-for-DMA-transers-on-media-usb-drivers/20161011-182408
head:   ff49f775552fe4ebe2944527cf882073679cb1e5
commit: b38d98275e144aaea9db69ba2dcba58466046d9b [3/31] cinergyT2-core: handle error code on RC query

:::::: branch date: 3 hours ago
:::::: commit date: 3 hours ago

Quoted 1 line
Quoted 1 line

drivers/media/usb/dvb-usb/cinergyT2-core.c:174:2-8: preceding lock on line 169

git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout b38d98275e144aaea9db69ba2dcba58466046d9b vim +174 drivers/media/usb/dvb-usb/cinergyT2-core.c

986bd1e5 drivers/media/dvb/dvb-usb/cinergyT2-core.c Tomi Orava            2008-09-19  163  {
7f987678 drivers/media/dvb/dvb-usb/cinergyT2-core.c Thierry MERLE         2008-09-19  164  	struct cinergyt2_state *st = d->priv;
b38d9827 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  165  	int i, ret;
7f987678 drivers/media/dvb/dvb-usb/cinergyT2-core.c Thierry MERLE         2008-09-19  166
986bd1e5 drivers/media/dvb/dvb-usb/cinergyT2-core.c Tomi Orava            2008-09-19  167  	*state = REMOTE_NO_KEY_PRESSED;
986bd1e5 drivers/media/dvb/dvb-usb/cinergyT2-core.c Tomi Orava            2008-09-19  168
48922468 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11 @169  	mutex_lock(&st->data_mutex);
48922468 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  170  	st->data[0] = CINERGYT2_EP1_GET_RC_EVENTS;
48922468 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  171
b38d9827 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  172  	ret = dvb_usb_generic_rw(d, st->data, 1, st->data, 5, 0);
b38d9827 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  173  	if (ret < 0)
b38d9827 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11 @174  		return ret;
48922468 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  175
48922468 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  176  	if (st->data[4] == 0xff) {
7f987678 drivers/media/dvb/dvb-usb/cinergyT2-core.c Thierry MERLE         2008-09-19  177  		/* key repeat */

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Signature · 2 lines
Thanks,
Mauro
#3 lore raw
Quoted 5 lines · Mauro Carvalho Chehab

Em Tue, 11 Oct 2016 15:16:24 +0200 (CEST)
Julia Lawall <[email protected]> escreveu:

Quoted 2 lines · Julia Lawall
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

It looks like a lock may be needed before line 174.

Sorry, an unlock.

I suspect that this is a false positive warning, as there is a mutex unlock on the same routine, at line 203. All exit conditions go to the unlock condition.

There is a direct exit in line 174.

julia

Quoted 64 lines

Am I missing something?

Quoted 49 lines
Quoted 49 lines

julia

---------- Forwarded message ----------
Date: Tue, 11 Oct 2016 21:06:18 +0800
From: kbuild test robot <[email protected]>
To: [email protected]
Cc: Julia Lawall <[email protected]>
Subject:

    [linux-review:Mauro-Carvalho-Chehab/Don-t-use-stack-for-DMA-transers-on-medi
    a-usb-drivers/20161011-182408 3/31]
    drivers/media/usb/dvb-usb/cinergyT2-core.c:174:2-8: preceding lock on line
    169

CC: [email protected]
TO: Mauro Carvalho Chehab <[email protected]>
CC: [email protected]
CC: 0day robot <[email protected]>

tree:   https://github.com/0day-ci/linux Mauro-Carvalho-Chehab/Don-t-use-stack-for-DMA-transers-on-media-usb-drivers/20161011-182408
head:   ff49f775552fe4ebe2944527cf882073679cb1e5
commit: b38d98275e144aaea9db69ba2dcba58466046d9b [3/31] cinergyT2-core: handle error code on RC query

:::::: branch date: 3 hours ago
:::::: commit date: 3 hours ago

Quoted 1 line
Quoted 1 line

drivers/media/usb/dvb-usb/cinergyT2-core.c:174:2-8: preceding lock on line 169

git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout b38d98275e144aaea9db69ba2dcba58466046d9b vim +174 drivers/media/usb/dvb-usb/cinergyT2-core.c

986bd1e5 drivers/media/dvb/dvb-usb/cinergyT2-core.c Tomi Orava            2008-09-19  163  {
7f987678 drivers/media/dvb/dvb-usb/cinergyT2-core.c Thierry MERLE         2008-09-19  164  	struct cinergyt2_state *st = d->priv;
b38d9827 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  165  	int i, ret;
7f987678 drivers/media/dvb/dvb-usb/cinergyT2-core.c Thierry MERLE         2008-09-19  166
986bd1e5 drivers/media/dvb/dvb-usb/cinergyT2-core.c Tomi Orava            2008-09-19  167  	*state = REMOTE_NO_KEY_PRESSED;
986bd1e5 drivers/media/dvb/dvb-usb/cinergyT2-core.c Tomi Orava            2008-09-19  168
48922468 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11 @169  	mutex_lock(&st->data_mutex);
48922468 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  170  	st->data[0] = CINERGYT2_EP1_GET_RC_EVENTS;
48922468 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  171
b38d9827 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  172  	ret = dvb_usb_generic_rw(d, st->data, 1, st->data, 5, 0);
b38d9827 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  173  	if (ret < 0)
b38d9827 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11 @174  		return ret;
48922468 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  175
48922468 drivers/media/usb/dvb-usb/cinergyT2-core.c Mauro Carvalho Chehab 2016-10-11  176  	if (st->data[4] == 0xff) {
7f987678 drivers/media/dvb/dvb-usb/cinergyT2-core.c Thierry MERLE         2008-09-19  177  		/* key repeat */
Quoted 6 lines
Quoted 4 lines

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

--
Thanks,
Mauro

#4 lore raw

Em Tue, 11 Oct 2016 23:41:53 +0200 (CEST)
Julia Lawall <[email protected]> escreveu:

Quoted 9 lines · Mauro Carvalho Chehab
Quoted 8 lines

Em Tue, 11 Oct 2016 15:16:24 +0200 (CEST)
Julia Lawall <[email protected]> escreveu:

Quoted 4 lines · Julia Lawall
Quoted 2 lines

It looks like a lock may be needed before line 174.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Sorry, an unlock.

I suspect that this is a false positive warning, as there is a mutex unlock on the same routine, at line 203. All exit conditions go to the unlock condition.

There is a direct exit in line 174.

Ah! I was looking at the wrong patch (cinergyT2-core: don't do DMA on stack).

Thanks for pointing it. I'll the affected code to:

-       dvb_usb_generic_rw(d, st->data, 1, st->data, 5, 0);
+       ret = dvb_usb_generic_rw(d, st->data, 1, st->data, 5, 0);
+       if (ret < 0)

+ goto ret;

Regards,
Mauro

Signature · 2 lines
Thanks,
Mauro