On Tue, Oct 25, 2016 at 11:41 PM, Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote: > On Tue, Oct 25, 2016 at 10:06:48PM +0530, Souptick Joarder wrote: >> Hi Greg, >> >> >> On Tue, Oct 25, 2016 at 2:33 PM, Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote: >> > On Thu, Oct 20, 2016 at 12:29:33PM +0530, Souptick Joarder wrote: >> >> This patch is added to free memory and return failure when kmalloc fails >> > >> > I'm sorry, but I can not parse that sentance. Can you rephrase this a >> > bit better? What exactly are you doing here? >> >> There are few functions where we need to free previously allocated memory >> when kmalloc fails. Else it may lead to memory leakage. >> In _init_cmd_priv() and _r8712_init_xmit_priv() , few places we are >> not freeing >> previously allocated memory when kmalloc fails.This patch will address it. >> >> shall I resend the patch? > > Please do, it is long-gone from my queue, and put more text, like you > write here, in the changelog area. > >> >> diff --git a/drivers/staging/rtl8712/os_intfs.c b/drivers/staging/rtl8712/os_intfs.c >> >> index cbe4de0..aab3141 100644 >> >> --- a/drivers/staging/rtl8712/os_intfs.c >> >> +++ b/drivers/staging/rtl8712/os_intfs.c >> >> @@ -313,7 +313,8 @@ u8 r8712_init_drv_sw(struct _adapter *padapter) >> >> return _FAIL; >> >> if (r8712_init_mlme_priv(padapter) == _FAIL) >> >> return _FAIL; >> >> - _r8712_init_xmit_priv(&padapter->xmitpriv, padapter); >> >> + if ((_r8712_init_xmit_priv(&padapter->xmitpriv, padapter)) != _SUCCESS) >> >> + return _FAIL; >> > >> > You don't have to unwind anything that r8712_init_mlme_priv() did? >> >> I didn't get your question? >> >> r8712_init_drv_sw() is getting called during initialization. >> if _r8712_init_xmit_priv() fails is it required to continue driver >> initialization >> or return _FAIL similar like previous function r8712_init_mlme_priv() ? > > Are you sure that r8712_init_mlme_priv() does not allocate anything that > you need to now free? Yes you are right. We are not freeing few memories allocated in r8712_init_mlme_priv() when _r8712_init_xmit_priv() return _FAIL. So we can't simply send _FAIL without freeing those memories. I will resend the modified patch in a new mail. > > thanks, > > greg k-h _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel