Import of kernel-5.14.0-687.20.1.el9_8
This commit is contained in:
parent
8626b73c68
commit
2137afdebb
@ -165,7 +165,7 @@ struct crypto_aead *krb5_prepare_encryption(const struct krb5_enctype *krb5,
|
||||
struct crypto_aead *ci = NULL;
|
||||
int ret = -ENOMEM;
|
||||
|
||||
ci = crypto_alloc_aead(krb5->encrypt_name, 0, 0);
|
||||
ci = crypto_alloc_aead(krb5->encrypt_name, 0, CRYPTO_ALG_ASYNC);
|
||||
if (IS_ERR(ci)) {
|
||||
ret = PTR_ERR(ci);
|
||||
if (ret == -ENOENT)
|
||||
|
||||
@ -39,12 +39,6 @@ struct krb5enc_request_ctx {
|
||||
char tail[];
|
||||
};
|
||||
|
||||
static void krb5enc_request_complete(struct aead_request *req, int err)
|
||||
{
|
||||
if (err != -EINPROGRESS)
|
||||
aead_request_complete(req, err);
|
||||
}
|
||||
|
||||
/**
|
||||
* crypto_krb5enc_extractkeys - Extract Ke and Ki keys from the key blob.
|
||||
* @keys: Where to put the key sizes and pointers
|
||||
@ -127,7 +121,7 @@ static void krb5enc_encrypt_done(struct crypto_async_request *areq, int err)
|
||||
{
|
||||
struct aead_request *req = areq->data;
|
||||
|
||||
krb5enc_request_complete(req, err);
|
||||
aead_request_complete(req, err);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -154,7 +148,7 @@ static int krb5enc_dispatch_encrypt(struct aead_request *req,
|
||||
dst = scatterwalk_ffwd(areq_ctx->dst, req->dst, req->assoclen);
|
||||
|
||||
skcipher_request_set_tfm(skreq, enc);
|
||||
skcipher_request_set_callback(skreq, aead_request_flags(req),
|
||||
skcipher_request_set_callback(skreq, flags,
|
||||
krb5enc_encrypt_done, req);
|
||||
skcipher_request_set_crypt(skreq, src, dst, req->cryptlen, req->iv);
|
||||
|
||||
@ -189,13 +183,16 @@ static void krb5enc_encrypt_ahash_done(struct crypto_async_request *areq,
|
||||
struct ahash_request *ahreq = (void *)(areq_ctx->tail + ictx->reqoff);
|
||||
|
||||
if (err)
|
||||
return krb5enc_request_complete(req, err);
|
||||
goto out;
|
||||
|
||||
krb5enc_insert_checksum(req, ahreq->result);
|
||||
|
||||
err = krb5enc_dispatch_encrypt(req, 0);
|
||||
if (err != -EINPROGRESS)
|
||||
aead_request_complete(req, err);
|
||||
if (err == -EINPROGRESS)
|
||||
return;
|
||||
|
||||
out:
|
||||
aead_request_complete(req, err);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -266,17 +263,16 @@ static void krb5enc_decrypt_hash_done(struct crypto_async_request *areq,
|
||||
{
|
||||
struct aead_request *req = areq->data;
|
||||
|
||||
if (err)
|
||||
return krb5enc_request_complete(req, err);
|
||||
|
||||
err = krb5enc_verify_hash(req);
|
||||
krb5enc_request_complete(req, err);
|
||||
if (!err)
|
||||
err = krb5enc_verify_hash(req);
|
||||
aead_request_complete(req, err);
|
||||
}
|
||||
|
||||
/*
|
||||
* Dispatch the hashing of the plaintext after we've done the decryption.
|
||||
*/
|
||||
static int krb5enc_dispatch_decrypt_hash(struct aead_request *req)
|
||||
static int krb5enc_dispatch_decrypt_hash(struct aead_request *req,
|
||||
unsigned int flags)
|
||||
{
|
||||
struct crypto_aead *krb5enc = crypto_aead_reqtfm(req);
|
||||
struct aead_instance *inst = aead_alg_instance(krb5enc);
|
||||
@ -292,7 +288,7 @@ static int krb5enc_dispatch_decrypt_hash(struct aead_request *req)
|
||||
ahash_request_set_tfm(ahreq, auth);
|
||||
ahash_request_set_crypt(ahreq, req->dst, hash,
|
||||
req->assoclen + req->cryptlen - authsize);
|
||||
ahash_request_set_callback(ahreq, aead_request_flags(req),
|
||||
ahash_request_set_callback(ahreq, flags,
|
||||
krb5enc_decrypt_hash_done, req);
|
||||
|
||||
err = crypto_ahash_digest(ahreq);
|
||||
@ -302,6 +298,21 @@ static int krb5enc_dispatch_decrypt_hash(struct aead_request *req)
|
||||
return krb5enc_verify_hash(req);
|
||||
}
|
||||
|
||||
static void krb5enc_decrypt_done(struct crypto_async_request *areq, int err)
|
||||
{
|
||||
struct aead_request *req = areq->data;
|
||||
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
err = krb5enc_dispatch_decrypt_hash(req, 0);
|
||||
if (err == -EINPROGRESS)
|
||||
return;
|
||||
|
||||
out:
|
||||
aead_request_complete(req, err);
|
||||
}
|
||||
|
||||
/*
|
||||
* Dispatch the decryption of the ciphertext.
|
||||
*/
|
||||
@ -325,7 +336,7 @@ static int krb5enc_dispatch_decrypt(struct aead_request *req)
|
||||
|
||||
skcipher_request_set_tfm(skreq, ctx->enc);
|
||||
skcipher_request_set_callback(skreq, aead_request_flags(req),
|
||||
req->base.complete, req->base.data);
|
||||
krb5enc_decrypt_done, req);
|
||||
skcipher_request_set_crypt(skreq, src, dst,
|
||||
req->cryptlen - authsize, req->iv);
|
||||
|
||||
@ -340,7 +351,7 @@ static int krb5enc_decrypt(struct aead_request *req)
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
return krb5enc_dispatch_decrypt_hash(req);
|
||||
return krb5enc_dispatch_decrypt_hash(req, aead_request_flags(req));
|
||||
}
|
||||
|
||||
static int krb5enc_init_tfm(struct crypto_aead *tfm)
|
||||
|
||||
@ -4374,6 +4374,7 @@ static const struct alg_test_desc alg_test_descs[] = {
|
||||
}, {
|
||||
.alg = "authenc(hmac(sha256),cts(cbc(aes)))",
|
||||
.test = alg_test_aead,
|
||||
.fips_allowed = 1,
|
||||
.suite = {
|
||||
.aead = __VECS(krb5_test_aes128_cts_hmac_sha256_128)
|
||||
}
|
||||
@ -4400,6 +4401,7 @@ static const struct alg_test_desc alg_test_descs[] = {
|
||||
}, {
|
||||
.alg = "authenc(hmac(sha384),cts(cbc(aes)))",
|
||||
.test = alg_test_aead,
|
||||
.fips_allowed = 1,
|
||||
.suite = {
|
||||
.aead = __VECS(krb5_test_aes256_cts_hmac_sha384_192)
|
||||
}
|
||||
|
||||
@ -532,7 +532,7 @@ static struct tegra_se_alg tegra_aes_algs[] = {
|
||||
.cra_name = "cbc(aes)",
|
||||
.cra_driver_name = "cbc-aes-tegra",
|
||||
.cra_priority = 500,
|
||||
.cra_flags = CRYPTO_ALG_TYPE_SKCIPHER | CRYPTO_ALG_ASYNC,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC,
|
||||
.cra_blocksize = AES_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct tegra_aes_ctx),
|
||||
.cra_alignmask = 0xf,
|
||||
@ -553,7 +553,7 @@ static struct tegra_se_alg tegra_aes_algs[] = {
|
||||
.cra_name = "ecb(aes)",
|
||||
.cra_driver_name = "ecb-aes-tegra",
|
||||
.cra_priority = 500,
|
||||
.cra_flags = CRYPTO_ALG_TYPE_SKCIPHER | CRYPTO_ALG_ASYNC,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC,
|
||||
.cra_blocksize = AES_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct tegra_aes_ctx),
|
||||
.cra_alignmask = 0xf,
|
||||
@ -575,7 +575,7 @@ static struct tegra_se_alg tegra_aes_algs[] = {
|
||||
.cra_name = "ctr(aes)",
|
||||
.cra_driver_name = "ctr-aes-tegra",
|
||||
.cra_priority = 500,
|
||||
.cra_flags = CRYPTO_ALG_TYPE_SKCIPHER | CRYPTO_ALG_ASYNC,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC,
|
||||
.cra_blocksize = 1,
|
||||
.cra_ctxsize = sizeof(struct tegra_aes_ctx),
|
||||
.cra_alignmask = 0xf,
|
||||
@ -597,6 +597,7 @@ static struct tegra_se_alg tegra_aes_algs[] = {
|
||||
.cra_name = "xts(aes)",
|
||||
.cra_driver_name = "xts-aes-tegra",
|
||||
.cra_priority = 500,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC,
|
||||
.cra_blocksize = AES_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct tegra_aes_ctx),
|
||||
.cra_alignmask = (__alignof__(u64) - 1),
|
||||
@ -1200,6 +1201,7 @@ static int tegra_ccm_do_one_req(struct crypto_engine *engine, void *areq)
|
||||
struct crypto_aead *tfm = crypto_aead_reqtfm(req);
|
||||
struct tegra_aead_ctx *ctx = crypto_aead_ctx(tfm);
|
||||
struct tegra_se *se = ctx->se;
|
||||
unsigned int bufsize;
|
||||
int ret;
|
||||
|
||||
ret = tegra_ccm_crypt_init(req, se, rctx);
|
||||
@ -1209,19 +1211,19 @@ static int tegra_ccm_do_one_req(struct crypto_engine *engine, void *areq)
|
||||
rctx->key_id = ctx->key_id;
|
||||
|
||||
/* Allocate buffers required */
|
||||
rctx->inbuf.size = rctx->assoclen + rctx->authsize + rctx->cryptlen + 100;
|
||||
rctx->inbuf.buf = dma_alloc_coherent(ctx->se->dev, rctx->inbuf.size,
|
||||
bufsize = rctx->assoclen + rctx->authsize + rctx->cryptlen + 100;
|
||||
rctx->inbuf.size = bufsize;
|
||||
rctx->inbuf.buf = dma_alloc_coherent(ctx->se->dev, bufsize,
|
||||
&rctx->inbuf.addr, GFP_KERNEL);
|
||||
ret = -ENOMEM;
|
||||
if (!rctx->inbuf.buf)
|
||||
goto out_finalize;
|
||||
|
||||
rctx->outbuf.size = rctx->assoclen + rctx->authsize + rctx->cryptlen + 100;
|
||||
rctx->outbuf.buf = dma_alloc_coherent(ctx->se->dev, rctx->outbuf.size,
|
||||
rctx->outbuf.size = bufsize;
|
||||
rctx->outbuf.buf = dma_alloc_coherent(ctx->se->dev, bufsize,
|
||||
&rctx->outbuf.addr, GFP_KERNEL);
|
||||
if (!rctx->outbuf.buf) {
|
||||
ret = -ENOMEM;
|
||||
if (!rctx->outbuf.buf)
|
||||
goto out_free_inbuf;
|
||||
}
|
||||
|
||||
if (!ctx->key_id) {
|
||||
ret = tegra_key_submit_reserved_aes(ctx->se, ctx->key,
|
||||
@ -1253,11 +1255,11 @@ static int tegra_ccm_do_one_req(struct crypto_engine *engine, void *areq)
|
||||
}
|
||||
|
||||
out:
|
||||
dma_free_coherent(ctx->se->dev, rctx->inbuf.size,
|
||||
dma_free_coherent(ctx->se->dev, bufsize,
|
||||
rctx->outbuf.buf, rctx->outbuf.addr);
|
||||
|
||||
out_free_inbuf:
|
||||
dma_free_coherent(ctx->se->dev, rctx->outbuf.size,
|
||||
dma_free_coherent(ctx->se->dev, bufsize,
|
||||
rctx->inbuf.buf, rctx->inbuf.addr);
|
||||
|
||||
if (tegra_key_is_reserved(rctx->key_id))
|
||||
@ -1277,6 +1279,7 @@ static int tegra_gcm_do_one_req(struct crypto_engine *engine, void *areq)
|
||||
struct crypto_aead *tfm = crypto_aead_reqtfm(req);
|
||||
struct tegra_aead_ctx *ctx = crypto_aead_ctx(tfm);
|
||||
struct tegra_aead_reqctx *rctx = aead_request_ctx(req);
|
||||
unsigned int bufsize;
|
||||
int ret;
|
||||
|
||||
rctx->src_sg = req->src;
|
||||
@ -1295,16 +1298,17 @@ static int tegra_gcm_do_one_req(struct crypto_engine *engine, void *areq)
|
||||
rctx->key_id = ctx->key_id;
|
||||
|
||||
/* Allocate buffers required */
|
||||
rctx->inbuf.size = rctx->assoclen + rctx->authsize + rctx->cryptlen;
|
||||
rctx->inbuf.buf = dma_alloc_coherent(ctx->se->dev, rctx->inbuf.size,
|
||||
bufsize = rctx->assoclen + rctx->authsize + rctx->cryptlen;
|
||||
rctx->inbuf.size = bufsize;
|
||||
rctx->inbuf.buf = dma_alloc_coherent(ctx->se->dev, bufsize,
|
||||
&rctx->inbuf.addr, GFP_KERNEL);
|
||||
if (!rctx->inbuf.buf) {
|
||||
ret = -ENOMEM;
|
||||
goto out_finalize;
|
||||
}
|
||||
|
||||
rctx->outbuf.size = rctx->assoclen + rctx->authsize + rctx->cryptlen;
|
||||
rctx->outbuf.buf = dma_alloc_coherent(ctx->se->dev, rctx->outbuf.size,
|
||||
rctx->outbuf.size = bufsize;
|
||||
rctx->outbuf.buf = dma_alloc_coherent(ctx->se->dev, bufsize,
|
||||
&rctx->outbuf.addr, GFP_KERNEL);
|
||||
if (!rctx->outbuf.buf) {
|
||||
ret = -ENOMEM;
|
||||
@ -1341,11 +1345,11 @@ static int tegra_gcm_do_one_req(struct crypto_engine *engine, void *areq)
|
||||
ret = tegra_gcm_do_verify(ctx->se, rctx);
|
||||
|
||||
out:
|
||||
dma_free_coherent(ctx->se->dev, rctx->outbuf.size,
|
||||
dma_free_coherent(ctx->se->dev, bufsize,
|
||||
rctx->outbuf.buf, rctx->outbuf.addr);
|
||||
|
||||
out_free_inbuf:
|
||||
dma_free_coherent(ctx->se->dev, rctx->inbuf.size,
|
||||
dma_free_coherent(ctx->se->dev, bufsize,
|
||||
rctx->inbuf.buf, rctx->inbuf.addr);
|
||||
|
||||
if (tegra_key_is_reserved(rctx->key_id))
|
||||
@ -1931,6 +1935,7 @@ static struct tegra_se_alg tegra_aead_algs[] = {
|
||||
.cra_name = "gcm(aes)",
|
||||
.cra_driver_name = "gcm-aes-tegra",
|
||||
.cra_priority = 500,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC,
|
||||
.cra_blocksize = 1,
|
||||
.cra_ctxsize = sizeof(struct tegra_aead_ctx),
|
||||
.cra_alignmask = 0xf,
|
||||
@ -1953,6 +1958,7 @@ static struct tegra_se_alg tegra_aead_algs[] = {
|
||||
.cra_name = "ccm(aes)",
|
||||
.cra_driver_name = "ccm-aes-tegra",
|
||||
.cra_priority = 500,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC,
|
||||
.cra_blocksize = 1,
|
||||
.cra_ctxsize = sizeof(struct tegra_aead_ctx),
|
||||
.cra_alignmask = 0xf,
|
||||
@ -1980,7 +1986,7 @@ static struct tegra_se_alg tegra_cmac_algs[] = {
|
||||
.cra_name = "cmac(aes)",
|
||||
.cra_driver_name = "tegra-se-cmac",
|
||||
.cra_priority = 300,
|
||||
.cra_flags = CRYPTO_ALG_TYPE_AHASH,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC,
|
||||
.cra_blocksize = AES_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct tegra_cmac_ctx),
|
||||
.cra_alignmask = 0,
|
||||
|
||||
@ -118,8 +118,9 @@ static int tegra_sha_fallback_init(struct ahash_request *req)
|
||||
struct tegra_sha_ctx *ctx = crypto_ahash_ctx(tfm);
|
||||
|
||||
ahash_request_set_tfm(&rctx->fallback_req, ctx->fallback_tfm);
|
||||
rctx->fallback_req.base.flags = req->base.flags &
|
||||
CRYPTO_TFM_REQ_MAY_SLEEP;
|
||||
ahash_request_set_callback(&rctx->fallback_req,
|
||||
req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP,
|
||||
req->base.complete, req->base.data);
|
||||
|
||||
return crypto_ahash_init(&rctx->fallback_req);
|
||||
}
|
||||
@ -131,10 +132,10 @@ static int tegra_sha_fallback_update(struct ahash_request *req)
|
||||
struct tegra_sha_ctx *ctx = crypto_ahash_ctx(tfm);
|
||||
|
||||
ahash_request_set_tfm(&rctx->fallback_req, ctx->fallback_tfm);
|
||||
rctx->fallback_req.base.flags = req->base.flags &
|
||||
CRYPTO_TFM_REQ_MAY_SLEEP;
|
||||
rctx->fallback_req.nbytes = req->nbytes;
|
||||
rctx->fallback_req.src = req->src;
|
||||
ahash_request_set_callback(&rctx->fallback_req,
|
||||
req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP,
|
||||
req->base.complete, req->base.data);
|
||||
ahash_request_set_crypt(&rctx->fallback_req, req->src, NULL, req->nbytes);
|
||||
|
||||
return crypto_ahash_update(&rctx->fallback_req);
|
||||
}
|
||||
@ -146,9 +147,10 @@ static int tegra_sha_fallback_final(struct ahash_request *req)
|
||||
struct tegra_sha_ctx *ctx = crypto_ahash_ctx(tfm);
|
||||
|
||||
ahash_request_set_tfm(&rctx->fallback_req, ctx->fallback_tfm);
|
||||
rctx->fallback_req.base.flags = req->base.flags &
|
||||
CRYPTO_TFM_REQ_MAY_SLEEP;
|
||||
rctx->fallback_req.result = req->result;
|
||||
ahash_request_set_callback(&rctx->fallback_req,
|
||||
req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP,
|
||||
req->base.complete, req->base.data);
|
||||
ahash_request_set_crypt(&rctx->fallback_req, NULL, req->result, 0);
|
||||
|
||||
return crypto_ahash_final(&rctx->fallback_req);
|
||||
}
|
||||
@ -160,12 +162,11 @@ static int tegra_sha_fallback_finup(struct ahash_request *req)
|
||||
struct tegra_sha_ctx *ctx = crypto_ahash_ctx(tfm);
|
||||
|
||||
ahash_request_set_tfm(&rctx->fallback_req, ctx->fallback_tfm);
|
||||
rctx->fallback_req.base.flags = req->base.flags &
|
||||
CRYPTO_TFM_REQ_MAY_SLEEP;
|
||||
|
||||
rctx->fallback_req.nbytes = req->nbytes;
|
||||
rctx->fallback_req.src = req->src;
|
||||
rctx->fallback_req.result = req->result;
|
||||
ahash_request_set_callback(&rctx->fallback_req,
|
||||
req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP,
|
||||
req->base.complete, req->base.data);
|
||||
ahash_request_set_crypt(&rctx->fallback_req, req->src, req->result,
|
||||
req->nbytes);
|
||||
|
||||
return crypto_ahash_finup(&rctx->fallback_req);
|
||||
}
|
||||
@ -177,12 +178,11 @@ static int tegra_sha_fallback_digest(struct ahash_request *req)
|
||||
struct tegra_sha_ctx *ctx = crypto_ahash_ctx(tfm);
|
||||
|
||||
ahash_request_set_tfm(&rctx->fallback_req, ctx->fallback_tfm);
|
||||
rctx->fallback_req.base.flags = req->base.flags &
|
||||
CRYPTO_TFM_REQ_MAY_SLEEP;
|
||||
|
||||
rctx->fallback_req.nbytes = req->nbytes;
|
||||
rctx->fallback_req.src = req->src;
|
||||
rctx->fallback_req.result = req->result;
|
||||
ahash_request_set_callback(&rctx->fallback_req,
|
||||
req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP,
|
||||
req->base.complete, req->base.data);
|
||||
ahash_request_set_crypt(&rctx->fallback_req, req->src, req->result,
|
||||
req->nbytes);
|
||||
|
||||
return crypto_ahash_digest(&rctx->fallback_req);
|
||||
}
|
||||
@ -194,8 +194,9 @@ static int tegra_sha_fallback_import(struct ahash_request *req, const void *in)
|
||||
struct tegra_sha_ctx *ctx = crypto_ahash_ctx(tfm);
|
||||
|
||||
ahash_request_set_tfm(&rctx->fallback_req, ctx->fallback_tfm);
|
||||
rctx->fallback_req.base.flags = req->base.flags &
|
||||
CRYPTO_TFM_REQ_MAY_SLEEP;
|
||||
ahash_request_set_callback(&rctx->fallback_req,
|
||||
req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP,
|
||||
req->base.complete, req->base.data);
|
||||
|
||||
return crypto_ahash_import(&rctx->fallback_req, in);
|
||||
}
|
||||
@ -207,8 +208,9 @@ static int tegra_sha_fallback_export(struct ahash_request *req, void *out)
|
||||
struct tegra_sha_ctx *ctx = crypto_ahash_ctx(tfm);
|
||||
|
||||
ahash_request_set_tfm(&rctx->fallback_req, ctx->fallback_tfm);
|
||||
rctx->fallback_req.base.flags = req->base.flags &
|
||||
CRYPTO_TFM_REQ_MAY_SLEEP;
|
||||
ahash_request_set_callback(&rctx->fallback_req,
|
||||
req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP,
|
||||
req->base.complete, req->base.data);
|
||||
|
||||
return crypto_ahash_export(&rctx->fallback_req, out);
|
||||
}
|
||||
@ -399,8 +401,9 @@ static int tegra_sha_do_update(struct ahash_request *req)
|
||||
struct tegra_sha_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(req));
|
||||
struct tegra_sha_reqctx *rctx = ahash_request_ctx(req);
|
||||
struct tegra_se *se = ctx->se;
|
||||
unsigned int nblks, nresidue, size, ret;
|
||||
unsigned int nblks, nresidue, size;
|
||||
u32 *cpuvaddr = se->cmdbuf->addr;
|
||||
int ret;
|
||||
|
||||
nresidue = (req->nbytes + rctx->residue.size) % rctx->blk_size;
|
||||
nblks = (req->nbytes + rctx->residue.size) / rctx->blk_size;
|
||||
@ -761,7 +764,7 @@ static struct tegra_se_alg tegra_hash_algs[] = {
|
||||
.cra_name = "sha1",
|
||||
.cra_driver_name = "tegra-se-sha1",
|
||||
.cra_priority = 300,
|
||||
.cra_flags = CRYPTO_ALG_TYPE_AHASH,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC,
|
||||
.cra_blocksize = SHA1_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct tegra_sha_ctx),
|
||||
.cra_alignmask = 0,
|
||||
@ -786,7 +789,7 @@ static struct tegra_se_alg tegra_hash_algs[] = {
|
||||
.cra_name = "sha224",
|
||||
.cra_driver_name = "tegra-se-sha224",
|
||||
.cra_priority = 300,
|
||||
.cra_flags = CRYPTO_ALG_TYPE_AHASH,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC,
|
||||
.cra_blocksize = SHA224_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct tegra_sha_ctx),
|
||||
.cra_alignmask = 0,
|
||||
@ -811,7 +814,7 @@ static struct tegra_se_alg tegra_hash_algs[] = {
|
||||
.cra_name = "sha256",
|
||||
.cra_driver_name = "tegra-se-sha256",
|
||||
.cra_priority = 300,
|
||||
.cra_flags = CRYPTO_ALG_TYPE_AHASH,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC,
|
||||
.cra_blocksize = SHA256_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct tegra_sha_ctx),
|
||||
.cra_alignmask = 0,
|
||||
@ -836,7 +839,7 @@ static struct tegra_se_alg tegra_hash_algs[] = {
|
||||
.cra_name = "sha384",
|
||||
.cra_driver_name = "tegra-se-sha384",
|
||||
.cra_priority = 300,
|
||||
.cra_flags = CRYPTO_ALG_TYPE_AHASH,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC,
|
||||
.cra_blocksize = SHA384_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct tegra_sha_ctx),
|
||||
.cra_alignmask = 0,
|
||||
@ -861,7 +864,7 @@ static struct tegra_se_alg tegra_hash_algs[] = {
|
||||
.cra_name = "sha512",
|
||||
.cra_driver_name = "tegra-se-sha512",
|
||||
.cra_priority = 300,
|
||||
.cra_flags = CRYPTO_ALG_TYPE_AHASH,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC,
|
||||
.cra_blocksize = SHA512_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct tegra_sha_ctx),
|
||||
.cra_alignmask = 0,
|
||||
@ -886,7 +889,7 @@ static struct tegra_se_alg tegra_hash_algs[] = {
|
||||
.cra_name = "sha3-224",
|
||||
.cra_driver_name = "tegra-se-sha3-224",
|
||||
.cra_priority = 300,
|
||||
.cra_flags = CRYPTO_ALG_TYPE_AHASH,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC,
|
||||
.cra_blocksize = SHA3_224_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct tegra_sha_ctx),
|
||||
.cra_alignmask = 0,
|
||||
@ -911,7 +914,7 @@ static struct tegra_se_alg tegra_hash_algs[] = {
|
||||
.cra_name = "sha3-256",
|
||||
.cra_driver_name = "tegra-se-sha3-256",
|
||||
.cra_priority = 300,
|
||||
.cra_flags = CRYPTO_ALG_TYPE_AHASH,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC,
|
||||
.cra_blocksize = SHA3_256_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct tegra_sha_ctx),
|
||||
.cra_alignmask = 0,
|
||||
@ -936,7 +939,7 @@ static struct tegra_se_alg tegra_hash_algs[] = {
|
||||
.cra_name = "sha3-384",
|
||||
.cra_driver_name = "tegra-se-sha3-384",
|
||||
.cra_priority = 300,
|
||||
.cra_flags = CRYPTO_ALG_TYPE_AHASH,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC,
|
||||
.cra_blocksize = SHA3_384_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct tegra_sha_ctx),
|
||||
.cra_alignmask = 0,
|
||||
@ -961,7 +964,7 @@ static struct tegra_se_alg tegra_hash_algs[] = {
|
||||
.cra_name = "sha3-512",
|
||||
.cra_driver_name = "tegra-se-sha3-512",
|
||||
.cra_priority = 300,
|
||||
.cra_flags = CRYPTO_ALG_TYPE_AHASH,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC,
|
||||
.cra_blocksize = SHA3_512_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct tegra_sha_ctx),
|
||||
.cra_alignmask = 0,
|
||||
@ -988,7 +991,8 @@ static struct tegra_se_alg tegra_hash_algs[] = {
|
||||
.cra_name = "hmac(sha224)",
|
||||
.cra_driver_name = "tegra-se-hmac-sha224",
|
||||
.cra_priority = 300,
|
||||
.cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_NEED_FALLBACK,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC |
|
||||
CRYPTO_ALG_NEED_FALLBACK,
|
||||
.cra_blocksize = SHA224_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct tegra_sha_ctx),
|
||||
.cra_alignmask = 0,
|
||||
@ -1015,7 +1019,8 @@ static struct tegra_se_alg tegra_hash_algs[] = {
|
||||
.cra_name = "hmac(sha256)",
|
||||
.cra_driver_name = "tegra-se-hmac-sha256",
|
||||
.cra_priority = 300,
|
||||
.cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_NEED_FALLBACK,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC |
|
||||
CRYPTO_ALG_NEED_FALLBACK,
|
||||
.cra_blocksize = SHA256_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct tegra_sha_ctx),
|
||||
.cra_alignmask = 0,
|
||||
@ -1042,7 +1047,8 @@ static struct tegra_se_alg tegra_hash_algs[] = {
|
||||
.cra_name = "hmac(sha384)",
|
||||
.cra_driver_name = "tegra-se-hmac-sha384",
|
||||
.cra_priority = 300,
|
||||
.cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_NEED_FALLBACK,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC |
|
||||
CRYPTO_ALG_NEED_FALLBACK,
|
||||
.cra_blocksize = SHA384_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct tegra_sha_ctx),
|
||||
.cra_alignmask = 0,
|
||||
@ -1069,7 +1075,8 @@ static struct tegra_se_alg tegra_hash_algs[] = {
|
||||
.cra_name = "hmac(sha512)",
|
||||
.cra_driver_name = "tegra-se-hmac-sha512",
|
||||
.cra_priority = 300,
|
||||
.cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_NEED_FALLBACK,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC |
|
||||
CRYPTO_ALG_NEED_FALLBACK,
|
||||
.cra_blocksize = SHA512_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct tegra_sha_ctx),
|
||||
.cra_alignmask = 0,
|
||||
|
||||
@ -52,7 +52,7 @@ tegra_se_cmdbuf_pin(struct device *dev, struct host1x_bo *bo, enum dma_data_dire
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
kref_init(&map->ref);
|
||||
map->bo = host1x_bo_get(bo);
|
||||
map->bo = bo;
|
||||
map->direction = direction;
|
||||
map->dev = dev;
|
||||
|
||||
@ -93,7 +93,6 @@ static void tegra_se_cmdbuf_unpin(struct host1x_bo_mapping *map)
|
||||
dma_unmap_sgtable(map->dev, map->sgt, map->direction, 0);
|
||||
sg_free_table(map->sgt);
|
||||
kfree(map->sgt);
|
||||
host1x_bo_put(map->bo);
|
||||
|
||||
kfree(map);
|
||||
}
|
||||
@ -310,7 +309,7 @@ static int tegra_se_probe(struct platform_device *pdev)
|
||||
|
||||
se->engine = crypto_engine_alloc_init(dev, 0);
|
||||
if (!se->engine)
|
||||
return dev_err_probe(dev, -ENOMEM, "failed to init crypto engine\n");
|
||||
return -ENOMEM;
|
||||
|
||||
ret = crypto_engine_start(se->engine);
|
||||
if (ret) {
|
||||
|
||||
@ -1645,7 +1645,7 @@ qla2x00_fw_state_show(struct device *dev, struct device_attribute *attr,
|
||||
{
|
||||
scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
|
||||
int rval = QLA_FUNCTION_FAILED;
|
||||
uint16_t state[6];
|
||||
uint16_t state[16];
|
||||
uint32_t pstate;
|
||||
|
||||
if (IS_QLAFX00(vha->hw)) {
|
||||
@ -2409,6 +2409,63 @@ qla2x00_dport_diagnostics_show(struct device *dev,
|
||||
vha->dport_data[0], vha->dport_data[1],
|
||||
vha->dport_data[2], vha->dport_data[3]);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
qla2x00_mpi_fw_state_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
|
||||
int rval = QLA_FUNCTION_FAILED;
|
||||
u16 state[16];
|
||||
u16 mpi_state;
|
||||
struct qla_hw_data *ha = vha->hw;
|
||||
|
||||
if (!(IS_QLA27XX(ha) || IS_QLA28XX(ha)))
|
||||
return scnprintf(buf, PAGE_SIZE,
|
||||
"MPI state reporting is not supported for this HBA.\n");
|
||||
|
||||
memset(state, 0, sizeof(state));
|
||||
|
||||
mutex_lock(&vha->hw->optrom_mutex);
|
||||
if (qla2x00_chip_is_down(vha)) {
|
||||
mutex_unlock(&vha->hw->optrom_mutex);
|
||||
ql_dbg(ql_dbg_user, vha, 0x70df,
|
||||
"ISP reset is in progress, failing mpi_fw_state.\n");
|
||||
return -EBUSY;
|
||||
} else if (vha->hw->flags.eeh_busy) {
|
||||
mutex_unlock(&vha->hw->optrom_mutex);
|
||||
ql_dbg(ql_dbg_user, vha, 0x70ea,
|
||||
"HBA in PCI error state, failing mpi_fw_state.\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
rval = qla2x00_get_firmware_state(vha, state);
|
||||
mutex_unlock(&vha->hw->optrom_mutex);
|
||||
if (rval != QLA_SUCCESS) {
|
||||
ql_dbg(ql_dbg_user, vha, 0x70eb,
|
||||
"MB Command to retrieve MPI state failed (%d), failing mpi_fw_state.\n",
|
||||
rval);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
mpi_state = state[11];
|
||||
|
||||
if (!(mpi_state & BIT_15))
|
||||
return scnprintf(buf, PAGE_SIZE,
|
||||
"MPI firmware state reporting is not supported by this firmware. (0x%02x)\n",
|
||||
mpi_state);
|
||||
|
||||
if (!(mpi_state & BIT_8))
|
||||
return scnprintf(buf, PAGE_SIZE,
|
||||
"MPI firmware is disabled. (0x%02x)\n",
|
||||
mpi_state);
|
||||
|
||||
return scnprintf(buf, PAGE_SIZE,
|
||||
"MPI firmware is enabled, state is %s. (0x%02x)\n",
|
||||
mpi_state & BIT_9 ? "active" : "inactive",
|
||||
mpi_state);
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(dport_diagnostics, 0444,
|
||||
qla2x00_dport_diagnostics_show, NULL);
|
||||
|
||||
@ -2476,6 +2533,8 @@ static DEVICE_ATTR(port_speed, 0644, qla2x00_port_speed_show,
|
||||
qla2x00_port_speed_store);
|
||||
static DEVICE_ATTR(port_no, 0444, qla2x00_port_no_show, NULL);
|
||||
static DEVICE_ATTR(fw_attr, 0444, qla2x00_fw_attr_show, NULL);
|
||||
static DEVICE_ATTR(mpi_fw_state, 0444, qla2x00_mpi_fw_state_show, NULL);
|
||||
|
||||
|
||||
|
||||
struct device_attribute *qla2x00_host_attrs[] = {
|
||||
@ -2525,6 +2584,7 @@ struct device_attribute *qla2x00_host_attrs[] = {
|
||||
NULL, /* reserve for qlini_mode */
|
||||
NULL, /* reserve for ql2xiniexchg */
|
||||
NULL, /* reserve for ql2xexchoffld */
|
||||
&dev_attr_mpi_fw_state,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
||||
@ -4916,7 +4916,7 @@ qla2x00_fw_ready(scsi_qla_host_t *vha)
|
||||
unsigned long wtime, mtime, cs84xx_time;
|
||||
uint16_t min_wait; /* Minimum wait time if loop is down */
|
||||
uint16_t wait_time; /* Wait time if loop is coming ready */
|
||||
uint16_t state[6];
|
||||
uint16_t state[16];
|
||||
struct qla_hw_data *ha = vha->hw;
|
||||
|
||||
if (IS_QLAFX00(vha->hw))
|
||||
|
||||
@ -2266,6 +2266,13 @@ qla2x00_get_firmware_state(scsi_qla_host_t *vha, uint16_t *states)
|
||||
mcp->in_mb = MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0;
|
||||
else
|
||||
mcp->in_mb = MBX_1|MBX_0;
|
||||
|
||||
if (IS_QLA27XX(ha) || IS_QLA28XX(ha)) {
|
||||
mcp->mb[12] = 0;
|
||||
mcp->out_mb |= MBX_12;
|
||||
mcp->in_mb |= MBX_12;
|
||||
}
|
||||
|
||||
mcp->tov = MBX_TOV_SECONDS;
|
||||
mcp->flags = 0;
|
||||
rval = qla2x00_mailbox_command(vha, mcp);
|
||||
@ -2278,6 +2285,8 @@ qla2x00_get_firmware_state(scsi_qla_host_t *vha, uint16_t *states)
|
||||
states[3] = mcp->mb[4];
|
||||
states[4] = mcp->mb[5];
|
||||
states[5] = mcp->mb[6]; /* DPORT status */
|
||||
if (IS_QLA27XX(ha) || IS_QLA28XX(ha))
|
||||
states[11] = mcp->mb[12]; /* MPI state. */
|
||||
}
|
||||
|
||||
if (rval != QLA_SUCCESS) {
|
||||
|
||||
@ -41,7 +41,9 @@ struct inet_connection_sock_af_ops {
|
||||
struct request_sock *req,
|
||||
struct dst_entry *dst,
|
||||
struct request_sock *req_unhash,
|
||||
bool *own_req);
|
||||
bool *own_req,
|
||||
void (*opt_child_init)(struct sock *newsk,
|
||||
const struct sock *sk));
|
||||
u16 net_header_len;
|
||||
u16 net_frag_header_len;
|
||||
u16 sockaddr_len;
|
||||
|
||||
@ -470,7 +470,9 @@ struct sock *tcp_v4_syn_recv_sock(const struct sock *sk, struct sk_buff *skb,
|
||||
struct request_sock *req,
|
||||
struct dst_entry *dst,
|
||||
struct request_sock *req_unhash,
|
||||
bool *own_req);
|
||||
bool *own_req,
|
||||
void (*opt_child_init)(struct sock *newsk,
|
||||
const struct sock *sk));
|
||||
int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb);
|
||||
int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len);
|
||||
int tcp_connect(struct sock *sk);
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md
|
||||
kernel.rhel,1,Red Hat,kernel-core,5.14.0-687.19.1.el9.x86_64,mailto:secalert@redhat.com
|
||||
kernel.almalinux,1,AlmaLinux,kernel-core,5.14.0-687.19.1.el9.x86_64,mailto:security@almalinux.org
|
||||
kernel.rhel,1,Red Hat,kernel-core,5.14.0-687.20.1.el9.x86_64,mailto:secalert@redhat.com
|
||||
kernel.almalinux,1,AlmaLinux,kernel-core,5.14.0-687.20.1.el9.x86_64,mailto:security@almalinux.org
|
||||
|
||||
@ -22,6 +22,36 @@
|
||||
|
||||
struct atm_vcc *sigd = NULL;
|
||||
|
||||
/*
|
||||
* find_get_vcc - validate and get a reference to a vcc pointer
|
||||
* @vcc: the vcc pointer to validate
|
||||
*
|
||||
* This function validates that @vcc points to a registered VCC in vcc_hash.
|
||||
* If found, it increments the socket reference count and returns the vcc.
|
||||
* The caller must call sock_put(sk_atm(vcc)) when done.
|
||||
*
|
||||
* Returns the vcc pointer if valid, NULL otherwise.
|
||||
*/
|
||||
static struct atm_vcc *find_get_vcc(struct atm_vcc *vcc)
|
||||
{
|
||||
int i;
|
||||
|
||||
read_lock(&vcc_sklist_lock);
|
||||
for (i = 0; i < VCC_HTABLE_SIZE; i++) {
|
||||
struct sock *s;
|
||||
|
||||
sk_for_each(s, &vcc_hash[i]) {
|
||||
if (atm_sk(s) == vcc) {
|
||||
sock_hold(s);
|
||||
read_unlock(&vcc_sklist_lock);
|
||||
return vcc;
|
||||
}
|
||||
}
|
||||
}
|
||||
read_unlock(&vcc_sklist_lock);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void sigd_put_skb(struct sk_buff *skb)
|
||||
{
|
||||
if (!sigd) {
|
||||
@ -69,7 +99,14 @@ static int sigd_send(struct atm_vcc *vcc, struct sk_buff *skb)
|
||||
|
||||
msg = (struct atmsvc_msg *) skb->data;
|
||||
WARN_ON(refcount_sub_and_test(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc));
|
||||
vcc = *(struct atm_vcc **) &msg->vcc;
|
||||
|
||||
vcc = find_get_vcc(*(struct atm_vcc **)&msg->vcc);
|
||||
if (!vcc) {
|
||||
pr_debug("invalid vcc pointer in msg\n");
|
||||
dev_kfree_skb(skb);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
pr_debug("%d (0x%lx)\n", (int)msg->type, (unsigned long)vcc);
|
||||
sk = sk_atm(vcc);
|
||||
|
||||
@ -100,7 +137,16 @@ static int sigd_send(struct atm_vcc *vcc, struct sk_buff *skb)
|
||||
clear_bit(ATM_VF_WAITING, &vcc->flags);
|
||||
break;
|
||||
case as_indicate:
|
||||
vcc = *(struct atm_vcc **)&msg->listen_vcc;
|
||||
/* Release the reference from msg->vcc, we'll use msg->listen_vcc instead */
|
||||
sock_put(sk);
|
||||
|
||||
vcc = find_get_vcc(*(struct atm_vcc **)&msg->listen_vcc);
|
||||
if (!vcc) {
|
||||
pr_debug("invalid listen_vcc pointer in msg\n");
|
||||
dev_kfree_skb(skb);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
sk = sk_atm(vcc);
|
||||
pr_debug("as_indicate!!!\n");
|
||||
lock_sock(sk);
|
||||
@ -115,6 +161,8 @@ static int sigd_send(struct atm_vcc *vcc, struct sk_buff *skb)
|
||||
sk->sk_state_change(sk);
|
||||
as_indicate_complete:
|
||||
release_sock(sk);
|
||||
/* Paired with find_get_vcc(msg->listen_vcc) above */
|
||||
sock_put(sk);
|
||||
return 0;
|
||||
case as_close:
|
||||
set_bit(ATM_VF_RELEASED, &vcc->flags);
|
||||
@ -131,11 +179,15 @@ as_indicate_complete:
|
||||
break;
|
||||
default:
|
||||
pr_alert("bad message type %d\n", (int)msg->type);
|
||||
/* Paired with find_get_vcc(msg->vcc) above */
|
||||
sock_put(sk);
|
||||
return -EINVAL;
|
||||
}
|
||||
sk->sk_state_change(sk);
|
||||
out:
|
||||
dev_kfree_skb(skb);
|
||||
/* Paired with find_get_vcc(msg->vcc) above */
|
||||
sock_put(sk);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -201,7 +201,7 @@ struct sock *tcp_get_cookie_sock(struct sock *sk, struct sk_buff *skb,
|
||||
bool own_req;
|
||||
|
||||
child = icsk->icsk_af_ops->syn_recv_sock(sk, skb, req, dst,
|
||||
NULL, &own_req);
|
||||
NULL, &own_req, NULL);
|
||||
if (child) {
|
||||
refcount_set(&req->rsk_refcnt, 1);
|
||||
tcp_sk(child)->tsoffset = tsoff;
|
||||
|
||||
@ -262,7 +262,7 @@ static struct sock *tcp_fastopen_create_child(struct sock *sk,
|
||||
bool own_req;
|
||||
|
||||
child = inet_csk(sk)->icsk_af_ops->syn_recv_sock(sk, skb, req, NULL,
|
||||
NULL, &own_req);
|
||||
NULL, &own_req, NULL);
|
||||
if (!child)
|
||||
return NULL;
|
||||
|
||||
|
||||
@ -1499,7 +1499,9 @@ struct sock *tcp_v4_syn_recv_sock(const struct sock *sk, struct sk_buff *skb,
|
||||
struct request_sock *req,
|
||||
struct dst_entry *dst,
|
||||
struct request_sock *req_unhash,
|
||||
bool *own_req)
|
||||
bool *own_req,
|
||||
void (*opt_child_init)(struct sock *newsk,
|
||||
const struct sock *sk))
|
||||
{
|
||||
struct inet_request_sock *ireq;
|
||||
bool found_dup_sk = false;
|
||||
@ -1555,6 +1557,10 @@ struct sock *tcp_v4_syn_recv_sock(const struct sock *sk, struct sk_buff *skb,
|
||||
}
|
||||
sk_setup_caps(newsk, dst);
|
||||
|
||||
#if IS_ENABLED(CONFIG_IPV6)
|
||||
if (opt_child_init)
|
||||
opt_child_init(newsk, sk);
|
||||
#endif
|
||||
tcp_ca_openreq_child(newsk, dst);
|
||||
|
||||
tcp_sync_mss(newsk, dst_mtu(dst));
|
||||
|
||||
@ -782,7 +782,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
|
||||
* socket is created, wait for troubles.
|
||||
*/
|
||||
child = inet_csk(sk)->icsk_af_ops->syn_recv_sock(sk, skb, req, NULL,
|
||||
req, &own_req);
|
||||
req, &own_req, NULL);
|
||||
if (!child)
|
||||
goto listen_overflow;
|
||||
|
||||
|
||||
@ -1188,11 +1188,48 @@ static void tcp_v6_restore_cb(struct sk_buff *skb)
|
||||
sizeof(struct inet6_skb_parm));
|
||||
}
|
||||
|
||||
/* Called from tcp_v4_syn_recv_sock() for v6_mapped children. */
|
||||
static void tcp_v6_mapped_child_init(struct sock *newsk, const struct sock *sk)
|
||||
{
|
||||
struct inet_sock *newinet = inet_sk(newsk);
|
||||
struct ipv6_pinfo *newnp;
|
||||
|
||||
newinet->pinet6 = newnp = tcp_inet6_sk(newsk);
|
||||
|
||||
memcpy(newnp, tcp_inet6_sk(sk), sizeof(struct ipv6_pinfo));
|
||||
|
||||
newnp->saddr = newsk->sk_v6_rcv_saddr;
|
||||
|
||||
inet_csk(newsk)->icsk_af_ops = &ipv6_mapped;
|
||||
if (sk_is_mptcp(newsk))
|
||||
mptcpv6_handle_mapped(newsk, true);
|
||||
newsk->sk_backlog_rcv = tcp_v4_do_rcv;
|
||||
#if defined(CONFIG_TCP_MD5SIG)
|
||||
tcp_sk(newsk)->af_specific = &tcp_sock_ipv6_mapped_specific;
|
||||
#endif
|
||||
|
||||
newnp->ipv6_mc_list = NULL;
|
||||
newnp->ipv6_ac_list = NULL;
|
||||
newnp->ipv6_fl_list = NULL;
|
||||
newnp->pktoptions = NULL;
|
||||
newnp->opt = NULL;
|
||||
|
||||
/* tcp_v4_syn_recv_sock() has initialized newinet->mc_{index,ttl} */
|
||||
newnp->mcast_oif = newinet->mc_index;
|
||||
newnp->mcast_hops = newinet->mc_ttl;
|
||||
|
||||
newnp->rcv_flowinfo = 0;
|
||||
if (tcp_inet6_sk(sk)->repflow)
|
||||
newnp->flow_label = 0;
|
||||
}
|
||||
|
||||
static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *skb,
|
||||
struct request_sock *req,
|
||||
struct dst_entry *dst,
|
||||
struct request_sock *req_unhash,
|
||||
bool *own_req)
|
||||
bool *own_req,
|
||||
void (*opt_child_init)(struct sock *newsk,
|
||||
const struct sock *sk))
|
||||
{
|
||||
struct inet_request_sock *ireq;
|
||||
struct ipv6_pinfo *newnp;
|
||||
@ -1208,61 +1245,10 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *
|
||||
#endif
|
||||
struct flowi6 fl6;
|
||||
|
||||
if (skb->protocol == htons(ETH_P_IP)) {
|
||||
/*
|
||||
* v6 mapped
|
||||
*/
|
||||
|
||||
newsk = tcp_v4_syn_recv_sock(sk, skb, req, dst,
|
||||
req_unhash, own_req);
|
||||
|
||||
if (!newsk)
|
||||
return NULL;
|
||||
|
||||
inet_sk(newsk)->pinet6 = tcp_inet6_sk(newsk);
|
||||
|
||||
newinet = inet_sk(newsk);
|
||||
newnp = tcp_inet6_sk(newsk);
|
||||
newtp = tcp_sk(newsk);
|
||||
|
||||
memcpy(newnp, np, sizeof(struct ipv6_pinfo));
|
||||
|
||||
newnp->saddr = newsk->sk_v6_rcv_saddr;
|
||||
|
||||
inet_csk(newsk)->icsk_af_ops = &ipv6_mapped;
|
||||
if (sk_is_mptcp(newsk))
|
||||
mptcpv6_handle_mapped(newsk, true);
|
||||
newsk->sk_backlog_rcv = tcp_v4_do_rcv;
|
||||
#ifdef CONFIG_TCP_MD5SIG
|
||||
newtp->af_specific = &tcp_sock_ipv6_mapped_specific;
|
||||
#endif
|
||||
|
||||
newnp->ipv6_mc_list = NULL;
|
||||
newnp->ipv6_ac_list = NULL;
|
||||
newnp->ipv6_fl_list = NULL;
|
||||
newnp->pktoptions = NULL;
|
||||
newnp->opt = NULL;
|
||||
newnp->mcast_oif = inet_iif(skb);
|
||||
newnp->mcast_hops = ip_hdr(skb)->ttl;
|
||||
newnp->rcv_flowinfo = 0;
|
||||
if (np->repflow)
|
||||
newnp->flow_label = 0;
|
||||
|
||||
/*
|
||||
* No need to charge this sock to the relevant IPv6 refcnt debug socks count
|
||||
* here, tcp_create_openreq_child now does this for us, see the comment in
|
||||
* that function for the gory details. -acme
|
||||
*/
|
||||
|
||||
/* It is tricky place. Until this moment IPv4 tcp
|
||||
worked with IPv6 icsk.icsk_af_ops.
|
||||
Sync it now.
|
||||
*/
|
||||
tcp_sync_mss(newsk, inet_csk(newsk)->icsk_pmtu_cookie);
|
||||
|
||||
return newsk;
|
||||
}
|
||||
|
||||
if (skb->protocol == htons(ETH_P_IP))
|
||||
return tcp_v4_syn_recv_sock(sk, skb, req, dst,
|
||||
req_unhash, own_req,
|
||||
tcp_v6_mapped_child_init);
|
||||
ireq = inet_rsk(req);
|
||||
|
||||
if (sk_acceptq_is_full(sk))
|
||||
|
||||
@ -805,7 +805,9 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
|
||||
struct request_sock *req,
|
||||
struct dst_entry *dst,
|
||||
struct request_sock *req_unhash,
|
||||
bool *own_req)
|
||||
bool *own_req,
|
||||
void (*opt_child_init)(struct sock *newsk,
|
||||
const struct sock *sk))
|
||||
{
|
||||
struct mptcp_subflow_context *listener = mptcp_subflow_ctx(sk);
|
||||
struct mptcp_subflow_request_sock *subflow_req;
|
||||
@ -852,7 +854,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
|
||||
|
||||
create_child:
|
||||
child = listener->icsk_af_ops->syn_recv_sock(sk, skb, req, dst,
|
||||
req_unhash, own_req);
|
||||
req_unhash, own_req, opt_child_init);
|
||||
|
||||
if (child && *own_req) {
|
||||
struct mptcp_subflow_context *ctx = mptcp_subflow_ctx(child);
|
||||
|
||||
@ -124,7 +124,9 @@ static struct sock *smc_tcp_syn_recv_sock(const struct sock *sk,
|
||||
struct request_sock *req,
|
||||
struct dst_entry *dst,
|
||||
struct request_sock *req_unhash,
|
||||
bool *own_req)
|
||||
bool *own_req,
|
||||
void (*opt_child_init)(struct sock *newsk,
|
||||
const struct sock *sk))
|
||||
{
|
||||
struct smc_sock *smc;
|
||||
struct sock *child;
|
||||
@ -142,7 +144,7 @@ static struct sock *smc_tcp_syn_recv_sock(const struct sock *sk,
|
||||
|
||||
/* passthrough to original syn recv sock fct */
|
||||
child = smc->ori_af_ops->syn_recv_sock(sk, skb, req, dst, req_unhash,
|
||||
own_req);
|
||||
own_req, opt_child_init);
|
||||
/* child must not inherit smc or its ops */
|
||||
if (child) {
|
||||
rcu_assign_sk_user_data(child, NULL);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user