[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170807.140640.71936308742422582.davem@davemloft.net>
Date: Mon, 07 Aug 2017 14:06:40 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: khoroshilov@...ras.ru
Cc: romieu@...zoreil.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, ldv-project@...uxtesting.org
Subject: Re: [PATCH] wan: dscc4: add checks for dma mapping errors
From: Alexey Khoroshilov <khoroshilov@...ras.ru>
Date: Fri, 4 Aug 2017 23:23:24 +0300
> The driver does not check if mapping dma memory succeed.
> The patch adds the checks and failure handling.
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Alexey Khoroshilov <khoroshilov@...ras.ru>
This is a great example of why it can be irritating to see these
mechanical "bug fixes" for drivers very few people use and actually
test, which introduces new bugs.
> @@ -522,19 +522,27 @@ static inline int try_get_rx_skb(struct dscc4_dev_priv *dpriv,
> struct RxFD *rx_fd = dpriv->rx_fd + dirty;
> const int len = RX_MAX(HDLC_MAX_MRU);
> struct sk_buff *skb;
> - int ret = 0;
> + dma_addr_t addr;
>
> skb = dev_alloc_skb(len);
> dpriv->rx_skbuff[dirty] = skb;
skb recorded here.
> +err_free_skb:
> + dev_kfree_skb_any(skb);
Yet freed here in the error path.
dpriv->rx_skbuff[dirty] should not be set to 'skb' until all possibile
failure tests have passed.
Powered by blists - more mailing lists