From: Dan Carpenter <error27@gmail.com> To: Linux Driver <Linux-Driver@qlogic.com>, "David S. Miller" <davem@davemloft.net>, Breno Leitao <leitao@linux.vnet.ibm.com>, "netdev@vger.kernel.org" <netdev@vger.kernel.org>, "kernel- Subject: [patch v2] qlge: pull NULL check ahead of dereference Date: Thu, 19 Aug 2010 20:52:44 +0200 [thread overview] Message-ID: <20100819185244.GD6674@bicker> (raw) In-Reply-To: <20100819125933.GB14895@linux-ox1b.qlogic.org> There was a dereference before NULL check issue introduced in 1e213303d "qlge: Add tx multiqueue support." I've pulled the NULL check of "net_rsp" forward a couple lines to avoid that. Also Ron Mercer says that the early exit should be above the index write. ql_write_cq_idx(rx_ring); Signed-off-by: Dan Carpenter <error27@gmail.com> --- v2: Moved the early exit ahead of the ql_write_cq_idx() diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c index 8d63f69..c9f9754 100644 --- a/drivers/net/qlge/qlge_main.c +++ b/drivers/net/qlge/qlge_main.c @@ -2222,10 +2222,11 @@ static int ql_clean_outbound_rx_ring(struct rx_ring *rx_ring) ql_update_cq(rx_ring); prod = ql_read_sh_reg(rx_ring->prod_idx_sh_reg); } + if (!net_rsp) + return 0; ql_write_cq_idx(rx_ring); tx_ring = &qdev->tx_ring[net_rsp->txq_idx]; - if (__netif_subqueue_stopped(qdev->ndev, tx_ring->wq_id) && - net_rsp != NULL) { + if (__netif_subqueue_stopped(qdev->ndev, tx_ring->wq_id)) { if (atomic_read(&tx_ring->queue_stopped) && (atomic_read(&tx_ring->tx_count) > (tx_ring->wq_len / 4))) /*
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com> To: Linux Driver <Linux-Driver@qlogic.com>, "David S. Miller" <davem@davemloft.net>, Breno Leitao <leitao@linux.vnet.ibm.com>, "netdev@vger.kernel.org" <netdev@vger.kernel.org>, kernel- Subject: [patch v2] qlge: pull NULL check ahead of dereference Date: Thu, 19 Aug 2010 18:52:44 +0000 [thread overview] Message-ID: <20100819185244.GD6674@bicker> (raw) In-Reply-To: <20100819125933.GB14895@linux-ox1b.qlogic.org> There was a dereference before NULL check issue introduced in 1e213303d "qlge: Add tx multiqueue support." I've pulled the NULL check of "net_rsp" forward a couple lines to avoid that. Also Ron Mercer says that the early exit should be above the index write. ql_write_cq_idx(rx_ring); Signed-off-by: Dan Carpenter <error27@gmail.com> --- v2: Moved the early exit ahead of the ql_write_cq_idx() diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c index 8d63f69..c9f9754 100644 --- a/drivers/net/qlge/qlge_main.c +++ b/drivers/net/qlge/qlge_main.c @@ -2222,10 +2222,11 @@ static int ql_clean_outbound_rx_ring(struct rx_ring *rx_ring) ql_update_cq(rx_ring); prod = ql_read_sh_reg(rx_ring->prod_idx_sh_reg); } + if (!net_rsp) + return 0; ql_write_cq_idx(rx_ring); tx_ring = &qdev->tx_ring[net_rsp->txq_idx]; - if (__netif_subqueue_stopped(qdev->ndev, tx_ring->wq_id) && - net_rsp != NULL) { + if (__netif_subqueue_stopped(qdev->ndev, tx_ring->wq_id)) { if (atomic_read(&tx_ring->queue_stopped) && (atomic_read(&tx_ring->tx_count) > (tx_ring->wq_len / 4))) /*
next prev parent reply other threads:[~2010-08-19 18:53 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-08-19 10:02 [patch] qlge: pull NULL check ahead of dereference Dan Carpenter 2010-08-19 10:02 ` Dan Carpenter 2010-08-19 12:19 ` Ron Mercer 2010-08-19 12:19 ` Ron Mercer 2010-08-19 12:59 ` Ron Mercer 2010-08-19 12:59 ` Ron Mercer 2010-08-19 18:52 ` Dan Carpenter [this message] 2010-08-19 18:52 ` [patch v2] " Dan Carpenter 2010-08-19 20:28 ` Ron Mercer 2010-08-19 20:28 ` Ron Mercer 2010-08-20 3:48 ` David Miller 2010-08-20 3:48 ` David Miller
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=20100819185244.GD6674@bicker \ --to=error27@gmail.com \ --cc=Linux-Driver@qlogic.com \ --cc=davem@davemloft.net \ --cc=leitao@linux.vnet.ibm.com \ --cc=netdev@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: linkBe 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.