diff options
Diffstat (limited to 'kernel/net/irda/af_irda.c')
-rw-r--r-- | kernel/net/irda/af_irda.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/net/irda/af_irda.c b/kernel/net/irda/af_irda.c index ee0ea25c8..923abd6b3 100644 --- a/kernel/net/irda/af_irda.c +++ b/kernel/net/irda/af_irda.c @@ -1086,6 +1086,9 @@ static int irda_create(struct net *net, struct socket *sock, int protocol, struct sock *sk; struct irda_sock *self; + if (protocol < 0 || protocol > SK_PROTOCOL_MAX) + return -EINVAL; + if (net != &init_net) return -EAFNOSUPPORT; @@ -1100,7 +1103,7 @@ static int irda_create(struct net *net, struct socket *sock, int protocol, } /* Allocate networking socket */ - sk = sk_alloc(net, PF_IRDA, GFP_KERNEL, &irda_proto); + sk = sk_alloc(net, PF_IRDA, GFP_KERNEL, &irda_proto, kern); if (sk == NULL) return -ENOMEM; @@ -2123,8 +2126,7 @@ static int irda_setsockopt(struct socket *sock, int level, int optname, } /* Unregister any old registration */ - if (self->skey) - irlmp_unregister_service(self->skey); + irlmp_unregister_service(self->skey); self->skey = irlmp_register_service((__u16) opt); break; |