The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Simon Sandström" <simon@nikanor.nu>
Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org,
	linux@Wolf-Entwicklungen.de, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/6] staging: pi433: Rename enum modShaping in rf69_enum.h
Date: Mon, 4 Dec 2017 13:33:56 +0300	[thread overview]
Message-ID: <20171204103356.cxmblmuvva3kjst6@mwanda> (raw)
In-Reply-To: <20171203151726.16639-7-simon@nikanor.nu>

On Sun, Dec 03, 2017 at 04:17:26PM +0100, Simon Sandström wrote:
> diff --git a/drivers/staging/pi433/pi433_if.h b/drivers/staging/pi433/pi433_if.h
> index 34ff0d4807bd..bcfe29840889 100644
> --- a/drivers/staging/pi433/pi433_if.h
> +++ b/drivers/staging/pi433/pi433_if.h
> @@ -63,7 +63,7 @@ struct pi433_tx_cfg {
>  	__u16			bit_rate;
>  	__u32			dev_frequency;
>  	enum modulation		modulation;
> -	enum modShaping		modShaping;
> +	enum mod_shaping	mod_shaping;
>  

I looked at how mod_shaping is set and the only place is in the ioctl:

   789          case PI433_IOC_WR_TX_CFG:
   790                  if (copy_from_user(&instance->tx_cfg, argp,
   791                                          sizeof(struct pi433_tx_cfg)))
   792                          return -EFAULT;
   793                  break;

We just write over the whole config.  Including important things like
rx_cfg.fixed_message_length.  There is no locking so when we do things
like:

   385          /* fixed or unlimited length? */
   386          if (dev->rx_cfg.fixed_message_length != 0)
   387          {
   388                  if (dev->rx_cfg.fixed_message_length > dev->rx_buffer_size)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
check

   389                  {
   390                          retval = -1;
   391                          goto abort;
   392                  }
   393                  bytes_total = dev->rx_cfg.fixed_message_length;
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
set this in the ioctl after the check but before this line and it looks
like a security problem.

   394                  dev_dbg(dev->dev,"rx: msg len set to %d by fixed length", bytes_total);
   395          }

Anyway, I guess this patch is fine.

regards,
dan carpenter

  reply	other threads:[~2017-12-04 10:34 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-03 15:17 [PATCH 0/6] Fix indentation and CamelCase issues in staging/pi433 Simon Sandström
2017-12-03 15:17 ` [PATCH 1/6] staging: pi433: Fix indentation in rf69_enum.h Simon Sandström
2017-12-03 15:17 ` [PATCH 2/6] staging: pi433: Capitalize constant definitions Simon Sandström
2017-12-03 15:17 ` [PATCH 3/6] staging: pi433: Rename variable in struct pi433_rx_cfg Simon Sandström
2017-12-03 15:17 ` [PATCH 4/6] staging: pi433: Rename enum optionOnOff in rf69_enum.h Simon Sandström
2017-12-03 16:49   ` Marcus Wolf
2017-12-04 10:04     ` Simon Sandström
2017-12-04 10:17   ` Dan Carpenter
2017-12-04 10:37     ` Dan Carpenter
2017-12-04 18:37       ` Marcus Wolf
2017-12-04 19:15         ` Dan Carpenter
2017-12-04 19:22           ` Marcus Wolf
2017-12-04 19:42             ` Simon Sandström
2017-12-04 19:59               ` Marcus Wolf
2017-12-04 20:05                 ` Simon Sandström
2017-12-05 12:06                   ` Marcus Wolf
2017-12-05 12:16                 ` Dan Carpenter
2017-12-05 12:40                   ` Marcus Wolf
2017-12-05 13:03                     ` Dan Carpenter
2017-12-03 15:17 ` [PATCH 5/6] staging: pi433: Rename enum dataMode " Simon Sandström
2017-12-04 10:24   ` Dan Carpenter
2017-12-04 19:12     ` Marcus Wolf
2017-12-04 19:21       ` Dan Carpenter
2017-12-04 19:31         ` Marcus Wolf
2017-12-04 19:56           ` Dan Carpenter
2017-12-04 20:21             ` Marcus Wolf
2017-12-03 15:17 ` [PATCH 6/6] staging: pi433: Rename enum modShaping " Simon Sandström
2017-12-04 10:33   ` Dan Carpenter [this message]
2017-12-04 18:59     ` Marcus Wolf
2017-12-04 19:18       ` Dan Carpenter
2017-12-04 19:41         ` Marcus Wolf
2017-12-17 17:13         ` Marcus Wolf

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=20171204103356.cxmblmuvva3kjst6@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@Wolf-Entwicklungen.de \
    --cc=simon@nikanor.nu \
    /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