All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: garrmcnu@gmail.com
Cc: netdev@vger.kernel.org, stephen@networkplumber.org,
	jiri@resnulli.us, nikolay@cumulusnetworks.com,
	bridge@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: bridge: fix potential null pointer dereference on return from br_port_get_rtnl()
Date: Fri, 22 Jun 2018 07:20:56 +0900 (KST)	[thread overview]
Message-ID: <20180622.072056.1223319763674661318.davem@davemloft.net> (raw)
In-Reply-To: <20180621201427.4961-1-garrmcnu@gmail.com>

From: Garry McNulty <garrmcnu@gmail.com>
Date: Thu, 21 Jun 2018 21:14:27 +0100

> br_port_get_rtnl() can return NULL if the network device is not a bridge
> port (IFF_BRIDGE_PORT flag not set). br_port_slave_changelink() and
> br_port_fill_slave_info() callbacks dereference this pointer without
> checking. Currently this is not a problem because slave devices always
> set this flag. Add null check in case these conditions ever change.
> 
> Detected by CoverityScan, CID 1339613 ("Dereference null return value")
> 
> Signed-off-by: Garry McNulty <garrmcnu@gmail.com>

I don't think this is reasonable.

The bridge code will never, ever, install a slave that doesn't have
that bit set.  It's the most fundamental aspect of how these objects
are managed.

WARNING: multiple messages have this Message-ID (diff)
From: David Miller <davem@davemloft.net>
To: garrmcnu@gmail.com
Cc: jiri@resnulli.us, nikolay@cumulusnetworks.com,
	netdev@vger.kernel.org, bridge@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [Bridge] [PATCH] net: bridge: fix potential null pointer dereference on return from br_port_get_rtnl()
Date: Fri, 22 Jun 2018 07:20:56 +0900 (KST)	[thread overview]
Message-ID: <20180622.072056.1223319763674661318.davem@davemloft.net> (raw)
In-Reply-To: <20180621201427.4961-1-garrmcnu@gmail.com>

From: Garry McNulty <garrmcnu@gmail.com>
Date: Thu, 21 Jun 2018 21:14:27 +0100

> br_port_get_rtnl() can return NULL if the network device is not a bridge
> port (IFF_BRIDGE_PORT flag not set). br_port_slave_changelink() and
> br_port_fill_slave_info() callbacks dereference this pointer without
> checking. Currently this is not a problem because slave devices always
> set this flag. Add null check in case these conditions ever change.
> 
> Detected by CoverityScan, CID 1339613 ("Dereference null return value")
> 
> Signed-off-by: Garry McNulty <garrmcnu@gmail.com>

I don't think this is reasonable.

The bridge code will never, ever, install a slave that doesn't have
that bit set.  It's the most fundamental aspect of how these objects
are managed.

  reply	other threads:[~2018-06-21 22:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-21 20:14 [PATCH] net: bridge: fix potential null pointer dereference on return from br_port_get_rtnl() Garry McNulty
2018-06-21 20:14 ` [Bridge] " Garry McNulty
2018-06-21 22:20 ` David Miller [this message]
2018-06-21 22:20   ` David Miller
2018-06-21 23:21   ` Stephen Hemminger
2018-06-21 23:21     ` [Bridge] " Stephen Hemminger
2018-06-21 23:21     ` Stephen Hemminger
2018-06-21 23:35   ` Nikolay Aleksandrov
2018-06-21 23:35     ` [Bridge] " Nikolay Aleksandrov
2018-06-21 23:35     ` Nikolay Aleksandrov
2018-06-22 19:05     ` Garry McNulty
2018-06-22 19:05       ` [Bridge] " Garry McNulty

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=20180622.072056.1223319763674661318.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=bridge@lists.linux-foundation.org \
    --cc=garrmcnu@gmail.com \
    --cc=jiri@resnulli.us \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@cumulusnetworks.com \
    --cc=stephen@networkplumber.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.