Dataset Viewer
Auto-converted to Parquet Duplicate
idx
int64
0
25.4k
project
stringclasses
707 values
project_url
stringclasses
735 values
filepath
stringlengths
4
100
commit_id
stringlengths
7
40
commit_message
stringlengths
0
18.3k
is_vulnerable
bool
2 classes
hash
stringlengths
32
32
func_name
stringlengths
3
112
func_body
stringlengths
23
235k
changed_lines
stringlengths
2
27.6k
changed_statements
stringlengths
2
161k
cve_list
listlengths
1
19
cwe_list
listlengths
1
6
fixed_func_idx
int64
1
25.4k
context
dict
0
linux
https://github.com/torvalds/linux
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
005145378c9ad7575a01b6ce1ba118fb427f583a
[media] dvb-usb-v2: avoid use-after-free I ran into a stack frame size warning because of the on-stack copy of the USB device structure: drivers/media/usb/dvb-usb-v2/dvb_usb_core.c: In function 'dvb_usbv2_disconnect': drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:1029:1: error: the frame size of 1104 bytes is larger th...
true
5eed13a1f22c5a961ab0b4dcab91a1a7
dvb_usbv2_disconnect
void dvb_usbv2_disconnect(struct usb_interface *intf) { struct dvb_usb_device *d = usb_get_intfdata(intf); const char *name = d->name; struct device dev = d->udev->dev; dev_dbg(&d->udev->dev, "%s: bInterfaceNumber=%d\n", __func__, intf->cur_altsetting->desc.bInterfaceNumber); if (d->props->exit) d->props->e...
[[1015, "\tconst char *name = d->name;\n"], [1016, "\tstruct device dev = d->udev->dev;\n"], [1026, "\tdev_info(&dev, \"%s: '%s' successfully deinitialized and disconnected\\n\",\n"], [1027, "\t\t\tKBUILD_MODNAME, name);\n"]]
[[1015, "const char *name = d->name;"], [1016, "struct device dev = d->udev->dev;"], [1026, "dev_info(&dev, \"%s: '%s' successfully deinitialized and disconnected\\n\",\n\t\t\tKBUILD_MODNAME, name);"]]
[ "CVE-2017-8064" ]
[ "CWE-119" ]
1
{ "Execution Environment": [ "CONFIG_VMAP_STACK" ], "Explanation": null, "External Function": [ "usb_get_intfdata", "dev_info" ], "Function Argument": [ "intf" ], "Globals": [ "KBUILD_MODNAME" ], "Type Execution Declaration": [ "struct dvb_usb_device", "struct device" ]...
1
linux
https://github.com/torvalds/linux
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
005145378c9ad7575a01b6ce1ba118fb427f583a
[media] dvb-usb-v2: avoid use-after-free I ran into a stack frame size warning because of the on-stack copy of the USB device structure: drivers/media/usb/dvb-usb-v2/dvb_usb_core.c: In function 'dvb_usbv2_disconnect': drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:1029:1: error: the frame size of 1104 bytes is larger th...
false
1adb6cd316c6ed00994b824a788e5c69
dvb_usbv2_disconnect
void dvb_usbv2_disconnect(struct usb_interface *intf) { struct dvb_usb_device *d = usb_get_intfdata(intf); const char *devname = kstrdup(dev_name(&d->udev->dev), GFP_KERNEL); const char *drvname = d->name; dev_dbg(&d->udev->dev, "%s: bInterfaceNumber=%d\n", __func__, intf->cur_altsetting->desc.bInterfaceNumber)...
[[1015, "\tconst char *devname = kstrdup(dev_name(&d->udev->dev), GFP_KERNEL);\n"], [1016, "\tconst char *drvname = d->name;\n"], [1026, "\tpr_info(\"%s: '%s:%s' successfully deinitialized and disconnected\\n\",\n"], [1027, "\t\tKBUILD_MODNAME, drvname, devname);\n"], [1028, "\tkfree(devname);\n"]]
[[1015, "const char *devname = kstrdup(dev_name(&d->udev->dev), GFP_KERNEL);"], [1016, "const char *drvname = d->name;"], [1026, "pr_info(\"%s: '%s:%s' successfully deinitialized and disconnected\\n\",\n\t\tKBUILD_MODNAME, drvname, devname);"], [1028, "kfree(devname);"]]
[ "CVE-2017-8064" ]
[ "CWE-119" ]
1
{ "Execution Environment": [ "CONFIG_VMAP_STACK" ], "Explanation": null, "External Function": [ "usb_get_intfdata", "dev_info" ], "Function Argument": [ "intf" ], "Globals": [ "KBUILD_MODNAME" ], "Type Execution Declaration": [ "struct dvb_usb_device", "struct device" ]...
2
linux
https://github.com/torvalds/linux
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cppcore.c
02e1a114fdb71e59ee6770294166c30d437bf86a
nfp: fix use-after-free in area_cache_get() area_cache_get() is used to distribute cache->area and set cache->id, and if cache->id is not 0 and cache->area->kref refcount is 0, it will release the cache->area by nfp_cpp_area_release(). area_cache_get() set cache->id before cpp->op->area_init() and nfp_cpp_area_acqu...
true
b09c47a4db6314a9ae2201fbee26ee43
area_cache_get
static struct nfp_cpp_area_cache * area_cache_get(struct nfp_cpp *cpp, u32 id, u64 addr, unsigned long *offset, size_t length) { struct nfp_cpp_area_cache *cache; int err; /* Early exit when length == 0, which prevents * the need for special case code below when * checking against available cache size. ...
[[877, "\tcache->id = id;\n"]]
[[877, "cache->id = id;"]]
[ "CVE-2022-3545" ]
[ "CWE-119" ]
3
{ "Execution Environment": [], "Explanation": null, "External Function": [ "nfp_cpp_area_release", "cpp->op->area_init", "nfp_cpp_area_acquire" ], "Function Argument": [], "Globals": [], "Type Execution Declaration": [] }
3
linux
https://github.com/torvalds/linux
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cppcore.c
02e1a114fdb71e59ee6770294166c30d437bf86a
nfp: fix use-after-free in area_cache_get() area_cache_get() is used to distribute cache->area and set cache->id, and if cache->id is not 0 and cache->area->kref refcount is 0, it will release the cache->area by nfp_cpp_area_release(). area_cache_get() set cache->id before cpp->op->area_init() and nfp_cpp_area_acqu...
false
6eb6e5761715e630d11c438f0e0f15e5
area_cache_get
static struct nfp_cpp_area_cache * area_cache_get(struct nfp_cpp *cpp, u32 id, u64 addr, unsigned long *offset, size_t length) { struct nfp_cpp_area_cache *cache; int err; /* Early exit when length == 0, which prevents * the need for special case code below when * checking against available cache size. ...
[[896, "\tcache->id = id;\n"], [897, "\n"]]
[[896, "cache->id = id;"], [897, "\n"]]
[ "CVE-2022-3545" ]
[ "CWE-119" ]
3
{ "Execution Environment": [], "Explanation": null, "External Function": [ "nfp_cpp_area_release", "cpp->op->area_init", "nfp_cpp_area_acquire" ], "Function Argument": [], "Globals": [], "Type Execution Declaration": [] }
4
linux
https://github.com/torvalds/linux
net/netfilter/ipvs/ip_vs_ctl.c
04bcef2a83f40c6db24222b27a52892cba39dffb
ipvs: Add boundary check on ioctl arguments The ipvs code has a nifty system for doing the size of ioctl command copies; it defines an array with values into which it indexes the cmd to find the right length. Unfortunately, the ipvs code forgot to check if the cmd was in the range that the array provides, allowing fo...
true
4142c8c9b956090ae535f2e0dfa2b660
do_ip_vs_get_ctl
static int do_ip_vs_get_ctl(struct sock *sk, int cmd, void __user *user, int *len) { unsigned char arg[128]; int ret = 0; if (!capable(CAP_NET_ADMIN)) return -EPERM; if (*len < get_arglen[GET_CMDID(cmd)]) { pr_err("get_ctl: len %u < %u\n", *len, get_arglen[GET_CMDID(cmd)]); return -EINVAL; } if ...
[[2365, "\tif (copy_from_user(arg, user, get_arglen[GET_CMDID(cmd)]) != 0)\n"]]
[[2365, "if (copy_from_user(arg, user, get_arglen[GET_CMDID(cmd)]) != 0)"]]
[ "CVE-2013-4588" ]
[ "CWE-119" ]
6
{ "Execution Environment": [], "Explanation": null, "External Function": [ "GET_CMDID" ], "Function Argument": [ "cmd" ], "Globals": [ "get_arglen" ], "Type Execution Declaration": [] }
5
linux
https://github.com/torvalds/linux
net/netfilter/ipvs/ip_vs_ctl.c
04bcef2a83f40c6db24222b27a52892cba39dffb
ipvs: Add boundary check on ioctl arguments The ipvs code has a nifty system for doing the size of ioctl command copies; it defines an array with values into which it indexes the cmd to find the right length. Unfortunately, the ipvs code forgot to check if the cmd was in the range that the array provides, allowing fo...
false
3952069a1f9b3d417354575f7e77abec
do_ip_vs_set_ctl
static int do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len) { int ret; unsigned char arg[MAX_ARG_LEN]; struct ip_vs_service_user *usvc_compat; struct ip_vs_service_user_kern usvc; struct ip_vs_service *svc; struct ip_vs_dest_user *udest_compat; struct ip_vs_dest_user_kern udest; ...
[[2080, "\tif (cmd < IP_VS_BASE_CTL || cmd > IP_VS_SO_SET_MAX)\n"], [2081, "\t\treturn -EINVAL;\n"], [2082, "\tif (len < 0 || len > MAX_ARG_LEN)\n"], [2083, "\t\treturn -EINVAL;\n"]]
[[2080, "if (cmd < IP_VS_BASE_CTL || cmd > IP_VS_SO_SET_MAX)"], [2081, "return -EINVAL;"], [2082, "if (len < 0 || len > MAX_ARG_LEN)"], [2083, "return -EINVAL;"]]
[ "CVE-2013-4588" ]
[ "CWE-119" ]
null
{ "Execution Environment": null, "Explanation": null, "External Function": null, "Function Argument": null, "Globals": null, "Type Execution Declaration": null }
6
linux
https://github.com/torvalds/linux
net/netfilter/ipvs/ip_vs_ctl.c
04bcef2a83f40c6db24222b27a52892cba39dffb
ipvs: Add boundary check on ioctl arguments The ipvs code has a nifty system for doing the size of ioctl command copies; it defines an array with values into which it indexes the cmd to find the right length. Unfortunately, the ipvs code forgot to check if the cmd was in the range that the array provides, allowing fo...
false
cb91c5bff7f5d1bc520dfb0a8a207efb
do_ip_vs_get_ctl
static int do_ip_vs_get_ctl(struct sock *sk, int cmd, void __user *user, int *len) { unsigned char arg[128]; int ret = 0; unsigned int copylen; if (!capable(CAP_NET_ADMIN)) return -EPERM; if (cmd < IP_VS_BASE_CTL || cmd > IP_VS_SO_GET_MAX) return -EINVAL; if (*len < get_arglen[GET_CMDID(cmd)]) { pr_err("...
[[2359, "\tunsigned int copylen;\n"], [2364, "\tif (cmd < IP_VS_BASE_CTL || cmd > IP_VS_SO_GET_MAX)\n"], [2365, "\t\treturn -EINVAL;\n"], [2366, "\n"], [2373, "\tcopylen = get_arglen[GET_CMDID(cmd)];\n"], [2374, "\tif (copylen > 128)\n"], [2375, "\t\treturn -EINVAL;\n"], [2376, "\n"], [2377, "\tif (copy_from_user(arg, ...
[[2359, "unsigned int copylen;"], [2364, "if (cmd < IP_VS_BASE_CTL || cmd > IP_VS_SO_GET_MAX)"], [2365, "return -EINVAL;"], [2366, "\n"], [2373, "copylen = get_arglen[GET_CMDID(cmd)];"], [2374, "if (copylen > 128)"], [2375, "return -EINVAL;"], [2376, "\n"], [2377, "if (copy_from_user(arg, user, copylen) != 0)"]]
[ "CVE-2013-4588" ]
[ "CWE-119" ]
6
{ "Execution Environment": [], "Explanation": null, "External Function": [ "GET_CMDID" ], "Function Argument": [ "cmd" ], "Globals": [ "get_arglen" ], "Type Execution Declaration": [] }
7
linux
https://github.com/torvalds/linux
drivers/vfio/pci/vfio_pci.c
05692d7005a364add85c6e25a6c4447ce08f913a
vfio/pci: Fix integer overflows, bitmask check The VFIO_DEVICE_SET_IRQS ioctl did not sufficiently sanitize user-supplied integers, potentially allowing memory corruption. This patch adds appropriate integer overflow checks, checks the range bounds for VFIO_IRQ_SET_DATA_NONE, and also verifies that only single element...
true
a049777f01d743bcf5935c70c207b35e
vfio_pci_ioctl
static long vfio_pci_ioctl(void *device_data, unsigned int cmd, unsigned long arg) { struct vfio_pci_device *vdev = device_data; unsigned long minsz; if (cmd == VFIO_DEVICE_GET_INFO) { struct vfio_device_info info; minsz = offsetofend(struct vfio_device_info, num_irqs); if (copy_from_user(&info, (void...
[[833, "\t\tint ret = 0;\n"], [845, "\t\tif (!(hdr.flags & VFIO_IRQ_SET_DATA_NONE)) {\n"], [846, "\t\t\tsize_t size;\n"], [847, "\t\t\tint max = vfio_pci_get_irq_count(vdev, hdr.index);\n"], [849, "\t\t\tif (hdr.flags & VFIO_IRQ_SET_DATA_BOOL)\n"], [850, "\t\t\t\tsize = sizeof(uint8_t);\n"], [851, "\t\t\telse if (hdr.f...
[[833, "int ret = 0;"], [845, "if (!(hdr.flags & VFIO_IRQ_SET_DATA_NONE))"], [846, "size_t size;"], [847, "int max = vfio_pci_get_irq_count(vdev, hdr.index);"], [849, "if (hdr.flags & VFIO_IRQ_SET_DATA_BOOL)"], [850, "size = sizeof(uint8_t);"], [851, "else if (hdr.flags & VFIO_IRQ_SET_DATA_EVENTFD)"], [852, "size = siz...
[ "CVE-2016-9083", "CVE-2016-9084" ]
[ "CWE-190", "CWE-119" ]
8
{ "Execution Environment": [], "Explanation": null, "External Function": [ "vfio_pci_get_irq_count" ], "Function Argument": [ "device_data", "cmd", "arg" ], "Globals": [ "VFIO_IRQ_SET_DATA_NONE", "VFIO_IRQ_SET_DATA_BOOL", "VFIO_IRQ_SET_DATA_EVENTFD", "VFIO_IRQ_SET_DATA_TYPE...
8
linux
https://github.com/torvalds/linux
drivers/vfio/pci/vfio_pci.c
05692d7005a364add85c6e25a6c4447ce08f913a
vfio/pci: Fix integer overflows, bitmask check The VFIO_DEVICE_SET_IRQS ioctl did not sufficiently sanitize user-supplied integers, potentially allowing memory corruption. This patch adds appropriate integer overflow checks, checks the range bounds for VFIO_IRQ_SET_DATA_NONE, and also verifies that only single element...
false
a868d284be988ce6b14e3074a510fdcf
vfio_pci_ioctl
static long vfio_pci_ioctl(void *device_data, unsigned int cmd, unsigned long arg) { struct vfio_pci_device *vdev = device_data; unsigned long minsz; if (cmd == VFIO_DEVICE_GET_INFO) { struct vfio_device_info info; minsz = offsetofend(struct vfio_device_info, num_irqs); if (copy_from_user(&info, (void...
[[832, "\t\tsize_t size;\n"], [834, "\t\tint max, ret = 0;\n"], [842, "\t\t hdr.count >= (U32_MAX - hdr.start) ||\n"], [847, "\t\tmax = vfio_pci_get_irq_count(vdev, hdr.index);\n"], [848, "\t\tif (hdr.start >= max || hdr.start + hdr.count > max)\n"], [849, "\t\t\treturn -EINVAL;\n"], [851, "\t\tswitch (hdr.flags & V...
[[832, "size_t size;"], [834, "int max, ret = 0;"], [841, "if (hdr.argsz < minsz || hdr.index >= VFIO_PCI_NUM_IRQS ||\n\t\t hdr.count >= (U32_MAX - hdr.start) ||\n\t\t hdr.flags & ~(VFIO_IRQ_SET_DATA_TYPE_MASK |\n\t\t\t\t VFIO_IRQ_SET_ACTION_TYPE_MASK))"], [847, "max = vfio_pci_get_irq_count(vdev, hdr.index);"],...
[ "CVE-2016-9083", "CVE-2016-9084" ]
[ "CWE-190", "CWE-119" ]
8
{ "Execution Environment": [], "Explanation": null, "External Function": [ "vfio_pci_get_irq_count" ], "Function Argument": [ "device_data", "cmd", "arg" ], "Globals": [ "VFIO_IRQ_SET_DATA_NONE", "VFIO_IRQ_SET_DATA_BOOL", "VFIO_IRQ_SET_DATA_EVENTFD", "VFIO_IRQ_SET_DATA_TYPE...
9
linux
https://github.com/torvalds/linux
drivers/vfio/pci/vfio_pci_intrs.c
05692d7005a364add85c6e25a6c4447ce08f913a
vfio/pci: Fix integer overflows, bitmask check The VFIO_DEVICE_SET_IRQS ioctl did not sufficiently sanitize user-supplied integers, potentially allowing memory corruption. This patch adds appropriate integer overflow checks, checks the range bounds for VFIO_IRQ_SET_DATA_NONE, and also verifies that only single element...
true
4e082208eaeda7cf04e95dca1377d293
vfio_msi_enable
static int vfio_msi_enable(struct vfio_pci_device *vdev, int nvec, bool msix) { struct pci_dev *pdev = vdev->pdev; unsigned int flag = msix ? PCI_IRQ_MSIX : PCI_IRQ_MSI; int ret; if (!is_irq_none(vdev)) return -EINVAL; vdev->ctx = kzalloc(nvec * sizeof(struct vfio_pci_irq_ctx), GFP_KERNEL); if (!vdev->ctx) ...
[[259, "\tvdev->ctx = kzalloc(nvec * sizeof(struct vfio_pci_irq_ctx), GFP_KERNEL);\n"]]
[[259, "vdev->ctx = kzalloc(nvec * sizeof(struct vfio_pci_irq_ctx), GFP_KERNEL);"]]
[ "CVE-2016-9083", "CVE-2016-9084" ]
[ "CWE-190", "CWE-119" ]
10
{ "Execution Environment": [], "Explanation": null, "External Function": [], "Function Argument": [ "nvec" ], "Globals": [], "Type Execution Declaration": [] }
10
linux
https://github.com/torvalds/linux
drivers/vfio/pci/vfio_pci_intrs.c
05692d7005a364add85c6e25a6c4447ce08f913a
vfio/pci: Fix integer overflows, bitmask check The VFIO_DEVICE_SET_IRQS ioctl did not sufficiently sanitize user-supplied integers, potentially allowing memory corruption. This patch adds appropriate integer overflow checks, checks the range bounds for VFIO_IRQ_SET_DATA_NONE, and also verifies that only single element...
false
7e49e89feb2e97fdd27fd1dc9883d202
vfio_msi_enable
static int vfio_msi_enable(struct vfio_pci_device *vdev, int nvec, bool msix) { struct pci_dev *pdev = vdev->pdev; unsigned int flag = msix ? PCI_IRQ_MSIX : PCI_IRQ_MSI; int ret; if (!is_irq_none(vdev)) return -EINVAL; vdev->ctx = kcalloc(nvec, sizeof(struct vfio_pci_irq_ctx), GFP_KERNEL); if (!vdev->ctx) r...
[[259, "\tvdev->ctx = kcalloc(nvec, sizeof(struct vfio_pci_irq_ctx), GFP_KERNEL);\n"]]
[[259, "vdev->ctx = kcalloc(nvec, sizeof(struct vfio_pci_irq_ctx), GFP_KERNEL);"]]
[ "CVE-2016-9083", "CVE-2016-9084" ]
[ "CWE-190", "CWE-119" ]
10
{ "Execution Environment": [], "Explanation": null, "External Function": [], "Function Argument": [ "nvec" ], "Globals": [], "Type Execution Declaration": [] }
11
linux
https://github.com/torvalds/linux
drivers/infiniband/hw/mlx5/qp.c
0625b4ba1a5d4703c7fb01c497bd6c156908af00
IB/mlx5: Fix leaking stack memory to userspace mlx5_ib_create_qp_resp was never initialized and only the first 4 bytes were written. Fixes: 41d902cb7c32 ("RDMA/mlx5: Fix definition of mlx5_ib_create_qp_resp") Cc: <stable@vger.kernel.org> Acked-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <...
true
4f14403d1b00e2825b924f7bae6f799d
create_qp_common
static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd, struct ib_qp_init_attr *init_attr, struct ib_udata *udata, struct mlx5_ib_qp *qp) { struct mlx5_ib_resources *devr = &dev->devr; int inlen = MLX5_ST_SZ_BYTES(create_qp_in); struct mlx5_core_dev *mdev = dev->mdev; struct mlx5_ib_cre...
[[1610, "\tstruct mlx5_ib_create_qp_resp resp;\n"]]
[[1610, "struct mlx5_ib_create_qp_resp resp;"]]
[ "CVE-2018-20855" ]
[ "CWE-119" ]
12
{ "Execution Environment": [], "Explanation": null, "External Function": [], "Function Argument": [], "Globals": [], "Type Execution Declaration": [ "struct mlx5_ib_create_qp_resp" ] }
12
linux
https://github.com/torvalds/linux
drivers/infiniband/hw/mlx5/qp.c
0625b4ba1a5d4703c7fb01c497bd6c156908af00
IB/mlx5: Fix leaking stack memory to userspace mlx5_ib_create_qp_resp was never initialized and only the first 4 bytes were written. Fixes: 41d902cb7c32 ("RDMA/mlx5: Fix definition of mlx5_ib_create_qp_resp") Cc: <stable@vger.kernel.org> Acked-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <...
false
0e311cfeb93cc5603699cbf680d9734f
create_qp_common
static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd, struct ib_qp_init_attr *init_attr, struct ib_udata *udata, struct mlx5_ib_qp *qp) { struct mlx5_ib_resources *devr = &dev->devr; int inlen = MLX5_ST_SZ_BYTES(create_qp_in); struct mlx5_core_dev *mdev = dev->mdev; struct mlx5_ib_cre...
[[1610, "\tstruct mlx5_ib_create_qp_resp resp = {};\n"]]
[[1610, "struct mlx5_ib_create_qp_resp resp = {};"]]
[ "CVE-2018-20855" ]
[ "CWE-119" ]
12
{ "Execution Environment": [], "Explanation": null, "External Function": [], "Function Argument": [], "Globals": [], "Type Execution Declaration": [ "struct mlx5_ib_create_qp_resp" ] }
13
linux
https://github.com/torvalds/linux
fs/cifs/smbencrypt.c
06deeec77a5a689cc94b21a8a91a76e42176685d
cifs: Fix smbencrypt() to stop pointing a scatterlist at the stack smbencrypt() points a scatterlist to the stack, which is breaks if CONFIG_VMAP_STACK=y. Fix it by switching to crypto_cipher_encrypt_one(). The new code should be considerably faster as an added benefit. This code is nearly identical to some code th...
true
a89228b9e70e6c1f4dc50bcf2932a2f1
smbhash
static int smbhash(unsigned char *out, const unsigned char *in, unsigned char *key) { int rc; unsigned char key2[8]; struct crypto_skcipher *tfm_des; struct scatterlist sgin, sgout; struct skcipher_request *req; str_to_key(key, key2); tfm_des = crypto_alloc_skcipher("ecb(des)", 0, CRYPTO_ALG_ASYNC); if (IS_ER...
[[72, "\tint rc;\n"], [74, "\tstruct crypto_skcipher *tfm_des;\n"], [75, "\tstruct scatterlist sgin, sgout;\n"], [76, "\tstruct skcipher_request *req;\n"], [80, "\ttfm_des = crypto_alloc_skcipher(\"ecb(des)\", 0, CRYPTO_ALG_ASYNC);\n"], [82, "\t\trc = PTR_ERR(tfm_des);\n"], [83, "\t\tcifs_dbg(VFS, \"could not allocate ...
[[72, "int rc;"], [74, "struct crypto_skcipher *tfm_des;"], [75, "struct scatterlist sgin, sgout;"], [76, "struct skcipher_request *req;"], [80, "tfm_des = crypto_alloc_skcipher(\"ecb(des)\", 0, CRYPTO_ALG_ASYNC);"], [82, "rc = PTR_ERR(tfm_des);"], [83, "cifs_dbg(VFS, \"could not allocate des crypto API\\n\");"], [84, ...
[ "CVE-2016-10154" ]
[ "CWE-119" ]
14
{ "Execution Environment": [ "CONFIG_VMAP_STACK" ], "Explanation": null, "External Function": [ "sg_init_one" ], "Function Argument": [], "Globals": [], "Type Execution Declaration": [] }
14
linux
https://github.com/torvalds/linux
fs/cifs/smbencrypt.c
06deeec77a5a689cc94b21a8a91a76e42176685d
cifs: Fix smbencrypt() to stop pointing a scatterlist at the stack smbencrypt() points a scatterlist to the stack, which is breaks if CONFIG_VMAP_STACK=y. Fix it by switching to crypto_cipher_encrypt_one(). The new code should be considerably faster as an added benefit. This code is nearly identical to some code th...
false
e8cc2fd6bec0fed306d2adce2c782f6f
smbhash
static int smbhash(unsigned char *out, const unsigned char *in, unsigned char *key) { unsigned char key2[8]; struct crypto_cipher *tfm_des; str_to_key(key, key2); tfm_des = crypto_alloc_cipher("des", 0, 0); if (IS_ERR(tfm_des)) { cifs_dbg(VFS, "could not allocate des crypto API\n"); return PTR_ERR(tfm_des); ...
[[73, "\tstruct crypto_cipher *tfm_des;\n"], [77, "\ttfm_des = crypto_alloc_cipher(\"des\", 0, 0);\n"], [80, "\t\treturn PTR_ERR(tfm_des);\n"], [83, "\tcrypto_cipher_setkey(tfm_des, key2, 8);\n"], [84, "\tcrypto_cipher_encrypt_one(tfm_des, out, in);\n"], [85, "\tcrypto_free_cipher(tfm_des);\n"], [87, "\treturn 0;\n"]]
[[73, "struct crypto_cipher *tfm_des;"], [77, "tfm_des = crypto_alloc_cipher(\"des\", 0, 0);"], [80, "return PTR_ERR(tfm_des);"], [83, "crypto_cipher_setkey(tfm_des, key2, 8);"], [84, "crypto_cipher_encrypt_one(tfm_des, out, in);"], [85, "crypto_free_cipher(tfm_des);"], [87, "return 0;"]]
[ "CVE-2016-10154" ]
[ "CWE-119" ]
14
{ "Execution Environment": [ "CONFIG_VMAP_STACK" ], "Explanation": null, "External Function": [ "sg_init_one" ], "Function Argument": [], "Globals": [], "Type Execution Declaration": [] }
15
linux
https://github.com/torvalds/linux
drivers/net/mlx4/port.c
0926f91083f34d047abc74f1ca4fa6a9c161f7db
mlx4_en: Fix out of bounds array access When searching for a free entry in either mlx4_register_vlan() or mlx4_register_mac(), and there is no free entry, the loop terminates without updating the local variable free thus causing out of array bounds access. Fix this by adding a proper check outside the loop. Signed-of...
true
0bb0fd17cb0d592e6c0241114adba3b5
mlx4_register_mac
int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *index) { struct mlx4_mac_table *table = &mlx4_priv(dev)->port[port].mac_table; int i, err = 0; int free = -1; mlx4_dbg(dev, "Registering MAC: 0x%llx\n", (unsigned long long) mac); mutex_lock(&table->mutex); for (i = 0; i < MLX4_MAX_MAC_NUM - 1; i...
[]
[]
[ "CVE-2010-5332" ]
[ "CWE-119" ]
17
{ "Execution Environment": [], "Explanation": null, "External Function": [ "mlx4_priv" ], "Function Argument": [ "dev", "port" ], "Globals": [ "MLX4_MAX_MAC_NUM" ], "Type Execution Declaration": [] }
16
linux
https://github.com/torvalds/linux
drivers/net/mlx4/port.c
0926f91083f34d047abc74f1ca4fa6a9c161f7db
mlx4_en: Fix out of bounds array access When searching for a free entry in either mlx4_register_vlan() or mlx4_register_mac(), and there is no free entry, the loop terminates without updating the local variable free thus causing out of array bounds access. Fix this by adding a proper check outside the loop. Signed-of...
true
b34d08283adbc51bc2a8ac9fef1d47d8
mlx4_register_vlan
int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index) { struct mlx4_vlan_table *table = &mlx4_priv(dev)->port[port].vlan_table; int i, err = 0; int free = -1; mutex_lock(&table->mutex); for (i = MLX4_VLAN_REGULAR; i < MLX4_MAX_VLAN_NUM; i++) { if (free < 0 && (table->refs[i] == 0)) { fr...
[]
[]
[ "CVE-2010-5332" ]
[ "CWE-119" ]
18
{ "Execution Environment": [], "Explanation": null, "External Function": [ "mlx4_priv", "be32_to_cpu", "cpu_to_be32", "mlx4_set_port_vlan_table", "mlx4_warn" ], "Function Argument": [ "dev", "port", "vlan", "index" ], "Globals": [ "MLX4_VLAN_REGULAR", "MLX4_MAX_...
17
linux
https://github.com/torvalds/linux
drivers/net/mlx4/port.c
0926f91083f34d047abc74f1ca4fa6a9c161f7db
mlx4_en: Fix out of bounds array access When searching for a free entry in either mlx4_register_vlan() or mlx4_register_mac(), and there is no free entry, the loop terminates without updating the local variable free thus causing out of array bounds access. Fix this by adding a proper check outside the loop. Signed-of...
false
5e384db2b5bcf28504943915f4e0feff
mlx4_register_mac
int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *index) { struct mlx4_mac_table *table = &mlx4_priv(dev)->port[port].mac_table; int i, err = 0; int free = -1; mlx4_dbg(dev, "Registering MAC: 0x%llx\n", (unsigned long long) mac); mutex_lock(&table->mutex); for (i = 0; i < MLX4_MAX_MAC_NUM - 1; i...
[[114, "\n"], [115, "\tif (free < 0) {\n"], [116, "\t\terr = -ENOMEM;\n"], [117, "\t\tgoto out;\n"], [118, "\t}\n"], [119, "\n"]]
[[114, "\n"], [115, "if (free < 0)"], [116, "err = -ENOMEM;"], [117, "goto out;"], [118, "\t}\n"], [119, "\n"]]
[ "CVE-2010-5332" ]
[ "CWE-119" ]
17
{ "Execution Environment": [], "Explanation": null, "External Function": [ "mlx4_priv" ], "Function Argument": [ "dev", "port" ], "Globals": [ "MLX4_MAX_MAC_NUM" ], "Type Execution Declaration": [] }
18
linux
https://github.com/torvalds/linux
drivers/net/mlx4/port.c
0926f91083f34d047abc74f1ca4fa6a9c161f7db
mlx4_en: Fix out of bounds array access When searching for a free entry in either mlx4_register_vlan() or mlx4_register_mac(), and there is no free entry, the loop terminates without updating the local variable free thus causing out of array bounds access. Fix this by adding a proper check outside the loop. Signed-of...
false
d2d908a7f0431e5675baba44caaafa0c
mlx4_register_vlan
int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index) { struct mlx4_vlan_table *table = &mlx4_priv(dev)->port[port].vlan_table; int i, err = 0; int free = -1; mutex_lock(&table->mutex); for (i = MLX4_VLAN_REGULAR; i < MLX4_MAX_VLAN_NUM; i++) { if (free < 0 && (table->refs[i] == 0)) { fr...
[[214, "\tif (free < 0) {\n"], [215, "\t\terr = -ENOMEM;\n"], [216, "\t\tgoto out;\n"], [217, "\t}\n"], [218, "\n"]]
[[214, "if (free < 0)"], [215, "err = -ENOMEM;"], [216, "goto out;"], [217, "\t}\n"], [218, "\n"]]
[ "CVE-2010-5332" ]
[ "CWE-119" ]
18
{ "Execution Environment": [], "Explanation": null, "External Function": [ "mlx4_priv", "be32_to_cpu", "cpu_to_be32", "mlx4_set_port_vlan_table", "mlx4_warn" ], "Function Argument": [ "dev", "port", "vlan", "index" ], "Globals": [ "MLX4_VLAN_REGULAR", "MLX4_MAX_...
19
linux
https://github.com/torvalds/linux
drivers/nvme/target/fc.c
0c319d3a144d4b8f1ea2047fd614d2149b68f889
nvmet-fc: ensure target queue id within range. When searching for queue id's ensure they are within the expected range. Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
true
c05ae774ee57b0ad442f8c36f38916df
nvmet_fc_find_target_queue
static struct nvmet_fc_tgt_queue * nvmet_fc_find_target_queue(struct nvmet_fc_tgtport *tgtport, u64 connection_id) { struct nvmet_fc_tgt_assoc *assoc; struct nvmet_fc_tgt_queue *queue; u64 association_id = nvmet_fc_getassociationid(connection_id); u16 qid = nvmet_fc_getqueueid(connection_id); unsigned long fla...
[]
[]
[ "CVE-2017-18379" ]
[ "CWE-119" ]
20
{ "Execution Environment": [], "Explanation": null, "External Function": [ "nvmet_fc_getqueueid" ], "Function Argument": [], "Globals": [ "NVMET_NR_QUEUES" ], "Type Execution Declaration": [ "struct nvmet_fc_tgt_assoc", "struct nvmet_fc_tgt_queue" ] }
20
linux
https://github.com/torvalds/linux
drivers/nvme/target/fc.c
0c319d3a144d4b8f1ea2047fd614d2149b68f889
nvmet-fc: ensure target queue id within range. When searching for queue id's ensure they are within the expected range. Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
false
ae5fb548fe28f4fb4cdb0151e82cf8e2
nvmet_fc_find_target_queue
static struct nvmet_fc_tgt_queue * nvmet_fc_find_target_queue(struct nvmet_fc_tgtport *tgtport, u64 connection_id) { struct nvmet_fc_tgt_assoc *assoc; struct nvmet_fc_tgt_queue *queue; u64 association_id = nvmet_fc_getassociationid(connection_id); u16 qid = nvmet_fc_getqueueid(connection_id); unsigned long fla...
[[786, "\tif (qid > NVMET_NR_QUEUES)\n"], [787, "\t\treturn NULL;\n"], [788, "\n"]]
[[786, "if (qid > NVMET_NR_QUEUES)"], [787, "return NULL;"], [788, "\n"]]
[ "CVE-2017-18379" ]
[ "CWE-119" ]
20
{ "Execution Environment": [], "Explanation": null, "External Function": [ "nvmet_fc_getqueueid" ], "Function Argument": [], "Globals": [ "NVMET_NR_QUEUES" ], "Type Execution Declaration": [ "struct nvmet_fc_tgt_assoc", "struct nvmet_fc_tgt_queue" ] }
21
linux
https://github.com/torvalds/linux
fs/ioctl.c
10eec60ce79187686e052092e5383c99b4420a20
vfs: ioctl: prevent double-fetch in dedupe ioctl This prevents a double-fetch from user space that can lead to to an undersized allocation and heap overflow. Fixes: 54dbc1517237 ("vfs: hoist the btrfs deduplication ioctl to the vfs") Signed-off-by: Scott Bauer <sbauer@plzdonthack.me> Signed-off-by: Linus Torvalds <to...
true
88ed0b07f2f93f508fcb10ea0454b747
ioctl_file_dedupe_range
static long ioctl_file_dedupe_range(struct file *file, void __user *arg) { struct file_dedupe_range __user *argp = arg; struct file_dedupe_range *same = NULL; int ret; unsigned long size; u16 count; if (get_user(count, &argp->dest_count)) { ret = -EFAULT; goto out; } size = offsetof(struct file_dedupe_ran...
[]
[]
[ "CVE-2016-6516" ]
[ "CWE-362", "CWE-119" ]
22
{ "Execution Environment": [], "Explanation": null, "External Function": [ "get_user", "memdup_user", "copy_to_user" ], "Function Argument": [ "arg" ], "Globals": [], "Type Execution Declaration": [ "struct file_dedupe_range __user", "struct file_dedupe_range" ] }
22
linux
https://github.com/torvalds/linux
fs/ioctl.c
10eec60ce79187686e052092e5383c99b4420a20
vfs: ioctl: prevent double-fetch in dedupe ioctl This prevents a double-fetch from user space that can lead to to an undersized allocation and heap overflow. Fixes: 54dbc1517237 ("vfs: hoist the btrfs deduplication ioctl to the vfs") Signed-off-by: Scott Bauer <sbauer@plzdonthack.me> Signed-off-by: Linus Torvalds <to...
false
ad737bed6069921506d9ce434712bad7
ioctl_file_dedupe_range
static long ioctl_file_dedupe_range(struct file *file, void __user *arg) { struct file_dedupe_range __user *argp = arg; struct file_dedupe_range *same = NULL; int ret; unsigned long size; u16 count; if (get_user(count, &argp->dest_count)) { ret = -EFAULT; goto out; } size = offsetof(struct file_dedupe_ran...
[[593, "\tsame->dest_count = count;\n"]]
[[593, "same->dest_count = count;"]]
[ "CVE-2016-6516" ]
[ "CWE-362", "CWE-119" ]
22
{ "Execution Environment": [], "Explanation": null, "External Function": [ "get_user", "memdup_user", "copy_to_user" ], "Function Argument": [ "arg" ], "Globals": [], "Type Execution Declaration": [ "struct file_dedupe_range __user", "struct file_dedupe_range" ] }
23
linux
https://github.com/torvalds/linux
drivers/net/ethernet/sunplus/spl2sw_driver.c
12aece8b01507a2d357a1861f470e83621fbb6f2
eth: sp7021: fix use after free bug in spl2sw_nvmem_get_mac_address This frees "mac" and tries to display its address as part of the error message on the next line. Swap the order. Fixes: fd3040b9394c ("net: ethernet: Add driver for Sunplus SP7021") Signed-off-by: Zheng Wang <zyytlz.wz@163.com> Signed-off-by: David ...
true
edf98bb67e48bc2765e89283212bb2a6
spl2sw_nvmem_get_mac_address
static int spl2sw_nvmem_get_mac_address(struct device *dev, struct device_node *np, void *addrbuf) { struct nvmem_cell *cell; ssize_t len; u8 *mac; /* Get nvmem cell of mac-address from dts. */ cell = of_nvmem_cell_get(np, "mac-address"); if (IS_ERR(cell)) return PTR_ERR(cell); /* Read mac address from ...
[[251, "\t\tkfree(mac);\n"]]
[[251, "kfree(mac);"]]
[ "CVE-2022-3541" ]
[ "CWE-119" ]
24
{ "Execution Environment": [], "Explanation": null, "External Function": [ "of_nvmem_cell_get", "nvmem_cell_read", "nvmem_cell_put", "is_valid_ether_addr", "dev_info" ], "Function Argument": [], "Globals": [], "Type Execution Declaration": [] }
24
linux
https://github.com/torvalds/linux
drivers/net/ethernet/sunplus/spl2sw_driver.c
12aece8b01507a2d357a1861f470e83621fbb6f2
eth: sp7021: fix use after free bug in spl2sw_nvmem_get_mac_address This frees "mac" and tries to display its address as part of the error message on the next line. Swap the order. Fixes: fd3040b9394c ("net: ethernet: Add driver for Sunplus SP7021") Signed-off-by: Zheng Wang <zyytlz.wz@163.com> Signed-off-by: David ...
false
b9422cbb5d31e8e69bf752bd7a6c6ed5
spl2sw_nvmem_get_mac_address
static int spl2sw_nvmem_get_mac_address(struct device *dev, struct device_node *np, void *addrbuf) { struct nvmem_cell *cell; ssize_t len; u8 *mac; /* Get nvmem cell of mac-address from dts. */ cell = of_nvmem_cell_get(np, "mac-address"); if (IS_ERR(cell)) return PTR_ERR(cell); /* Read mac address from ...
[[252, "\t\tkfree(mac);\n"]]
[[252, "kfree(mac);"]]
[ "CVE-2022-3541" ]
[ "CWE-119" ]
24
{ "Execution Environment": [], "Explanation": null, "External Function": [ "of_nvmem_cell_get", "nvmem_cell_read", "nvmem_cell_put", "is_valid_ether_addr", "dev_info" ], "Function Argument": [], "Globals": [], "Type Execution Declaration": [] }
25
linux
https://github.com/torvalds/linux
drivers/target/loopback/tcm_loop.c
12f09ccb4612734a53e47ed5302e0479c10a50f8
loopback: off by one in tcm_loop_make_naa_tpg() This is an off by one 'tgpt' check in tcm_loop_make_naa_tpg() that could result in memory corruption. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
true
bb10218e4db9527815edd9343f459cff
tcm_loop_make_naa_tpg
struct se_portal_group *tcm_loop_make_naa_tpg( struct se_wwn *wwn, struct config_group *group, const char *name) { struct tcm_loop_hba *tl_hba = container_of(wwn, struct tcm_loop_hba, tl_hba_wwn); struct tcm_loop_tpg *tl_tpg; char *tpgt_str, *end_ptr; int ret; unsigned short int tpgt; tpgt_str = strstr(nam...
[[1208, "\tif (tpgt > TL_TPGS_PER_HBA) {\n"]]
[[1208, "if (tpgt > TL_TPGS_PER_HBA)"]]
[ "CVE-2011-5327" ]
[ "CWE-119" ]
26
{ "Execution Environment": [], "Explanation": null, "External Function": [], "Function Argument": [], "Globals": [ "TL_TPGS_PER_HBA" ], "Type Execution Declaration": [ "struct tcm_loop_hba", "struct tcm_loop_tpg" ] }
26
linux
https://github.com/torvalds/linux
drivers/target/loopback/tcm_loop.c
12f09ccb4612734a53e47ed5302e0479c10a50f8
loopback: off by one in tcm_loop_make_naa_tpg() This is an off by one 'tgpt' check in tcm_loop_make_naa_tpg() that could result in memory corruption. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
false
ba9488c551927f9c924adb9bcb8fce29
tcm_loop_make_naa_tpg
struct se_portal_group *tcm_loop_make_naa_tpg( struct se_wwn *wwn, struct config_group *group, const char *name) { struct tcm_loop_hba *tl_hba = container_of(wwn, struct tcm_loop_hba, tl_hba_wwn); struct tcm_loop_tpg *tl_tpg; char *tpgt_str, *end_ptr; int ret; unsigned short int tpgt; tpgt_str = strstr(nam...
[[1208, "\tif (tpgt >= TL_TPGS_PER_HBA) {\n"]]
[[1208, "if (tpgt >= TL_TPGS_PER_HBA)"]]
[ "CVE-2011-5327" ]
[ "CWE-119" ]
26
{ "Execution Environment": [], "Explanation": null, "External Function": [], "Function Argument": [], "Globals": [ "TL_TPGS_PER_HBA" ], "Type Execution Declaration": [ "struct tcm_loop_hba", "struct tcm_loop_tpg" ] }
27
linux
https://github.com/torvalds/linux
fs/nfsd/nfsxdr.c
13bf9fbff0e5e099e2b6f003a0ab8ae145436309
nfsd: stricter decoding of write-like NFSv2/v3 ops The NFSv2/v3 code does not systematically check whether we decode past the end of the buffer. This generally appears to be harmless, but there are a few places where we do arithmetic on the pointers involved and don't account for the possibility that a length could b...
true
312254bef4649bf3181c0060b93bc490
nfssvc_decode_writeargs
int nfssvc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd_writeargs *args) { unsigned int len, hdr, dlen; struct kvec *head = rqstp->rq_arg.head; int v; p = decode_fh(p, &args->fh); if (!p) return 0; p++; /* beginoffset */ args->offset = ntohl(*p++); /* offset */ p++; /* totalcou...
[]
[]
[ "CVE-2017-7895" ]
[ "CWE-119" ]
28
{ "Execution Environment": [], "Explanation": null, "External Function": [ "decode_fh", "page_address" ], "Function Argument": [ "rqstp" ], "Globals": [ "NFSSVC_MAXBLKSIZE_V2", "PAGE_SIZE", "XDR_QUADLEN" ], "Type Execution Declaration": [] }
28
linux
https://github.com/torvalds/linux
fs/nfsd/nfsxdr.c
13bf9fbff0e5e099e2b6f003a0ab8ae145436309
nfsd: stricter decoding of write-like NFSv2/v3 ops The NFSv2/v3 code does not systematically check whether we decode past the end of the buffer. This generally appears to be harmless, but there are a few places where we do arithmetic on the pointers involved and don't account for the possibility that a length could b...
false
e0616d42a55dbbc6ea9361716131ed66
nfssvc_decode_writeargs
int nfssvc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd_writeargs *args) { unsigned int len, hdr, dlen; struct kvec *head = rqstp->rq_arg.head; int v; p = decode_fh(p, &args->fh); if (!p) return 0; p++; /* beginoffset */ args->offset = ntohl(*p++); /* offset */ p++; /* totalcou...
[[305, "\tif (hdr > head->iov_len)\n"], [306, "\t\treturn 0;\n"]]
[[305, "if (hdr > head->iov_len)"], [306, "return 0;"]]
[ "CVE-2017-7895" ]
[ "CWE-119" ]
28
{ "Execution Environment": [], "Explanation": null, "External Function": [ "decode_fh", "page_address" ], "Function Argument": [ "rqstp" ], "Globals": [ "NFSSVC_MAXBLKSIZE_V2", "PAGE_SIZE", "XDR_QUADLEN" ], "Type Execution Declaration": [] }
29
linux
https://github.com/torvalds/linux
fs/jbd2/transaction.c
15291164b22a357cb211b618adfef4fa82fc0de3
jbd2: clear BH_Delay & BH_Unwritten in journal_unmap_buffer journal_unmap_buffer()'s zap_buffer: code clears a lot of buffer head state ala discard_buffer(), but does not touch _Delay or _Unwritten as discard_buffer() does. This can be problematic in some areas of the ext4 code which assume that if they have found a ...
true
1708a3552db849780aa5aa7df12f8b7a
journal_unmap_buffer
static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh) { transaction_t *transaction; struct journal_head *jh; int may_free = 1; int ret; BUFFER_TRACE(bh, "entry"); /* * It is safe to proceed here without the j_list_lock because the * buffers cannot be stolen by try_to_free_buffers as lo...
[]
[]
[ "CVE-2011-4086" ]
[ "CWE-119" ]
30
{ "Execution Environment": [ "the ext4 filesystem must be mounted with a journal" ], "Explanation": null, "External Function": [], "Function Argument": [], "Globals": [], "Type Execution Declaration": [] }
30
linux
https://github.com/torvalds/linux
fs/jbd2/transaction.c
15291164b22a357cb211b618adfef4fa82fc0de3
jbd2: clear BH_Delay & BH_Unwritten in journal_unmap_buffer journal_unmap_buffer()'s zap_buffer: code clears a lot of buffer head state ala discard_buffer(), but does not touch _Delay or _Unwritten as discard_buffer() does. This can be problematic in some areas of the ext4 code which assume that if they have found a ...
false
e85e99d5d65ba40f87a83bf83e2677ee
journal_unmap_buffer
static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh) { transaction_t *transaction; struct journal_head *jh; int may_free = 1; int ret; BUFFER_TRACE(bh, "entry"); /* * It is safe to proceed here without the j_list_lock because the * buffers cannot be stolen by try_to_free_buffers as lo...
[[1952, "\tclear_buffer_delay(bh);\n"], [1953, "\tclear_buffer_unwritten(bh);\n"]]
[[1952, "clear_buffer_delay(bh);"], [1953, "clear_buffer_unwritten(bh);"]]
[ "CVE-2011-4086" ]
[ "CWE-119" ]
30
{ "Execution Environment": [ "the ext4 filesystem must be mounted with a journal" ], "Explanation": null, "External Function": [], "Function Argument": [], "Globals": [], "Type Execution Declaration": [] }
31
linux
https://github.com/torvalds/linux
mm/memory.c
16ce101db85db694a91380aa4c89b25530871d33
mm/memory.c: fix race when faulting a device private page Patch series "Fix several device private page reference counting issues", v2 This series aims to fix a number of page reference counting issues in drivers dealing with device private ZONE_DEVICE pages. These result in use-after-free type bugs, either from acc...
true
6c3324ccd98e2b9019df7554fdfc4e67
do_swap_page
vm_fault_t do_swap_page(struct vm_fault *vmf) { struct vm_area_struct *vma = vmf->vma; struct folio *swapcache, *folio = NULL; struct page *page; struct swap_info_struct *si = NULL; rmap_t rmap_flags = RMAP_NONE; bool exclusive = false; swp_entry_t entry; pte_t pte; int locked; vm_fault_t ret = 0; void *shad...
[[3753, "\t\t\tret = vmf->page->pgmap->ops->migrate_to_ram(vmf);\n"]]
[[3753, "ret = vmf->page->pgmap->ops->migrate_to_ram(vmf);"]]
[ "CVE-2022-3523" ]
[ "CWE-416", "CWE-119" ]
32
{ "Execution Environment": [], "Explanation": null, "External Function": [ "vmf->page->pgmap->ops->migrate_to_ram" ], "Function Argument": [], "Globals": [], "Type Execution Declaration": [ "struct vm_fault", "struct page", "struct dev_pagemap_ops" ] }
32
linux
https://github.com/torvalds/linux
mm/memory.c
16ce101db85db694a91380aa4c89b25530871d33
mm/memory.c: fix race when faulting a device private page Patch series "Fix several device private page reference counting issues", v2 This series aims to fix a number of page reference counting issues in drivers dealing with device private ZONE_DEVICE pages. These result in use-after-free type bugs, either from acc...
false
b2a6dcd0780f4ef35d80208cafe62d51
do_swap_page
vm_fault_t do_swap_page(struct vm_fault *vmf) { struct vm_area_struct *vma = vmf->vma; struct folio *swapcache, *folio = NULL; struct page *page; struct swap_info_struct *si = NULL; rmap_t rmap_flags = RMAP_NONE; bool exclusive = false; swp_entry_t entry; pte_t pte; int locked; vm_fault_t ret = 0; void *shad...
[[3753, "\t\t\tvmf->pte = pte_offset_map_lock(vma->vm_mm, vmf->pmd,\n"], [3754, "\t\t\t\t\tvmf->address, &vmf->ptl);\n"], [3755, "\t\t\tif (unlikely(!pte_same(*vmf->pte, vmf->orig_pte))) {\n"], [3756, "\t\t\t\tspin_unlock(vmf->ptl);\n"], [3757, "\t\t\t\tgoto out;\n"], [3758, "\t\t\t}\n"], [3759, "\n"], [3760, "\t\t\t/*...
[[3753, "vmf->pte = pte_offset_map_lock(vma->vm_mm, vmf->pmd,\n\t\t\t\t\tvmf->address, &vmf->ptl);"], [3755, "if (unlikely(!pte_same(*vmf->pte, vmf->orig_pte)))"], [3756, "spin_unlock(vmf->ptl);"], [3757, "goto out;"], [3758, "\t\t\t}\n"], [3759, "\n"], [3760, "/*\n\t\t\t * Get a page reference while we know the page c...
[ "CVE-2022-3523" ]
[ "CWE-416", "CWE-119" ]
32
{ "Execution Environment": [], "Explanation": null, "External Function": [ "vmf->page->pgmap->ops->migrate_to_ram" ], "Function Argument": [], "Globals": [], "Type Execution Declaration": [ "struct vm_fault", "struct page", "struct dev_pagemap_ops" ] }
33
linux
https://github.com/torvalds/linux
kernel/bpf/verifier.c
179d1c5602997fef5a940c6ddcf31212cbfebd14
bpf: don't prune branches when a scalar is replaced with a pointer This could be made safe by passing through a reference to env and checking for env->allow_ptr_leaks, but it would only work one way and is probably not worth the hassle - not doing it will not directly lead to program rejection. Fixes: f1174f77b50c ("...
true
efa1225f12ed754b1dcae072082ed9ca
regsafe
static bool regsafe(struct bpf_reg_state *rold, struct bpf_reg_state *rcur, struct idpair *idmap) { if (!(rold->live & REG_LIVE_READ)) /* explored state didn't use this */ return true; if (memcmp(rold, rcur, offsetof(struct bpf_reg_state, live)) == 0) return true; if (rold->type == NOT_INIT) /* explo...
[[3470, "\t\t\t/* if we knew anything about the old value, we're not\n"], [3471, "\t\t\t * equal, because we can't know anything about the\n"], [3472, "\t\t\t * scalar value of the pointer in the new value.\n"], [3474, "\t\t\treturn rold->umin_value == 0 &&\n"], [3475, "\t\t\t rold->umax_value == U64_MAX &&\n"], ...
[[3470, "/* if we knew anything about the old value, we're not\n\t\t\t * equal, because we can't know anything about the\n\t\t\t * scalar value of the pointer in the new value.\n\t\t\t */"], [3474, "return rold->umin_value == 0 &&\n\t\t\t rold->umax_value == U64_MAX &&\n\t\t\t rold->smin_value == S64_MIN &&...
[ "CVE-2017-17855" ]
[ "CWE-119" ]
34
{ "Execution Environment": [], "Explanation": null, "External Function": [ "tnum_is_unknown" ], "Function Argument": [], "Globals": [], "Type Execution Declaration": [ "U64_MAX", "S64_MIN" ] }
34
linux
https://github.com/torvalds/linux
kernel/bpf/verifier.c
179d1c5602997fef5a940c6ddcf31212cbfebd14
bpf: don't prune branches when a scalar is replaced with a pointer This could be made safe by passing through a reference to env and checking for env->allow_ptr_leaks, but it would only work one way and is probably not worth the hassle - not doing it will not directly lead to program rejection. Fixes: f1174f77b50c ("...
false
5f6d745208838c9654712c9620472a78
regsafe
static bool regsafe(struct bpf_reg_state *rold, struct bpf_reg_state *rcur, struct idpair *idmap) { if (!(rold->live & REG_LIVE_READ)) /* explored state didn't use this */ return true; if (memcmp(rold, rcur, offsetof(struct bpf_reg_state, live)) == 0) return true; if (rold->type == NOT_INIT) /* explo...
[[3470, "\t\t\t/* We're trying to use a pointer in place of a scalar.\n"], [3471, "\t\t\t * Even if the scalar was unbounded, this could lead to\n"], [3472, "\t\t\t * pointer leaks because scalars are allowed to leak\n"], [3473, "\t\t\t * while pointers are not. We could make this safe in\n"], [3474, "\t\t\t * special ...
[[3470, "/* We're trying to use a pointer in place of a scalar.\n\t\t\t * Even if the scalar was unbounded, this could lead to\n\t\t\t * pointer leaks because scalars are allowed to leak\n\t\t\t * while pointers are not. We could make this safe in\n\t\t\t * special cases if root is calling us, but it's\n\t\t\t * probab...
[ "CVE-2017-17855" ]
[ "CWE-119" ]
34
{ "Execution Environment": [], "Explanation": null, "External Function": [ "tnum_is_unknown" ], "Function Argument": [], "Globals": [], "Type Execution Declaration": [ "U64_MAX", "S64_MIN" ] }
35
linux
https://github.com/torvalds/linux
drivers/net/ethernet/mediatek/mtk_ppe.c
17a5f6a78dc7b8db385de346092d7d9f9dc24df6
net: ethernet: mtk_eth_soc: use after free in __mtk_ppe_check_skb() The __mtk_foe_entry_clear() function frees "entry" so we have to use the _safe() version of hlist_for_each_entry() to prevent a use after free. Fixes: 33fc42de3327 ("net: ethernet: mtk_eth_soc: support creating mac address based offload entries") Sig...
true
854ecd98b68ec4fcd7d7f1340b7fa1f0
__mtk_ppe_check_skb
void __mtk_ppe_check_skb(struct mtk_ppe *ppe, struct sk_buff *skb, u16 hash) { struct hlist_head *head = &ppe->foe_flow[hash / 2]; struct mtk_foe_entry *hwe = &ppe->foe_table[hash]; struct mtk_flow_entry *entry; struct mtk_foe_bridge key = {}; struct ethhdr *eh; bool found = false; u8 *tag; spin_lock_bh(&ppe_l...
[[612, "\thlist_for_each_entry(entry, head, list) {\n"]]
[[612, "\thlist_for_each_entry(entry, head, list) {\n"]]
[ "CVE-2022-3636" ]
[ "CWE-416", "CWE-119" ]
36
{ "Execution Environment": [], "Explanation": null, "External Function": [ "__mtk_foe_entry_clear" ], "Function Argument": [], "Globals": [], "Type Execution Declaration": [] }
36
linux
https://github.com/torvalds/linux
drivers/net/ethernet/mediatek/mtk_ppe.c
17a5f6a78dc7b8db385de346092d7d9f9dc24df6
net: ethernet: mtk_eth_soc: use after free in __mtk_ppe_check_skb() The __mtk_foe_entry_clear() function frees "entry" so we have to use the _safe() version of hlist_for_each_entry() to prevent a use after free. Fixes: 33fc42de3327 ("net: ethernet: mtk_eth_soc: support creating mac address based offload entries") Sig...
false
0eab16ac49e9ae77017812443475b94a
__mtk_ppe_check_skb
void __mtk_ppe_check_skb(struct mtk_ppe *ppe, struct sk_buff *skb, u16 hash) { struct hlist_head *head = &ppe->foe_flow[hash / 2]; struct mtk_foe_entry *hwe = &ppe->foe_table[hash]; struct mtk_flow_entry *entry; struct mtk_foe_bridge key = {}; struct hlist_node *n; struct ethhdr *eh; bool found = false; u8 *tag...
[[603, "\tstruct hlist_node *n;\n"], [613, "\thlist_for_each_entry_safe(entry, n, head, list) {\n"]]
[[603, "struct hlist_node *n;"], [613, "\thlist_for_each_entry_safe(entry, n, head, list) {\n"]]
[ "CVE-2022-3636" ]
[ "CWE-416", "CWE-119" ]
36
{ "Execution Environment": [], "Explanation": null, "External Function": [ "__mtk_foe_entry_clear" ], "Function Argument": [], "Globals": [], "Type Execution Declaration": [] }
37
linux
https://github.com/torvalds/linux
drivers/mtd/spi-nor/cadence-quadspi.c
193e87143c290ec16838f5368adc0e0bc94eb931
mtd: spi-nor: Off by one in cqspi_setup_flash() There are CQSPI_MAX_CHIPSELECT elements in the ->f_pdata array so the > should be >=. Fixes: 140623410536 ('mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Marek Vasut <marex@denx.de> ...
true
0b477c06c2026d64a183015547046464
cqspi_setup_flash
static int cqspi_setup_flash(struct cqspi_st *cqspi, struct device_node *np) { struct platform_device *pdev = cqspi->pdev; struct device *dev = &pdev->dev; struct cqspi_flash_pdata *f_pdata; struct spi_nor *nor; struct mtd_info *mtd; unsigned int cs; int i, ret; /* Get flash device data */ for_each_available_...
[[1085, "\t\tif (cs > CQSPI_MAX_CHIPSELECT) {\n"]]
[[1085, "if (cs > CQSPI_MAX_CHIPSELECT)"]]
[ "CVE-2016-10764" ]
[ "CWE-119" ]
38
{ "Execution Environment": [], "Explanation": null, "External Function": [], "Function Argument": [], "Globals": [ "CQSPI_MAX_CHIPSELECT" ], "Type Execution Declaration": [ "struct cqspi_st" ] }
End of preview. Expand in Data Studio

Dataset Card for Dataset Name

SecVulEval is a collection of real-world C/C++ vulnerabilities.

Dataset Details

Dataset Description

The dataset is curated by collecting C/C++ vulnerability from NVD. It features statement-level vulnerable information, context information for vulnerable functions (is_vulnerable=True), and other metadata such as CVE, CWE, commit information. The dataset contains vulnerable and non-vulnerable function samples.

Dataset Sources

The vulnerabilities (CVEs) are collected from NVD (https://nvd.nist.gov). Then, the corresponding patches to the vulnerabilities are collected from their respective git repositories.

Uses

The dataset comprises both vulnerable (43.23%) and non-vulnerable (56.77%) functions, with a total collection of 25,440 function. This large collection of functions make it suitable for training vulnerability detection model. The statement-level info, along with contextual information can make context-aware detection at finer-grained level possible. The dataset can also be used to evaluate C/C++ vulnerability detection models.

Dataset Structure

The dataset has 15 different fields.

  • The project_url column has 735 different values while the project column has 707 unique values. This is because for project == "Android", there are multiple different repositories.
  • The changed_lines and changed_statements columns include the changes in made in the patch as a list of (line, code) pair. Vulnerable functions include the deleted lines/statements and the non-vulnerable functions has the added lines/statements.
  • Some functions/vulnerabilities can be assigned to more than one CVE/CWE which is why cve_list and cwe_list are given as lists, although in most cases there would be only one CVE and CWE id.
  • The fixed_func_id includes the idx number (first field in the dataset) of the corresponding fixed patch of a vulnerable function. This helps to easily pair the vulnerable functions with their fixing code. For non-vulnerable code it doesn't make sense for a "fixed" version and the fixed_func_id is just itself.
  • The context field includes contextual information for vulnerable functions according to the five categories as discussed in the paper. It is added as the list of symbols and an explanation as generated by the LLM.

Other fields are self-explanatory.

Downloads last month
265