From: Alexey Khoroshilov <khoroshilov@ispras.ru>
To: Krishna Chaitanya <chaitanya.mgit@gmail.com>
Cc: Christian Lamparter <chunkeey@googlemail.com>,
"John W. Linville" <linville@tuxdriver.com>,
linux-wireless <linux-wireless@vger.kernel.org>,
netdev <netdev@vger.kernel.org>,
linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org
Subject: Re: [PATCH] p54usb: fix leaks at failure path in p54u_probe()
Date: Sun, 09 Mar 2014 03:01:19 +0400 [thread overview]
Message-ID: <531BA13F.2060205@ispras.ru> (raw)
In-Reply-To: <CABPxzYLzMvtWShP_PFdyTzV8P1P177yPZh=xAO=3tiy97UfEmQ@mail.gmail.com>
On 09.03.2014 02:44, Krishna Chaitanya wrote:
> On Sat, Mar 8, 2014 at 2:41 AM, Alexey Khoroshilov
> <khoroshilov@ispras.ru> wrote:
>> If p54u_load_firmware() fails, p54u_probe() does not deallocate
>> already allocated resources. The patch adds proper failure handling.
>>
>> Found by Linux Driver Verification project (linuxtesting.org).
>>
>> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
>> ---
>> drivers/net/wireless/p54/p54usb.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
>> index 6e635cfa24c8..5df74503fd4f 100644
>> --- a/drivers/net/wireless/p54/p54usb.c
>> +++ b/drivers/net/wireless/p54/p54usb.c
>> @@ -1053,6 +1053,10 @@ static int p54u_probe(struct usb_interface *intf,
>> priv->upload_fw = p54u_upload_firmware_net2280;
>> }
>> err = p54u_load_firmware(dev, intf);
>> + if (err) {
>> + usb_put_dev(udev);
>> + p54_free_common(dev);
>> + }
>> return err;
>> }
> The load_firmware puts down the reference
> in case of error. Only free is required here.
No, p54u_load_firmware() puts down reference that was got up by itself.
So we still have to put down reference got up in p54u_probe().
--
Alexey
next prev parent reply other threads:[~2014-03-08 23:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-07 21:11 [PATCH] p54usb: fix leaks at failure path in p54u_probe() Alexey Khoroshilov
2014-03-07 21:27 ` Christian Lamparter
2014-03-08 22:44 ` Krishna Chaitanya
2014-03-08 23:01 ` Alexey Khoroshilov [this message]
2014-03-08 23:08 ` Christian Lamparter
2014-03-08 23:10 ` Krishna Chaitanya
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=531BA13F.2060205@ispras.ru \
--to=khoroshilov@ispras.ru \
--cc=chaitanya.mgit@gmail.com \
--cc=chunkeey@googlemail.com \
--cc=ldv-project@linuxtesting.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.