Revision 6d36c728bc2e2d632f4b0dea00df5532e20dfdab authored by Linus Torvalds on 21 October 2022, 00:24:59 UTC, committed by Linus Torvalds on 21 October 2022, 00:24:59 UTC
Pull networking fixes from Paolo Abeni:
 "Including fixes from netfilter.

  Current release - regressions:

   - revert "net: fix cpu_max_bits_warn() usage in
     netif_attrmask_next{,_and}"

   - revert "net: sched: fq_codel: remove redundant resource cleanup in
     fq_codel_init()"

   - dsa: uninitialized variable in dsa_slave_netdevice_event()

   - eth: sunhme: uninitialized variable in happy_meal_init()

  Current release - new code bugs:

   - eth: octeontx2: fix resource not freed after malloc

  Previous releases - regressions:

   - sched: fix return value of qdisc ingress handling on success

   - sched: fix race condition in qdisc_graft()

   - udp: update reuse->has_conns under reuseport_lock.

   - tls: strp: make sure the TCP skbs do not have overlapping data

   - hsr: avoid possible NULL deref in skb_clone()

   - tipc: fix an information leak in tipc_topsrv_kern_subscr

   - phylink: add mac_managed_pm in phylink_config structure

   - eth: i40e: fix DMA mappings leak

   - eth: hyperv: fix a RX-path warning

   - eth: mtk: fix memory leaks

  Previous releases - always broken:

   - sched: cake: fix null pointer access issue when cake_init() fails"

* tag 'net-6.1-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (43 commits)
  net: phy: dp83822: disable MDI crossover status change interrupt
  net: sched: fix race condition in qdisc_graft()
  net: hns: fix possible memory leak in hnae_ae_register()
  wwan_hwsim: fix possible memory leak in wwan_hwsim_dev_new()
  sfc: include vport_id in filter spec hash and equal()
  genetlink: fix kdoc warnings
  selftests: add selftest for chaining of tc ingress handling to egress
  net: Fix return value of qdisc ingress handling on success
  net: sched: sfb: fix null pointer access issue when sfb_init() fails
  Revert "net: sched: fq_codel: remove redundant resource cleanup in fq_codel_init()"
  net: sched: cake: fix null pointer access issue when cake_init() fails
  ethernet: marvell: octeontx2 Fix resource not freed after malloc
  netfilter: nf_tables: relax NFTA_SET_ELEM_KEY_END set flags requirements
  netfilter: rpfilter/fib: Set ->flowic_uid correctly for user namespaces.
  ionic: catch NULL pointer issue on reconfig
  net: hsr: avoid possible NULL deref in skb_clone()
  bnxt_en: fix memory leak in bnxt_nvm_test()
  ip6mr: fix UAF issue in ip6mr_sk_done() when addrconf_init_net() failed
  udp: Update reuse->has_conns under reuseport_lock.
  net: ethernet: mediatek: ppe: Remove the unused function mtk_foe_entry_usable()
  ...
2 parent s c7b0065 + 7f378c0
Raw File
get_led_device_info.sh
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0

led_common_defs_path="include/dt-bindings/leds/common.h"

num_args=$#
if [ $num_args -eq 1 ]; then
        linux_top=$(dirname `realpath $0` | awk -F/     \
                        '{                              \
                                i=1;                    \
                                while (i <= NF - 2) {   \
                                        printf $i"/";   \
                                        i++;            \
                                };                      \
                        }')
	led_defs_path=$linux_top/$led_common_defs_path
elif [ $num_args -eq 2 ]; then
        led_defs_path=`realpath $2`
else
	echo "Usage: get_led_device_info.sh LED_CDEV_PATH [LED_COMMON_DEFS_PATH]"
	exit 1
fi

if [ ! -f $led_defs_path ]; then
	echo "$led_defs_path doesn't exist"
	exit 1
fi

led_cdev_path=`echo $1 | sed s'/\/$//'`

ls "$led_cdev_path/brightness" > /dev/null 2>&1
if [ $? -ne 0 ]; then
	echo "Device \"$led_cdev_path\" does not exist."
	exit 1
fi

bus=`readlink $led_cdev_path/device/subsystem | sed s'/.*\///'`
usb_subdev=`readlink $led_cdev_path | grep usb | sed s'/\(.*usb[0-9]*\/[0-9]*-[0-9]*\)\/.*/\1/'`
ls "$led_cdev_path/device/of_node/compatible" > /dev/null 2>&1
of_node_missing=$?

if [ "$bus" = "input" ]; then
	input_node=`readlink $led_cdev_path/device | sed s'/.*\///'`
	if [ ! -z "$usb_subdev" ]; then
		bus="usb"
	fi
fi

if [ "$bus" = "usb" ]; then
	usb_interface=`readlink $led_cdev_path | sed s'/.*\(usb[0-9]*\)/\1/' | cut -d\/ -f3`
	cd $led_cdev_path/../$usb_subdev
	driver=`readlink $usb_interface/driver | sed s'/.*\///'`
	if [ -d "$usb_interface/ieee80211" ]; then
		wifi_phy=`ls -l $usb_interface/ieee80211 | grep phy | awk '{print $9}'`
	fi
	idVendor=`cat idVendor`
	idProduct=`cat idProduct`
	manufacturer=`cat manufacturer`
	product=`cat product`
