Skip to content

Commit

Permalink
Merge tag 'v4.4.292' of git://git.kernel.org/pub/scm/linux/kernel/git…
Browse files Browse the repository at this point in the history
…/stable/linux into eas

This is the 4.4.292 stable release
  • Loading branch information
SreekanthPalakurthi committed Jun 27, 2022
2 parents f179d7d + 18dc3b9 commit 7c63d91
Show file tree
Hide file tree
Showing 16 changed files with 217 additions and 92 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
VERSION = 4
PATCHLEVEL = 4
SUBLEVEL = 291
SUBLEVEL = 292
EXTRAVERSION =
NAME = Blurry Fish Butt

Expand Down
3 changes: 0 additions & 3 deletions drivers/amba/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,6 @@ int amba_device_add(struct amba_device *dev, struct resource *parent)
void __iomem *tmp;
int i, ret;

WARN_ON(dev->irq[0] == (unsigned int)-1);
WARN_ON(dev->irq[1] == (unsigned int)-1);

ret = request_resource(parent, &dev->res);
if (ret)
goto err_out;
Expand Down
35 changes: 25 additions & 10 deletions drivers/infiniband/hw/qib/qib_user_sdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <linux/rbtree.h>
#include <linux/spinlock.h>
#include <linux/delay.h>
#include <linux/overflow.h>

