lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1478011552-24957-1-git-send-email-weiyj.lk@gmail.com>
Date:   Tue,  1 Nov 2016 14:45:52 +0000
From:   Wei Yongjun <weiyj.lk@...il.com>
To:     "David S . Miller" <davem@...emloft.net>,
        stephen hemminger <stephen@...workplumber.org>,
        Tom Herbert <tom@...bertland.com>,
        Florian Westphal <fw@...len.de>,
        Johannes Berg <johannes.berg@...el.com>,
        pravin shelar <pshelar@....org>,
        Tycho Andersen <tycho.andersen@...onical.com>,
        Matti Vaittinen <matti.vaittinen@...ia.com>
Cc:     Wei Yongjun <weiyongjun1@...wei.com>, netdev@...r.kernel.org
Subject: [PATCH net-next v2] genetlink: fix error return code in genl_register_family()

From: Wei Yongjun <weiyongjun1@...wei.com>

Fix to return a negative error code from the idr_alloc() error handling
case instead of 0, as done elsewhere in this function.

Also fix the return value check of idr_alloc() since idr_alloc return
negative errors on failure, not zero.

Fixes: 2ae0f17df1cd ("genetlink: use idr to track families")
Signed-off-by: Wei Yongjun <weiyongjun1@...wei.com>
---
v1 -> v2: fix the return value check and return idr_alloc's err code
---
 net/netlink/genetlink.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index caf04d7..bbd3bff 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -362,8 +362,10 @@ int genl_register_family(struct genl_family *family)
 
 	family->id = idr_alloc(&genl_fam_idr, family,
 			       start, end + 1, GFP_KERNEL);
-	if (!family->id)
+	if (family->id < 0) {
+		err = family->id;
 		goto errout_locked;
+	}
 
 	err = genl_validate_assign_mc_groups(family);
 	if (err)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