netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2400m/USB: fix error return when rx_size is too large
@ 2019-12-02 17:42 Colin King
  2019-12-02 21:13 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2019-12-02 17:42 UTC (permalink / raw)
  To: Inaky Perez-Gonzalez, linux-wimax, David S . Miller, netdev
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Currently when the rx_size is too large the intended error
-EINVAL is not being returned as this is being assigned to
result rather than rx_skb. Fix this be setting rx_skb
to ERR_PTR(-EINVAL) so that the error is returned in rx_skb
as originally intended.

Addresses-Coverity: ("Unused value")
Fixes: a8ebf98f5414 ("i2400m/USB: TX and RX path backends")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/wimax/i2400m/usb-rx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wimax/i2400m/usb-rx.c b/drivers/net/wimax/i2400m/usb-rx.c
index 5b64bda7d9e7..1a5e2178bb27 100644
--- a/drivers/net/wimax/i2400m/usb-rx.c
+++ b/drivers/net/wimax/i2400m/usb-rx.c
@@ -256,7 +256,7 @@ struct sk_buff *i2400mu_rx(struct i2400mu *i2400mu, struct sk_buff *rx_skb)
 			i2400mu->rx_size = rx_size;
 		else if (printk_ratelimit()) {
 			dev_err(dev, "BUG? rx_size up to %d\n", rx_size);
-			result = -EINVAL;
+			rx_skb = ERR_PTR(-EINVAL);
 			goto out;
 		}
 		skb_put(rx_skb, read_size);
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] i2400m/USB: fix error return when rx_size is too large
  2019-12-02 17:42 [PATCH] i2400m/USB: fix error return when rx_size is too large Colin King
@ 2019-12-02 21:13 ` David Miller
  2019-12-04 11:32   ` Colin Ian King
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2019-12-02 21:13 UTC (permalink / raw)
  To: colin.king; +Cc: inaky, linux-wimax, netdev, kernel-janitors, linux-kernel

From: Colin King <colin.king@canonical.com>
Date: Mon,  2 Dec 2019 17:42:46 +0000

> From: Colin Ian King <colin.king@canonical.com>
> 
> Currently when the rx_size is too large the intended error
> -EINVAL is not being returned as this is being assigned to
> result rather than rx_skb. Fix this be setting rx_skb
> to ERR_PTR(-EINVAL) so that the error is returned in rx_skb
> as originally intended.
> 
> Addresses-Coverity: ("Unused value")
> Fixes: a8ebf98f5414 ("i2400m/USB: TX and RX path backends")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

This leaks rx_skb, the caller is supposed to clean up rx_skb
by freeing it if this function doesn't transmit it successfully.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] i2400m/USB: fix error return when rx_size is too large
  2019-12-02 21:13 ` David Miller
@ 2019-12-04 11:32   ` Colin Ian King
  0 siblings, 0 replies; 3+ messages in thread
From: Colin Ian King @ 2019-12-04 11:32 UTC (permalink / raw)
  To: David Miller; +Cc: inaky, linux-wimax, netdev, kernel-janitors, linux-kernel

On 02/12/2019 21:13, David Miller wrote:
> From: Colin King <colin.king@canonical.com>
> Date: Mon,  2 Dec 2019 17:42:46 +0000
> 
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> Currently when the rx_size is too large the intended error
>> -EINVAL is not being returned as this is being assigned to
>> result rather than rx_skb. Fix this be setting rx_skb
>> to ERR_PTR(-EINVAL) so that the error is returned in rx_skb
>> as originally intended.
>>
>> Addresses-Coverity: ("Unused value")
>> Fixes: a8ebf98f5414 ("i2400m/USB: TX and RX path backends")
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> 
> This leaks rx_skb, the caller is supposed to clean up rx_skb
> by freeing it if this function doesn't transmit it successfully.
> 
Oops, yes. Ignore this fix.

Colin

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-12-04 11:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-02 17:42 [PATCH] i2400m/USB: fix error return when rx_size is too large Colin King
2019-12-02 21:13 ` David Miller
2019-12-04 11:32   ` Colin Ian King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).