Re: [PATCH v2] Fix use after free warning introduced by gcc 12.1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Apr 30, 2023 at 12:04:57AM +0530, Krishna Chaitanya wrote:
> On Fri, Apr 28, 2023 at 9:09 PM Jouni Malinen <j@xxxxx> wrote:
> >
> > On Fri, Apr 21, 2023 at 12:58:21AM +0530, Krishna wrote:
> > > gcc 12.1 complains about using pointer after realloc as it could
> > > potentially be moved/freed, causing any uses after UB.
> > >
> > > Fix this by doing checks before alloc and use those statuses and update
> > > with new BSS.
> >
> > Could you please provide the exact warning message produced by the
> > compiler? gcc 12.1 did not complain about anything in my test setup when
> > compiling wpa_supplicant, so I'm assuming this would need some extra
> > warnings to be enabled.
> 
> ../../../../../modules/lib/hostap/wpa_supplicant/bss.c:701:25: error:
> pointer 'bss' may be used after 'realloc' [-Werror=use-after-free]
> 701 | wpa_bss_update_pending_connect(wpa_s, bss, nbss);

Thanks for the details. This gets hidden by CONFIG_WPA_TRACE=y that I
use in my builds.. I was able to reproduce this now and I applied the
patch with some cleanup.

-- 
Jouni Malinen                                            PGP id EFC895FA

_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux