X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=kernel-small_fixes.patch;h=dc2c31ff9b1c67f8176b7c034942e6a78f7a9b5b;hb=96f9c67f08faa78b1f5f4ad8404e371d811a1108;hp=6edbd9d974d0e1b262b129f8568bdfd122af3838;hpb=8ac0885f2bca74ae597f51e980418d50c9598d6f;p=packages%2Fkernel.git diff --git a/kernel-small_fixes.patch b/kernel-small_fixes.patch index 6edbd9d9..dc2c31ff 100644 --- a/kernel-small_fixes.patch +++ b/kernel-small_fixes.patch @@ -1,118 +1,109 @@ ---- linux-4.18/scripts/clang-version.sh~ 2018-08-12 22:41:04.000000000 +0200 -+++ linux-4.18/scripts/clang-version.sh 2018-08-12 23:52:07.650403870 +0200 -@@ -12,7 +12,7 @@ +; https://lkml.org/lkml/2019/7/10/244 +diff -ur linux-5.3/drivers/scsi/aacraid.org/aacraid.h linux-5.3/drivers/scsi/aacraid/aacraid.h +--- linux-5.3/drivers/scsi/aacraid.org/aacraid.h 2019-11-01 22:42:37.011469816 +0100 ++++ linux-5.3/drivers/scsi/aacraid/aacraid.h 2019-11-04 09:29:51.321486211 +0100 +@@ -2740,17 +2740,6 @@ + int aac_rx_deliver_producer(struct fib * fib); + void aac_reinit_aif(struct aac_dev *aac, unsigned int index); - compiler="$*" - --if !( $compiler --version | grep -q clang) ; then -+if ! ( $compiler --version | grep -q clang) ; then - echo 0 - exit 1 - fi -From 432061b3da64e488be3403124a72a9250bbe96d4 Mon Sep 17 00:00:00 2001 -From: Mikulas Patocka -Date: Wed, 5 Sep 2018 09:17:45 -0400 -Subject: dm: disable CRYPTO_TFM_REQ_MAY_SLEEP to fix a GFP_KERNEL recursion - deadlock - -There's a XFS on dm-crypt deadlock, recursing back to itself due to the -crypto subsystems use of GFP_KERNEL, reported here: -https://bugzilla.kernel.org/show_bug.cgi?id=200835 - -* dm-crypt calls crypt_convert in xts mode -* init_crypt from xts.c calls kmalloc(GFP_KERNEL) -* kmalloc(GFP_KERNEL) recurses into the XFS filesystem, the filesystem - tries to submit some bios and wait for them, causing a deadlock - -Fix this by updating both the DM crypt and integrity targets to no -longer use the CRYPTO_TFM_REQ_MAY_SLEEP flag, which will change the -crypto allocations from GFP_KERNEL to GFP_ATOMIC, therefore they can't -recurse into a filesystem. A GFP_ATOMIC allocation can fail, but -init_crypt() in xts.c handles the allocation failure gracefully - it -will fall back to preallocated buffer if the allocation fails. - -The crypto API maintainer says that the crypto API only needs to -allocate memory when dealing with unaligned buffers and therefore -turning CRYPTO_TFM_REQ_MAY_SLEEP off is safe (see this discussion: -https://www.redhat.com/archives/dm-devel/2018-August/msg00195.html ) - -Cc: stable@vger.kernel.org -Signed-off-by: Mikulas Patocka -Signed-off-by: Mike Snitzer ---- - drivers/md/dm-crypt.c | 10 +++++----- - drivers/md/dm-integrity.c | 4 ++-- - 2 files changed, 7 insertions(+), 7 deletions(-) - -diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c -index f266c81f396f..0481223b1deb 100644 -@@ -334,7 +334,7 @@ static int crypt_iv_essiv_init(struct cr - - sg_init_one(&sg, cc->key, cc->key_size); - ahash_request_set_tfm(req, essiv->hash_tfm); -- ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_SLEEP, NULL, NULL); -+ ahash_request_set_callback(req, 0, NULL, NULL); - ahash_request_set_crypt(req, &sg, essiv->salt, cc->key_size); +-static inline int aac_is_src(struct aac_dev *dev) +-{ +- u16 device = dev->pdev->device; +- +- if (device == PMC_DEVICE_S6 || +- device == PMC_DEVICE_S7 || +- device == PMC_DEVICE_S8) +- return 1; +- return 0; +-} +- + static inline int aac_supports_2T(struct aac_dev *dev) + { + return (dev->adapter_info.options & AAC_OPT_NEW_COMM_64); +diff -ur linux-5.3/drivers/scsi/aacraid.org/comminit.c linux-5.3/drivers/scsi/aacraid/comminit.c +--- linux-5.3/drivers/scsi/aacraid.org/comminit.c 2019-11-01 22:42:37.014803249 +0100 ++++ linux-5.3/drivers/scsi/aacraid/comminit.c 2019-11-04 09:29:51.321486211 +0100 +@@ -41,8 +41,11 @@ + { + u32 status = 0; - err = crypto_ahash_digest(req); -@@ -606,7 +606,7 @@ static int crypt_iv_lmk_one(struct crypt_config *cc, u8 *iv, - int i, r; +- if (aac_is_src(dev)) ++ if (dev->pdev->device == PMC_DEVICE_S6 || ++ dev->pdev->device == PMC_DEVICE_S7 || ++ dev->pdev->device == PMC_DEVICE_S8) { + status = src_readl(dev, MUnit.OMR); ++ } + return (status & AAC_INT_MODE_MSIX); + } - desc->tfm = lmk->hash_tfm; -- desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP; -+ desc->flags = 0; +@@ -349,7 +352,8 @@ + /* FIB should be freed only after getting the response from the F/W */ + if (status != -ERESTARTSYS) + aac_fib_free(fibctx); +- if (aac_is_src(dev) && ++ if ((dev->pdev->device == PMC_DEVICE_S7 || ++ dev->pdev->device == PMC_DEVICE_S8) && + dev->msi_enabled) + aac_set_intx_mode(dev); + return status; +@@ -610,7 +614,8 @@ + dev->max_fib_size = status[1] & 0xFFE0; + host->sg_tablesize = status[2] >> 16; + dev->sg_tablesize = status[2] & 0xFFFF; +- if (aac_is_src(dev)) { ++ if (dev->pdev->device == PMC_DEVICE_S7 || ++ dev->pdev->device == PMC_DEVICE_S8) { + if (host->can_queue > (status[3] >> 16) - + AAC_NUM_MGT_FIB) + host->can_queue = (status[3] >> 16) - +@@ -629,7 +634,9 @@ + pr_warn("numacb=%d ignored\n", numacb); + } - r = crypto_shash_init(desc); - if (r) -@@ -768,7 +768,7 @@ static int crypt_iv_tcw_whitening(struct crypt_config *cc, +- if (aac_is_src(dev)) ++ if (dev->pdev->device == PMC_DEVICE_S6 || ++ dev->pdev->device == PMC_DEVICE_S7 || ++ dev->pdev->device == PMC_DEVICE_S8) + aac_define_int_mode(dev); + /* + * Ok now init the communication subsystem +diff -ur linux-5.3/drivers/scsi/aacraid.org/commsup.c linux-5.3/drivers/scsi/aacraid/commsup.c +--- linux-5.3/drivers/scsi/aacraid.org/commsup.c 2019-11-01 22:42:37.014803249 +0100 ++++ linux-5.3/drivers/scsi/aacraid/commsup.c 2019-11-04 09:29:51.321486211 +0100 +@@ -2593,7 +2593,9 @@ + { + int i; - /* calculate crc32 for every 32bit part and xor it */ - desc->tfm = tcw->crc32_tfm; -- desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP; -+ desc->flags = 0; - for (i = 0; i < 4; i++) { - r = crypto_shash_init(desc); - if (r) -@@ -1251,7 +1251,7 @@ static void crypt_alloc_req_skcipher(struct crypt_config *cc, - * requests if driver request queue is full. - */ - skcipher_request_set_callback(ctx->r.req, -- CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP, -+ CRYPTO_TFM_REQ_MAY_BACKLOG, - kcryptd_async_done, dmreq_of_req(cc, ctx->r.req)); - } +- if (aac_is_src(dev)) { ++ if (dev->pdev->device == PMC_DEVICE_S6 || ++ dev->pdev->device == PMC_DEVICE_S7 || ++ dev->pdev->device == PMC_DEVICE_S8) { + if (dev->max_msix > 1) { + for (i = 0; i < dev->max_msix; i++) + free_irq(pci_irq_vector(dev->pdev, i), +diff -ur linux-5.3/drivers/scsi/aacraid.org/linit.c linux-5.3/drivers/scsi/aacraid/linit.c +--- linux-5.3/drivers/scsi/aacraid.org/linit.c 2019-11-01 22:42:37.011469816 +0100 ++++ linux-5.3/drivers/scsi/aacraid/linit.c 2019-11-04 09:29:51.321486211 +0100 +@@ -1567,8 +1567,9 @@ + aac_send_shutdown(aac); -@@ -1268,7 +1268,7 @@ static void crypt_alloc_req_aead(struct crypt_config *cc, - * requests if driver request queue is full. - */ - aead_request_set_callback(ctx->r.req_aead, -- CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP, -+ CRYPTO_TFM_REQ_MAY_BACKLOG, - kcryptd_async_done, dmreq_of_req(cc, ctx->r.req_aead)); - } + aac_adapter_disable_int(aac); +- +- if (aac_is_src(aac)) { ++ if (aac->pdev->device == PMC_DEVICE_S6 || ++ aac->pdev->device == PMC_DEVICE_S7 || ++ aac->pdev->device == PMC_DEVICE_S8) { + if (aac->max_msix > 1) { + for (i = 0; i < aac->max_msix; i++) { + free_irq(pci_irq_vector(aac->pdev, i), +@@ -1858,7 +1859,8 @@ + aac_adapter_enable_int(dev); -diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c -index 378878599466..89ccb64342de 100644 ---- a/drivers/md/dm-integrity.c -+++ b/drivers/md/dm-integrity.c -@@ -532,7 +532,7 @@ static void section_mac(struct dm_integrity_c *ic, unsigned section, __u8 result - unsigned j, size; - desc->tfm = ic->journal_mac; -- desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP; -+ desc->flags = 0; +- if (aac_is_src(dev)) ++ if (dev->pdev->device == PMC_DEVICE_S7 || ++ dev->pdev->device == PMC_DEVICE_S8) + aac_define_int_mode(dev); - r = crypto_shash_init(desc); - if (unlikely(r)) { -@@ -676,7 +676,7 @@ static void complete_journal_encrypt(struct crypto_async_request *req, int err) - static bool do_crypt(bool encrypt, struct skcipher_request *req, struct journal_completion *comp) - { - int r; -- skcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP, -+ skcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, - complete_journal_encrypt, comp); - if (likely(encrypt)) - r = crypto_skcipher_encrypt(req); --- -cgit 1.2-0.3.lf.el7 + if (dev->msi_enabled)