From: Greg Kroah-Hartman Date: Thu, 13 Feb 2020 15:01:47 +0000 (-0800) Subject: 4.9-stable patches X-Git-Tag: v4.4.214~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=471a59ae7515987a4e1ee648997e11b423f89f39;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: dm-fix-potential-for-q-make_request_fn-null-pointer.patch scsi-megaraid_sas-do-not-initiate-ocr-if-controller-is-not-in-ready-state.patch --- diff --git a/queue-4.9/dm-fix-potential-for-q-make_request_fn-null-pointer.patch b/queue-4.9/dm-fix-potential-for-q-make_request_fn-null-pointer.patch new file mode 100644 index 00000000000..dc3351aa18a --- /dev/null +++ b/queue-4.9/dm-fix-potential-for-q-make_request_fn-null-pointer.patch @@ -0,0 +1,73 @@ +From 47ace7e012b9f7ad71d43ac9063d335ea3d6820b Mon Sep 17 00:00:00 2001 +From: Mike Snitzer +Date: Mon, 27 Jan 2020 14:07:23 -0500 +Subject: dm: fix potential for q->make_request_fn NULL pointer + +From: Mike Snitzer + +commit 47ace7e012b9f7ad71d43ac9063d335ea3d6820b upstream. + +Move blk_queue_make_request() to dm.c:alloc_dev() so that +q->make_request_fn is never NULL during the lifetime of a DM device +(even one that is created without a DM table). + +Otherwise generic_make_request() will crash simply by doing: + dmsetup create -n test + mount /dev/dm-N /mnt + +While at it, move ->congested_data initialization out of +dm.c:alloc_dev() and into the bio-based specific init method. + +Reported-by: Stefan Bader +BugLink: https://bugs.launchpad.net/bugs/1860231 +Fixes: ff36ab34583a ("dm: remove request-based logic from make_request_fn wrapper") +Depends-on: c12c9a3c3860c ("dm: various cleanups to md->queue initialization code") +Cc: stable@vger.kernel.org +Signed-off-by: Mike Snitzer +[smb: adjusted for context and dm_init_md_queue() exitsting in older + kernels, and congested_data embedded in backing_dev_info] +Signed-off-by: Stefan Bader +Signed-off-by: Greg Kroah-Hartman +--- + drivers/md/dm.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +--- a/drivers/md/dm.c ++++ b/drivers/md/dm.c +@@ -1457,7 +1457,6 @@ void dm_init_md_queue(struct mapped_devi + * - must do so here (in alloc_dev callchain) before queue is used + */ + md->queue->queuedata = md; +- md->queue->backing_dev_info.congested_data = md; + } + + void dm_init_normal_md_queue(struct mapped_device *md) +@@ -1468,6 +1467,7 @@ void dm_init_normal_md_queue(struct mapp + /* + * Initialize aspects of queue that aren't relevant for blk-mq + */ ++ md->queue->backing_dev_info.congested_data = md; + md->queue->backing_dev_info.congested_fn = dm_any_congested; + blk_queue_bounce_limit(md->queue, BLK_BOUNCE_ANY); + } +@@ -1555,6 +1555,12 @@ static struct mapped_device *alloc_dev(i + goto bad; + + dm_init_md_queue(md); ++ /* ++ * default to bio-based required ->make_request_fn until DM ++ * table is loaded and md->type established. If request-based ++ * table is loaded: blk-mq will override accordingly. ++ */ ++ blk_queue_make_request(md->queue, dm_make_request); + + md->disk = alloc_disk_node(1, numa_node_id); + if (!md->disk) +@@ -1853,7 +1859,6 @@ int dm_setup_md_queue(struct mapped_devi + case DM_TYPE_BIO_BASED: + case DM_TYPE_DAX_BIO_BASED: + dm_init_normal_md_queue(md); +- blk_queue_make_request(md->queue, dm_make_request); + /* + * DM handles splitting bios as needed. Free the bio_split bioset + * since it won't be used (saves 1 process per bio-based DM device). diff --git a/queue-4.9/scsi-megaraid_sas-do-not-initiate-ocr-if-controller-is-not-in-ready-state.patch b/queue-4.9/scsi-megaraid_sas-do-not-initiate-ocr-if-controller-is-not-in-ready-state.patch new file mode 100644 index 00000000000..d02614cf3a7 --- /dev/null +++ b/queue-4.9/scsi-megaraid_sas-do-not-initiate-ocr-if-controller-is-not-in-ready-state.patch @@ -0,0 +1,71 @@ +From 6d7537270e3283b92f9b327da9d58a4de40fe8d0 Mon Sep 17 00:00:00 2001 +From: Anand Lodnoor +Date: Tue, 14 Jan 2020 16:51:19 +0530 +Subject: scsi: megaraid_sas: Do not initiate OCR if controller is not in ready state + +From: Anand Lodnoor + +commit 6d7537270e3283b92f9b327da9d58a4de40fe8d0 upstream. + +Driver initiates OCR if a DCMD command times out. But there is a deadlock +if the driver attempts to invoke another OCR before the mutex lock +(reset_mutex) is released from the previous session of OCR. + +This patch takes care of the above scenario using new flag +MEGASAS_FUSION_OCR_NOT_POSSIBLE to indicate if OCR is possible. + +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/1579000882-20246-9-git-send-email-anand.lodnoor@broadcom.com +Signed-off-by: Shivasharan S +Signed-off-by: Anand Lodnoor +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + + +--- + drivers/scsi/megaraid/megaraid_sas_base.c | 3 ++- + drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 ++- + drivers/scsi/megaraid/megaraid_sas_fusion.h | 1 + + 3 files changed, 5 insertions(+), 2 deletions(-) + +--- a/drivers/scsi/megaraid/megaraid_sas_base.c ++++ b/drivers/scsi/megaraid/megaraid_sas_base.c +@@ -3978,7 +3978,8 @@ dcmd_timeout_ocr_possible(struct megasas + if (!instance->ctrl_context) + return KILL_ADAPTER; + else if (instance->unload || +- test_bit(MEGASAS_FUSION_IN_RESET, &instance->reset_flags)) ++ test_bit(MEGASAS_FUSION_OCR_NOT_POSSIBLE, ++ &instance->reset_flags)) + return IGNORE_TIMEOUT; + else + return INITIATE_OCR; +--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c ++++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c +@@ -3438,6 +3438,7 @@ int megasas_reset_fusion(struct Scsi_Hos + if (instance->requestorId && !instance->skip_heartbeat_timer_del) + del_timer_sync(&instance->sriov_heartbeat_timer); + set_bit(MEGASAS_FUSION_IN_RESET, &instance->reset_flags); ++ set_bit(MEGASAS_FUSION_OCR_NOT_POSSIBLE, &instance->reset_flags); + atomic_set(&instance->adprecovery, MEGASAS_ADPRESET_SM_POLLING); + instance->instancet->disable_intr(instance); + msleep(1000); +@@ -3594,7 +3595,7 @@ fail_kill_adapter: + atomic_set(&instance->adprecovery, MEGASAS_HBA_OPERATIONAL); + } + out: +- clear_bit(MEGASAS_FUSION_IN_RESET, &instance->reset_flags); ++ clear_bit(MEGASAS_FUSION_OCR_NOT_POSSIBLE, &instance->reset_flags); + mutex_unlock(&instance->reset_mutex); + return retval; + } +--- a/drivers/scsi/megaraid/megaraid_sas_fusion.h ++++ b/drivers/scsi/megaraid/megaraid_sas_fusion.h +@@ -93,6 +93,7 @@ enum MR_RAID_FLAGS_IO_SUB_TYPE { + + #define MEGASAS_FP_CMD_LEN 16 + #define MEGASAS_FUSION_IN_RESET 0 ++#define MEGASAS_FUSION_OCR_NOT_POSSIBLE 1 + #define THRESHOLD_REPLY_COUNT 50 + #define JBOD_MAPS_COUNT 2 + diff --git a/queue-4.9/series b/queue-4.9/series index 78e2d0b0557..58564265b1a 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -108,6 +108,8 @@ arm-dts-at91-sama5d3-define-clock-rate-range-for-tcb1.patch tools-power-acpi-fix-compilation-error.patch powerpc-pseries-allow-not-having-ibm-hypertas-functions-hcall-multi-tce-for-ddw.patch pinctrl-sh-pfc-r8a7778-fix-duplicate-sdself_b-and-sd1_clk_b.patch +scsi-megaraid_sas-do-not-initiate-ocr-if-controller-is-not-in-ready-state.patch +dm-fix-potential-for-q-make_request_fn-null-pointer.patch mwifiex-fix-possible-buffer-overflows-in-mwifiex_ret.patch mwifiex-fix-possible-buffer-overflows-in-mwifiex_cmd.patch libertas-don-t-exit-from-lbs_ibss_join_existing-with.patch