netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: mcarlson@broadcom.com
Cc: netdev@vger.kernel.org, mchan@broadcom.com, andy@greyhouse.net,
	tonyb@cybernetics.com
Subject: Re: [PATCH 1/2] tg3: 5701 DMA corruption fix
Date: Thu, 17 Apr 2008 23:26:12 -0700 (PDT)	[thread overview]
Message-ID: <20080417.232612.04456205.davem@davemloft.net> (raw)
In-Reply-To: <20080416222741.GA20272@localdomain>

From: "Matt Carlson" <mcarlson@broadcom.com>
Date: Wed, 16 Apr 2008 15:27:41 -0700

> +		while (pci_id->vendor != 0) {
> +			bridge = pci_get_device(pci_id->vendor,
> +						pci_id->device,
> +						bridge);
> +			if (!bridge) {
> +				pci_id++;
> +				continue;
> +			}
> +			if (bridge->subordinate &&
> +			    (bridge->subordinate->number <=
> +			     tp->pdev->bus->number) &&
> +			    (bridge->subordinate->subordinate >=
> +			     tp->pdev->bus->number)) {
> +				tp->tg3_flags3 |= TG3_FLG3_5701_DMA_BUG;
> +				pci_dev_put(bridge);
> +				break;
> +			}
> +		}
> +	}

This code block will leak bridge device objects when the table
comparison check fails.

Probably the best thing to do is seperate the boolean check
from the other operations:

	bool match = false;
 ...
	if (bridge->subordinate &&
	    (bridge->subordinate->number <=
	     tp->pdev->bus->number) &&
	    (bridge->subordinate->subordinate >=
	     tp->pdev->bus->number))
		match = true;

	pci_dev_put_bridge(bridge);

	if (match) {
		tp->tg3_flags |= TG3_FLG3_5701_DMA_BUG;
		pci_dev_put(bridge);
	}

Please fix this up, and combine the version bump into this patch.

Thank you!

  reply	other threads:[~2008-04-18  6:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-16 22:27 [PATCH 1/2] tg3: 5701 DMA corruption fix Matt Carlson
2008-04-18  6:26 ` David Miller [this message]
2008-04-18 17:45   ` Michael Chan
2008-04-18 21:57     ` 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=20080417.232612.04456205.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=andy@greyhouse.net \
    --cc=mcarlson@broadcom.com \
    --cc=mchan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=tonyb@cybernetics.com \
    /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 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).