Bug 214542 - sysctl_ifmalisti: missing IF_ADDR_RUNLOCK if rtsock_msg_buffer returns error
Summary: sysctl_ifmalisti: missing IF_ADDR_RUNLOCK if rtsock_msg_buffer returns error
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Mark Johnston
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2016-11-15 17:53 UTC by tony.cai1982
Modified: 2016-11-22 17:44 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tony.cai1982 2016-11-15 17:53:13 UTC
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index ca89002..47777c3 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -1798,8 +1798,10 @@ sysctl_ifmalist(int af, struct walkarg *w)
                            (ifma->ifma_addr->sa_family != AF_LINK) ?
                            ifma->ifma_lladdr : NULL;
                        error = rtsock_msg_buffer(RTM_NEWMADDR, &info, w, &len);
-                       if (error != 0)
+                       if (error != 0) {
+                               IF_ADDR_RUNLOCK(ifp);
                                goto done;
+                       }
                        if (w->w_req && w->w_tmem) {
                                struct ifma_msghdr *ifmam;
Comment 1 commit-hook freebsd_committer freebsd_triage 2016-11-15 19:24:17 UTC
A commit references this bug:

Author: markj
Date: Tue Nov 15 19:23:49 UTC 2016
New revision: 308694
URL: https://svnweb.freebsd.org/changeset/base/308694

Log:
  Plug a lock leak in sysctl_ifmalist().

  Fix style in the local variable declarations.

  PR:		214542
  MFC after:	1 week

Changes:
  head/sys/net/rtsock.c
Comment 2 commit-hook freebsd_committer freebsd_triage 2016-11-22 17:43:44 UTC
A commit references this bug:

Author: markj
Date: Tue Nov 22 17:42:59 UTC 2016
New revision: 309015
URL: https://svnweb.freebsd.org/changeset/base/309015

Log:
  MFC r308694:
  Plug a lock leak in sysctl_ifmalist().

  PR:	214542

Changes:
_U  stable/11/
  stable/11/sys/net/rtsock.c