mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kangjie Lu <kjlu@umn.edu>
To: kjlu@umn.edu
Cc: pakki001@umn.edu, Armin Schindler <mac@melware.de>,
	Karsten Keil <isdn@linux-pingi.de>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] isdn: eicon: fix a missing check of api_parse
Date: Wed, 26 Dec 2018 00:40:32 -0600	[thread overview]
Message-ID: <20181226064032.75800-1-kjlu@umn.edu> (raw)

api_parse can fail, and if it fails, we should not use the ss_parms
which can be incorrect.
The fix checks its return value and stops using ss_parms if api_parse
fails.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/isdn/hardware/eicon/message.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/isdn/hardware/eicon/message.c b/drivers/isdn/hardware/eicon/message.c
index def7992a38e6..afb4a7d88288 100644
--- a/drivers/isdn/hardware/eicon/message.c
+++ b/drivers/isdn/hardware/eicon/message.c
@@ -1846,7 +1846,13 @@ static byte facility_req(dword Id, word Number, DIVA_CAPI_ADAPTER *a,
 				break;
 
 			case S_HOLD:
-				api_parse(&parms->info[1], (word)parms->length, "ws", ss_parms);
+				if (api_parse(&parms->info[1],
+							(word)parms->length,
+							"ws", ss_parms)) {
+					dbug(1, dprintf("format wrong"));
+					Info = _WRONG_MESSAGE_FORMAT;
+					break;
+				}
 				if (plci && plci->State && plci->SuppState == IDLE)
 				{
 					plci->SuppState = HOLD_REQUEST;
-- 
2.17.2 (Apple Git-113)


             reply	other threads:[~2018-12-26  6:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-26  6:40 Kangjie Lu [this message]
2018-12-28  0:27 ` David Miller

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=20181226064032.75800-1-kjlu@umn.edu \
    --to=kjlu@umn.edu \
    --cc=isdn@linux-pingi.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mac@melware.de \
    --cc=netdev@vger.kernel.org \
    --cc=pakki001@umn.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®