drivers: base: remove improper get/put in add_memory_section()
authorSeth Jennings <sjenning@linux.vnet.ibm.com>
Tue, 20 Aug 2013 17:13:02 +0000 (12:13 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 21 Aug 2013 18:49:47 +0000 (11:49 -0700)
commit37171e3cb7a2f6fc594b524c940beb1ce85cc935
tree16fe5b67c4ef5e25bce7ebbf1fee2f173311a3f4
parent37a7bd6255b415afe197489b5cd1f9568a7ae058
drivers: base: remove improper get/put in add_memory_section()

The path through add_memory_section() when the memory block already
exists uses flawed refcounting logic.  A get_device() is done on a
memory block using a pointer that might not be valid as we dropped
our previous reference and didn't obtain a new reference in the
proper way.

Lets stop pretending and just remove the get/put.  The
mem_sysfs_mutex, which we hold over the entire init loop now, will
prevent the memory blocks from disappearing from under us.

Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/memory.c