netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: David Miller <davem@davemloft.net>
Cc: Karsten Keil <isdn@linux-pingi.de>,
	linux-ppp@vger.kernel.org, netdev <netdev@vger.kernel.org>
Subject: [PATCH v2 net 1/2] isdn_ppp: Add checks for allocation failure in isdn_ppp_open()
Date: Sun, 1 Nov 2015 16:21:24 +0000	[thread overview]
Message-ID: <20151101162123.GA9478@decadent.org.uk> (raw)

[-- Attachment #1: Type: text/plain, Size: 971 bytes --]

Compile-tested only.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
Re-sent using mutt since Evolution 3.18 mangles patches.

Ben.

 drivers/isdn/i4l/isdn_ppp.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c
index c4198fa..86f9abe 100644
--- a/drivers/isdn/i4l/isdn_ppp.c
+++ b/drivers/isdn/i4l/isdn_ppp.c
@@ -301,6 +301,8 @@ isdn_ppp_open(int min, struct file *file)
 	is->compflags = 0;
 
 	is->reset = isdn_ppp_ccp_reset_alloc(is);
+	if (!is->reset)
+		return -ENOMEM;
 
 	is->lp = NULL;
 	is->mp_seqno = 0;       /* MP sequence number */
@@ -320,6 +322,10 @@ isdn_ppp_open(int min, struct file *file)
 	 * VJ header compression init
 	 */
 	is->slcomp = slhc_init(16, 16);	/* not necessary for 2. link in bundle */
+	if (!is->slcomp) {
+		isdn_ppp_ccp_reset_free(is);
+		return -ENOMEM;
+	}
 #endif
 #ifdef CONFIG_IPPP_FILTER
 	is->pass_filter = NULL;


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

             reply	other threads:[~2015-11-01 16:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-01 16:21 Ben Hutchings [this message]
2015-11-01 16:22 ` [PATCH v2 net 2/2] ppp, slip: Validate VJ compression slot parameters completely Ben Hutchings
2015-11-02 21:25   ` David Miller
2015-11-02 21:25 ` [PATCH v2 net 1/2] isdn_ppp: Add checks for allocation failure in isdn_ppp_open() 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=20151101162123.GA9478@decadent.org.uk \
    --to=ben@decadent.org.uk \
    --cc=davem@davemloft.net \
    --cc=isdn@linux-pingi.de \
    --cc=linux-ppp@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).