mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "YOSHIFUJI Hideaki / 吉藤英明" <yoshfuji@linux-ipv6.org>
To: jmorris@redhat.com
Cc: paulus@samba.org, linux-kernel@vger.kernel.org,
	netdev@oss.sgi.com, davem@redhat.com, yoshfuji@linux-ipv6.org
Subject: Re: Bug somewhere in crypto or ipsec stuff
Date: Thu, 30 Oct 2003 14:24:58 +0900 (JST)	[thread overview]
Message-ID: <20031030.142458.350988313.yoshfuji@linux-ipv6.org> (raw)
In-Reply-To: <Xine.LNX.4.44.0310292344530.23580-100000@thoron.boston.redhat.com>

In article <Xine.LNX.4.44.0310292344530.23580-100000@thoron.boston.redhat.com> (at Wed, 29 Oct 2003 23:47:05 -0500 (EST)), James Morris <jmorris@redhat.com> says:

> > Do you mean that we need to fix the caller?
> 
> Yes.

> >  - crypto allows name == NULL, and return any algorithm
> >    (for example, an algorithm that we see first.)
> >  - caller may filter name == NULL case if it is ambiguous in their context.
> 
> I think that could be dangerous, including if calling with null is a 
> bug, and they get an inappropriate algorithm.  An incorrect algorithm type 
> could also be returned (e.g. digest instead of a cipher).

okay. how about this?

===== crypto/api.c 1.30 vs edited =====
--- 1.30/crypto/api.c	Sat Mar 29 20:16:58 2003
+++ edited/crypto/api.c	Thu Oct 30 14:21:53 2003
@@ -36,6 +36,9 @@
 struct crypto_alg *crypto_alg_lookup(const char *name)
 {
 	struct crypto_alg *q, *alg = NULL;
+
+	if (!name)
+		return NULL;
 	
 	down_read(&crypto_alg_sem);
 	
===== net/ipv4/ipcomp.c 1.16 vs edited =====
--- 1.16/net/ipv4/ipcomp.c	Mon Aug 18 20:14:38 2003
+++ edited/net/ipv4/ipcomp.c	Thu Oct 30 14:18:49 2003
@@ -360,7 +360,12 @@
 	ipcd->scratch = kmalloc(IPCOMP_SCRATCH_SIZE, GFP_KERNEL);
 	if (!ipcd->scratch)
 		goto error;
-	
+
+	if (!x->calg->alg_name) {
+		err = -EINVAL;
+		goto error;
+	}
+
 	ipcd->tfm = crypto_alloc_tfm(x->calg->alg_name, 0);
 	if (!ipcd->tfm)
 		goto error;
===== net/ipv6/ipcomp6.c 1.7 vs edited =====
--- 1.7/net/ipv6/ipcomp6.c	Mon Aug 18 20:14:38 2003
+++ edited/net/ipv6/ipcomp6.c	Thu Oct 30 14:18:49 2003
@@ -293,6 +293,11 @@
 	if (!ipcd->scratch)
 		goto error;
 
+	if (!x->calg->alg_name) {
+		err = -EINVAL;
+		goto error;
+	}
+
 	ipcd->tfm = crypto_alloc_tfm(x->calg->alg_name, 0);
 	if (!ipcd->tfm)
 		goto error;

      reply	other threads:[~2003-10-30  5:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-30  2:29 Paul Mackerras
2003-10-30  3:17 ` YOSHIFUJI Hideaki / 吉藤英明
2003-10-30  3:22   ` James Morris
2003-10-30  3:41     ` YOSHIFUJI Hideaki / 吉藤英明
2003-10-30  4:33       ` Valdis.Kletnieks
2003-10-30  4:47       ` James Morris
2003-10-30  5:24         ` YOSHIFUJI Hideaki / 吉藤英明 [this message]

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=20031030.142458.350988313.yoshfuji@linux-ipv6.org \
    --to=yoshfuji@linux-ipv6.org \
    --cc=davem@redhat.com \
    --cc=jmorris@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@oss.sgi.com \
    --cc=paulus@samba.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

all inboxes | Powered by JetHome®