Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e1ae0a89 authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman
Browse files

USB: gadget: u_ether: Fix a configfs return code



commit 650bf52208d804ad5ee449c58102f8dc43175573 upstream.

If the string is invalid, this should return -EINVAL instead of 0.

Fixes: 73517cf4 ("usb: gadget: add RNDIS configfs options for class/subclass/protocol")
Cc: stable <stable@vger.kernel.org>
Acked-by: default avatarLorenzo Colitti <lorenzo@google.com>
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/YCqZ3P53yyIg5cn7@mwanda


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cbee4586
Loading
Loading
Loading
Loading
+2 −3
Original line number Original line Diff line number Diff line
@@ -169,12 +169,11 @@ out: \
						size_t len)		\
						size_t len)		\
	{								\
	{								\
		struct f_##_f_##_opts *opts = to_f_##_f_##_opts(item);	\
		struct f_##_f_##_opts *opts = to_f_##_f_##_opts(item);	\
		int ret;						\
		int ret = -EINVAL;					\
		u8 val;							\
		u8 val;							\
									\
									\
		mutex_lock(&opts->lock);				\
		mutex_lock(&opts->lock);				\
		ret = sscanf(page, "%02hhx", &val);			\
		if (sscanf(page, "%02hhx", &val) > 0) {			\
		if (ret > 0) {						\
			opts->_n_ = val;				\
			opts->_n_ = val;				\
			ret = len;					\
			ret = len;					\
		}							\
		}							\