#include "qib.h"
#include "qib_user_sdma.h"
Expand Down Expand Up @@ -606,7 +607,7 @@ static int qib_user_sdma_coalesce(const struct qib_devdata *dd,
/*
* How many pages in this iovec element?
*/
static int qib_user_sdma_num_pages(const struct iovec *iov)
static size_t qib_user_sdma_num_pages(const struct iovec *iov)
{
const unsigned long addr = (unsigned long) iov->iov_base;
const unsigned long len = iov->iov_len;
Expand Down Expand Up @@ -662,7 +663,7 @@ static void qib_user_sdma_free_pkt_frag(struct device *dev,
static int qib_user_sdma_pin_pages(const struct qib_devdata *dd,
struct qib_user_sdma_queue *pq,
struct qib_user_sdma_pkt *pkt,
unsigned long addr, int tlen, int npages)
unsigned long addr, int tlen, size_t npages)
{
struct page *pages[8];
int i, j;
Expand Down Expand Up @@ -726,7 +727,7 @@ static int qib_user_sdma_pin_pkt(const struct qib_devdata *dd,
unsigned long idx;

for (idx = 0; idx < niov; idx++) {
const int npages = qib_user_sdma_num_pages(iov + idx);
const size_t npages = qib_user_sdma_num_pages(iov + idx);
const unsigned long addr = (unsigned long) iov[idx].iov_base;

ret = qib_user_sdma_pin_pages(dd, pq, pkt, addr,
Expand Down Expand Up @@ -828,8 +829,8 @@ static int qib_user_sdma_queue_pkts(const struct qib_devdata *dd,
unsigned pktnw;
unsigned pktnwc;
int nfrags = 0;
int npages = 0;
int bytes_togo = 0;
size_t npages = 0;
size_t bytes_togo = 0;
int tiddma = 0;
int cfur;

Expand Down Expand Up @@ -889,7 +890,11 @@ static int qib_user_sdma_queue_pkts(const struct qib_devdata *dd,

npages += qib_user_sdma_num_pages(&iov[idx]);

bytes_togo += slen;
if (check_add_overflow(bytes_togo, slen, &bytes_togo) ||
bytes_togo > type_max(typeof(pkt->bytes_togo))) {
ret = -EINVAL;
goto free_pbc;
}
pktnwc += slen >> 2;
idx++;
nfrags++;
Expand All @@ -908,10 +913,10 @@ static int qib_user_sdma_queue_pkts(const struct qib_devdata *dd,
}

if (frag_size) {
int pktsize, tidsmsize, n;
size_t tidsmsize, n, pktsize, sz, addrlimit;

n = npages*((2*PAGE_SIZE/frag_size)+1);
pktsize = sizeof(*pkt) + sizeof(pkt->addr[0])*n;
pktsize = struct_size(pkt, addr, n);

/*
* Determine if this is tid-sdma or just sdma.
Expand All @@ -926,14 +931,24 @@ static int qib_user_sdma_queue_pkts(const struct qib_devdata *dd,
else
tidsmsize = 0;

pkt = kmalloc(pktsize+tidsmsize, GFP_KERNEL);
if (check_add_overflow(pktsize, tidsmsize, &sz)) {
ret = -EINVAL;
goto free_pbc;
}
pkt = kmalloc(sz, GFP_KERNEL);
if (!pkt) {
ret = -ENOMEM;
goto free_pbc;
}
pkt->largepkt = 1;
pkt->frag_size = frag_size;
pkt->addrlimit = n + ARRAY_SIZE(pkt->addr);
if (check_add_overflow(n, ARRAY_SIZE(pkt->addr),
&addrlimit) ||
addrlimit > type_max(typeof(pkt->addrlimit))) {
ret = -EINVAL;
goto free_pbc;
}
pkt->addrlimit = addrlimit;

if (tiddma) {
char *tidsm = (char *)pkt + pktsize;
Expand Down
45 changes: 29 additions & 16 deletions drivers/net/usb/hso.c
Original file line number Diff line number Diff line change
Expand Up @@ -2522,7 +2522,7 @@ static struct hso_device *hso_create_net_device(struct usb_interface *interface,
hso_net_init);
if (!net) {
dev_err(&interface->dev, "Unable to create ethernet device\n");
goto exit;
goto err_hso_dev;
}

hso_net = netdev_priv(net);
Expand All @@ -2535,54 +2535,67 @@ static struct hso_device *hso_create_net_device(struct usb_interface *interface,
USB_DIR_IN);
if (!hso_net->in_endp) {
dev_err(&interface->dev, "Can't find BULK IN endpoint\n");
goto exit;
goto err_net;
}
hso_net->out_endp = hso_get_ep(interface, USB_ENDPOINT_XFER_BULK,
USB_DIR_OUT);
if (!hso_net->out_endp) {
dev_err(&interface->dev, "Can't find BULK OUT endpoint\n");
goto exit;
goto err_net;
}
SET_NETDEV_DEV(net, &interface->dev);
SET_NETDEV_DEVTYPE(net, &hso_type);

/* registering our net device */
result = register_netdev(net);
if (result) {
dev_err(&interface->dev, "Failed to register device\n");
goto exit;
}

/* start allocating */
for (i = 0; i < MUX_BULK_RX_BUF_COUNT; i++) {
hso_net->mux_bulk_rx_urb_pool[i] = usb_alloc_urb(0, GFP_KERNEL);
if (!hso_net->mux_bulk_rx_urb_pool[i]) {
dev_err(&interface->dev, "Could not allocate rx urb\n");
goto exit;
goto err_mux_bulk_rx;
}
hso_net->mux_bulk_rx_buf_pool[i] = kzalloc(MUX_BULK_RX_BUF_SIZE,
GFP_KERNEL);
if (!hso_net->mux_bulk_rx_buf_pool[i])
goto exit;
goto err_mux_bulk_rx;
}
hso_net->mux_bulk_tx_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!hso_net->mux_bulk_tx_urb) {
dev_err(&interface->dev, "Could not allocate tx urb\n");
goto exit;
goto err_mux_bulk_rx;
}
hso_net->mux_bulk_tx_buf = kzalloc(MUX_BULK_TX_BUF_SIZE, GFP_KERNEL);
if (!hso_net->mux_bulk_tx_buf)
goto exit;
goto err_free_tx_urb;

add_net_device(hso_dev);

/* registering our net device */
result = register_netdev(net);
if (result) {
dev_err(&interface->dev, "Failed to register device\n");
goto err_free_tx_buf;
}

hso_log_port(hso_dev);

hso_create_rfkill(hso_dev, interface);

return hso_dev;
exit:
hso_free_net_device(hso_dev);

err_free_tx_buf:
remove_net_device(hso_dev);
kfree(hso_net->mux_bulk_tx_buf);
err_free_tx_urb:
usb_free_urb(hso_net->mux_bulk_tx_urb);
err_mux_bulk_rx:
for (i = 0; i < MUX_BULK_RX_BUF_COUNT; i++) {
usb_free_urb(hso_net->mux_bulk_rx_urb_pool[i]);
kfree(hso_net->mux_bulk_rx_buf_pool[i]);
}
err_net:
free_netdev(net);
err_hso_dev:
kfree(hso_dev);
return NULL;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/rsi/rsi_91x_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static int rsi_usb_card_write(struct rsi_hw *adapter,
buf,
len,
&transfer,
HZ * 5);
USB_CTRL_SET_TIMEOUT);

if (status < 0) {
rsi_dbg(ERR_ZONE,
Expand Down
4 changes: 3 additions & 1 deletion drivers/scsi/scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -936,8 +936,10 @@ EXPORT_SYMBOL(scsi_device_get);
*/
void scsi_device_put(struct scsi_device *sdev)
{
module_put(sdev->host->hostt->module);
struct module *mod = sdev->host->hostt->module;

put_device(&sdev->sdev_gendev);
module_put(mod);
}
EXPORT_SYMBOL(scsi_device_put);

Expand Down
9 changes: 9 additions & 0 deletions drivers/scsi/scsi_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,12 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work)
struct device *parent;
struct list_head *this, *tmp;
unsigned long flags;
struct module *mod;

sdev = container_of(work, struct scsi_device, ew.work);

mod = sdev->host->hostt->module;

scsi_dh_release_device(sdev);

parent = sdev->sdev_gendev.parent;
Expand Down Expand Up @@ -430,11 +433,17 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work)

if (parent)
put_device(parent);
module_put(mod);
}

static void scsi_device_dev_release(struct device *dev)
{
struct scsi_device *sdp = to_scsi_device(dev);

/* Set module pointer as NULL in case of module unloading */
if (!try_module_get(sdp->host->hostt->module))
sdp->host->hostt->module = NULL;

execute_in_process_context(scsi_device_dev_release_usercontext,
&sdp->ew);
}
Expand Down
Loading

0 comments on commit 7c63d91

Please sign in to comment.