]> git.baikalelectronics.ru Git - kernel.git/commit
ata: sata_mv: Cleanup only the initialized ports
authorEzequiel Garcia <ezequiel.garcia@free-electrons.com>
Sun, 16 Feb 2014 15:29:53 +0000 (12:29 -0300)
committerTejun Heo <tj@kernel.org>
Sun, 16 Feb 2014 16:51:17 +0000 (11:51 -0500)
commit1eff4d53d7f9c088b84d5d786c4fc2a4040f9319
treec5a69d0a235864821b6ad4d46c9a280b72f95e7f
parente4bf95dbe98272576b11b91e5be3f3cbcb99f5ef
ata: sata_mv: Cleanup only the initialized ports

When an error occurs in the port initialization loop, currently the
driver tries to cleanup all the ports. This results in a NULL pointer
dereference if the ports were only partially initialized.

Fix this by updating only the number of initialized ports (either
with failure or successfully), before jumping to the error path
and looping over that number in the cleanup loop.

Cc: Andrew Lunn <andrew@lunn.ch>
Reported-by: Mikael Pettersson <mikpelinux@gmail.com>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: stable@vger.kernel.org
drivers/ata/sata_mv.c