]> git.baikalelectronics.ru Git - kernel.git/commit
mtd: mtd_blkdevs: fix error path in blktrans_open
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Mon, 18 Apr 2011 04:50:37 +0000 (07:50 +0300)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Wed, 25 May 2011 00:53:45 +0000 (01:53 +0100)
commit1ea2f53a1c2b6d3130bd4f9440f96d6147e64c75
treea5704163f225330f25102e8daf5668b2215c86ed
parent5a6a7d8bdcd66cb9f19ebd03414731e2a06a2820
mtd: mtd_blkdevs: fix error path in blktrans_open

The 'blktrans_open()' does not handle possible '__get_mtd_device()' failures
because it does not check the error code. Moreover, the 'dev->tr->open()'
failures are not handled correctly because in this case the function just
goes ahead and gets the mtd device, then returns an error. But Instead, it
should _not_ try to get the mtd device, then it should put back the module
and the kref.

This patch fixes the issue. Note, I only compile-tested it. This patch was
inspired by a bug report about a similar issue in 2.6.34 kernels
sent by Mike Turner <admin@islandsoftware.co.uk> to the MTD mailing list:

http://lists.infradead.org/pipermail/linux-mtd/2011-April/034980.html

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/mtd_blkdevs.c