android_kernel_xiaomi_sm8450/scripts/sign-file.c
aseshu 136573f110 Merge keystone/android12-5.10-keystone-qcom-release.205+ (a31d98f) into msm-5.10
* refs/heads/tmp-a31d98f:
  ANDROID: userfaultfd: allow SPF for UFFD_FEATURE_SIGBUS on private+anon
  ANDROID: GKI: Update symbols to symbol list
  ANDROID: add hooks into blk-mq-sched.c for customized I/O scheduler
  ANDROID: add hooks into blk-ma-tag.c for customized I/O scheduler
  ANDROID: add hooks into blk-flush.c for customized I/O scheduler
  ANDROID: add hooks into blk-core.c for customized I/O scheduler
  ANDROID: add hooks into blk-mq.c for customized I/O scheduler.
  ANDROID: add hooks into bio.c for customized I/O scheduler
  UPSTREAM: usb: dwc3: gadget: Handle EP0 request dequeuing properly
  UPSTREAM: usb: dwc3: gadget: Refactor EP0 forced stall/restart into a separate API
  ANDROID: GKI: Update symbols to symbol list
  ANDROID: add hooks into blk-mq-sched.c for customized I/O scheduler
  ANDROID: add hooks into blk-ma-tag.c for customized I/O scheduler
  ANDROID: add hooks into blk-flush.c for customized I/O scheduler
  ANDROID: add hooks into blk-core.c for customized I/O scheduler
  ANDROID: add hooks into blk-mq.c for customized I/O scheduler.
  ANDROID: add hooks into bio.c for customized I/O scheduler
  ANDROID: ABI: Update oplus symbol list
  ANDROID: binder: Add vendor hook to fix priority restore
  ANDROID: GKI: Update symbol list
  ANDROID: Add vendor hook for task exiting routine
  UPSTREAM: netfilter: nft_set_rbtree: skip end interval element from gc
  ANDROID: GKI: Update oplus symbol list
  UPSTREAM: usb: gadget: uvc: set v4l2_dev->dev in f_uvc
  ANDROID: mm: Fix VMA ref count after fast-mremap
  ANDROID: mm: Fix VMA ref count after fast-mremap
  ANDROID: GKI: fix ABI breakage in struct ipv6_devconf
  Reapply "net: release reference to inet6_dev pointer"
  Reapply "net: change accept_ra_min_rtr_lft to affect all RA lifetimes"
  Reapply "net: add sysctl accept_ra_min_rtr_lft"
  ANDROID: GKI: explicit include of stringify.h
  ANDROID: introduce a vendor hook to allow speculative swap pagefaults
  ANDROID: mm: allow limited speculative page faulting in do_swap_page()
  UPSTREAM: net: tls, update curr on splice as well
  ANDROID: GKI: Update oplus symbol list
  ANDROID: mm: Add vendor hooks for recording when kswapd finishing the reclaim job
  ANDROID: GKI: Update oplus symbol list
  ANDROID: vendor_hooks: Add hooks for adjusting alloc_flags
  Reapply "perf: Fix perf_event_validate_size()"
  UPSTREAM: ida: Fix crash in ida_free when the bitmap is empty
  UPSTREAM: netfilter: nf_tables: Reject tables of unsupported family
  UPSTREAM: net/rose: Fix Use-After-Free in rose_ioctl
  ANDROID: GKI: Update symbol list for mtk
  Reapply "perf: Disallow mis-matched inherited group reads"
  ANDROID: scsi: ufs: UFS HPB feature not working
  ANDROID: GKI: Update symbol list for mtk
  FROMGIT: usb: dwc: ep0: Update request status in dwc3_ep0_stall_restart
  FROMGIT: BACKPORT: mm: update mark_victim tracepoints fields
  ANDROID: ABI: update allowed list for galaxy
  ANDROID: ABI: update allowed list for galaxy
  BACKPORT: exfat: reduce block requests when zeroing a cluster
  UPSTREAM: netfilter: nf_tables: skip set commit for deleted/destroyed sets
  ANDROID: GKI: fix crc issue in include/net/addrconf.h
  Revert "cred: switch to using atomic_long_t"
  Linux 5.10.205
  powerpc/ftrace: Fix stack teardown in ftrace_no_trace
  powerpc/ftrace: Create a dummy stackframe to fix stack unwind
  tty: n_gsm: add sanity check for gsm->receive in gsm_receive_buf()
  tty: n_gsm, remove duplicates of parameters
  tty: n_gsm: fix tty registration before control channel open
  USB: gadget: core: adjust uevent timing on gadget unbind
  ring-buffer: Fix a race in rb_time_cmpxchg() for 32 bit archs
  ring-buffer: Fix writing to the buffer with max_data_size
  ring-buffer: Have saved event hold the entire event
  tracing: Update snapshot buffer on resize if it is allocated
  ring-buffer: Fix memory leak of free page
  team: Fix use-after-free when an option instance allocation fails
  arm64: mm: Always make sw-dirty PTEs hw-dirty in pte_modify
  ext4: prevent the normalized size from exceeding EXT_MAX_BLOCKS
  soundwire: stream: fix NULL pointer dereference for multi_link
  perf: Fix perf_event_validate_size() lockdep splat
  HID: hid-asus: add const to read-only outgoing usb buffer
  net: usb: qmi_wwan: claim interface 4 for ZTE MF290
  asm-generic: qspinlock: fix queued_spin_value_unlocked() implementation
  HID: multitouch: Add quirk for HONOR GLO-GXXX touchpad
  HID: hid-asus: reset the backlight brightness level on resume
  HID: add ALWAYS_POLL quirk for Apple kb
  HID: glorious: fix Glorious Model I HID report
  platform/x86: intel_telemetry: Fix kernel doc descriptions
  bcache: avoid NULL checking to c->root in run_cache_set()
  bcache: add code comments for bch_btree_node_get() and __bch_btree_node_alloc()
  bcache: remove redundant assignment to variable cur_idx
  bcache: avoid oversize memory allocation by small stripe_size
  blk-throttle: fix lockdep warning of "cgroup_mutex or RCU read lock required!"
  usb: aqc111: check packet for fixup for true limit
  drm/mediatek: Add spinlock for setting vblank event in atomic_begin
  PCI: loongson: Limit MRRS to 256
  Revert "PCI: acpiphp: Reassign resources on bridge if necessary"
  ALSA: hda/realtek: Apply mute LED quirk for HP15-db
  ALSA: hda/hdmi: add force-connect quirks for ASUSTeK Z170 variants
  fuse: dax: set fc->dax to NULL in fuse_dax_conn_free()
  cred: switch to using atomic_long_t
  net: atlantic: fix double free in ring reinit logic
  appletalk: Fix Use-After-Free in atalk_ioctl
  net: stmmac: Handle disabled MDIO busses from devicetree
  net: stmmac: use dev_err_probe() for reporting mdio bus registration failure
  vsock/virtio: Fix unsigned integer wrap around in virtio_transport_has_space()
  sign-file: Fix incorrect return values check
  net: ena: Fix XDP redirection error
  net: ena: Destroy correct number of xdp queues upon failure
  net: Remove acked SYN flag from packet in the transmit queue correctly
  qed: Fix a potential use-after-free in qed_cxt_tables_alloc
  net/rose: Fix Use-After-Free in rose_ioctl
  atm: Fix Use-After-Free in do_vcc_ioctl
  net: fec: correct queue selection
  net: vlan: introduce skb_vlan_eth_hdr()
  atm: solos-pci: Fix potential deadlock on &tx_queue_lock
  atm: solos-pci: Fix potential deadlock on &cli_queue_lock
  qca_spi: Fix reset behavior
  qca_debug: Fix ethtool -G iface tx behavior
  qca_debug: Prevent crash on TX ring changes
  net: ipv6: support reporting otherwise unknown prefix flags in RTM_NEWPREFIX
  HID: lenovo: Restrict detection of patched firmware only to USB cptkbd
  afs: Fix refcount underflow from error handling race
  netfilter: nf_tables: fix 'exist' matching on bigendian arches
  Revert "psample: Require 'CAP_NET_ADMIN' when joining "packets" group"
  Revert "genetlink: add CAP_NET_ADMIN test for multicast bind"
  Revert "drop_monitor: Require 'CAP_SYS_ADMIN' when joining "events" group"
  Revert "perf/core: Add a new read format to get a number of lost samples"
  Revert "perf: Fix perf_event_validate_size()"
  Revert "hrtimers: Push pending hrtimers away from outgoing CPU earlier"
  Linux 5.10.204
  r8169: fix rtl8125b PAUSE frames blasting when suspended
  devcoredump: Send uevent once devcd is ready
  devcoredump : Serialize devcd_del work
  smb: client: fix potential NULL deref in parse_dfs_referrals()
  cifs: Fix non-availability of dedup breaking generic/304
  Revert "btrfs: add dmesg output for first mount and last unmount of a filesystem"
  mmc: block: Be sure to wait while busy in CQE error recovery
  platform/x86: asus-wmi: Document the dgpu_disable sysfs attribute
  tools headers UAPI: Sync linux/perf_event.h with the kernel sources
  platform/x86: asus-wmi: Fix kbd_dock_devid tablet-switch reporting
  netfilter: nft_set_pipapo: skip inactive elements during set walk
  drop_monitor: Require 'CAP_SYS_ADMIN' when joining "events" group
  psample: Require 'CAP_NET_ADMIN' when joining "packets" group
  genetlink: add CAP_NET_ADMIN test for multicast bind
  netlink: don't call ->netlink_bind with table lock held
  io_uring/af_unix: disable sending io_uring over sockets
  MIPS: Loongson64: Enable DMA noncoherent support
  MIPS: Loongson64: Reserve vgabios memory on boot
  KVM: s390/mm: Properly reset no-dat
  x86/CPU/AMD: Check vendor in the AMD microcode callback
  serial: 8250_omap: Add earlycon support for the AM654 UART controller
  serial: 8250: 8250_omap: Do not start RX DMA on THRI interrupt
  serial: 8250: 8250_omap: Clear UART_HAS_RHR_IT_DIS bit
  serial: sc16is7xx: address RX timeout interrupt errata
  ARM: PL011: Fix DMA support
  usb: typec: class: fix typec_altmode_put_partner to put plugs
  Revert "xhci: Loosen RPM as default policy to cover for AMD xHC 1.1"
  parport: Add support for Brainboxes IX/UC/PX parallel cards
  usb: gadget: f_hid: fix report descriptor allocation
  drm/amdgpu: correct the amdgpu runtime dereference usage count
  gpiolib: sysfs: Fix error handling on failed export
  perf: Fix perf_event_validate_size()
  perf/core: Add a new read format to get a number of lost samples
  tracing: Stop current tracer when resizing buffer
  tracing: Set actual size after ring buffer resize
  ring-buffer: Force absolute timestamp on discard of event
  misc: mei: client.c: fix problem of return '-EOVERFLOW' in mei_cl_write
  misc: mei: client.c: return negative error code in mei_cl_write
  arm64: dts: mediatek: mt8183: Fix unit address for scp reserved memory
  arm64: dts: mediatek: mt8173-evb: Fix regulator-fixed node names
  arm64: dts: mediatek: mt7622: fix memory node warning check
  packet: Move reference count in packet_sock to atomic_long_t
  tracing: Fix a possible race when disabling buffered events
  tracing: Fix incomplete locking when disabling buffered events
  tracing: Disable snapshot buffer when stopping instance tracers
  tracing: Always update snapshot buffer size
  checkstack: fix printed address
  nilfs2: prevent WARNING in nilfs_sufile_set_segment_usage()
  nilfs2: fix missing error check for sb_set_blocksize call
  ALSA: hda/realtek: Enable headset on Lenovo M90 Gen5
  ALSA: pcm: fix out-of-bounds in snd_pcm_state_names
  riscv: fix misaligned access handling of C.SWSP and C.SDSP
  ARM: dts: imx7: Declare timers compatible with fsl,imx6dl-gpt
  ARM: imx: Check return value of devm_kasprintf in imx_mmdc_perf_init
  scsi: be2iscsi: Fix a memleak in beiscsi_init_wrb_handle()
  tracing: Fix a warning when allocating buffered events fails
  ASoC: wm_adsp: fix memleak in wm_adsp_buffer_populate
  hwmon: (acpi_power_meter) Fix 4.29 MW bug
  RDMA/bnxt_re: Correct module description string
  RDMA/rtrs-clt: Remove the warnings for req in_use check
  arm64: dts: rockchip: Expand reg size of vdec node for RK3399
  tee: optee: Fix supplicant based device enumeration
  bpf: sockmap, updating the sg structure should also update curr
  tcp: do not accept ACK of bytes we never sent
  netfilter: xt_owner: Fix for unsafe access of sk->sk_socket
  net: hns: fix fake link up on xge port
  ipv4: ip_gre: Avoid skb_pull() failure in ipgre_xmit()
  ionic: Fix dim work handling in split interrupt mode
  ionic: fix snprintf format length warning
  net: bnxt: fix a potential use-after-free in bnxt_init_tc
  i40e: Fix unexpected MFS warning message
  arcnet: restoring support for multiple Sohard Arcnet cards
  net: arcnet: com20020 fix error handling
  mlxbf-bootctl: correctly identify secure boot with development keys
  hv_netvsc: rndis_filter needs to select NLS
  octeontx2-pf: Add missing mutex lock in otx2_get_pauseparam
  ipv6: fix potential NULL deref in fib6_add()
  of: dynamic: Fix of_reconfig_get_state_change() return value documentation
  of: Add missing 'Return' section in kerneldoc comments
  of: Fix kerneldoc output formatting
  of: base: Fix some formatting issues and provide missing descriptions
  platform/x86: asus-wmi: Move i8042 filter install to shared asus-wmi code
  platform/x86: asus-wmi: Simplify tablet-mode-switch handling
  platform/x86: asus-wmi: Simplify tablet-mode-switch probing
  platform/x86: asus-wmi: Add support for ROG X13 tablet mode
  platform/x86: asus-wmi: Adjust tablet/lidflip handling to use enum
  asus-wmi: Add dgpu disable method
  platform/x86: asus-nb-wmi: Add tablet_mode_sw=lid-flip quirk for the TP200s
  platform/x86: asus-nb-wmi: Allow configuring SW_TABLET_MODE method with a module option
  platform/x86: asus-wmi: Add support for SW_TABLET_MODE on UX360
  drm/amdgpu: correct chunk_ptr to a pointer to chunk.
  kconfig: fix memory leak from range properties
  tg3: Increment tx_dropped in tg3_tso_bug()
  tg3: Move the [rt]x_dropped counters to tg3_napi
  netfilter: ipset: fix race condition between swap/destroy and kernel side add/del/test
  i2c: designware: Fix corrupted memory seen in the ISR
  hrtimers: Push pending hrtimers away from outgoing CPU earlier
  Revert "mmc: core: add helpers mmc_regulator_enable/disable_vqmmc"
  Revert "mmc: sdhci-sprd: Fix vqmmc not shutting down after the card was pulled"
  Revert "driver core: Move the "removable" attribute from USB to core"
  Revert "drm/amdgpu: don't use ATRM for external devices"
  Revert "HID: core: store the unique system identifier in hid_device"
  Revert "HID: fix HID device resource race between HID core and debugging support"
  Revert "wireguard: use DEV_STATS_INC()"
  ANDROID: Fix up ipvlan merge in 5.10.202
  Revert "ASoC: soc-card: Add storage for PCI SSID"
  Revert "tracing: Have trace_event_file have ref counters"
  UPSTREAM: interconnect: qcom: Add support for mask-based BCMs
  Revert "ipvlan: properly track tx_errors"
  Revert "inet: shrink struct flowi_common"
  Revert "arm64/arm: xen: enlighten: Fix KPTI checks"
  Revert "mfd: core: Un-constify mfd_cell.of_reg"
  Linux 5.10.203
  driver core: Release all resources during unbind before updating device links
  r8169: fix deadlock on RTL8125 in jumbo mtu mode
  r8169: disable ASPM in case of tx timeout
  mmc: sdhci-sprd: Fix vqmmc not shutting down after the card was pulled
  mmc: core: add helpers mmc_regulator_enable/disable_vqmmc
  mmc: block: Retry commands in CQE error recovery
  mmc: core: convert comma to semicolon
  mmc: cqhci: Fix task clearing in CQE error recovery
  mmc: cqhci: Warn of halt or task clear failure
  mmc: cqhci: Increase recovery halt timeout
  cpufreq: imx6q: Don't disable 792 Mhz OPP unnecessarily
  cpufreq: imx6q: don't warn for disabling a non-existing frequency
  scsi: qla2xxx: Fix system crash due to bad pointer access
  scsi: qla2xxx: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  scsi: core: Introduce the scsi_cmd_to_rq() function
  smb3: fix caching of ctime on setxattr
  fs: add ctime accessors infrastructure
  drm/amdgpu: don't use ATRM for external devices
  driver core: Move the "removable" attribute from USB to core
  ima: annotate iint mutex to avoid lockdep false positive warnings
  fbdev: stifb: Make the STI next font pointer a 32-bit signed offset
  misc: pci_endpoint_test: Add deviceID for J721S2 PCIe EP device support
  misc: pci_endpoint_test: Add deviceID for AM64 and J7200
  s390/cmma: fix detection of DAT pages
  s390/mm: fix phys vs virt confusion in mark_kernel_pXd() functions family
  ASoC: SOF: sof-pci-dev: Fix community key quirk detection
  ASoC: SOF: sof-pci-dev: don't use the community key on APL Chromebooks
  ASoC: SOF: sof-pci-dev: add parameter to override topology filename
  ASoC: SOF: sof-pci-dev: use community key on all Up boards
  ASoC: Intel: Move soc_intel_is_foo() helpers to a generic header
  smb3: fix touch -h of symlink
  net: ravb: Start TX queues after HW initialization succeeded
  net: ravb: Use pm_runtime_resume_and_get()
  ravb: Fix races between ravb_tx_timeout_work() and net related ops
  r8169: prevent potential deadlock in rtl8169_close
  Revert "workqueue: remove unused cancel_work()"
  octeontx2-pf: Fix adding mbox work queue entry when num_vfs > 64
  net: stmmac: xgmac: Disable FPE MMC interrupts
  selftests/net: mptcp: fix uninitialized variable warnings
  selftests/net: ipsec: fix constant out of range
  dpaa2-eth: increase the needed headroom to account for alignment
  ipv4: igmp: fix refcnt uaf issue when receiving igmp query packet
  usb: config: fix iteration issue in 'usb_get_bos_descriptor()'
  USB: core: Change configuration warnings to notices
  hv_netvsc: fix race of netvsc and VF register_netdevice
  Input: xpad - add HyperX Clutch Gladiate Support
  btrfs: make error messages more clear when getting a chunk map
  btrfs: send: ensure send_fd is writable
  btrfs: fix off-by-one when checking chunk map includes logical address
  btrfs: ref-verify: fix memory leaks in btrfs_ref_tree_mod()
  btrfs: add dmesg output for first mount and last unmount of a filesystem
  parisc: Drop the HP-UX ENOSYM and EREMOTERELEASE error codes
  powerpc: Don't clobber f0/vs0 during fp|altivec register save
  iommu/vt-d: Add MTL to quirk list to skip TE disabling
  bcache: revert replacing IS_ERR_OR_NULL with IS_ERR
  dm verity: don't perform FEC for failed readahead IO
  dm-verity: align struct dm_verity_fec_io properly
  ALSA: hda/realtek: Add supported ALC257 for ChromeOS
  ALSA: hda/realtek: Headset Mic VREF to 100%
  ALSA: hda: Disable power-save on KONTRON SinglePC
  mmc: block: Do not lose cache flush during CQE error recovery
  firewire: core: fix possible memory leak in create_units()
  pinctrl: avoid reload of p state in list iteration
  io_uring: fix off-by one bvec index
  USB: dwc3: qcom: fix wakeup after probe deferral
  usb: dwc3: set the dma max_seg_size
  usb: dwc3: Fix default mode initialization
  USB: dwc2: write HCINT with INTMASK applied
  USB: serial: option: don't claim interface 4 for ZTE MF290
  USB: serial: option: fix FM101R-GL defines
  USB: serial: option: add Fibocom L7xx modules
  bcache: fixup lock c->root error
  bcache: fixup init dirty data errors
  bcache: prevent potential division by zero error
  bcache: check return value from btree_node_alloc_replacement()
  dm-delay: fix a race between delay_presuspend and delay_bio
  hv_netvsc: Mark VF as slave before exposing it to user-mode
  hv_netvsc: Fix race of register_netdevice_notifier and VF register
  USB: serial: option: add Luat Air72*U series products
  s390/dasd: protect device queue against concurrent access
  bcache: fixup multi-threaded bch_sectors_dirty_init() wake-up race
  bcache: replace a mistaken IS_ERR() by IS_ERR_OR_NULL() in btree_gc_coalesce()
  swiotlb-xen: provide the "max_mapping_size" method
  ACPI: resource: Skip IRQ override on ASUS ExpertBook B1402CVA
  ASoC: simple-card: fixup asoc_simple_probe() error handling
  nfsd: lock_rename() needs both directories to live on the same fs
  ext4: make sure allocate pending entry not fail
  ext4: fix slab-use-after-free in ext4_es_insert_extent()
  ext4: using nofail preallocation in ext4_es_insert_extent()
  ext4: using nofail preallocation in ext4_es_insert_delayed_block()
  ext4: using nofail preallocation in ext4_es_remove_extent()
  ext4: use pre-allocated es in __es_remove_extent()
  ext4: use pre-allocated es in __es_insert_extent()
  ext4: factor out __es_alloc_extent() and __es_free_extent()
  ext4: add a new helper to check if es must be kept
  MIPS: KVM: Fix a build warning about variable set but not used
  media: ccs: Correctly initialise try compose rectangle
  lockdep: Fix block chain corruption
  USB: dwc3: qcom: fix ACPI platform device leak
  USB: dwc3: qcom: fix resource leaks on probe deferral
  nvmet: nul-terminate the NQNs passed in the connect command
  nvmet: remove unnecessary ctrl parameter
  afs: Fix file locking on R/O volumes to operate in local mode
  afs: Return ENOENT if no cell DNS record can be found
  net: axienet: Fix check for partial TX checksum
  amd-xgbe: propagate the correct speed and duplex status
  amd-xgbe: handle the corner-case during tx completion
  amd-xgbe: handle corner-case during sfp hotplug
  arm/xen: fix xen_vcpu_info allocation alignment
  net/smc: avoid data corruption caused by decline
  net: usb: ax88179_178a: fix failed operations during ax88179_reset
  ipv4: Correct/silence an endian warning in __ip_do_redirect
  HID: fix HID device resource race between HID core and debugging support
  HID: core: store the unique system identifier in hid_device
  drm/rockchip: vop: Fix color for RGB888/BGR888 format on VOP full
  ata: pata_isapnp: Add missing error check for devm_ioport_map()
  wireguard: use DEV_STATS_INC()
  drm/panel: simple: Fix Innolux G101ICE-L01 timings
  drm/panel: simple: Fix Innolux G101ICE-L01 bus flags
  drm/panel: auo,b101uan08.3: Fine tune the panel power sequence
  drm/panel: boe-tv101wum-nl6: Fine tune the panel power sequence
  afs: Make error on cell lookup failure consistent with OpenAFS
  afs: Fix afs_server_list to be cleaned up with RCU
  PCI: keystone: Drop __init from ks_pcie_add_pcie_{ep,port}()
  RDMA/irdma: Prevent zero-length STAG registration
  ANDROID: GKI: db845c: Update symbols list and ABI on rpmsg_register_device_override
  Linux 5.10.202
  interconnect: qcom: Add support for mask-based BCMs
  netfilter: nf_tables: disable toggling dormant table state more than once
  netfilter: nf_tables: fix table flag updates
  netfilter: nftables: update table flags from the commit phase
  tracing: Have trace_event_file have ref counters
  io_uring/fdinfo: lock SQ thread while retrieving thread cpu/pid
  drm/amd/display: Change the DMCUB mailbox memory location from FB to inbox
  drm/amdgpu: fix error handling in amdgpu_bo_list_get()
  drm/amd/pm: Handle non-terminated overdrive commands.
  ext4: remove gdb backup copy for meta bg in setup_new_flex_group_blocks
  ext4: correct the start block of counting reserved clusters
  ext4: correct return value of ext4_convert_meta_bg
  ext4: correct offset of gdb backup in non meta_bg group to update_backups
  ext4: apply umask if ACL support is disabled
  Revert "net: r8169: Disable multicast filter for RTL8168H and RTL8107E"
  media: qcom: camss: Fix vfe_get() error jump
  mm: kmem: drop __GFP_NOFAIL when allocating objcg vectors
  nfsd: fix file memleak on client_opens_release
  media: venus: hfi: add checks to handle capabilities from firmware
  media: venus: hfi: fix the check to handle session buffer requirement
  media: venus: hfi_parser: Add check to keep the number of codecs within range
  media: sharp: fix sharp encoding
  media: lirc: drop trailing space from scancode transmit
  f2fs: avoid format-overflow warning
  i2c: i801: fix potential race in i801_block_transaction_byte_by_byte
  net: phylink: initialize carrier state at creation
  net: dsa: lan9303: consequently nested-lock physical MDIO
  i2c: designware: Disable TX_EMPTY irq while waiting for block length byte
  lsm: fix default return value for inode_getsecctx
  lsm: fix default return value for vm_enough_memory
  Revert ncsi: Propagate carrier gain/loss events to the NCSI controller
  arm64: dts: qcom: ipq6018: Fix tcsr_mutex register size
  arm64: dts: qcom: ipq6018: switch TCSR mutex to MMIO
  PCI: exynos: Don't discard .remove() callback
  Bluetooth: btusb: Add 0bda:b85b for Fn-Link RTL8852BE
  Bluetooth: btusb: Add RTW8852BE device 13d3:3570 to device tables
  bluetooth: Add device 13d3:3571 to device tables
  bluetooth: Add device 0bda:887b to device tables
  Bluetooth: btusb: Add Realtek RTL8852BE support ID 0x0cb8:0xc559
  cpufreq: stats: Fix buffer overflow detection in trans_stats()
  tty: serial: meson: fix hard LOCKUP on crtscts mode
  serial: meson: Use platform_get_irq() to get the interrupt
  tty: serial: meson: retrieve port FIFO size from DT
  serial: meson: remove redundant initialization of variable id
  ALSA: hda/realtek - Enable internal speaker of ASUS K6500ZC
  ALSA: hda/realtek - Add Dell ALC295 to pin fall back table
  ALSA: info: Fix potential deadlock at disconnection
  xhci: Enable RPM on controllers that support low-power states
  parisc/pgtable: Do not drop upper 5 address bits of physical address
  parisc: Prevent booting 64-bit kernels on PA1.x machines
  i3c: master: cdns: Fix reading status register
  mtd: cfi_cmdset_0001: Byte swap OTP info
  mm/memory_hotplug: use pfn math in place of direct struct page manipulation
  mm/cma: use nth_page() in place of direct struct page manipulation
  dmaengine: stm32-mdma: correct desc prep when channel running
  mcb: fix error handling for different scenarios when parsing
  i2c: core: Run atomic i2c xfer when !preemptible
  kernel/reboot: emergency_restart: Set correct system_state
  quota: explicitly forbid quota files from being encrypted
  jbd2: fix potential data lost in recovering journal raced with synchronizing fs bdev
  PCI: keystone: Don't discard .probe() callback
  PCI: keystone: Don't discard .remove() callback
  genirq/generic_chip: Make irq_remove_generic_chip() irqdomain aware
  mmc: meson-gx: Remove setting of CMD_CFG_ERROR
  wifi: ath11k: fix htt pktlog locking
  wifi: ath11k: fix dfs radar event locking
  wifi: ath11k: fix temperature event locking
  ima: detect changes to the backing overlay file
  firmware: qcom_scm: use 64-bit calling convention only when client is 64-bit
  btrfs: don't arbitrarily slow down delalloc if we're committing
  rcu: kmemleak: Ignore kmemleak false positives when RCU-freeing objects
  PM: hibernate: Clean up sync_read handling in snapshot_write_next()
  PM: hibernate: Use __get_safe_page() rather than touching the list
  arm64: dts: qcom: ipq6018: Fix hwlock index for SMEM
  PCI/ASPM: Fix L1 substate handling in aspm_attr_store_common()
  mmc: sdhci_am654: fix start loop index for TAP value parsing
  mmc: vub300: fix an error code
  clk: qcom: ipq6018: drop the CLK_SET_RATE_PARENT flag from PLL clocks
  clk: qcom: ipq8074: drop the CLK_SET_RATE_PARENT flag from PLL clocks
  parisc/pdc: Add width field to struct pdc_model
  arm64: Restrict CPU_BIG_ENDIAN to GNU as or LLVM IAS 15.x or newer
  ACPI: resource: Do IRQ override on TongFang GMxXGxx
  watchdog: move softlockup_panic back to early_param
  PCI/sysfs: Protect driver's D3cold preference from user space
  hvc/xen: fix error path in xen_hvc_init() to always register frontend driver
  hvc/xen: fix console unplug
  tty/sysrq: replace smp_processor_id() with get_cpu()
  audit: don't WARN_ON_ONCE(!current->mm) in audit_exe_compare()
  audit: don't take task_lock() in audit_exe_compare() code path
  KVM: x86: Ignore MSR_AMD64_TW_CFG access
  KVM: x86: hyper-v: Don't auto-enable stimer on write from user-space
  x86/cpu/hygon: Fix the CPU topology evaluation for real
  scsi: megaraid_sas: Increase register read retry rount from 3 to 30 for selected registers
  scsi: mpt3sas: Fix loop logic
  bpf: Fix precision tracking for BPF_ALU | BPF_TO_BE | BPF_END
  bpf: Fix check_stack_write_fixed_off() to correctly spill imm
  randstruct: Fix gcc-plugin performance mode to stay in group
  powerpc/perf: Fix disabling BHRB and instruction sampling
  media: venus: hfi: add checks to perform sanity on queue pointers
  cifs: fix check of rc in function generate_smb3signingkey
  cifs: spnego: add ';' in HOST_KEY_LEN
  tools/power/turbostat: Fix a knl bug
  macvlan: Don't propagate promisc change to lower dev in passthru
  net/mlx5e: Check return value of snprintf writing to fw_version buffer for representors
  net/mlx5_core: Clean driver version and name
  net/mlx5e: fix double free of encap_header
  net: stmmac: fix rx budget limit check
  netfilter: nf_conntrack_bridge: initialize err to 0
  net: ethernet: cortina: Fix MTU max setting
  net: ethernet: cortina: Handle large frames
  net: ethernet: cortina: Fix max RX frame define
  bonding: stop the device in bond_setup_by_slave()
  ptp: annotate data-race around q->head and q->tail
  xen/events: fix delayed eoi list handling
  ppp: limit MRU to 64K
  tipc: Fix kernel-infoleak due to uninitialized TLV value
  net: hns3: fix VF reset fail issue
  net: hns3: fix variable may not initialized problem in hns3_init_mac_addr()
  tty: Fix uninit-value access in ppp_sync_receive()
  ipvlan: add ipvlan_route_v6_outbound() helper
  gfs2: Silence "suspicious RCU usage in gfs2_permission" warning
  SUNRPC: Fix RPC client cleaned up the freed pipefs dentries
  NFSv4.1: fix SP4_MACH_CRED protection for pnfs IO
  SUNRPC: Add an IS_ERR() check back to where it was
  SUNRPC: ECONNRESET might require a rebind
  xhci: turn cancelled td cleanup to its own function
  wifi: iwlwifi: Use FW rate for non-data frames
  pwm: Fix double shift bug
  drm/amdgpu: fix software pci_unplug on some chips
  ASoC: ti: omap-mcbsp: Fix runtime PM underflow warnings
  kgdb: Flush console before entering kgdb on panic
  drm/amd/display: Avoid NULL dereference of timing generator
  media: imon: fix access to invalid resource for the second interface
  media: cobalt: Use FIELD_GET() to extract Link Width
  gfs2: fix an oops in gfs2_permission
  gfs2: ignore negated quota changes
  media: vivid: avoid integer overflow
  media: gspca: cpia1: shift-out-of-bounds in set_flicker
  i2c: sun6i-p2wi: Prevent potential division by zero
  9p/trans_fd: Annotate data-racy writes to file::f_flags
  usb: gadget: f_ncm: Always set current gadget in ncm_bind()
  tty: vcc: Add check for kstrdup() in vcc_probe()
  exfat: support handle zero-size directory
  HID: Add quirk for Dell Pro Wireless Keyboard and Mouse KM5221W
  misc: pci_endpoint_test: Add Device ID for R-Car S4-8 PCIe controller
  scsi: libfc: Fix potential NULL pointer dereference in fc_lport_ptp_setup()
  atm: iphase: Do PCI error checks on own line
  PCI: tegra194: Use FIELD_GET()/FIELD_PREP() with Link Width fields
  ALSA: hda: Fix possible null-ptr-deref when assigning a stream
  ARM: 9320/1: fix stack depot IRQ stack filter
  HID: lenovo: Detect quirk-free fw on cptkbd and stop applying workaround
  jfs: fix array-index-out-of-bounds in diAlloc
  jfs: fix array-index-out-of-bounds in dbFindLeaf
  fs/jfs: Add validity check for db_maxag and db_agpref
  fs/jfs: Add check for negative db_l2nbperpage
  RDMA/hfi1: Use FIELD_GET() to extract Link Width
  crypto: pcrypt - Fix hungtask for PADATA_RESET
  ASoC: soc-card: Add storage for PCI SSID
  selftests/efivarfs: create-read: fix a resource leak
  drm/amdgpu: Fix a null pointer access when the smc_rreg pointer is NULL
  drm/panel: st7703: Pick different reset sequence
  drm/panel/panel-tpo-tpg110: fix a possible null pointer dereference
  drm/panel: fix a possible null pointer dereference
  drm/amdgpu: Fix potential null pointer derefernce
  drm/amd: Fix UBSAN array-index-out-of-bounds for Polaris and Tonga
  drm/amd: Fix UBSAN array-index-out-of-bounds for SMU7
  drm/msm/dp: skip validity check for DP CTS EDID checksum
  drm/komeda: drop all currently held locks if deadlock happens
  platform/x86: thinkpad_acpi: Add battery quirk for Thinkpad X120e
  Bluetooth: Fix double free in hci_conn_cleanup
  Bluetooth: btusb: Add date->evt_skb is NULL check
  wifi: ath10k: Don't touch the CE interrupt registers after power up
  net: annotate data-races around sk->sk_dst_pending_confirm
  net: annotate data-races around sk->sk_tx_queue_mapping
  wifi: ath10k: fix clang-specific fortify warning
  wifi: ath9k: fix clang-specific fortify warnings
  bpf: Detect IP == ksym.end as part of BPF program
  wifi: mac80211: don't return unset power in ieee80211_get_tx_power()
  wifi: mac80211_hwsim: fix clang-specific fortify warning
  x86/mm: Drop the 4 MB restriction on minimal NUMA node memory size
  clocksource/drivers/timer-atmel-tcb: Fix initialization on SAM9 hardware
  clocksource/drivers/timer-imx-gpt: Fix potential memory leak
  perf/core: Bail out early if the request AUX area is out of bound
  locking/ww_mutex/test: Fix potential workqueue corruption
  ANDROID: fix up rpmsg_device ABI break
  ANDROID: fix up platform_device ABI break
  Revert "kasan: print the original fault addr when access invalid shadow"
  Linux 5.10.201
  btrfs: use u64 for buffer sizes in the tree search ioctls
  Revert "mmc: core: Capture correct oemid-bits for eMMC cards"
  tracing/kprobes: Fix the order of argument descriptions
  fbdev: fsl-diu-fb: mark wr_reg_wa() static
  fbdev: imsttfb: fix a resource leak in probe
  fbdev: imsttfb: Fix error path of imsttfb_probe()
  spi: spi-zynq-qspi: add spi-mem to driver kconfig dependencies
  drm/syncobj: fix DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE
  x86/sev-es: Allow copy_from_kernel_nofault() in earlier boot
  x86: Share definition of __is_canonical_address()
  netfilter: nat: fix ipv6 nat redirect with mapped and scoped addresses
  netfilter: nft_redir: use `struct nf_nat_range2` throughout and deduplicate eval call-backs
  netfilter: xt_recent: fix (increase) ipv6 literal buffer length
  r8169: respect userspace disabling IFF_MULTICAST
  tg3: power down device only on SYSTEM_POWER_OFF
  net/smc: put sk reference if close work was canceled
  net/smc: allow cdc msg send rather than drop it with NULL sndbuf_desc
  net/smc: fix dangling sock under state SMC_APPFINCLOSEWAIT
  net: stmmac: xgmac: Enable support for multiple Flexible PPS outputs
  Fix termination state for idr_for_each_entry_ul()
  net: r8169: Disable multicast filter for RTL8168H and RTL8107E
  dccp/tcp: Call security_inet_conn_request() after setting IPv6 addresses.
  dccp: Call security_inet_conn_request() after setting IPv4 addresses.
  inet: shrink struct flowi_common
  tipc: Change nla_policy for bearer-related names to NLA_NUL_STRING
  hsr: Prevent use after free in prp_create_tagged_frame()
  llc: verify mac len before reading mac header
  Input: synaptics-rmi4 - fix use after free in rmi_unregister_function()
  pwm: brcmstb: Utilize appropriate clock APIs in suspend/resume
  pwm: sti: Reduce number of allocations and drop usage of chip_data
  pwm: sti: Avoid conditional gotos
  regmap: prevent noinc writes from clobbering cache
  media: dvb-usb-v2: af9035: fix missing unlock
  media: cedrus: Fix clock/reset sequence
  media: vidtv: mux: Add check and kfree for kstrdup
  media: vidtv: psi: Add check for kstrdup
  media: s3c-camif: Avoid inappropriate kfree()
  media: bttv: fix use after free error due to btv->timeout timer
  media: i2c: max9286: Fix some redundant of_node_put() calls
  pcmcia: ds: fix possible name leak in error path in pcmcia_device_add()
  pcmcia: ds: fix refcount leak in pcmcia_device_add()
  pcmcia: cs: fix possible hung task and memory leak pccardd()
  rtc: pcf85363: fix wrong mask/val parameters in regmap_update_bits call
  i3c: Fix potential refcount leak in i3c_master_register_new_i3c_devs
  perf hist: Add missing puts to hist__account_cycles
  perf machine: Avoid out of bounds LBR memory read
  usb: host: xhci-plat: fix possible kernel oops while resuming
  xhci: Loosen RPM as default policy to cover for AMD xHC 1.1
  powerpc/pseries: fix potential memory leak in init_cpu_associativity()
  powerpc/imc-pmu: Use the correct spinlock initializer.
  powerpc/xive: Fix endian conversion size
  powerpc/40x: Remove stale PTE_ATOMIC_UPDATES macro
  modpost: fix tee MODULE_DEVICE_TABLE built on big-endian host
  interconnect: qcom: sc7180: Set ACV enable_mask
  interconnect: qcom: sc7180: Retire DEFINE_QBCM
  f2fs: fix to initialize map.m_pblk in f2fs_precache_extents()
  dmaengine: pxa_dma: Remove an erroneous BUG_ON() in pxad_free_desc()
  USB: usbip: fix stub_dev hub disconnect
  tools: iio: iio_generic_buffer ensure alignment
  tools: iio: iio_generic_buffer: Fix some integer type and calculation
  tools: iio: privatize globals and functions in iio_generic_buffer.c file
  misc: st_core: Do not call kfree_skb() under spin_lock_irqsave()
  dmaengine: ti: edma: handle irq_of_parse_and_map() errors
  usb: dwc2: fix possible NULL pointer dereference caused by driver concurrency
  livepatch: Fix missing newline character in klp_resolve_symbols()
  tty: tty_jobctrl: fix pid memleak in disassociate_ctty()
  leds: trigger: ledtrig-cpu:: Fix 'output may be truncated' issue for 'cpu'
  leds: pwm: Don't disable the PWM when the LED should be off
  mfd: dln2: Fix double put in dln2_probe
  mfd: core: Ensure disabled devices are skipped without aborting
  mfd: core: Un-constify mfd_cell.of_reg
  ASoC: ams-delta.c: use component after check
  padata: Fix refcnt handling in padata_free_shell()
  padata: Convert from atomic_t to refcount_t on parallel_data->refcnt
  ASoC: Intel: Skylake: Fix mem leak when parsing UUIDs fails
  HID: logitech-hidpp: Move get_wireless_feature_index() check to hidpp_connect_event()
  HID: logitech-hidpp: Revert "Don't restart communication if not necessary"
  HID: logitech-hidpp: Don't restart IO, instead defer hid_connect() only
  HID: logitech-hidpp: Remove HIDPP_QUIRK_NO_HIDINPUT quirk
  Revert "HID: logitech-hidpp: add a module parameter to keep firmware gestures"
  sh: bios: Revive earlyprintk support
  hid: cp2112: Fix IRQ shutdown stopping polling for all IRQs on chip
  RDMA/hfi1: Workaround truncation compilation error
  scsi: ufs: core: Leave space for '\0' in utf8 desc string
  ASoC: fsl: Fix PM disable depth imbalance in fsl_easrc_probe
  RDMA/hns: Fix signed-unsigned mixed comparisons
  RDMA/hns: Fix uninitialized ucmd in hns_roce_create_qp_common()
  IB/mlx5: Fix rdma counter binding for RAW QP
  ASoC: fsl: mpc5200_dma.c: Fix warning of Function parameter or member not described
  ext4: move 'ix' sanity check to corrent position
  ARM: 9321/1: memset: cast the constant byte to unsigned char
  hid: cp2112: Fix duplicate workqueue initialization
  crypto: qat - increase size of buffers
  crypto: qat - mask device capabilities with soft straps
  crypto: caam/jr - fix Chacha20 + Poly1305 self test failure
  crypto: caam/qi2 - fix Chacha20 + Poly1305 self test failure
  nd_btt: Make BTT lanes preemptible
  libnvdimm/of_pmem: Use devm_kstrdup instead of kstrdup and check its return value
  hwrng: geode - fix accessing registers
  crypto: hisilicon/hpre - Fix a erroneous check after snprintf()
  selftests/resctrl: Ensure the benchmark commands fits to its array
  selftests/pidfd: Fix ksft print formats
  clk: scmi: Free scmi_clk allocated when the clocks with invalid info are skipped
  firmware: ti_sci: Mark driver as non removable
  soc: qcom: llcc: Handle a second device without data corruption
  ARM: dts: qcom: mdm9615: populate vsdcc fixed regulator
  arm64: dts: qcom: sdm845-mtp: fix WiFi configuration
  arm64: dts: qcom: msm8916: Fix iommu local address range
  xen-pciback: Consider INTx disabled when MSI/MSI-X is enabled
  drm/rockchip: Fix type promotion bug in rockchip_gem_iommu_map()
  arm64/arm: xen: enlighten: Fix KPTI checks
  drm/rockchip: cdn-dp: Fix some error handling paths in cdn_dp_probe()
  drm/mediatek: Fix iommu fault during crtc enabling
  drm/bridge: tc358768: Fix bit updates
  drm/bridge: tc358768: Disable non-continuous clock mode
  drm/bridge: tc358768: Fix use of uninitialized variable
  drm/radeon: possible buffer overflow
  drm/rockchip: vop: Fix call to crtc reset helper
  drm/rockchip: vop: Fix reset of state in duplicate state crtc funcs
  hwmon: (coretemp) Fix potentially truncated sysfs attribute name
  hwmon: (axi-fan-control) Fix possible NULL pointer dereference
  hwmon: (axi-fan-control) Support temperature vs pwm points
  platform/x86: wmi: Fix opening of char device
  platform/x86: wmi: remove unnecessary initializations
  platform/x86: wmi: Fix probe failure when failing to register WMI devices
  clk: qcom: config IPQ_APSS_6018 should depend on QCOM_SMEM
  clk: mediatek: clk-mt2701: Add check for mtk_alloc_clk_data
  clk: mediatek: clk-mt7629: Add check for mtk_alloc_clk_data
  clk: mediatek: clk-mt7629-eth: Add check for mtk_alloc_clk_data
  clk: mediatek: clk-mt6797: Add check for mtk_alloc_clk_data
  clk: mediatek: clk-mt6779: Add check for mtk_alloc_clk_data
  clk: mediatek: clk-mt6765: Add check for mtk_alloc_clk_data
  clk: npcm7xx: Fix incorrect kfree
  clk: ti: fix double free in of_ti_divider_clk_setup()
  clk: ti: change ti_clk_register[_omap_hw]() API
  clk: ti: Update component clocks to use ti_dt_clk_name()
  clk: ti: Update pll and clockdomain clocks to use ti_dt_clk_name()
  clk: ti: Add ti_dt_clk_name() helper to use clock-output-names
  clk: keystone: pll: fix a couple NULL vs IS_ERR() checks
  spi: nxp-fspi: use the correct ioremap function
  clk: linux/clk-provider.h: fix kernel-doc warnings and typos
  clk: asm9260: use parent index to link the reference clock
  clk: imx: imx8mq: correct error handling path
  clk: imx: Select MXC_CLK for CLK_IMX8QXP
  clk: qcom: gcc-sm8150: Fix gcc_sdcc2_apps_clk_src
  clk: qcom: gcc-sm8150: use ARRAY_SIZE instead of specifying num_parents
  clk: qcom: mmcc-msm8998: Fix the SMMU GDSC
  clk: qcom: mmcc-msm8998: Set bimc_smmu_gdsc always on
  clk: qcom: mmcc-msm8998: Don't check halt bit on some branch clks
  clk: qcom: mmcc-msm8998: Add hardware clockgating registers to some clks
  clk: qcom: clk-rcg2: Fix clock rate overflow for high parent frequencies
  regmap: debugfs: Fix a erroneous check after snprintf()
  ipvlan: properly track tx_errors
  net: add DEV_STATS_READ() helper
  ipv6: avoid atomic fragment on GSO packets
  ACPI: sysfs: Fix create_pnp_modalias() and create_of_modalias()
  tcp: fix cookie_init_timestamp() overflows
  chtls: fix tp->rcv_tstamp initialization
  r8169: fix rare issue with broken rx after link-down on RTL8125
  r8169: use tp_to_dev instead of open code
  thermal: core: prevent potential string overflow
  PM / devfreq: rockchip-dfi: Make pmu regmap mandatory
  can: dev: can_restart(): fix race condition between controller restart and netif_carrier_on()
  can: dev: can_restart(): don't crash kernel if carrier is OK
  wifi: rtlwifi: fix EDCA limit set by BT coexistence
  tcp_metrics: do not create an entry from tcp_init_metrics()
  tcp_metrics: properly set tp->snd_ssthresh in tcp_init_metrics()
  tcp_metrics: add missing barriers on delete
  wifi: mt76: mt7603: rework/fix rx pse hang check
  wifi: rtw88: debug: Fix the NULL vs IS_ERR() bug for debugfs_create_file()
  net: spider_net: Use size_add() in call to struct_size()
  tipc: Use size_add() in calls to struct_size()
  mlxsw: Use size_mul() in call to struct_size()
  gve: Use size_add() in call to struct_size()
  overflow: Implement size_t saturating arithmetic helpers
  tcp: call tcp_try_undo_recovery when an RTOd TFO SYNACK is ACKed
  udp: add missing WRITE_ONCE() around up->encap_rcv
  i40e: fix potential memory leaks in i40e_remove()
  genirq/matrix: Exclude managed interrupts in irq_matrix_allocated()
  pstore/platform: Add check for kstrdup
  x86/boot: Fix incorrect startup_gdt_descr.size
  futex: Don't include process MM in futex key on no-MMU
  x86/srso: Fix SBPB enablement for (possible) future fixed HW
  vfs: fix readahead(2) on block devices
  sched/uclamp: Ignore (util == 0) optimization in feec() when p_util_max = 0
  iov_iter, x86: Be consistent about the __user tag on copy_mc_to_user()
  Linux 5.10.200
  ALSA: hda: intel-dsp-config: Fix JSL Chromebook quirk detection
  tty: 8250: Add support for Intashield IS-100
  tty: 8250: Add support for Brainboxes UP cards
  tty: 8250: Add support for additional Brainboxes UC cards
  tty: 8250: Remove UC-257 and UC-431
  usb: raw-gadget: properly handle interrupted requests
  usb: storage: set 1.50 as the lower bcdDevice for older "Super Top" compatibility
  PCI: Prevent xHCI driver from claiming AMD VanGogh USB3 DRD device
  can: isotp: isotp_sendmsg(): fix TX state detection and wait behavior
  can: isotp: isotp_bind(): do not validate unused address information
  can: isotp: add local echo tx processing and tx without FC
  can: isotp: handle wait_event_interruptible() return values
  can: isotp: check CAN address family in isotp_bind()
  can: isotp: isotp_bind(): return -EINVAL on incorrect CAN ID formatting
  can: isotp: set max PDU size to 64 kByte
  can: isotp: Add error message if txqueuelen is too small
  can: isotp: add symbolic error message to isotp_module_init()
  can: isotp: change error format from decimal to symbolic error names
  powerpc/mm: Fix boot crash with FLATMEM
  net: chelsio: cxgb4: add an error code check in t4_load_phy_fw
  platform/mellanox: mlxbf-tmfifo: Fix a warning message
  scsi: mpt3sas: Fix in error path
  fbdev: uvesafb: Call cn_del_callback() at the end of uvesafb_exit()
  ASoC: rt5650: fix the wrong result of key button
  netfilter: nfnetlink_log: silence bogus compiler warning
  spi: npcm-fiu: Fix UMA reads when dummy.nbytes == 0
  fbdev: atyfb: only use ioremap_uc() on i386 and ia64
  Input: synaptics-rmi4 - handle reset delay when using SMBus trsnsport
  dmaengine: ste_dma40: Fix PM disable depth imbalance in d40_probe
  irqchip/stm32-exti: add missing DT IRQ flag translation
  net: sched: cls_u32: Fix allocation size in u32_init()
  x86: Fix .brk attribute in linker script
  rpmsg: Fix possible refcount leak in rpmsg_register_device_override()
  rpmsg: glink: Release driver_override
  rpmsg: Fix calling device_lock() on non-initialized device
  rpmsg: Fix kfree() of static memory on setting driver_override
  rpmsg: Constify local variable in field store macro
  driver: platform: Add helper for safer setting of driver_override
  objtool/x86: add missing embedded_insn check
  ext4: avoid overlapping preallocations due to overflow
  ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow
  ext4: add two helper functions extent_logical_end() and pa_logical_end()
  x86/mm: Fix RESERVE_BRK() for older binutils
  x86/mm: Simplify RESERVE_BRK()
  f2fs: fix to do sanity check on inode type during garbage collection
  smbdirect: missing rc checks while waiting for rdma events
  kobject: Fix slab-out-of-bounds in fill_kobj_path()
  x86/i8259: Skip probing when ACPI/MADT advertises PCAT compatibility
  iio: adc: xilinx-xadc: Don't clobber preset voltage/temperature thresholds
  iio: adc: xilinx: use more devres helpers and remove remove()
  iio: adc: xilinx: use devm_krealloc() instead of kfree() + kcalloc()
  iio: adc: xilinx: use helper variable for &pdev->dev
  clk: Sanitize possible_parent_show to Handle Return Value of of_clk_get_parent_name
  sparc32: fix a braino in fault handling in csum_and_copy_..._user()
  perf/core: Fix potential NULL deref
  nvmem: imx: correct nregs for i.MX6UL
  nvmem: imx: correct nregs for i.MX6SLL
  nvmem: imx: correct nregs for i.MX6ULL
  misc: fastrpc: Clean buffers on remote invocation failures
  tracing/kprobes: Fix the description of variable length arguments
  i2c: aspeed: Fix i2c bus hang in slave read
  i2c: stm32f7: Fix PEC handling in case of SMBUS transfers
  i2c: muxes: i2c-demux-pinctrl: Use of_get_i2c_adapter_by_node()
  i2c: muxes: i2c-mux-gpmux: Use of_get_i2c_adapter_by_node()
  i2c: muxes: i2c-mux-pinctrl: Use of_get_i2c_adapter_by_node()
  iio: exynos-adc: request second interupt only when touchscreen mode is used
  kasan: print the original fault addr when access invalid shadow
  i40e: Fix wrong check for I40E_TXR_FLAGS_WB_ON_ITR
  gtp: fix fragmentation needed check with gso
  gtp: uapi: fix GTPA_MAX
  tcp: fix wrong RTO timeout when received SACK reneging
  r8152: Release firmware if we have an error in probe
  r8152: Cancel hw_phy_work if we have an error in probe
  r8152: Run the unload routine if we have errors during probe
  r8152: Increase USB control msg timeout to 5000ms as per spec
  net: usb: smsc95xx: Fix uninit-value access in smsc95xx_read_reg
  net: ieee802154: adf7242: Fix some potential buffer overflow in adf7242_stats_show()
  igc: Fix ambiguity in the ethtool advertising
  neighbour: fix various data-races
  igb: Fix potential memory leak in igb_add_ethtool_nfc_entry
  treewide: Spelling fix in comment
  r8169: fix the KCSAN reported data race in rtl_rx while reading desc->opts1
  r8169: fix the KCSAN reported data-race in rtl_tx while reading TxDescArray[entry].opts1
  drm/dp_mst: Fix NULL deref in get_mst_branch_device_by_guid_helper()
  mmc: renesas_sdhi: use custom mask for TMIO_MASK_ALL
  mm/page_alloc: correct start page when guard page debug is enabled
  virtio-mmio: fix memory leak of vm_dev
  virtio_balloon: Fix endless deflation and inflation on arm64
  mcb-lpc: Reallocate memory region to avoid memory overlapping
  mcb: Return actual parsed size when reading chameleon table
  selftests/ftrace: Add new test case which checks non unique symbol
  Revert "usb: core: Track SuperSpeed Plus GenXxY"
  Revert "drm/connector: Add a fwnode pointer to drm_connector and register with ACPI (v2)"
  Revert "drm/connector: Add drm_connector_find_by_fwnode() function (v3)"
  Revert "drm/connector: Add support for out-of-band hotplug notification (v3)"
  Revert "usb: typec: altmodes/displayport: Notify drm subsys of hotplug events"
  Revert "usb: typec: altmodes/displayport: Signal hpd low when exiting mode"
  Revert "ipv4/fib: send notify when delete source address routes"
  Revert "net: add sysctl accept_ra_min_rtr_lft"
  Revert "net: change accept_ra_min_rtr_lft to affect all RA lifetimes"
  Revert "net: release reference to inet6_dev pointer"
  Revert "xfrm: fix a data-race in xfrm_gen_index()"
  Revert "perf: Disallow mis-matched inherited group reads"
  Revert "Bluetooth: hci_core: Fix build warnings"
  Revert "xfrm: interface: use DEV_STATS_INC()"
  ANDROID: GKI: arm64: drop CONFIG_DEBUG_PREEMPT forced disable
  Linux 5.10.199
  xfrm6: fix inet6_dev refcount underflow problem
  Bluetooth: hci_sock: Correctly bounds check and pad HCI_MON_NEW_INDEX name
  Bluetooth: hci_sock: fix slab oob read in create_monitor_event
  phy: mapphone-mdm6600: Fix pinctrl_pm handling for sleep pins
  phy: mapphone-mdm6600: Fix runtime PM for remove
  phy: mapphone-mdm6600: Fix runtime disable on probe
  ASoC: pxa: fix a memory leak in probe()
  gpio: vf610: set value before the direction to avoid a glitch
  platform/x86: asus-wmi: Map 0x2a code, Ignore 0x2b and 0x2c events
  platform/x86: asus-wmi: Change ASUS_WMI_BRN_DOWN code from 0x20 to 0x2e
  s390/pci: fix iommu bitmap allocation
  perf: Disallow mis-matched inherited group reads
  USB: serial: option: add Fibocom to DELL custom modem FM101R-GL
  USB: serial: option: add entry for Sierra EM9191 with new firmware
  USB: serial: option: add Telit LE910C4-WWX 0x1035 composition
  nvme-rdma: do not try to stop unallocated queues
  nvme-pci: add BOGUS_NID for Intel 0a54 device
  ACPI: irq: Fix incorrect return value in acpi_register_gsi()
  pNFS: Fix a hang in nfs4_evict_inode()
  Revert "pinctrl: avoid unsafe code pattern in find_pinctrl()"
  mmc: core: Capture correct oemid-bits for eMMC cards
  mmc: core: sdio: hold retuning if sdio in 1-bit mode
  mtd: physmap-core: Restore map_rom fallback
  mtd: spinand: micron: correct bitmask for ecc status
  mtd: rawnand: arasan: Ensure program page operations are successful
  mtd: rawnand: marvell: Ensure program page operations are successful
  mtd: rawnand: qcom: Unmap the right resource upon probe failure
  Bluetooth: hci_event: Fix using memcmp when comparing keys
  net/mlx5: Handle fw tracer change ownership event based on MTRC
  platform/x86: touchscreen_dmi: Add info for the Positivo C4128B
  HID: multitouch: Add required quirk for Synaptics 0xcd7e device
  btrfs: fix some -Wmaybe-uninitialized warnings in ioctl.c
  drm: panel-orientation-quirks: Add quirk for One Mix 2S
  ipv4/fib: send notify when delete source address routes
  sky2: Make sure there is at least one frag_addr available
  regulator/core: Revert "fix kobject release warning and memory leak in regulator_register()"
  wifi: cfg80211: avoid leaking stack data into trace
  wifi: mac80211: allow transmitting EAPOL frames with tainted key
  wifi: cfg80211: Fix 6GHz scan configuration
  Bluetooth: hci_core: Fix build warnings
  Bluetooth: Avoid redundant authentication
  HID: holtek: fix slab-out-of-bounds Write in holtek_kbd_input_event
  tracing: relax trace_event_eval_update() execution with cond_resched()
  ata: libata-eh: Fix compilation warning in ata_eh_link_report()
  gpio: timberdale: Fix potential deadlock on &tgpio->lock
  overlayfs: set ctime when setting mtime and atime
  i2c: mux: Avoid potential false error message in i2c_mux_add_adapter
  btrfs: initialize start_slot in btrfs_log_prealloc_extents
  btrfs: return -EUCLEAN for delayed tree ref with a ref count not equals to 1
  ARM: dts: ti: omap: Fix noisy serial with overrun-throttle-ms for mapphone
  usb: typec: altmodes/displayport: Signal hpd low when exiting mode
  usb: typec: altmodes/displayport: Notify drm subsys of hotplug events
  drm/connector: Add support for out-of-band hotplug notification (v3)
  drm/connector: Add drm_connector_find_by_fwnode() function (v3)
  drm/connector: Add a fwnode pointer to drm_connector and register with ACPI (v2)
  drm/connector: Give connector sysfs devices there own device_type
  drm/amd/display: Don't set dpms_off for seamless boot
  drm/amd/display: only check available pipe to disable vbios mode.
  serial: 8250_omap: Fix errors with no_console_suspend
  serial: 8250: omap: Fix imprecise external abort for omap_8250_pm()
  xhci: track port suspend state correctly in unsuccessful resume cases
  xhci: decouple usb2 port resume and get_port_status request handling
  xhci: clear usb2 resume related variables in one place.
  xhci: rename resume_done to resume_timestamp
  xhci: move port specific items such as state completions to port structure
  xhci: cleanup xhci_hub_control port references
  usb: core: Track SuperSpeed Plus GenXxY
  selftests/mm: fix awk usage in charge_reserved_hugetlb.sh and hugetlb_reparenting_test.sh that may cause error
  selftests/vm: make charge_reserved_hugetlb.sh work with existing cgroup setting
  ACPI: resource: Skip IRQ override on ASUS ExpertBook B1402CBA
  ACPI: resource: Skip IRQ override on ASUS ExpertBook B1502CBA
  ACPI: resource: Skip IRQ override on Asus Expertbook B2402CBA
  ACPI: resource: Add Asus ExpertBook B2502 to Asus quirks
  ACPI: resource: Skip IRQ override on Asus Vivobook S5602ZA
  ACPI: resource: Add ASUS model S5402ZA to quirks
  ACPI: resource: Skip IRQ override on Asus Vivobook K3402ZA/K3502ZA
  ACPI: resources: Add DMI-based legacy IRQ override quirk
  ACPI: Drop acpi_dev_irqresource_disabled()
  resource: Add irqresource_disabled()
  thunderbolt: Workaround an IOMMU fault on certain systems with Intel Maple Ridge
  net: pktgen: Fix interface flags printing
  netfilter: nft_set_rbtree: .deactivate fails if element has expired
  neighbor: tracing: Move pin6 inside CONFIG_IPV6=y section
  net/sched: sch_hfsc: upgrade 'rt' to 'sc' when it becomes a inner curve
  net: dsa: bcm_sf2: Fix possible memory leak in bcm_sf2_mdio_register()
  i40e: prevent crash on probe if hw registers have invalid values
  net: usb: smsc95xx: Fix an error code in smsc95xx_reset()
  ipv4: fib: annotate races around nh->nh_saddr_genid and nh->nh_saddr
  tun: prevent negative ifindex
  tcp: tsq: relax tcp_small_queue_check() when rtx queue contains a single skb
  tcp: fix excessive TLP and RACK timeouts from HZ rounding
  net: rfkill: gpio: prevent value glitch during probe
  net: ipv6: fix return value check in esp_remove_trailer
  net: ipv4: fix return value check in esp_remove_trailer
  xfrm: interface: use DEV_STATS_INC()
  xfrm: fix a data-race in xfrm_gen_index()
  qed: fix LL2 RX buffer allocation
  drm/i915: Retry gtt fault when out of fence registers
  nvmet-tcp: Fix a possible UAF in queue intialization setup
  netfilter: nft_payload: fix wrong mac header matching
  tcp: check mptcp-level constraints for backlog coalescing
  x86/sev: Check for user-space IOIO pointing to kernel space
  x86/sev: Check IOBM for IOIO exceptions from user-space
  x86/sev: Disable MMIO emulation from user mode
  KVM: x86: Mask LVTPC when handling a PMI
  regmap: fix NULL deref on lookup
  nfc: nci: fix possible NULL pointer dereference in send_acknowledge()
  ice: reset first in crash dump kernels
  ice: fix over-shifted variable
  Bluetooth: avoid memcmp() out of bounds warning
  Bluetooth: hci_event: Fix coding style
  Bluetooth: vhci: Fix race when opening vhci device
  Bluetooth: Fix a refcnt underflow problem for hci_conn
  Bluetooth: Reject connection with the device which has same BD_ADDR
  Bluetooth: hci_event: Ignore NULL link key
  usb: hub: Guard against accesses to uninitialized BOS descriptors
  Documentation: sysctl: align cells in second content column
  mm/memory_hotplug: rate limit page migration warnings
  lib/Kconfig.debug: do not enable DEBUG_PREEMPT by default
  dev_forward_skb: do not scrub skb mark within the same name space
  ravb: Fix use-after-free issue in ravb_tx_timeout_work()
  RDMA/srp: Fix srp_abort()
  RDMA/srp: Set scmnd->result only when scmnd is not NULL
  arm64: armv8_deprecated: fix unused-function error
  arm64: armv8_deprecated: rework deprected instruction handling
  arm64: armv8_deprecated: move aarch32 helper earlier
  arm64: armv8_deprecated move emulation functions
  arm64: armv8_deprecated: fold ops into insn_emulation
  arm64: rework EL0 MRS emulation
  arm64: factor insn read out of call_undef_hook()
  arm64: factor out EL1 SSBS emulation hook
  arm64: split EL0/EL1 UNDEF handlers
  arm64: allow kprobes on EL0 handlers
  arm64: rework BTI exception handling
  arm64: rework FPAC exception handling
  arm64: consistently pass ESR_ELx to die()
  arm64: die(): pass 'err' as long
  arm64: report EL1 UNDEFs better
  x86/alternatives: Disable KASAN in apply_alternatives()
  powerpc/64e: Fix wrong test in __ptep_test_and_clear_young()
  powerpc/8xx: Fix pte_access_permitted() for PAGE_NONE
  dmaengine: mediatek: Fix deadlock caused by synchronize_irq()
  usb: gadget: ncm: Handle decoding of multiple NTB's in unwrap call
  usb: gadget: udc-xilinx: replace memcpy with memcpy_toio
  counter: microchip-tcb-capture: Fix the use of internal GCLK logic
  pinctrl: avoid unsafe code pattern in find_pinctrl()
  cgroup: Remove duplicates in cgroup v1 tasks file
  tee: amdtee: fix use-after-free vulnerability in amdtee_close_session
  Input: goodix - ensure int GPIO is in input for gpio_count == 1 && gpio_int_idx == 0 case
  Input: i8042 - add Fujitsu Lifebook E5411 to i8042 quirk table
  Input: xpad - add PXN V900 support
  Input: psmouse - fix fast_reconnect function for PS/2 mode
  Input: powermate - fix use-after-free in powermate_config_complete
  ceph: fix type promotion bug on 32bit systems
  ceph: fix incorrect revoked caps assert in ceph_fill_file_size()
  libceph: use kernel_connect()
  thunderbolt: Check that lane 1 is in CL0 before enabling lane bonding
  mcb: remove is_added flag from mcb_device struct
  x86/cpu: Fix AMD erratum #1485 on Zen4-based CPUs
  iio: pressure: ms5611: ms5611_prom_is_valid false negative bug
  iio: pressure: dps310: Adjust Timeout Settings
  iio: pressure: bmp280: Fix NULL pointer exception
  usb: musb: Modify the "HWVers" register address
  usb: musb: Get the musb_qh poniter after musb_giveback
  usb: dwc3: Soft reset phy on probe for host
  net: usb: dm9601: fix uninitialized variable use in dm9601_mdio_read
  usb: xhci: xhci-ring: Use sysdev for mapping bounce buffer
  dmaengine: stm32-mdma: abort resume if no ongoing transfer
  media: mtk-jpeg: Fix use after free bug due to uncanceled work
  net: release reference to inet6_dev pointer
  net: change accept_ra_min_rtr_lft to affect all RA lifetimes
  net: add sysctl accept_ra_min_rtr_lft
  Revert "spi: spi-zynqmp-gqspi: Fix runtime PM imbalance in zynqmp_qspi_probe"
  Revert "spi: zynqmp-gqspi: fix clock imbalance on probe failure"
  workqueue: Override implicit ordered attribute in workqueue_apply_unbound_cpumask()
  nfc: nci: assert requested protocol is valid
  pinctrl: renesas: rzn1: Enable missing PINMUX
  net: nfc: fix races in nfc_llcp_sock_get() and nfc_llcp_sock_get_sn()
  ixgbe: fix crash with empty VF macvlan list
  net: phy: mscc: macsec: reject PN update requests
  net: macsec: indicate next pn update when offloading
  drm/vmwgfx: fix typo of sizeof argument
  riscv, bpf: Sign-extend return values
  riscv, bpf: Factor out emit_call for kernel and bpf context
  xen-netback: use default TX queue size for vifs
  mlxsw: fix mlxsw_sp2_nve_vxlan_learning_set() return type
  ieee802154: ca8210: Fix a potential UAF in ca8210_probe
  ravb: Fix up dma_free_coherent() call in ravb_remove()
  drm/msm/dpu: change _dpu_plane_calc_bw() to use u64 to avoid overflow
  drm/msm/dsi: skip the wait for video mode done if not applicable
  drm/msm/dp: do not reinitialize phy unless retry during link training
  net: prevent address rewrite in kernel_bind()
  quota: Fix slow quotaoff
  HID: logitech-hidpp: Fix kernel crash on receiver USB disconnect
  lib/test_meminit: fix off-by-one error in test_pages()
  perf/arm-cmn: Fix the unhandled overflow status of counter 4 to 7
  RDMA/cxgb4: Check skb value for failure to allocate
  RDMA/srp: Do not call scsi_done() from srp_abort()
  RDMA/srp: Make struct scsi_cmnd and struct srp_request adjacent

 Conflicts:
	drivers/interconnect/qcom/bcm-voter.c
	drivers/interconnect/qcom/icc-rpmh.h
	drivers/media/platform/qcom/venus/hfi_parser.c

