From: Greg Kroah-Hartman Date: Mon, 6 May 2019 07:46:56 +0000 (+0200) Subject: 4.9-stable patches X-Git-Tag: v4.9.174~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bd28fe24ecee6d08080d71b71ddefc133a5b36a7;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: scsi-rdma-srpt-fix-a-credit-leak-for-aborted-commands.patch staging-iio-adt7316-allow-adt751x-to-use-internal-vref-for-all-dacs.patch staging-iio-adt7316-fix-the-dac-read-calculation.patch staging-iio-adt7316-fix-the-dac-write-calculation.patch --- diff --git a/queue-4.9/scsi-rdma-srpt-fix-a-credit-leak-for-aborted-commands.patch b/queue-4.9/scsi-rdma-srpt-fix-a-credit-leak-for-aborted-commands.patch new file mode 100644 index 00000000000..a4dfc79a157 --- /dev/null +++ b/queue-4.9/scsi-rdma-srpt-fix-a-credit-leak-for-aborted-commands.patch @@ -0,0 +1,49 @@ +From 40ca8757291ca7a8775498112d320205b2a2e571 Mon Sep 17 00:00:00 2001 +From: Bart Van Assche +Date: Fri, 25 Jan 2019 10:34:51 -0800 +Subject: scsi: RDMA/srpt: Fix a credit leak for aborted commands + +From: Bart Van Assche + +commit 40ca8757291ca7a8775498112d320205b2a2e571 upstream. + +Make sure that the next time a response is sent to the initiator that the +credit it had allocated for the aborted request gets freed. + +Cc: Doug Ledford +Cc: Jason Gunthorpe +Cc: Nicholas Bellinger +Cc: Mike Christie +Cc: Hannes Reinecke +Cc: Christoph Hellwig +Fixes: 131e6abc674e ("target: Add TFO->abort_task for aborted task resources release") # v3.15 +Signed-off-by: Bart Van Assche +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/infiniband/ulp/srpt/ib_srpt.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- a/drivers/infiniband/ulp/srpt/ib_srpt.c ++++ b/drivers/infiniband/ulp/srpt/ib_srpt.c +@@ -2368,8 +2368,19 @@ static void srpt_queue_tm_rsp(struct se_ + srpt_queue_response(cmd); + } + ++/* ++ * This function is called for aborted commands if no response is sent to the ++ * initiator. Make sure that the credits freed by aborting a command are ++ * returned to the initiator the next time a response is sent by incrementing ++ * ch->req_lim_delta. ++ */ + static void srpt_aborted_task(struct se_cmd *cmd) + { ++ struct srpt_send_ioctx *ioctx = container_of(cmd, ++ struct srpt_send_ioctx, cmd); ++ struct srpt_rdma_ch *ch = ioctx->ch; ++ ++ atomic_inc(&ch->req_lim_delta); + } + + static int srpt_queue_status(struct se_cmd *cmd) diff --git a/queue-4.9/series b/queue-4.9/series index c3a3cb3ca50..18efce4b394 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -52,3 +52,7 @@ xsysace-fix-error-handling-in-ace_setup.patch arm-orion-don-t-use-using-64-bit-dma-masks.patch arm-iop-don-t-use-using-64-bit-dma-masks.patch perf-x86-amd-update-generic-hardware-cache-events-for-family-17h.patch +staging-iio-adt7316-allow-adt751x-to-use-internal-vref-for-all-dacs.patch +staging-iio-adt7316-fix-the-dac-read-calculation.patch +staging-iio-adt7316-fix-the-dac-write-calculation.patch +scsi-rdma-srpt-fix-a-credit-leak-for-aborted-commands.patch diff --git a/queue-4.9/staging-iio-adt7316-allow-adt751x-to-use-internal-vref-for-all-dacs.patch b/queue-4.9/staging-iio-adt7316-allow-adt751x-to-use-internal-vref-for-all-dacs.patch new file mode 100644 index 00000000000..1a068f314d2 --- /dev/null +++ b/queue-4.9/staging-iio-adt7316-allow-adt751x-to-use-internal-vref-for-all-dacs.patch @@ -0,0 +1,34 @@ +From 10bfe7cc1739c22f0aa296b39e53f61e9e3f4d99 Mon Sep 17 00:00:00 2001 +From: Jeremy Fertic +Date: Tue, 11 Dec 2018 17:55:00 -0700 +Subject: staging: iio: adt7316: allow adt751x to use internal vref for all dacs + +From: Jeremy Fertic + +commit 10bfe7cc1739c22f0aa296b39e53f61e9e3f4d99 upstream. + +With adt7516/7/9, internal vref is available for dacs a and b, dacs c and +d, or all dacs. The driver doesn't currently support internal vref for all +dacs. Change the else if to an if so both bits are checked rather than +just one or the other. + +Signed-off-by: Jeremy Fertic +Fixes: 35f6b6b86ede ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver") +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/staging/iio/addac/adt7316.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/staging/iio/addac/adt7316.c ++++ b/drivers/staging/iio/addac/adt7316.c +@@ -1089,7 +1089,7 @@ static ssize_t adt7316_store_DAC_interna + ldac_config = chip->ldac_config & (~ADT7516_DAC_IN_VREF_MASK); + if (data & 0x1) + ldac_config |= ADT7516_DAC_AB_IN_VREF; +- else if (data & 0x2) ++ if (data & 0x2) + ldac_config |= ADT7516_DAC_CD_IN_VREF; + } else { + ret = kstrtou8(buf, 16, &data); diff --git a/queue-4.9/staging-iio-adt7316-fix-the-dac-read-calculation.patch b/queue-4.9/staging-iio-adt7316-fix-the-dac-read-calculation.patch new file mode 100644 index 00000000000..adda82ba881 --- /dev/null +++ b/queue-4.9/staging-iio-adt7316-fix-the-dac-read-calculation.patch @@ -0,0 +1,57 @@ +From 45130fb030aec26ac28b4bb23344901df3ec3b7f Mon Sep 17 00:00:00 2001 +From: Jeremy Fertic +Date: Sat, 22 Dec 2018 21:57:42 -0700 +Subject: staging: iio: adt7316: fix the dac read calculation + +From: Jeremy Fertic + +commit 45130fb030aec26ac28b4bb23344901df3ec3b7f upstream. + +The calculation of the current dac value is using the wrong bits of the +dac lsb register. Create two macros to shift the lsb register value into +lsb position, depending on whether the dac is 10 or 12 bit. Initialize +data to 0 so, with an 8 bit dac, the msb register value can be bitwise +ORed with data. + +Fixes: 35f6b6b86ede ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver") +Signed-off-by: Jeremy Fertic +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/staging/iio/addac/adt7316.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +--- a/drivers/staging/iio/addac/adt7316.c ++++ b/drivers/staging/iio/addac/adt7316.c +@@ -47,6 +47,8 @@ + #define ADT7516_MSB_AIN3 0xA + #define ADT7516_MSB_AIN4 0xB + #define ADT7316_DA_DATA_BASE 0x10 ++#define ADT7316_DA_10_BIT_LSB_SHIFT 6 ++#define ADT7316_DA_12_BIT_LSB_SHIFT 4 + #define ADT7316_DA_MSB_DATA_REGS 4 + #define ADT7316_LSB_DAC_A 0x10 + #define ADT7316_MSB_DAC_A 0x11 +@@ -1411,7 +1413,7 @@ static IIO_DEVICE_ATTR(ex_analog_temp_of + static ssize_t adt7316_show_DAC(struct adt7316_chip_info *chip, + int channel, char *buf) + { +- u16 data; ++ u16 data = 0; + u8 msb, lsb, offset; + int ret; + +@@ -1436,7 +1438,11 @@ static ssize_t adt7316_show_DAC(struct a + if (ret) + return -EIO; + +- data = (msb << offset) + (lsb & ((1 << offset) - 1)); ++ if (chip->dac_bits == 12) ++ data = lsb >> ADT7316_DA_12_BIT_LSB_SHIFT; ++ else if (chip->dac_bits == 10) ++ data = lsb >> ADT7316_DA_10_BIT_LSB_SHIFT; ++ data |= msb << offset; + + return sprintf(buf, "%d\n", data); + } diff --git a/queue-4.9/staging-iio-adt7316-fix-the-dac-write-calculation.patch b/queue-4.9/staging-iio-adt7316-fix-the-dac-write-calculation.patch new file mode 100644 index 00000000000..7fdb549ab42 --- /dev/null +++ b/queue-4.9/staging-iio-adt7316-fix-the-dac-write-calculation.patch @@ -0,0 +1,54 @@ +From 78accaea117c1ae878774974fab91ac4a0b0e2b0 Mon Sep 17 00:00:00 2001 +From: Jeremy Fertic +Date: Sat, 22 Dec 2018 21:57:43 -0700 +Subject: staging: iio: adt7316: fix the dac write calculation + +From: Jeremy Fertic + +commit 78accaea117c1ae878774974fab91ac4a0b0e2b0 upstream. + +The lsb calculation is not masking the correct bits from the user input. +Subtract 1 from (1 << offset) to correctly set up the mask to be applied +to user input. + +The lsb register stores its value starting at the bit 7 position. +adt7316_store_DAC() currently assumes the value is at the other end of the +register. Shift the lsb value before storing it in a new variable lsb_reg, +and write this variable to the lsb register. + +Fixes: 35f6b6b86ede ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver") +Signed-off-by: Jeremy Fertic +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/staging/iio/addac/adt7316.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +--- a/drivers/staging/iio/addac/adt7316.c ++++ b/drivers/staging/iio/addac/adt7316.c +@@ -1450,7 +1450,7 @@ static ssize_t adt7316_show_DAC(struct a + static ssize_t adt7316_store_DAC(struct adt7316_chip_info *chip, + int channel, const char *buf, size_t len) + { +- u8 msb, lsb, offset; ++ u8 msb, lsb, lsb_reg, offset; + u16 data; + int ret; + +@@ -1468,9 +1468,13 @@ static ssize_t adt7316_store_DAC(struct + return -EINVAL; + + if (chip->dac_bits > 8) { +- lsb = data & (1 << offset); ++ lsb = data & ((1 << offset) - 1); ++ if (chip->dac_bits == 12) ++ lsb_reg = lsb << ADT7316_DA_12_BIT_LSB_SHIFT; ++ else ++ lsb_reg = lsb << ADT7316_DA_10_BIT_LSB_SHIFT; + ret = chip->bus.write(chip->bus.client, +- ADT7316_DA_DATA_BASE + channel * 2, lsb); ++ ADT7316_DA_DATA_BASE + channel * 2, lsb_reg); + if (ret) + return -EIO; + }