Skip to content

Commit 66da0e1

Browse files
Ilija Hadzictorvalds
authored andcommitted
devpts: plug the memory leak in kill_sb
When devpts is unmounted, there may be a no-longer-used IDR tree hanging off the superblock we are about to kill. This needs to be cleaned up before destroying the SB. The leak is usually not a big deal because unmounting devpts is typically done when shutting down the whole machine. However, shutting down an LXC container instead of a physical machine exposes the problem (the garbage is detectable with kmemleak). Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com> Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 1bf49dd commit 66da0e1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/devpts/inode.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ static void devpts_kill_sb(struct super_block *sb)
498498
{
499499
struct pts_fs_info *fsi = DEVPTS_SB(sb);
500500

501+
ida_destroy(&fsi->allocated_ptys);
501502
kfree(fsi);
502503
kill_litter_super(sb);
503504
}

0 commit comments

Comments
 (0)