Re: [PATCH 01/12] Fix memory issues in path reordering failure code paths

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Applied.
Thanks.


On Mon, Jun 30, 2014 at 7:13 AM, Benjamin Marzinski <bmarzins@xxxxxxxxxx> wrote:
There were some possible NULL pointer dereferences and multiple frees
in the failure code paths of the path reordering code.  This patch
cleans them up.

Signed-off-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx>
---
 libmultipath/configure.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 3ed6b55..6ad7a80 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -160,8 +160,16 @@ int order_paths_in_pg_by_alt_adapters(struct pathgroup *pgp, vector adapters,

        while (total_paths > 0) {
                agp = VECTOR_SLOT(adapters, next_adapter_index);
+               if (!agp) {
+                       condlog(0, "can't get adapter group %d", next_adapter_index);
+                       return 1;
+               }

                hgp = VECTOR_SLOT(agp->host_groups, agp->next_host_index);
+               if (!hgp) {
+                       condlog(0, "can't get host group %d of adapter group %d", next_adapter_index, agp->next_host_index);
+                       return 1;
+               }

                if (!hgp->num_paths) {
                        agp->next_host_index++;
@@ -223,8 +231,8 @@ int rr_optimize_path_order(struct pathgroup *pgp)
        /* group paths in path group by host adapters
         */
        if (group_by_host_adapter(pgp, adapters)) {
+               /* already freed adapters */
                condlog(3, "Failed to group paths by adapters");
-               free_adaptergroup(adapters);
                return 0;
        }

--
1.8.3.1


--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel

[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux