* [char-misc-next 0/2]: mei bus fix type promotion bugs
@ 2018-07-11 12:29 Tomas Winkler
2018-07-11 12:29 ` [char-misc-next v2 1/2] mei: bus: type promotion bug in mei_nfc_if_version() Tomas Winkler
2018-07-11 12:29 ` [char-misc-next 2/2] mei: bus: type promotion bug in mei_fwver() Tomas Winkler
0 siblings, 2 replies; 3+ messages in thread
From: Tomas Winkler @ 2018-07-11 12:29 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Alexander Usyskin, linux-kernel, Tomas Winkler, Dan Carpenter
The first patch is a rebase of Dan's patch over misc-next version
of the driver. It should go also to the stable.
Second one fixes a same issue introduced in next cycle:
"mei: expose fw version to sysfs"
Dan Carpenter (1):
mei: bus: type promotion bug in mei_nfc_if_version()
Tomas Winkler (1):
mei: bus: type promotion bug in mei_fwver()
drivers/misc/mei/bus-fixup.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--
2.14.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* [char-misc-next v2 1/2] mei: bus: type promotion bug in mei_nfc_if_version()
2018-07-11 12:29 [char-misc-next 0/2]: mei bus fix type promotion bugs Tomas Winkler
@ 2018-07-11 12:29 ` Tomas Winkler
2018-07-11 12:29 ` [char-misc-next 2/2] mei: bus: type promotion bug in mei_fwver() Tomas Winkler
1 sibling, 0 replies; 3+ messages in thread
From: Tomas Winkler @ 2018-07-11 12:29 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Alexander Usyskin, linux-kernel, Dan Carpenter, stable, Tomas Winkler
From: Dan Carpenter <dan.carpenter@oracle.com>
We accidentally removed the check for negative returns
without considering the issue of type promotion.
The "if_version_length" variable is type size_t so if __mei_cl_recv()
returns a negative then "bytes_recv" is type promoted
to a high positive value and treated as success.
Cc: <stable@vger.kernel.org>
Fixes: 582ab27a063a ("mei: bus: fix received data size check in NFC fixup")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
V2: rebase
drivers/misc/mei/bus-fixup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/misc/mei/bus-fixup.c b/drivers/misc/mei/bus-fixup.c
index e45fe826d87d..65e28be3c8cc 100644
--- a/drivers/misc/mei/bus-fixup.c
+++ b/drivers/misc/mei/bus-fixup.c
@@ -341,7 +341,7 @@ static int mei_nfc_if_version(struct mei_cl *cl,
ret = 0;
bytes_recv = __mei_cl_recv(cl, (u8 *)reply, if_version_length, 0, 0);
- if (bytes_recv < if_version_length) {
+ if (bytes_recv < 0 || bytes_recv < if_version_length) {
dev_err(bus->dev, "Could not read IF version\n");
ret = -EIO;
goto err;
--
2.14.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [char-misc-next 2/2] mei: bus: type promotion bug in mei_fwver()
2018-07-11 12:29 [char-misc-next 0/2]: mei bus fix type promotion bugs Tomas Winkler
2018-07-11 12:29 ` [char-misc-next v2 1/2] mei: bus: type promotion bug in mei_nfc_if_version() Tomas Winkler
@ 2018-07-11 12:29 ` Tomas Winkler
1 sibling, 0 replies; 3+ messages in thread
From: Tomas Winkler @ 2018-07-11 12:29 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Alexander Usyskin, linux-kernel, Tomas Winkler, Dan Carpenter
if __mei_cl_recv() returns a negative then "bytes_recv"
type is promoted to a high positive value in comparison with
size_t evaluated by MKHI_FWVER_LEN(1). It results in error condition
not to be detected.
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 9078ad92ef86 ("mei: expose fw version to sysfs")
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
drivers/misc/mei/bus-fixup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/misc/mei/bus-fixup.c b/drivers/misc/mei/bus-fixup.c
index 65e28be3c8cc..4c232f0eae90 100644
--- a/drivers/misc/mei/bus-fixup.c
+++ b/drivers/misc/mei/bus-fixup.c
@@ -181,7 +181,7 @@ static int mei_fwver(struct mei_cl_device *cldev)
ret = 0;
bytes_recv = __mei_cl_recv(cldev->cl, buf, sizeof(buf), 0,
MKHI_RCV_TIMEOUT);
- if (bytes_recv < MKHI_FWVER_LEN(1)) {
+ if (bytes_recv < 0 || bytes_recv < MKHI_FWVER_LEN(1)) {
/*
* Should be at least one version block,
* error out if nothing found
--
2.14.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-07-11 12:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-11 12:29 [char-misc-next 0/2]: mei bus fix type promotion bugs Tomas Winkler
2018-07-11 12:29 ` [char-misc-next v2 1/2] mei: bus: type promotion bug in mei_nfc_if_version() Tomas Winkler
2018-07-11 12:29 ` [char-misc-next 2/2] mei: bus: type promotion bug in mei_fwver() Tomas Winkler
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.