shmem: fix double uncharge in __shmem_file_setup()
authorKonstantin Khlebnikov <koct9i@gmail.com>
Wed, 6 Aug 2014 23:06:32 +0000 (16:06 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 7 Aug 2014 01:01:18 +0000 (18:01 -0700)
commit66ee4b8887ec5ce04bae3e840d206db7b7ad34d1
treeca202430d326aaca6ad5f11e7296ccf1956aa961
parentef6b571fb8920d5006349a6e29ac47c4817e9691
shmem: fix double uncharge in __shmem_file_setup()

If __shmem_file_setup() fails on struct file allocation it uncharges
memory commitment twice: first by shmem_unacct_size() and second time
implicitly in shmem_evict_inode() when it kills the newly created inode.

This patch removes shmem_unacct_size() from error path if the inode was
already there.

Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
Acked-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/shmem.c