linux/drivers/rapidio
Dan Carpenter 73984137d3 rapidio: dereferencing an error pointer
Original patch: https://lkml.org/lkml/2016/8/4/32

If riocm_ch_alloc() fails then we end up dereferencing the error
pointer.

The problem is that we're not unwinding in the reverse order from how we
allocate things so it gets confusing.  I've changed this around so now
"ch" is NULL when we are done with it after we call riocm_put_channel().
That way we can check if it's NULL and avoid calling riocm_put_channel()
on it twice.

I renamed err_nodev to err_put_new_ch so that it better reflects what
the goto does.

Then because we had flipping things around, it means we don't neeed to
initialize the pointers to NULL and we can remove an if statement and
pull things in an indent level.

Link: http://lkml.kernel.org/r/20160805152406.20713-1-alexandre.bounine@idt.com
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Andre van Herk <andre.van.herk@prodrive-technologies.com>
Cc: Barry Wood <barry.wood@idt.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-08-10 16:40:56 -07:00
..
devices rapidio: modify for rev.3 specification changes 2016-08-02 19:35:37 -04:00
switches rapidio/switches: add driver for IDT gen3 switches 2016-08-02 19:35:38 -04:00
Kconfig rapidio: add RapidIO channelized messaging driver 2016-08-02 19:35:31 -04:00
Makefile rapidio: add RapidIO channelized messaging driver 2016-08-02 19:35:31 -04:00
rio-access.c [RAPIDIO] Add RapidIO multi mport support 2008-04-29 19:40:28 +10:00
rio-driver.c rapidio: add shutdown notification for RapidIO devices 2016-03-22 15:36:02 -07:00
rio-scan.c rapidio: modify for rev.3 specification changes 2016-08-02 19:35:37 -04:00
rio-sysfs.c rapidio: use kobj_to_dev() 2016-01-20 17:09:18 -08:00
rio.c rapidio: modify for rev.3 specification changes 2016-08-02 19:35:37 -04:00
rio.h rapidio: modify for rev.3 specification changes 2016-08-02 19:35:37 -04:00
rio_cm.c rapidio: dereferencing an error pointer 2016-08-10 16:40:56 -07:00