From 8007d56303a108466f7e373162886a88a2c2d43c Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sun, 24 Jun 2018 19:15:25 +0800 Subject: [PATCH] 3.18-stable patches added patches: libata-drop-sandisk-sd7ub3q-g1001-nolpm-quirk.patch libata-zpodd-make-arrays-cdb-static-reduces-object-code-size.patch libata-zpodd-small-read-overflow-in-eject_tray.patch w1-mxc_w1-enable-clock-before-calling-clk_get_rate-on-it.patch --- ...op-sandisk-sd7ub3q-g1001-nolpm-quirk.patch | 56 +++++++++++++++ ...-cdb-static-reduces-object-code-size.patch | 48 +++++++++++++ ...dd-small-read-overflow-in-eject_tray.patch | 33 +++++++++ queue-3.18/series | 4 ++ ...ck-before-calling-clk_get_rate-on-it.patch | 68 +++++++++++++++++++ 5 files changed, 209 insertions(+) create mode 100644 queue-3.18/libata-drop-sandisk-sd7ub3q-g1001-nolpm-quirk.patch create mode 100644 queue-3.18/libata-zpodd-make-arrays-cdb-static-reduces-object-code-size.patch create mode 100644 queue-3.18/libata-zpodd-small-read-overflow-in-eject_tray.patch create mode 100644 queue-3.18/w1-mxc_w1-enable-clock-before-calling-clk_get_rate-on-it.patch diff --git a/queue-3.18/libata-drop-sandisk-sd7ub3q-g1001-nolpm-quirk.patch b/queue-3.18/libata-drop-sandisk-sd7ub3q-g1001-nolpm-quirk.patch new file mode 100644 index 00000000000..f228c7c4230 --- /dev/null +++ b/queue-3.18/libata-drop-sandisk-sd7ub3q-g1001-nolpm-quirk.patch @@ -0,0 +1,56 @@ +From 2cfce3a86b64b53f0a70e92a6a659c720c319b45 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Thu, 31 May 2018 13:21:07 +0200 +Subject: libata: Drop SanDisk SD7UB3Q*G1001 NOLPM quirk + +From: Hans de Goede + +commit 2cfce3a86b64b53f0a70e92a6a659c720c319b45 upstream. + +Commit 184add2ca23c ("libata: Apply NOLPM quirk for SanDisk +SD7UB3Q*G1001 SSDs") disabled LPM for SanDisk SD7UB3Q*G1001 SSDs. + +This has lead to several reports of users of that SSD where LPM +was working fine and who know have a significantly increased idle +power consumption on their laptops. + +Likely there is another problem on the T450s from the original +reporter which gets exposed by the uncore reaching deeper sleep +states (higher PC-states) due to LPM being enabled. The problem as +reported, a hardfreeze about once a day, already did not sound like +it would be caused by LPM and the reports of the SSD working fine +confirm this. The original reporter is ok with dropping the quirk. + +A X250 user has reported the same hard freeze problem and for him +the problem went away after unrelated updates, I suspect some GPU +driver stack changes fixed things. + +TL;DR: The original reporters problem were triggered by LPM but not +an LPM issue, so drop the quirk for the SSD in question. + +BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1583207 +Cc: stable@vger.kernel.org +Cc: Richard W.M. Jones +Cc: Lorenzo Dalrio +Reported-by: Lorenzo Dalrio +Signed-off-by: Hans de Goede +Signed-off-by: Tejun Heo +Acked-by: "Richard W.M. Jones" +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/ata/libata-core.c | 3 --- + 1 file changed, 3 deletions(-) + +--- a/drivers/ata/libata-core.c ++++ b/drivers/ata/libata-core.c +@@ -4248,9 +4248,6 @@ static const struct ata_blacklist_entry + ATA_HORKAGE_ZERO_AFTER_TRIM | + ATA_HORKAGE_NOLPM, }, + +- /* Sandisk devices which are known to not handle LPM well */ +- { "SanDisk SD7UB3Q*G1001", NULL, ATA_HORKAGE_NOLPM, }, +- + /* devices that don't properly handle queued TRIM commands */ + { "Micron_M500_*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | + ATA_HORKAGE_ZERO_AFTER_TRIM, }, diff --git a/queue-3.18/libata-zpodd-make-arrays-cdb-static-reduces-object-code-size.patch b/queue-3.18/libata-zpodd-make-arrays-cdb-static-reduces-object-code-size.patch new file mode 100644 index 00000000000..4884d0faf2b --- /dev/null +++ b/queue-3.18/libata-zpodd-make-arrays-cdb-static-reduces-object-code-size.patch @@ -0,0 +1,48 @@ +From 795ef788145ed2fa023efdf11e8d5d7bedc21462 Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Wed, 6 Sep 2017 09:56:29 +0100 +Subject: libata: zpodd: make arrays cdb static, reduces object code size + +From: Colin Ian King + +commit 795ef788145ed2fa023efdf11e8d5d7bedc21462 upstream. + +Don't populate the arrays cdb on the stack, instead make them static. +Makes the object code smaller by 230 bytes: + +Before: + text data bss dec hex filename + 3797 240 0 4037 fc5 drivers/ata/libata-zpodd.o + +After: + text data bss dec hex filename + 3407 400 0 3807 edf drivers/ata/libata-zpodd.o + +Signed-off-by: Colin Ian King +Signed-off-by: Tejun Heo +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/ata/libata-zpodd.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/ata/libata-zpodd.c ++++ b/drivers/ata/libata-zpodd.c +@@ -34,7 +34,7 @@ struct zpodd { + static int eject_tray(struct ata_device *dev) + { + struct ata_taskfile tf; +- const char cdb[] = { GPCMD_START_STOP_UNIT, ++ static const char cdb[] = { GPCMD_START_STOP_UNIT, + 0, 0, 0, + 0x02, /* LoEj */ + 0, 0, 0, 0, 0, 0, 0, +@@ -55,7 +55,7 @@ static enum odd_mech_type zpodd_get_mech + unsigned int ret; + struct rm_feature_desc *desc = (void *)(buf + 8); + struct ata_taskfile tf; +- char cdb[] = { GPCMD_GET_CONFIGURATION, ++ static const char cdb[] = { GPCMD_GET_CONFIGURATION, + 2, /* only 1 feature descriptor requested */ + 0, 3, /* 3, removable medium feature */ + 0, 0, 0,/* reserved */ diff --git a/queue-3.18/libata-zpodd-small-read-overflow-in-eject_tray.patch b/queue-3.18/libata-zpodd-small-read-overflow-in-eject_tray.patch new file mode 100644 index 00000000000..ead3eb943f1 --- /dev/null +++ b/queue-3.18/libata-zpodd-small-read-overflow-in-eject_tray.patch @@ -0,0 +1,33 @@ +From 18c9a99bce2a57dfd7e881658703b5d7469cc7b9 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Tue, 29 May 2018 12:13:24 +0300 +Subject: libata: zpodd: small read overflow in eject_tray() + +From: Dan Carpenter + +commit 18c9a99bce2a57dfd7e881658703b5d7469cc7b9 upstream. + +We read from the cdb[] buffer in ata_exec_internal_sg(). It has to be +ATAPI_CDB_LEN (16) bytes long, but this buffer is only 12 bytes. + +Fixes: 213342053db5 ("libata: handle power transition of ODD") +Signed-off-by: Dan Carpenter +Signed-off-by: Tejun Heo +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/ata/libata-zpodd.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/ata/libata-zpodd.c ++++ b/drivers/ata/libata-zpodd.c +@@ -34,7 +34,7 @@ struct zpodd { + static int eject_tray(struct ata_device *dev) + { + struct ata_taskfile tf; +- static const char cdb[] = { GPCMD_START_STOP_UNIT, ++ static const char cdb[ATAPI_CDB_LEN] = { GPCMD_START_STOP_UNIT, + 0, 0, 0, + 0x02, /* LoEj */ + 0, 0, 0, 0, 0, 0, 0, diff --git a/queue-3.18/series b/queue-3.18/series index f0f74f45ad9..cdc6dd1a1a1 100644 --- a/queue-3.18/series +++ b/queue-3.18/series @@ -39,3 +39,7 @@ ext4-update-mtime-in-ext4_punch_hole-even-if-no-blocks-are-released.patch ext4-fix-fencepost-error-in-check-for-inode-count-overflow-during-resize.patch btrfs-scrub-don-t-use-inode-pages-for-device-replace.patch alsa-hda-handle-kzalloc-failure-in-snd_hda_attach_pcm_stream.patch +libata-zpodd-make-arrays-cdb-static-reduces-object-code-size.patch +libata-zpodd-small-read-overflow-in-eject_tray.patch +libata-drop-sandisk-sd7ub3q-g1001-nolpm-quirk.patch +w1-mxc_w1-enable-clock-before-calling-clk_get_rate-on-it.patch diff --git a/queue-3.18/w1-mxc_w1-enable-clock-before-calling-clk_get_rate-on-it.patch b/queue-3.18/w1-mxc_w1-enable-clock-before-calling-clk_get_rate-on-it.patch new file mode 100644 index 00000000000..3e5443cdf8d --- /dev/null +++ b/queue-3.18/w1-mxc_w1-enable-clock-before-calling-clk_get_rate-on-it.patch @@ -0,0 +1,68 @@ +From 955bc61328dc0a297fb3baccd84e9d3aee501ed8 Mon Sep 17 00:00:00 2001 +From: Stefan Potyra +Date: Wed, 2 May 2018 10:55:31 +0200 +Subject: w1: mxc_w1: Enable clock before calling clk_get_rate() on it + +From: Stefan Potyra + +commit 955bc61328dc0a297fb3baccd84e9d3aee501ed8 upstream. + +According to the API, you may only call clk_get_rate() after actually +enabling it. + +Found by Linux Driver Verification project (linuxtesting.org). + +Fixes: a5fd9139f74c ("w1: add 1-wire master driver for i.MX27 / i.MX31") +Signed-off-by: Stefan Potyra +Acked-by: Evgeniy Polyakov +Cc: stable +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/w1/masters/mxc_w1.c | 20 +++++++++++++------- + 1 file changed, 13 insertions(+), 7 deletions(-) + +--- a/drivers/w1/masters/mxc_w1.c ++++ b/drivers/w1/masters/mxc_w1.c +@@ -113,6 +113,10 @@ static int mxc_w1_probe(struct platform_ + if (IS_ERR(mdev->clk)) + return PTR_ERR(mdev->clk); + ++ err = clk_prepare_enable(mdev->clk); ++ if (err) ++ return err; ++ + clkrate = clk_get_rate(mdev->clk); + if (clkrate < 10000000) + dev_warn(&pdev->dev, +@@ -126,12 +130,10 @@ static int mxc_w1_probe(struct platform_ + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + mdev->regs = devm_ioremap_resource(&pdev->dev, res); +- if (IS_ERR(mdev->regs)) +- return PTR_ERR(mdev->regs); +- +- err = clk_prepare_enable(mdev->clk); +- if (err) +- return err; ++ if (IS_ERR(mdev->regs)) { ++ err = PTR_ERR(mdev->regs); ++ goto out_disable_clk; ++ } + + /* Software reset 1-Wire module */ + writeb(MXC_W1_RESET_RST, mdev->regs + MXC_W1_RESET); +@@ -147,8 +149,12 @@ static int mxc_w1_probe(struct platform_ + + err = w1_add_master_device(&mdev->bus_master); + if (err) +- clk_disable_unprepare(mdev->clk); ++ goto out_disable_clk; ++ ++ return 0; + ++out_disable_clk: ++ clk_disable_unprepare(mdev->clk); + return err; + } + -- 2.47.3