diff options
-rw-r--r-- | 0001-USB-gadget-dummy_hcd-switch-char-to-u8.patch | 61 | ||||
-rw-r--r-- | 0001-driver-core-add-printk-debugging.patch | 10 | ||||
-rw-r--r-- | 0001-net-packet-move-reference-count-in-packet_sock-to-64.patch | 98 | ||||
-rw-r--r-- | 0001-readfile-implement-readfile-syscall.patch | 2 | ||||
-rw-r--r-- | 0001-vsmp-driver.patch | 4 | ||||
-rw-r--r-- | pmu_attr_visible.patch | 63 | ||||
-rw-r--r-- | series | 3 |
7 files changed, 70 insertions, 171 deletions
diff --git a/0001-USB-gadget-dummy_hcd-switch-char-to-u8.patch b/0001-USB-gadget-dummy_hcd-switch-char-to-u8.patch new file mode 100644 index 00000000000000..ee75c4e107d866 --- /dev/null +++ b/0001-USB-gadget-dummy_hcd-switch-char-to-u8.patch @@ -0,0 +1,61 @@ +From ed62e36cc3d52d3bcfb5ec2ce20f9317cefaef67 Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Date: Fri, 21 Oct 2022 08:33:30 +0200 +Subject: [PATCH] USB: gadget: dummy_hcd: switch char * to u8 * + +The function handle_control_request() casts the urb buffer to a char *, +and then treats it like a unsigned char buffer when assigning data to +it. On some architectures, "char" is really signed, so let's just +properly set this pointer to a u8 to take away any potential problems as +that's what is really wanted here. + +Document that we are only using the lower 8 bits for the devstatus +variable (only 7 are currently used), as the cast from 16 to 8 is not +obvious. + +Cc: Felipe Balbi <balbi@kernel.org> +Cc: Jakob Koschel <jakobkoschel@gmail.com> +Cc: Randy Dunlap <rdunlap@infradead.org> +Cc: Ira Weiny <ira.weiny@intel.com> +Cc: Alan Stern <stern@rowland.harvard.edu> +Reported-by: Linus Torvalds <torvalds@linux-foundation.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/usb/gadget/udc/dummy_hcd.c | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +--- a/drivers/usb/gadget/udc/dummy_hcd.c ++++ b/drivers/usb/gadget/udc/dummy_hcd.c +@@ -1741,13 +1741,13 @@ static int handle_control_request(struct + if (setup->bRequestType == Dev_InRequest + || setup->bRequestType == Intf_InRequest + || setup->bRequestType == Ep_InRequest) { +- char *buf; ++ u8 *buf; + /* +- * device: remote wakeup, selfpowered ++ * device: remote wakeup, selfpowered, LTM, U1, or U2 + * interface: nothing + * endpoint: halt + */ +- buf = (char *)urb->transfer_buffer; ++ buf = urb->transfer_buffer; + if (urb->transfer_buffer_length > 0) { + if (setup->bRequestType == Ep_InRequest) { + ep2 = find_endpoint(dum, w_index); +@@ -1756,11 +1756,12 @@ static int handle_control_request(struct + break; + } + buf[0] = ep2->halted; +- } else if (setup->bRequestType == +- Dev_InRequest) { ++ } else if (setup->bRequestType == Dev_InRequest) { ++ /* Only take the lower 8 bits */ + buf[0] = (u8)dum->devstatus; +- } else ++ } else { + buf[0] = 0; ++ } + } + if (urb->transfer_buffer_length > 1) + buf[1] = 0; diff --git a/0001-driver-core-add-printk-debugging.patch b/0001-driver-core-add-printk-debugging.patch index 1d5af6d396fa1a..69bba41edede01 100644 --- a/0001-driver-core-add-printk-debugging.patch +++ b/0001-driver-core-add-printk-debugging.patch @@ -21,7 +21,7 @@ Helps when trying to find leaks kfree(priv); } -@@ -1191,6 +1192,7 @@ EXPORT_SYMBOL_GPL(subsys_interface_unreg +@@ -1198,6 +1199,7 @@ EXPORT_SYMBOL_GPL(subsys_interface_unreg static void system_root_device_release(struct device *dev) { @@ -40,7 +40,7 @@ Helps when trying to find leaks #include <linux/device/class.h> #include <linux/device.h> #include <linux/module.h> -@@ -575,6 +577,7 @@ EXPORT_SYMBOL_GPL(class_compat_register) +@@ -574,6 +576,7 @@ EXPORT_SYMBOL_GPL(class_compat_register) */ void class_compat_unregister(struct class_compat *cls) { @@ -50,7 +50,7 @@ Helps when trying to find leaks } --- a/drivers/base/core.c +++ b/drivers/base/core.c -@@ -3851,6 +3851,7 @@ EXPORT_SYMBOL_GPL(device_del); +@@ -3948,6 +3948,7 @@ EXPORT_SYMBOL_GPL(device_del); void device_unregister(struct device *dev) { pr_debug("device: '%s': %s\n", dev_name(dev), __func__); @@ -58,7 +58,7 @@ Helps when trying to find leaks device_del(dev); put_device(dev); } -@@ -4275,6 +4276,7 @@ EXPORT_SYMBOL_GPL(root_device_unregister +@@ -4377,6 +4378,7 @@ EXPORT_SYMBOL_GPL(root_device_unregister static void device_create_release(struct device *dev) { pr_debug("device: '%s': %s\n", dev_name(dev), __func__); @@ -66,7 +66,7 @@ Helps when trying to find leaks kfree(dev); } -@@ -4409,6 +4411,7 @@ void device_destroy(const struct class * +@@ -4511,6 +4513,7 @@ void device_destroy(const struct class * dev = class_find_device_by_devt(class, devt); if (dev) { diff --git a/0001-net-packet-move-reference-count-in-packet_sock-to-64.patch b/0001-net-packet-move-reference-count-in-packet_sock-to-64.patch deleted file mode 100644 index 734633f20a0ade..00000000000000 --- a/0001-net-packet-move-reference-count-in-packet_sock-to-64.patch +++ /dev/null @@ -1,98 +0,0 @@ -From ac0d2377f612a16f1b452c7945e77dee93c0289e Mon Sep 17 00:00:00 2001 -From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -Date: Thu, 30 Nov 2023 14:10:27 +0000 -Subject: [PATCH] net/packet: move reference count in packet_sock to 64 bits - -In some potential instances the reference count on struct packet_sock -could be saturated and cause overflows which gets the kernel a bit -confused. To prevent this, move to a 64bit atomic reference count to -prevent the possibility of this type of overflow. - -Because we can not handle saturation, using refcount_t is not possible -in this place. Maybe someday in the future if it changes could it be -used. - -Original version from Daniel after I did it wrong, I've provided a -changelog. - -Reported-by: "The UK's National Cyber Security Centre (NCSC)" <security@ncsc.gov.uk> -Cc: stable <stable@kernel.org> -Cc: Daniel Borkmann <daniel@iogearbox.net> -Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com> -Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> ---- - net/packet/af_packet.c | 16 ++++++++-------- - net/packet/internal.h | 2 +- - 2 files changed, 9 insertions(+), 9 deletions(-) - ---- a/net/packet/af_packet.c -+++ b/net/packet/af_packet.c -@@ -4300,7 +4300,7 @@ static void packet_mm_open(struct vm_are - struct sock *sk = sock->sk; - - if (sk) -- atomic_inc(&pkt_sk(sk)->mapped); -+ atomic64_inc(&pkt_sk(sk)->mapped); - } - - static void packet_mm_close(struct vm_area_struct *vma) -@@ -4310,7 +4310,7 @@ static void packet_mm_close(struct vm_ar - struct sock *sk = sock->sk; - - if (sk) -- atomic_dec(&pkt_sk(sk)->mapped); -+ atomic64_dec(&pkt_sk(sk)->mapped); - } - - static const struct vm_operations_struct packet_mmap_ops = { -@@ -4405,7 +4405,7 @@ static int packet_set_ring(struct sock * - - err = -EBUSY; - if (!closing) { -- if (atomic_read(&po->mapped)) -+ if (atomic64_read(&po->mapped)) - goto out; - if (packet_read_pending(rb)) - goto out; -@@ -4508,7 +4508,7 @@ static int packet_set_ring(struct sock * - - err = -EBUSY; - mutex_lock(&po->pg_vec_lock); -- if (closing || atomic_read(&po->mapped) == 0) { -+ if (closing || atomic64_read(&po->mapped) == 0) { - err = 0; - spin_lock_bh(&rb_queue->lock); - swap(rb->pg_vec, pg_vec); -@@ -4526,9 +4526,9 @@ static int packet_set_ring(struct sock * - po->prot_hook.func = (po->rx_ring.pg_vec) ? - tpacket_rcv : packet_rcv; - skb_queue_purge(rb_queue); -- if (atomic_read(&po->mapped)) -- pr_err("packet_mmap: vma is busy: %d\n", -- atomic_read(&po->mapped)); -+ if (atomic64_read(&po->mapped)) -+ pr_err("packet_mmap: vma is busy: %lld\n", -+ atomic64_read(&po->mapped)); - } - mutex_unlock(&po->pg_vec_lock); - -@@ -4606,7 +4606,7 @@ static int packet_mmap(struct file *file - } - } - -- atomic_inc(&po->mapped); -+ atomic64_inc(&po->mapped); - vma->vm_ops = &packet_mmap_ops; - err = 0; - ---- a/net/packet/internal.h -+++ b/net/packet/internal.h -@@ -122,7 +122,7 @@ struct packet_sock { - __be16 num; - struct packet_rollover *rollover; - struct packet_mclist *mclist; -- atomic_t mapped; -+ atomic64_t mapped; - enum tpacket_versions tp_version; - unsigned int tp_hdrlen; - unsigned int tp_reserve; diff --git a/0001-readfile-implement-readfile-syscall.patch b/0001-readfile-implement-readfile-syscall.patch index 93448fe2e86188..8df29869861787 100644 --- a/0001-readfile-implement-readfile-syscall.patch +++ b/0001-readfile-implement-readfile-syscall.patch @@ -20,7 +20,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- a/fs/open.c +++ b/fs/open.c -@@ -1676,3 +1676,53 @@ int stream_open(struct inode *inode, str +@@ -1641,3 +1641,53 @@ int stream_open(struct inode *inode, str } EXPORT_SYMBOL(stream_open); diff --git a/0001-vsmp-driver.patch b/0001-vsmp-driver.patch index a248846248f282..92a974deb85bba 100644 --- a/0001-vsmp-driver.patch +++ b/0001-vsmp-driver.patch @@ -28,7 +28,7 @@ first cut to cleanup +Description: Shows the full version of the vSMP hypervisor --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -23365,6 +23365,12 @@ F: lib/test_printf.c +@@ -24105,6 +24105,12 @@ F: lib/test_printf.c F: lib/test_scanf.c F: lib/vsprintf.c @@ -43,7 +43,7 @@ first cut to cleanup L: linux-hwmon@vger.kernel.org --- a/drivers/virt/Kconfig +++ b/drivers/virt/Kconfig -@@ -50,4 +50,6 @@ source "drivers/virt/acrn/Kconfig" +@@ -49,4 +49,6 @@ source "drivers/virt/acrn/Kconfig" source "drivers/virt/coco/Kconfig" diff --git a/pmu_attr_visible.patch b/pmu_attr_visible.patch deleted file mode 100644 index 228d9d9676bc3c..00000000000000 --- a/pmu_attr_visible.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- - kernel/events/core.c | 40 ++++++++++++++++++++++++++++------------ - 1 file changed, 28 insertions(+), 12 deletions(-) - ---- a/kernel/events/core.c -+++ b/kernel/events/core.c -@@ -11400,9 +11400,32 @@ static DEVICE_ATTR_RW(perf_event_mux_int - static struct attribute *pmu_dev_attrs[] = { - &dev_attr_type.attr, - &dev_attr_perf_event_mux_interval_ms.attr, -+ &dev_attr_nr_addr_filters.attr, -+ NULL, -+}; -+ -+static umode_t pmu_dev_is_visible(struct kobject *kobj, struct attribute *a, int n) -+{ -+ struct device *dev = kobj_to_dev(kobj); -+ struct pmu *pmu = dev_get_drvdata(dev); -+ -+ if (!pmu->nr_addr_filters) -+ return 0; -+ -+ return a->mode; -+ -+ return 0; -+} -+ -+static struct attribute_group pmu_dev_attr_group = { -+ .is_visible = pmu_dev_is_visible, -+ .attrs = pmu_dev_attrs, -+}; -+ -+const static struct attribute_group *pmu_dev_groups[] = { -+ &pmu_dev_attr_group, - NULL, - }; --ATTRIBUTE_GROUPS(pmu_dev); - - static int pmu_bus_running; - static struct bus_type pmu_bus = { -@@ -11439,18 +11462,11 @@ static int pmu_dev_alloc(struct pmu *pmu - if (ret) - goto free_dev; - -- /* For PMUs with address filters, throw in an extra attribute: */ -- if (pmu->nr_addr_filters) -- ret = device_create_file(pmu->dev, &dev_attr_nr_addr_filters); -- -- if (ret) -- goto del_dev; -- -- if (pmu->attr_update) -+ if (pmu->attr_update) { - ret = sysfs_update_groups(&pmu->dev->kobj, pmu->attr_update); -- -- if (ret) -- goto del_dev; -+ if (ret) -+ goto del_dev; -+ } - - out: - return ret; @@ -1,7 +1,6 @@ # -0001-net-packet-move-reference-count-in-packet_sock-to-64.patch +0001-USB-gadget-dummy_hcd-switch-char-to-u8.patch 0001-driver-core-add-printk-debugging.patch -pmu_attr_visible.patch usb.patch 0001-vsmp-driver.patch 0001-driver-core-aux-test-code.patch |