All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: [bug report] qed: Add Light L2 support
Date: Tue, 11 Oct 2016 08:34:20 +0000	[thread overview]
Message-ID: <20161011083420.GA18141@mwanda> (raw)

Hello Yuval Mintz,

The patch 0a7fb11c23c0: "qed: Add Light L2 support" from Oct 1, 2016,
leads to the following Smatch warning:

	drivers/net/ethernet/qlogic/qed/qed_ll2.c:1590 qed_ll2_start()
	error: dereferencing freed memory 'buffer'

drivers/net/ethernet/qlogic/qed/qed_ll2.c
  1587  
  1588          /* Post all Rx buffers to FW */
  1589          spin_lock_bh(&cdev->ll2->lock);
  1590          list_for_each_entry(buffer, &cdev->ll2->list, list) {
                                    ^^^^^^
Note.

  1591                  rc = qed_ll2_post_rx_buffer(QED_LEADING_HWFN(cdev),
  1592                                              cdev->ll2->handle,
  1593                                              buffer->phys_addr, 0, buffer, 1);
  1594                  if (rc) {
  1595                          DP_INFO(cdev,
  1596                                  "Failed to post an Rx buffer; Deleting it\n");
  1597                          dma_unmap_single(&cdev->pdev->dev, buffer->phys_addr,
  1598                                           cdev->ll2->rx_size, DMA_FROM_DEVICE);
  1599                          kfree(buffer->data);
  1600                          list_del(&buffer->list);
  1601                          kfree(buffer);
                                      ^^^^^^

There was probably supposed to be a break statement after this kfree().
Otherwise use list_for_each_entry_safe().

  1602                  } else {
  1603                          cdev->ll2->rx_cnt++;
  1604                  }
  1605          }
  1606          spin_unlock_bh(&cdev->ll2->lock);
  1607  

regards,
dan carpenter

                 reply	other threads:[~2016-10-11  8:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20161011083420.GA18141@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@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.