From: Dan Carpenter <dan.carpenter@oracle.com>
To: Walter Harms <wharms@bfs.de>
Cc: Ping-Ke Shih <pkshih@realtek.com>,
Jussi Kivilinna <jussi.kivilinna@iki.fi>,
Kalle Valo <kvalo@codeaurora.org>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"kernel-janitors@vger.kernel.org"
<kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH] rtlwifi: Fix a double free in _rtl_usb_tx_urb_setup()
Date: Wed, 13 May 2020 16:44:46 +0300 [thread overview]
Message-ID: <20200513134446.GC3041@kadam> (raw)
In-Reply-To: <ba9452bd2cff4888b76fd17ef85a274b@bfs.de>
On Wed, May 13, 2020 at 01:38:09PM +0000, Walter Harms wrote:
> IMHO _rtl_usb_transmit() should not free() either
> it should return -1.
> The only caller is rtl_usb_tx() where we need a check:
>
> if ( _rtl_usb_transmit() < 0)
> goto err_free;
>
> but i am confused, rtl_usb_tx() is returning NETDEV_TX_OK in an error case ?
>
> err_free:
> dev_kfree_skb_any(skb);
> return NETDEV_TX_OK;
This is a pretty typical pattern in networking. For convenience we are
pretending that the transmit always succeeds and that the packet was
lost somewhere in the network. The TCP layer will ask for a resend.
regards,
dan carpenter
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Walter Harms <wharms@bfs.de>
Cc: Ping-Ke Shih <pkshih@realtek.com>,
Jussi Kivilinna <jussi.kivilinna@iki.fi>,
Kalle Valo <kvalo@codeaurora.org>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"kernel-janitors@vger.kernel.org"
<kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH] rtlwifi: Fix a double free in _rtl_usb_tx_urb_setup()
Date: Wed, 13 May 2020 13:44:46 +0000 [thread overview]
Message-ID: <20200513134446.GC3041@kadam> (raw)
In-Reply-To: <ba9452bd2cff4888b76fd17ef85a274b@bfs.de>
On Wed, May 13, 2020 at 01:38:09PM +0000, Walter Harms wrote:
> IMHO _rtl_usb_transmit() should not free() either
> it should return -1.
> The only caller is rtl_usb_tx() where we need a check:
>
> if ( _rtl_usb_transmit() < 0)
> goto err_free;
>
> but i am confused, rtl_usb_tx() is returning NETDEV_TX_OK in an error case ?
>
> err_free:
> dev_kfree_skb_any(skb);
> return NETDEV_TX_OK;
This is a pretty typical pattern in networking. For convenience we are
pretending that the transmit always succeeds and that the packet was
lost somewhere in the network. The TCP layer will ask for a resend.
regards,
dan carpenter
next prev parent reply other threads:[~2020-05-13 13:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-13 9:39 [PATCH] rtlwifi: Fix a double free in _rtl_usb_tx_urb_setup() Dan Carpenter
2020-05-13 9:39 ` Dan Carpenter
2020-05-13 13:38 ` AW: " Walter Harms
2020-05-13 13:44 ` Dan Carpenter [this message]
2020-05-13 13:44 ` Dan Carpenter
2020-05-18 12:15 ` Kalle Valo
2020-05-18 12:15 ` Kalle Valo
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=20200513134446.GC3041@kadam \
--to=dan.carpenter@oracle.com \
--cc=jussi.kivilinna@iki.fi \
--cc=kernel-janitors@vger.kernel.org \
--cc=kvalo@codeaurora.org \
--cc=linux-wireless@vger.kernel.org \
--cc=pkshih@realtek.com \
--cc=wharms@bfs.de \
/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.