diff --git a/net/atm/br2684.c b/net/atm/br2684.c index 6dc383c90262263c73af300eb8f3220d100aad79..403e71fa88feb900a7d194f3f3c83f4f6e1cb0d4 100644 --- a/net/atm/br2684.c +++ b/net/atm/br2684.c @@ -735,10 +735,13 @@ static int br2684_ioctl(struct socket *sock, unsigned int cmd, return -ENOIOCTLCMD; if (!capable(CAP_NET_ADMIN)) return -EPERM; - if (cmd == ATM_SETBACKEND) + if (cmd == ATM_SETBACKEND) { + if (sock->state != SS_CONNECTED) + return -EINVAL; return br2684_regvcc(atmvcc, argp); - else + } else { return br2684_create(argp); + } #ifdef CONFIG_ATM_BR2684_IPFILTER case BR2684_SETFILT: if (atmvcc->push != br2684_push)