elif [ "$bus" = "input" ]; then
	cd $led_cdev_path
	product=`cat device/name`
	driver=`cat device/device/driver/description`
elif [ $of_node_missing -eq 0 ]; then
	cd $led_cdev_path
	compatible=`cat device/of_node/compatible`
	if [ "$compatible" = "gpio-leds" ]; then
		driver="leds-gpio"
	elif [ "$compatible" = "pwm-leds" ]; then
		driver="leds-pwm"
	else
		manufacturer=`echo $compatible | awk -F, '{print $1}'`
		product=`echo $compatible | awk -F, '{print $2}'`
	fi
else
	echo "Unknown device type."
	exit 1
fi

printf "\n#####################################\n"
printf "# LED class device hardware details #\n"
printf "#####################################\n\n"

printf "bus:\t\t\t$bus\n"

if [ ! -z "$idVendor" ]; then
	printf "idVendor:\t\t$idVendor\n"
fi

if [ ! -z "$idProduct" ]; then
	printf "idProduct:\t\t$idProduct\n"
fi

if [ ! -z "$manufacturer" ]; then
	printf "manufacturer:\t\t$manufacturer\n"
fi

if [ ! -z "$product" ]; then
	printf "product:\t\t$product\n"
fi

if [ ! -z "$driver" ]; then
	printf "driver:\t\t\t$driver\n"
fi

if [ ! -z "$input_node" ]; then
	printf "associated input node:\t$input_node\n"
fi

printf "\n####################################\n"
printf "# LED class device name validation #\n"
printf "####################################\n\n"

led_name=`echo $led_cdev_path | sed s'/.*\///'`

num_sections=`echo $led_name | awk -F: '{print NF}'`

if [ $num_sections -eq 1 ]; then
	printf "\":\" delimiter not detected.\t[ FAILED ]\n"
	exit 1
elif [ $num_sections -eq 2 ]; then
	color=`echo $led_name | cut -d: -f1`
	function=`echo $led_name | cut -d: -f2`
elif [ $num_sections -eq 3 ]; then
	devicename=`echo $led_name | cut -d: -f1`
	color=`echo $led_name | cut -d: -f2`
	function=`echo $led_name | cut -d: -f3`
else
	printf "Detected %d sections in the LED class device name - should the script be updated?\n" $num_sections
	exit 1
fi

S_DEV="devicename"
S_CLR="color     "
S_FUN="function  "
status_tab=20

print_msg_ok()
{
	local section_name="$1"
	local section_val="$2"
	local msg="$3"
	printf "$section_name :\t%-${status_tab}.${status_tab}s %s %s\n" "$section_val" "[ OK ]    " "$msg"
}

print_msg_failed()
{
	local section_name="$1"
	local section_val="$2"
	local msg="$3"
	printf "$section_name :\t%-${status_tab}.${status_tab}s %s %s\n" "$section_val" "[ FAILED ]" "$msg"
}

if [ ! -z "$input_node" ]; then
	expected_devname=$input_node
elif [ ! -z "$wifi_phy" ]; then
	expected_devname=$wifi_phy
fi

if [ ! -z "$devicename" ]; then
	if [ ! -z "$expected_devname" ]; then
		if [ "$devicename" = "$expected_devname" ]; then
			print_msg_ok "$S_DEV" "$devicename"
		else
			print_msg_failed "$S_DEV" "$devicename" "Expected: $expected_devname"
		fi
	else
		if [ "$devicename" = "$manufacturer" ]; then
			print_msg_failed "$S_DEV" "$devicename" "Redundant: use of vendor name is discouraged"
		elif [ "$devicename" = "$product" ]; then
			print_msg_failed "$S_DEV" "$devicename" "Redundant: use of product name is discouraged"
		else
			print_msg_failed "$S_DEV" "$devicename" "Unknown devicename - should the script be updated?"
		fi
	fi
elif [ ! -z "$expected_devname" ]; then
	print_msg_failed "$S_DEV" "blank" "Expected: $expected_devname"
fi

if [ ! -z "$color" ]; then
	color_upper=`echo $color | tr [:lower:] [:upper:]`
	color_id_definition=$(cat $led_defs_path | grep "_$color_upper\s" | awk '{print $2}')
	if [ ! -z "$color_id_definition" ]; then
		print_msg_ok "$S_CLR" "$color" "Matching definition: $color_id_definition"
	else
		print_msg_failed "$S_CLR" "$color" "Definition not found in $led_defs_path"
	fi

fi

if [ ! -z "$function" ]; then
	# strip optional enumerator
	function=`echo $function | sed s'/\(.*\)-[0-9]*$/\1/'`
	fun_definition=$(cat $led_defs_path | grep "\"$function\"" | awk '{print $2}')
	if [ ! -z "$fun_definition" ]; then
		print_msg_ok "$S_FUN" "$function" "Matching definition: $fun_definition"
	else
		print_msg_failed "$S_FUN" "$function" "Definition not found in $led_defs_path"
	fi

fi
back to top