Patch "[PATCH 059/135] s390/cio: fix measurement characteristics memleak" has been added to the 4.4-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
[PATCH 059/135] s390/cio: fix measurement characteristics memleak
to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
0059-s390-cio-fix-measurement-characteristics-memleak.patch
and it can be found in the queue-4.4 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
b25aac2e34a9783d2fde366d9ce12a8c0d525f50Mon Sep 17 00:00:00 2001
From: Sebastian Ott <[email protected]>
Date: Mon, 25 Jan 2016 10:30:27 +0100
Subject: [PATCH 059/135] s390/cio: fix measurement characteristics memleak
[ Upstream commit 0d9bfe9123cfde59bf5c2e375b59d2a7d5061c4c ]
Measurement characteristics are allocated during channel path registration but not freed during deregistration. Fix this by embedding these characteristics inside struct channel_path.
--- drivers/s390/cio/chp.c | 6 +++--- drivers/s390/cio/chp.h | 2 +- drivers/s390/cio/chsc.c | 16 ++-------------- 3 files changed, 6 insertions(+), 18 deletions(-)
drivers/s390/cio/chp.c +3 -3
@@ -139,11 +139,11 @@ static ssize_t chp_measurement_chars_rea device = container_of(kobj, struct device, kobj); chp =to_channelpath (device); -if (!chp->cmg_chars) +if (chp->cmg ==-1 )return 0 ; -return memory_read_from_buffer (buf, count, &off, - chp->cmg_chars,sizeof (struct cmg_chars )); +return memory_read_from_buffer (buf, count, &off, &chp->cmg_chars, +sizeof (chp->cmg_chars)); }static struct bin_attribute chp_measurement_chars_attr = {
drivers/s390/cio/chp.h +1 -1
@@ -48,7 +48,7 @@ struct channel_path {/* Channel-measurement related stuff: */ int cmg;int shared; -void *cmg_chars; +struct cmg_chars cmg_chars; };/* Return channel_path struct for given chpid. */
drivers/s390/cio/chsc.c +2 -14
@@ -967,22 +967,19 @@ static void chsc_initialize_cmg_chars(struct channel_path *chp, u8 cmcv, struct cmg_chars *chars) { - struct cmg_chars *cmg_chars; int i, mask; - cmg_chars = chp->cmg_chars;for (i =0 ; i <NR_MEASUREMENT_CHARS ; i++) { mask =0x80 >> (i +3 );if (cmcv & mask) - cmg_chars->values[i] = chars->values[i]; + chp->cmg_chars.values[i] = chars->values[i];else - cmg_chars->values[i] =0 ; + chp->cmg_chars.values[i] =0 ; } }int chsc_get_channel_measurement_chars (struct channel_path *chp) { -struct cmg_chars *cmg_chars;int ccode, ret; struct {
@@ -1006,11 +1003,6 @@ int chsc_get_channel_measurement_chars(su32 data[NR_MEASUREMENT_CHARS ]; } __attribute__ ((packed)) *scmc_area; - chp->cmg_chars =NULL ; - cmg_chars =kmalloc (sizeof (*cmg_chars),GFP_KERNEL ); -if (!cmg_chars) -return -ENOMEM ; -spin_lock_irq (&chsc_page_lock);memset (chsc_page,0 ,PAGE_SIZE ); scmc_area = chsc_page;
@@ -1042,14 +1034,10 @@ int chsc_get_channel_measurement_chars(s/* No cmg-dependent data. */ goto out; } - chp->cmg_chars = cmg_chars;chsc_initialize_cmg_chars (chp, scmc_area->cmcv, (struct cmg_chars *) &scmc_area->data); out:spin_unlock_irq (&chsc_page_lock); -if (!chp->cmg_chars) -kfree (cmg_chars); -return ret; }
Patches currently in stable-queue which might be from [email protected] are
queue-4.4/0059-s390-cio-fix-measurement-characteristics-memleak.patch queue-4.4/0061-s390-cio-update-measurement-characteristics.patch queue-4.4/0094-s390-pci_dma-fix-DMA-table-corruption-with-4-TB-main.patch queue-4.4/0060-s390-cio-ensure-consistent-measurement-state.patch