Change-Id: I3dd63e23b279d1f3dc6f726d18b73a965098b403
Signed-off-by: aseshu <quic_aseshu@quicinc.com>
2024-04-05 17:33:21 +05:30

410 lines
10 KiB
C

/* Sign a module file using the given key.
*
* Copyright © 2014-2016 Red Hat, Inc. All Rights Reserved.
* Copyright © 2015 Intel Corporation.
* Copyright © 2016 Hewlett Packard Enterprise Development LP
*
* Authors: David Howells <dhowells@redhat.com>
* David Woodhouse <dwmw2@infradead.org>
* Juerg Haefliger <juerg.haefliger@hpe.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the licence, or (at your option) any later version.
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <getopt.h>
#include <err.h>
#include <arpa/inet.h>
#include <openssl/opensslv.h>
#include <openssl/bio.h>
#include <openssl/evp.h>
#include <openssl/pem.h>
#include <openssl/err.h>
#include <openssl/engine.h>
/*
* OpenSSL 3.0 deprecates the OpenSSL's ENGINE API.
*
* Remove this if/when that API is no longer used
*/
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
/*
* Use CMS if we have openssl-1.0.0 or newer available - otherwise we have to
* assume that it's not available and its header file is missing and that we
* should use PKCS#7 instead. Switching to the older PKCS#7 format restricts
* the options we have on specifying the X.509 certificate we want.
*
* Further, older versions of OpenSSL don't support manually adding signers to
* the PKCS#7 message so have to accept that we get a certificate included in
* the signature message. Nor do such older versions of OpenSSL support
* signing with anything other than SHA1 - so we're stuck with that if such is
* the case.
*/
#if defined(LIBRESSL_VERSION_NUMBER) || \
OPENSSL_VERSION_NUMBER < 0x10000000L || \
defined(OPENSSL_NO_CMS)
#define USE_PKCS7
#endif
#ifndef USE_PKCS7
#include <openssl/cms.h>
#else
#include <openssl/pkcs7.h>
#endif
struct module_signature {
uint8_t algo; /* Public-key crypto algorithm [0] */
uint8_t hash; /* Digest algorithm [0] */
uint8_t id_type; /* Key identifier type [PKEY_ID_PKCS7] */
uint8_t signer_len; /* Length of signer's name [0] */
uint8_t key_id_len; /* Length of key identifier [0] */
uint8_t __pad[3];
uint32_t sig_len; /* Length of signature data */
};
#define PKEY_ID_PKCS7 2
static char magic_number[] = "~Module signature appended~\n";
static __attribute__((noreturn))
void format(void)
{
fprintf(stderr,
"Usage: scripts/sign-file [-dp] <hash algo> <key> <x509> <module> [<dest>]\n");
fprintf(stderr,
" scripts/sign-file -s <raw sig> <hash algo> <x509> <module> [<dest>]\n");
exit(2);
}
static void display_openssl_errors(int l)
{
const char *file;
char buf[120];
int e, line;
if (ERR_peek_error() == 0)
return;
fprintf(stderr, "At main.c:%d:\n", l);
while ((e = ERR_get_error_line(&file, &line))) {
ERR_error_string(e, buf);
fprintf(stderr, "- SSL %s: %s:%d\n", buf, file, line);
}
}
#ifndef OPENSSL_NO_ENGINE
static void drain_openssl_errors(void)
{
const char *file;
int line;
if (ERR_peek_error() == 0)
return;
while (ERR_get_error_line(&file, &line)) {}
}
#endif
#define ERR(cond, fmt, ...) \
do { \
bool __cond = (cond); \
display_openssl_errors(__LINE__); \
if (__cond) { \
err(1, fmt, ## __VA_ARGS__); \
} \
} while(0)
static const char *key_pass;
static int pem_pw_cb(char *buf, int len, int w, void *v)
{
int pwlen;
if (!key_pass)
return -1;
pwlen = strlen(key_pass);
if (pwlen >= len)
return -1;
strcpy(buf, key_pass);
/* If it's wrong, don't keep trying it. */
key_pass = NULL;
return pwlen;
}
static EVP_PKEY *read_private_key(const char *private_key_name)
{
EVP_PKEY *private_key;
BIO *b;
#ifndef OPENSSL_NO_ENGINE
if (!strncmp(private_key_name, "pkcs11:", 7)) {
ENGINE *e;
ENGINE_load_builtin_engines();
drain_openssl_errors();
e = ENGINE_by_id("pkcs11");
ERR(!e, "Load PKCS#11 ENGINE");
if (ENGINE_init(e))
drain_openssl_errors();
else
ERR(1, "ENGINE_init");
if (key_pass)
ERR(!ENGINE_ctrl_cmd_string(e, "PIN", key_pass, 0),
"Set PKCS#11 PIN");
private_key = ENGINE_load_private_key(e, private_key_name,
NULL, NULL);
ERR(!private_key, "%s", private_key_name);
return private_key;
}
#endif
b = BIO_new_file(private_key_name, "rb");
ERR(!b, "%s", private_key_name);
private_key = PEM_read_bio_PrivateKey(b, NULL, pem_pw_cb,
NULL);
ERR(!private_key, "%s", private_key_name);
BIO_free(b);
return private_key;
}
static X509 *read_x509(const char *x509_name)
{
unsigned char buf[2];
X509 *x509;
BIO *b;
int n;
b = BIO_new_file(x509_name, "rb");
ERR(!b, "%s", x509_name);
/* Look at the first two bytes of the file to determine the encoding */
n = BIO_read(b, buf, 2);
if (n != 2) {
if (BIO_should_retry(b)) {
fprintf(stderr, "%s: Read wanted retry\n", x509_name);
exit(1);
}
if (n >= 0) {
fprintf(stderr, "%s: Short read\n", x509_name);
exit(1);
}
ERR(1, "%s", x509_name);
}
ERR(BIO_reset(b) != 0, "%s", x509_name);
if (buf[0] == 0x30 && buf[1] >= 0x81 && buf[1] <= 0x84)
/* Assume raw DER encoded X.509 */
x509 = d2i_X509_bio(b, NULL);
else
/* Assume PEM encoded X.509 */
x509 = PEM_read_bio_X509(b, NULL, NULL, NULL);
BIO_free(b);
ERR(!x509, "%s", x509_name);
return x509;
}
int main(int argc, char **argv)
{
struct module_signature sig_info = { .id_type = PKEY_ID_PKCS7 };
char *hash_algo = NULL;
char *private_key_name = NULL, *raw_sig_name = NULL;
char *x509_name, *module_name, *dest_name;
bool save_sig = false, replace_orig;
bool sign_only = false;
bool raw_sig = false;
unsigned char buf[4096];
unsigned long module_size, sig_size;
unsigned int use_signed_attrs;
const EVP_MD *digest_algo;
EVP_PKEY *private_key;
#ifndef USE_PKCS7
CMS_ContentInfo *cms = NULL;
unsigned int use_keyid = 0;
#else
PKCS7 *pkcs7 = NULL;
#endif
X509 *x509;
BIO *bd, *bm;
int opt, n;
OpenSSL_add_all_algorithms();
ERR_load_crypto_strings();
ERR_clear_error();
key_pass = getenv("KBUILD_SIGN_PIN");
#ifndef USE_PKCS7
use_signed_attrs = CMS_NOATTR;
#else
use_signed_attrs = PKCS7_NOATTR;
#endif
do {
opt = getopt(argc, argv, "sdpk");
switch (opt) {
case 's': raw_sig = true; break;
case 'p': save_sig = true; break;
case 'd': sign_only = true; save_sig = true; break;
#ifndef USE_PKCS7
case 'k': use_keyid = CMS_USE_KEYID; break;
#endif
case -1: break;
default: format();
}
} while (opt != -1);
argc -= optind;
argv += optind;
if (argc < 4 || argc > 5)
format();
if (raw_sig) {
raw_sig_name = argv[0];
hash_algo = argv[1];
} else {
hash_algo = argv[0];
private_key_name = argv[1];
}
x509_name = argv[2];
module_name = argv[3];
if (argc == 5 && strcmp(argv[3], argv[4]) != 0) {
dest_name = argv[4];
replace_orig = false;
} else {
ERR(asprintf(&dest_name, "%s.~signed~", module_name) < 0,
"asprintf");
replace_orig = true;
}
#ifdef USE_PKCS7
if (strcmp(hash_algo, "sha1") != 0) {
fprintf(stderr, "sign-file: %s only supports SHA1 signing\n",
OPENSSL_VERSION_TEXT);
exit(3);
}
#endif
/* Open the module file */
bm = BIO_new_file(module_name, "rb");
ERR(!bm, "%s", module_name);
if (!raw_sig) {
/* Read the private key and the X.509 cert the PKCS#7 message
* will point to.
*/
private_key = read_private_key(private_key_name);
x509 = read_x509(x509_name);
/* Digest the module data. */
OpenSSL_add_all_digests();
display_openssl_errors(__LINE__);
digest_algo = EVP_get_digestbyname(hash_algo);
ERR(!digest_algo, "EVP_get_digestbyname");
#ifndef USE_PKCS7
/* Load the signature message from the digest buffer. */
cms = CMS_sign(NULL, NULL, NULL, NULL,
CMS_NOCERTS | CMS_PARTIAL | CMS_BINARY |
CMS_DETACHED | CMS_STREAM);
ERR(!cms, "CMS_sign");
ERR(!CMS_add1_signer(cms, x509, private_key, digest_algo,
CMS_NOCERTS | CMS_BINARY |
CMS_NOSMIMECAP | use_keyid |
use_signed_attrs),
"CMS_add1_signer");
ERR(CMS_final(cms, bm, NULL, CMS_NOCERTS | CMS_BINARY) != 1,
"CMS_final");
#else
pkcs7 = PKCS7_sign(x509, private_key, NULL, bm,
PKCS7_NOCERTS | PKCS7_BINARY |
PKCS7_DETACHED | use_signed_attrs);
ERR(!pkcs7, "PKCS7_sign");
#endif
if (save_sig) {
char *sig_file_name;
BIO *b;
ERR(asprintf(&sig_file_name, "%s.p7s", module_name) < 0,
"asprintf");
b = BIO_new_file(sig_file_name, "wb");
ERR(!b, "%s", sig_file_name);
#ifndef USE_PKCS7
ERR(i2d_CMS_bio_stream(b, cms, NULL, 0) != 1,
"%s", sig_file_name);
#else
ERR(i2d_PKCS7_bio(b, pkcs7) != 1,
"%s", sig_file_name);
#endif
BIO_free(b);
}
if (sign_only) {
BIO_free(bm);
return 0;
}
}
/* Open the destination file now so that we can shovel the module data
* across as we read it.
*/
bd = BIO_new_file(dest_name, "wb");
ERR(!bd, "%s", dest_name);
/* Append the marker and the PKCS#7 message to the destination file */
ERR(BIO_reset(bm) < 0, "%s", module_name);
while ((n = BIO_read(bm, buf, sizeof(buf))),
n > 0) {
ERR(BIO_write(bd, buf, n) < 0, "%s", dest_name);
}
BIO_free(bm);
ERR(n < 0, "%s", module_name);
module_size = BIO_number_written(bd);
if (!raw_sig) {
#ifndef USE_PKCS7
ERR(i2d_CMS_bio_stream(bd, cms, NULL, 0) != 1, "%s", dest_name);
#else
ERR(i2d_PKCS7_bio(bd, pkcs7) != 1, "%s", dest_name);
#endif
} else {
BIO *b;
/* Read the raw signature file and write the data to the
* destination file
*/
b = BIO_new_file(raw_sig_name, "rb");
ERR(!b, "%s", raw_sig_name);
while ((n = BIO_read(b, buf, sizeof(buf))), n > 0)
ERR(BIO_write(bd, buf, n) < 0, "%s", dest_name);
BIO_free(b);
}
sig_size = BIO_number_written(bd) - module_size;
sig_info.sig_len = htonl(sig_size);
ERR(BIO_write(bd, &sig_info, sizeof(sig_info)) < 0, "%s", dest_name);
ERR(BIO_write(bd, magic_number, sizeof(magic_number) - 1) < 0, "%s", dest_name);
ERR(BIO_free(bd) != 1, "%s", dest_name);
/* Finally, if we're signing in place, replace the original. */
if (replace_orig)
ERR(rename(dest_name, module_name) < 0, "%s", dest_name);
return 0;
}