aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorEric Sesterhenn <snakebyte@gmx.de>2006-03-26 18:33:07 +0200
committerAdrian Bunk <bunk@stusta.de>2006-03-26 18:33:07 +0200
commit606f44228e257ea1e35557c2fec7133cca634096 (patch)
treed9cb9c5173079c1d03f917ab7e81871f0c226368 /drivers
parentf02e1fafb534459522a8c46bc46b32820684623e (diff)
downloadlinux-606f44228e257ea1e35557c2fec7133cca634096.tar.gz
BUG_ON() Conversion in drivers/s390/block/dasd_devmap.c
this changes if() BUG(); constructs to BUG_ON() which is cleaner, contains unlikely() and can better optimized away. Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de> Signed-off-by: Adrian Bunk <bunk@stusta.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/s390/block/dasd_devmap.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c
index 2f720108a7e07..c1c6f13811500 100644
--- a/drivers/s390/block/dasd_devmap.c
+++ b/drivers/s390/block/dasd_devmap.c
@@ -437,8 +437,7 @@ dasd_forget_ranges(void)
spin_lock(&dasd_devmap_lock);
for (i = 0; i < 256; i++) {
list_for_each_entry_safe(devmap, n, &dasd_hashlists[i], list) {
- if (devmap->device != NULL)
- BUG();
+ BUG_ON(devmap->device != NULL);
list_del(&devmap->list);
kfree(devmap);
}
@@ -547,8 +546,7 @@ dasd_delete_device(struct dasd_device *device)
/* First remove device pointer from devmap. */
devmap = dasd_find_busid(device->cdev->dev.bus_id);
- if (IS_ERR(devmap))
- BUG();
+ BUG_ON(IS_ERR(devmap));
spin_lock(&dasd_devmap_lock);
if (devmap->device != device) {
spin_unlock(&dasd_devmap_lock);
value='0' selected='selected'>unified
authorFan Ni <fan.ni@samsung.com>2022-12-15 17:09:14 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-02-14 19:11:52 +0100
commita04c7d062b537ff787d00da95bdfe343260d4beb (patch)
tree12e0d025f9a17ea462efd0f0ffb6afc32b2f7acd
parent01815a1caf2fec67910a7fb108241b22699e6590 (diff)
downloadlinux-a04c7d062b537ff787d00da95bdfe343260d4beb.tar.gz
cxl/region: Fix null pointer dereference for resetting decoder
commit 4fa4302d6dc7de7e8e74dc7405611a2efb4bf54b upstream. Not all decoders have a reset callback. The CXL specification allows a host bridge with a single root port to have no explicit HDM decoders. Currently the region driver assumes there are none. As such the CXL core creates a special pass through decoder instance without a commit/reset callback. Prior to this patch, the ->reset() callback was called unconditionally when calling cxl_region_decode_reset. Thus a configuration with 1 Host Bridge, 1 Root Port, and one directly attached CXL type 3 device or multiple CXL type 3 devices attached to downstream ports of a switch can cause a null pointer dereference. Before the fix, a kernel crash was observed when we destroy the region, and a pass through decoder is reset. The issue can be reproduced as below, 1) create a region with a CXL setup which includes a HB with a single root port under which a memdev is attached directly. 2) destroy the region with cxl destroy-region regionX -f. Fixes: 176baefb2eb5 ("cxl/hdm: Commit decoder state to hardware") Cc: <stable@vger.kernel.org> Signed-off-by: Fan Ni <fan.ni@samsung.com> Reviewed-by: Davidlohr Bueso <dave@stgolabs.net> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Tested-by: Gregory Price <gregory.price@memverge.com> Reviewed-by: Gregory Price <gregory.price@memverge.com> Link: https://lore.kernel.org/r/20221215170909.2650271-1-fan.ni@samsung.com Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>