Bug 195953 - Possible access to unintended variable in "linux/net/mac80211/sta_info.c" line 2158
Summary: Possible access to unintended variable in "linux/net/mac80211/sta_info.c" lin...
Status: CLOSED CODE_FIX
Alias: None
Product: Networking
Classification: Unclassified
Component: Wireless (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Johannes Berg
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-01 06:55 UTC by Petru-Florin Mihancea
Modified: 2017-06-01 19:28 UTC (History)
0 users

See Also:
Kernel Version: 4.12-rc3
Tree: Mainline
Regression: No


Attachments

Description Petru-Florin Mihancea 2017-06-01 06:55:22 UTC
While experimenting with a CodeSonar plugin we develop, we noticed a
potential issue in file "linux/net/mac80211/sta_info.c" line 2158 function sta_set_sinfo

        sinfo->rx_dropped_misc = sta->rx_stats.dropped;
	if (sta->pcpu_rx_stats) {
		for_each_possible_cpu(cpu) {
			struct ieee80211_sta_rx_stats *cpurxs;

			cpurxs = per_cpu_ptr(sta->pcpu_rx_stats, cpu);
	/*HERE*/	sinfo->rx_packets += cpurxs->dropped;
		}
        }

Wasn't the intention to use "rx_dropped_misc" (instead of "rx_packets") in the indicated line. In the first line, "rx_dropped_misc" is updated.

Thank you.
Comment 1 Johannes Berg 2017-06-01 18:22:51 UTC
Yeah, good catch, probably copy/paste issue. Will fix.

Note You need to log in before you can comment on or make changes to this bug.