X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=crypto%2Faf_alg.c;h=7846c0c20cfec1998674e18e0a516a89caea509f;hb=1f1cba787f5b2c03e3d103829cc02a74a7c9110a;hp=c49766b03165ce095d218b09f0e22e7765e05388;hpb=e525de3ab04621d227330aa82cd4073c0b0f3579;p=linux-2.6-block.git diff --git a/crypto/af_alg.c b/crypto/af_alg.c index c49766b03165..7846c0c20cfe 100644 --- a/crypto/af_alg.c +++ b/crypto/af_alg.c @@ -158,16 +158,16 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) void *private; int err; - /* If caller uses non-allowed flag, return error. */ - if ((sa->salg_feat & ~allowed) || (sa->salg_mask & ~allowed)) - return -EINVAL; - if (sock->state == SS_CONNECTED) return -EINVAL; if (addr_len < sizeof(*sa)) return -EINVAL; + /* If caller uses non-allowed flag, return error. */ + if ((sa->salg_feat & ~allowed) || (sa->salg_mask & ~allowed)) + return -EINVAL; + sa->salg_type[sizeof(sa->salg_type) - 1] = 0; sa->salg_name[sizeof(sa->salg_name) + addr_len - sizeof(*sa) - 1] = 0;