Skip to content

Commit

Permalink
[S390] monreader: fix use after free bug with suspend/resume
Browse files Browse the repository at this point in the history
The monreader device driver doesn't set dev->driver_data to NULL after
freeing the corresponding data structure. This leads to a use after
free bug in the freeze/thaw suspend/resume functions after the device
has been opened and closed once. Fix this by clearing dev->driver_data
in the close() function.

Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
Gerald Schaefer authored and Martin Schwidefsky committed Nov 13, 2009
1 parent 156171c commit ccaf655
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/s390/char/monreader.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ static int mon_close(struct inode *inode, struct file *filp)
atomic_set(&monpriv->msglim_count, 0);
monpriv->write_index = 0;
monpriv->read_index = 0;
dev_set_drvdata(monreader_device, NULL);

for (i = 0; i < MON_MSGLIM; i++)
kfree(monpriv->msg_array[i]);
Expand Down

0 comments on commit ccaf655

Please sign in to comment.