stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 02/26] media: dvb_frontend: be sure to init dvb_frontend_handle_ioctl() return code
       [not found] <c4389ab1c02bb08c1a55012fdb859c8b10bdc47e.1509569763.git.mchehab@s-opensource.com>
@ 2017-11-01 21:05 ` Mauro Carvalho Chehab
  2017-11-07 18:29   ` Daniel Scheller
  0 siblings, 1 reply; 2+ messages in thread
From: Mauro Carvalho Chehab @ 2017-11-01 21:05 UTC (permalink / raw)
  Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
	Mauro Carvalho Chehab, Shuah Khan, Max Kellermann, Colin Ian King,
	Satendra Singh Thakur, stable

As smatch warned:
	drivers/media/dvb-core/dvb_frontend.c:2468 dvb_frontend_handle_ioctl() error: uninitialized symbol 'err'.

The ioctl handler actually got a regression here: before changeset
d73dcf0cdb95 ("media: dvb_frontend: cleanup ioctl handling logic"),
the code used to return -EOPNOTSUPP if an ioctl handler was not
implemented on a driver. After the change, it may return a random
value.

Fixes: d73dcf0cdb95 ("media: dvb_frontend: cleanup ioctl handling logic")
# For 4.14
Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
---
 drivers/media/dvb-core/dvb_frontend.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c
index daaf969719e4..bcf0cbcbf7b2 100644
--- a/drivers/media/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb-core/dvb_frontend.c
@@ -2109,7 +2109,7 @@ static int dvb_frontend_handle_ioctl(struct file *file,
 	struct dvb_frontend *fe = dvbdev->priv;
 	struct dvb_frontend_private *fepriv = fe->frontend_priv;
 	struct dtv_frontend_properties *c = &fe->dtv_property_cache;
-	int i, err;
+	int i, err = -EOPNOTSUPP;
 
 	dev_dbg(fe->dvb->device, "%s:\n", __func__);
 
@@ -2144,6 +2144,7 @@ static int dvb_frontend_handle_ioctl(struct file *file,
 			}
 		}
 		kfree(tvp);
+		err = 0;
 		break;
 	}
 	case FE_GET_PROPERTY: {
@@ -2195,6 +2196,7 @@ static int dvb_frontend_handle_ioctl(struct file *file,
 			return -EFAULT;
 		}
 		kfree(tvp);
+		err = 0;
 		break;
 	}
 
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 02/26] media: dvb_frontend: be sure to init dvb_frontend_handle_ioctl() return code
  2017-11-01 21:05 ` [PATCH v2 02/26] media: dvb_frontend: be sure to init dvb_frontend_handle_ioctl() return code Mauro Carvalho Chehab
@ 2017-11-07 18:29   ` Daniel Scheller
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Scheller @ 2017-11-07 18:29 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Linux Media Mailing List, Mauro Carvalho Chehab, Shuah Khan,
	Max Kellermann, Colin Ian King, Satendra Singh Thakur, stable

Am Wed,  1 Nov 2017 17:05:39 -0400
schrieb Mauro Carvalho Chehab <mchehab@s-opensource.com>:

> As smatch warned:
> 	drivers/media/dvb-core/dvb_frontend.c:2468
> dvb_frontend_handle_ioctl() error: uninitialized symbol 'err'.
> 
> The ioctl handler actually got a regression here: before changeset
> d73dcf0cdb95 ("media: dvb_frontend: cleanup ioctl handling logic"),
> the code used to return -EOPNOTSUPP if an ioctl handler was not
> implemented on a driver. After the change, it may return a random
> value.
> 
> Fixes: d73dcf0cdb95 ("media: dvb_frontend: cleanup ioctl handling
> logic") # For 4.14
> Cc: stable@vger.kernel.org
> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
> ---
>  drivers/media/dvb-core/dvb_frontend.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/dvb-core/dvb_frontend.c
> b/drivers/media/dvb-core/dvb_frontend.c index
> daaf969719e4..bcf0cbcbf7b2 100644 ---
> a/drivers/media/dvb-core/dvb_frontend.c +++
> b/drivers/media/dvb-core/dvb_frontend.c @@ -2109,7 +2109,7 @@ static
> int dvb_frontend_handle_ioctl(struct file *file, struct dvb_frontend
> *fe = dvbdev->priv; struct dvb_frontend_private *fepriv =
> fe->frontend_priv; struct dtv_frontend_properties *c =
> &fe->dtv_property_cache;
> -	int i, err;
> +	int i, err = -EOPNOTSUPP;
>  
>  	dev_dbg(fe->dvb->device, "%s:\n", __func__);
>  
> @@ -2144,6 +2144,7 @@ static int dvb_frontend_handle_ioctl(struct
> file *file, }
>  		}
>  		kfree(tvp);
> +		err = 0;
>  		break;
>  	}
>  	case FE_GET_PROPERTY: {
> @@ -2195,6 +2196,7 @@ static int dvb_frontend_handle_ioctl(struct
> file *file, return -EFAULT;
>  		}
>  		kfree(tvp);
> +		err = 0;
>  		break;
>  	}
>  

Tested-by: Daniel Scheller <d.scheller@gmx.net>

Fixes false reporting of successful DVBv3 signal stats inquiry when
they're not available, causing wrong assumptions and values in userspace
apps.

Best regards,
Daniel Scheller
-- 
https://github.com/herrnst

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-07 18:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <c4389ab1c02bb08c1a55012fdb859c8b10bdc47e.1509569763.git.mchehab@s-opensource.com>
2017-11-01 21:05 ` [PATCH v2 02/26] media: dvb_frontend: be sure to init dvb_frontend_handle_ioctl() return code Mauro Carvalho Chehab
2017-11-07 18:29   ` Daniel Scheller

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).