aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/cio/css.c
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2009-09-11 04:28:24 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2009-09-11 04:29:39 -0400
commitab6aae09024be1b039df441fa1b64dbe092d0acb (patch)
tree92f2d8612665b7c8257c48b61de7bce850012556 /drivers/s390/cio/css.c
parentf014824ee72e66292c3b1172dc142f959b42e61b (diff)
[S390] cio: fix memleak in subchannel validation
When scanning for new subchannels we have a code path where we allocate memory for a struct subchannel, set the device name (which is dynamically allocated now) and do a check if the underlying device is blacklisted - if so we free the subchannel structure. Since we have not set up refcounting at this stage, the device name's memory is lost. Fix this by moving the dev_set_name after the blacklist test. Note: With this patch the init_name for the console subchannel becomes virtually obsolete. Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/cio/css.c')
-rw-r--r--drivers/s390/cio/css.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
index 40d4b3093b71..0dc6f6d26287 100644
--- a/drivers/s390/cio/css.c
+++ b/drivers/s390/cio/css.c
@@ -183,6 +183,11 @@ static int css_sch_device_register(struct subchannel *sch)
183 int ret; 183 int ret;
184 184
185 mutex_lock(&sch->reg_mutex); 185 mutex_lock(&sch->reg_mutex);
186 if (cio_is_console(sch->schid))
187 sch->dev.init_name = cio_get_console_sch_name(sch->schid);
188 else
189 dev_set_name(&sch->dev, "0.%x.%04x", sch->schid.ssid,
190 sch->schid.sch_no);
186 ret = device_register(&sch->dev); 191 ret = device_register(&sch->dev);
187 mutex_unlock(&sch->reg_mutex); 192 mutex_unlock(&sch->reg_mutex);
188 return ret; 193 return ret;