Staging: prevent rtl8187se from crashing dev_ioctl() in SIOCGIWNAME
authorDan Aloni <dan@aloni.org>
Sat, 20 Jun 2009 13:32:22 +0000 (16:32 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sun, 12 Jul 2009 20:21:45 +0000 (13:21 -0700)
commit02c8baecf5d8850dba40b47cdf003ed2e04e66dd
tree78cb75f4d14bb25c72893e66da5a6c1d94a13924
parent77b9288197b6034c44abe2619aff62cba056a713
Staging: prevent rtl8187se from crashing dev_ioctl() in SIOCGIWNAME

I repeatedly get __stack_chk_fail panic()s with this driver before
applying the attached fix.

ieee80211_wx_get_name() ignores sizeof(wrqu->name) which is IFNAMSIZ (16), and
on certain conditions, the concatenated string will be larger than IFNAMSIZ
including the terminating zero.

    length ("802.11" ++ "b" ++ "/g" ++ " linked" ++ "\x00") == 17

This fix uses strl{cpy,cat} in addition to the reduction of the total
possible length of the output string by a char.

It can be applied to 2.6.30-stable as well.

Signed-off-by: Dan Aloni <dan@aloni.org>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c