netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: walter harms <wharms@bfs.de>
Cc: Karsten Keil <isdn@linux-pingi.de>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] isdn: mISDN: set ->family in ->getname()
Date: Tue, 23 Apr 2013 11:02:14 +0300	[thread overview]
Message-ID: <20130423080213.GA30376@mwanda> (raw)
In-Reply-To: <51763AD7.10102@bfs.de>

On Tue, Apr 23, 2013 at 09:40:07AM +0200, walter harms wrote:
> 
> 
> Am 23.04.2013 08:24, schrieb Dan Carpenter:
> > The "maddr->family" variable was not set but instead it leaked stack
> > information to userspace.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > diff --git a/drivers/isdn/mISDN/socket.c b/drivers/isdn/mISDN/socket.c
> > index 8b07f83..a838864 100644
> > --- a/drivers/isdn/mISDN/socket.c
> > +++ b/drivers/isdn/mISDN/socket.c
> > @@ -578,6 +578,7 @@ data_sock_getname(struct socket *sock, struct sockaddr *addr,
> >  	lock_sock(sk);
> >  
> >  	*addr_len = sizeof(*maddr);
> > +	maddr->family = AF_ISDN;
> >  	maddr->dev = _pms(sk)->dev->id;
> >  	maddr->channel = _pms(sk)->ch.nr;
> >  	maddr->sapi = _pms(sk)->ch.addr & 0xff;
> 
> just nitpicking ...
> net/nfc/llcp/sock.c has a memset(..0,..) for the struct. Is this
> an options here also ?
> (just to make sure everything is 0 in the beginning)

In net/nfc/llcp/sock.c the struct has a hole after ->sa_family so
the memset() isn't optional.

These ->getname() patches were from manually auditing all the
->getname() functions.  I've tried to follow the local style in my
patches.  Quite a few of these use __packed structs to avoid holes
and the need for the memset().

regards,
dan carpenter

  reply	other threads:[~2013-04-23  8:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-23  6:24 [patch] isdn: mISDN: set ->family in ->getname() Dan Carpenter
2013-04-23  7:40 ` walter harms
2013-04-23  8:02   ` Dan Carpenter [this message]
2013-04-25  5:49 ` 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=20130423080213.GA30376@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=isdn@linux-pingi.de \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=wharms@bfs.de \
    /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).