diff mbox series

[v1,2/2] pinctrl: Relax user input size in pinmux_select()

Message ID 20230604131215.78847-2-andriy.shevchenko@linux.intel.com
State Accepted
Commit e3275a89e5c7c4a78522357b8b677b1a79d4d011
Headers show
Series None | expand

Commit Message

Andy Shevchenko June 4, 2023, 1:12 p.m. UTC
This is debugfs and there is no much sense to strict the user from
sending as much data as they can. The memdup_user_nul() will anyway
fail if there is not enough memory.

Relax the user input size by removing an artificial limitaion.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/pinctrl/pinmux.c | 4 ----
 1 file changed, 4 deletions(-)

Comments

Linus Walleij June 9, 2023, 7:22 a.m. UTC | #1
On Sun, Jun 4, 2023 at 3:12 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> This is debugfs and there is no much sense to strict the user from
> sending as much data as they can. The memdup_user_nul() will anyway
> fail if there is not enough memory.
>
> Relax the user input size by removing an artificial limitaion.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Fair enough, patch applied!

Yours,
Linus Walleij
Andy Shevchenko June 13, 2023, 3:33 p.m. UTC | #2
On Tue, Jun 13, 2023 at 04:38:17PM +0200, Markus Elfring wrote:
> > This is debugfs and there is no much sense to strict the user from
> > sending as much data as they can. The memdup_user_nul() will anyway
> > fail if there is not enough memory.
> >
> > Relax the user input size by removing an artificial limitaion.
> 
> How are the chances to avoid typos also in such a change description?

Almost 0. This is now part of the non-rebased branch. It can be fixed
if and only if
- something really wrong happened before this patch in the tree and has
  to be fixed, and
- maintainer will remember to fix the typo.
Linus Walleij June 13, 2023, 6:17 p.m. UTC | #3
On Tue, Jun 13, 2023 at 4:38 PM Markus Elfring <Markus.Elfring@web.de> wrote:
> > This is debugfs and there is no much sense to strict the user from
> > sending as much data as they can. The memdup_user_nul() will anyway
> > fail if there is not enough memory.
> >
> > Relax the user input size by removing an artificial limitaion.
>
> How are the chances to avoid typos also in such a change description?

I don't care much about typos, and when a patch is coming from Andy
it's certainly not a blocker for anything since his patches are
of high technical value.

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
index 2d2f3bd164d5..82c750a31952 100644
--- a/drivers/pinctrl/pinmux.c
+++ b/drivers/pinctrl/pinmux.c
@@ -677,7 +677,6 @@  void pinmux_show_setting(struct seq_file *s,
 DEFINE_SHOW_ATTRIBUTE(pinmux_functions);
 DEFINE_SHOW_ATTRIBUTE(pinmux_pins);
 
-#define PINMUX_SELECT_MAX 128
 static ssize_t pinmux_select(struct file *file, const char __user *user_buf,
 				   size_t len, loff_t *ppos)
 {
@@ -689,9 +688,6 @@  static ssize_t pinmux_select(struct file *file, const char __user *user_buf,
 	unsigned int num_groups;
 	int fsel, gsel, ret;
 
-	if (len > PINMUX_SELECT_MAX)
-		return -ENOMEM;
-
 	buf = memdup_user_nul(user_buf, len);
 	if (IS_ERR(buf))
 		return PTR_ERR(buf);