提交 fe09b32a 编写于 作者: J Jesper Juhl 提交者: John W. Linville

Net, libertas: Resolve memory leak in if_spi_host_to_card()

If we hit the default case in the switch in if_spi_host_to_card() we'll leak
the memory we allocated for 'packet'. This patch resolves the leak by freeing
the allocated memory in that case.
Signed-off-by: NJesper Juhl <jj@chaosbits.net>
Acked-by: NDan Williams <dcbw@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 ed66ba47
...@@ -995,6 +995,7 @@ static int if_spi_host_to_card(struct lbs_private *priv, ...@@ -995,6 +995,7 @@ static int if_spi_host_to_card(struct lbs_private *priv,
spin_unlock_irqrestore(&card->buffer_lock, flags); spin_unlock_irqrestore(&card->buffer_lock, flags);
break; break;
default: default:
kfree(packet);
netdev_err(priv->dev, "can't transfer buffer of type %d\n", netdev_err(priv->dev, "can't transfer buffer of type %d\n",
type); type);
err = -EINVAL; err = -EINVAL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册