···298298 zram->backing_dev = NULL;299299 zram->old_block_size = 0;300300 zram->bdev = NULL;301301-301301+ zram->disk->queue->backing_dev_info->capabilities |=302302+ BDI_CAP_SYNCHRONOUS_IO;302303 kvfree(zram->bitmap);303304 zram->bitmap = NULL;304305}···401400 zram->backing_dev = backing_dev;402401 zram->bitmap = bitmap;403402 zram->nr_pages = nr_pages;403403+ /*404404+ * With writeback feature, zram does asynchronous IO so it's no longer405405+ * synchronous device so let's remove synchronous io flag. Othewise,406406+ * upper layer(e.g., swap) could wait IO completion rather than407407+ * (submit and return), which will cause system sluggish.408408+ * Furthermore, when the IO function returns(e.g., swap_readpage),409409+ * upper layer expects IO was done so it could deallocate the page410410+ * freely but in fact, IO is going on so finally could cause411411+ * use-after-free when the IO is really done.412412+ */413413+ zram->disk->queue->backing_dev_info->capabilities &=414414+ ~BDI_CAP_SYNCHRONOUS_IO;404415 up_write(&zram->init_lock);405416406417 pr_info("setup backing device %s\n", file_name);
+28-13
drivers/i2c/busses/i2c-xlp9xx.c
···191191 if (priv->len_recv) {192192 /* read length byte */193193 rlen = xlp9xx_read_i2c_reg(priv, XLP9XX_I2C_MRXFIFO);194194+195195+ /*196196+ * We expect at least 2 interrupts for I2C_M_RECV_LEN197197+ * transactions. The length is updated during the first198198+ * interrupt, and the buffer contents are only copied199199+ * during subsequent interrupts. If in case the interrupts200200+ * get merged we would complete the transaction without201201+ * copying out the bytes from RX fifo. To avoid this now we202202+ * drain the fifo as and when data is available.203203+ * We drained the rlen byte already, decrement total length204204+ * by one.205205+ */206206+207207+ len--;194208 if (rlen > I2C_SMBUS_BLOCK_MAX || rlen == 0) {195209 rlen = 0; /*abort transfer */196210 priv->msg_buf_remaining = 0;197211 priv->msg_len = 0;198198- } else {199199- *buf++ = rlen;200200- if (priv->client_pec)201201- ++rlen; /* account for error check byte */202202- /* update remaining bytes and message length */203203- priv->msg_buf_remaining = rlen;204204- priv->msg_len = rlen + 1;212212+ xlp9xx_i2c_update_rlen(priv);213213+ return;205214 }215215+216216+ *buf++ = rlen;217217+ if (priv->client_pec)218218+ ++rlen; /* account for error check byte */219219+ /* update remaining bytes and message length */220220+ priv->msg_buf_remaining = rlen;221221+ priv->msg_len = rlen + 1;206222 xlp9xx_i2c_update_rlen(priv);207223 priv->len_recv = false;208208- } else {209209- len = min(priv->msg_buf_remaining, len);210210- for (i = 0; i < len; i++, buf++)211211- *buf = xlp9xx_read_i2c_reg(priv, XLP9XX_I2C_MRXFIFO);212212-213213- priv->msg_buf_remaining -= len;214224 }215225226226+ len = min(priv->msg_buf_remaining, len);227227+ for (i = 0; i < len; i++, buf++)228228+ *buf = xlp9xx_read_i2c_reg(priv, XLP9XX_I2C_MRXFIFO);229229+230230+ priv->msg_buf_remaining -= len;216231 priv->msg_buf = buf;217232218233 if (priv->msg_buf_remaining)
+11-14
drivers/net/ethernet/ti/cpsw.c
···23582358 int i;2359235923602360 for (i = 0; i < cpsw->data.slaves; i++) {23612361- if (vid == cpsw->slaves[i].port_vlan)23622362- return -EINVAL;23612361+ if (vid == cpsw->slaves[i].port_vlan) {23622362+ ret = -EINVAL;23632363+ goto err;23642364+ }23632365 }23642366 }2365236723662368 dev_info(priv->dev, "Adding vlanid %d to vlan filter\n", vid);23672369 ret = cpsw_add_vlan_ale_entry(priv, vid);23682368-23702370+err:23692371 pm_runtime_put(cpsw->dev);23702372 return ret;23712373}···2393239123942392 for (i = 0; i < cpsw->data.slaves; i++) {23952393 if (vid == cpsw->slaves[i].port_vlan)23962396- return -EINVAL;23942394+ goto err;23972395 }23982396 }2399239724002398 dev_info(priv->dev, "removing vlanid %d from vlan filter\n", vid);24012399 ret = cpsw_ale_del_vlan(cpsw->ale, vid, 0);24022402- if (ret != 0)24032403- return ret;24042404-24052405- ret = cpsw_ale_del_ucast(cpsw->ale, priv->mac_addr,24062406- HOST_PORT_NUM, ALE_VLAN, vid);24072407- if (ret != 0)24082408- return ret;24092409-24102410- ret = cpsw_ale_del_mcast(cpsw->ale, priv->ndev->broadcast,24112411- 0, ALE_VLAN, vid);24002400+ ret |= cpsw_ale_del_ucast(cpsw->ale, priv->mac_addr,24012401+ HOST_PORT_NUM, ALE_VLAN, vid);24022402+ ret |= cpsw_ale_del_mcast(cpsw->ale, priv->ndev->broadcast,24032403+ 0, ALE_VLAN, vid);24042404+err:24122405 pm_runtime_put(cpsw->dev);24132406 return ret;24142407}
···11config ARCH_HAS_UBSAN_SANITIZE_ALL22 bool3344-config ARCH_WANTS_UBSAN_NO_NULL55- def_bool n66-74config UBSAN85 bool "Undefined behaviour sanity checker"96 help···3538 This option enables detection of unaligned memory accesses.3639 Enabling this option on architectures that support unaligned3740 accesses may produce a lot of false positives.3838-3939-config UBSAN_NULL4040- bool "Enable checking of null pointers"4141- depends on UBSAN4242- default y if !ARCH_WANTS_UBSAN_NO_NULL4343- help4444- This option enables detection of memory accesses via a4545- null pointer.46414742config TEST_UBSAN4843 tristate "Module for testing for undefined behavior detection"
···1414#include <uapi/linux/bpf.h>1515#include "bpf_helpers.h"16161717-#define MAX_CPUS 12 /* WARNING - sync with _user.c */1717+#define MAX_CPUS 64 /* WARNING - sync with _user.c */18181919/* Special map type that can XDP_REDIRECT frames to another CPU */2020struct bpf_map_def SEC("maps") cpu_map = {
+2-2
samples/bpf/xdp_redirect_cpu_user.c
···1919#include <arpa/inet.h>2020#include <linux/if_link.h>21212222-#define MAX_CPUS 12 /* WARNING - sync with _kern.c */2222+#define MAX_CPUS 64 /* WARNING - sync with _kern.c */23232424/* How many xdp_progs are defined in _kern.c */2525#define MAX_PROG 5···527527 * procedure.528528 */529529 create_cpu_entry(1, 1024, 0, false);530530- create_cpu_entry(1, 128, 0, false);530530+ create_cpu_entry(1, 8, 0, false);531531 create_cpu_entry(1, 16000, 0, false);532532}533533
-4
scripts/Makefile.ubsan
···1414 CFLAGS_UBSAN += $(call cc-option, -fsanitize=alignment)1515endif16161717-ifdef CONFIG_UBSAN_NULL1818- CFLAGS_UBSAN += $(call cc-option, -fsanitize=null)1919-endif2020-2117 # -fsanitize=* options makes GCC less smart than usual and2218 # increase number of 'maybe-uninitialized false-positives2319 CFLAGS_UBSAN += $(call cc-option, -Wno-maybe-uninitialized)