summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornorly <ny-git@enpas.org>2022-06-11 14:49:05 +0200
committernorly <ny-git@enpas.org>2022-06-11 14:49:05 +0200
commit37111be717212b8c7779978c0385393c2d51747d (patch)
tree463a5699bb540176d297d1619392447299157bec
parent11a11ae0991f8f1cc5fa3eabb2e853121436f10f (diff)
Stop leaking SKBs in elm327_parse_frame()
SKBs need to be used or freed before returning, no exceptions.
-rw-r--r--module/can327.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/module/can327.c b/module/can327.c
index 2d9c44e..ea92daf 100644
--- a/module/can327.c
+++ b/module/can327.c
@@ -440,6 +440,7 @@ static int elm327_parse_frame(struct can327 *elm, size_t len)
/* The line is likely garbled anyway, so bail.
* The main code will restart listening.
*/
+ kfree_skb(skb);
return -ENODATA;
}
@@ -458,6 +459,7 @@ static int elm327_parse_frame(struct can327 *elm, size_t len)
/* This is not a well-formatted data line.
* Assume it's an error message.
*/
+ kfree_skb(skb);
return -ENODATA;
}
@@ -465,6 +467,7 @@ static int elm327_parse_frame(struct can327 *elm, size_t len)
/* The line is too short to be a valid frame hex dump.
* Something interrupted the hex dump or it is invalid.
*/
+ kfree_skb(skb);
return -ENODATA;
}
@@ -516,6 +519,7 @@ static int elm327_parse_frame(struct can327 *elm, size_t len)
* However, this will correctly drop the state machine back into
* command mode.
*/
+ kfree_skb(skb);
return -ENODATA;
}