Bug 199676 - [net80211] [patch]: fix possible kernel panic in IBSS mode (iv_bss may be freed twice)
Summary: [net80211] [patch]: fix possible kernel panic in IBSS mode (iv_bss may be fre...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: wireless (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-wireless (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2015-04-25 01:04 UTC by Andriy Voskoboinyk
Modified: 2015-05-04 00:49 UTC (History)
1 user (show)

See Also:


Attachments
Remove old iv_bss entry from the node table (1.04 KB, patch)
2015-04-25 01:04 UTC, Andriy Voskoboinyk
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andriy Voskoboinyk freebsd_committer freebsd_triage 2015-04-25 01:04:06 UTC
Created attachment 155958 [details]
Remove old iv_bss entry from the node table

This may happen on RUN -> SCAN -> RUN -> SCAN state transition:

1. RUN -> SCAN: in ieee80211_sta_join1(): iv_bss will be moved to obss, refcnt will be reduced by 2 (default minimum).

Now, if old iv_bss have some extra references (for example, from unacknowledged probe responses), it will not be freed and will stay in the node table.

2. SCAN -> RUN.

3. If old iv_bss will not be deleted by the time when the next RUN -> SCAN state transition occurs, then sta_leave() will reduce it's reference counter once more. As a result, two last users will free it -> this will lead to kernel panic.

In this patch old iv_bss entry is explicitly removed from the node table in ieee80211_sta_join1() (as a result, it will not be processed by sta_leave()).
Comment 1 commit-hook freebsd_committer freebsd_triage 2015-05-03 22:29:31 UTC
A commit references this bug:

Author: adrian
Date: Sun May  3 22:28:43 UTC 2015
New revision: 282372
URL: https://svnweb.freebsd.org/changeset/base/282372

Log:
  Remove old iv_bss entry from the node table

  This may happen on RUN -> SCAN -> RUN -> SCAN state transition:

  1. RUN -> SCAN: in ieee80211_sta_join1(): iv_bss will be moved to obss,
     refcnt will be reduced by 2 (default minimum).

  Now, if old iv_bss have some extra references (for example, from
  unacknowledged probe responses), it will not be freed and will stay
  in the node table.

  2. SCAN -> RUN.

  3. If old iv_bss will not be deleted by the time when the next RUN -> SCAN
     state transition occurs, then sta_leave() will reduce it's reference
     counter once more. As a result, two last users will free it -> this will
     lead to kernel panic.

  In this patch old iv_bss entry is explicitly removed from the node table in
  ieee80211_sta_join1() (as a result, it will not be processed by sta_leave()).

  PR:		kern/199676
  Differential Revision:	Andriy Voskoboinyk <s3erios@gmail.com>

Changes:
  head/sys/net80211/ieee80211_node.c